Mirascopev2
Lilypad

content

Attribute AssistantContentChunk

Type: TypeAlias

Chunks of assistant content that may be streamed as generated by the LLM.

Attribute AssistantContentPart

Type: TypeAlias

Content parts that can be included in an AssistantMessage.

Class Audio

Audio content for a message.

Audio can be included in messages for voice or sound-based interactions.

Attributes

NameTypeDescription
typeLiteral['audio']-
sourceBase64AudioSource-

Function download

Download and encode an audio file from a URL.

Parameters

NameTypeDescription
clsAny-
urlstrThe URL of the audio file to download
max_size= MAX_AUDIO_SIZEintMaximum allowed audio size in bytes (default: 25MB)

Returns

TypeDescription
AudioAn `Audio` with a `Base64AudioSource`

Function download_async

Asynchronously download and encode an audio file from a URL.

Parameters

NameTypeDescription
clsAny-
urlstrThe URL of the audio file to download
max_size= MAX_AUDIO_SIZEintMaximum allowed audio size in bytes (default: 25MB)

Returns

TypeDescription
AudioAn `Audio` with a `Base64AudioSource`

Function from_file

Create an Audio from a file path.

Parameters

NameTypeDescription
clsAny-
file_pathstrPath to the audio file
max_size= MAX_AUDIO_SIZEintMaximum allowed audio size in bytes (default: 25MB)

Returns

TypeDescription
Audio-

Function from_bytes

Create an Audio from raw bytes.

Parameters

NameTypeDescription
clsAny-
databytesRaw audio bytes
max_size= MAX_AUDIO_SIZEintMaximum allowed audio size in bytes (default: 25MB)

Returns

TypeDescription
Audio-

Class Base64AudioSource

Audio data represented as a base64 encoded string.

Attributes

NameTypeDescription
typeLiteral['base64_audio_source']-
datastrThe audio data, as a base64 encoded string.
mime_typeAudioMimeTypeThe mime type of the audio (e.g. audio/mp3).

Class Base64DocumentSource

Document data represented as a base64 encoded string.

Attributes

NameTypeDescription
typeLiteral['base64_document_source']-
datastrThe document data, as a base64 encoded string.
media_typeDocumentBase64MimeTypeThe media type of the document (e.g. application/pdf).

Class Base64ImageSource

Image data represented as a base64 encoded string.

Attributes

NameTypeDescription
typeLiteral['base64_image_source']-
datastrThe image data, as a base64 encoded string.
mime_typeImageMimeTypeThe mime type of the image (e.g. image/png).

Attribute ContentPart

Type: TypeAlias

Content parts that may be included in a Message.

Class Document

Document content for a message.

Documents (like PDFs) can be included for the model to analyze or reference.

Attributes

NameTypeDescription
typeLiteral['document']-
sourceBase64DocumentSource | TextDocumentSource | URLDocumentSource-

Function from_url

Create a Document from a URL.

Parameters

NameTypeDescription
clsAny-
urlstr-
download= Falsebool-

Returns

TypeDescription
Document-

Function from_file

Create a Document from a file path.

Parameters

NameTypeDescription
clsAny-
file_pathstr-
mime_typeDocumentTextMimeType | DocumentBase64MimeType | None-

Returns

TypeDescription
Document-

Function from_bytes

Create a Document from raw bytes.

Parameters

NameTypeDescription
clsAny-
databytes-
mime_typeDocumentTextMimeType | DocumentBase64MimeType | None-

Returns

TypeDescription
Document-

Class Image

Image content for a message.

Images can be included in messages to provide visual context. This can be used for both input (e.g., user uploading an image) and output (e.g., model generating an image).

Attributes

NameTypeDescription
typeLiteral['image']-
sourceBase64ImageSource | URLImageSource-

Function from_url

Create an Image reference from a URL, without downloading it.

Parameters

NameTypeDescription
clsAny-
urlstrThe URL of the image

Returns

TypeDescription
ImageAn `Image` with a `URLImageSource`

Function download

Download and encode an image from a URL.

Parameters

NameTypeDescription
clsAny-
urlstrThe URL of the image to download
max_size= MAX_IMAGE_SIZEintMaximum allowed image size in bytes (default: 20MB)

Returns

TypeDescription
ImageAn `Image` with a `Base64ImageSource`

Function download_async

Asynchronously download and encode an image from a URL.

Parameters

NameTypeDescription
clsAny-
urlstrThe URL of the image to download
max_size= MAX_IMAGE_SIZEintMaximum allowed image size in bytes (default: 20MB)

Returns

TypeDescription
ImageAn `Image` with a `Base64ImageSource`

Function from_file

Create an Image from a file path.

Parameters

