Update compatibility guide for pydantic (#9396)

Use langchain.pydantic_v1 instead of pydantic_v1
This commit is contained in:
Eugene Yurtsev 2023-08-17 15:09:18 -04:00 committed by GitHub
parent 8c986221e4
commit b11c233304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ the case of inheritance and in the case of passing objects to LangChain.
**YES**
```python
from pydantic.v1 import root_validator, validator
from langchain.pydantic_v1 import root_validator, validator
class CustomTool(BaseTool): # BaseTool is v1 code
x: int = Field(default=1)
@ -84,7 +84,7 @@ CustomTool(
```python
from langchain.tools.base import Tool
from pydantic.v1 import BaseModel, Field # <-- Uses v1 namespace
from langchain.pydantic_v1 import BaseModel, Field # <-- Uses v1 namespace
class CalculatorInput(BaseModel):
question: str = Field()