law-bot / embeddings.py
anpigon's picture
chore: Add utils, config, embeddings, retrievers, prompt, and llm modules
56487d0
raw
history blame
352 Bytes
# 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},
)