本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
带有会话属性的示例请求
以下示例说明如何调用 AMAZON。 BedrockAgentIntent 并演示了在响应中填充的会话和请求属性。这些属性包含 Bedrock Agent 的响应数据,可用于访问代理的输出、Amazon Bedrock 知识库来源和操作组调用详细信息。
{ "sessionId": "user-session-123", "messages": [{ "content": "Your order #12345 is currently being processed and will ship within 2-3 business days. You will receive a tracking number via email once it ships.", "contentType": "PlainText" }], "sessionState": { "sessionAttributes": { "x-amz-lex:bedrock-agent-search-response": "Your order #12345 is currently being processed and will ship within 2-3 business days. You will receive a tracking number via email once it ships.", "x-amz-lex:bedrock-knowledge-base-search-response-source": "[{\"title\": \"Order Processing Guide\", \"uri\": \"s3://knowledge-base/orders/processing.pdf\", \"excerpt\": \"Standard orders typically ship within 2-3 business days...\"}]", "x-amz-lex:bedrock-agent-action-group-invocation-input": "{\"actionGroupName\": \"OrderLookup\", \"function\": \"getOrderStatus\", \"parameters\": {\"orderId\": \"12345\", \"customerId\": \"67890\"}}", "x-amz-lex:bedrock-agent-knowledge-base-lookup-input": "{\"knowledgeBaseId\": \"KB123456\", \"query\": \"order status processing time\", \"numberOfResults\": 3}" }, "intent": { "name": "BedrockAgentIntent", "slots": {}, "state": "Fulfilled", "confirmationState": "None" }, "dialogAction": { "type": "ElicitIntent" } }, "interpretations": [{ "intent": { "name": "FallbackIntent", "slots": {} }, "interpretationSource": "Lex" }], "requestAttributes": { "x-amz-lex:channels:platform": "Web", "x-amz-lex:accept-content-types": "PlainText", "x-amz-lex:bedrock-agent-search-response": "Your order #12345 is currently being processed and will ship within 2-3 business days. You will receive a tracking number via email once it ships.", "x-amz-lex:bedrock-knowledge-base-search-response-source": "[{\"title\": \"Order Processing Guide\", \"uri\": \"s3://knowledge-base/orders/processing.pdf\", \"excerpt\": \"Standard orders typically ship within 2-3 business days...\"}]", "x-amz-lex:bedrock-agent-action-group-invocation-input": "{\"actionGroupName\": \"OrderLookup\", \"function\": \"getOrderStatus\", \"parameters\": {\"orderId\": \"12345\", \"customerId\": \"67890\"}}", "x-amz-lex:bedrock-agent-knowledge-base-lookup-input": "{\"knowledgeBaseId\": \"KB123456\", \"query\": \"order status processing time\", \"numberOfResults\": 3}" } }
在此示例中,会话属性显示了如何 BedrockAgentIntent 填充响应数据,包括代理的答案、使用的 Amazon Bedrock 知识库来源、操作组调用以及用于生成响应的 Amazon Bedrock 知识库查询详细信息。