Skip to content

Files

A required output file declared on a request. The runtime tells the model about declared files; if produced by a tool, they surface in ChatCompletionResponse.files. If missing, an error placeholder is surfaced instead.

FieldType
namestr
formatstr | None
descriptionstr | None
__init__(
name: str,
format: str | None = None,
description: str | None = None,
) -> None

User-provided input file attached to a chat request.

Text-like files are previewed in prompt context and can be paginated by the built-in file tools when the agentic runtime is active. Binary files are stored and mounted into shell/code workdirs, but are metadata-only in prompt context.

FieldType
idstr
namestr
mime_typestr | None
bytesint
__init__(name: str, data: bytes, mime_type: str | None = None) -> None
from_text(
name: str,
text: str,
mime_type: str = 'text/plain',
) -> 'InputFile'
from_path(
path: str,
mime_type: str | None = None,
name: str | None = None,
) -> 'InputFile'

Where a file was produced.

FieldType
toolstr
roundint
turnint

First-class output from an agentic run.

Files exist independently of the transcript. The body is inline for small files (text for text content, data_base64 for binary). Large files have a server-side url and text/data_base64 will be None - use is_truncated() to detect.

FieldType
idstr
namestr
formatstr | None
mime_typestr | None
bytesint
sourceFileSource
textstr | None
data_base64str | None
previewstr | None
is_text() -> bool
is_binary() -> bool
is_image() -> bool
is_video() -> bool
is_error() -> bool
is_truncated() -> bool
save(path: str) -> None

Generated from mistralrs-pyo3/mistralrs.pyi.