parse() — langchain Function Reference
Architecture documentation for the parse() function in regex.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d3f9af03_d5d7_b515_1553_90c42c111edf["parse()"] 10925ecf_0028_c82d_a03e_3d51aac9fdf7["RegexParser"] d3f9af03_d5d7_b515_1553_90c42c111edf -->|defined in| 10925ecf_0028_c82d_a03e_3d51aac9fdf7 style d3f9af03_d5d7_b515_1553_90c42c111edf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/output_parsers/regex.py lines 29–40
def parse(self, text: str) -> dict[str, str]:
"""Parse the output of an LLM call."""
match = re.search(self.regex, text)
if match:
return {key: match.group(i + 1) for i, key in enumerate(self.output_keys)}
if self.default_output_key is None:
msg = f"Could not parse output: {text}"
raise ValueError(msg)
return {
key: text if key == self.default_output_key else ""
for key in self.output_keys
}
Domain
Subdomains
Source
Frequently Asked Questions
What does parse() do?
parse() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/output_parsers/regex.py.
Where is parse() defined?
parse() is defined in libs/langchain/langchain_classic/output_parsers/regex.py at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free