openai 0.83.0 → 0.84.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +1 -1
  4. data/lib/openai/auth/workload_identity_auth.rb +17 -2
  5. data/lib/openai/client.rb +20 -6
  6. data/lib/openai/errors.rb +1 -1
  7. data/lib/openai/helpers/streaming/chat_completion_stream.rb +1 -2
  8. data/lib/openai/helpers/streaming/response_events.rb +2 -2
  9. data/lib/openai/helpers/streaming/response_stream.rb +73 -42
  10. data/lib/openai/helpers/structured_output/chat_completion_parser.rb +6 -0
  11. data/lib/openai/helpers/structured_output/response_parser.rb +1 -1
  12. data/lib/openai/internal/type/base_model.rb +2 -2
  13. data/lib/openai/internal/type/converter.rb +1 -1
  14. data/lib/openai/internal/util.rb +2 -2
  15. data/lib/openai/models/admin/organization/usage_costs_params.rb +10 -1
  16. data/lib/openai/models/batch.rb +4 -4
  17. data/lib/openai/models/beta/beta_response.rb +9 -12
  18. data/lib/openai/models/beta/beta_response_usage.rb +1 -12
  19. data/lib/openai/models/beta/beta_responses_client_event.rb +8 -12
  20. data/lib/openai/models/beta/response_compact_params.rb +7 -7
  21. data/lib/openai/models/beta/response_create_params.rb +8 -12
  22. data/lib/openai/models/chat/completion_create_params.rb +8 -8
  23. data/lib/openai/models/completion_usage.rb +1 -12
  24. data/lib/openai/models/eval_create_response.rb +1 -1
  25. data/lib/openai/models/eval_list_response.rb +1 -1
  26. data/lib/openai/models/eval_retrieve_response.rb +1 -1
  27. data/lib/openai/models/eval_update_response.rb +1 -1
  28. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +2 -2
  29. data/lib/openai/models/reasoning.rb +0 -2
  30. data/lib/openai/models/responses/response.rb +6 -7
  31. data/lib/openai/models/responses/response_compact_params.rb +7 -7
  32. data/lib/openai/models/responses/response_create_params.rb +5 -7
  33. data/lib/openai/models/responses/response_usage.rb +1 -12
  34. data/lib/openai/models/responses/responses_client_event.rb +5 -7
  35. data/lib/openai/resources/admin/organization/usage.rb +3 -1
  36. data/lib/openai/resources/beta/responses.rb +5 -5
  37. data/lib/openai/resources/chat/completions.rb +2 -2
  38. data/lib/openai/resources/responses.rb +7 -6
  39. data/lib/openai/version.rb +1 -1
  40. data/lib/openai.rb +1 -0
  41. data/rbi/openai/errors.rbi +1 -1
  42. data/rbi/openai/helpers/streaming/events.rbi +2 -2
  43. data/rbi/openai/helpers/streaming/response_stream.rbi +3 -3
  44. data/rbi/openai/models/admin/organization/usage_costs_params.rbi +15 -0
  45. data/rbi/openai/models/batch.rbi +6 -6
  46. data/rbi/openai/models/beta/beta_response.rbi +10 -15
  47. data/rbi/openai/models/beta/beta_response_usage.rbi +3 -13
  48. data/rbi/openai/models/beta/beta_responses_client_event.rbi +9 -15
  49. data/rbi/openai/models/beta/response_compact_params.rbi +9 -9
  50. data/rbi/openai/models/beta/response_create_params.rbi +9 -15
  51. data/rbi/openai/models/chat/completion_create_params.rbi +9 -9
  52. data/rbi/openai/models/completion_usage.rbi +0 -10
  53. data/rbi/openai/models/eval_create_response.rbi +1 -1
  54. data/rbi/openai/models/eval_list_response.rbi +1 -1
  55. data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
  56. data/rbi/openai/models/eval_update_response.rbi +1 -1
  57. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +2 -2
  58. data/rbi/openai/models/reasoning.rbi +0 -2
  59. data/rbi/openai/models/responses/response.rbi +7 -10
  60. data/rbi/openai/models/responses/response_compact_params.rbi +9 -9
  61. data/rbi/openai/models/responses/response_create_params.rbi +6 -10
  62. data/rbi/openai/models/responses/response_usage.rbi +3 -13
  63. data/rbi/openai/models/responses/responses_client_event.rbi +6 -10
  64. data/rbi/openai/resources/admin/organization/usage.rbi +4 -0
  65. data/rbi/openai/resources/beta/responses.rbi +7 -11
  66. data/rbi/openai/resources/chat/completions.rbi +6 -6
  67. data/rbi/openai/resources/responses.rbi +9 -13
  68. data/sig/openai/errors.rbs +1 -1
  69. data/sig/openai/internal/transport/base_client.rbs +4 -19
  70. data/sig/openai/models/admin/organization/usage_costs_params.rbs +7 -0
  71. data/sig/openai/models/beta/beta_response.rbs +2 -1
  72. data/sig/openai/models/beta/beta_response_usage.rbs +3 -8
  73. data/sig/openai/models/completion_usage.rbs +0 -5
  74. data/sig/openai/models/responses/response.rbs +2 -1
  75. data/sig/openai/models/responses/response_usage.rbs +3 -8
  76. data/sig/openai/resources/admin/organization/usage.rbs +1 -0
  77. metadata +1 -1
@@ -53,9 +53,9 @@ module OpenAI
53
53
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
54
54
  attr_accessor :metadata
55
55
 
56
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
57
- # wide range of models with different capabilities, performance characteristics,
58
- # and price points. Refer to the
56
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
57
+ # range of models with different capabilities, performance characteristics, and
58
+ # price points. Refer to the
59
59
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
60
60
  # available models.
61
61
  sig { returns(OpenAI::ResponsesModel::Variants) }
@@ -215,8 +215,6 @@ module OpenAI
215
215
  sig { returns(T.nilable(OpenAI::Responses::Response::PromptCacheRetention::TaggedSymbol)) }
216
216
  attr_accessor :prompt_cache_retention
217
217
 
218
- # **gpt-5 and o-series models only**
219
- #
220
218
  # Configuration options for
221
219
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
222
220
  sig { returns(T.nilable(OpenAI::Reasoning)) }
@@ -477,9 +475,9 @@ module OpenAI
477
475
  # a maximum length of 512 characters.
478
476
  metadata:,
479
477
 
480
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
481
- # wide range of models with different capabilities, performance characteristics,
482
- # and price points. Refer to the
478
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
479
+ # range of models with different capabilities, performance characteristics, and
480
+ # price points. Refer to the
483
481
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
484
482
  # available models.
485
483
  model:,
@@ -600,8 +598,6 @@ module OpenAI
600
598
  # `prompt_cache_retention` is not specified.
601
599
  prompt_cache_retention: nil,
602
600
 
603
- # **gpt-5 and o-series models only**
604
- #
605
601
  # Configuration options for
606
602
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
607
603
  reasoning: nil,
@@ -775,6 +771,7 @@ module OpenAI
775
771
  :max_output_tokens,
776
772
  OpenAI::Responses::Response::IncompleteDetails::Reason::TaggedSymbol
777
773
  )
774
+ MAX_MESSAGES = T.let(:max_messages, OpenAI::Responses::Response::IncompleteDetails::Reason::TaggedSymbol)
778
775
  CONTENT_FILTER = T.let(
779
776
  :content_filter,
780
777
  OpenAI::Responses::Response::IncompleteDetails::Reason::TaggedSymbol
@@ -17,9 +17,9 @@ module OpenAI
17
17
  )
18
18
  end
19
19
 
20
- # Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a
21
- # wide range of models with different capabilities, performance characteristics,
22
- # and price points. Refer to the
20
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
21
+ # range of models with different capabilities, performance characteristics, and
22
+ # price points. Refer to the
23
23
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
24
24
  # available models.
25
25
  sig { returns(T.nilable(T.any(OpenAI::Responses::ResponseCompactParams::Model::OrSymbol, String))) }
@@ -112,9 +112,9 @@ module OpenAI
112
112
  end
