File size: 355 Bytes
de850e8
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# embeddings.py
from langchain_community.embeddings import HuggingFaceBgeEmbeddings

from .config import EMBEDDING_MODEL
from .utils import get_device


def get_embeddings():
    return HuggingFaceBgeEmbeddings(
        model_name=EMBEDDING_MODEL,
        model_kwargs={"device": get_device()},
        encode_kwargs={"normalize_embeddings": True},
    )