mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-28 15:00:23 +00:00
core[patch]: Fix regression in core (#26121)
Limited to unit testing code -- did not cause any actual issues
This commit is contained in:
@@ -70,13 +70,14 @@ def _remove_enum_description(obj: Any) -> None:
|
|||||||
|
|
||||||
def _schema(obj: Any) -> dict:
|
def _schema(obj: Any) -> dict:
|
||||||
"""Return the schema of the object."""
|
"""Return the schema of the object."""
|
||||||
# Remap to old style schema
|
|
||||||
if not is_basemodel_subclass(obj):
|
if not is_basemodel_subclass(obj):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"Object must be a Pydantic BaseModel subclass. Got {type(obj)}"
|
f"Object must be a Pydantic BaseModel subclass. Got {type(obj)}"
|
||||||
)
|
)
|
||||||
|
# Remap to old style schema
|
||||||
if not hasattr(obj, "model_json_schema"): # V1 model
|
if not hasattr(obj, "model_json_schema"): # V1 model
|
||||||
return obj.model_json_schema()
|
return obj.schema()
|
||||||
|
|
||||||
schema_ = obj.model_json_schema(ref_template="#/definitions/{model}")
|
schema_ = obj.model_json_schema(ref_template="#/definitions/{model}")
|
||||||
if "$defs" in schema_:
|
if "$defs" in schema_:
|
||||||
|
Reference in New Issue
Block a user