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.