openai 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10373778f29256c14ae2a86c73559f1666fead459817c6261b4960c64d0a8c6e
4
- data.tar.gz: d923d898c5f7adcd2430cfa8baf05a7b76bb0b4450ed7a808e4cb85d5cb49b9c
3
+ metadata.gz: 319786b20e6239f01ec9d26047bae8fa9259e141f95baa7d24b22ff3b417aac8
4
+ data.tar.gz: 85a7e695dedbad2fbdc305dc2ee5e1843ef3793fcf50d2bfe3efd6be294cfa37
5
5
  SHA512:
6
- metadata.gz: 5131c4e4918e766e222df46cffd15582461fa8dd677a55ae2e6602c0283ed3c6a48682b562dbf1135573329fa295d4b4e2ac2bb52897b032dd5297c5ff85e191
7
- data.tar.gz: c13000c1ad47d32f6c4fad58b2974f3dec4dfb58a751e34d4c76da1cb032391439fdc07f4f8a8052b1c8e7fe1dc181567c26acdacf65cb09b30376b8167598aa
6
+ metadata.gz: bcf2cc4be6392d80121ff4371946fb56e255dbb6f75564251690db6f825155e35cafe7fbfd91f5937e275a458cd8bd8641b92b5c05ccbd242bbc9720b7cd01f3
7
+ data.tar.gz: 8d0417477c03208b215fb0ddb36947d73a6e25bd55243c2a137a09437920b52c814e22f5ea78113c42b59426bf5d929cdbfd03a3d5d4554ff8c698fd87b463d9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.46.0 (2026-02-08)
4
+
5
+ Full Changelog: [v0.45.0...v0.46.0](https://github.com/openai/openai-ruby/compare/v0.45.0...v0.46.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** responses context_management ([d954f15](https://github.com/openai/openai-ruby/commit/d954f152ff59cc30baec8d7bba91f1575bfa29f4))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **client:** loosen json header parsing ([8b7f68c](https://github.com/openai/openai-ruby/commit/8b7f68c3b866daba39ed4bf83a724990891de69a))
15
+
3
16
  ## 0.45.0 (2026-02-04)
4
17
 
5
18
  Full Changelog: [v0.44.0...v0.45.0](https://github.com/openai/openai-ruby/compare/v0.44.0...v0.45.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "openai", "~> 0.45.0"
18
+ gem "openai", "~> 0.46.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -485,7 +485,7 @@ module OpenAI
485
485
  end
486
486
 
487
487
  # @type [Regexp]
488
- JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}
488
+ JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
489
489
  # @type [Regexp]
490
490
  JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
491
491
 
@@ -44,8 +44,8 @@ module OpenAI
44
44
  # @!attribute input_fidelity
45
45
  # Control how much effort the model will exert to match the style and features,
46
46
  # especially facial features, of input images. This parameter is only supported
47
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
48
- # `low`. Defaults to `low`.
47
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
48
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
49
49
  #
50
50
  # @return [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil]
51
51
  optional :input_fidelity, enum: -> { OpenAI::ImageEditParams::InputFidelity }, nil?: true
@@ -209,8 +209,8 @@ module OpenAI
209
209
 
210
210
  # Control how much effort the model will exert to match the style and features,
211
211
  # especially facial features, of input images. This parameter is only supported
212
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
213
- # `low`. Defaults to `low`.
212
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
213
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
214
214
  module InputFidelity
215
215
  extend OpenAI::Internal::Type::Enum
216
216
 
@@ -17,6 +17,16 @@ module OpenAI
17
17
  # @return [Boolean, nil]
18
18
  optional :background, OpenAI::Internal::Type::Boolean, nil?: true
19
19
 
20
+ # @!attribute context_management
21
+ # Context management configuration for this request.
22
+ #
23
+ # @return [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil]
24
+ optional :context_management,
25
+ -> {
26
+ OpenAI::Internal::Type::ArrayOf[OpenAI::Responses::ResponseCreateParams::ContextManagement]
27
+ },
28
+ nil?: true
29
+
20
30
  # @!attribute conversation
21
31
  # The conversation that this response belongs to. Items from this conversation are
22
32
  # prepended to `input_items` for this response request. Input items and output
@@ -308,12 +318,14 @@ module OpenAI
308
318
  # @return [String, nil]
309
319
  optional :user, String
310
320
 
311
- # @!method initialize(background: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
321
+ # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
312
322
  # Some parameter documentations has been truncated, see
313
323
  # {OpenAI::Models::Responses::ResponseCreateParams} for more details.
314
324
  #
315
325
  # @param background [Boolean, nil] Whether to run the model response in the background.
316
326
  #
327
+ # @param context_management [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil] Context management configuration for this request.
328
+ #
317
329
  # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
318
330
  #
319
331
  # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
@@ -368,6 +380,25 @@ module OpenAI
368
380
  #
369
381
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
370
382
 
383
+ class ContextManagement < OpenAI::Internal::Type::BaseModel
384
+ # @!attribute type
385
+ # The context management entry type. Currently only 'compaction' is supported.
386
+ #
387
+ # @return [String]
388
+ required :type, String
389
+
390
+ # @!attribute compact_threshold
391
+ # Token threshold at which compaction should be triggered for this entry.
392
+ #
393
+ # @return [Integer, nil]
394
+ optional :compact_threshold, Integer, nil?: true
395
+
396
+ # @!method initialize(type:, compact_threshold: nil)
397
+ # @param type [String] The context management entry type. Currently only 'compaction' is supported.
398
+ #
399
+ # @param compact_threshold [Integer, nil] Token threshold at which compaction should be triggered for this entry.
400
+ end
401
+
371
402
  # The conversation that this response belongs to. Items from this conversation are
372
403
  # prepended to `input_items` for this response request. Input items and output
373
404
  # items from this response are automatically added to this conversation after this
@@ -462,8 +462,8 @@ module OpenAI
462
462
  # @!attribute input_fidelity
463
463
  # Control how much effort the model will exert to match the style and features,
464
464
  # especially facial features, of input images. This parameter is only supported
465
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
466
- # `low`. Defaults to `low`.
465
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
466
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
467
467
  #
468
468
  # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::InputFidelity, nil]
469
469
  optional :input_fidelity,
@@ -586,8 +586,8 @@ module OpenAI
586
586
 
587
587
  # Control how much effort the model will exert to match the style and features,
588
588
  # especially facial features, of input images. This parameter is only supported
589
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
590
- # `low`. Defaults to `low`.
589
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
590
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
591
591
  #
592
592
  # @see OpenAI::Models::Responses::Tool::ImageGeneration#input_fidelity
593
593
  module InputFidelity
@@ -26,10 +26,12 @@ module OpenAI
26
26
  # [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
27
27
  # your own data as input for the model's response.
28
28
  #
29
- # @overload create(background: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
29
+ # @overload create(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
30
30
  #
31
31
  # @param background [Boolean, nil] Whether to run the model response in the background.
32
32
  #
33
+ # @param context_management [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil] Context management configuration for this request.
34
+ #
33
35
  # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
34
36
  #
35
37
  # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
@@ -127,10 +129,12 @@ module OpenAI
127
129
  # [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
128
130
  # your own data as input for the model's response.
129
131
  #
130
- # @overload stream(background: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
132
+ # @overload stream(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
131
133
  #
132
134
  # @param background [Boolean, nil] Whether to run the model response in the background.
133
135
  #
136
+ # @param context_management [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil] Context management configuration for this request.
137
+ #
134
138
  # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
135
139
  #
136
140
  # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.45.0"
4
+ VERSION = "0.46.0"
5
5
  end
@@ -296,7 +296,7 @@ module OpenAI
296
296
  end
297
297
 
298
298
  JSON_CONTENT =
299
- T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp)
299
+ T.let(%r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}, Regexp)
300
300
  JSONL_CONTENT =
