mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-29 07:19:59 +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,
|
BaseModel,
|
||||||
ConfigDict,
|
ConfigDict,
|
||||||
Field,
|
Field,
|
||||||
|
PydanticDeprecationWarning,
|
||||||
SkipValidation,
|
SkipValidation,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
model_validator,
|
model_validator,
|
||||||
@@ -207,6 +208,11 @@ def create_schema_from_function(
|
|||||||
A pydantic model with the same arguments as the function.
|
A pydantic model with the same arguments as the function.
|
||||||
"""
|
"""
|
||||||
# https://docs.pydantic.dev/latest/usage/validation_decorator/
|
# https://docs.pydantic.dev/latest/usage/validation_decorator/
|
||||||
|
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
|
validated = validate_arguments(func, config=_SchemaConfig) # type: ignore
|
||||||
|
|
||||||
sig = inspect.signature(func)
|
sig = inspect.signature(func)
|
||||||
|
Reference in New Issue
Block a user