Last active 1730463930

mathieu's Avatar mathieu revised this gist 1730463930. Go to revision

1 file changed, 0 insertions, 0 deletions

embedding renamed to embedding.py

File renamed without changes

mathieu's Avatar mathieu revised this gist 1730463916. Go to revision

1 file changed, 17 insertions

embedding(file created)

@@ -0,0 +1,17 @@
1 + # Embedding setup
2 + embedding_provider = config.get("embedding_provider", "default")
3 + if 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
13 + elif embedding_provider == "default":
14 + # Use default embedding (e.g., OpenAI)
15 + pass
16 + else:
17 + raise ValueError(f"Unsupported embedding_provider: {embedding_provider}")
Newer Older