@nhtio/adk/batteries/llm/bedrock_converse/types
Wire shapes, helper contracts, and option types for the native Bedrock Converse battery.
Remarks
AWS Bedrock's Converse API is a content-BLOCK protocol, which is what separates it from Chat Completions in ways a gateway has to paper over:
- A turn's payload is
content[]— an array of typed blocks ({text},{image},{toolUse},{toolResult}) — so ONE assistant turn can carry prose and a tool call together. In the OpenAI shape those are separate fields on separate messages. - A tool result is a
userturn carrying a{toolResult}block, not atool-role message. - System text is a top-level
system[]array, not a message in the conversation. - Converse requires strict
user↔assistantalternation and rejects consecutive same-role turns outright. This is the constraint most gateways silently repair by merging. toolConfigMUST be present whenever anytoolUse/toolResultblock appears — omitting it is a hard rejection ("The toolConfig field must be defined when using toolUse and toolResult content blocks."), even when the history is only replaying past calls.- Tool input schemas go under
inputSchema.jsonand must survive Converse's schema dialect, which rejects several JSON-Schema keywords.
Auth is Bearer-token (Authorization: Bearer <ABSK…>) against bedrock-runtime.<region>.amazonaws.com, so no SigV4 signer or AWS SDK dependency is required — deliberately, since this battery must stay cross-environment and dependency-light.
Interfaces
| Interface | Description |
|---|---|
| BedrockConverseAdapterOptions | Constructor and per-dispatch options. |
| BedrockConverseHelpers | The injectable translation seam. Every function has a default* implementation. |
| ConverseContentBlock | One typed content block. Exactly one field is set per block. |
| ConverseImageBlock | An image block. bytes is base64 on the wire despite the SDK's Uint8Array typing. |
| ConverseInferenceConfig | Sampling and output controls. |
| ConverseMessage | One conversation turn. |
| ConverseRequest | The complete Converse request body. |
| ConverseRequestBuildInput | Everything buildConverseRequest needs. |
| ConverseResponse | The Converse response body. |
| ConverseSystemBlock | A system-text block. Top-level, never part of messages[]. |
| ConverseToolConfig | Tool configuration. |
| ConverseToolResult | A tool result, carried on a user turn. |
| ConverseToolSpec | A tool declaration. |
| ConverseToolUse | A model-emitted tool invocation. |
| ConverseUsage | Token accounting. |
Type Aliases
| Type Alias | Description |
|---|---|
| ConverseRole | Conversation role. Converse has no system or tool role — see the module remarks. |
| ConverseToolChoice | Forces, permits, or forbids tool use. |
References
ChatCompletionsBucketLabel
Re-exports ChatCompletionsBucketLabel
ChatCompletionsBucketOrder
Re-exports ChatCompletionsBucketOrder
ChatCompletionsRetryConfig
Re-exports ChatCompletionsRetryConfig
ChatHelpersCommon
Re-exports ChatHelpersCommon
DescriptionLike
Re-exports DescriptionLike
JsonSchema
Re-exports JsonSchema
MemoryAttrs
Re-exports MemoryAttrs
PromptAssembledObserverFn
Re-exports PromptAssembledObserverFn
RawGenerationObserverFn
Re-exports RawGenerationObserverFn
RetrievableAttrs
Re-exports RetrievableAttrs
StandingInstructionAttrs
Re-exports StandingInstructionAttrs
ThoughtAttrs
Re-exports ThoughtAttrs
ToolCallParserFn
Re-exports ToolCallParserFn
ToolCallParserName
Re-exports ToolCallParserName
TrustedContentAttrs
Re-exports TrustedContentAttrs
UnsupportedMediaPolicy
Re-exports UnsupportedMediaPolicy
UntrustedContentAttrs
Re-exports UntrustedContentAttrs