Skip to content

Commit

Permalink
Add a warning to the chat template docs about the tool_calls format (h…
Browse files Browse the repository at this point in the history
…uggingface#33277)

* Add a warning to the chat template docs

* Add a warning to the chat template docs

* Add a warning to the chat template docs
  • Loading branch information
Rocketknight1 authored Sep 4, 2024
1 parent 2cb543d commit 01c8c6c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/source/en/chat_templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,12 @@ tool_call = {"name": "get_current_temperature", "arguments": {"location": "Paris
messages.append({"role": "assistant", "tool_calls": [{"type": "function", "function": tool_call}]})
```

<Tip warning={true}>

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!

</Tip>

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
Expand Down

0 comments on commit 01c8c6c

Please sign in to comment.