OpenAI as default #11409
Replies: 1 comment 1 reply
-
🤖 Hey @pjbruno327, long time no see! Hope you're doing awesome. 😄 To unset OpenAI as the default for LLM and embeddings in LlamaIndex, you need to modify the Currently, the function sets OpenAI as the default embedding model when For example, if you want to set HuggingFace as the default, you can modify the function as follows: def resolve_embed_model(
embed_model: Optional[EmbedType] = None,
callback_manager: Optional[CallbackManager] = None,
) -> BaseEmbedding:
"""Resolve embed model."""
from llama_index.core.settings import Settings
try:
from llama_index.core.bridge.langchain import Embeddings as LCEmbeddings
except ImportError:
LCEmbeddings = None # type: ignore
if embed_model == "default":
try:
from llama_index.embeddings.huggingface import (
HuggingFaceEmbedding,
) # pants: no-infer-dep
splits = embed_model.split(":", 1)
is_local = splits[0]
model_name = splits[1] if len(splits) > 1 else None
if is_local != "local":
raise ValueError(
"embed_model must start with str 'local' or of type BaseEmbedding"
)
cache_folder = os.path.join(get_cache_dir(), "models")
os.makedirs(cache_folder, exist_ok=True)
embed_model = HuggingFaceEmbedding(
model_name=model_name, cache_folder=cache_folder
)
except ImportError:
raise ImportError(
"`llama-index-embeddings-huggingface` package not found, "
"please run `pip install llama-index-embeddings-huggingface`"
)
# rest of the function This modification will set HuggingFace as the default embedding model when You can find the Sources
|
Beta Was this translation helpful? Give feedback.
-
How do I remove OpenAI as the default for LLM and embeddings?
Beta Was this translation helpful? Give feedback.
All reactions