関数呼び出しを使用すると、データベース、顧客管理システム、ドキュメント リポジトリなどのリアルタイムの情報やサービスとやり取りできる Gemini ベースのアプリケーションとエージェントを作成できます。これにより、関連性の高いコンテキストに沿ったレスポンスをアプリケーションが提供できるようになります。
教師ありファインチューニングでは、独自のチューニング データセットを使用して、アプリケーションの関数呼び出しベースのレスポンスの全体的な精度を向上させることができます。
サポートされているモデル
関数呼び出しのチューニングは、次の Gemini モデルでサポートされています。
gemini-2.0-flash-001
チューニング用データセットの形式
ファインチューニング データセットの fileUri
は、Cloud Storage バケット内のファイルの URI にすることも、一般公開されている HTTP または HTTPS URL にすることもできます。
汎用形式の例については、Gemini のデータセットの例をご覧ください。
次のセクションでは、関数呼び出しのチューニング ジョブの作成に使用する関数呼び出しデータセットの例を示します。
テキスト生成のための関数呼び出しのチューニング
関数呼び出しを使用して単一のテキスト レスポンスを生成するチューニング用のデータセットの例を次に示します。
{
"system_instruction": {
"role": "system",
"parts": [
{
"text": "You are an assistant that helps users find the best product for them."
}
]
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "Do you have the White Pixel 8 Pro 128GB in stock in the US?"
}
]
},
{
"role": "model",
"parts": [
{
"functionCall": {
"name": "get_product_sku",
"args": {
"product_name": "Pixel 8 Pro 128GB"
}
}
}
]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_product_sku",
"description": "Get the available inventory for a Google products, e.g: Pixel phones, Pixel Watches, Google Home etc",
"parameters": {
"type": "OBJECT",
"properties": {
"product_name": {
"type": "STRING",
"description": "Product name",
"enum": [
"Pixel 8 Pro 128GB",
"Pixel 8 Pro 256GB",
"Pixel 8 Pro 512GB",
"Pixel 8 Pro 1TB"
]
}
}
}
},
{
"name": "get_store_location",
"description": "Get the location of the closest store",
"parameters": {
"type": "OBJECT",
"properties": {
"location": {
"type": "STRING",
"description": "Location"
}
}
}
}
]
}
]
}
チャット セッションをサポートするように関数呼び出しをチューニングする
以下は、チャット セッションをサポートする関数呼び出しをチューニングするためのデータセットの例です。
{
"system_instruction": {
"role": "system",
"parts": [
{
"text": "You are an assistant that helps users find the best product for them."
}
]
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "Do you have the Porcelain Pixel 8 Pro 128GB in stock in the US?"
}
]
},
{
"role": "model",
"parts": [
{
"functionCall": {
"name": "get_product_sku",
"args": {
"product_name": "Pixel 8 Pro 128GB"
}
}
}
]
},
{
"parts": [
{
"functionResponse": {
"name": "get_product_sku",
"response": {
"output": "True"
}
}
}
]
},
{
"role": "model",
"parts": [
{
"text": "Yes, we have the Porcelain Pixel 8 Pro 128GB in stock in the US."
}
]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_product_sku",
"description": "Get the available inventory for a Google products, e.g: Pixel phones, Pixel Watches, Google Home etc",
"parameters": {
"type": "OBJECT",
"properties": {
"product_name": {
"type": "STRING",
"description": "Product name",
"enum": [
"Pixel 8 Pro 128GB",
"Pixel 8 Pro 256GB",
"Pixel 8 Pro 512GB",
"Pixel 8 Pro 1TB"
]
}
}
}
},
{
"name": "get_store_location",
"description": "Get the location of the closest store",
"parameters": {
"type": "OBJECT",
"properties": {
"location": {
"type": "STRING",
"description": "Location"
}
}
}
}
]
}
]
}
並列関数呼び出しのチューニング
並列関数呼び出しをチューニングするためのデータセットの例を次に示します。
{
"system_instruction": {
"role": "system",
"parts": [
{
"text": "You are an assistant that helps users find the best product for them."
}
]
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "Where is the closest Google Store to Mountain View, CA that has Pixel 8 Pro 128GB in stock?"
}
]
},
{
"role": "model",
"parts": [
{
"functionCall": {
"name": "get_product_sku",
"args": {
"product_name": "Pixel 8 Pro 128GB"
}
}
},
{
"functionCall": {
"name": "get_store_location",
"args": {
"location": "Mountain View, CA"
}
}
}
]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_product_sku",
"description": "Get the available inventory for a Google products, e.g: Pixel phones, Pixel Watches, Google Home etc",
"parameters": {
"type": "OBJECT",
"properties": {
"product_name": {
"type": "STRING",
"description": "Product name",
"enum": [
"Pixel 8 Pro 128GB",
"Pixel 8 Pro 256GB",
"Pixel 8 Pro 512GB",
"Pixel 8 Pro 1TB"
]
}
}
}
},
{
"name": "get_store_location",
"description": "Get the location of the closest store",
"parameters": {
"type": "OBJECT",
"properties": {
"location": {
"type": "STRING",
"description": "Location"
}
}
}
}
]
}
]
}
次のステップ
- チューニング ジョブの作成方法とチューニング済みモデルのテスト方法については、教師ありファインチューニングを使用して Gemini モデルをチューニングするをご覧ください。
- Gemini モデルのチューニングについては、チューニングの概要をご覧ください。
- 関数呼び出しの詳細については、関数呼び出しの概要をご覧ください。