You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the pandas dataframe prompts and examples, we got inspiration from the recent work of [Ye et al. 2024](https://arxiv.org/abs/2401.15463).
374
375
376
+
## Function Calling
377
+
378
+
You can also use the Code Llama models for function calling. However, the Code Llama 70B Instruct model provided via the together.ai APIs currently don't support this feature. So for now we went ahead and provided an example with the Code Llama 34B Instruct model instead.
379
+
380
+
```python
381
+
tools = [
382
+
{
383
+
"type": "function",
384
+
"function": {
385
+
"name": "get_current_weather",
386
+
"description": "Get the current weather in a given location",
387
+
"parameters": {
388
+
"type": "object",
389
+
"properties": {
390
+
"location": {
391
+
"type": "string",
392
+
"description": "The city and state, e.g. San Francisco, CA"
393
+
},
394
+
"unit": {
395
+
"type": "string",
396
+
"enum": [
397
+
"celsius",
398
+
"fahrenheit"
399
+
]
400
+
}
401
+
}
402
+
}
403
+
}
404
+
}
405
+
]
406
+
407
+
messages = [
408
+
{"role": "system", "content": "You are a helpful assistant that can access external functions. The responses from these function calls will be appended to this dialogue. Please provide responses based on the information from these function calls."},
409
+
{"role": "user", "content": "What is the current temperature of New York, San Francisco and Chicago?"}
There are some scenarios where the model will refuse to respond because of the safety alignment it has undergone. As an example, the model sometimes refuses to answer the prompt request below. It can be fixed by rephrasing the prompt or removing the `system` prompt.
0 commit comments