mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 20:12:55 +01:00
Separate local mode into llms-llama-cpp and embeddings-huggingface for clarity
This commit is contained in:
parent
85276893a3
commit
c3fe36e070
21 changed files with 186 additions and 106 deletions
|
|
@ -18,18 +18,18 @@ class EmbeddingComponent:
|
|||
embedding_mode = settings.embedding.mode
|
||||
logger.info("Initializing the embedding model in mode=%s", embedding_mode)
|
||||
match embedding_mode:
|
||||
case "local":
|
||||
case "huggingface":
|
||||
try:
|
||||
from llama_index.embeddings.huggingface import ( # type: ignore
|
||||
HuggingFaceEmbedding,
|
||||
)
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"Local dependencies not found, install with `poetry install --extras local`"
|
||||
"Local dependencies not found, install with `poetry install --extras embeddings-huggingface`"
|
||||
) from e
|
||||
|
||||
self.embedding_model = HuggingFaceEmbedding(
|
||||
model_name=settings.local.embedding_hf_model_name,
|
||||
model_name=settings.huggingface.embedding_hf_model_name,
|
||||
cache_folder=str(models_cache_path),
|
||||
)
|
||||
case "sagemaker":
|
||||
|
|
@ -39,7 +39,7 @@ class EmbeddingComponent:
|
|||
)
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"Sagemaker dependencies not found, install with `poetry install --extras sagemaker`"
|
||||
"Sagemaker dependencies not found, install with `poetry install --extras embeddings-sagemaker`"
|
||||
) from e
|
||||
|
||||
self.embedding_model = SagemakerEmbedding(
|
||||
|
|
@ -52,7 +52,7 @@ class EmbeddingComponent:
|
|||
)
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"OpenAI dependencies not found, install with `poetry install --extras openai`"
|
||||
"OpenAI dependencies not found, install with `poetry install --extras embeddings-openai`"
|
||||
) from e
|
||||
|
||||
openai_settings = settings.openai.api_key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue