File size: 2,483 Bytes
ecf5250
 
 
85ff8c7
2057304
 
85ff8c7
2057304
85ff8c7
 
 
2057304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0690ce0
2057304
 
85ff8c7
2057304
 
7e292f1
 
2057304
69e8b1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
license: llama3
---
### Function Calling Llama by ScaleGenAI


## This model is intended for use in environments where automated function calling capabilities are required to enhance data manipulation and retrieval tasks. It is particularly useful in scenarios involving complex data analysis, where users can query data interactively through natural language commands.

### The model has a specific format for tool calling that is :

```
<|begin_of_text|>
<|start_header_id|>system<|end_header_id|>
        Only use these tools while answering
        **python_repl_tool** - Run python code on the dataframe.
          Parameters:
            code: python code to run in the exec function.
            chain_of_thought: chain of thought behind using the tool
this is what my dataframe looks like :
                                  Financials                 Metrics          Flags
                          Revenue    Expenses    Profit    ROI    Valid    Outlier
Year Quarter Region
2021 Q1      North     120000.0     85000.0     35000.0    0.29   True     False
             South     95000.0      55000.0     40000.0    0.42   False    False
     Q2      North     130000.0     60000.0     70000.0    0.54   True     True
             South     100000.0     70000.0     30000.0    0.30   True     False
2022 Q1      North     125000.0     75000.0     50000.0    0.40   False    False

<|eot_id|>
<|start_header_id|>user<|end_header_id|>
What is year 2021 quarter 1 revenue for region North??
<|eot_id|>
<|start_header_id|>assistant<|end_header_id|>
function_call: {"name": "python_repl_tool", "arguments": {"code": "df.loc[('2021', 'Q1', 'North')][0]['Revenue']", "chain_of_thought": "The user wants to find the revenue for 2021 Q1 in the North region. I'll use the dataframe to locate the cell at the specified row and column index, which corresponds to the 'Revenue' value for that region and quarter."}}
<|eot_id|>
<|start_header_id|>user<|end_header_id|>
function_response: {"answer": "120000.0"}
<|eot_id|>
<|start_header_id|>assistant<|end_header_id|>
```


#### Ai will respond with function_call if it needs to call a function lile : function_call {tool args in json}
#### User will respond with either error or the response if it was a tool like : function_response {json response}

#### Tools can also take chain of thought as a parameter : Chain of thought increases the chances of getting better responses as each function is equipped with reasoning by the llm