files
Creates, updates, deletes, gets or lists a files resource.
Overview
| Name | files |
| Type | Resource |
| Id | openai.containers.files |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the file. |
container_id | string | The container this file belongs to. |
bytes | integer | Size of the file in bytes. |
created_at | integer (unixtime) | Unix timestamp (in seconds) when the file was created. |
object | string | The type of this object (container.file). |
path | string | Path of the file in the container. |
source | string | Source of the file (e.g., user, assistant). |
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the file. |
container_id | string | The container this file belongs to. |
bytes | integer | Size of the file in bytes. |
created_at | integer (unixtime) | Unix timestamp (in seconds) when the file was created. |
object | string | The type of this object (container.file). |
path | string | Path of the file in the container. |
source | string | Source of the file (e.g., user, assistant). |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | container_id, file_id | openai-organization, openai-project | Retrieves a container file. |
list | select | container_id | limit, order, after, openai-organization, openai-project | Lists container files. |
create | insert | container_id | openai-organization, openai-project | Creates a container file. |
delete | delete | container_id, file_id | openai-organization, openai-project | Delete a container file. |
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 |
|---|---|---|
container_id | string | |
file_id | string | |
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 100, and the default is 20. 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. |
SELECT examples
- get
- list
Retrieves a container file.
SELECT
id,
container_id,
bytes,
created_at,
object,
path,
source
FROM openai.containers.files
WHERE container_id = '{{ container_id }}' -- required
AND file_id = '{{ file_id }}' -- required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
Lists container files.
SELECT
id,
container_id,
bytes,
created_at,
object,
path,
source
FROM openai.containers.files
WHERE container_id = '{{ container_id }}' -- required
AND "order" = '{{ order }}'
AND after = '{{ after }}'
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;
INSERT examples
- create
- Manifest
Creates a container file.
INSERT INTO openai.containers.files (
file_id,
container_id,
"openai-organization",
"openai-project"
)
SELECT
'{{ file_id }}',
'{{ container_id }}',
'{{ openai-organization }}',
'{{ openai-project }}'
RETURNING
id,
container_id,
bytes,
created_at,
object,
path,
source
;
# Description fields are for documentation purposes
- name: files
props:
- name: container_id
value: "{{ container_id }}"
description: Required parameter for the files resource.
- name: file_id
value: "{{ file_id }}"
description: |
Name of the file to create.
- name: openai-organization
value: "{{ openai-organization }}"
description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
description: Optionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as `openai_organization`.
- name: openai-project
value: "{{ openai-project }}"
description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
description: Optionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as `openai_project`.
DELETE examples
- delete
Delete a container file.
DELETE FROM openai.containers.files
WHERE container_id = '{{ container_id }}' --required
AND file_id = '{{ file_id }}' --required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;