Skip to content

Converse

Source: src/AWS/Bedrock/Converse.ts

Runtime binding for bedrock-runtime:Converse — Amazon Bedrock’s unified messages API that works across all conversational foundation models.

Bind one or more model references inside a function runtime to get a callable that sends messages to the model. The binding grants the function bedrock:InvokeModel scoped to exactly the bound models. A model reference may be a foundation-model id, a cross-region inference profile id (e.g. us.amazon.nova-micro-v1:0), or a full Bedrock ARN (application inference profile, imported model, prompt version, …).

Model access is an account entitlement — enable the model in the Bedrock console (Model access) before invoking, otherwise calls fail with AccessDeniedException. Many newer models are only invocable through a cross-region inference profile id, not their bare foundation-model id.

Send a Single Prompt

// init
const converse = yield* Bedrock.Converse("us.amazon.nova-micro-v1:0");
// runtime
const result = yield* converse({
messages: [{ role: "user", content: [{ text: "Say hello." }] }],
inferenceConfig: { maxTokens: 64 },
});
const text = result.output.message.content[0]?.text;

Bind Multiple Models and Pick Per Call

const converse = yield* Bedrock.Converse(
"us.amazon.nova-micro-v1:0",
"us.anthropic.claude-sonnet-4-20250514-v1:0",
);
const result = yield* converse({
modelId: "us.anthropic.claude-sonnet-4-20250514-v1:0",
messages: [{ role: "user", content: [{ text: "Summarize this." }] }],
});

System Prompt and Inference Config

const result = yield* converse({
system: [{ text: "You answer in exactly one word." }],
messages: [{ role: "user", content: [{ text: "What color is the sky?" }] }],
inferenceConfig: { maxTokens: 16, temperature: 0 },
});