mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-28 09:28:48 +00:00
parent
b11c233304
commit
0c4683ebcc
@ -31,7 +31,7 @@ the case of inheritance and in the case of passing objects to LangChain.
|
|||||||
**YES**
|
**YES**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.pydantic_v1 import root_validator, validator
|
from pydantic.v1 import root_validator, validator
|
||||||
|
|
||||||
class CustomTool(BaseTool): # BaseTool is v1 code
|
class CustomTool(BaseTool): # BaseTool is v1 code
|
||||||
x: int = Field(default=1)
|
x: int = Field(default=1)
|
||||||
@ -84,7 +84,7 @@ CustomTool(
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.tools.base import Tool
|
from langchain.tools.base import Tool
|
||||||
from langchain.pydantic_v1 import BaseModel, Field # <-- Uses v1 namespace
|
from pydantic.v1 import BaseModel, Field # <-- Uses v1 namespace
|
||||||
|
|
||||||
class CalculatorInput(BaseModel):
|
class CalculatorInput(BaseModel):
|
||||||
question: str = Field()
|
question: str = Field()
|
||||||
|
Loading…
Reference in New Issue
Block a user