From 6948ff2448ed8fdc77bf0dbd34c92ea1858f0fba Mon Sep 17 00:00:00 2001 From: ogrre Date: Wed, 27 Sep 2023 17:09:14 +0200 Subject: [PATCH] add openai model setting --- config/chatgpt.php | 9 +++++++++ src/Models/Chat.php | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/chatgpt.php b/config/chatgpt.php index 9cfb58e..e149c6b 100644 --- a/config/chatgpt.php +++ b/config/chatgpt.php @@ -2,6 +2,15 @@ return [ + 'openai' => [ + + /* + * + */ + + 'model' => env('OPENAI_MODEL', 'gpt-3.5-turbo') + ], + 'models' => [ /* diff --git a/src/Models/Chat.php b/src/Models/Chat.php index ded2867..7262a6a 100644 --- a/src/Models/Chat.php +++ b/src/Models/Chat.php @@ -84,7 +84,7 @@ public function gpt(string $prompt) $this->newMessage($prompt, "user"); $response = $this->client->chat()->create([ - 'model' => 'gpt-3.5-turbo', + 'model' => config('chatgpt.openai.model'), 'messages' => $this->list_messages(), ]); @@ -104,7 +104,7 @@ private function title(string $prompt) $content = "RĂ©sume ce prompt en quelques mots pour en faire un titre: " . $prompt; $response = $this->client->chat()->create([ - 'model' => 'gpt-3.5-turbo', + 'model' => config('chatgpt.openai.model'), 'messages' => [ ['role' => 'user', 'content' => $content], ],