# content
## <ApiType type="Attribute" slug="assistant-content-chunk" symbolName="AssistantContentChunk" /> AssistantContentChunk
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
Chunks of assistant content that may be streamed as generated by the LLM.
## <ApiType type="Attribute" slug="assistant-content-part" symbolName="AssistantContentPart" /> AssistantContentPart
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
Content parts that can be included in an AssistantMessage.
## <ApiType type="Class" slug="audio" symbolName="Audio" /> Audio
Audio content for a message.
Audio can be included in messages for voice or sound-based interactions.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['audio']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'audio'",
"description": null,
"kind": "simple",
"symbol_name": "'audio'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "source",
"type_info": {
"type_str": "Base64AudioSource",
"description": null,
"kind": "simple",
"symbol_name": "Base64AudioSource",
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-content-audio--audio-download" symbolName="download" /> download
Download and encode an audio file from a URL.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The URL of the audio file to download"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_AUDIO_SIZE",
"description": "Maximum allowed audio size in bytes (default: 25MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Audio",
"description": null,
"kind": "simple",
"symbol_name": "Audio",
"doc_url": "/docs/api/llm/content#audio"
},
"description": "An `Audio` with a `Base64AudioSource`"
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-audio--audio-download_async" symbolName="download_async" /> download_async
Asynchronously download and encode an audio file from a URL.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The URL of the audio file to download"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_AUDIO_SIZE",
"description": "Maximum allowed audio size in bytes (default: 25MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Audio",
"description": null,
"kind": "simple",
"symbol_name": "Audio",
"doc_url": "/docs/api/llm/content#audio"
},
"description": "An `Audio` with a `Base64AudioSource`"
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-audio--audio-from_file" symbolName="from_file" /> from_file
Create an `Audio` from a file path.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "file_path",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Path to the audio file"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_AUDIO_SIZE",
"description": "Maximum allowed audio size in bytes (default: 25MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Audio",
"description": null,
"kind": "simple",
"symbol_name": "Audio",
"doc_url": "/docs/api/llm/content#audio"
}
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-audio--audio-from_bytes" symbolName="from_bytes" /> from_bytes
Create an `Audio` from raw bytes.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "bytes",
"description": null,
"kind": "simple",
"symbol_name": "bytes",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#bytes"
},
"description": "Raw audio bytes"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_AUDIO_SIZE",
"description": "Maximum allowed audio size in bytes (default: 25MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Audio",
"description": null,
"kind": "simple",
"symbol_name": "Audio",
"doc_url": "/docs/api/llm/content#audio"
}
}}
/>
## <ApiType type="Class" slug="base64-audio-source" symbolName="Base64AudioSource" /> Base64AudioSource
Audio data represented as a base64 encoded string.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['base64_audio_source']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'base64_audio_source'",
"description": null,
"kind": "simple",
"symbol_name": "'base64_audio_source'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The audio data, as a base64 encoded string."
},
{
"name": "mime_type",
"type_info": {
"type_str": "AudioMimeType",
"description": null,
"kind": "simple",
"symbol_name": "AudioMimeType",
"doc_url": null
},
"description": "The mime type of the audio (e.g. audio/mp3)."
}
]}
/>
## <ApiType type="Class" slug="base64-document-source" symbolName="Base64DocumentSource" /> Base64DocumentSource
Document data represented as a base64 encoded string.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['base64_document_source']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'base64_document_source'",
"description": null,
"kind": "simple",
"symbol_name": "'base64_document_source'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The document data, as a base64 encoded string."
},
{
"name": "media_type",
"type_info": {
"type_str": "DocumentBase64MimeType",
"description": null,
"kind": "simple",
"symbol_name": "DocumentBase64MimeType",
"doc_url": null
},
"description": "The media type of the document (e.g. application/pdf)."
}
]}
/>
## <ApiType type="Class" slug="base64-image-source" symbolName="Base64ImageSource" /> Base64ImageSource
Image data represented as a base64 encoded string.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['base64_image_source']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'base64_image_source'",
"description": null,
"kind": "simple",
"symbol_name": "'base64_image_source'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The image data, as a base64 encoded string."
},
{
"name": "mime_type",
"type_info": {
"type_str": "ImageMimeType",
"description": null,
"kind": "simple",
"symbol_name": "ImageMimeType",
"doc_url": null
},
"description": "The mime type of the image (e.g. image/png)."
}
]}
/>
## <ApiType type="Attribute" slug="content-part" symbolName="ContentPart" /> ContentPart
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
Content parts that may be included in a Message.
## <ApiType type="Class" slug="document" symbolName="Document" /> Document
Document content for a message.
Documents (like PDFs) can be included for the model to analyze or reference.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['document']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'document'",
"description": null,
"kind": "simple",
"symbol_name": "'document'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "source",
"type_info": {
"type_str": "Base64DocumentSource | TextDocumentSource | URLDocumentSource",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "Base64DocumentSource",
"description": null,
"kind": "simple",
"symbol_name": "Base64DocumentSource",
"doc_url": null
},
{
"type_str": "TextDocumentSource",
"description": null,
"kind": "simple",
"symbol_name": "TextDocumentSource",
"doc_url": null
},
{
"type_str": "URLDocumentSource",
"description": null,
"kind": "simple",
"symbol_name": "URLDocumentSource",
"doc_url": null
}
],
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-content-document--document-from_url" symbolName="from_url" /> from_url
Create a `Document` from a URL.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
}
},
{
"name": "download",
"type_info": {
"type_str": "bool",
"description": null,
"kind": "simple",
"symbol_name": "bool",
"doc_url": "https://docs.python.org/3/library/functions.html#bool"
},
"default": "False"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Document",
"description": null,
"kind": "simple",
"symbol_name": "Document",
"doc_url": "/docs/api/llm/content#document"
}
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-document--document-from_file" symbolName="from_file" /> from_file
Create a `Document` from a file path.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "file_path",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
}
},
{
"name": "mime_type",
"type_info": {
"type_str": "DocumentTextMimeType | DocumentBase64MimeType | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "DocumentTextMimeType",
"description": null,
"kind": "simple",
"symbol_name": "DocumentTextMimeType",
"doc_url": null
},
{
"type_str": "DocumentBase64MimeType",
"description": null,
"kind": "simple",
"symbol_name": "DocumentBase64MimeType",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Document",
"description": null,
"kind": "simple",
"symbol_name": "Document",
"doc_url": "/docs/api/llm/content#document"
}
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-document--document-from_bytes" symbolName="from_bytes" /> from_bytes
Create a `Document` from raw bytes.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "bytes",
"description": null,
"kind": "simple",
"symbol_name": "bytes",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#bytes"
}
},
{
"name": "mime_type",
"type_info": {
"type_str": "DocumentTextMimeType | DocumentBase64MimeType | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "DocumentTextMimeType",
"description": null,
"kind": "simple",
"symbol_name": "DocumentTextMimeType",
"doc_url": null
},
{
"type_str": "DocumentBase64MimeType",
"description": null,
"kind": "simple",
"symbol_name": "DocumentBase64MimeType",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Document",
"description": null,
"kind": "simple",
"symbol_name": "Document",
"doc_url": "/docs/api/llm/content#document"
}
}}
/>
## <ApiType type="Class" slug="image" symbolName="Image" /> 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).
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['image']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'image'",
"description": null,
"kind": "simple",
"symbol_name": "'image'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "source",
"type_info": {
"type_str": "Base64ImageSource | URLImageSource",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "Base64ImageSource",
"description": null,
"kind": "simple",
"symbol_name": "Base64ImageSource",
"doc_url": null
},
{
"type_str": "URLImageSource",
"description": null,
"kind": "simple",
"symbol_name": "URLImageSource",
"doc_url": null
}
],
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-content-image--image-from_url" symbolName="from_url" /> from_url
Create an `Image` reference from a URL, without downloading it.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The URL of the image"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Image",
"description": null,
"kind": "simple",
"symbol_name": "Image",
"doc_url": "/docs/api/llm/content#image"
},
"description": "An `Image` with a `URLImageSource`"
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-image--image-download" symbolName="download" /> download
Download and encode an image from a URL.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The URL of the image to download"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_IMAGE_SIZE",
"description": "Maximum allowed image size in bytes (default: 20MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Image",
"description": null,
"kind": "simple",
"symbol_name": "Image",
"doc_url": "/docs/api/llm/content#image"
},
"description": "An `Image` with a `Base64ImageSource`"
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-image--image-download_async" symbolName="download_async" /> download_async
Asynchronously download and encode an image from a URL.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The URL of the image to download"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_IMAGE_SIZE",
"description": "Maximum allowed image size in bytes (default: 20MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Image",
"description": null,
"kind": "simple",
"symbol_name": "Image",
"doc_url": "/docs/api/llm/content#image"
},
"description": "An `Image` with a `Base64ImageSource`"
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-image--image-from_file" symbolName="from_file" /> from_file
Create an `Image` from a file path.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "file_path",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Path to the image file"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_IMAGE_SIZE",
"description": "Maximum allowed image size in bytes (default: 20MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Image",
"description": null,
"kind": "simple",
"symbol_name": "Image",
"doc_url": "/docs/api/llm/content#image"
}
}}
/>
## <ApiType type="Function" slug="mirascope-llm-content-image--image-from_bytes" symbolName="from_bytes" /> from_bytes
Create an `Image` from raw bytes.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "bytes",
"description": null,
"kind": "simple",
"symbol_name": "bytes",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#bytes"
},
"description": "Raw image bytes"
},
{
"name": "max_size",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"default": "MAX_IMAGE_SIZE",
"description": "Maximum allowed image size in bytes (default: 20MB)"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Image",
"description": null,
"kind": "simple",
"symbol_name": "Image",
"doc_url": "/docs/api/llm/content#image"
}
}}
/>
## <ApiType type="Attribute" slug="image-mime-type" symbolName="ImageMimeType" /> ImageMimeType
**Type:** <TypeLink type={{"type_str": "Literal['image/png', 'image/jpeg', 'image/webp', 'image/gif', 'image/heic', 'image/heif']", "description": null, "kind": "generic", "base_type": {"type_str": "Literal", "description": null, "kind": "simple", "symbol_name": "Literal", "doc_url": null}, "parameters": [{"type_str": "'image/png'", "description": null, "kind": "simple", "symbol_name": "'image/png'", "doc_url": null}, {"type_str": "'image/jpeg'", "description": null, "kind": "simple", "symbol_name": "'image/jpeg'", "doc_url": null}, {"type_str": "'image/webp'", "description": null, "kind": "simple", "symbol_name": "'image/webp'", "doc_url": null}, {"type_str": "'image/gif'", "description": null, "kind": "simple", "symbol_name": "'image/gif'", "doc_url": null}, {"type_str": "'image/heic'", "description": null, "kind": "simple", "symbol_name": "'image/heic'", "doc_url": null}, {"type_str": "'image/heif'", "description": null, "kind": "simple", "symbol_name": "'image/heif'", "doc_url": null}], "doc_url": null}} />
## <ApiType type="Class" slug="text" symbolName="Text" /> Text
Text content for a message.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['text']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text'",
"description": null,
"kind": "simple",
"symbol_name": "'text'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "text",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The text content."
}
]}
/>
## <ApiType type="Class" slug="text-chunk" symbolName="TextChunk" /> TextChunk
Represents an incremental text chunk in a stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['text_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'text_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['text']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text'",
"description": null,
"kind": "simple",
"symbol_name": "'text'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
},
{
"name": "delta",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The incremental text added in this chunk."
}
]}
/>
## <ApiType type="Class" slug="text-document-source" symbolName="TextDocumentSource" /> TextDocumentSource
Plain text document data.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['text_document_source']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text_document_source'",
"description": null,
"kind": "simple",
"symbol_name": "'text_document_source'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "data",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The document data, as plain text."
},
{
"name": "media_type",
"type_info": {
"type_str": "DocumentTextMimeType",
"description": null,
"kind": "simple",
"symbol_name": "DocumentTextMimeType",
"doc_url": null
},
"description": "The media type of the document (e.g. text/plain, text/csv)."
}
]}
/>
## <ApiType type="Class" slug="text-end-chunk" symbolName="TextEndChunk" /> TextEndChunk
Represents the end of a text chunk stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['text_end_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text_end_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'text_end_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['text']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text'",
"description": null,
"kind": "simple",
"symbol_name": "'text'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
}
]}
/>
## <ApiType type="Class" slug="text-start-chunk" symbolName="TextStartChunk" /> TextStartChunk
Represents the start of a text chunk stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['text_start_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text_start_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'text_start_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['text']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'text'",
"description": null,
"kind": "simple",
"symbol_name": "'text'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
}
]}
/>
## <ApiType type="Class" slug="thought" symbolName="Thought" /> 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.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['thought']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought'",
"description": null,
"kind": "simple",
"symbol_name": "'thought'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "thought",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The thoughts or reasoning of the assistant."
}
]}
/>
## <ApiType type="Class" slug="thought-chunk" symbolName="ThoughtChunk" /> ThoughtChunk
Represents an incremental thought chunk in a stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['thought_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'thought_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['thought']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought'",
"description": null,
"kind": "simple",
"symbol_name": "'thought'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
},
{
"name": "delta",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The incremental thoughts added in this chunk."
}
]}
/>
## <ApiType type="Class" slug="thought-end-chunk" symbolName="ThoughtEndChunk" /> ThoughtEndChunk
Represents the end of a thought chunk stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['thought_end_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought_end_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'thought_end_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['thought']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought'",
"description": null,
"kind": "simple",
"symbol_name": "'thought'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
}
]}
/>
## <ApiType type="Class" slug="thought-start-chunk" symbolName="ThoughtStartChunk" /> ThoughtStartChunk
Represents the start of a thought chunk stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['thought_start_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought_start_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'thought_start_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['thought']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'thought'",
"description": null,
"kind": "simple",
"symbol_name": "'thought'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
}
]}
/>
## <ApiType type="Class" slug="tool-call" symbolName="ToolCall" /> 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.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['tool_call']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "A unique identifier for this tool call."
},
{
"name": "name",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The name of the tool to call."
},
{
"name": "args",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The arguments to pass to the tool, stored as stringified json."
}
]}
/>
## <ApiType type="Class" slug="tool-call-chunk" symbolName="ToolCallChunk" /> ToolCallChunk
Represents an incremental tool call chunk in a stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['tool_call_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['tool_call']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
},
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "A unique identifier for this tool call."
},
{
"name": "delta",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The incremental json args added in this chunk."
}
]}
/>
## <ApiType type="Class" slug="tool-call-end-chunk" symbolName="ToolCallEndChunk" /> ToolCallEndChunk
Represents the end of a tool call chunk stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['tool_call_end_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call_end_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call_end_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['tool_call']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
},
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "A unique identifier for this tool call."
}
]}
/>
## <ApiType type="Class" slug="tool-call-start-chunk" symbolName="ToolCallStartChunk" /> ToolCallStartChunk
Represents the start of a tool call chunk stream.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['tool_call_start_chunk']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call_start_chunk'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call_start_chunk'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "content_type",
"type_info": {
"type_str": "Literal['tool_call']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_call'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_call'",
"doc_url": null
}
],
"doc_url": null
},
"description": "The type of content reconstructed by this chunk."
},
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "A unique identifier for this tool call."
},
{
"name": "name",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The name of the tool to call."
}
]}
/>
## <ApiType type="Class" slug="tool-output" symbolName="ToolOutput" /> 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:**
<TypeLink type={{"type_str": "Generic[JsonableCovariantT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "JsonableCovariantT", "description": null, "kind": "simple", "symbol_name": "JsonableCovariantT", "doc_url": "/docs/api/llm/types#jsonable-covariant-t"}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['tool_output']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'tool_output'",
"description": null,
"kind": "simple",
"symbol_name": "'tool_output'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The ID of the tool call that this output is for."
},
{
"name": "name",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The name of the tool that created this output."
},
{
"name": "result",
"type_info": {
"type_str": "JsonableCovariantT | str",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "JsonableCovariantT",
"description": null,
"kind": "simple",
"symbol_name": "JsonableCovariantT",
"doc_url": null
},
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
],
"doc_url": null
},
"description": "The result of calling the tool.\n\nIf the tool executed successfully, this will be the tool output.\nIf the tool errored, this will be the error message, as a string.\n\nIn either case, the result should be passed back to the LLM (so it can\neither process the output, or re-try with awareness of the error.)"
},
{
"name": "error",
"type_info": {
"type_str": "ToolError | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "ToolError",
"description": null,
"kind": "simple",
"symbol_name": "ToolError",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
},
"description": "The error from calling the tool, if any."
},
{
"name": "output",
"type_info": {
"type_str": "JsonableCovariantT",
"description": null,
"kind": "simple",
"symbol_name": "JsonableCovariantT",
"doc_url": null
}
}
]}
/>
## <ApiType type="Class" slug="u-r-l-document-source" symbolName="URLDocumentSource" /> URLDocumentSource
Document data referenced via external URL.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['url_document_source']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'url_document_source'",
"description": null,
"kind": "simple",
"symbol_name": "'url_document_source'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The url of the document (e.g. https://example.com/paper.pdf)."
}
]}
/>
## <ApiType type="Class" slug="u-r-l-image-source" symbolName="URLImageSource" /> URLImageSource
Image data referenced via external URL.
<AttributesTable
attributes={[
{
"name": "type",
"type_info": {
"type_str": "Literal['url_image_source']",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Literal",
"description": null,
"kind": "simple",
"symbol_name": "Literal",
"doc_url": null
},
"parameters": [
{
"type_str": "'url_image_source'",
"description": null,
"kind": "simple",
"symbol_name": "'url_image_source'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "url",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
"description": "The url of the image (e.g. https://example.com/sazed.png)."
}
]}
/>
## <ApiType type="Attribute" slug="user-content-part" symbolName="UserContentPart" /> UserContentPart
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
Content parts that can be included in a UserMessage.