301
301
  T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
302
302
 
@@ -39,8 +39,8 @@ module OpenAI
39
39
 
40
40
  # Control how much effort the model will exert to match the style and features,
41
41
  # especially facial features, of input images. This parameter is only supported
42
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
43
- # `low`. Defaults to `low`.
42
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
43
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
44
44
  sig do
45
45
  returns(T.nilable(OpenAI::ImageEditParams::InputFidelity::OrSymbol))
46
46
  end
@@ -164,8 +164,8 @@ module OpenAI
164
164
  background: nil,
165
165
  # Control how much effort the model will exert to match the style and features,
166
166
  # especially facial features, of input images. This parameter is only supported
167
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
168
- # `low`. Defaults to `low`.
167
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
168
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
169
169
  input_fidelity: nil,
170
170
  # An additional image whose fully transparent areas (e.g. where alpha is zero)
171
171
  # indicate where `image` should be edited. If there are multiple images provided,
@@ -299,8 +299,8 @@ module OpenAI
299
299
 
300
300
  # Control how much effort the model will exert to match the style and features,
301
301
  # especially facial features, of input images. This parameter is only supported
302
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
303
- # `low`. Defaults to `low`.
302
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
303
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
304
304
  module InputFidelity
305
305
  extend OpenAI::Internal::Type::Enum
