Skip to main content
You are reading the docs of Galtea 5.22. Read this page in the latest version.
Use this when the bytes go straight into a request of your own: the base64 image or document part a multimodal model takes, or a parser that reads from memory. Reach for download() instead when the file is meant to stay on disk, or when a library you call only takes a path. An input file is capped by the total of one input: 20 MB by default, and a deployment can raise it. read() holds the whole file in memory, so it is safe up to the total that your environment sets. Where that total is above the memory of your process, use download(), which streams the file to disk.

Returns

Returns the file’s bytes.

Example

Inside an agent callback, the files of the current turn arrive as input_data.input_files, so the same call reads the document the test case attached.

Parameters

string | AttachedFile
required
The file to fetch: an AttachedFile read from test_case.input_files, trace.input_files, input_data.input_files or trace.actual_output_files, or the URI of any file this organization uploaded. Those lists also hold a file part of your own, which this call cannot fetch: fetch it with your own client.

Errors

A failed read raises instead of returning None, and the message never contains the presigned link.