Containers API

Create, retrieve, list, and delete code-interpreter containers, and add files to them. Containers provide sandboxed compute for the Responses code-interpreter tool and expire after idle. OpenAI only.

Objects

UniLM.ContainerObjectType
ContainerObject

A code-interpreter container: id, status, and name; raw holds the unparsed JSON response.

source

Result Types

Request Functions

UniLM.create_containerFunction
create_container(; name, file_ids=nothing, expires_after=nothing, service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.retrieve_containerFunction
retrieve_container(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.list_containersFunction
list_containers(; limit=nothing, after=nothing, service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.delete_containerFunction
delete_container(id; service=OPENAIServiceEndpoint)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source
UniLM.add_container_fileFunction
add_container_file(container_id, path; service=OPENAIServiceEndpoint)  (multipart upload)

Pass config::Union{Nothing,RequestConfig} to override the timeout budget for this call (a single bounded attempt; max_attempts does not apply).

source

Usage

# Create a container (optionally seeding it with uploaded file ids)
result = create_container(name="my-sandbox")
result isa ContainerSuccess && println("Created: ", result.response.id)

# Retrieve, list, add a file, delete
container = retrieve_container("cntr-abc123")
containers = list_containers(limit=20)
add_container_file("cntr-abc123", "data.csv")
delete_container("cntr-abc123")