sarahlmk commited on
Commit
6312169
1 Parent(s): de8d5ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +97 -3
README.md CHANGED
@@ -1,3 +1,97 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model Card for functionary-medium-v2.2
2
+
3
+ [https://github.com/MeetKai/functionary](https://github.com/MeetKai/functionary)
4
+
5
+ ![Functionary Logo](https://huggingface.co/meetkai/functionary-medium-v2.2/resolve/main/functionary_logo.jpg "Functionary Logo")
6
+
7
+ Functionary is a language model that can interpret and execute functions/plugins.
8
+
9
+ The model determines when to execute functions, whether in parallel or serially, and can understand their outputs. It only triggers functions as needed. Function definitions are given as JSON Schema Objects, similar to OpenAI GPT function calls.
10
+
11
+ ## Key Features
12
+
13
+ - Intelligent **parallel tool use**
14
+ - Able to analyze functions/tools outputs and provide relevant responses **grounded in the outputs**
15
+ - Able to decide **when to not use tools/call functions** and provide normal chat response
16
+ - Truly one of the best open-source alternative to GPT-4
17
+ - Support code interpreter
18
+
19
+ Our model achieves state-of-the-art performance in Function Calling Accuracy on SGD dataset. The accuracy metric measures the overall correctness of predicted function calls, including function name prediction and arguments extraction.
20
+
21
+ ![Eval Chart](https://huggingface.co/meetkai/functionary-small-v2.4/resolve/main/SGD_acc_chart.png "Eval Chart")
22
+
23
+ | Dataset | Model Name | Function Calling Accuracy (Name & Arguments) |
24
+ | :-------------| :-------------------| ---------------------------: |
25
+ | SGD | MeetKai-functionary-small-v2.4 | 83.07|
26
+ | SGD | MeetKai-functionary-medium-v2.4 | **88.11**|
27
+ | SGD | OpenAI-gpt-3.5-turbo-1106 | 71.64 |
28
+ | SGD | OpenAI-gpt-4-1106-preview | 76.29 |
29
+
30
+ ## Prompt Template
31
+
32
+ We use a specially designed prompt template which we call "v2PromptTemplate" that breaks down each turns into from, recipient and content portions.
33
+
34
+ We convert function definitions to a similar text to TypeScript definitions. Then we inject these definitions as system prompts. After that, we inject the default system prompt. Then we start the conversation messages.
35
+
36
+ This formatting is also available via our vLLM server which we process the functions into Typescript definitions encapsulated in a system message and use a pre-defined Transformers chat template. This means that lists of messages can be formatted for you with the apply_chat_template() method within our server:
37
+
38
+ ```python
39
+ from openai import OpenAI
40
+
41
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="functionary")
42
+
43
+ client.chat.completions.create(
44
+ model="path/to/functionary/model/",
45
+ messages=[{"role": "user",
46
+ "content": "What is the weather for Istanbul?"}
47
+ ],
48
+ tools=[{
49
+ "type": "function",
50
+ "function": {
51
+ "name": "get_current_weather",
52
+ "description": "Get the current weather",
53
+ "parameters": {
54
+ "type": "object",
55
+ "properties": {
56
+ "location": {
57
+ "type": "string",
58
+ "description": "The city and state, e.g. San Francisco, CA"
59
+ }
60
+ },
61
+ "required": ["location"]
62
+ }
63
+ }
64
+ }],
65
+ tool_choice="auto"
66
+ )
67
+ ```
68
+
69
+ will yield:
70
+
71
+ ```
72
+ <|from|>system
73
+ <|recipient|>all
74
+ <|content|>// Supported function definitions that should be called when necessary.
75
+ namespace functions {
76
+ // Get the current weather
77
+ type get_current_weather = (_: {
78
+ // The city and state, e.g. San Francisco, CA
79
+ location: string,
80
+ }) => any;
81
+ } // namespace functions
82
+ <|from|>system
83
+ <|recipient|>all
84
+ <|content|>A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. The assistant calls functions with appropriate input when necessary
85
+ <|from|>user
86
+ <|recipient|>all
87
+ <|content|>What is the weather for Istanbul?
88
+ ```
89
+
90
+ A more detailed example is provided [here](https://github.com/MeetKai/functionary/blob/main/tests/prompt_test_v2.txt).
91
+
92
+ ## Run the model
93
+
94
+ We encourage users to run our models using our OpenAI-compatible vLLM server [here](https://github.com/MeetKai/functionary).
95
+
96
+ # The MeetKai Team
97
+ ![MeetKai Logo](https://huggingface.co/meetkai/functionary-medium-v2.2/resolve/main/meetkai_logo.png "MeetKai Logo")