Skip to content

Commit 8010d99

Browse files
committed
Add langchain as optional dependency.
1 parent 2c7a77f commit 8010d99

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

ads/llm/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44
# Copyright (c) 2023 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

7-
8-
from ads.llm.langchain.plugins.llm_gen_ai import GenerativeAI
9-
from ads.llm.langchain.plugins.llm_md import ModelDeploymentTGI
10-
from ads.llm.langchain.plugins.llm_md import ModelDeploymentVLLM
11-
from ads.llm.langchain.plugins.embeddings import GenerativeAIEmbeddings
7+
try:
8+
import langchain
9+
from ads.llm.langchain.plugins.llm_gen_ai import GenerativeAI
10+
from ads.llm.langchain.plugins.llm_md import ModelDeploymentTGI
11+
from ads.llm.langchain.plugins.llm_md import ModelDeploymentVLLM
12+
from ads.llm.langchain.plugins.embeddings import GenerativeAIEmbeddings
13+
except ImportError as ex:
14+
if ex.name == "langchain":
15+
raise ImportError(
16+
f"{ex.msg}\nPlease install/update langchain with `pip install langchain -U`"
17+
) from ex
18+
raise ex

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-r test-requirements.txt
2-
-e ".[bds,data,geo,huggingface,notebook,onnx,opctl,optuna,pii,spark,tensorflow,text,torch,viz]"
2+
-e ".[bds,data,geo,huggingface,llm,notebook,onnx,opctl,optuna,pii,spark,tensorflow,text,torch,viz]"
33
arff
44
category_encoders
55
dask

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ pii = [
181181
"spacy-transformers==1.2.5",
182182
"spacy==3.6.1",
183183
]
184+
llm = [
185+
"langchain>=0.0.295"
186+
]
184187

185188
[project.urls]
186189
"Github" = "https://github.com/oracle/accelerated-data-science"

0 commit comments

Comments
 (0)