amazon_bedrock
amazon_bedrock
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 accepts the following properties.
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.
Accepts either a text string or a pom object array for structured prompts, plus optional tuning parameters.
See post_prompt details below.
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 callback below.
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.
The post_prompt object accepts either a plain text prompt or a structured POM prompt, plus optional tuning parameters.
The main identity prompt for the AI. This prompt will be used to outline the agent’s personality, role, and other characteristics.
Controls the randomness of responses. Higher values (e.g., 0.8) make output more random and creative, while lower values (e.g., 0.2) make it more focused and deterministic. Range: 0.0 to 1.0.
Controls diversity via nucleus sampling. Only tokens with cumulative probability up to top_p are considered. Lower values make output more focused. Range: 0.0 to 1.0.
Minimum confidence threshold for AI responses. Responses below this threshold may be filtered or flagged. Range: 0.0 to 1.0.
Penalizes tokens based on whether they appear in the text so far. Positive values encourage the model to talk about new topics.
Penalizes tokens based on their frequency in the text so far. Positive values decrease the likelihood of repeating the same line verbatim.
SignalWire will make a request to the post_prompt_url with the following parameters:
Action that prompted this request. The value will be “post_conversation”.
Timestamp indicating when the AI session ended.
A unique identifier for the AI session.
Timestamp indicating when the AI session started.
Name of the application that originated the request.
Timestamp indicating when the call was answered.
Timestamp indicating when the call ended.
ID of the call.
The complete log of the call, as a JSON object.
Content of the call log entry.
Role associated with the call log entry (e.g., “system”, “assistant”, “user”).
Timestamp indicating when the call started.
Name associated with the caller ID.
Number associated with the caller ID.
Disposition of the content.
Type of content. The value will be text/swaig.
A unique identifier for the conversation thread, if configured via the AI parameters.
The answer from the AI agent to the post_prompt. The object contains the three following fields.
If a JSON object is detected within the answer, it is parsed and provided here.
The raw data answer from the AI agent.
The answer from the AI agent, excluding any JSON.
ID of the Project.
ID of the Space.
A collection of variables related to SWML.
A log related to SWAIG functions.
Represents the total number of input tokens.
Represents the total number of output tokens.
Version number.
Below is a json example of the callback request that is sent to the post_prompt_url:
The response to the callback request should be a JSON object with the following parameters:
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.