replace_all_of_with_ref() — langchain Function Reference
Architecture documentation for the replace_all_of_with_ref() function in pydantic_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 4b6cb995_0278_5df7_b4c7_82cb6b0b8320["replace_all_of_with_ref()"] b22df862_b52d_14dc_cb85_6573258dd27c["pydantic_utils.py"] 4b6cb995_0278_5df7_b4c7_82cb6b0b8320 -->|defined in| b22df862_b52d_14dc_cb85_6573258dd27c 231942ec_e6ee_db67_4aa9_62b78c60b2f1["_schema()"] 231942ec_e6ee_db67_4aa9_62b78c60b2f1 -->|calls| 4b6cb995_0278_5df7_b4c7_82cb6b0b8320 31a96103_4c69_062c_4133_8d54d03d7cea["_normalize_schema()"] 31a96103_4c69_062c_4133_8d54d03d7cea -->|calls| 4b6cb995_0278_5df7_b4c7_82cb6b0b8320 style 4b6cb995_0278_5df7_b4c7_82cb6b0b8320 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/pydantic_utils.py lines 9–28
def replace_all_of_with_ref(schema: Any) -> None:
if isinstance(schema, dict):
# If the schema has an allOf key with a single item that contains a $ref
if (
"allOf" in schema
and len(schema["allOf"]) == 1
and "$ref" in schema["allOf"][0]
):
schema["$ref"] = schema["allOf"][0]["$ref"]
del schema["allOf"]
if "default" in schema and schema["default"] is None:
del schema["default"]
else:
# Recursively process nested schemas
for value in schema.values():
if isinstance(value, (dict, list)):
replace_all_of_with_ref(value)
elif isinstance(schema, list):
for item in schema:
replace_all_of_with_ref(item)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does replace_all_of_with_ref() do?
replace_all_of_with_ref() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/pydantic_utils.py.
Where is replace_all_of_with_ref() defined?
replace_all_of_with_ref() is defined in libs/core/tests/unit_tests/pydantic_utils.py at line 9.
What calls replace_all_of_with_ref()?
replace_all_of_with_ref() is called by 2 function(s): _normalize_schema, _schema.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free