mirror of https://github.com/hwchase17/langchain
DOCS: Fix Sample Code for Compatibility with Pydantic 2.0 (#13890)
- **Description:** I encountered an issue while running the existing sample code on the page https://python.langchain.com/docs/modules/agents/how_to/agent_iter in an environment with Pydantic 2.0 installed. The following error was triggered: ```python ValidationError Traceback (most recent call last) <ipython-input-12-2ffff2c87e76> in <cell line: 43>() 41 42 tools = [ ---> 43 Tool( 44 name="GetPrime", 45 func=get_prime, 2 frames /usr/local/lib/python3.10/dist-packages/pydantic/v1/main.py in __init__(__pydantic_self__, **data) 339 values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data) 340 if validation_error: --> 341 raise validation_error 342 try: 343 object_setattr(__pydantic_self__, '__dict__', values) ValidationError: 1 validation error for Tool args_schema subclass of BaseModel expected (type=type_error.subclass; expected_class=BaseModel) ``` I have made modifications to the example code to ensure it functions correctly in environments with Pydantic 2.0.pull/13889/head^2
parent
968ba6961f
commit
f2af82058f
Loading…
Reference in New Issue