I'm trying to use the OpenAI PHP SDK's completion() method to maintain a conversation.
But the artificial intelligence seems to have forgotten the question I asked before. It will randomly answer the second prompt.
The code I used for these two calls is as follows:
$call1 = $open_ai->completion([ 'model' => 'text-davinci-003', 'prompt' => 'How Are You?', ]); $call2 = $open_ai->completion([ 'model' => 'text-davinci-003', 'prompt' => 'What i asked you before?', ]);
What did I miss? How can I keep the session active between these two calls so that the AI remembers what I asked before?
The second answer, becausethe first answerdoes not answer the OP's question.
Based onthis OpenAI Playground example, a "conversation" can only be "asked" by sending two commands to the API.
Don’t think there’s a way to keep the conversation going after receiving a reply.
Consider this example, we send the following text:
The reply I got was:
Code for this purpose: