Skip to content

Commit

Permalink
Conditionally add pydantic v1 to namespace (langchain-ai#9202)
Browse files Browse the repository at this point in the history
Conditionally add pydantic_v1 to namespace.
  • Loading branch information
eyurtsev authored and toshishjawale committed Aug 14, 2023
1 parent 8746cd7 commit 636cf9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/langchain/langchain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
except ImportError:
pydantic_v1 = importlib.import_module("pydantic")

sys.modules["pydantic_v1"] = pydantic_v1
if "pydantic_v1" not in sys.modules:
# Use a conditional because langchain experimental
# will use the same strategy to add pydantic_v1 to sys.modules
# and may run prior to langchain core package.
sys.modules["pydantic_v1"] = pydantic_v1

from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
from langchain.cache import BaseCache
Expand Down

0 comments on commit 636cf9d

Please sign in to comment.