Home / Function/ parse_result() — langchain Function Reference

parse_result() — langchain Function Reference

Architecture documentation for the parse_result() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8d7e9835_b750_4d03_5457_b8e40735ccfe["parse_result()"]
  e155cd04_a39d_263a_c7f3_32e5830d204b["BaseOutputParser"]
  8d7e9835_b750_4d03_5457_b8e40735ccfe -->|defined in| e155cd04_a39d_263a_c7f3_32e5830d204b
  ed977dbe_388f_1e3d_b9dc_6b6244713930["parse_result()"]
  ed977dbe_388f_1e3d_b9dc_6b6244713930 -->|calls| 8d7e9835_b750_4d03_5457_b8e40735ccfe
  d0466f82_a0f5_f9bb_a408_1ceff85e7997["invoke()"]
  d0466f82_a0f5_f9bb_a408_1ceff85e7997 -->|calls| 8d7e9835_b750_4d03_5457_b8e40735ccfe
  56267ba8_64a1_3881_bcb1_b91b56f2cf8b["parse()"]
  8d7e9835_b750_4d03_5457_b8e40735ccfe -->|calls| 56267ba8_64a1_3881_bcb1_b91b56f2cf8b
  ed977dbe_388f_1e3d_b9dc_6b6244713930["parse_result()"]
  8d7e9835_b750_4d03_5457_b8e40735ccfe -->|calls| ed977dbe_388f_1e3d_b9dc_6b6244713930
  style 8d7e9835_b750_4d03_5457_b8e40735ccfe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/output_parsers/base.py lines 246–264

    def parse_result(self, result: list[Generation], *, partial: bool = False) -> T:
        """Parse a list of candidate model `Generation` objects into a specific format.

        The return value is parsed from only the first `Generation` in the result, which
        is assumed to be the highest-likelihood `Generation`.

        Args:
            result: A list of `Generation` to be parsed.

                The `Generation` objects are assumed to be different candidate outputs
                for a single model input.
            partial: Whether to parse the output as a partial result.

                This is useful for parsers that can parse partial results.

        Returns:
            Structured output.
        """
        return self.parse(result[0].text)

Domain

Subdomains

Frequently Asked Questions

What does parse_result() do?
parse_result() is a function in the langchain codebase, defined in libs/core/langchain_core/output_parsers/base.py.
Where is parse_result() defined?
parse_result() is defined in libs/core/langchain_core/output_parsers/base.py at line 246.
What does parse_result() call?
parse_result() calls 2 function(s): parse, parse_result.
What calls parse_result()?
parse_result() is called by 2 function(s): invoke, parse_result.

Analyze Your Own Codebase

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

Try Supermodel Free