Home / Function/ _parse_generation() — langchain Function Reference

_parse_generation() — langchain Function Reference

Architecture documentation for the _parse_generation() function in llm.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  22d92363_f085_3c47_b309_2c3eddeabdb4["_parse_generation()"]
  ccf50fe1_4990_cf19_1e2d_25efe83f53c5["LLMChain"]
  22d92363_f085_3c47_b309_2c3eddeabdb4 -->|defined in| ccf50fe1_4990_cf19_1e2d_25efe83f53c5
  f8ca5dfd_cddf_f131_0f5b_583f692271a4["apply_and_parse()"]
  f8ca5dfd_cddf_f131_0f5b_583f692271a4 -->|calls| 22d92363_f085_3c47_b309_2c3eddeabdb4
  4aafc3e7_1717_9856_e0f1_9356acba7b7b["aapply_and_parse()"]
  4aafc3e7_1717_9856_e0f1_9356acba7b7b -->|calls| 22d92363_f085_3c47_b309_2c3eddeabdb4
  style 22d92363_f085_3c47_b309_2c3eddeabdb4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/llm.py lines 380–389

    def _parse_generation(
        self,
        generation: list[dict[str, str]],
    ) -> Sequence[str | list[str] | dict[str, str]]:
        if self.prompt.output_parser is not None:
            return [
                self.prompt.output_parser.parse(res[self.output_key])
                for res in generation
            ]
        return generation

Subdomains

Frequently Asked Questions

What does _parse_generation() do?
_parse_generation() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/llm.py.
Where is _parse_generation() defined?
_parse_generation() is defined in libs/langchain/langchain_classic/chains/llm.py at line 380.
What calls _parse_generation()?
_parse_generation() is called by 2 function(s): aapply_and_parse, apply_and_parse.

Analyze Your Own Codebase

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

Try Supermodel Free