|RAG Retriever|Connect to external data sources|[chat + rag](https://docs.cohere.com/reference/chat)|`from langchain.retrievers import CohereRagRetriever`|[cohere.ipynb](/docs/docs/integrations/retrievers/cohere.ipynb)|
|Text Embedding|Embed strings to vectors|[embed](https://docs.cohere.com/reference/embed)|`from langchain.embeddings import CohereEmbeddings`|[cohere.ipynb](/docs/docs/integrations/text_embedding/cohere.ipynb)|
|Rerank Retriever|Rank strings based on relevance|[rerank](https://docs.cohere.com/reference/rerank)|`from langchain.retrievers.document_compressors import CohereRerank`|[cohere.ipynb](/docs/docs/integrations/retrievers/cohere-reranker.ipynb)|
There exists an Cohere LLM wrapper, which you can access with
See a [usage example](/docs/integrations/llms/cohere).
## Quick copy examples
### Chat
```python
from langchain.llms import Cohere
from langchain.chat_models import ChatCohere
from langchain.schema import HumanMessage
chat = ChatCohere()
messages = [HumanMessage(content="knock knock")]
print(chat(messages))
```
## Text Embedding Model
### LLM
There exists an Cohere Embedding model, which you can access with
```python
from langchain.embeddings import CohereEmbeddings
from langchain.llms import Cohere
llm = Cohere(model="command")
print(llm.invoke("Come up with a pet name"))
```
For a more detailed walkthrough of this, see [this notebook](/docs/integrations/text_embedding/cohere)
## Retriever
See a [usage example](/docs/integrations/retrievers/cohere-reranker).
### RAG Retriever
```python
from langchain.retrievers.document_compressors import CohereRerank
from langchain.chat_models import ChatCohere
from langchain.retrievers import CohereRagRetriever
from langchain.schema.document import Document
rag = CohereRagRetriever(llm=ChatCohere())
print(rag.get_relevant_documents("What is cohere ai?"))
```
### Text Embedding
```python
from langchain.chat_models import ChatCohere
from langchain.retrievers import CohereRagRetriever
from langchain.schema.document import Document
rag = CohereRagRetriever(llm=ChatCohere())
print(rag.get_relevant_documents("What is cohere ai?"))