Last active 1730463930

embedding.py Raw
1# Embedding setup
2embedding_provider = config.get("embedding_provider", "default")
3if embedding_provider == "huggingface":
4 from llama_index.embeddings.huggingface import HuggingFaceEmbedding
5
6 embedding_name = config.get("embedding_name")
7 if not embedding_name:
8 raise ValueError(
9 "Embedding name must be specified for Hugging Face embeddings."
10 )
11 EMBED_MODEL = HuggingFaceEmbedding(model_name=embedding_name)
12 Settings.embed_model = EMBED_MODEL
13elif embedding_provider == "default":
14 # Use default embedding (e.g., OpenAI)
15 pass
16else:
17 raise ValueError(f"Unsupported embedding_provider: {embedding_provider}")