Spaces:
Sleeping
Sleeping
File size: 1,003 Bytes
5e1a30c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
"""
Response parsers for answer generation.
This module provides parsers that extract structured information
from LLM responses in various formats.
"""
from .markdown_parser import MarkdownParser
# Future parsers will be imported here
# from .json_parser import JSONParser
# from .citation_parser import CitationParser
__all__ = [
'MarkdownParser',
# 'JSONParser',
# 'CitationParser',
]
# Parser registry for easy lookup
PARSER_REGISTRY = {
'markdown': MarkdownParser,
# 'json': JSONParser,
# 'citation': CitationParser,
}
def get_parser_class(parser_type: str):
"""
Get response parser class by type.
Args:
parser_type: Parser type name
Returns:
Parser class
Raises:
ValueError: If parser type not found
"""
if parser_type not in PARSER_REGISTRY:
raise ValueError(f"Unknown response parser: {parser_type}. Available: {list(PARSER_REGISTRY.keys())}")
return PARSER_REGISTRY[parser_type] |