Skip to content

Commit e6c9478

Browse files
committed
apply review suggestions
1 parent 56cf606 commit e6c9478

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

docs/user-guides/python-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ For convenience, this toolkit also includes a selection of LangChain tools, wrap
132132

133133
### Chains as Actions
134134

135-
> **⚠️ DEPRECATED**: Chain support is deprecated and will be removed in a future release. Please use [Runnable](https://python.langchain.com/docs/expression_language/) instead. See the [Runnable as Action Guide](langchain/runnable-as-action/README.md) for examples.
135+
> **⚠️ DEPRECATED**: Chain support is deprecated and will be removed in a future release. Please use [Runnable](https://python.langchain.com/docs/expression_language/) instead. See the [Runnable as Action Guide](../langchain/runnable-as-action/README.md) for examples.
136136
137137
You can register a Langchain chain as an action using the [LLMRails.register_action](../api/nemoguardrails.rails.llm.llmrails.md#method-llmrailsregister_action) method:
138138

examples/configs/rag/multi_kb/config.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
from langchain_classic.embeddings import HuggingFaceEmbeddings
3434
from langchain_classic.text_splitter import CharacterTextSplitter
3535
from langchain_classic.vectorstores import FAISS
36-
except ImportError as e:
36+
except ImportError as second_error:
3737
raise ImportError(
38-
"Failed to import from langchain. If you're using LangChain >= 1.0.0, "
39-
"please install langchain-classic: pip install langchain-classic"
40-
) from e
38+
f"Failed to import required LangChain modules. "
39+
f"If you're using LangChain >= 1.0.0, ensure langchain-classic and langchain-text-splitters is installed. "
40+
f"Original error: {second_error}"
41+
) from second_error
4142

4243
from langchain_core.language_models.llms import BaseLLM
4344
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

examples/configs/rag/pinecone/config.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,21 @@
2121

2222
try:
2323
from langchain.chains import RetrievalQA
24-
from langchain.docstore.document import Document
2524
from langchain.embeddings.openai import OpenAIEmbeddings
2625
from langchain.vectorstores import Pinecone
2726
except ImportError:
2827
try:
2928
from langchain_classic.chains import RetrievalQA
30-
from langchain_classic.docstore.document import Document
3129
from langchain_classic.embeddings.openai import OpenAIEmbeddings
3230
from langchain_classic.vectorstores import Pinecone
33-
except ImportError as e:
31+
except ImportError as second_error:
3432
raise ImportError(
35-
"Failed to import from langchain. If you're using LangChain >= 1.0.0, "
36-
"please install langchain-classic: pip install langchain-classic"
37-
) from e
33+
f"Failed to import required LangChain modules. "
34+
f"If you're using LangChain >= 1.0.0, ensure langchain-classic is installed. "
35+
f"Original error: {second_error}"
36+
) from second_error
3837

39-
from langchain_core.language_models.llms import BaseLLM
38+
from langchain_core.language_models import BaseLLM
4039

4140
from nemoguardrails import LLMRails
4241
from nemoguardrails.actions import action

examples/scripts/langchain/experiments.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
except ImportError:
2121
try:
2222
from langchain_classic.chains import LLMMathChain
23-
except ImportError as e:
23+
except ImportError as second_error:
2424
raise ImportError(
25-
"Failed to import LLMMathChain. If you're using LangChain >= 1.0.0, "
26-
"please install langchain-classic: pip install langchain-classic"
27-
) from e
25+
f"Failed to import required LangChain modules. "
26+
f"If you're using LangChain >= 1.0.0, ensure langchain-classic is installed. "
27+
f"Original error: {second_error}"
28+
) from second_error
2829

2930
from langchain_core.prompts import ChatPromptTemplate
3031
from langchain_core.tools import Tool

0 commit comments

Comments
 (0)