> ## Documentation index
> Fetch the complete documentation index at: https://arize.com/llms.txt
> Ask it with GET https://arize.com/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.

# Amazon Bedrock Evals

> Configure and run Bedrock for evals

### Using Amazon Bedrock with Phoenix Evals

<Info>
Requires `litellm` and AWS credentials configured via environment variables or boto3.

```sh
pip install "arize-phoenix-evals>=3" litellm boto3
```
</Info>

Use the `"litellm"` provider with a Bedrock model ID:

```python
from phoenix.evals import LLM

llm = LLM(provider="litellm", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0")
```

LiteLLM reads AWS credentials from the standard environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION_NAME`).

### Using with evaluators

```python
from phoenix.evals import LLM, evaluate_dataframe
from phoenix.evals.metrics import FaithfulnessEvaluator

llm = LLM(provider="litellm", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0")
evaluator = FaithfulnessEvaluator(llm=llm)

results_df = evaluate_dataframe(dataframe=df, evaluators=[evaluator])
```

### Authentication with assumed roles

If you need to assume a role, configure your credentials via environment variables before creating the LLM:

```python
import os

import boto3
from phoenix.evals import LLM

sts_client = boto3.client("sts")
response = sts_client.assume_role(
    RoleArn="arn:aws:iam::123456789012:role/MyRole",
    RoleSessionName="PhoenixEvalsSession",
)

creds = response["Credentials"]
os.environ["AWS_ACCESS_KEY_ID"] = creds["AccessKeyId"]
os.environ["AWS_SECRET_ACCESS_KEY"] = creds["SecretAccessKey"]
os.environ["AWS_SESSION_TOKEN"] = creds["SessionToken"]

llm = LLM(provider="litellm", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0")
```
