🚀 Functionary-small-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サーバーを使用してモデルを実行することをお勧めします。サーバーはこちら
📸 チーム紹介
