Module: RubyLLM::Providers::OpenAIResponses::Containers

Defined in:
lib/ruby_llm/providers/openai_responses/containers.rb

Overview

Containers API support for managing persistent execution environments. Containers can be used with the shell tool and code interpreter.

Class Method Summary collapse

Class Method Details

.container_file_content_url(container_id, file_id) ⇒ Object



28
29
30
# File 'lib/ruby_llm/providers/openai_responses/containers.rb', line 28

def container_file_content_url(container_id, file_id)
  "containers/#{container_id}/files/#{file_id}/content"
end

.container_file_url(container_id, file_id) ⇒ Object



24
25
26
# File 'lib/ruby_llm/providers/openai_responses/containers.rb', line 24

def container_file_url(container_id, file_id)
  "containers/#{container_id}/files/#{file_id}"
end

.container_files_url(container_id) ⇒ Object



20
21
22
# File 'lib/ruby_llm/providers/openai_responses/containers.rb', line 20

def container_files_url(container_id)
  "containers/#{container_id}/files"
end

.container_url(container_id) ⇒ Object



16
17
18
# File 'lib/ruby_llm/providers/openai_responses/containers.rb', line 16

def container_url(container_id)
  "containers/#{container_id}"
end

.containers_urlObject

URL helpers



12
13
14
# File 'lib/ruby_llm/providers/openai_responses/containers.rb', line 12

def containers_url
  'containers'
end

.create_payload(name: nil, expires_after: nil, file_ids: nil, memory_limit: nil) ⇒ Hash

Build create container payload

Parameters:

  • name (String, nil) (defaults to: nil)

    Name for the container

  • expires_after (Hash, nil) (defaults to: nil)

    Expiry config, e.g. { anchor: ‘last_active_at’, minutes: 60 }

  • file_ids (Array<String>, nil) (defaults to: nil)

    Files to copy into the container

  • memory_limit (String, nil) (defaults to: nil)

    Memory limit: ‘1g’, ‘4g’, ‘16g’, ‘64g’

Returns:

  • (Hash)

    Create container payload



38
39
40
41
42
43
44
45
# File 'lib/ruby_llm/providers/openai_responses/containers.rb', line 38

def create_payload(name: nil, expires_after: nil, file_ids: nil, memory_limit: nil)
  payload = {}
  payload[:name] = name if name
  payload[:expires_after] = expires_after if expires_after
  payload[:file_ids] = file_ids if file_ids
  payload[:memory_limit] = memory_limit if memory_limit
  payload
end