113
113
  def self.new(
114
114
 
115
- # Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a
116
- # wide range of models with different capabilities, performance characteristics,
117
- # and price points. Refer to the
115
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
116
+ # range of models with different capabilities, performance characteristics, and
117
+ # price points. Refer to the
118
118
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
119
119
  # available models.
120
120
  model:,
@@ -192,9 +192,9 @@ module OpenAI
192
192
  def to_hash
193
193
  end
194
194
 
195
- # Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a
196
- # wide range of models with different capabilities, performance characteristics,
197
- # and price points. Refer to the
195
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
196
+ # range of models with different capabilities, performance characteristics, and
197
+ # price points. Refer to the
198
198
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
199
199
  # available models.
200
200
  module Model
@@ -99,9 +99,9 @@ module OpenAI
99
99
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
100
100
  attr_accessor :metadata
101
101
 
102
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
103
- # wide range of models with different capabilities, performance characteristics,
104
- # and price points. Refer to the
102
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
103
+ # range of models with different capabilities, performance characteristics, and
104
+ # price points. Refer to the
105
105
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
106
106
  # available models.
107
107
  sig {
@@ -186,8 +186,6 @@ module OpenAI
186
186
  sig { returns(T.nilable(OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::OrSymbol)) }
187
187
  attr_accessor :prompt_cache_retention
188
188
 
189
- # **gpt-5 and o-series models only**
190
- #
191
189
  # Configuration options for
192
190
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
193
191
  sig { returns(T.nilable(OpenAI::Reasoning)) }
@@ -587,9 +585,9 @@ module OpenAI
587
585
  # a maximum length of 512 characters.
588
586
  metadata: nil,
589
587
 
590
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
591
- # wide range of models with different capabilities, performance characteristics,
592
- # and price points. Refer to the
588
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
589
+ # range of models with different capabilities, performance characteristics, and
590
+ # price points. Refer to the
593
591
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
594
592
  # available models.
595
593
  model: nil,
@@ -645,8 +643,6 @@ module OpenAI
645
643
  # `prompt_cache_retention` is not specified.
646
644
  prompt_cache_retention: nil,
647
645
 
648
- # **gpt-5 and o-series models only**
649
- #
650
646
  # Configuration options for
651
647
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
652
648
  reasoning: nil,
@@ -40,10 +40,6 @@ module OpenAI
40
40
  sig { returns(Integer) }
41
41
  attr_accessor :total_tokens
42
42
 
43
- # Compute units for the request. Currently null when available.
44
- sig { returns(T.nilable(Integer)) }
45
- attr_accessor :compute_units
46
-
47
43
  # Represents token usage details including input tokens, output tokens, a
48
44
  # breakdown of output tokens, and the total tokens used.
49
45
  sig do
@@ -57,9 +53,7 @@ module OpenAI
57
53
 
58
54
  output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails::OrHash,
59
55
 
60
- total_tokens: Integer,
61
-
62
- compute_units: T.nilable(Integer)
56
+ total_tokens: Integer
63
57
  )
64
58
  .returns(T.attached_class)
65
59
  end
@@ -78,11 +72,8 @@ module OpenAI
78
72
  output_tokens_details:,
79
73
 
80
74
  # The total number of tokens used.
81
- total_tokens:,
82
-
83
- # Compute units for the request. Currently null when available.
84
75
 
85
- compute_units: nil
76
+ total_tokens:
86
77
  )
87
78
  end
88
79
 
@@ -93,8 +84,7 @@ module OpenAI
93
84
  input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
94
85
  output_tokens: Integer,
95
86
  output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
96
- total_tokens: Integer,
97
- compute_units: T.nilable(Integer)
87
+ total_tokens: Integer
98
88
  }
99
89
  )
100
90
  end
@@ -100,9 +100,9 @@ module OpenAI
100
100
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
101
101
  attr_accessor :metadata
102
102
 
103
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
104
- # wide range of models with different capabilities, performance characteristics,
105
- # and price points. Refer to the
103
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
104
+ # range of models with different capabilities, performance characteristics, and
105
+ # price points. Refer to the
106
106
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
107
107
  # available models.
108
108
  sig {
@@ -187,8 +187,6 @@ module OpenAI
187
187
  sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::OrSymbol)) }
188
188
  attr_accessor :prompt_cache_retention
189
189
 
190
- # **gpt-5 and o-series models only**
191
- #
192
190
  # Configuration options for
193
191
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
194
192
  sig { returns(T.nilable(OpenAI::Reasoning)) }