306
306
 
@@ -20,6 +20,18 @@ module OpenAI
20
20
  sig { returns(T.nilable(T::Boolean)) }
21
21
  attr_accessor :background
22
22
 
23
+ # Context management configuration for this request.
24
+ sig do
25
+ returns(
26
+ T.nilable(
27
+ T::Array[
28
+ OpenAI::Responses::ResponseCreateParams::ContextManagement
29
+ ]
30
+ )
31
+ )
32
+ end
33
+ attr_accessor :context_management
34
+
23
35
  # The conversation that this response belongs to. Items from this conversation are
24
36
  # prepended to `input_items` for this response request. Input items and output
25
37
  # items from this response are automatically added to this conversation after this
@@ -427,6 +439,12 @@ module OpenAI
427
439
  sig do
428
440
  params(
429
441
  background: T.nilable(T::Boolean),
442
+ context_management:
443
+ T.nilable(
444
+ T::Array[
445
+ OpenAI::Responses::ResponseCreateParams::ContextManagement::OrHash
446
+ ]
447
+ ),
430
448
  conversation:
431
449
  T.nilable(
432
450
  T.any(
@@ -512,6 +530,8 @@ module OpenAI
512
530
  # Whether to run the model response in the background.
513
531
  # [Learn more](https://platform.openai.com/docs/guides/background).
514
532
  background: nil,
533
+ # Context management configuration for this request.
534
+ context_management: nil,
515
535
  # The conversation that this response belongs to. Items from this conversation are
516
536
  # prepended to `input_items` for this response request. Input items and output
517
537
  # items from this response are automatically added to this conversation after this
@@ -691,6 +711,12 @@ module OpenAI
691
711
  override.returns(
692
712
  {
693
713
  background: T.nilable(T::Boolean),
714
+ context_management:
715
+ T.nilable(
716
+ T::Array[
717
+ OpenAI::Responses::ResponseCreateParams::ContextManagement
718
+ ]
719
+ ),
694
720
  conversation:
695
721
  T.nilable(
696
722
  T.any(String, OpenAI::Responses::ResponseConversationParam)
@@ -773,6 +799,45 @@ module OpenAI
773
799
  def to_hash
774
800
  end
775
801
 
802
+ class ContextManagement < OpenAI::Internal::Type::BaseModel
803
+ OrHash =
804
+ T.type_alias do
805
+ T.any(
806
+ OpenAI::Responses::ResponseCreateParams::ContextManagement,
807
+ OpenAI::Internal::AnyHash
808
+ )
809
+ end
810
+
811
+ # The context management entry type. Currently only 'compaction' is supported.
812
+ sig { returns(String) }
813
+ attr_accessor :type
814
+
815
+ # Token threshold at which compaction should be triggered for this entry.
816
+ sig { returns(T.nilable(Integer)) }
817
+ attr_accessor :compact_threshold
818
+
819
+ sig do
820
+ params(type: String, compact_threshold: T.nilable(Integer)).returns(
821
+ T.attached_class
822
+ )
823
+ end
824
+ def self.new(
825
+ # The context management entry type. Currently only 'compaction' is supported.
826
+ type:,
827
+ # Token threshold at which compaction should be triggered for this entry.
828
+ compact_threshold: nil
829
+ )
830
+ end
831
+
832
+ sig do
833
+ override.returns(
834
+ { type: String, compact_threshold: T.nilable(Integer) }
835
+ )
836
+ end
837
+ def to_hash
838
+ end
839
+ end
840
+
776
841
  # The conversation that this response belongs to. Items from this conversation are
777
842
  # prepended to `input_items` for this response request. Input items and output
778
843
  # items from this response are automatically added to this conversation after this
@@ -874,8 +874,8 @@ module OpenAI
874
874
 
875
875
  # Control how much effort the model will exert to match the style and features,
876
876
  # especially facial features, of input images. This parameter is only supported
877
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
878
- # `low`. Defaults to `low`.
877
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
878
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
879
879
  sig do
880
880
  returns(
881
881
  T.nilable(
@@ -1055,8 +1055,8 @@ module OpenAI
1055
1055
  background: nil,
1056
1056
  # Control how much effort the model will exert to match the style and features,
1057
1057
  # especially facial features, of input images. This parameter is only supported
1058
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
1059
- # `low`. Defaults to `low`.
1058
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
1059
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
1060
1060
  input_fidelity: nil,
1061
1061
  # Optional mask for inpainting. Contains `image_url` (string, optional) and
1062
1062
  # `file_id` (string, optional).
@@ -1198,8 +1198,8 @@ module OpenAI
1198
1198
 
1199
1199
  # Control how much effort the model will exert to match the style and features,
1200
1200
  # especially facial features, of input images. This parameter is only supported
1201
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
1202
- # `low`. Defaults to `low`.
1201
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
1202
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
1203
1203
  module InputFidelity
1204
1204
  extend OpenAI::Internal::Type::Enum
1205
1205
 
@@ -93,8 +93,8 @@ module OpenAI
93
93
  background: nil,
94
94
  # Control how much effort the model will exert to match the style and features,
95
95
  # especially facial features, of input images. This parameter is only supported
96
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
97
- # `low`. Defaults to `low`.
96
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
97
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
98
98
  input_fidelity: nil,
99
99
  # An additional image whose fully transparent areas (e.g. where alpha is zero)
100
100
  # indicate where `image` should be edited. If there are multiple images provided,
@@ -199,8 +199,8 @@ module OpenAI
199
199
  background: nil,
200
200
  # Control how much effort the model will exert to match the style and features,
201
201
  # especially facial features, of input images. This parameter is only supported
202
- # for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
203
- # `low`. Defaults to `low`.
202
+ # for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
203
+ # `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
204
204
  input_fidelity: nil,
205
205
  # An additional image whose fully transparent areas (e.g. where alpha is zero)
206
206
  # indicate where `image` should be edited. If there are multiple images provided,
@@ -25,6 +25,12 @@ module OpenAI
25
25
  sig do
26
26
  params(
27
27
  background: T.nilable(T::Boolean),
28
+ context_management:
29
+ T.nilable(
30
+ T::Array[
31
+ OpenAI::Responses::ResponseCreateParams::ContextManagement::OrHash
32
+ ]
33
+ ),
28
34
  conversation:
29
35
  T.nilable(
30
36
  T.any(
@@ -115,6 +121,8 @@ module OpenAI
115
121
  # Whether to run the model response in the background.
116
122
  # [Learn more](https://platform.openai.com/docs/guides/background).
117
123
  background: nil,
124
+ # Context management configuration for this request.
125
+ context_management: nil,
118
126
  # The conversation that this response belongs to. Items from this conversation are
119
127
  # prepended to `input_items` for this response request. Input items and output
120
128
  # items from this response are automatically added to this conversation after this
@@ -309,6 +317,12 @@ module OpenAI
309
317
  sig do
310
318
  params(
311
319
  background: T.nilable(T::Boolean),
320
+ context_management:
321
+ T.nilable(
322
+ T::Array[
323
+ OpenAI::Responses::ResponseCreateParams::ContextManagement::OrHash
324
+ ]
325
+ ),
312
326
  conversation:
313
327
  T.nilable(
314
328
  T.any(
@@ -405,6 +419,8 @@ module OpenAI
405
419
  # Whether to run the model response in the background.
406
420
  # [Learn more](https://platform.openai.com/docs/guides/background).
407
421
  background: nil,
422
+ # Context management configuration for this request.
423
+ context_management: nil,
408
424
  # The conversation that this response belongs to. Items from this conversation are
409
425
  # prepended to `input_items` for this response request. Input items and output
410
426
  # items from this response are automatically added to this conversation after this
@@ -4,6 +4,7 @@ module OpenAI
4
4
  type response_create_params =
5
5
  {
6
6
  background: bool?,
7
+ context_management: ::Array[OpenAI::Responses::ResponseCreateParams::ContextManagement]?,
7
8
  conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
8
9
  include: ::Array[OpenAI::Models::Responses::response_includable]?,
9
10
  input: OpenAI::Models::Responses::ResponseCreateParams::input,
@@ -39,6 +40,8 @@ module OpenAI
39
40
 
40
41
  attr_accessor background: bool?
41
42
 
43
+ attr_accessor context_management: ::Array[OpenAI::Responses::ResponseCreateParams::ContextManagement]?
44
+
42
45
  attr_accessor conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?
43
46
 
44
47
  attr_accessor include: ::Array[OpenAI::Models::Responses::response_includable]?
@@ -119,6 +122,7 @@ module OpenAI
119
122
 
120
123
  def initialize: (
121
124
  ?background: bool?,
125
+ ?context_management: ::Array[OpenAI::Responses::ResponseCreateParams::ContextManagement]?,
122
126
  ?conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
123
127
  ?include: ::Array[OpenAI::Models::Responses::response_includable]?,
124
128
  ?input: OpenAI::Models::Responses::ResponseCreateParams::input,
@@ -150,6 +154,7 @@ module OpenAI
150
154
 
151
155
  def to_hash: -> {
152
156
  background: bool?,
157
+ context_management: ::Array[OpenAI::Responses::ResponseCreateParams::ContextManagement]?,
153
158
  conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
154
159
  include: ::Array[OpenAI::Models::Responses::response_includable]?,
155
160
  input: OpenAI::Models::Responses::ResponseCreateParams::input,
@@ -179,6 +184,18 @@ module OpenAI
179
184
  request_options: OpenAI::RequestOptions
180
185
  }
181
186
 
187
+ type context_management = { type: String, compact_threshold: Integer? }
188
+
189
+ class ContextManagement < OpenAI::Internal::Type::BaseModel
190
+ attr_accessor type: String
191
+
192
+ attr_accessor compact_threshold: Integer?
193
+
194
+ def initialize: (type: String, ?compact_threshold: Integer?) -> void
195
+
196
+ def to_hash: -> { type: String, compact_threshold: Integer? }
197
+ end
198
+
182
199
  type conversation =
183
200
  String | OpenAI::Responses::ResponseConversationParam
184
201
 
@@ -7,6 +7,7 @@ module OpenAI
7
7
 
8
8
  def create: (
9
9
  ?background: bool?,
10
+ ?context_management: ::Array[OpenAI::Responses::ResponseCreateParams::ContextManagement]?,
10
11
  ?conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
11
12
  ?include: ::Array[OpenAI::Models::Responses::response_includable]?,
12
13
  ?input: OpenAI::Models::Responses::ResponseCreateParams::input,
@@ -38,6 +39,7 @@ module OpenAI
38
39
 
39
40
  def stream_raw: (
40
41
  ?background: bool?,
42
+ ?context_management: ::Array[OpenAI::Responses::ResponseCreateParams::ContextManagement]?,
41
43
  ?conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
42
44
  ?include: ::Array[OpenAI::Models::Responses::response_includable]?,
43
45
  ?input: OpenAI::Models::Responses::ResponseCreateParams::input,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.45.0
4
+ version: 0.46.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-05 00:00:00.000000000 Z
11
+ date: 2026-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64