Context Vars
aws.access-key-idaws.secret-access-key
aws.session-tokenaws.region
Functions
converse of ::aws::bedrock::converse/converse
fn (model_id: Str, messages: Vec
Use the Bedrock Converse API for a unified interface across all models.
The Converse API works with any Bedrock model (Claude, Titan, Llama, Mistral, etc.) using the same message format.
Example
// Simple text conversation
result ::aws::bedrock::converse/converse("us.amazon.nova-micro-v1:0", "What is 2+2?")
content result.output.message.content
text first(content).text
// => "4"
// With message history
messages [
{role: "user", content: [{text: "My name is Alice"}]},
{role: "assistant", content: [{text: "Hello Alice!"}]},
{role: "user", content: [{text: "What is my name?"}]}
]
result ::aws::bedrock::converse/converse("us.amazon.nova-micro-v1:0", messages)
// Check usage metrics
result.usage.inputTokens // => 15
result.usage.outputTokens // => 5
converse-stream of ::aws::bedrock::converse/converse-stream
fn (model_id: Str, messages: Vec, system: Vec, inference_config: Map, tool_config: Map): ::hot::http/HttpResponse | ::aws::core/AwsError
fn (model_id: Str, messages: Vec, system: Vec): ::hot::http/HttpResponse | ::aws::core/AwsError
fn (model_id: Str, messages: Vec): ::hot::http/HttpResponse | ::aws::core/AwsError
Use the Bedrock Converse API with streaming response.
Returns the raw HTTP response with an event stream body. Note: Streaming requires parsing the AWS Event Stream binary format.
get-foundation-model of ::aws::bedrock::models/get-foundation-model
fn (model_identifier: Str): GetFoundationModelResponse | ::aws::core/AwsError
Get details about a specific foundation model.
Example
result ::aws::bedrock::models/get-foundation-model("amazon.nova-micro-v1:0")
model result.model
// => {model_id: "amazon.nova-micro-v1:0", model_name: "Nova Micro", ...}
invoke-claude of ::aws::bedrock::invoke/invoke-claude
fn (model_id: Str, messages: Vec, max_tokens: Int, system: Str, temperature: Dec, top_p: Dec, stop_sequences: Vec): ClaudeResponse | ::aws::core/AwsError
fn (model_id: Str, messages: Vec, max_tokens: Int, system: Str): ClaudeResponse | ::aws::core/AwsError
fn (model_id: Str, messages: Vec, max_tokens: Int): ClaudeResponse | ::aws::core/AwsError
fn (model_id: Str, messages: Vec): ClaudeResponse | ::aws::core/AwsError
fn (prompt: Str): ClaudeResponse | ::aws::core/AwsError
Invoke an Anthropic Claude model via Bedrock using the Messages API format.
Example
// Simple prompt with default model (Claude 3 Haiku)
result ::aws::bedrock::invoke/invoke-claude("What is 2+2?")
text first(result.content).text
// => "4"
// With specific model and system prompt
result ::aws::bedrock::invoke/invoke-claude(
"anthropic.claude-3-5-sonnet-20240620-v1:0",
[{role: "user", content: "Explain quantum computing"}],
1024,
"You are a physics teacher"
)
invoke-llama of ::aws::bedrock::invoke/invoke-llama
fn (model_id: Str, prompt: Str, max_gen_len: Int, temperature: Dec, top_p: Dec): InvokeModelResponse | ::aws::core/AwsError
fn (model_id: Str, prompt: Str, max_gen_len: Int): InvokeModelResponse | ::aws::core/AwsError
fn (model_id: Str, prompt: Str): InvokeModelResponse | ::aws::core/AwsError
fn (prompt: Str): InvokeModelResponse | ::aws::core/AwsError
Invoke a Meta Llama model via Bedrock.
Example
// Simple prompt with default model (Llama 3 8B)
result ::aws::bedrock::invoke/invoke-llama("What is functional programming?")
result.body.generation
// => "Functional programming is..."
invoke-mistral of ::aws::bedrock::invoke/invoke-mistral
fn (model_id: Str, prompt: Str, max_tokens: Int, temperature: Dec, top_p: Dec, stop: Vec): InvokeModelResponse | ::aws::core/AwsError
fn (model_id: Str, prompt: Str, max_tokens: Int): InvokeModelResponse | ::aws::core/AwsError
fn (model_id: Str, prompt: Str): InvokeModelResponse | ::aws::core/AwsError
fn (prompt: Str): InvokeModelResponse | ::aws::core/AwsError
Invoke a Mistral AI model via Bedrock.
Example
// Simple prompt with default model (Mistral 7B)
result ::aws::bedrock::invoke/invoke-mistral("Write a haiku about coding")
result.body.outputs
// => [{text: "..."}]
invoke-model of ::aws::bedrock::invoke/invoke-model
fn (model_id: Str, body: Map, content_type: Str, accept: Str): InvokeModelResponse | ::aws::core/AwsError
Invoke a Bedrock foundation model with a raw request body.
This is the low-level invocation API. For most use cases, prefer converse
which provides a unified interface across all models.
Example
result ::aws::bedrock::invoke/invoke-model(
"amazon.titan-text-express-v1",
{inputText: "Hello", textGenerationConfig: {maxTokenCount: 100}},
"application/json",
"application/json"
)
result.body
// => {inputTextTokenCount: 1, results: [{outputText: "...", ...}]}
invoke-titan of ::aws::bedrock::invoke/invoke-titan
fn (model_id: Str, input_text: Str, max_token_count: Int, temperature: Dec, top_p: Dec, stop_sequences: Vec): TitanResponse | ::aws::core/AwsError
fn (model_id: Str, input_text: Str, max_token_count: Int): TitanResponse | ::aws::core/AwsError
fn (model_id: Str, input_text: Str): TitanResponse | ::aws::core/AwsError
fn (input_text: Str): TitanResponse | ::aws::core/AwsError
Invoke an Amazon Titan text model via Bedrock.
Example
// Simple prompt with default model (Titan Text Express)
result ::aws::bedrock::invoke/invoke-titan("Tell me about Hot language")
text first(result.results).outputText
// => "Hot is..."
// With specific model and token limit
result ::aws::bedrock::invoke/invoke-titan("amazon.titan-text-lite-v1", "Hello!", 512)
list-foundation-models of ::aws::bedrock::models/list-foundation-models
fn (by_provider: Str, by_customization_type: Str, by_output_modality: Str, by_inference_type: Str): ListFoundationModelsResponse | ::aws::core/AwsError
fn (by_provider: Str): ListFoundationModelsResponse | ::aws::core/AwsError
fn (): ListFoundationModelsResponse | ::aws::core/AwsError
List all available foundation models in Bedrock.
Optionally filter by provider, customization type, output modality, or inference type.
Example
// List all models
result ::aws::bedrock::models/list-foundation-models()
models result.models
// => [{model_id: "amazon.nova-micro-v1:0", provider_name: "Amazon", ...}, ...]
// List models by provider
result ::aws::bedrock::models/list-foundation-models("Anthropic")
Types
AwsError of ::aws::core/AwsError
ContentBlock of ::aws::bedrock::converse/ContentBlock
ContentBlock type {
text: Str?,
image: Map?,
tool_use: Map?,
tool_result: Map?
}
ConverseResponse of ::aws::bedrock::converse/ConverseResponse
ConverseResponse type {
output: Map?,
stop_reason: StopReason?,
usage: Map?,
metrics: Map?
}
Credentials of ::aws::core/Credentials
FoundationModel of ::aws::bedrock::models/FoundationModel
FoundationModel type {
model_arn: Str?,
model_id: Str?,
model_name: Str?,
provider_name: Str?,
input_modalities: Vec?,
output_modalities: Vec?,
response_streaming_supported: Bool?,
customizations_supported: Vec?,
inference_types_supported: Vec?,
model_lifecycle: Map?
}
InvokeModelResponse of ::aws::bedrock::invoke/InvokeModelResponse
InvokeModelResponse type {
body: Any,
content_type: Str?,
status_code: Int?
}
ListFoundationModelsResponse of ::aws::bedrock::models/ListFoundationModelsResponse
ListFoundationModelsResponse type {
models: Vec
}
Message of ::aws::bedrock::converse/Message
Message type {
role: Role,
content: Vec
}