๐ Model Card for functionary-medium-v2.2
Functionary is a language model that can interpret and execute functions/plugins, offering a powerful solution for various applications.
https://github.com/MeetKai/functionary

๐ Quick Start
Functionary is a language model capable of interpreting and executing functions/plugins. It can determine when to execute functions, whether in parallel or serially, and understand their outputs. It only triggers functions as needed. Function definitions are given as JSON Schema Objects, similar to OpenAI GPT function calls.
โจ Features
- Intelligent Parallel Tool Use: Enables efficient processing by using tools in parallel.
- Output - Grounded Responses: Analyzes functions/tools outputs and provides relevant responses based on the outputs.
- Smart Tool - Usage Decision: Decides when not to use tools/call functions and provides normal chat responses.
- Open - Source Alternative to GPT - 4: One of the best open - source alternatives to GPT - 4.
๐ Performance
Our model achieves state - of - the - art performance in Function Calling Accuracy on our in - house dataset. The accuracy metric measures the overall correctness of predicted function calls, including function name prediction and arguments extraction.

Dataset |
Model Name |
Function Calling Accuracy (Name & Arguments) |
In - house data |
MeetKai - functionary - small - v2.2 |
0.546 |
In - house data |
MeetKai - functionary - medium - v2.2 |
0.664 |
In - house data |
OpenAI - gpt - 3.5 - turbo - 1106 |
0.531 |
In - house data |
OpenAI - gpt - 4 - 1106 - preview |
0.737 |
๐ Prompt Template
We use a specially designed prompt template called "v2PromptTemplate" that breaks down each turn into from, recipient, and content portions.
We convert function definitions to a text similar 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.
This formatting is also available via our vLLM server, which processes the functions into Typescript definitions encapsulated in a system message and uses 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:
๐ป Usage Examples
Basic Usage
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="functionary")
client.chat.completions.create(
model="path/to/functionary/model/",
messages=[{"role": "user",
"content": "What is the weather for Istanbul?"}
],
tools=[{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
}],
tool_choice="auto"
)
This will yield:
<|from|>system
<|recipient|>all
<|content|>// Supported function definitions that should be called when necessary.
namespace functions {
// Get the current weather
type get_current_weather = (_: {
// The city and state, e.g. San Francisco, CA
location: string,
}) => any;
} // namespace functions
<|from|>system
<|recipient|>all
<|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
<|from|>user
<|recipient|>all
<|content|>What is the weather for Istanbul?
A more detailed example is provided here.
๐ง Run the model
We encourage users to run our models using our OpenAI - compatible vLLM server here.
๐ฅ The MeetKai Team
