Home / Function/ _validate() — langchain Function Reference

_validate() — langchain Function Reference

Architecture documentation for the _validate() function in json_schema.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8b7d5d13_c859_2d6b_d657_495032d846c5["_validate()"]
  9babfe39_52f2_aa6b_17f6_a55234538495["JsonSchemaEvaluator"]
  8b7d5d13_c859_2d6b_d657_495032d846c5 -->|defined in| 9babfe39_52f2_aa6b_17f6_a55234538495
  810f2cc6_5067_feaf_c5ea_268fbeb54aeb["_evaluate_strings()"]
  810f2cc6_5067_feaf_c5ea_268fbeb54aeb -->|calls| 8b7d5d13_c859_2d6b_d657_495032d846c5
  style 8b7d5d13_c859_2d6b_d657_495032d846c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/parsing/json_schema.py lines 78–85

    def _validate(self, prediction: Any, schema: Any) -> dict:
        from jsonschema import ValidationError, validate

        try:
            validate(instance=prediction, schema=schema)
        except ValidationError as e:
            return {"score": False, "reasoning": repr(e)}
        return {"score": True}

Domain

Subdomains

Frequently Asked Questions

What does _validate() do?
_validate() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/parsing/json_schema.py.
Where is _validate() defined?
_validate() is defined in libs/langchain/langchain_classic/evaluation/parsing/json_schema.py at line 78.
What calls _validate()?
_validate() is called by 1 function(s): _evaluate_strings.

Analyze Your Own Codebase

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

Try Supermodel Free