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

# aws

AWS SageMaker client.

Sends JSON payloads to a SageMaker endpoint via the `sagemaker-runtime` `invoke_endpoint` API.  The `model_name` field is injected into every request body for multi-model dispatch.

## AWSClient

```python theme={null}
class AWSClient()
```

Sends JSON payloads to an AWS SageMaker endpoint.

<ParamField body="endpoint_name">
  Name of the SageMaker endpoint.
</ParamField>

<ParamField body="model_name">
  Model identifier injected into the request body for SageMaker multi-model dispatch.
</ParamField>

<ParamField body="region_name">
  AWS region. When *None*, uses the default from the environment or *boto\_session*.
</ParamField>

<ParamField body="boto_session">
  Optional pre-configured `Session` (e.g. with explicit credentials or a custom profile). When *None*, a default session is created using the standard credential chain.
</ParamField>

<ParamField body="timeout">
  Read timeout in seconds.
</ParamField>

**Example:**

```python theme={null}
client = AWSClient(
    endpoint_name="h1-prod",
    model_name="h1",
)
resp_json = client.predict(request_json)
```

#### predict

```python theme={null}
def predict(body: str) -> str
```

Invoke the SageMaker endpoint for prediction.

<ParamField body="body" type="str" required>
  Serialized JSON request payload.
</ParamField>

<ResponseField name="returns" type="str">
  Response body as a JSON string.
</ResponseField>

#### embed

```python theme={null}
def embed(body: str) -> str
```

Invoke the SageMaker endpoint for embedding.

<ParamField body="body" type="str" required>
  Serialized JSON request payload.
</ParamField>

<ResponseField name="returns" type="str">
  Response body as a JSON string.
</ResponseField>

#### metadata

```python theme={null}
def metadata() -> str
```

Fetch model metadata via `/invocations`.

Sends a minimal request with `mode` set to `"metadata"` so the server returns model metadata instead of running inference.

<ResponseField name="returns" type="str">
  Response body as a JSON string.
</ResponseField>

#### predict\_async

```python theme={null}
async def predict_async(body: str, session: Any = None) -> str
```

Predict asynchronously via `run_in_executor`.

`boto3` is not natively async, so the synchronous `predict` call is delegated to a thread pool.

<ParamField body="body" type="str" required>
  Serialized JSON payload.
</ParamField>

<ParamField body="session" type="Any">
  Unused. Accepted for interface compatibility with the `Client` protocol.
</ParamField>

<ResponseField name="returns" type="str">
  Response body as a string.
</ResponseField>

#### embed\_async

```python theme={null}
async def embed_async(body: str, session: Any = None) -> str
```

Embed asynchronously via `run_in_executor`.

<ParamField body="body" type="str" required>
  Serialized JSON payload.
</ParamField>

<ParamField body="session" type="Any">
  Unused. Accepted for interface compatibility.
</ParamField>

<ResponseField name="returns" type="str">
  Response body as a string.
</ResponseField>