@@ -603,9 +601,9 @@ module OpenAI
603
601
  # a maximum length of 512 characters.
604
602
  metadata: nil,
605
603
 
606
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
607
- # wide range of models with different capabilities, performance characteristics,
608
- # and price points. Refer to the
604
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
605
+ # range of models with different capabilities, performance characteristics, and
606
+ # price points. Refer to the
609
607
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
610
608
  # available models.
611
609
  model: nil,
@@ -661,8 +659,6 @@ module OpenAI
661
659
  # `prompt_cache_retention` is not specified.
662
660
  prompt_cache_retention: nil,
663
661
 
664
- # **gpt-5 and o-series models only**
665
- #
666
662
  # Configuration options for
667
663
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
668
664
  reasoning: nil,
@@ -210,6 +210,7 @@ module OpenAI
210
210
  end_time: Integer,
211
211
  group_by: T::Array[OpenAI::Admin::Organization::UsageCostsParams::GroupBy::OrSymbol],
212
212
  limit: Integer,
213
+ line_items: T::Array[String],
213
214
  page: String,
214
215
  project_ids: T::Array[String],
215
216
  request_options: OpenAI::RequestOptions::OrHash
@@ -232,6 +233,9 @@ module OpenAI
232
233
  # A limit on the number of buckets to be returned. Limit can range between 1 and
233
234
  # 180, and the default is 7.
234
235
  limit: nil,
236
+ # Return only costs for these exact line item names. Each value must match the
237
+ # complete `line_item` value, for example `gpt-5.6-sol, input_tokens`.
238
+ line_items: nil,
235
239
  # A cursor for use in pagination. Corresponding to the `next_page` field from the
236
240
  # previous response.
237
241
  page: nil,
@@ -157,8 +157,8 @@ module OpenAI
157
157
  # Keys are strings with a maximum length of 64 characters. Values are strings with
158
158
  # a maximum length of 512 characters.
159
159
  metadata: nil,
160
- # Body param: Model ID used to generate the response, like `gpt-4o` or `o3`.
161
- # OpenAI offers a wide range of models with different capabilities, performance
160
+ # Body param: Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI
161
+ # offers a wide range of models with different capabilities, performance
162
162
  # characteristics, and price points. Refer to the
163
163
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
164
164
  # available models.
@@ -211,9 +211,7 @@ module OpenAI
211
211
  # - Organizations with ZDR enabled default to `in_memory` when
212
212
  # `prompt_cache_retention` is not specified.
213
213
  prompt_cache_retention: nil,
214
- # Body param: **gpt-5 and o-series models only**
215
- #
216
- # Configuration options for
214
+ # Body param: Configuration options for
217
215
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
218
216
  reasoning: nil,
219
217
  # Body param: A stable identifier used to help detect users of your application
@@ -473,8 +471,8 @@ module OpenAI
473
471
  # Keys are strings with a maximum length of 64 characters. Values are strings with
474
472
  # a maximum length of 512 characters.
475
473
  metadata: nil,
476
- # Body param: Model ID used to generate the response, like `gpt-4o` or `o3`.
477
- # OpenAI offers a wide range of models with different capabilities, performance
474
+ # Body param: Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI
475
+ # offers a wide range of models with different capabilities, performance
478
476
  # characteristics, and price points. Refer to the
479
477
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
480
478
  # available models.
@@ -527,9 +525,7 @@ module OpenAI
527
525
  # - Organizations with ZDR enabled default to `in_memory` when
528
526
  # `prompt_cache_retention` is not specified.
529
527
  prompt_cache_retention: nil,
530
- # Body param: **gpt-5 and o-series models only**
531
- #
532
- # Configuration options for
528
+ # Body param: Configuration options for
533
529
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
534
530
  reasoning: nil,
535
531
  # Body param: A stable identifier used to help detect users of your application
@@ -786,7 +782,7 @@ module OpenAI
786
782
  .returns(OpenAI::Beta::BetaCompactedResponse)
787
783
  }
