> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Aws

> Python API reference for the aws llm plugin.

<Card title="Usage guide" icon="book" href="/plugins/llm/aws" horizontal>
  Setup, environment variables, and Python/JavaScript/Go usage examples.
</Card>

## 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

```python theme={null}
AWSBedrockLLM(*, model: 'str' = 'amazon.nova-lite-v1:0', region: 'Optional[str]' = None, aws_access_key_id: 'Optional[str]' = None, aws_secret_access_key: 'Optional[str]' = None, aws_session_token: 'Optional[str]' = None, temperature: 'float' = 0.7, max_output_tokens: 'int' = 1024, top_p: 'Optional[float]' = None, top_k: 'Optional[int]' = None, stop_sequences: 'list[str] | str | None' = None, tool_choice: 'str' = 'auto', cache_system: 'Optional[bool]' = None, cache_tools: 'Optional[bool]' = None, strip_thinking: 'Optional[bool]' = None, text_tool_calls: 'Optional[bool]' = None, additional_request_fields: 'Optional[dict]' = None, **kwargs: 'Any') -> 'None'
```

<ParamField path="model" type="str" default="amazon.nova-lite-v1:0">
  Bedrock model id or inference profile ARN. Defaults to `"amazon.nova-lite-v1:0"`; falls back to the `BEDROCK_INFERENCE_PROFILE_ARN` env var.
</ParamField>

<ParamField path="region" type="Optional[str]">
  AWS region for Bedrock Runtime. Falls back to `AWS_DEFAULT_REGION` / `AWS_REGION`, then `"us-east-1"`.
</ParamField>

<ParamField path="aws_access_key_id" type="Optional[str]">
  Falls back to `AWS_ACCESS_KEY_ID`.
</ParamField>

<ParamField path="aws_secret_access_key" type="Optional[str]">
  Falls back to `AWS_SECRET_ACCESS_KEY`.
</ParamField>

<ParamField path="aws_session_token" type="Optional[str]">
  Falls back to `AWS_SESSION_TOKEN`. When no credentials are resolved, the runtime uses the default AWS credential chain (IAM role, shared profile).
</ParamField>

<ParamField path="temperature" type="float" default="0.7">
  Sampling temperature. Defaults to `0.7`.
</ParamField>

<ParamField path="max_output_tokens" type="int" default="1024">
  Max tokens generated per response. Defaults to `1024`. The legacy `max_tokens` kwarg is also accepted.
</ParamField>

<ParamField path="top_p" type="Optional[float]">
  Nucleus sampling probability mass.
</ParamField>

<ParamField path="top_k" type="Optional[int]">
  Top-K tokens considered (sent via additional request fields; model support varies).
</ParamField>

<ParamField path="stop_sequences" type="list[str] | str | None">
  Sequences that stop generation; a string or list.
</ParamField>

<ParamField path="tool_choice" type="str" default="auto">
  `"auto"`, `"required"`, `"none"`, or a tool name.
</ParamField>

<ParamField path="cache_system" type="Optional[bool]">
  Add a prompt-cache checkpoint after the system prompt.
</ParamField>

<ParamField path="cache_tools" type="Optional[bool]">
  Add a prompt-cache checkpoint after the tool definitions.
</ParamField>

<ParamField path="strip_thinking" type="Optional[bool]">
  Remove `&lt;thinking>...&lt;/thinking>` spans from the streamed text. Defaults to enabled in the runtime (Nova emits chain-of-thought that TTS would otherwise read aloud).
</ParamField>

<ParamField path="text_tool_calls" type="Optional[bool]">
  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.
</ParamField>

<ParamField path="additional_request_fields" type="Optional[dict]">
  Extra `additionalModelRequestFields` merged into the Converse request for model-specific parameters.
</ParamField>

### aclose

```python theme={null}
def aclose(self) -> 'None'
```

Release any resources held by the provider.

### cancel\_current\_generation

```python theme={null}
def cancel_current_generation(self) -> 'None'
```

Cancel the in-progress generation for the active session, if any.

### chat

```python theme={null}
def chat(self, messages: 'Any', tools: 'Any' = None, conversational_graph: 'Any' = None, **kwargs: 'Any') -> 'AsyncIterator[LLMResponse]'
```

Generate a streamed chat completion.

<ParamField path="messages" type="Any" required>
  The conversation history to send to the model.
</ParamField>

<ParamField path="tools" type="Any">
  Optional tool definitions the model may call.
</ParamField>

<ParamField path="conversational_graph" type="Any">
  Optional conversational graph guiding the exchange.
</ParamField>

<ResponseField name="returns" type="AsyncIterator[LLMResponse]">
  LLMResponse: Response chunks produced as the model generates output.
</ResponseField>

### emit

```python theme={null}
def emit(self, event: 'T', *args: 'Any') -> 'None'
```

Emit an event, invoking all registered handlers with the given arguments.

Handlers are called in registration order. Coroutine handlers are
scheduled on the running event loop. If the emitter is closed, the call
is a no-op.

<ParamField path="event" type="T" required>
  The event to emit.
</ParamField>

### off

```python theme={null}
def off(self, event: 'T', callback: 'Callable[..., Any]') -> 'None'
```

Remove a previously registered handler for an event.

If the handler is not registered for the event, the call is a no-op.

<ParamField path="event" type="T" required>
  The event the handler was registered for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any]" required>
  The handler to remove.
</ParamField>

### on

```python theme={null}
def on(self, event: 'T', callback: 'Callable[..., Any] | None' = None) -> 'Callable[..., Any]'
```

Register a handler for an event.

Can be used directly by passing a callback, or as a decorator when
`callback` is omitted.

<ParamField path="event" type="T" required>
  The event to listen for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any] | None">
  The handler to invoke when the event is emitted. If `None`, a decorator is returned that registers the decorated function.
</ParamField>

<ResponseField name="returns" type="Callable[..., Any]">
  The registered callback when `callback` is provided, otherwise a decorator that registers and returns the function it wraps.
</ResponseField>
