I’m trying to keep a conversation going using the completion() method with OpenAI PHP SDK.
- Prompt #1: "How Are You?"
- Prompt #2: "What I asked you before?"
but the AI seems to forget what i asked before. and it reply with random answers to the second prompt.
The code i’m using for the 2 calls are these:
$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 am I missing? How can i keep the session alive between these two calls in order to make the AI remember what I asked before?
2
Answers
Second answer, as the first one did not answer OP’s question.
Based on this OpenAI Playground Example, a ‘conversation’ can only be ‘asked’ by sending both the command to the API.
Don’t think there is a way of keep the conversation going after retreiving a response.
Consider this example, were we send the following text:
The response I get is:
Code used for this:
Note the
stop
array that, quoted from the documentation:This seems to let the AI know where to ‘read’ and where to ‘write’
If you remove that param from the request, it returns without the answer:
The same problem is here 🙁 Kind of a dream to develop a relationship with AI to keep a conversation but apparently, every request triggers a new session, according to my experience you have to send a full text to AI (davinci for me now)to get what you want.
Rep: