mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
docs: Update pydantic compatibility (#25145)
Update pydantic compatibility
This commit is contained in:
parent
425f6ffa5b
commit
3da2713172
@ -13,9 +13,14 @@ the v1 namespace of Pydantic 2.
|
|||||||
Because Pydantic does not support mixing .v1 and .v2 objects, users should be aware of a number of issues
|
Because Pydantic does not support mixing .v1 and .v2 objects, users should be aware of a number of issues
|
||||||
when using LangChain with Pydantic.
|
when using LangChain with Pydantic.
|
||||||
|
|
||||||
|
:::caution
|
||||||
|
While LangChain supports Pydantic V2 objects in some APIs (listed below), it's suggested that users keep using Pydantic V1 objects until LangChain 0.3 is released.
|
||||||
|
:::
|
||||||
|
|
||||||
|
|
||||||
## 1. Passing Pydantic objects to LangChain APIs
|
## 1. Passing Pydantic objects to LangChain APIs
|
||||||
|
|
||||||
Most LangChain APIs that accept Pydantic objects have been updated to accept both Pydantic v1 and v2 objects.
|
Most LangChain APIs for *tool usage* (see list below) have been updated to accept either Pydantic v1 or v2 objects.
|
||||||
|
|
||||||
* Pydantic v1 objects correspond to subclasses of `pydantic.BaseModel` if `pydantic 1` is installed or subclasses of `pydantic.v1.BaseModel` if `pydantic 2` is installed.
|
* Pydantic v1 objects correspond to subclasses of `pydantic.BaseModel` if `pydantic 1` is installed or subclasses of `pydantic.v1.BaseModel` if `pydantic 2` is installed.
|
||||||
* Pydantic v2 objects correspond to subclasses of `pydantic.BaseModel` if `pydantic 2` is installed.
|
* Pydantic v2 objects correspond to subclasses of `pydantic.BaseModel` if `pydantic 2` is installed.
|
||||||
|
Loading…
Reference in New Issue
Block a user