mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Merge #8812 with main to fix unrelated test failure Co-authored-by: shibuiwilliam <shibuiyusuke@gmail.com>
This commit is contained in:
parent
15c271e7b3
commit
f76d50d8dc
@ -43,7 +43,7 @@ class OBSDirectoryLoader(BaseLoader):
|
||||
try:
|
||||
from obs import ObsClient
|
||||
except ImportError:
|
||||
raise ValueError(
|
||||
raise ImportError(
|
||||
"Could not import esdk-obs-python python package. "
|
||||
"Please install it with `pip install esdk-obs-python`."
|
||||
)
|
||||
|
@ -67,7 +67,7 @@ class OBSFileLoader(BaseLoader):
|
||||
try:
|
||||
from obs import ObsClient
|
||||
except ImportError:
|
||||
raise ValueError(
|
||||
raise ImportError(
|
||||
"Could not import esdk-obs-python python package. "
|
||||
"Please install it with `pip install esdk-obs-python`."
|
||||
)
|
||||
|
@ -149,14 +149,14 @@ class OpenAIWhisperParserLocal(BaseBlobParser):
|
||||
try:
|
||||
from pydub import AudioSegment
|
||||
except ImportError:
|
||||
raise ValueError(
|
||||
"pydub package not found, please install it with " "`pip install pydub`"
|
||||
raise ImportError(
|
||||
"pydub package not found, please install it with `pip install pydub`"
|
||||
)
|
||||
|
||||
try:
|
||||
import librosa
|
||||
except ImportError:
|
||||
raise ValueError(
|
||||
raise ImportError(
|
||||
"librosa package not found, please install it with "
|
||||
"`pip install librosa`"
|
||||
)
|
||||
|
@ -183,7 +183,7 @@ class AmazonTextractPDFParser(BaseBlobParser):
|
||||
else:
|
||||
self.textract_features = []
|
||||
except ImportError:
|
||||
raise ModuleNotFoundError(
|
||||
raise ImportError(
|
||||
"Could not import amazon-textract-caller python package. "
|
||||
"Please install it with `pip install amazon-textract-caller`."
|
||||
)
|
||||
@ -194,7 +194,7 @@ class AmazonTextractPDFParser(BaseBlobParser):
|
||||
|
||||
self.boto3_textract_client = boto3.client("textract")
|
||||
except ImportError:
|
||||
raise ModuleNotFoundError(
|
||||
raise ImportError(
|
||||
"Could not import boto3 python package. "
|
||||
"Please install it with `pip install boto3`."
|
||||
)
|
||||
|
@ -295,7 +295,13 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
|
||||
if self.openai_api_type in ("azure", "azure_ad", "azuread"):
|
||||
openai_args["engine"] = self.deployment
|
||||
if self.openai_proxy:
|
||||
try:
|
||||
import openai
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Could not import openai python package. "
|
||||
"Please install it with `pip install openai`."
|
||||
)
|
||||
|
||||
openai.proxy = {
|
||||
"http": self.openai_proxy,
|
||||
|
@ -30,6 +30,7 @@ def _load_rapidfuzz() -> Any:
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Please install the rapidfuzz library to use the FuzzyMatchStringEvaluator."
|
||||
"Please install it with `pip install rapidfuzz`."
|
||||
)
|
||||
return rapidfuzz.distance
|
||||
|
||||
|
@ -66,6 +66,7 @@ class CosmosDBChatMessageHistory(BaseChatMessageHistory):
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"You must install the azure-cosmos package to use the CosmosDBChatMessageHistory." # noqa: E501
|
||||
"Please install it with `pip install azure-cosmos`."
|
||||
) from exc
|
||||
if self.credential:
|
||||
self._client = CosmosClient(
|
||||
@ -94,6 +95,7 @@ class CosmosDBChatMessageHistory(BaseChatMessageHistory):
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"You must install the azure-cosmos package to use the CosmosDBChatMessageHistory." # noqa: E501
|
||||
"Please install it with `pip install azure-cosmos`."
|
||||
) from exc
|
||||
database = self._client.create_database_if_not_exists(self.cosmos_database)
|
||||
self._container = database.create_container_if_not_exists(
|
||||
@ -130,6 +132,7 @@ class CosmosDBChatMessageHistory(BaseChatMessageHistory):
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"You must install the azure-cosmos package to use the CosmosDBChatMessageHistory." # noqa: E501
|
||||
"Please install it with `pip install azure-cosmos`."
|
||||
) from exc
|
||||
try:
|
||||
item = self._container.read_item(
|
||||
|
@ -72,8 +72,9 @@ class NGramOverlapExampleSelector(BaseExampleSelector, BaseModel):
|
||||
sentence_bleu,
|
||||
)
|
||||
except ImportError as e:
|
||||
raise ValueError(
|
||||
"Not all the correct dependencies for this ExampleSelect exist"
|
||||
raise ImportError(
|
||||
"Not all the correct dependencies for this ExampleSelect exist."
|
||||
"Please install nltk with `pip install nltk`."
|
||||
) from e
|
||||
|
||||
return values
|
||||
|
Loading…
Reference in New Issue
Block a user