description: "This component computes the embeddings of a list of documents and stores the obtained vectors in the embedding field of each document. It uses Cohere embedding models."
---
# CohereDocumentEmbedder
This component computes the embeddings of a list of documents and stores the obtained vectors in the embedding field of each document. It uses Cohere embedding models.
The vectors computed by this component are necessary to perform embedding retrieval on a collection of documents. At retrieval time, the vector that represents the query is compared with those of the documents to find the most similar or relevant documents.
`CohereDocumentEmbedder` enriches the metadata of documents with an embedding of their content. To embed a string, you should use the [`CohereTextEmbedder`](https://docs.haystack.deepset.ai/v2.0/docs/coheretextembedder).
`"embed-multilingual-v2.0"`. The default model is `embed-english-v2.0`. This list of all supported models can be found in Cohere’s [model documentation](https://docs.cohere.com/docs/models#representation).
To start using this integration with Haystack, install it with:
```shell
pip install cohere-haystack
```
The component uses a `COHERE_API_KEY`or `CO_API_KEY` environment variable by default. Otherwise, you can pass an API key at initialization with `api_key`:
To get a Cohere API key, head over to https://cohere.com/.
### Embedding Metadata
Text documents often come with a set of metadata. If they are distinctive and semantically meaningful, you can embed them along with the text of the document to improve retrieval.
You can do this by using the Document Embedder:
```python
from haystack import Document
from cohere_haystack.embedders.document_embedder import CohereDocumentEmbedder