mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-09 15:03:21 +00:00
ruff: add bugbear across packages (#31917)
WIP, other packages will get in next PRs
This commit is contained in:
@@ -98,12 +98,12 @@ class HuggingFaceEndpointEmbeddings(BaseModel, Embeddings):
|
||||
self.client = client
|
||||
self.async_client = async_client
|
||||
|
||||
except ImportError:
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import huggingface_hub python package. "
|
||||
"Please install it with `pip install huggingface_hub`."
|
||||
)
|
||||
raise ImportError(msg)
|
||||
raise ImportError(msg) from e
|
||||
return self
|
||||
|
||||
def embed_documents(self, texts: list[str]) -> list[list[float]]:
|
||||
|
@@ -115,12 +115,12 @@ class HuggingFacePipeline(BaseLLM):
|
||||
)
|
||||
from transformers import pipeline as hf_pipeline # type: ignore[import]
|
||||
|
||||
except ImportError:
|
||||
except ImportError as e:
|
||||
msg = (
|
||||
"Could not import transformers python package. "
|
||||
"Please install it with `pip install transformers`."
|
||||
)
|
||||
raise ValueError(msg)
|
||||
raise ValueError(msg) from e
|
||||
|
||||
_model_kwargs = model_kwargs.copy() if model_kwargs else {}
|
||||
if device_map is not None:
|
||||
|
Reference in New Issue
Block a user