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

# OpenAI evals

> Configure and run OpenAI for evals

### Using OpenAI with Phoenix Evals

<Info>
Requires `openai>=1.0.0`

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

Create an `LLM` instance with the OpenAI provider:

```python
from phoenix.evals import LLM

llm = LLM(provider="openai", model="gpt-4o")
```

The `LLM` wrapper reads your API key from the `OPENAI_API_KEY` environment variable, or you can pass it directly:

```python
llm = LLM(provider="openai", model="gpt-4o", api_key="sk-...")
```

### Using with evaluators

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

llm = LLM(provider="openai", model="gpt-4o")
evaluator = FaithfulnessEvaluator(llm=llm)

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

### Custom parameters

Pass additional parameters to the OpenAI client:

```python
llm = LLM(
    provider="openai",
    model="gpt-4o",
    temperature=0.0,
    sync_client_kwargs={"timeout": 60.0},
    async_client_kwargs={"timeout": 120.0},
)
```

### Azure OpenAI

Use the `"azure"` provider for Azure OpenAI deployments:

```python
llm = LLM(
    provider="azure",
    model="gpt-4o",  # This is the deployment name
    api_key="your-api-key",
    api_version="2024-02-01",
    base_url="https://your-resource.openai.azure.com/",
)
```

<Info>
The `model` parameter is the deployment name in Azure. You can find it in the Azure OpenAI playground.
</Info>

<Frame caption="How to find the model param in Azure">
  <img src="https://storage.googleapis.com/arize-phoenix-assets/assets/images/phoenix-docs-images/c01cbde1-image.jpeg" />
</Frame>

For full details on Azure OpenAI, check out the [OpenAI Documentation](https://github.com/openai/openai-python#microsoft-azure-openai).
