Skip to main content

coding.markdown_code_extractor

MarkdownCodeExtractor

class MarkdownCodeExtractor(CodeExtractor)

(Experimental) A class that extracts code blocks from a message using Markdown syntax.

extract_code_blocks

def extract_code_blocks(
message: Union[str, List[Union[UserMessageTextContentPart,
UserMessageImageContentPart]], None]
) -> List[CodeBlock]

(Experimental) Extract code blocks from a message. If no code blocks are found, return an empty list.

Arguments:

  • message str - The message to extract code blocks from.

Returns:

  • List[CodeBlock] - The extracted code blocks or an empty list.