files
Creates, updates, deletes, gets or lists a files resource.
Overview​
| Name | files |
| Type | Resource |
| Id | openai.files.files |
Fields​
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The file identifier, which can be referenced in the API endpoints. |
bytes | integer | The size of the file, in bytes. |
created_at | integer (unixtime) | The Unix timestamp (in seconds) for when the file was created. |
expires_at | integer (unixtime) | The Unix timestamp (in seconds) for when the file will expire. |
filename | string | The name of the file. |
object | string | The object type, which is always file. (file) |
purpose | string | The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data. (assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, user_data) |
status | string | Deprecated. The current status of the file, which can be either uploaded, processed, or error. (uploaded, processed, error) |
status_details | string | Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job. |
| Name | Datatype | Description |
|---|---|---|
id | string | The file identifier, which can be referenced in the API endpoints. |
bytes | integer | The size of the file, in bytes. |
created_at | integer (unixtime) | The Unix timestamp (in seconds) for when the file was created. |
expires_at | integer (unixtime) | The Unix timestamp (in seconds) for when the file will expire. |
filename | string | The name of the file. |
object | string | The object type, which is always file. (file) |
purpose | string | The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data. (assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, user_data) |
status | string | Deprecated. The current status of the file, which can be either uploaded, processed, or error. (uploaded, processed, error) |
status_details | string | Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | file_id | openai-organization, openai-project | |
list | select | purpose, limit, order, after, openai-organization, openai-project | ||
delete | delete | file_id | openai-organization, openai-project |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
file_id | string | The ID of the file to use for this request. |
after | string | A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. |
limit | integer | A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000. Automatically applied from a SQL LIMIT clause - SELECT ... LIMIT 10 sends limit=10 on the wire. Setting it explicitly in a WHERE clause is not required. |
openai-organization | string | Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as openai_organization. |
openai-project | string | Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as openai_project. |
order | string | Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. |
purpose | string | Only return files with the given purpose. |
SELECT examples​
- get
- list
OK
SELECT
id,
bytes,
created_at,
expires_at,
filename,
object,
purpose,
status,
status_details
FROM openai.files.files
WHERE file_id = '{{ file_id }}' -- required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
OK
SELECT
id,
bytes,
created_at,
expires_at,
filename,
object,
purpose,
status,
status_details
FROM openai.files.files
WHERE purpose = '{{ purpose }}'
AND "order" = '{{ order }}'
AND after = '{{ after }}'
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
DELETE examples​
- delete
No description available.
DELETE FROM openai.files.files
WHERE file_id = '{{ file_id }}' --required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;