| from langchain_huggingface import HuggingFaceEmbeddings | |
| def get_embedding_model() -> HuggingFaceEmbeddings: | |
| model_name = "BAAI/bge-small-en-v1.5" | |
| print(f"Loading embedding model: {model_name} ...") | |
| embeddings = HuggingFaceEmbeddings( | |
| model_name=model_name, | |
| model_kwargs={"device": "cpu"}, | |
| encode_kwargs={"normalize_embeddings": True}, | |
| ) | |
| print("Embedding model loaded successfully.") | |
| return embeddings | |