788
784
  def compact(
789
- # Body param: Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI
785
+ # Body param: Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI
790
786
  # offers a wide range of models with different capabilities, performance
791
787
  # characteristics, and price points. Refer to the
792
788
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
@@ -115,9 +115,9 @@ module OpenAI
115
115
  # [images](https://platform.openai.com/docs/guides/vision), and
116
116
  # [audio](https://platform.openai.com/docs/guides/audio).
117
117
  messages:,
118
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
119
- # wide range of models with different capabilities, performance characteristics,
120
- # and price points. Refer to the
118
+ # Model ID used to generate the response, like `gpt-5.6-sol` or `o3`. OpenAI
119
+ # offers a wide range of models with different capabilities, performance
120
+ # characteristics, and price points. Refer to the
121
121
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
122
122
  # available models.
123
123
  model:,
@@ -453,9 +453,9 @@ module OpenAI
453
453
  # [images](https://platform.openai.com/docs/guides/vision), and
454
454
  # [audio](https://platform.openai.com/docs/guides/audio).
455
455
  messages:,
456
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
457
- # wide range of models with different capabilities, performance characteristics,
458
- # and price points. Refer to the
456
+ # Model ID used to generate the response, like `gpt-5.6-sol` or `o3`. OpenAI
457
+ # offers a wide range of models with different capabilities, performance
458
+ # characteristics, and price points. Refer to the
459
459
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
460
460
  # available models.
461
461
  model:,
@@ -155,9 +155,9 @@ module OpenAI
155
155
  # Keys are strings with a maximum length of 64 characters. Values are strings with
156
156
  # a maximum length of 512 characters.
157
157
  metadata: nil,
158
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
159
- # wide range of models with different capabilities, performance characteristics,
160
- # and price points. Refer to the
158
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
159
+ # range of models with different capabilities, performance characteristics, and
160
+ # price points. Refer to the
161
161
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
162
162
  # available models.
163
163
  model: nil,
@@ -205,8 +205,6 @@ module OpenAI
205
205
  # - Organizations with ZDR enabled default to `in_memory` when
206
206
  # `prompt_cache_retention` is not specified.
207
207
  prompt_cache_retention: nil,
208
- # **gpt-5 and o-series models only**
209
- #
210
208
  # Configuration options for
211
209
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
212
210
  reasoning: nil,
@@ -462,9 +460,9 @@ module OpenAI
462
460
  # Keys are strings with a maximum length of 64 characters. Values are strings with
463
461
  # a maximum length of 512 characters.
464
462
  metadata: nil,
465
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
466
- # wide range of models with different capabilities, performance characteristics,
467
- # and price points. Refer to the
463
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
464
+ # range of models with different capabilities, performance characteristics, and
465
+ # price points. Refer to the
468
466
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
469
467
  # available models.
470
468
  model: nil,
@@ -512,8 +510,6 @@ module OpenAI
512
510
  # - Organizations with ZDR enabled default to `in_memory` when
513
511
  # `prompt_cache_retention` is not specified.
514
512
  prompt_cache_retention: nil,
515
- # **gpt-5 and o-series models only**
516
- #
517
513
  # Configuration options for
518
514
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
519
515
  reasoning: nil,
@@ -990,9 +986,9 @@ module OpenAI
990
986
  .returns(OpenAI::Responses::CompactedResponse)
991
987
  end
992
988
  def compact(
993
- # Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a
994
- # wide range of models with different capabilities, performance characteristics,
995
- # and price points. Refer to the
989
+ # Model ID used to generate the response, like `gpt-5.6-sol`. OpenAI offers a wide
990
+ # range of models with different capabilities, performance characteristics, and
991
+ # price points. Refer to the
996
992
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
997
993
  # available models.
998
994
  model:,
@@ -1,7 +1,7 @@
1
1
  module OpenAI
2
2
  module Errors
3
3
  class Error < StandardError
4
- attr_accessor cause: StandardError?
4
+ attr_reader cause: StandardError?
5
5
  end
6
6
 
7
7
  class PollingError < OpenAI::Errors::Error
@@ -8,8 +8,8 @@ module OpenAI
8
8
  {
9
9
  method: Symbol,
10
10
  path: String | ::Array[String],
11
- query: ::Hash[String, (::Array[String] | String)?]?,
12
- headers: ::Hash[String, (String
11
+ query: ::Hash[(String | Symbol), (::Array[String] | String)?]?,
12
+ headers: ::Hash[(String | Symbol), (String
13
13
  | Integer
14
14
  | ::Array[(String | Integer)?])?]?,
15
15
  body: top?,
@@ -20,7 +20,7 @@ module OpenAI
20
20
  page: Class?,
21
21
  stream: Class?,
22
22
  model: OpenAI::Internal::Type::Converter::input?,
23
- security: { :bearer_auth? => bool, :admin_api_key_auth? => bool }?,
23
+ security: ::Hash[(:bearer_auth | :admin_api_key_auth), bool]?,
24
24
  options: OpenAI::request_opts?
25
25
  }
26
26
  type request_input =
@@ -154,22 +154,7 @@ module OpenAI
154
154
  } -> OpenAI::HTTPClient::Response
155
155
 
156
156
  def request: (
157
- Symbol method,
158
- String | ::Array[String] path,
159
- ?query: ::Hash[String, (::Array[String] | String)?]?,
160
- ?headers: ::Hash[String, (String
161
- | Integer
162
- | ::Array[(String | Integer)?])?]?,
163
- ?body: top?,
164
- ?unwrap: (Symbol
165
- | Integer
166
- | ::Array[(Symbol | Integer)]
167
- | (^(top arg0) -> top))?,
168
- ?page: Class?,
169
- ?stream: Class?,
170
- ?model: OpenAI::Internal::Type::Converter::input?,
171
- ?security: { :bearer_auth? => bool, :admin_api_key_auth? => bool }?,
172
- ?options: OpenAI::request_opts?
157
+ OpenAI::Internal::Transport::BaseClient::request_components req
173
158
  ) -> top
174
159
 
175
160
  private def perform_request: (
@@ -10,6 +10,7 @@ module OpenAI
10
10
  end_time: Integer,
11
11
  group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
12
12
  limit: Integer,
13
+ line_items: ::Array[String],
13
14
  page: String,
14
15
  project_ids: ::Array[String]
15
16
  }
@@ -45,6 +46,10 @@ module OpenAI
45
46
 
46
47
  def limit=: (Integer) -> Integer
47
48
 
49
+ attr_reader line_items: ::Array[String]?
50
+
51
+ def line_items=: (::Array[String]) -> ::Array[String]
52
+
48
53
  attr_reader page: String?
49
54
 
50
55
  def page=: (String) -> String
@@ -60,6 +65,7 @@ module OpenAI
60
65
  ?end_time: Integer,
61
66
  ?group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
62
67
  ?limit: Integer,
68
+ ?line_items: ::Array[String],
63
69
  ?page: String,
64
70
  ?project_ids: ::Array[String],
65
71
  ?request_options: OpenAI::request_opts
@@ -72,6 +78,7 @@ module OpenAI
72
78
  end_time: Integer,
73
79
  group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
74
80
  limit: Integer,
81
+ line_items: ::Array[String],
75
82
  page: String,
76
83
  project_ids: ::Array[String],
77
84
  request_options: OpenAI::RequestOptions
@@ -222,12 +222,13 @@ module OpenAI
222
222
  reason: OpenAI::Models::Beta::BetaResponse::IncompleteDetails::reason
223
223
  }
224
224
 
225
- type reason = :max_output_tokens | :content_filter
225
+ type reason = :max_output_tokens | :max_messages | :content_filter
226
226
 
227
227
  module Reason
228
228
  extend OpenAI::Internal::Type::Enum
229
229
 
230
230
  MAX_OUTPUT_TOKENS: :max_output_tokens
231
+ MAX_MESSAGES: :max_messages
231
232
  CONTENT_FILTER: :content_filter
232
233
 
233
234
  def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponse::IncompleteDetails::reason]
@@ -9,8 +9,7 @@ module OpenAI
9
9
  input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
10
10
  output_tokens: Integer,
11
11
  output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
12
- total_tokens: Integer,
13
- compute_units: Integer?
12
+ total_tokens: Integer
14
13
  }
