yera.models.interfaces.llms.aws_bedrock
Module containing the interface to AWS bedrock LLMs.
Symbols
AwsBedrockLLM
BaseLLMInterfaceInterface to AWS Bedrock LLM models.
This class provides a wrapper around the AWS Bedrock runtime client, enabling interactions with various LLM models available through Bedrock (AWS Bedrock Claude, Qwen, OpenAI, DeepSeek, Google Gemini, and others). It supports both standard chat completions and structured output generation for models that support it.
The class automatically detects whether the selected model natively supports structured outputs or requires a tool-use fallback.
Attributes
Configuration settings for the LLM including model_id and inference parameters.
AWS connection configuration including credentials and region information.
Whether the selected model supports native structured output generation.
Lazy-initialized AWS Bedrock runtime client instance.
Methods
AwsBedrockLLM.start
start() → NoneInitialise the AWS Bedrock API client.
Creates and stores an AWS Bedrock client instance using the configured connection settings. This method must be called before making any API requests via the client property.
AwsBedrockLLM.stop
stop() → NoneShut down and clear the AWS Bedrock API client.
Releases the AWS Bedrock client instance by setting it to None. After calling this method, start() must be called again before further API requests can be made.
AwsBedrockLLM.chat
chat(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream a chat response through the configured AWS transport.
Responses models use Bedrock Runtime's OpenAI-compatible endpoint. Other Bedrock models use the Converse API.
Parameters
Workspace conversation history.
Per-call reasoning override.
Per-call inference overrides.
AwsBedrockLLM.make_struct
make_struct(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream a structured response through the configured AWS transport.
Responses models use OpenAI-compatible strict JSON Schema. Converse models use Bedrock's native structured-output configuration.
Parameters
Workspace conversation history.
Struct class defining the required output.
Per-call reasoning override.
Per-call inference overrides.