NameTypeDescription
clsAny-
file_pathstrPath to the image file
max_size= MAX_IMAGE_SIZEintMaximum allowed image size in bytes (default: 20MB)

Returns

TypeDescription
Image-

Function from_bytes

Create an Image from raw bytes.

Parameters

NameTypeDescription
clsAny-
databytesRaw image bytes
max_size= MAX_IMAGE_SIZEintMaximum allowed image size in bytes (default: 20MB)

Returns

TypeDescription
Image-

Attribute ImageMimeType

Type: Literal['image/png', 'image/jpeg', 'image/webp', 'image/gif', 'image/heic', 'image/heif']

Class Text

Text content for a message.

Attributes

NameTypeDescription
typeLiteral['text']-
textstrThe text content.

Class TextChunk

Represents an incremental text chunk in a stream.

Attributes

NameTypeDescription
typeLiteral['text_chunk']-
content_typeLiteral['text']The type of content reconstructed by this chunk.
deltastrThe incremental text added in this chunk.

Class TextDocumentSource

Plain text document data.

Attributes

NameTypeDescription
typeLiteral['text_document_source']-
datastrThe document data, as plain text.
media_typeDocumentTextMimeTypeThe media type of the document (e.g. text/plain, text/csv).

Class TextEndChunk

Represents the end of a text chunk stream.

Attributes

NameTypeDescription
typeLiteral['text_end_chunk']-
content_typeLiteral['text']The type of content reconstructed by this chunk.

Class TextStartChunk

Represents the start of a text chunk stream.

Attributes

NameTypeDescription
typeLiteral['text_start_chunk']-
content_typeLiteral['text']The type of content reconstructed by this chunk.

Class Thought

Thinking content for a message.

Represents the thinking or thought process of the assistant. These generally are summaries of the model's reasoning process, rather than the direct reasoning tokens, although this behavior is model and provider specific.

Attributes

NameTypeDescription
typeLiteral['thought']-
thoughtstrThe thoughts or reasoning of the assistant.

Class ThoughtChunk

Represents an incremental thought chunk in a stream.

Attributes

NameTypeDescription
typeLiteral['thought_chunk']-
content_typeLiteral['thought']The type of content reconstructed by this chunk.
deltastrThe incremental thoughts added in this chunk.

Class ThoughtEndChunk

Represents the end of a thought chunk stream.

Attributes

NameTypeDescription
typeLiteral['thought_end_chunk']-
content_typeLiteral['thought']The type of content reconstructed by this chunk.

Class ThoughtStartChunk

Represents the start of a thought chunk stream.

Attributes

NameTypeDescription
typeLiteral['thought_start_chunk']-
content_typeLiteral['thought']The type of content reconstructed by this chunk.

Class ToolCall

Tool call content for a message.

Represents a request from the assistant to call a tool. This is part of an assistant message's content.

Attributes

NameTypeDescription
typeLiteral['tool_call']-
idstrA unique identifier for this tool call.
namestrThe name of the tool to call.
argsstrThe arguments to pass to the tool, stored as stringified json.

Class ToolCallChunk

Represents an incremental tool call chunk in a stream.

Attributes

NameTypeDescription
typeLiteral['tool_call_chunk']-
content_typeLiteral['tool_call']The type of content reconstructed by this chunk.
deltastrThe incremental json args added in this chunk.

Class ToolCallEndChunk

Represents the end of a tool call chunk stream.

Attributes

NameTypeDescription
typeLiteral['tool_call_end_chunk']-
content_typeLiteral['tool_call']The type of content reconstructed by this chunk.

Class ToolCallStartChunk

Represents the start of a tool call chunk stream.

Attributes

NameTypeDescription
typeLiteral['tool_call_start_chunk']-
content_typeLiteral['tool_call']The type of content reconstructed by this chunk.
idstrA unique identifier for this tool call.
namestrThe name of the tool to call.

Class ToolOutput

Tool output content for a message.

Represents the output from a tool call. This is part of a user message's content, typically following a tool call from the assistant.

Bases:

Generic[JsonableT]

Attributes

NameTypeDescription
typeLiteral['tool_output']-
idstrThe ID of the tool call that this output is for.
namestrThe name of the tool that created this output.
valueJsonableTThe output value from the tool call.

Class URLDocumentSource

Document data referenced via external URL.

Attributes

NameTypeDescription
typeLiteral['url_document_source']-
urlstrThe url of the document (e.g. https://example.com/paper.pdf).

Class URLImageSource

Image data referenced via external URL.

Attributes

NameTypeDescription
typeLiteral['url_image_source']-
urlstrThe url of the image (e.g. https://example.com/sazed.png).

Attribute UserContentPart

Type: TypeAlias

Content parts that can be included in a UserMessage.