coding.markdown_code_extractor
MarkdownCodeExtractor
class MarkdownCodeExtractor(CodeExtractor)
(实验性)一个使用Markdown语法从消息中提取代码块的类。
提取代码块
def extract_code_blocks(
message: Union[str, List[Union[UserMessageTextContentPart,
UserMessageImageContentPart]], None]
) -> List[CodeBlock]
(实验性)从消息中提取代码块。如果未找到任何代码块, 则返回一个空列表。
参数:
message
str - 要从中提取代码块的消息。
返回:
List[CodeBlock]
- 提取的代码块或空列表。