Skip to content

API Reference parrot.handlers.understanding

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

parrot.handlers.understanding

View source

HTTP handler for image and video understanding via Google GenAI.

Class UnderstandingHandler

REST handler for image and video understanding.

The POST endpoint accepts two request modes:

  • Multipart (multipart/form-data): upload a file via the file field plus a prompt text field. Optional media_type and model fields may also be included.
  • JSON (application/json): send a UnderstandingRequest payload with media_url pointing at a remote image or video.

Media type (image vs video) is resolved in this priority order:

  1. Explicit media_type field ('image' or 'video').
  2. Content-Type header of the uploaded file part (multipart only).
  3. File extension of the uploaded filename or URL path.
Parameter Type Default Description
*args Any ()
**kwargs Any {}

Method UnderstandingHandler.setup

Register the handler view on app at route.

setup(app: Any, route: str = '/api/v1/google/understanding') -> None

Parameter Type Default Description
app Any An aiohttp Application or a Navigator WebApp wrapper.
route str '/api/v1/google/understanding' URL path to register the view at.

Method UnderstandingHandler.post

Analyse one or more images (and optionally one video) and return the result.

Supports multipart file uploads (one or more file parts) and JSON body with media_url and/or media_urls. When a single video and any number of images are submitted together, the video is sent as the primary input and the images become reference_images.

post() -> web.Response

Returns: web.Response — 200 JSON UnderstandingResponse on success. 400 JSON error when the request is invalid (e.g. more than one video, undetermined media type, missing prompt/source). 500 JSON error when the Google GenAI client fails.

Method UnderstandingHandler.get

Return the parameter catalog and JSON schema for this endpoint.

get() -> web.Response

Returns: web.Response — 200 JSON payload with the request schema, supported media types, default values, and supported file extensions.

Alias UnderstandingRequest

Re-exported from parrot.handlers.models.understanding.UnderstandingRequest.

Alias UnderstandingResponse

Re-exported from parrot.handlers.models.understanding.UnderstandingResponse.

Alias media_type_from_filename

Re-exported from parrot.handlers.models.understanding.media_type_from_filename.

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