AmazonBedrockSchema unstable
The AmazonBedrockSchema module defines handwritten schemas for the subset
of the Amazon Bedrock Converse API that this provider uses: the Converse
request and response, and the ConverseStream events.
Details
The Smithy model of the Converse API expresses most content as unions. A union is modelled here as a struct whose members are all optional. Every struct that Bedrock sends back keeps the fields this provider does not model, so a new union member or field reaches a low-level consumer instead of failing the whole response or being dropped. Blobs travel as base64 strings, as in the JSON protocol.
Models
A ConverseStream event this provider does not model, keyed by its
event-stream :event-type like every other event: { [eventType]: payload }.
Details
The type declares no index signature, so an in check on a
ConverseStreamEvent still narrows to the known event, and the brand
keeps this member apart from them. Read the payload with Object.entries.
Signature
type UnknownConverseStreamEvent = Brand.Branded<object, "UnknownConverseStreamEvent">Schemas
CachePointBlock
unstableA cache point marking the end of a reusable prefix of a request.
Details
Converse caches everything preceding the block, so a cache point is its own
content block appended after the content it should cover. ttl opts into
extended caching; when omitted Bedrock uses the default lifetime.
Bedrock does not send cache points back, so unlike the response structs
this one keeps no unmodelled fields and stays exact as a request option.
Signature
declare const CachePointBlock: Struct<{ readonly ttl: optionalKey<Literals<readonly ["5m", "1h"]>>; readonly type: Literal<"default">;}>The type of CachePointBlock.
Signature
type CachePointBlock = typeof CachePointBlock.TypeContentBlock
unstableA content block within a Converse message. A block member this provider
does not model, such as citationsContent, is kept as it was sent.
Signature
declare const ContentBlock: StructWithRest<Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: optionalKey<Literals<readonly ["5m", "1h"]>>; readonly type: Literal<"default">; }>>; readonly document: optional<StructWithRest<Struct<{ readonly format: Literals<readonly ["pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md"]>; readonly name: String; readonly source: StructWithRest<Struct<{ readonly bytes: String; }>, readonly [$Record<String, Unknown>]>; }>, readonly [$Record<String, Unknown>]>>; readonly image: optional<StructWithRest<Struct<{ readonly format: Literals<readonly ["png", "jpeg", "gif", "webp"]>; readonly source: StructWithRest<Struct<{ readonly bytes: String; }>, readonly [$Record<String, Unknown>]>; }>, readonly [$Record<String, Unknown>]>>; readonly reasoningContent: optional<StructWithRest<Struct<{ readonly reasoningText: optional<StructWithRest<Struct<{ readonly signature: ...; readonly text: ...; }>, readonly [$Record<..., ...>]>>; readonly redactedContent: optional<String>; }>, readonly [$Record<String, Unknown>]>>; readonly text: optional<String>; readonly toolResult: optional<StructWithRest<Struct<{ readonly content: $Array<StructWithRest<Struct<{ readonly json: ...; readonly text: ...; }>, readonly [$Record<..., ...>]>>; readonly status: optional<Literals<readonly ["success", "error"]>>; readonly toolUseId: String; }>, readonly [$Record<String, Unknown>]>>; readonly toolUse: optional<StructWithRest<Struct<{ readonly input: Unknown; readonly name: String; readonly toolUseId: String; }>, readonly [$Record<String, Unknown>]>>;}>, readonly [$Record<String, Unknown>]>ContentBlockDelta
unstableA delta within a streamed content block: text, a fragment of tool input
JSON, or reasoning text, signature or redacted content. A delta member this
provider does not model, such as citation, is kept as it was sent.
Signature
declare const ContentBlockDelta: StructWithRest<Struct<{ readonly reasoningContent: optional<StructWithRest<Struct<{ readonly redactedContent: optional<String>; readonly signature: optional<String>; readonly text: optional<String>; }>, readonly [$Record<String, Unknown>]>>; readonly text: optional<String>; readonly toolUse: optional<StructWithRest<Struct<{ readonly input: String; }>, readonly [$Record<String, Unknown>]>>;}>, readonly [$Record<String, Unknown>]>ContentBlockDeltaEvent
unstableA streamed delta event for a content block.
Signature
declare const ContentBlockDeltaEvent: StructWithRest<Struct<{ readonly contentBlockIndex: Int; readonly delta: StructWithRest<Struct<{ readonly reasoningContent: optional<StructWithRest<Struct<{ readonly redactedContent: optional<...>; readonly signature: optional<...>; readonly text: optional<...>; }>, readonly [$Record<String, Unknown>]>>; readonly text: optional<String>; readonly toolUse: optional<StructWithRest<Struct<{ readonly input: String; }>, readonly [$Record<String, Unknown>]>>; }>, readonly [$Record<String, Unknown>]>;}>, readonly [$Record<String, Unknown>]>ContentBlockStartEvent
unstableThe start of a streamed content block. Tool-use blocks announce their id and name here; text and reasoning blocks start directly with deltas.
Signature
declare const ContentBlockStartEvent: StructWithRest<Struct<{ readonly contentBlockIndex: Int; readonly start: optional<StructWithRest<Struct<{ readonly toolUse: optional<StructWithRest<Struct<{ readonly name: ...; readonly toolUseId: ...; }>, readonly [$Record<..., ...>]>>; }>, readonly [$Record<String, Unknown>]>>;}>, readonly [$Record<String, Unknown>]>ContentBlockStopEvent
unstableA streamed stop event for a content block.
Signature
declare const ContentBlockStopEvent: StructWithRest<Struct<{ readonly contentBlockIndex: Int;}>, readonly [$Record<String, Unknown>]>ConverseMetrics
unstableMetrics about a Converse call.
Signature
declare const ConverseMetrics: StructWithRest<Struct<{ readonly latencyMs: Number;}>, readonly [$Record<String, Unknown>]>ConverseRequest
unstableThe request payload for the Converse and ConverseStream operations.
Details
modelId travels in the URL, not in the body. additionalModelRequestFields
carries inference parameters specific to the target model; extended
thinking on an Anthropic model is enabled through it.
Signature
declare const ConverseRequest: Struct<{ readonly additionalModelRequestFields: optional<$Record<String, Unknown>>; readonly guardrailConfig: optional<Struct<{ readonly guardrailIdentifier: String; readonly guardrailVersion: String; readonly streamProcessingMode: optionalKey<Literals<readonly ["sync", "async"]>>; readonly trace: optionalKey<Literals<readonly ["enabled", "disabled", "enabled_full"]>>; }>>; readonly inferenceConfig: optional<Struct<{ readonly maxTokens: optional<Int>; readonly stopSequences: optional<$Array<String>>; readonly temperature: optional<Number>; readonly topP: optional<Number>; }>>; readonly messages: $Array<StructWithRest<Struct<{ readonly content: $Array<StructWithRest<Struct<{ readonly cachePoint: optional<...>; readonly document: optional<...>; readonly image: optional<...>; readonly reasoningContent: optional<...>; readonly text: optional<...>; readonly toolResult: optional<...>; readonly toolUse: optional<...>; }>, readonly [$Record<String, Unknown>]>>; readonly role: Literals<readonly ["user", "assistant"]>; }>, readonly [$Record<String, Unknown>]>>; readonly modelId: String; readonly outputConfig: optionalKey<Struct<{ readonly effort: optionalKey<String>; readonly textFormat: optionalKey<Struct<{ readonly structure: Struct<{ readonly jsonSchema: Struct<...>; }>; readonly type: Literal<"json_schema">; }>>; }>>; readonly system: optional<$Array<Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: optionalKey<Literals<...>>; readonly type: Literal<"default">; }>>; readonly text: optional<String>; }>>>; readonly toolConfig: optionalKey<Struct<{ readonly toolChoice: optionalKey<Union<readonly [Struct<{ readonly auto: Struct<...>; }>, Struct<{ readonly any: Struct<...>; }>, Struct<{ readonly tool: Struct<...>; }>]>>; readonly tools: $Array<Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: ...; readonly type: ...; }>>; readonly toolSpec: optional<Struct<{ readonly description: ...; readonly inputSchema: ...; readonly name: ...; }>>; }>>; }>>;}>The type of ConverseRequest.
Signature
type ConverseRequest = typeof ConverseRequest.TypeConverseResponse
unstableThe response from a successful Converse call. trace and any field this
provider does not model, such as additionalModelResponseFields, are kept
as Bedrock sent them.
Signature
declare const ConverseResponse: StructWithRest<Struct<{ readonly metrics: optional<StructWithRest<Struct<{ readonly latencyMs: Number; }>, readonly [$Record<String, Unknown>]>>; readonly output: StructWithRest<Struct<{ readonly message: StructWithRest<Struct<{ readonly content: $Array<StructWithRest<..., ...>>; readonly role: Literals<readonly [..., ...]>; }>, readonly [$Record<String, Unknown>]>; }>, readonly [$Record<String, Unknown>]>; readonly stopReason: Union<readonly [Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>, StringForLiteralAutocomplete]>; readonly trace: optional<Unknown>; readonly usage: StructWithRest<Struct<{ readonly cacheReadInputTokens: optional<Int>; readonly cacheWriteInputTokens: optional<Int>; readonly inputTokens: Int; readonly outputTokens: Int; readonly totalTokens: Int; }>, readonly [$Record<String, Unknown>]>;}>, readonly [$Record<String, Unknown>]>The type of ConverseResponse.
Signature
type ConverseResponse = typeof ConverseResponse.TypeConverseStreamEvent
unstableA ConverseStream event, keyed by its event-stream :event-type, as the AWS
SDK shapes it: { messageStart: ... }, { contentBlockDelta: ... } and so
on. An event type this provider does not model decodes through
UnknownConverseStreamEvent; a malformed known event still fails.
Signature
declare const ConverseStreamEvent: Union<readonly [Struct<{ readonly messageStart: StructWithRest<Struct<{ readonly role: Literals<readonly ["user", "assistant"]>; }>, readonly [$Record<String, Unknown>]>;}>, Struct<{ readonly contentBlockStart: StructWithRest<Struct<{ readonly contentBlockIndex: Int; readonly start: optional<StructWithRest<Struct<{ readonly toolUse: ...; }>, readonly [$Record<..., ...>]>>; }>, readonly [$Record<String, Unknown>]>;}>, Struct<{ readonly contentBlockDelta: StructWithRest<Struct<{ readonly contentBlockIndex: Int; readonly delta: StructWithRest<Struct<{ readonly reasoningContent: optional<...>; readonly text: optional<...>; readonly toolUse: optional<...>; }>, readonly [$Record<String, Unknown>]>; }>, readonly [$Record<String, Unknown>]>;}>, Struct<{ readonly contentBlockStop: StructWithRest<Struct<{ readonly contentBlockIndex: Int; }>, readonly [$Record<String, Unknown>]>;}>, Struct<{ readonly messageStop: StructWithRest<Struct<{ readonly stopReason: Union<readonly [Literals<readonly [..., ..., ..., ..., ..., ..., ..., ..., ...]>, StringForLiteralAutocomplete]>; }>, readonly [$Record<String, Unknown>]>;}>, Struct<{ readonly metadata: StructWithRest<Struct<{ readonly metrics: optional<StructWithRest<Struct<{ readonly latencyMs: ...; }>, readonly [$Record<..., ...>]>>; readonly trace: optional<Unknown>; readonly usage: StructWithRest<Struct<{ readonly cacheReadInputTokens: optional<...>; readonly cacheWriteInputTokens: optional<...>; readonly inputTokens: Int; readonly outputTokens: Int; readonly totalTokens: Int; }>, readonly [$Record<String, Unknown>]>; }>, readonly [$Record<String, Unknown>]>;}>, declare<UnknownConverseStreamEvent, UnknownConverseStreamEvent>]>The type of ConverseStreamEvent.
Signature
type ConverseStreamEvent = typeof ConverseStreamEvent.TypeConverseStreamException
unstableThe body of an exception frame in a ConverseStream response, such as a
throttlingException.
Signature
declare const ConverseStreamException: StructWithRest<Struct<{ readonly message: optional<String>;}>, readonly [$Record<String, Unknown>]>ConverseStreamMetadataEvent
unstableThe trailing metadata event of a stream, carrying usage and metrics. Bedrock
sends it after messageStop.
Signature
declare const ConverseStreamMetadataEvent: StructWithRest<Struct<{ readonly metrics: optional<StructWithRest<Struct<{ readonly latencyMs: Number; }>, readonly [$Record<String, Unknown>]>>; readonly trace: optional<Unknown>; readonly usage: StructWithRest<Struct<{ readonly cacheReadInputTokens: optional<Int>; readonly cacheWriteInputTokens: optional<Int>; readonly inputTokens: Int; readonly outputTokens: Int; readonly totalTokens: Int; }>, readonly [$Record<String, Unknown>]>;}>, readonly [$Record<String, Unknown>]>DocumentBlock
unstableA document content block. Bedrock restricts name to alphanumerics, single
runs of whitespace, hyphens, parentheses and square brackets.
Signature
declare const DocumentBlock: StructWithRest<Struct<{ readonly format: Literals<readonly ["pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md"]>; readonly name: String; readonly source: StructWithRest<Struct<{ readonly bytes: String; }>, readonly [$Record<String, Unknown>]>;}>, readonly [$Record<String, Unknown>]>DocumentFormat
unstableThe document formats the Converse API accepts.
Signature
declare const DocumentFormat: Literals<readonly ["pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md"]>GuardrailConfiguration
unstableThe guardrail of a Converse request. streamProcessingMode applies to
ConverseStream only and is removed from Converse requests.
Signature
declare const GuardrailConfiguration: Struct<{ readonly guardrailIdentifier: String; readonly guardrailVersion: String; readonly streamProcessingMode: optionalKey<Literals<readonly ["sync", "async"]>>; readonly trace: optionalKey<Literals<readonly ["enabled", "disabled", "enabled_full"]>>;}>ImageBlock
unstableAn image content block. The image is sent as base64 bytes.
Signature
declare const ImageBlock: StructWithRest<Struct<{ readonly format: Literals<readonly ["png", "jpeg", "gif", "webp"]>; readonly source: StructWithRest<Struct<{ readonly bytes: String; }>, readonly [$Record<String, Unknown>]>;}>, readonly [$Record<String, Unknown>]>ImageFormat
unstableThe image formats the Converse API accepts.
Signature
declare const ImageFormat: Literals<readonly ["png", "jpeg", "gif", "webp"]>InferenceConfiguration
unstableBase inference parameters to pass to a model in a Converse call.
Signature
declare const InferenceConfiguration: Struct<{ readonly maxTokens: optional<Int>; readonly stopSequences: optional<$Array<String>>; readonly temperature: optional<Number>; readonly topP: optional<Number>;}>JsonSchemaDefinition
unstableA JSON Schema the model's output must conform to. schema is the JSON
Schema serialized to a string, as Converse requires.
Signature
declare const JsonSchemaDefinition: Struct<{ readonly description: optionalKey<String>; readonly name: optionalKey<String>; readonly schema: String;}>KnownStopReason
unstableThe stop reasons that the Smithy model of the Converse API names.
Signature
declare const KnownStopReason: Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>The type of KnownStopReason.
Signature
type KnownStopReason = typeof KnownStopReason.TypeA message within a Converse conversation.
Signature
declare const Message: StructWithRest<Struct<{ readonly content: $Array<StructWithRest<Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: optionalKey<...>; readonly type: Literal<...>; }>>; readonly document: optional<StructWithRest<Struct<{ readonly format: ...; readonly name: ...; readonly source: ...; }>, readonly [$Record<..., ...>]>>; readonly image: optional<StructWithRest<Struct<{ readonly format: ...; readonly source: ...; }>, readonly [$Record<..., ...>]>>; readonly reasoningContent: optional<StructWithRest<Struct<{ readonly reasoningText: ...; readonly redactedContent: ...; }>, readonly [$Record<..., ...>]>>; readonly text: optional<String>; readonly toolResult: optional<StructWithRest<Struct<{ readonly content: ...; readonly status: ...; readonly toolUseId: ...; }>, readonly [$Record<..., ...>]>>; readonly toolUse: optional<StructWithRest<Struct<{ readonly input: ...; readonly name: ...; readonly toolUseId: ...; }>, readonly [$Record<..., ...>]>>; }>, readonly [$Record<String, Unknown>]>>; readonly role: Literals<readonly ["user", "assistant"]>;}>, readonly [$Record<String, Unknown>]>MessageStartEvent
unstableThe start of a streamed message.
Signature
declare const MessageStartEvent: StructWithRest<Struct<{ readonly role: Literals<readonly ["user", "assistant"]>;}>, readonly [$Record<String, Unknown>]>MessageStopEvent
unstableThe stop event for a streamed message.
Signature
declare const MessageStopEvent: StructWithRest<Struct<{ readonly stopReason: Union<readonly [Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>, StringForLiteralAutocomplete]>;}>, readonly [$Record<String, Unknown>]>OutputConfig
unstableOutput configuration for a Converse request: native structured output
(textFormat) and the model's effort level (effort, on the models that
accept it).
Signature
declare const OutputConfig: Struct<{ readonly effort: optionalKey<String>; readonly textFormat: optionalKey<Struct<{ readonly structure: Struct<{ readonly jsonSchema: Struct<{ readonly description: optionalKey<String>; readonly name: optionalKey<String>; readonly schema: String; }>; }>; readonly type: Literal<"json_schema">; }>>;}>OutputFormat
unstableStructured output parameters for a Converse request.
Signature
declare const OutputFormat: Struct<{ readonly structure: Struct<{ readonly jsonSchema: Struct<{ readonly description: optionalKey<String>; readonly name: optionalKey<String>; readonly schema: String; }>; }>; readonly type: Literal<"json_schema">;}>ReasoningContentBlock
unstableA reasoning content block: either reasoning text or reasoning that the model provider redacted, as a base64 string.
Signature
declare const ReasoningContentBlock: StructWithRest<Struct<{ readonly reasoningText: optional<StructWithRest<Struct<{ readonly signature: optional<String>; readonly text: String; }>, readonly [$Record<String, Unknown>]>>; readonly redactedContent: optional<String>;}>, readonly [$Record<String, Unknown>]>ReasoningTextBlock
unstableThe reasoning text produced by a model, with the signature that verifies the model generated it. The signature must be echoed back unmodified when the block is sent in a later turn.
Signature
declare const ReasoningTextBlock: StructWithRest<Struct<{ readonly signature: optional<String>; readonly text: String;}>, readonly [$Record<String, Unknown>]>StopReason
unstableThe reason the model stopped generating a response. Any string decodes, so a reason that Bedrock adds later does not fail the response.
Signature
declare const StopReason: Union<readonly [Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>, StringForLiteralAutocomplete]>The type of StopReason.
Signature
type StopReason = typeof StopReason.TypeSystemContentBlock
unstableA system content block: system text or a cache point.
Signature
declare const SystemContentBlock: Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: optionalKey<Literals<readonly ["5m", "1h"]>>; readonly type: Literal<"default">; }>>; readonly text: optional<String>;}>TokenUsage
unstableToken usage statistics returned by the Converse API.
Signature
declare const TokenUsage: StructWithRest<Struct<{ readonly cacheReadInputTokens: optional<Int>; readonly cacheWriteInputTokens: optional<Int>; readonly inputTokens: Int; readonly outputTokens: Int; readonly totalTokens: Int;}>, readonly [$Record<String, Unknown>]>The type of TokenUsage.
Signature
type TokenUsage = typeof TokenUsage.TypeA tool entry within a ToolConfiguration: a tool specification, or a cache point marking the end of the cacheable prefix of the tool list.
Signature
declare const Tool: Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: optionalKey<Literals<readonly ["5m", "1h"]>>; readonly type: Literal<"default">; }>>; readonly toolSpec: optional<Struct<{ readonly description: optionalKey<String>; readonly inputSchema: Struct<{ readonly json: $Record<String, Unknown>; }>; readonly name: String; }>>;}>ToolChoice
unstableControls how the model selects a tool: let it decide (auto), force any
tool (any), or force a specific tool (tool).
Signature
declare const ToolChoice: Union<readonly [Struct<{ readonly auto: Struct<{}>;}>, Struct<{ readonly any: Struct<{}>;}>, Struct<{ readonly tool: Struct<{ readonly name: String; }>;}>]>The type of ToolChoice.
Signature
type ToolChoice = typeof ToolChoice.TypeToolConfiguration
unstableThe tool configuration for a Converse request.
Signature
declare const ToolConfiguration: Struct<{ readonly toolChoice: optionalKey<Union<readonly [Struct<{ readonly auto: Struct<{}>; }>, Struct<{ readonly any: Struct<{}>; }>, Struct<{ readonly tool: Struct<{ readonly name: String; }>; }>]>>; readonly tools: $Array<Struct<{ readonly cachePoint: optional<Struct<{ readonly ttl: optionalKey<Literals<readonly [..., ...]>>; readonly type: Literal<"default">; }>>; readonly toolSpec: optional<Struct<{ readonly description: optionalKey<String>; readonly inputSchema: Struct<{ readonly json: $Record<..., ...>; }>; readonly name: String; }>>; }>>;}>ToolResultBlock
unstableA tool-result content block: the outcome of a tool invocation fed back to the model.
Signature
declare const ToolResultBlock: StructWithRest<Struct<{ readonly content: $Array<StructWithRest<Struct<{ readonly json: optional<Unknown>; readonly text: optional<String>; }>, readonly [$Record<String, Unknown>]>>; readonly status: optional<Literals<readonly ["success", "error"]>>; readonly toolUseId: String;}>, readonly [$Record<String, Unknown>]>ToolResultContentBlock
unstableOne piece of the content of a tool result: text or a JSON document.
Signature
declare const ToolResultContentBlock: StructWithRest<Struct<{ readonly json: optional<Unknown>; readonly text: optional<String>;}>, readonly [$Record<String, Unknown>]>ToolSpecification
unstableThe JSON Schema specification of a tool the model may call.
Signature
declare const ToolSpecification: Struct<{ readonly description: optionalKey<String>; readonly inputSchema: Struct<{ readonly json: $Record<String, Unknown>; }>; readonly name: String;}>ToolUseBlock
unstableA tool-use content block: the model's request to invoke a tool.
Signature
declare const ToolUseBlock: StructWithRest<Struct<{ readonly input: Unknown; readonly name: String; readonly toolUseId: String;}>, readonly [$Record<String, Unknown>]>UnknownConverseStreamEvent
unstableFallback schema for a ConverseStream event this provider does not model.
Signature
declare const UnknownConverseStreamEvent: declare<UnknownConverseStreamEvent, UnknownConverseStreamEvent>