15
14
 
16
15
  class BetaResponseUsage < OpenAI::Internal::Type::BaseModel
@@ -24,15 +23,12 @@ module OpenAI
24
23
 
25
24
  attr_accessor total_tokens: Integer
26
25
 
27
- attr_accessor compute_units: Integer?
28
-
29
26
  def initialize: (
30
27
  input_tokens: Integer,
31
28
  input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
32
29
  output_tokens: Integer,
33
30
  output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
34
- total_tokens: Integer,
35
- ?compute_units: Integer?
31
+ total_tokens: Integer
36
32
  ) -> void
37
33
 
38
34
  def to_hash: -> {
@@ -40,8 +36,7 @@ module OpenAI
40
36
  input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
41
37
  output_tokens: Integer,
42
38
  output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
43
- total_tokens: Integer,
44
- compute_units: Integer?
39
+ total_tokens: Integer
45
40
  }
46
41
 
47
42
  type input_tokens_details =
@@ -6,7 +6,6 @@ module OpenAI
6
6
  prompt_tokens: Integer,
7
7
  total_tokens: Integer,
8
8
  completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
9
- compute_units: Integer?,
10
9
  prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
11
10
  }
12
11
 
@@ -23,8 +22,6 @@ module OpenAI
23
22
  OpenAI::CompletionUsage::CompletionTokensDetails
