🚀 Functionary-medium-v2.2 モデルカード
Functionaryは、関数やプラグインを解釈して実行できる言語モデルです。このモデルは、関数をいつ実行するか、並列または直列で実行するかを判断し、その出力を理解することができます。必要に応じてのみ関数をトリガーします。関数定義は、OpenAI GPTの関数呼び出しと同様に、JSONスキーマオブジェクトとして与えられます。
https://github.com/MeetKai/functionary

🚀 クイックスタート
Functionaryは、関数やプラグインを解釈して実行する能力を持つ言語モデルです。このモデルは、関数の実行タイミングや実行方法(並列または直列)を判断し、その出力を理解することができます。
✨ 主な機能
- インテリジェントな並列ツール使用
- 関数やツールの出力を分析し、その出力に基づいた適切な応答を提供する能力
- ツールや関数を使用しないタイミングを判断し、通常のチャット応答を提供する能力
- GPT - 4に代わる優れたオープンソースの代替手段
📊 性能
当社のモデルは、社内データセットにおける関数呼び出し精度で最先端の性能を達成しています。精度指標は、予測された関数呼び出しの全体的な正確性を測定し、関数名の予測と引数の抽出を含みます。

データセット |
モデル名 |
関数呼び出し精度 (名前と引数) |
社内データ |
MeetKai - functionary - small - v2.2 |
0.546 |
社内データ |
MeetKai - functionary - medium - v2.2 |
0.664 |
社内データ |
OpenAI - gpt - 3.5 - turbo - 1106 |
0.531 |
社内データ |
OpenAI - gpt - 4 - 1106 - preview |
0.737 |
📚 ドキュメント
プロンプトテンプレート
当社は、「v2PromptTemplate」と呼ばれる特別に設計されたプロンプトテンプレートを使用しています。このテンプレートは、各ターンを送信者、受信者、内容の部分に分解します。
関数定義をTypeScript定義に似たテキストに変換し、これらの定義をシステムプロンプトとして注入します。その後、デフォルトのシステムプロンプトを注入し、会話メッセージを開始します。
この形式は、当社のvLLMサーバーを通じても利用できます。このサーバーでは、関数をシステムメッセージにカプセル化されたTypeScript定義に変換し、事前定義されたTransformersチャットテンプレートを使用します。つまり、メッセージのリストは、apply_chat_template()メソッドを使用して自動的にフォーマットできます。
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"
)
これにより、以下のような出力が得られます。
<|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?
より詳細な例はこちらで確認できます。
🚀 モデルの実行
ユーザーは、当社のOpenAI互換vLLMサーバーを使用してモデルを実行することをお勧めします。サーバーはこちら
MeetKaiチーム
