API Appendix
Common terms and concepts
Assets
Assets can be just about anything, from PDFs to Excel spreadsheets to audio files. These are the unstructured entities Trellis will transform with individual operations.
Assets are referenced with their asset_id
. All assets must belong to a project.
Upload
To upload assets:
-
You will first need a
proj_id
(see Create Project). -
Create pre-signed URLs to securely upload your files.
-
Upload files from the pre-signed URLs to a project in Trellis, to be processed later.
Extraction
To extract information from assets:
-
You will first need a
proj_id
(see Create Project) and a list ofasset_id
’s (see above). -
Create a request to extract information from your assets into markdown.
-
Fetch the extracted markdown for each
asset_id
.
Events
Create event subscriptions to run actions like extraction, transformation and even sending webhooks. When an event subscription is triggered, a set action will execute.
-
Locate the triggering project (
proj_id
) or transformation (transform_id
). -
Specify the trigger event (one of
asset_extracted
,asset_uploaded
,transform_completed
) -
Specify the actions to run (one of
refresh_transform
,run_extraction
,send_webhook
) -
Specify the triggered project (
project_id
) or transformation (transform_id
) for each action.
If you want to trigger a webhook on a specific event, you must create a webhook first.
Operations
An operation is a step that Trellis takes to process your assets. Examples include extracting information, classification, and generating new data. These operations can stack on each other, but they will eventually derive from the source content in the assets.
Projects
Projects are simply a group of related transformations. While transformations each contain their own assets, you can also upload assets to the entire project, which will propagate the assets to every transformation.
Creating a project is very easy - all you need is a name. Then, you can hit the Create Project endpoint. Make sure to store the proj_id
for future API requests (or call the Get Projects endpoint).
Transformations
Transformations group together the assets, operations, and processed data into a single entity. You can define a transformation by specifying a list of operations, as well as a model and an extraction mode. Read our transformation guide for more details.
-
Specify your transformation parameters.
-
Model: one of
trellis-scale
,trellis-premium
ortrellis-vertix
-
Mode: one of
document
ortable
-
Operations: A list of objects. Each must contain:
-
A
column_name
-
A
column_type
(one oftext
,integer
,numeric
,boolean
,list
,object
,string
,number
,time
,date
,text[]
,jsonb
) -
A
task_description
-
A
transform_type
(one ofextraction
,classification
,generation
,manual
,api_request
) -
For the full list (including optional params) see
body.transform_params.operations
-
-
Table Preferences: If
table
mode is selected, you can specify the table names for table transformations. Must include:-
advanced_reasoning
: Boolean -
included_table_names
: Specifies the names to be included for table transformations.
-
-
-
Find the
proj_id
of the project to add the transformation to (Get Projects) -
Specify a
transform_name
and create the transformation. Make sure to store thetransform_id
.
Once you create a transformation, if you haven’t already, you should upload assets to the project containing the transformation. Then, you can refresh (run) the transformation with the transform_id
.
Webhooks
Creating a webhook helps Trellis communicate with your server in real time. Together with event subscriptions, you can get notified of important events, like when your transformations finish running!
All you need is a URL to your server and an authentication key (optional) to create a webhook. The webhook_id
is useful to link with event subscriptions. See here for a full example.