mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 12:07:36 +00:00
fix(core): Dereference Refs for pydantic schema fails in tool schema generation (#32203)
The `_dereference_refs_helper` in `langchain_core.utils.json_schema` incorrectly handled objects with a reference and other fields. **Issue**: #32170 # Description We change the check so that it accepts other keys in the object.
This commit is contained in:
@@ -55,7 +55,7 @@ def _dereference_refs_helper(
|
|||||||
processed_refs = set()
|
processed_refs = set()
|
||||||
|
|
||||||
# 1) Pure $ref node?
|
# 1) Pure $ref node?
|
||||||
if isinstance(obj, dict) and set(obj.keys()) == {"$ref"}:
|
if isinstance(obj, dict) and "$ref" in set(obj.keys()):
|
||||||
ref_path = obj["$ref"]
|
ref_path = obj["$ref"]
|
||||||
# cycle?
|
# cycle?
|
||||||
if ref_path in processed_refs:
|
if ref_path in processed_refs:
|
||||||
|
Reference in New Issue
Block a user