AmazonBedrockLanguageModel unstable
The AmazonBedrockLanguageModel module maps the Effect AI LanguageModel
abstraction onto the Amazon Bedrock Converse API.
Scope
Text, tool calling and tool results are supported on both the streaming and
the non-streaming path. Structured output asks for the object through a
forced tool by default, and through Converse's native
outputConfig.textFormat when Config.structuredOutputs is true.
Reasoning blocks are surfaced on both paths and round-trip into later turns
with their signature. Image and document file parts become Converse image
and document blocks; a media type Converse has no format for fails with
AiError.InvalidUserInputError. Prompt caching is opt-in per message or
part via the "amazon-bedrock" provider options.
Configuration
Per-request configuration for the Amazon Bedrock language model.
Details
Derived from ConverseRequest, minus the fields built from the prompt and
the toolkit, so every other Converse request parameter is settable per
request. That includes additionalModelRequestFields, which carries
inference parameters specific to the target model, among them extended
thinking on Anthropic models. The thinking budget is drawn from the same
ceiling as the visible answer, so inferenceConfig.maxTokens must exceed
budget_tokens.
Signature
declare class Config extends Shape<"@effect/ai-amazon-bedrock/AmazonBedrockLanguageModel/Config", { readonly additionalModelRequestFields?: { [key: string]: unknown; }; readonly guardrailConfig?: { readonly guardrailIdentifier: string; readonly guardrailVersion: string; readonly streamProcessingMode?: "sync" | "async"; readonly trace?: "enabled" | "disabled" | "enabled_full"; }; readonly inferenceConfig?: { readonly maxTokens?: number; readonly stopSequences?: readonly Array<string>; readonly temperature?: number; readonly topP?: number; }; readonly modelId?: string; readonly outputConfig?: { readonly effort?: string; }; readonly structuredOutputs?: boolean;}, this> { constructor(_: never);}Example Enabling extended thinking for one request
import { AmazonBedrockLanguageModel } from "@effect/ai-amazon-bedrock"import { LanguageModel } from "effect/ai"
const answer = LanguageModel.generateText({ prompt: "How many r's are in strawberry?"}).pipe( AmazonBedrockLanguageModel.withConfigOverride({ additionalModelRequestFields: { thinking: { type: "enabled", budget_tokens: 1024 } }, inferenceConfig: { maxTokens: 4096 } }))withConfigOverride
unstableProvides config overrides for Amazon Bedrock language model operations.
Signature
declare const withConfigOverride: { (overrides: { readonly additionalModelRequestFields?: { [key: string]: unknown; }; readonly guardrailConfig?: { readonly guardrailIdentifier: string; readonly guardrailVersion: string; readonly streamProcessingMode?: "sync" | "async"; readonly trace?: "enabled" | "disabled" | "enabled_full"; }; readonly inferenceConfig?: { readonly maxTokens?: number; readonly stopSequences?: readonly Array<string>; readonly temperature?: number; readonly topP?: number; }; readonly modelId?: string; readonly outputConfig?: { readonly effort?: string; }; readonly structuredOutputs?: boolean; }): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Config>>; <A, E, R>(self: Effect<A, E, R>, overrides: { readonly additionalModelRequestFields?: { [key: string]: unknown; }; readonly guardrailConfig?: { readonly guardrailIdentifier: string; readonly guardrailVersion: string; readonly streamProcessingMode?: "sync" | "async"; readonly trace?: "enabled" | "disabled" | "enabled_full"; }; readonly inferenceConfig?: { readonly maxTokens?: number; readonly stopSequences?: readonly Array<string>; readonly temperature?: number; readonly topP?: number; }; readonly modelId?: string; readonly outputConfig?: { readonly effort?: string; }; readonly structuredOutputs?: boolean; }): Effect<A, E, Exclude<R, Config>>;}Constructors
Creates an Amazon Bedrock LanguageModel service from a model identifier
and optional request defaults.
Signature
declare const make: (...args: [{ readonly config?: Omit<{ readonly additionalModelRequestFields?: { [key: string]: unknown; }; readonly guardrailConfig?: { readonly guardrailIdentifier: string; readonly guardrailVersion: string; readonly streamProcessingMode?: "sync" | "async"; readonly trace?: "enabled" | "disabled" | "enabled_full"; }; readonly inferenceConfig?: { readonly maxTokens?: number; readonly stopSequences?: readonly Array<string>; readonly temperature?: number; readonly topP?: number; }; readonly modelId?: string; readonly outputConfig?: { readonly effort?: string; }; readonly structuredOutputs?: boolean; }, "modelId">; readonly model: string;}]) => Effect<LanguageModel, never, AmazonBedrockClient>Creates an Amazon Bedrock model descriptor that can be provided with
Effect.provide.
Signature
declare function model(model: string, config?: Omit<{ readonly additionalModelRequestFields?: { [key: string]: unknown; }; readonly guardrailConfig?: { readonly guardrailIdentifier: string; readonly guardrailVersion: string; readonly streamProcessingMode?: "sync" | "async"; readonly trace?: "enabled" | "disabled" | "enabled_full"; }; readonly inferenceConfig?: { readonly maxTokens?: number; readonly stopSequences?: readonly Array<string>; readonly temperature?: number; readonly topP?: number; }; readonly modelId?: string; readonly outputConfig?: { readonly effort?: string; }; readonly structuredOutputs?: boolean;}, "modelId">): Model<"amazon-bedrock", LanguageModel, AmazonBedrockClient>Layers
Creates a layer for the Amazon Bedrock language model.
Signature
declare function layer(options: { readonly config?: Omit<{ readonly additionalModelRequestFields?: { [key: string]: unknown; }; readonly guardrailConfig?: { readonly guardrailIdentifier: string; readonly guardrailVersion: string; readonly streamProcessingMode?: "sync" | "async"; readonly trace?: "enabled" | "disabled" | "enabled_full"; }; readonly inferenceConfig?: { readonly maxTokens?: number; readonly stopSequences?: readonly Array<string>; readonly temperature?: number; readonly topP?: number; }; readonly modelId?: string; readonly outputConfig?: { readonly effort?: string; }; readonly structuredOutputs?: boolean; }, "modelId">; readonly model: string;}): Layer<LanguageModel, never, AmazonBedrockClient>Models
A request to cache everything preceding a message or part.
Details
Converse caches a prefix of the request rather than an individual block, so
this becomes a cachePoint block appended after the content it covers.
Omitting ttl leaves the cache lifetime to Bedrock.
Signature
type CachePoint = typeof CachePointBlock.EncodedA Bedrock model identifier, cross-region inference profile id or ARN, such
as us.anthropic.claude-sonnet-4-5-20250929-v1:0.
Signature
type Model = stringThe Bedrock-side identity of a reasoning block.
Details
Converse returns reasoning either as text plus a signature that proves the
model produced it, or as redactedContent (base64) when the model
provider's safety systems encrypted it. Either must be echoed back
unmodified for the block to be accepted in a later turn, so it is carried
on the part's provider metadata and options.
Signature
type ReasoningInfo = { readonly redactedContent?: string; readonly signature?: string;}