本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
在 Amazon Bedrock 代理程式提示範本中使用預留位置變數
您可以在客服人員提示範本中使用預留位置變數。呼叫提示範本時,變數將會由預先存在的組態填入。選取標籤以查看可用於每個提示範本的變數。
- Pre-processing
-
變數 支援的模型 取代為 $functions$ Anthropic Claude Instant,2.0 Claude版 為代理程式設定的動作群組 API 操作和知識庫。 $tools$ Anthropic Claude v2.1、Claude 3 Sonnet、Claude 3 Haiku、Claude 3 Opus、Amazon Titan Text Premier $conversation_history$ Anthropic Claude Instant、Claude2.0 版、2.1 Claude版 目前工作階段的對話歷史記錄。 $question$ 全部 工作階段中目前 InvokeAgent
呼叫的使用者輸入。 - Orchestration
-
變數 支援的模型 取代為 $functions$ Anthropic Claude Instant,2.0 Claude版 為代理程式設定的動作群組 API 操作和知識庫。 $tools$ Anthropic Claude v2.1、Claude 3 Sonnet、Claude 3 Haiku、Claude 3 Opus、Amazon Titan Text Premier $agent_scratchpad$ 全部 為模型指定一個區域,以記錄其想法和採取的動作。以目前回合中先前反覆運算的預測和輸出取代。為模型提供特定使用者輸入已達成的內容,以及後續步驟的內容。 $any_function_name$ Anthropic Claude Instant,2.0 Claude版 從存在於客服人員動作群組中的 API 名稱隨機選擇的 API 名稱。 $conversation_history$ Anthropic Claude Instant、Claude2.0 版、2.1 Claude版 目前工作階段的對話歷史記錄 $instruction$ 全部 為代理程式設定的模型指示。 $model_instruction$ Amazon Titan Text Premier 為代理程式設定的模型指示。 $prompt_session_attributes$ 全部 跨提示保留的工作階段屬性。 $question$ 全部 工作階段中目前 InvokeAgent
呼叫的使用者輸入。$thought$ Amazon Titan Text Premier 思維字首,以開始對模型每個轉彎的思考。 $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>
使用預留位置變數向使用者要求詳細資訊
如果您允許代理程式透過執行下列其中一個動作,向使用者要求更多資訊,則可以使用下列預留位置變數:
-
在 主控台中,在客服人員詳細資訊中的使用者輸入中設定 。
-
AMAZON.UserInput
使用 CreateAgentActionGroup或 UpdateAgentActionGroup請求parentActionGroupSignature
將 設定為 。
變數 支援的模型 取代為 $ask_user_missing_parameters$ Anthropic Claude Instant,2.0 Claude版 模型要求使用者提供必要遺漏資訊的指示。 $ask_user_missing_information$ Anthropic Claude v2.1、Claude 3 Sonnet、Claude 3 Haiku、 Claude 3 Opus $ask_user_confirm_parameters$ Anthropic Claude Instant,2.0 AnthropicClaude版 模型要求使用者確認客服人員尚未收到或不確定的參數的指示。 $ask_user_function$ Anthropic Claude Instant,2.0 AnthropicClaude版 向使用者提出問題的 函數。 $ask_user_function_format$ Anthropic Claude Instant,2.0 AnthropicClaude版 向使用者提出問題的函數格式。 $ask_user_input_examples$ Anthropic Claude Instant,2.0 AnthropicClaude版 幾個範例,以告知模型如何預測何時應該向使用者提出問題。 -
- Knowledge base response generation
-
變數 模型 取代為 $query$ Llama 3.1 和 Llama 3.2 除外的所有項目 協調提示模型回應在預測下一個步驟為知識庫查詢時所產生的查詢。 $search_results$ Llama 3.1 和 Llama 3.2 除外的所有項目 使用者查詢的擷取結果。 - Post-processing
-
變數 模型 取代為 $latest_response$ 全部 上次協調提示模型回應。 $bot_response$ Amazon Titan Text 模型 目前回合的動作群組和知識庫輸出。 $question$ 全部 工作階段中目前 InvokeAgent
.call 的使用者輸入。$responses$ 全部 目前回合的動作群組和知識庫輸出。 - Memory summarization
-
變數 支援的模型 取代為 $past_conversation_summary$ 全部 先前產生的摘要清單 $conversation$ 全部 使用者與客服人員之間的目前對話
設定進階提示
撰寫自訂剖析器 Lambda 函數