Skip to content

Commit

Permalink
Wrap replicate package import in try/except.
Browse files Browse the repository at this point in the history
Signed-off-by: Fayvor Love <[email protected]>
  • Loading branch information
fayvor committed Nov 2, 2024
1 parent 72e242b commit b581070
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion libs/community/langchain_community/llms/replicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
from langchain_core.utils import get_from_dict_or_env, pre_init
from langchain_core.utils.pydantic import get_fields
from pydantic import ConfigDict, Field, model_validator
from replicate.client import Client
from typing_extensions import Self

if TYPE_CHECKING:
from replicate.prediction import Prediction

try:
from replicate.client import Client
except ImportError:
raise ImportError(
"Could not import replicate python package. "
"Please install it with `pip install replicate`."
)

logger = logging.getLogger(__name__)


Expand Down
4 changes: 2 additions & 2 deletions libs/community/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ select = [ "E", "F", "I", "T201",]
omit = [ "tests/*",]

[tool.pytest.ini_options]
addopts = "--strict-markers --strict-config --durations=5 --snapshot-warn-unused -vv"
addopts = "--strict-markers --strict-config --durations=5 -vv"
markers = [ "requires: mark tests as requiring a specific library", "scheduled: mark tests to run in scheduled testing", "compile: mark placeholder test used to compile integration tests without running them",]
asyncio_mode = "auto"
# asyncio_mode = "auto"
filterwarnings = [ "ignore::langchain_core._api.beta_decorator.LangChainBetaWarning", "ignore::langchain_core._api.deprecation.LangChainDeprecationWarning:test", "ignore::langchain_core._api.deprecation.LangChainPendingDeprecationWarning:test",]

[tool.poetry.group.test]
Expand Down

0 comments on commit b581070

Please sign in to comment.