Home / Function/ _resolve_schema_references() — langchain Function Reference

_resolve_schema_references() — langchain Function Reference

Architecture documentation for the _resolve_schema_references() function in utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ed09315a_3c7c_da4f_ff71_426d6c5f4b9a["_resolve_schema_references()"]
  b0da75f9_7929_4b8f_2e76_6ee9d0db52e8["utils.py"]
  ed09315a_3c7c_da4f_ff71_426d6c5f4b9a -->|defined in| b0da75f9_7929_4b8f_2e76_6ee9d0db52e8
  style ed09315a_3c7c_da4f_ff71_426d6c5f4b9a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/openai_functions/utils.py lines 4–17

def _resolve_schema_references(schema: Any, definitions: dict[str, Any]) -> Any:
    """Resolve the $ref keys in a JSON schema object using the provided definitions."""
    if isinstance(schema, list):
        for i, item in enumerate(schema):
            schema[i] = _resolve_schema_references(item, definitions)
    elif isinstance(schema, dict):
        if "$ref" in schema:
            ref_key = schema.pop("$ref").split("/")[-1]
            ref = definitions.get(ref_key, {})
            schema.update(ref)
        else:
            for key, value in schema.items():
                schema[key] = _resolve_schema_references(value, definitions)
    return schema

Subdomains

Frequently Asked Questions

What does _resolve_schema_references() do?
_resolve_schema_references() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/openai_functions/utils.py.
Where is _resolve_schema_references() defined?
_resolve_schema_references() is defined in libs/langchain/langchain_classic/chains/openai_functions/utils.py at line 4.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free