Skip to content
3 min read · 512 words

@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 user turn carrying a {toolResult} block, not a tool-role message.
  • System text is a top-level system[] array, not a message in the conversation.
  • Converse requires strict user ↔ assistant alternation and rejects consecutive same-role turns outright. This is the constraint most gateways silently repair by merging.
  • toolConfig MUST be present whenever any toolUse / toolResult block 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.json and 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 ​

InterfaceDescription
BedrockConverseAdapterOptionsConstructor and per-dispatch options.
BedrockConverseHelpersThe injectable translation seam. Every function has a default* implementation.
ConverseContentBlockOne typed content block. Exactly one field is set per block.
ConverseImageBlockAn image block. bytes is base64 on the wire despite the SDK's Uint8Array typing.
ConverseInferenceConfigSampling and output controls.
ConverseMessageOne conversation turn.
ConverseRequestThe complete Converse request body.
ConverseRequestBuildInputEverything buildConverseRequest needs.
ConverseResponseThe Converse response body.
ConverseSystemBlockA system-text block. Top-level, never part of messages[].
ConverseToolConfigTool configuration.
ConverseToolResultA tool result, carried on a user turn.
ConverseToolSpecA tool declaration.
ConverseToolUseA model-emitted tool invocation.
ConverseUsageToken accounting.

Type Aliases ​

Type AliasDescription
ConverseRoleConversation role. Converse has no system or tool role — see the module remarks.
ConverseToolChoiceForces, 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


ToolCallIdFilterFn ​

Re-exports ToolCallIdFilterFn


ToolCallParserFn ​

Re-exports ToolCallParserFn


ToolCallParserName ​

Re-exports ToolCallParserName


TrustedContentAttrs ​

Re-exports TrustedContentAttrs


UnsupportedMediaPolicy ​

Re-exports UnsupportedMediaPolicy


UntrustedContentAttrs ​

Re-exports UntrustedContentAttrs