24
23
  ) -> OpenAI::CompletionUsage::CompletionTokensDetails
25
24
 
26
- attr_accessor compute_units: Integer?
27
-
28
25
  attr_reader prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails?
29
26
 
30
27
  def prompt_tokens_details=: (
@@ -36,7 +33,6 @@ module OpenAI
36
33
  prompt_tokens: Integer,
37
34
  total_tokens: Integer,
38
35
  ?completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
39
- ?compute_units: Integer?,
40
36
  ?prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
41
37
  ) -> void
42
38
 
@@ -45,7 +41,6 @@ module OpenAI
45
41
  prompt_tokens: Integer,
46
42
  total_tokens: Integer,
47
43
  completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
48
- compute_units: Integer?,
49
44
  prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
50
45
  }
51
46
 
@@ -222,12 +222,13 @@ module OpenAI
222
222
  reason: OpenAI::Models::Responses::Response::IncompleteDetails::reason
223
223
  }
224
224
 
225
- type reason = :max_output_tokens | :content_filter
225
+ type reason = :max_output_tokens | :max_messages | :content_filter
226
226
 
227
227
  module Reason
228
228
  extend OpenAI::Internal::Type::Enum
229
229
 
230
230
  MAX_OUTPUT_TOKENS: :max_output_tokens
231
+ MAX_MESSAGES: :max_messages
231
232
  CONTENT_FILTER: :content_filter
232
233
 
233
234
  def self?.values: -> ::Array[OpenAI::Models::Responses::Response::IncompleteDetails::reason]
@@ -7,8 +7,7 @@ module OpenAI
7
7
  input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
8
8
  output_tokens: Integer,
9
9
  output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
10
- total_tokens: Integer,
11
- compute_units: Integer?
10
+ total_tokens: Integer
12
11
  }
13
12
 
14
13
  class ResponseUsage < OpenAI::Internal::Type::BaseModel
@@ -22,15 +21,12 @@ module OpenAI
22
21
 
23
22
  attr_accessor total_tokens: Integer
24
23
 
25
- attr_accessor compute_units: Integer?
26
-
27
24
  def initialize: (
28
25
  input_tokens: Integer,
29
26
  input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
30
27
  output_tokens: Integer,
31
28
  output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
32
- total_tokens: Integer,
33
- ?compute_units: Integer?
29
+ total_tokens: Integer
34
30
  ) -> void
35
31
 
36
32
  def to_hash: -> {
@@ -38,8 +34,7 @@ module OpenAI
38
34
  input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
39
35
  output_tokens: Integer,
40
36
  output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
41
- total_tokens: Integer,
42
- compute_units: Integer?
37
+ total_tokens: Integer
43
38
  }
44
39
 
45
40
  type input_tokens_details =
@@ -64,6 +64,7 @@ module OpenAI
64
64
  ?end_time: Integer,
65
65
  ?group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
66
66
  ?limit: Integer,
67
+ ?line_items: ::Array[String],
67
68
  ?page: String,
68
69
  ?project_ids: ::Array[String],
69
70
  ?request_options: OpenAI::request_opts
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.83.0
4
+ version: 0.84.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI