mellea.serve.models
User-facing types for m serve.
Classes
CLASS TextContent
Text content in a multimodal message.
CLASS ImageUrlContent
Image URL content in a multimodal message.
Supports both data URIs (base64-encoded images) and HTTP(S) URLs.
CLASS ChatMessage
Chat message with support for text-only or multimodal content.
The content field can be:
- A string (text-only, backward compatible)
- None (for messages without content)
- A list of content objects (multimodal: text, images)
Methods:
FUNC get_text_content
get_text_content(self) -> str
Extract text content from message, handling both string and multimodal formats.
Returns:
- Concatenated text from all TextContent items, or empty string if no text.
- Images are ignored (handled separately via extraction utilities).
FUNC get_image_urls
get_image_urls(self) -> list[str]
Extract image URLs from message content.
Returns:
- List of image URL strings from all ImageUrlContent items.
- Empty list if content is a string or contains no images.
FUNC get_image_blocks
get_image_blocks(self) -> list[ImageBlock]
Extract ImageBlocks from message content.
Returns:
- List of ImageBlocks from all ImageUrlContent items.
- Empty list if content is a string or contains no images.
Raises:
ValueError: If an image URL is invalid or cannot be processed.