From 3720c132601eed013a93674c275f2d25ea60ec9a Mon Sep 17 00:00:00 2001 From: Sandro Gehri Date: Sun, 12 Nov 2023 08:34:35 +0100 Subject: [PATCH] Update facade and factory for the assistants api --- composer.json | 2 +- src/Facades/OpenAI.php | 2 ++ src/ServiceProvider.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2fbd65e..df50c88 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "php": "^8.1.0", "guzzlehttp/guzzle": "^7.7.0", "laravel/framework": "^9.46.0|^10.14.1", - "openai-php/client": "^0.7.8" + "openai-php/client": "dev-add-assistant-api" }, "require-dev": { "laravel/pint": "^1.10.3", diff --git a/src/Facades/OpenAI.php b/src/Facades/OpenAI.php index f4d9355..ffd0294 100644 --- a/src/Facades/OpenAI.php +++ b/src/Facades/OpenAI.php @@ -10,6 +10,7 @@ use OpenAI\Responses\StreamResponse; /** + * @method static \OpenAI\Resources\Assistants assistants() * @method static \OpenAI\Resources\Audio audio() * @method static \OpenAI\Resources\Chat chat() * @method static \OpenAI\Resources\Completions completions() @@ -20,6 +21,7 @@ * @method static \OpenAI\Resources\Images images() * @method static \OpenAI\Resources\Models models() * @method static \OpenAI\Resources\Moderations moderations() + * @method static \OpenAI\Resources\Threads threads() */ final class OpenAI extends Facade { diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index ad04878..e7d3344 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -32,6 +32,7 @@ public function register(): void return OpenAI::factory() ->withApiKey($apiKey) ->withOrganization($organization) + ->withHttpHeader('OpenAI-Beta', 'assistants=v1') ->withHttpClient(new \GuzzleHttp\Client(['timeout' => config('openai.request_timeout', 30)])) ->make(); });