Files
Files are the top-level object for any piece of data in a workspace.
Files hold bytes of raw data (with a mime_type
, and processed data in Blocks.
A File
may also have a list of Tags (annotations).
To do work on a File
, it needs to be saved and its content must be in Blocks.
There are a few ways to accomplish this:
- Create
File
andBlock
content directly (see below) - Add raw data directly, then create
Blocks
with a blockifier plugin - Import raw data with a File Importer, then create
Blocks
with a blockifier plugin
It’s useful to think of Steamship Files more broadly than “file on your desktop.” They are any useful object:
- A conversation between a user and an assistant
- a PDF file
- a YouTube video
- a Podcast episode
- A Notion page
- the JSON representation of an AirTable API response
Read the File PyDoc spec here
.
Creating Files Directly
The quickest way to create data is to create Files with Block
content directly:
file = File.create(
client=client,
blocks=[Block(text="Some example text")]
)
Making File Data Public
If you want the raw data bytes of a File
to be publicly accessible, you can set the parameter public_data = True
when calling File.create()
.
This is useful if you wish to share a generated image or audio file, or must make the content viewable in a place that cannot
retain your Steamship API key. You can also change the value of the public_data
flag on an existing File
by calling
File.set_public_data
.