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.ContainerObject — Type
ContainerObjectA code-interpreter container: id, status, and name; raw holds the unparsed JSON response.
UniLM.ContainerList — Type
ContainerListA page of container records (raw JSON dicts) from list_containers; has_more signals that further pages are available.
Result Types
UniLM.ContainerSuccess — Type
Successful create/retrieve/add-file result wrapping a ContainerObject.
UniLM.ContainerListSuccess — Type
Successful list_containers result wrapping a ContainerList.
UniLM.ContainerDeleteSuccess — Type
Successful delete_container result; deleted confirms removal of id.
UniLM.ContainerFailure — Type
Containers API error result: HTTP status and the raw response body.
UniLM.ContainerCallError — Type
Local/transport error from a Containers API call (the request never completed).
Request Functions
UniLM.create_container — Function
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).
UniLM.retrieve_container — Function
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).
UniLM.list_containers — Function
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).
UniLM.delete_container — Function
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).
UniLM.add_container_file — Function
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).
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")