Skip to content

The agent engineering platform.

docs: Add explanation on how to use Hugging Face embeddings (#22118)

Tom Aarsen5b5ea2af30ed
diff --git a/docs/docs/how_to/embed_text.mdx b/docs/docs/how_to/embed_text.mdx
index 1be7b054d1..ed75a36a62 100644
--- a/docs/docs/how_to/embed_text.mdx
+++ b/docs/docs/how_to/embed_text.mdx
@@ -75,6 +75,31 @@ Otherwise you can initialize without any params:
from langchain_cohere import CohereEmbeddings
embeddings_model = CohereEmbeddings()
+```
+
+ </TabItem>
+ <TabItem value="huggingface" label="Hugging Face">
+
+To start we'll need to install the Hugging Face partner package:
+
+```bash
+pip install langchain-huggingface
+```
+
+You can then load any [Sentence Transformers model](https://huggingface.co/models?library=sentence-transformers) from the Hugging Face Hub.
+
+```python
+from langchain_huggingface import HuggingFaceEmbeddings
+
+embeddings_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2")
+```
+
+You can also leave the `model_name` blank to use the default [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) model.
+
+```python
+from langchain_huggingface import HuggingFaceEmbeddings
+
+embeddings_model = HuggingFaceEmbeddings()
```
</TabItem>