You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please append ai response to as another element to the messages array, The request should be dynamic
<?php
require __DIR__ . '/vendor/autoload.php'; // remove this line if you use a PHP Framework.
use Orhanerday\OpenAi\OpenAi;
$open_ai_key = getenv('OPENAI_API_KEY');
$open_ai = new OpenAi($open_ai_key);
$complete = $open_ai->chat([
'model' => 'gpt-3.5-turbo',
'messages' => [
[
"role" => "system",
"content" => "You are a helpful assistant."
],
[
"role" => "user",
"content" => "Who won the world series in 2020?"
],
[
"role" => "assistant",
"content" => "The Los Angeles Dodgers won the World Series in 2020."
],
[
"role" => "user",
"content" => "Where was it played?"
],
[
"role" => "assistant",
"content" => "Los Angeles"
],
[
"role" => "user",
"content" => "Where is Los Angeles?"
],
],
'temperature' => 1.0,
'max_tokens' => 4000,
'frequency_penalty' => 0,
'presence_penalty' => 0,
]);
var_dump($complete);
Describe the bug
When script send next request to chat API, it returns different response, how can we continue same thread?
To Reproduce
Continue thread
Code snippets
No response
OS
MAC
PHP version
PHP latest
Library version
latest
The text was updated successfully, but these errors were encountered: