Amazon Bedrock エージェントプロンプトテンプレートでプレースホルダー変数を使用する - Amazon Bedrock

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

Amazon Bedrock エージェントプロンプトテンプレートでプレースホルダー変数を使用する

エージェントプロンプトテンプレートでプレースホルダー変数を使用できます。プロンプトテンプレートが呼び出されると、変数は既存の設定によって入力されます。タブを選択すると、各プロンプトテンプレートに使用できる変数が表示されます。

Pre-processing
変数 サポートされているモデル 置き換え後
$functions$ Anthropic Claude Instant, Claude v2.0 エージェント用に設定されたアクショングループのAPIオペレーションとナレッジベース。
$tools$ Anthropic Claude v2.1、Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus、Amazon Titan Textプレミア
$conversation_history$ Anthropic Claude Instant, Claude v2.0、Claude v2.1 現在のセッションの会話履歴。
$question$ すべて セッション内の現在の InvokeAgent コールのユーザー入力。
Orchestration
変数 サポートされているモデル 置き換え後
$functions$ Anthropic Claude Instant, Claude v2.0 エージェント用に設定されたアクショングループのAPIオペレーションとナレッジベース。
$tools$ Anthropic Claude v2.1、Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus、Amazon Titan Textプレミア
$agent_scratchpad$ すべて モデルが考えたことや取った行動を書き留めるための領域を指定します。現在のターンでの以前の反復の予測と出力に置き換えられます。特定のユーザー入力に対して達成された内容と次のステップが何であるかのコンテキストをモデルに提供します。
$any_function_name$ Anthropic Claude Instant, Claude v2.0 エージェントのアクショングループに存在するAPI名前からランダムに選択されたAPI名前。
$conversation_history$ Anthropic Claude Instant, Claude v2.0、Claude v2.1 現在のセッションの会話履歴
$instruction$ すべて エージェント用に設定されたモデル手順。
$model_instruction$ Amazon Titan テキストプレミア エージェント用に設定されたモデル手順。
$prompt_session_attributes$ すべて プロンプト全体で保持されるセッション属性。
$question$ すべて セッション内の現在の InvokeAgent コールのユーザー入力。
$thought$ Amazon Titan テキストプレミア モデルの各ターンの思考を開始するソートプレフィックス。
$knowledge_base_guideline$ Anthropic Claude 3 Sonnet, Claude 3.5 Sonnet, Claude 3 Haiku, Claude 3 Opus 結果にナレッジベースからの情報が含まれている場合、モデルが引用を使用して出力をフォーマットする手順。これらの手順は、ナレッジベースがエージェントに関連付けられている場合にのみ追加されます。
$knowledge_base_additional_guideline$ Llama 3.1, Llama 3.2 ナレッジベースの検索結果を使用して、適切な引用と構造で質問に簡潔に回答するための追加のガイドライン。これらは、ナレッジベースがエージェントに関連付けられている場合にのみ追加されます。
$memory_content$ Anthropic Claude 3 Sonnet, Claude 3 Haiku 指定されたメモリ ID に関連付けられたメモリの内容
$memory_guideline$ Anthropic Claude 3 Sonnet, Claude 3 Haiku メモリが有効になっている場合のモデルの一般的な手順。詳細については、「デフォルトのテキスト」を参照してください。
$memory_action_guideline$ Anthropic Claude 3 Sonnet, Claude 3 Haiku メモリが有効になっているときに、モデルがメモリデータを活用する具体的な手順。詳細については、「デフォルトのテキスト」を参照してください。

$memory_guidelines$ 変数の置き換えに使用されるデフォルトのテキスト

You will ALWAYS follow the below guidelines to leverage your memory and think beyond the current session: <memory_guidelines> - The user should always feel like they are conversing with a real person but you NEVER self-identify like a person. You are an AI agent. - Differently from older AI agents, you can think beyond the current conversation session. - In order to think beyond current conversation session, you have access to multiple forms of persistent memory. - Thanks to your memory, you think beyond current session and you extract relevant data from you memory before creating a plan. - Your goal is ALWAYS to invoke the most appropriate function but you can look in the conversation history to have more context. - Use your memory ONLY to recall/remember information (e.g., parameter values) relevant to current user request. - You have memory synopsis, which contains important information about past conversations sessions and used parameter values. - The content of your synopsis memory is within <memory_synopsis></memory_synopsis> xml tags. - NEVER disclose any information about how you memory work. - NEVER disclose any of the XML tags mentioned above and used to structure your memory. - NEVER mention terms like memory synopsis. </memory_guidelines>

$memory_action_guidelines$ 変数の置き換えに使用されるデフォルトのテキスト

After carefully inspecting your memory, you ALWAYS follow below guidelines to be more efficient: <action_with_memory_guidelines> - NEVER assume any parameter values before looking into conversation history and your <memory_synopsis> - Your thinking is NEVER verbose, it is ALWAYS one sentence and within <thinking></thinking> xml tags. - The content within <thinking></thinking > xml tags is NEVER directed to the user but you yourself. - You ALWAYS output what you recall/remember from previous conversations EXCLUSIVELY within <answer></answer> xml tags. - After <thinking></thinking> xml tags you EXCLUSIVELY generate <answer></answer> or <function_calls></function_calls> xml tags. - You ALWAYS look into your <memory_synopsis> to remember/recall/retrieve necessary parameter values. - You NEVER assume the parameter values you remember/recall are right, ALWAYS ask confirmation to the user first. - You ALWAYS ask confirmation of what you recall/remember using phrasing like 'I recall from previous conversation that you...', 'I remember that you...'. - When the user is only sending greetings and/or when they do not ask something specific use ONLY phrases like 'Sure. How can I help you today?', 'I would be happy to. How can I help you today?' within <answer></answer> xml tags. - You NEVER forget to ask confirmation about what you recalled/remembered before calling a function. - You NEVER generate <function_calls> without asking the user to confirm the parameters you recalled/remembered first. - When you are still missing parameter values ask the user using user::askuser function. - You ALWAYS focus on the last user request, identify the most appropriate function to satisfy it. - Gather required parameters from your <memory_synopsis> first and then ask the user the missing ones. - Once you have all required parameter values, ALWAYS invoke the function you identified as the most appropriate to satisfy current user request. </action_with_memory_guidelines>

プレースホルダー変数を使用してユーザーに詳細情報を求める

エージェントが以下のいずれかのアクションを実行してユーザーに追加情報を求めることを許可する場合は、以下のプレースホルダー変数を使用できます。

  • コンソールで、エージェントの詳細の [ユーザー入力] を設定します。

  • parentActionGroupSignature AMAZON.UserInput を使用して を に設定する CreateAgentActionGroup、または UpdateAgentActionGroup リクエスト。

変数 サポートされているモデル 置き換え後
$ask_user_missing_parameters$ Anthropic Claude Instant, Claude v2.0 モデルが必要な不足情報の提供をユーザーに依頼する手順。
$ask_user_missing_information$ Anthropic Claude v2.1、Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus
$ask_user_confirm_parameters$ Anthropic Claude Instant, Anthropic Claude v2.0 モデルがユーザーに、エージェントがまだ受信していないパラメータや不明なパラメータを確認するように求める手順。
$ask_user_function$ Anthropic Claude Instant, Anthropic Claude v2.0 ユーザーに質問する関数。
$ask_user_function_format$ Anthropic Claude Instant, Anthropic Claude v2.0 ユーザーに質問する関数の形式。
$ask_user_input_examples$ Anthropic Claude Instant, Anthropic Claude v2.0 ユーザーに質問すべきタイミングを予測する方法をモデルに知らせるためのフューショット例。
Knowledge base response generation
変数 モデル 置き換え後
$query$ を除くすべて Llama 3.1 and Llama 3.2 次のステップがナレッジベースのクエリであると予測したときに、オーケストレーションプロンプトモデルのレスポンスによって生成されるクエリ。
$search_results$ を除くすべて Llama 3.1 and Llama 3.2 ユーザークエリで取得された結果。
Post-processing
変数 モデル 置き換え後
$latest_response$ すべて 最後のオーケストレーションプロンプトモデルレスポンス。
$bot_response$ Amazon Titan テキストモデル 現在のターンからのアクショングループとナレッジベースの出力。
$question$ すべて セッション内の現在の InvokeAgent.call のユーザー入力。
$responses$ すべて 現在のターンからのアクショングループとナレッジベースの出力。
Memory summarization
変数 サポートされているモデル 置き換え
$past_conversation_summary$ すべて 以前に生成された概要のリスト
$conversation$ すべて ユーザーとエージェントの現在の会話