mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-27 06:18:05 +00:00
core[patch]: Ignore pydantic deprecation warnings in validate_arguments (#26122)
For now, we'll use the deprecation functionality which is present until pydantic 3.
This commit is contained in:
@@ -31,6 +31,7 @@ from pydantic import (
|
||||
BaseModel,
|
||||
ConfigDict,
|
||||
Field,
|
||||
PydanticDeprecationWarning,
|
||||
SkipValidation,
|
||||
ValidationError,
|
||||
model_validator,
|
||||
@@ -207,7 +208,12 @@ def create_schema_from_function(
|
||||
A pydantic model with the same arguments as the function.
|
||||
"""
|
||||
# https://docs.pydantic.dev/latest/usage/validation_decorator/
|
||||
validated = validate_arguments(func, config=_SchemaConfig) # type: ignore
|
||||
with warnings.catch_warnings():
|
||||
# We are using deprecated functionality here.
|
||||
# This code should be re-written to simply construct a pydantic model
|
||||
# using inspect.signature and create_model.
|
||||
warnings.simplefilter("ignore", category=PydanticDeprecationWarning)
|
||||
validated = validate_arguments(func, config=_SchemaConfig) # type: ignore
|
||||
|
||||
sig = inspect.signature(func)
|
||||
|
||||
|
Reference in New Issue
Block a user