diff --git a/docs/source/en/chat_templating.md b/docs/source/en/chat_templating.md index 6564912a8534be..01ff5fed46e149 100644 --- a/docs/source/en/chat_templating.md +++ b/docs/source/en/chat_templating.md @@ -441,6 +441,12 @@ tool_call = {"name": "get_current_temperature", "arguments": {"location": "Paris messages.append({"role": "assistant", "tool_calls": [{"type": "function", "function": tool_call}]}) ``` + + +If you're familiar with the OpenAI API, you should pay attention to an important difference here - the `tool_call` is +a dict, but in the OpenAI API it's a JSON string. Passing a string may cause errors or strange model behaviour! + + Now that we've added the tool call to the conversation, we can call the function and append the result to the conversation. Since we're just using a dummy function for this example that always returns 22.0, we can just append