Home / Function/ parse() — langchain Function Reference

parse() — langchain Function Reference

Architecture documentation for the parse() function in list.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1eb4fd5c_34b6_cb12_859d_1d2144dce96b["parse()"]
  be6b5955_5669_a1a7_aaff_9cb7248c7a58["CommaSeparatedListOutputParser"]
  1eb4fd5c_34b6_cb12_859d_1d2144dce96b -->|defined in| be6b5955_5669_a1a7_aaff_9cb7248c7a58
  4eaeb4b9_0fa1_8f0f_f9ca_f52372345458["_transform()"]
  4eaeb4b9_0fa1_8f0f_f9ca_f52372345458 -->|calls| 1eb4fd5c_34b6_cb12_859d_1d2144dce96b
  b097eaed_4e00_ba36_ebba_08b481d535ef["_atransform()"]
  b097eaed_4e00_ba36_ebba_08b481d535ef -->|calls| 1eb4fd5c_34b6_cb12_859d_1d2144dce96b
  3a830584_5655_fbe4_4957_e28246de484b["parse()"]
  1eb4fd5c_34b6_cb12_859d_1d2144dce96b -->|calls| 3a830584_5655_fbe4_4957_e28246de484b
  style 1eb4fd5c_34b6_cb12_859d_1d2144dce96b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/output_parsers/list.py lines 165–181

    def parse(self, text: str) -> list[str]:
        """Parse the output of an LLM call.

        Args:
            text: The output of an LLM call.

        Returns:
            A list of strings.
        """
        try:
            reader = csv.reader(
                StringIO(text), quotechar='"', delimiter=",", skipinitialspace=True
            )
            return [item for sublist in reader for item in sublist]
        except csv.Error:
            # Keep old logic for backup
            return [part.strip() for part in text.split(",")]

Domain

Subdomains

Calls

Frequently Asked Questions

What does parse() do?
parse() is a function in the langchain codebase, defined in libs/core/langchain_core/output_parsers/list.py.
Where is parse() defined?
parse() is defined in libs/core/langchain_core/output_parsers/list.py at line 165.
What does parse() call?
parse() calls 1 function(s): parse.
What calls parse()?
parse() is called by 2 function(s): _atransform, _transform.

Analyze Your Own Codebase

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

Try Supermodel Free