Hello,
I am exploring the possibility of transitioning away from assistants (which are slow and still in beta), and this involves creating a conversation history for the completions API. Since I use function calling, I am uncertain about how to incorporate previous function calls into the conversation history (appropriate message format?). Should I include only the returned function values, or also the calls themselves?
The scenario I wish to address is as follows:
USER: How many apples are required for the āApple pieā recipe?
FUNCTION CALL: retrieve_recipe(āApple pieā)
FUNCTION CALL RESULT: { āapplesā: 2, ācarrotsā: 1 }
ASSISTANT: You need 2 apples.
Now, if I subsequently inquire about the number of carrots, I want the model to retrieve the data from the previous result without making another function call, for example:
USER: Ok, and how many carrots?
ā NO FUNCTION CALL REQUIRED, RETRIEVE ANSWER FROM PREVIOUS JSON
ASSISTANT: You need 1 carrot.
You need the concept of hidden thoughts. Include results from all function calls. Then include those hidden thoughts in the prompt history you send to LLM each time but donāt show them to user (or hide them behind a toggle)
Thanks, sure my idea is to include something hidden in prompt history. But are function call answers enough or do I also need function call requests? Are call_id required or no?
How āminimalā can be messages and what format to use for them to work?
Thanks!
Hi! This interests me, when you refer to hidden thoughts, exactly what needs to be done? At the moment I am migrating to completions and with the context I donāt know how to work it, currently I am leaving the last 10 messages as open ai does in the messages array.
Thatās one layer. The other layer is ābehind the scenes thinkingā (which is what assistants API does and thereās an even more sophisticated version going on with āreasoningā models). This is what you need to replicate when you move to Completions.
Yep. Creating a prompt machine that fills the context on the fly.
But it is not really carrots and apples in real world applications. It can be thousands of pages of documents structured im chunks and labled with millions of labels.