Skip to main content

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.

amazon_bedrock
objectrequired

An object that contains the Amazon Bedrock parameters.

Amazon Bedrock parameters

amazon_bedrock.global_data
object

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.

amazon_bedrock.params
object

A JSON object containing parameters as key-value pairs.

amazon_bedrock.post_prompt
object

The final set of instructions and configuration settings to send to the agent.

See post_prompt for additional details.

amazon_bedrock.post_prompt_url
string

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.

amazon_bedrock.prompt
objectrequired

Establishes the initial set of instructions and settings to configure the agent.

See prompt for additional details.

amazon_bedrock.SWAIG
object

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.

---
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.