mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-04 12:39:32 +00:00
docs: Update how to docs for pydantic compatibility (#22983)
Add missing imports in docs from langchain_core.tools BaseTool --------- Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
This commit is contained in:
@@ -22,6 +22,7 @@ the case of inheritance and in the case of passing objects to LangChain.
|
||||
|
||||
```python
|
||||
from pydantic.v1 import root_validator, validator
|
||||
from langchain_core.tools import BaseTool
|
||||
|
||||
class CustomTool(BaseTool): # BaseTool is v1 code
|
||||
x: int = Field(default=1)
|
||||
@@ -48,6 +49,7 @@ Mixing Pydantic v2 primitives with Pydantic v1 primitives can raise cryptic erro
|
||||
|
||||
```python
|
||||
from pydantic import Field, field_validator # pydantic v2
|
||||
from langchain_core.tools import BaseTool
|
||||
|
||||
class CustomTool(BaseTool): # BaseTool is v1 code
|
||||
x: int = Field(default=1)
|
||||
|
Reference in New Issue
Block a user