This commit is contained in:
Robert Hirsch 2024-06-06 20:56:09 +02:00
parent 94712824d6
commit 757a8c79fd
No known key found for this signature in database
GPG key ID: A9D9D1205DBED12C
3 changed files with 6 additions and 0 deletions

View file

@ -31,6 +31,7 @@ class EmbeddingComponent:
self.embedding_model = HuggingFaceEmbedding(
model_name=settings.huggingface.embedding_hf_model_name,
cache_folder=str(models_cache_path),
max_length=settings.huggingface.embedding_hf_max_length,
)
case "sagemaker":
try:

View file

@ -151,6 +151,10 @@ class HuggingFaceSettings(BaseModel):
embedding_hf_model_name: str = Field(
description="Name of the HuggingFace model to use for embeddings"
)
embedding_hf_max_length: int = Field(
None,
description="Some embedding models have a maximum length for input, provide here for not crashing"
)
access_token: str = Field(
None,
description="Huggingface access token, required to download some models",

View file

@ -69,6 +69,7 @@ embedding:
huggingface:
embedding_hf_model_name: BAAI/bge-small-en-v1.5
embedding_hf_max_length: 512 # some models have a maximum length for input
access_token: ${HUGGINGFACE_TOKEN:}
vectorstore: