Skip to content

Commit 8be52a2

Browse files
feat(api): add container endpoint
1 parent 9105b8b commit 8be52a2

File tree

220 files changed

+5049
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+5049
-152
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 99
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a5651cb97f86d1e2531af6aef8c5230f1ea350560fbae790ca2e481b30a6c217.yml
3-
openapi_spec_hash: 66a5104fd3bb43383cf919225df7a6fd
4-
config_hash: bb657c3fed232a56930035de3aaed936
1+
configured_endpoints: 109
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6af14840a810139bf407013167ce1c8fb21b6ef8eb0cc3db58b51af7d52c4b5a.yml
3+
openapi_spec_hash: 3241bde6b273cfec0035e522bd07985d
4+
config_hash: 7367b68a4e7db36885c1a886f57b17f6

lib/openai.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,21 @@
224224
require_relative "openai/models/completion_create_params"
225225
require_relative "openai/models/completion_usage"
226226
require_relative "openai/models/compound_filter"
227+
require_relative "openai/models/container_create_params"
228+
require_relative "openai/models/container_create_response"
229+
require_relative "openai/models/container_delete_params"
230+
require_relative "openai/models/container_list_params"
231+
require_relative "openai/models/container_list_response"
232+
require_relative "openai/models/container_retrieve_params"
233+
require_relative "openai/models/container_retrieve_response"
234+
require_relative "openai/models/containers/file_create_params"
235+
require_relative "openai/models/containers/file_create_response"
236+
require_relative "openai/models/containers/file_delete_params"
237+
require_relative "openai/models/containers/file_list_params"
238+
require_relative "openai/models/containers/file_list_response"
239+
require_relative "openai/models/containers/file_retrieve_params"
240+
require_relative "openai/models/containers/file_retrieve_response"
241+
require_relative "openai/models/containers/files/content_retrieve_params"
227242
require_relative "openai/models/create_embedding_response"
228243
require_relative "openai/models/embedding"
229244
require_relative "openai/models/embedding_create_params"
@@ -337,6 +352,7 @@
337352
require_relative "openai/models/responses/response_audio_done_event"
338353
require_relative "openai/models/responses/response_audio_transcript_delta_event"
339354
require_relative "openai/models/responses/response_audio_transcript_done_event"
355+
require_relative "openai/models/responses/response_cancel_params"
340356
require_relative "openai/models/responses/response_code_interpreter_call_code_delta_event"
341357
require_relative "openai/models/responses/response_code_interpreter_call_code_done_event"
342358
require_relative "openai/models/responses/response_code_interpreter_call_completed_event"
@@ -478,6 +494,9 @@
478494
require_relative "openai/resources/chat/completions"
479495
require_relative "openai/resources/chat/completions/messages"
480496
require_relative "openai/resources/completions"
497+
require_relative "openai/resources/containers"
498+
require_relative "openai/resources/containers/files"
499+
require_relative "openai/resources/containers/files/content"
481500
require_relative "openai/resources/embeddings"
482501
require_relative "openai/resources/evals"
483502
require_relative "openai/resources/evals/runs"

lib/openai/client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ class Client < OpenAI::Internal::Transport::BaseClient
7272
# @return [OpenAI::Resources::Evals]
7373
attr_reader :evals
7474

