Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
AWSBedrockLLM
AWS Bedrock LLM plugin (Converse API). Streams text generation and function/tool calling from any Bedrock-hosted model (Amazon Nova, Anthropic Claude, Meta Llama, Mistral, Google Gemma). Credentials resolve as explicit argument -> environment variable -> the default AWS credential chain (IAM role / shared profile).Constructor
Bedrock model id or inference profile ARN. Defaults to
"amazon.nova-lite-v1:0"; falls back to the BEDROCK_INFERENCE_PROFILE_ARN env var.AWS region for Bedrock Runtime. Falls back to
AWS_DEFAULT_REGION / AWS_REGION, then "us-east-1".Falls back to
AWS_ACCESS_KEY_ID.Falls back to
AWS_SECRET_ACCESS_KEY.Falls back to
AWS_SESSION_TOKEN. When no credentials are resolved, the runtime uses the default AWS credential chain (IAM role, shared profile).Sampling temperature. Defaults to
0.7.Max tokens generated per response. Defaults to
1024. The legacy max_tokens kwarg is also accepted.Nucleus sampling probability mass.
Top-K tokens considered (sent via additional request fields; model support varies).
Sequences that stop generation; a string or list.
"auto", "required", "none", or a tool name.Add a prompt-cache checkpoint after the system prompt.
Add a prompt-cache checkpoint after the tool definitions.
Remove
<thinking>...</thinking> spans from the streamed text. Defaults to enabled in the runtime (Nova emits chain-of-thought that TTS would otherwise read aloud).Parse function calls a model prints as plain text instead of native Converse tool use. Auto-enabled for models that lack native tool use (e.g. Gemma) when left unset.
Extra
additionalModelRequestFields merged into the Converse request for model-specific parameters.aclose
cancel_current_generation
chat
The conversation history to send to the model.
Optional tool definitions the model may call.
Optional conversational graph guiding the exchange.
LLMResponse: Response chunks produced as the model generates output.
emit
The event to emit.
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.