AIモデルの構成の上書き
AIモデルの構成の上書き
ai_agent構成を使用すると、デフォルトのAIモデルの構成を上書きできます。これは、以下のエンドポイントで使用できます。
上書きの例を以下に示します。
- 組織のニーズに基づいて、デフォルトのAIモデルをカスタムのAIモデルに置き換える。
- ベースとなる
promptを微調整し、よりカスタマイズされたユーザーエクスペリエンスを実現する。 temperatureなどのパラメータを変更して、結果の創造性を調整する。
構成のサンプル
ai/askの場合の構成全体は以下のとおりです。
{
"type": "ai_agent_ask",
"basic_text": {
"llm_endpoint_params": {
"type": "openai_params",
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>",
"temperature": 0,
"top_p": 1
},
"model": "azure__openai__gpt_4o_mini",
"num_tokens_for_completion": 8400,
"prompt_template": "It is `{current_date}`, consider these travel options `{content}` and answer the `{user_question}`.",
"system_message": "You are a helpful travel assistant specialized in budget travel"
},
"basic_text_multi": {
"llm_endpoint_params": {
"type": "openai_params",
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>",
"temperature": 0,
"top_p": 1
},
"model": "azure__openai__gpt_4o_mini",
"num_tokens_for_completion": 8400,
"prompt_template": "It is `{current_date}`, consider these travel options `{content}` and answer the `{user_question}`.",
"system_message": "You are a helpful travel assistant specialized in budget travel"
},
"long_text": {
"embeddings": {
"model": "openai__text_embedding_ada_002",
"strategy": {
"id": "basic",
"num_tokens_per_chunk": 64
}
},
"llm_endpoint_params": {
"type": "openai_params",
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>",
"temperature": 0,
"top_p": 1
},
"model": "azure__openai__gpt_4o_mini",
"num_tokens_for_completion": 8400,
"prompt_template": "It is `{current_date}`, consider these travel options `{content}` and answer the `{user_question}`.",
"system_message": "You are a helpful travel assistant specialized in budget travel"
},
"long_text_multi": {
"embeddings": {
"model": "openai__text_embedding_ada_002",
"strategy": {
"id": "basic",
"num_tokens_per_chunk": 64
}
},
"llm_endpoint_params": {
"type": "openai_params",
"frequency_penalty": 1.5,
"presence_penalty": 1.5,
"stop": "<|im_end|>",
"temperature": 0,
"top_p": 1
},
"model": "azure__openai__gpt_4o_mini",
"num_tokens_for_completion": 8400,
"prompt_template": "It is `{current_date}`, consider these travel options `{content}` and answer the `{user_question}`.",
"system_message": "You are a helpful travel assistant specialized in budget travel"
}
}
パラメータセットの相違点
ask、text_gen、extract、extract_structuredに使用できるパラメータのセットは、APIコールに応じて若干異なります。
-
askエンドポイントのエージェント構成には、basic_text、basic_text_multi、long_text、long_text_multiパラメータが含まれます。これは、リクエストの対象となる項目を単一にするか複数にするかを指定するために使用するmodeパラメータが原因です。modeとしてmultiple_item_qaを選択した場合は、上書き用にmultiパラメータも使用できます。 -
text_genのエージェント構成には、テキストの生成に使用されるbasic_genパラメータが含まれます。
LLMエンドポイントパラメータ
llm_endpoint_params構成のオプションは、全体的なAIモデルがGoogleベースか、OpenAIベースか、AWSベースかによって異なります。
たとえば、どちらのllm_endpoint_paramsオブジェクトもtemperatureパラメータを受け入れますが、モデルによって結果が異なります 。
GoogleモデルとAWSモデルの場合、temperatureはレスポンス生成時のサンプリングに使用されます。レスポンス生成はtop-Pとtop-Kが適用された場合に発生します。temperatureは、トークン選択におけるランダム性の程度を制御します。
OpenAIモデルの場合、temperatureは、値が0~2の間のサンプリングtemperatureとなります。0.8のような高い値を指定すると、出力がよりランダムになるのに対し、0.2のような低い値を指定すると、出力はより焦点を絞った、決定的なものになります。独自の構成を導入する場合は、temperatureとtop_pの両方ではなく、いずれかを使用してください。
システムメッセージ
system_messageパラメータの目的は、LLMがその役割と実行するべき内容を理解するのを支援することです。たとえば、旅行日程を処理するソリューションの場合は、次のようなシステムメッセージを追加できます。
You are a travel agent aid. You are going to help support staff process large amounts of schedules, tickets, etc.
このメッセージは、送信するコンテンツとは別ですが、結果を改善できます。
完了に必要なトークンの数
num_tokens_for_completionパラメータは、Box AIが返すことのできるトークンの数を表します。この数値は、使用されるモデルによって異なる場合があります。