75+
# @return [OpenAI::Resources::Containers]
76+
attr_reader :containers
77+
7578
# @api private
7679
#
7780
# @return [Hash{String=>String}]
@@ -147,6 +150,7 @@ def initialize(
147150
@uploads = OpenAI::Resources::Uploads.new(client: self)
148151
@responses = OpenAI::Resources::Responses.new(client: self)
149152
@evals = OpenAI::Resources::Evals.new(client: self)
153+
@containers = OpenAI::Resources::Containers.new(client: self)
150154
end
151155
end
152156
end

lib/openai/models.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ module OpenAI
8181

8282
CompoundFilter = OpenAI::Models::CompoundFilter
8383

84+
ContainerCreateParams = OpenAI::Models::ContainerCreateParams
85+
86+
ContainerDeleteParams = OpenAI::Models::ContainerDeleteParams
87+
88+
ContainerListParams = OpenAI::Models::ContainerListParams
89+
90+
ContainerRetrieveParams = OpenAI::Models::ContainerRetrieveParams
91+
92+
Containers = OpenAI::Models::Containers
93+
8494
CreateEmbeddingResponse = OpenAI::Models::CreateEmbeddingResponse
8595

8696
Embedding = OpenAI::Models::Embedding
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
# @see OpenAI::Resources::Containers#create
6+
class ContainerCreateParams < OpenAI::Internal::Type::BaseModel
7+
extend OpenAI::Internal::Type::RequestParameters::Converter
8+
include OpenAI::Internal::Type::RequestParameters
9+
10+
# @!attribute name
11+
# Name of the container to create.
12+
#
13+
# @return [String]
14+
required :name, String
15+
16+
# @!attribute expires_after
17+
# Container expiration time in seconds relative to the 'anchor' time.
18+
#
19+
# @return [OpenAI::ContainerCreateParams::ExpiresAfter, nil]
20+
optional :expires_after, -> { OpenAI::ContainerCreateParams::ExpiresAfter }
21+
22+
# @!attribute file_ids
23+
# IDs of files to copy to the container.
24+
#
25+
# @return [Array<String>, nil]
26+
optional :file_ids, OpenAI::Internal::Type::ArrayOf[String]
27+
28+
# @!method initialize(name:, expires_after: nil, file_ids: nil, request_options: {})
29+
# @param name [String] Name of the container to create.
30+
#
31+
# @param expires_after [OpenAI::ContainerCreateParams::ExpiresAfter] Container expiration time in seconds relative to the 'anchor' time.
32+
#
33+
# @param file_ids [Array<String>] IDs of files to copy to the container.
34+
#
35+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
36+
37+
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
38+
# @!attribute anchor
39+
# Time anchor for the expiration time. Currently only 'last_active_at' is
40+
# supported.
41+
#
42+
# @return [Symbol, OpenAI::ContainerCreateParams::ExpiresAfter::Anchor]
43+
required :anchor, enum: -> { OpenAI::ContainerCreateParams::ExpiresAfter::Anchor }
44+
45+
# @!attribute minutes
46+
#
47+
# @return [Integer]
48+
required :minutes, Integer
49+
50+
# @!method initialize(anchor:, minutes:)
51+
# Some parameter documentations has been truncated, see
52+
# {OpenAI::ContainerCreateParams::ExpiresAfter} for more details.
53+
#
54+
# Container expiration time in seconds relative to the 'anchor' time.
55+
#
56+
# @param anchor [Symbol, OpenAI::ContainerCreateParams::ExpiresAfter::Anchor] Time anchor for the expiration time. Currently only 'last_active_at' is supporte
57+
#
58+
# @param minutes [Integer]
59+
60+
# Time anchor for the expiration time. Currently only 'last_active_at' is
61+
# supported.
62+
#
63+
# @see OpenAI::ContainerCreateParams::ExpiresAfter#anchor
64+
module Anchor
65+
extend OpenAI::Internal::Type::Enum
66+
67+
LAST_ACTIVE_AT = :last_active_at
68+
69+
# @!method self.values
70+
# @return [Array<Symbol>]
71+
end
72+
end
73+
end
74+
end
75+
end
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
# @see OpenAI::Resources::Containers#create
6+
class ContainerCreateResponse < OpenAI::Internal::Type::BaseModel
7+
# @!attribute id
8+
# Unique identifier for the container.
9+
#
10+
# @return [String]
11+
required :id, String
12+
13+
# @!attribute created_at
14+
# Unix timestamp (in seconds) when the container was created.
15+
#
16+
# @return [Integer]
17+
required :created_at, Integer
18+
19+
# @!attribute name
20+
# Name of the container.
21+
#
22+
# @return [String]
23+
required :name, String
24+
25+
# @!attribute object
26+
# The type of this object.
27+
#
28+
# @return [String]
29+
required :object, String
30+
31+
# @!attribute status
32+
# Status of the container (e.g., active, deleted).
33+
#
34+
# @return [String]
35+
required :status, String
36+
37+
# @!attribute expires_after
38+
# The container will expire after this time period. The anchor is the reference
39+
# point for the expiration. The minutes is the number of minutes after the anchor
40+
# before the container expires.
41+
#
42+
# @return [OpenAI::Models::ContainerCreateResponse::ExpiresAfter, nil]
43+
optional :expires_after, -> { OpenAI::Models::ContainerCreateResponse::ExpiresAfter }
44+
45+
# @!method initialize(id:, created_at:, name:, object:, status:, expires_after: nil)
46+
# Some parameter documentations has been truncated, see
47+
# {OpenAI::Models::ContainerCreateResponse} for more details.
48+
#
49+
# @param id [String] Unique identifier for the container.
50+
#
51+
# @param created_at [Integer] Unix timestamp (in seconds) when the container was created.
52+
#
53+
# @param name [String] Name of the container.
54+
#
55+
# @param object [String] The type of this object.
56+
#
57+
# @param status [String] Status of the container (e.g., active, deleted).
58+
#
59+
# @param expires_after [OpenAI::Models::ContainerCreateResponse::ExpiresAfter] The container will expire after this time period.
60+
61+
# @see OpenAI::Models::ContainerCreateResponse#expires_after
62+
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
63+
# @!attribute anchor
64+
# The reference point for the expiration.
65+
#
66+
# @return [Symbol, OpenAI::Models::ContainerCreateResponse::ExpiresAfter::Anchor, nil]
67+
optional :anchor, enum: -> { OpenAI::Models::ContainerCreateResponse::ExpiresAfter::Anchor }
68+
69+
# @!attribute minutes
70+
# The number of minutes after the anchor before the container expires.
71+
#
72+
# @return [Integer, nil]
73+
optional :minutes, Integer
74+
75+
# @!method initialize(anchor: nil, minutes: nil)
76+
# The container will expire after this time period. The anchor is the reference
77+
# point for the expiration. The minutes is the number of minutes after the anchor
78+
# before the container expires.
79+
#
80+
# @param anchor [Symbol, OpenAI::Models::ContainerCreateResponse::ExpiresAfter::Anchor] The reference point for the expiration.
81+
#
82+
# @param minutes [Integer] The number of minutes after the anchor before the container expires.
83+
84+
# The reference point for the expiration.
85+
#
86+
# @see OpenAI::Models::ContainerCreateResponse::ExpiresAfter#anchor
87+
module Anchor
88+
extend OpenAI::Internal::Type::Enum
89+
90+
LAST_ACTIVE_AT = :last_active_at
91+
92+
# @!method self.values
93+
# @return [Array<Symbol>]
94+
end
95+
end
96+
end
97+
end
98+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
# @see OpenAI::Resources::Containers#delete
6+
class ContainerDeleteParams < OpenAI::Internal::Type::BaseModel
7+
extend OpenAI::Internal::Type::RequestParameters::Converter
8+
include OpenAI::Internal::Type::RequestParameters
9+
10+
# @!method initialize(request_options: {})
11+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
12+
end
13+
end
14+
end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# frozen_string_literal: true
2+
3+
module OpenAI
4+
module Models
5+
# @see OpenAI::Resources::Containers#list
6+
class ContainerListParams < OpenAI::Internal::Type::BaseModel
7+
extend OpenAI::Internal::Type::RequestParameters::Converter
8+
include OpenAI::Internal::Type::RequestParameters
9+
10+
# @!attribute after
11+
# A cursor for use in pagination. `after` is an object ID that defines your place
12+
# in the list. For instance, if you make a list request and receive 100 objects,
13+
# ending with obj_foo, your subsequent call can include after=obj_foo in order to
14+
# fetch the next page of the list.
15+
#
16+
# @return [String, nil]
17+
optional :after, String
18+
19+
# @!attribute limit
20+
# A limit on the number of objects to be returned. Limit can range between 1 and
21+
# 100, and the default is 20.
22+
#
23+
# @return [Integer, nil]
24+
optional :limit, Integer
25+
26+
# @!attribute order
27+
# Sort order by the `created_at` timestamp of the objects. `asc` for ascending
28+
# order and `desc` for descending order.
29+
#
30+
# @return [Symbol, OpenAI::ContainerListParams::Order, nil]
31+
optional :order, enum: -> { OpenAI::ContainerListParams::Order }
32+
33+
# @!method initialize(after: nil, limit: nil, order: nil, request_options: {})
34+
# Some parameter documentations has been truncated, see
35+
# {OpenAI::Models::ContainerListParams} for more details.
36+
#
37+
# @param after [String] A cursor for use in pagination. `after` is an object ID that defines your place
38+
#
39+
# @param limit [Integer] A limit on the number of objects to be returned. Limit can range between 1 and 1
40+
#
41+
# @param order [Symbol, OpenAI::ContainerListParams::Order] Sort order by the `created_at` timestamp of the objects. `asc` for ascending ord
42+
#
43+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
44+
45+
# Sort order by the `created_at` timestamp of the objects. `asc` for ascending
46+
# order and `desc` for descending order.
47+
module Order
48+
extend OpenAI::Internal::Type::Enum
49+
50+
ASC = :asc
51+
DESC = :desc
52+
53+
# @!method self.values
54+
# @return [Array<Symbol>]
55+
end
56+
end
57+
end
58+
end

0 commit comments

Comments
 (0)