Adala-ai / apps /api /app /rag /embeddings.py
quantumsquatan's picture
Deploy Adala AI application
ee9de9c verified
Raw
History Blame Contribute Delete
387 Bytes
from functools import lru_cache
from langchain_huggingface import HuggingFaceEmbeddings
from app.config import settings
@lru_cache
def get_embeddings() -> HuggingFaceEmbeddings:
return HuggingFaceEmbeddings(
model_name=settings.embedding_model,
model_kwargs={"trust_remote_code": True},
encode_kwargs={"normalize_embeddings": True},
)