instructor icon indicating copy to clipboard operation
instructor copied to clipboard

Return Tool Id With Parallel Tool Calling

Open tarunamasa opened this issue 1 year ago • 1 comments

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.)

tarunamasa avatar Feb 08 '24 05:02 tarunamasa

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

jxnl avatar Feb 08 '24 14:02 jxnl

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:

  1. Add the chat competition from the raw response to the messages array, this contains the references to the tool_calls described here.
  2. 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

ls-jason-rossiter avatar Jun 21 '24 02:06 ls-jason-rossiter