instructor
instructor copied to clipboard
Return Tool Id With Parallel Tool Calling
Can then use this to repack the answers to these tools into the next llm response.
https://platform.openai.com/docs/guides/function-calling (e.g.)
This is great.
Should this be needed for single calls too?
Would you want to just have a _tool_id attribute?
Or do you want to set
This was marked as completed but I can't seem to find a way to retrieve the tool calls completion history and their IDs when using parallel function calling.
When working on the next LLM request I need to add these tool call results back to the messages array:
- Add the chat competition from the raw response to the messages array, this contains the references to the
tool_calls
described here. - Retrieve the tool call ID so that each of the tool call results can be added to the messages array referencing the correct tool call ID.
Do you have any recommendations on how to do this? I can't find it in the docs.
I've also tried using resp, completion = client.chat.completions.create_with_completion
but the generator does not contain the raw response: https://github.com/jxnl/instructor/blob/main/instructor/process_response.py#L90-L98