You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
Example Code
This discussion is not related to any specific python code; this is more like a promotion or idea.
Error Message and Stack Trace (if applicable)
No response
Description
Intro
I am a software engineer at MediaTek, and my project involves using LangChain to address some of our challenges and to conduct research on topics related to LangChain. I believe a member of our team has already initiated contact with the vendor regarding the purchase of a LangSmith License.
Motivation
Today, I delved into the source code and discovered that this package heavily relies on Pydantic, specifically version 1. However, the OpenAI API is currently utilizing Pydantic==2.4.2Ref, there is no reason we don't upgrade it as a developer.
Observation of current repository and needs
Here are some observations and understandings I have gathered:
In langchain_core, langchain.pydantic_v1 is used solely for invoking pydantic.v1.
There are significant differences between Pydantic v1 and v2, such as:
root_validator has been replaced by model_validator.
validator has been replaced by field_validator.
etc.
Question
Should we consider updating this module?
If so, it would be my honor to undertake this task.
Workflow
If I am to proceed, my approach would include:
Replacing all instances of from langchain_core.pydantic_v1 import XXX with from pydantic import XXX within the langchain codebase.
Making the necessary updates for Pydantic, including changes to model_validator, field_validator, etc.
Keeping langchain_core.pydantic_v1 unchanged to avoid conflicts with other repositories, but issuing a deprecation warning to inform users and developers.
System Info
None
The text was updated successfully, but these errors were encountered:
This is a much larger change that we plan to do as a part of a future release.
LangChain is used by a large number of packages, many of whom still haven't upgraded to pydantic v2. We haven't wanted to break support for those users yet and wanted to give them time to upgrade before we fully break. We chose to create an interoperable layer to let you use langchain regardless of whether your environment has v1 or v2. Using v2 explicitly would break compatibility for those still on v1.
Checked other resources
Example Code
This discussion is not related to any specific python code; this is more like a promotion or idea.
Error Message and Stack Trace (if applicable)
No response
Description
Intro
I am a software engineer at MediaTek, and my project involves using LangChain to address some of our challenges and to conduct research on topics related to LangChain. I believe a member of our team has already initiated contact with the vendor regarding the purchase of a LangSmith License.
Motivation
Today, I delved into the source code and discovered that this package heavily relies on Pydantic, specifically version 1. However, the OpenAI API is currently utilizing
Pydantic==2.4.2
Ref, there is no reason we don't upgrade it as a developer.Observation of current repository and needs
Here are some observations and understandings I have gathered:
langchain.pydantic_v1
is used solely for invokingpydantic.v1
.root_validator
has been replaced bymodel_validator
.validator
has been replaced byfield_validator
.Question
Should we consider updating this module?
If so, it would be my honor to undertake this task.
Workflow
If I am to proceed, my approach would include:
from langchain_core.pydantic_v1 import XXX
withfrom pydantic import XXX
within thelangchain
codebase.model_validator
,field_validator
, etc.langchain_core.pydantic_v1
unchanged to avoid conflicts with other repositories, but issuing a deprecation warning to inform users and developers.System Info
None
The text was updated successfully, but these errors were encountered: