MarkdownListOutputParser Class — langchain Architecture
Architecture documentation for the MarkdownListOutputParser class in list.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 49eebb51_648b_a9f1_5ac1_1bea73d13e62["MarkdownListOutputParser"] 137024f5_2b01_9c8f_64f4_357c533282c7["ListOutputParser"] 49eebb51_648b_a9f1_5ac1_1bea73d13e62 -->|extends| 137024f5_2b01_9c8f_64f4_357c533282c7 39460b97_96ad_60ff_34e4_145e3ec6b305["list.py"] 49eebb51_648b_a9f1_5ac1_1bea73d13e62 -->|defined in| 39460b97_96ad_60ff_34e4_145e3ec6b305 d8d13e51_bba0_9439_7a15_15fe801cf386["get_format_instructions()"] 49eebb51_648b_a9f1_5ac1_1bea73d13e62 -->|method| d8d13e51_bba0_9439_7a15_15fe801cf386 0ad51d3f_4ac1_1896_08f3_232cde0d7af8["parse()"] 49eebb51_648b_a9f1_5ac1_1bea73d13e62 -->|method| 0ad51d3f_4ac1_1896_08f3_232cde0d7af8 6afa5fc3_732f_7e00_a3fd_1d3b7908c702["parse_iter()"] 49eebb51_648b_a9f1_5ac1_1bea73d13e62 -->|method| 6afa5fc3_732f_7e00_a3fd_1d3b7908c702 97ccb744_2ff0_65d3_d5f3_cee791c0bebb["_type()"] 49eebb51_648b_a9f1_5ac1_1bea73d13e62 -->|method| 97ccb744_2ff0_65d3_d5f3_cee791c0bebb
Relationship Graph
Source Code
libs/core/langchain_core/output_parsers/list.py lines 221–249
class MarkdownListOutputParser(ListOutputParser):
"""Parse a Markdown list."""
pattern: str = r"^\s*[-*]\s([^\n]+)$"
"""The pattern to match a Markdown list item."""
@override
def get_format_instructions(self) -> str:
"""Return the format instructions for the Markdown list output."""
return "Your response should be a markdown list, eg: `- foo\n- bar\n- baz`"
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.
"""
return re.findall(self.pattern, text, re.MULTILINE)
@override
def parse_iter(self, text: str) -> Iterator[re.Match]:
return re.finditer(self.pattern, text, re.MULTILINE)
@property
def _type(self) -> str:
return "markdown-list"
Extends
Source
Frequently Asked Questions
What is the MarkdownListOutputParser class?
MarkdownListOutputParser is a class in the langchain codebase, defined in libs/core/langchain_core/output_parsers/list.py.
Where is MarkdownListOutputParser defined?
MarkdownListOutputParser is defined in libs/core/langchain_core/output_parsers/list.py at line 221.
What does MarkdownListOutputParser extend?
MarkdownListOutputParser extends ListOutputParser.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free