Skip to content

Commit fb5da83

Browse files
authored
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.
1 parent a7d0e42 commit fb5da83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libs/core/langchain_core/utils/json_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _dereference_refs_helper(
5555
processed_refs = set()
5656

5757
# 1) Pure $ref node?
58-
if isinstance(obj, dict) and set(obj.keys()) == {"$ref"}:
58+
if isinstance(obj, dict) and "$ref" in set(obj.keys()):
5959
ref_path = obj["$ref"]
6060
# cycle?
6161
if ref_path in processed_refs:

0 commit comments

Comments
 (0)