Skip to content

API Reference parrot.integrations.parser

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.integrations.parser

View source

Shared Response Parser for Integration Wrappers.

Provides a unified way to parse AIMessage responses into structured content for rendering in different platforms (Telegram, MS Teams, etc.).

Class ChartData

Metadata for a generated chart.

Parameter Type Default Description
path Path
title str 'Chart'
chart_type str 'unknown'
format str 'png'
base64_data Optional[str] None
public_url Optional[str] None

Fields:

Field Type Default Description
path Path Path to the chart image file
title str 'Chart' Chart title
chart_type str 'unknown' Type of chart (bar, line, pie, etc.)
format str 'png' Output format (png, svg, pdf)
base64_data Optional[str] None Base64-encoded image data (for inline embedding)
public_url Optional[str] None Public URL if uploaded to cloud storage

Method ChartData.to_base64

Convert the chart image to base64-encoded string.

to_base64() -> str

Returns: str — Base64 string suitable for data URI embedding

Method ChartData.to_data_uri

Convert the chart to a data URI for inline embedding.

to_data_uri() -> str

Returns: str — Data URI string (e.g., "data:image/png;base64,...")

Attribute HAS_PANDAS

Class ParsedResponse

Structured response content extracted from AIMessage.

Parameter Type Default Description
text str ''
images List[Path] list()
documents List[Path] list()
media List[Path] list()
image_urls List[str] list()
media_urls List[str] list()
charts List[ChartData] list()
code Optional[str] None
code_language Optional[str] None
table_data Optional[Any] None
table_markdown Optional[str] None
is_markdown bool True
has_structured_output bool False

Fields:

Field Type Default Description
text str ''
images List[Path] field(default_factory=list)
documents List[Path] field(default_factory=list)
media List[Path] field(default_factory=list)
image_urls List[str] field(default_factory=list)
media_urls List[str] field(default_factory=list)
charts List[ChartData] field(default_factory=list)
code Optional[str] None
code_language Optional[str] None
table_data Optional[Any] None
table_markdown Optional[str] None
is_markdown bool True
has_structured_output bool False

Attributes:

Attribute Type Description
has_attachments bool Check if there are any file attachments.
has_table bool Check if there is table data to render.
has_code bool Check if there is code to render.
has_charts bool Check if there are charts to render.

Function parse_response

Parse an AIMessage or similar response into structured content.

Extracts text, images, documents, code, and tabular data from the response for platform-specific rendering.

parse_response(response: Any) -> ParsedResponse

Parameter Type Default Description
response Any AIMessage, AgentResponse, or similar response object

Returns: ParsedResponse — ParsedResponse with extracted content

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally