Class: OpenAI::Resources::Beta::Agents::Environments::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/beta/agents/environments/files.rb,
sig/openai/resources/beta/agents/environments/files.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Files

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Files.

Parameters:



81
82
83
# File 'lib/openai/resources/beta/agents/environments/files.rb', line 81

def initialize(client:)
  @client = client
end

Instance Method Details

#create(environment_id, hosted_environment_file_param:, request_options: {}) ⇒ OpenAI::Models::Beta::Agents::Environments::EnvironmentFile

Copies inline bytes or a Files API file into a connected execution environment. See environment files.

Parameters:

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/openai/resources/beta/agents/environments/files.rb', line 26

def create(environment_id, params)
  parsed, options = OpenAI::Beta::Agents::Environments::FileCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["agents/environments/%1$s/files", environment_id],
    body: parsed[:hosted_environment_file_param],
    model: OpenAI::Beta::Agents::Environments::EnvironmentFile,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options}
  )
end

#list(environment_id, limit: nil, order: nil, page: nil, path: nil, request_options: {}) ⇒ OpenAI::Internal::TokenPage<OpenAI::Models::Beta::Agents::Environments::EnvironmentFile>

Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See environment files.

Parameters:

  • environment_id (String)

    The ID of the environment.

  • limit (Integer, nil)

    The maximum number of files to return, between 1 and 100.

  • order (Symbol, OpenAI::Models::Beta::Agents::Environments::FileListParams::Order)

    Sort by case-sensitive path components. Defaults to descending.

  • page (String)

    The opaque token from the previous page. Keep the same path, order, and limit.

  • path (String, nil)

    Restrict the listing to this absolute workspace directory.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/openai/resources/beta/agents/environments/files.rb', line 64

def list(environment_id, params = {})
  parsed, options = OpenAI::Beta::Agents::Environments::FileListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["agents/environments/%1$s/files", environment_id],
    query: query,
    page: OpenAI::Internal::TokenPage,
    model: OpenAI::Beta::Agents::Environments::EnvironmentFile,
    security: {bearer_auth: true},
    options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options}
  )
end