Harrison/error hf (#3348)

Co-authored-by: Rui Melo <44201826+rufimelo99@users.noreply.github.com>
This commit is contained in:
Harrison Chase 2023-04-22 09:06:36 -07:00 committed by GitHub
parent a5ad1c270f
commit 6200a2a00e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,14 +43,15 @@ class HuggingFaceEmbeddings(BaseModel, Embeddings):
try:
import sentence_transformers
self.client = sentence_transformers.SentenceTransformer(
self.model_name, cache_folder=self.cache_folder, **self.model_kwargs
)
except ImportError:
except ImportError as exc:
raise ValueError(
"Could not import sentence_transformers python package. "
"Please install it with `pip install sentence_transformers`."
)
) from exc
self.client = sentence_transformers.SentenceTransformer(
self.model_name, cache_folder=self.cache_folder, **self.model_kwargs
)
class Config:
"""Configuration for this pydantic object."""