Home / Function/ validate_schema() — langchain Function Reference

validate_schema() — langchain Function Reference

Architecture documentation for the validate_schema() function in openai_functions.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2aee1697_2766_1a3f_7ebb_71adb3a63836["validate_schema()"]
  9e82a47f_5a67_03df_5090_a9ef55b8c16d["PydanticOutputFunctionsParser"]
  2aee1697_2766_1a3f_7ebb_71adb3a63836 -->|defined in| 9e82a47f_5a67_03df_5090_a9ef55b8c16d
  style 2aee1697_2766_1a3f_7ebb_71adb3a63836 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/output_parsers/openai_functions.py lines 231–256

    def validate_schema(cls, values: dict[str, Any]) -> Any:
        """Validate the Pydantic schema.

        Args:
            values: The values to validate.

        Returns:
            The validated values.

        Raises:
            ValueError: If the schema is not a Pydantic schema.
        """
        schema = values["pydantic_schema"]
        if "args_only" not in values:
            values["args_only"] = (
                isinstance(schema, type)
                and not isinstance(schema, GenericAlias)
                and issubclass(schema, BaseModel)
            )
        elif values["args_only"] and isinstance(schema, dict):
            msg = (
                "If multiple pydantic schemas are provided then args_only should be"
                " False."
            )
            raise ValueError(msg)
        return values

Domain

Subdomains

Frequently Asked Questions

What does validate_schema() do?
validate_schema() is a function in the langchain codebase, defined in libs/core/langchain_core/output_parsers/openai_functions.py.
Where is validate_schema() defined?
validate_schema() is defined in libs/core/langchain_core/output_parsers/openai_functions.py at line 231.

Analyze Your Own Codebase

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

Try Supermodel Free