

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 Amazon Bedrock 代理程式提示範本中使用預留位置變數
<a name="prompt-placeholders"></a>

您可以在代理程式提示範本中使用預留位置變數。呼叫提示範本時，變數將會由預先存在的組態填入。選取索引標籤可查看可用於每個提示範本的變數。

------
#### [ Pre-processing ]


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/prompt-placeholders.html)

------
#### [ Orchestration ]


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/prompt-placeholders.html)

**用來取代 `$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>
```

**使用預留位置變數向使用者詢問更多資訊**

如果您允許代理程式透過進行下列其中一個動作向使用者詢問更多資訊，您可以使用以下預留位置變數：
+ 在主控台中，在代理程式詳細資訊的**使用者輸入**中設定。
+ 使用 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgentActionGroup.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgentActionGroup.html) 或 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_UpdateAgentActionGroup.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_UpdateAgentActionGroup.html) 請求將 `parentActionGroupSignature` 設定為 `AMAZON.UserInput`。


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/prompt-placeholders.html)

------
#### [ Knowledge base response generation ]


****  

| 變數 | 模型 | 取代為 | 
| --- | --- | --- | 
| \$1query\$1 | Llama 3.1 和 Llama 3.2 除外的所有項目 | 協同運作提示模型回應在預測下一步是查詢知識庫時所產生的查詢。 | 
| \$1search\$1results\$1 | Llama 3.1 和 Llama 3.2 除外的所有項目 | 使用者查詢的擷取結果。 | 

------
#### [ Post-processing ]


****  

| 變數 | 模型 | 取代為 | 
| --- | --- | --- | 
| \$1latest\$1response\$1 | 全部 | 最後一個協同運作提示模型回應。 | 
| \$1bot\$1response\$1 | Amazon Titan Text 模型 | 目前輪次的動作群組和知識庫輸出。 | 
| \$1question\$1 | 全部 | 工作階段中目前 InvokeAgent.呼叫的使用者輸入。 | 
| \$1responses\$1 | 全部 | 目前輪次的動作群組和知識庫輸出。 | 

------
#### [ Memory summarization ]


****  

| 變數 | 支援的模型 | 取代為 | 
| --- | --- | --- | 
| \$1past\$1conversation\$1summary\$1 | 全部 | 先前產生的摘要清單 | 
| \$1conversation\$1 | 全部 | 使用者與代理程式之間的目前對話 | 

------
#### [ Multi-agent ]


****  

| 變數 | 支援的模型 | 取代為 | 
| --- | --- | --- | 
| \$1agent\$1collaborators\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 協作者的代理程式關聯 | 
| \$1multi\$1agent\$1payload\$1reference\$1guideline\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 不同代理程式之間共用的內容。來自代理程式的訊息可能包含以下格式的承載：<br:payload id="\$1PAYLOAD\$1ID"> \$1PAYLOAD\$1CONTENT </br:payload>  | 

------
#### [ Routing classifier ]


****  

| 變數 | 支援的模型 | 取代為 | 
| --- | --- | --- | 
| \$1knowledge\$1base\$1routing\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 所有所連接知識庫的描述 | 
| \$1action\$1routing\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 所有已連接工具的描述 | 
| \$1knowledge\$1base\$1routing\$1guideline\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 讓模型在結果包含知識庫中資訊時路由具有引文之輸出的指示。只有在知識庫與主管代理程式相關聯時，才會新增這些指示。 | 
| \$1action\$1routing\$1guideline\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 讓模型在您已連接工具，且使用者請求與任一工具相關時傳回工具使用的指示。 | 
| \$1last\$1most\$1specialized\$1agent\$1guideline\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 如果最後一個使用者訊息與源自該代理程式的後續步驟相關，且該代理程式需要訊息中的資訊才能繼續時，便使用 keep\$1previous\$1agent 路由至此代理程式的指示。 | 
| \$1prompt\$1session\$1attributes\$1 | 多代理協同作業[支援的所有模型](multi-agents-supported.md) | 路由分類器中的輸入變數  | 

------

**使用預留位置變數向使用者詢問更多資訊**

如果您允許代理程式透過進行下列其中一個動作向使用者詢問更多資訊，您可以使用以下預留位置變數：
+ 在主控台中，在代理程式詳細資訊的**使用者輸入**中設定。
+ 使用 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgentActionGroup.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgentActionGroup.html) 或 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_UpdateAgentActionGroup.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_UpdateAgentActionGroup.html) 請求將 `parentActionGroupSignature` 設定為 `AMAZON.UserInput`。


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/prompt-placeholders.html)