amazon_bedrock
Create an Amazon Bedrock agent with a prompt. Since the text prompt is central to getting great results out of the AI, it is highly recommended that you also read the Prompting Best Practices guide.
An object that contains the Amazon Bedrock parameters.
Amazon Bedrock parameters
A powerful and flexible environmental variable which can accept arbitrary data that is set initially in the SWML script or from the SWML set_global_data action. This data can be referenced globally. All contained information can be accessed and expanded within the prompt - for example, by using a template string.
A JSON object containing parameters as key-value pairs.
The final set of instructions and configuration settings to send to the agent.
See post_prompt for additional details.
The URL to which to send status callbacks and reports. Authentication can also be set in the url in the format of username:password@url.
See post_prompt_url for additional details.
Establishes the initial set of instructions and settings to configure the agent.
See prompt for additional details.
An array of JSON objects to create user-defined functions/endpoints that can be executed during the dialogue.
See SWAIG for additional details.
Amazon Bedrock example
The following example selects Bedrock's Tiffany voice using the voice_id parameter in the prompt. It includes scaffolding for a post_prompt_url as well as several remote and inline functions using SWAIG.
- YAML
- JSON
---
version: 1.0.0
sections:
main:
- amazon_bedrock:
post_prompt_url: https://example.com/my-api
prompt:
voice_id: tiffany
text: |
You are a helpful assistant that can provide information to users about a destination.
At the start of the conversation, always ask the user for their name.
You can use the appropriate function to get the phone number, address,
or weather information.
post_prompt:
text: Summarize the conversation.
SWAIG:
includes:
- functions:
- get_phone_number
- get_address
url: https://example.com/functions
defaults:
web_hook_url: https://example.com/my-webhook
functions:
- function: get_weather
description: To determine what the current weather is in a provided location.
parameters:
properties:
location:
type: string
description: The name of the city to find the weather from.
type: object
- function: summarize_conversation
description: Summarize the conversation.
parameters:
type: object
properties:
name:
type: string
description: The name of the user.
{
"version": "1.0.0",
"sections": {
"main": [
{
"amazon_bedrock": {
"post_prompt_url": "https://example.com/my-api",
"prompt": {
"voice_id": "tiffany",
"text": "You are a helpful assistant that can provide information to users about a destination.\nAt the start of the conversation, always ask the user for their name.\nYou can use the appropriate function to get the phone number, address,\nor weather information.\n"
},
"post_prompt": {
"text": "Summarize the conversation."
},
"SWAIG": {
"includes": [
{
"functions": [
"get_phone_number",
"get_address"
],
"url": "https://example.com/functions"
}
],
"defaults": {
"web_hook_url": "https://example.com/my-webhook"
},
"functions": [
{
"function": "get_weather",
"description": "To determine what the current weather is in a provided location.",
"parameters": {
"properties": {
"location": {
"type": "string",
"description": "The name of the city to find the weather from."
}
},
"type": "object"
}
},
{
"function": "summarize_conversation",
"description": "Summarize the conversation.",
"parameters": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the user."
}
}
}
}
]
}
}
}
]
}
}