Embedded function calling is (currently) designed as an all-in-one solution. runWithTools maintains
Embedded function calling is (currently) designed as an all-in-one solution. runWithTools maintains and adds to a copy of the message history internally, and the final output is always a plain response. (I.e. not a tool call.) When the model's response is a tool call, the matching user-defined function is called and both the tool call and the function's (stringified) return value is appended to the history.
In your example, the internal message history might look something like this after the first "iteration".
Inference is run again with this as input and the result might be something like 'I have successfully updated the key-value pair for you. The value of "banana" is now set to "yellow" in the database.'
In your example, the internal message history might look something like this after the first "iteration".
Inference is run again with this as input and the result might be something like 'I have successfully updated the key-value pair for you. The value of "banana" is now set to "yellow" in the database.'




