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

## Module Contents

### Classes

| Name                                                                                       | Description                       |
| ------------------------------------------------------------------------------------------ | --------------------------------- |
| [`CohereEmbeddingModel`](#nemoguardrails-embeddings-providers-cohere-CohereEmbeddingModel) | Embedding model using Cohere API. |

### Data

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

### API

```python
class nemoguardrails.embeddings.providers.cohere.CohereEmbeddingModel(
    embedding_model: str,
    input_type: str = 'search_document',
    kwargs = {}
)
```

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

Embedding model using Cohere API.

To use, you must have either:

1. The `COHERE_API_KEY` environment variable set with your API key, or
2. Pass your API key using the api\_key kwarg to the Cohere constructor.

**Parameters:**

**`embedding_model`** `str`

The name of the embedding model.

---

**`input_type`** `str` — default: 'search\_document'

The type of input for the embedding model, default is "search\_document".
"search\_document", "search\_query", "classification", "clustering", "image"

---

**`client`** `= cohere.Client(**kwargs)`

---

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

---

**`embedding_size_dict`**

---

**`engine_name`** `= 'cohere'`

---

```python
nemoguardrails.embeddings.providers.cohere.CohereEmbeddingModel.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.cohere.CohereEmbeddingModel.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.cohere.async_client_var: ContextVar = ContextVar('async_client', default=None)
```