> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# nemoguardrails.embeddings.providers.openai

## Module Contents

### Classes

| Name                                                                                       | Description                       |
| ------------------------------------------------------------------------------------------ | --------------------------------- |
| [`OpenAIEmbeddingModel`](#nemoguardrails-embeddings-providers-openai-OpenAIEmbeddingModel) | Embedding model using OpenAI API. |

### Data

[`async_client_var`](#nemoguardrails-embeddings-providers-openai-async_client_var)

### API

```python
class nemoguardrails.embeddings.providers.openai.OpenAIEmbeddingModel(
    embedding_model: str,
    kwargs = {}
)
```

**Bases:** [EmbeddingModel](/guardrails-python-sdk/nemoguardrails/embeddings/providers/base#nemoguardrails-embeddings-providers-base-EmbeddingModel)

Embedding model using OpenAI API.

**Parameters:**

**`embedding_model`** `str`

The name of the embedding model.

---

**`client`** `= OpenAI(**kwargs)`

---

**`embedding_size`** `= self.embedding_size_dict[self.model]`

---

**`embedding_size_dict`**

---

**`engine_name`** `= 'openai'`

---

```python
nemoguardrails.embeddings.providers.openai.OpenAIEmbeddingModel.encode(
    documents: typing.List[str]
) -> typing.List[typing.List[float]]
```

Encode a list of documents into embeddings.

**Parameters:**

**`documents`** `List[str]`

The list of documents to be encoded.

---

**Returns:** `List[List[float]]`

List\[List\[float]]: The encoded embeddings.

```python
nemoguardrails.embeddings.providers.openai.OpenAIEmbeddingModel.encode_async(
    documents: typing.List[str]
) -> typing.List[typing.List[float]]
```

async

Encode a list of documents into embeddings.

**Parameters:**

**`documents`** `List[str]`

The list of documents to be encoded.

---

**Returns:** `List[List[float]]`

List\[List\[float]]: The encoded embeddings.

```python
nemoguardrails.embeddings.providers.openai.async_client_var: ContextVar = ContextVar('async_client', default=None)
```