Conditionally add pydantic v1 to namespace (#9202)

Conditionally add pydantic_v1 to namespace.
pull/9233/head
Eugene Yurtsev 11 months ago committed by GitHub
parent feec422bf7
commit 04bc5f3b18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,7 +21,11 @@ try:
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

Loading…
Cancel
Save