Commit
•
bb6c4ca
1
Parent(s):
e1ef90b
Update README.md
Browse files
README.md
CHANGED
@@ -162,15 +162,14 @@ Please make sure you include a docstring in the same format as this example!
|
|
162 |
If the model makes a tool call, you can append the tool call to the conversation like so:
|
163 |
|
164 |
```python
|
165 |
-
tool_call_id = "vAHdf3" # Random ID, should be unique for each tool call
|
166 |
tool_call = {"name": "multiply", "arguments": {"a": "6", "b": "7"}}
|
167 |
-
messages.append({"role": "assistant", "tool_calls": [{
|
168 |
```
|
169 |
|
170 |
Next, call the tool function and append the tool result:
|
171 |
|
172 |
```python
|
173 |
-
messages.append({"role": "tool", "
|
174 |
```
|
175 |
|
176 |
And finally apply the chat template to the updated `messages` list and `generate()` text once again to continue the conversation.
|
|
|
162 |
If the model makes a tool call, you can append the tool call to the conversation like so:
|
163 |
|
164 |
```python
|
|
|
165 |
tool_call = {"name": "multiply", "arguments": {"a": "6", "b": "7"}}
|
166 |
+
messages.append({"role": "assistant", "tool_calls": [{type": "function", "function": tool_call}]})
|
167 |
```
|
168 |
|
169 |
Next, call the tool function and append the tool result:
|
170 |
|
171 |
```python
|
172 |
+
messages.append({"role": "tool", "name": "multiply", "content": "42"})
|
173 |
```
|
174 |
|
175 |
And finally apply the chat template to the updated `messages` list and `generate()` text once again to continue the conversation.
|