# HuggingFaceBgeEmbeddings

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/embeddings/huggingface/HuggingFaceBgeEmbeddings)

HuggingFace sentence_transformers embedding models.

To use, you should have the ``sentence_transformers`` python package installed.
To use Nomic, make sure the version of ``sentence_transformers`` >= 2.3.0.

## Signature

```python
HuggingFaceBgeEmbeddings(
    self,
    **kwargs: Any = {},
)
```

## Description

**Bge Example:**

.. code-block:: python

from langchain_community.embeddings import HuggingFaceBgeEmbeddings

model_name = "BAAI/bge-large-en-v1.5"
model_kwargs = {'device': 'cpu'}
encode_kwargs = {'normalize_embeddings': True}
hf = HuggingFaceBgeEmbeddings(
    model_name=model_name,
    model_kwargs=model_kwargs,
    encode_kwargs=encode_kwargs
)

Nomic Example:
   .. code-block:: python

       from langchain_community.embeddings import HuggingFaceBgeEmbeddings

       model_name = "nomic-ai/nomic-embed-text-v1"
       model_kwargs = {
           'device': 'cpu',
           'trust_remote_code':True
           }
       encode_kwargs = {'normalize_embeddings': True}
       hf = HuggingFaceBgeEmbeddings(
           model_name=model_name,
           model_kwargs=model_kwargs,
           encode_kwargs=encode_kwargs,
           query_instruction = "search_query:",
           embed_instruction = "search_document:"
       )

## Extends

- `BaseModel`
- `Embeddings`

## Constructors

```python
__init__(
    self,
    **kwargs: Any = {},
)
```


## Properties

- `client`
- `model_name`
- `cache_folder`
- `model_kwargs`
- `encode_kwargs`
- `query_instruction`
- `embed_instruction`
- `show_progress`
- `model_config`

## Methods

- [`embed_documents()`](https://reference.langchain.com/python/langchain-community/embeddings/huggingface/HuggingFaceBgeEmbeddings/embed_documents)
- [`embed_query()`](https://reference.langchain.com/python/langchain-community/embeddings/huggingface/HuggingFaceBgeEmbeddings/embed_query)

## ⚠️ Deprecated

Deprecated since version 0.2.2.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/embeddings/huggingface.py#L252)