Source code for fastrag.ingestion.steps.parsing.svg
"""Searchable SVG labels without requiring a vision model."""
from collections.abc import AsyncIterator, Mapping
from typing import Any
from fastrag.ingestion.models import Source
from fastrag.ingestion.steps.base import ExecutionContext
from fastrag.ingestion.steps.parsing.html import HtmlParser
from fastrag.models import Document
[docs]
class SvgParser(HtmlParser):
"""Extract titles, descriptions, text and foreignObject labels from SVG."""
accepted_media_types = frozenset({"image/svg+xml"})
[docs]
def config(self) -> Mapping[str, Any]:
"""Return label extraction settings for cache identity."""
return {**super().config(), "svg": True}