Module: Ask::Content

Defined in:
lib/ask/content.rb

Overview

Content types for multi-modal messages.

These are frozen value objects representing different kinds of content that can appear in an Message. A message's content_blocks may contain multiple content objects of different types, allowing text, images, audio, video, and files to be interleaved naturally.

All content types are frozen value objects with structural equality. They carry the minimum fields needed for provider-agnostic use; each provider serializes them to its own wire format.

Examples:

Text

Ask::Content::Text.new("What's in this image?")

Image from URL

Ask::Content::Image.new(url: "https://example.com/photo.jpg",
                        mime_type: "image/jpeg")

Multi-modal message

msg = Ask::Message.new(role: :user, content: [
  Ask::Content::Text.new("What's in this image?"),
  Ask::Content::Image.new(url: "https://example.com/photo.jpg",
                          mime_type: "image/jpeg")
])

Defined Under Namespace

Modules: Block Classes: Audio, File, Image, Media, Text, Video