openai 0.125.0 → 0.127.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/agents/session_stream.rb +3 -0
  5. data/lib/openai/helpers/beta/agents/result.rb +5 -0
  6. data/lib/openai/models/all_models.rb +1 -0
  7. data/lib/openai/models/beta/agent_session.rb +17 -11
  8. data/lib/openai/models/beta/agent_session_budget_reached_event.rb +48 -0
  9. data/lib/openai/models/beta/agent_session_event.rb +4 -1
  10. data/lib/openai/models/beta/beta_response.rb +9 -0
  11. data/lib/openai/models/beta/beta_responses_client_event.rb +76 -1
  12. data/lib/openai/models/beta/response_compact_params.rb +9 -0
  13. data/lib/openai/models/beta/response_create_params.rb +70 -1
  14. data/lib/openai/models/chat_model.rb +2 -0
  15. data/lib/openai/models/responses/response_compact_params.rb +9 -0
  16. data/lib/openai/models/responses/response_create_params.rb +61 -1
  17. data/lib/openai/models/responses/responses_client_event.rb +65 -1
  18. data/lib/openai/models/responses_model.rb +1 -0
  19. data/lib/openai/resources/beta/agents/sessions/events.rb +1 -1
  20. data/lib/openai/resources/beta/responses.rb +12 -2
  21. data/lib/openai/resources/responses.rb +12 -2
  22. data/lib/openai/version.rb +1 -1
  23. data/lib/openai.rb +1 -0
  24. data/rbi/openai/models/all_models.rbi +1 -0
  25. data/rbi/openai/models/beta/agent_session.rbi +17 -11
  26. data/rbi/openai/models/beta/agent_session_budget_reached_event.rbi +83 -0
  27. data/rbi/openai/models/beta/agent_session_event.rbi +1 -0
  28. data/rbi/openai/models/beta/beta_response.rbi +3 -0
  29. data/rbi/openai/models/beta/beta_responses_client_event.rbi +145 -0
  30. data/rbi/openai/models/beta/response_compact_params.rbi +3 -0
  31. data/rbi/openai/models/beta/response_create_params.rbi +116 -0
  32. data/rbi/openai/models/chat_model.rbi +2 -0
  33. data/rbi/openai/models/responses/response_compact_params.rbi +3 -0
  34. data/rbi/openai/models/responses/response_create_params.rbi +117 -0
  35. data/rbi/openai/models/responses/responses_client_event.rbi +135 -0
  36. data/rbi/openai/models/responses_model.rbi +1 -0
  37. data/rbi/openai/resources/beta/responses.rbi +10 -0
  38. data/rbi/openai/resources/responses.rbi +12 -0
  39. data/sig/openai/models/all_models.rbs +2 -0
  40. data/sig/openai/models/beta/agent_session.rbs +20 -13
  41. data/sig/openai/models/beta/agent_session_budget_reached_event.rbs +52 -0
  42. data/sig/openai/models/beta/agent_session_event.rbs +1 -0
  43. data/sig/openai/models/beta/beta_response.rbs +6 -0
  44. data/sig/openai/models/beta/beta_responses_client_event.rbs +79 -0
  45. data/sig/openai/models/beta/response_compact_params.rbs +6 -0
  46. data/sig/openai/models/beta/response_create_params.rbs +79 -0
  47. data/sig/openai/models/chat_model.rbs +4 -0
  48. data/sig/openai/models/responses/response_compact_params.rbs +6 -0
  49. data/sig/openai/models/responses/response_create_params.rbs +73 -0
  50. data/sig/openai/models/responses/responses_client_event.rbs +73 -0
  51. data/sig/openai/models/responses_model.rbs +2 -0
  52. data/sig/openai/resources/beta/responses.rbs +2 -0
  53. data/sig/openai/resources/responses.rbs +3 -0
  54. metadata +4 -1
@@ -23,6 +23,14 @@ module OpenAI
23
23
  # @return [Boolean, nil]
24
24
  optional :background, OpenAI::Internal::Type::Boolean, nil?: true
25
25
 
26
+ # @!attribute background_options
27
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
28
+ # windows require `background: true`, Standard processing, and `stream: false` or
29
+ # omitted.
30
+ #
31
+ # @return [OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions, nil]
32
+ optional :background_options, -> { OpenAI::Responses::ResponseCreateParams::BackgroundOptions }
33
+
26
34
  # @!attribute context_management
27
35
  # Context management configuration for this request.
28
36
  #
@@ -390,7 +398,7 @@ module OpenAI
390
398
  # @return [String, nil]
391
399
  optional :user, String
392
400
 
393
- # @!method initialize(access_programs: nil, background: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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: {})
401
+ # @!method initialize(access_programs: nil, background: nil, background_options: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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: {})
394
402
  # @param access_programs [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms]
395
403
  # Domain-specific access programs to use for this request.
396
404
  #
@@ -398,6 +406,11 @@ module OpenAI
398
406
  # Whether to run the model response in the background.
399
407
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
400
408
  #
409
+ # @param background_options [OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions]
410
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
411
+ # windows require `background: true`, Standard processing, and `stream: false` or
412
+ # omitted.
413
+ #
401
414
  # @param context_management [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil]
402
415
  # Context management configuration for this request.
403
416
  #
@@ -701,6 +714,53 @@ module OpenAI
701
714
  end
702
715
  end
703
716
 
717
+ class BackgroundOptions < OpenAI::Internal::Type::BaseModel
718
+ # @!attribute completion_window
719
+ # The completion window for background execution. Defaults to `soonest`; `2h` and
720
+ # `8h` select discounted background execution.
721
+ #
722
+ # @return [Symbol, OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions::CompletionWindow, nil]
723
+ optional(
724
+ :completion_window,
725
+ enum: -> { OpenAI::Responses::ResponseCreateParams::BackgroundOptions::CompletionWindow }
726
+ )
727
+
728
+ # @!attribute continuation_id
729
+ # A customer-provided opaque identifier used to prioritize related background
730
+ # requests. It does not add prior history to the input.
731
+ #
732
+ # @return [String, nil]
733
+ optional :continuation_id, String
734
+
735
+ # @!method initialize(completion_window: nil, continuation_id: nil)
736
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
737
+ # windows require `background: true`, Standard processing, and `stream: false` or
738
+ # omitted.
739
+ #
740
+ # @param completion_window [Symbol, OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions::CompletionWindow]
741
+ # The completion window for background execution. Defaults to `soonest`; `2h` and
742
+ # `8h` select discounted background execution.
743
+ #
744
+ # @param continuation_id [String]
745
+ # A customer-provided opaque identifier used to prioritize related background
746
+ # requests. It does not add prior history to the input.
747
+
748
+ # The completion window for background execution. Defaults to `soonest`; `2h` and
749
+ # `8h` select discounted background execution.
750
+ #
751
+ # @see OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions#completion_window
752
+ module CompletionWindow
753
+ extend OpenAI::Internal::Type::Enum
754
+
755
+ SOONEST = :soonest
756
+ COMPLETION_WINDOW_2H = :"2h"
757
+ COMPLETION_WINDOW_8H = :"8h"
758
+
759
+ # @!method self.values
760
+ # @return [Array<Symbol>]
761
+ end
762
+ end
763
+
704
764
  class ContextManagement < OpenAI::Internal::Type::BaseModel
705
765
  # @!attribute type
706
766
  # The context management entry type. Currently only 'compaction' is supported.
@@ -69,6 +69,17 @@ module OpenAI
69
69
  # @return [Boolean, nil]
70
70
  optional :background, OpenAI::Internal::Type::Boolean, nil?: true
71
71
 
72
+ # @!attribute background_options
73
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
74
+ # windows require `background: true`, Standard processing, and `stream: false` or
75
+ # omitted.
76
+ #
77
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions, nil]
78
+ optional(
79
+ :background_options,
80
+ -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions }
81
+ )
82
+
72
83
  # @!attribute context_management
73
84
  # Context management configuration for this request.
74
85
  #
@@ -479,7 +490,7 @@ module OpenAI
479
490
  # @return [String, nil]
480
491
  optional :user, String
481
492
 
482
- # @!method initialize(access_programs: nil, background: nil, context_management: nil, conversation: nil, generate: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
493
+ # @!method initialize(access_programs: nil, background: nil, background_options: nil, context_management: nil, conversation: nil, generate: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
483
494
  # Client event for creating a response over a persistent WebSocket connection.
484
495
  # This payload uses the same top-level fields as `POST /v1/responses`, plus
485
496
  # WebSocket-only envelope metadata.
@@ -497,6 +508,11 @@ module OpenAI
497
508
  # Whether to run the model response in the background.
498
509
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
499
510
  #
511
+ # @param background_options [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions]
512
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
513
+ # windows require `background: true`, Standard processing, and `stream: false` or
514
+ # omitted.
515
+ #
500
516
  # @param context_management [Array<OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement>, nil]
501
517
  # Context management configuration for this request.
502
518
  #
@@ -825,6 +841,54 @@ module OpenAI
825
841
  end
826
842
  end
827
843
 
844
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#background_options
845
+ class BackgroundOptions < OpenAI::Internal::Type::BaseModel
846
+ # @!attribute completion_window
847
+ # The completion window for background execution. Defaults to `soonest`; `2h` and
848
+ # `8h` select discounted background execution.
849
+ #
850
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions::CompletionWindow, nil]
851
+ optional(
852
+ :completion_window,
853
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions::CompletionWindow }
854
+ )
855
+
856
+ # @!attribute continuation_id
857
+ # A customer-provided opaque identifier used to prioritize related background
858
+ # requests. It does not add prior history to the input.
859
+ #
860
+ # @return [String, nil]
861
+ optional :continuation_id, String
862
+
863
+ # @!method initialize(completion_window: nil, continuation_id: nil)
864
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
865
+ # windows require `background: true`, Standard processing, and `stream: false` or
866
+ # omitted.
867
+ #
868
+ # @param completion_window [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions::CompletionWindow]
869
+ # The completion window for background execution. Defaults to `soonest`; `2h` and
870
+ # `8h` select discounted background execution.
871
+ #
872
+ # @param continuation_id [String]
873
+ # A customer-provided opaque identifier used to prioritize related background
874
+ # requests. It does not add prior history to the input.
875
+
876
+ # The completion window for background execution. Defaults to `soonest`; `2h` and
877
+ # `8h` select discounted background execution.
878
+ #
879
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::BackgroundOptions#completion_window
880
+ module CompletionWindow
881
+ extend OpenAI::Internal::Type::Enum
882
+
883
+ SOONEST = :soonest
884
+ COMPLETION_WINDOW_2H = :"2h"
885
+ COMPLETION_WINDOW_8H = :"8h"
886
+
887
+ # @!method self.values
888
+ # @return [Array<Symbol>]
889
+ end
890
+ end
891
+
828
892
  class ContextManagement < OpenAI::Internal::Type::BaseModel
829
893
  # @!attribute type
830
894
  # The context management entry type. Currently only 'compaction' is supported.
@@ -78,6 +78,7 @@ module OpenAI
78
78
  GPT_6_CYBER = :"gpt-6-cyber"
79
79
  GPT_ROSALIND_RESEARCH = :"gpt-rosalind-research"
80
80
  GPT_6_ROSALIND = :"gpt-6-rosalind"
81
+ GPT_6_2_ASTRA_LAW = :"gpt-6.2-astra-law"
81
82
 
82
83
  # @!method self.values
83
84
  # @return [Array<Symbol>]
@@ -61,7 +61,7 @@ module OpenAI
61
61
  #
62
62
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
63
63
  #
64
- # @return [OpenAI::Internal::Stream<OpenAI::Models::Beta::AgentSessionErrorEvent, OpenAI::Models::Beta::AgentSessionEnvironmentReadyEvent, OpenAI::Models::Beta::AgentSessionEnvironmentSuspendedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentExpiredEvent, OpenAI::Models::Beta::AgentSessionEnvironmentResetEvent, OpenAI::Models::Beta::AgentOutputCommandExecutionOutputDeltaEvent, OpenAI::Models::Beta::AgentSessionCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnInProgressEvent, OpenAI::Models::Beta::AgentSessionTurnCompletedEvent, OpenAI::Models::Beta::AgentSessionTurnFailedEvent, OpenAI::Models::Beta::AgentSessionTurnCancelledEvent, OpenAI::Models::Beta::AgentSessionTurnItemAddedEvent, OpenAI::Models::Beta::AgentSessionIdleEvent, OpenAI::Models::Beta::AgentSessionInProgressEvent, OpenAI::Models::Beta::AgentSessionRequiresActionEvent, OpenAI::Models::Beta::AgentSessionFailedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentPendingEvent, OpenAI::Models::Beta::AgentSessionEnvironmentConnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentDisconnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentFailedEvent, OpenAI::Models::Beta::AgentSessionSubagentCreatedEvent, OpenAI::Models::Beta::AgentSessionSubagentActiveEvent, OpenAI::Models::Beta::AgentSessionSubagentClosedEvent, OpenAI::Models::Beta::AgentSessionTurnItemDoneEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent>]
64
+ # @return [OpenAI::Internal::Stream<OpenAI::Models::Beta::AgentSessionErrorEvent, OpenAI::Models::Beta::AgentSessionEnvironmentReadyEvent, OpenAI::Models::Beta::AgentSessionEnvironmentSuspendedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentExpiredEvent, OpenAI::Models::Beta::AgentSessionEnvironmentResetEvent, OpenAI::Models::Beta::AgentOutputCommandExecutionOutputDeltaEvent, OpenAI::Models::Beta::AgentSessionCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnInProgressEvent, OpenAI::Models::Beta::AgentSessionTurnCompletedEvent, OpenAI::Models::Beta::AgentSessionTurnFailedEvent, OpenAI::Models::Beta::AgentSessionTurnCancelledEvent, OpenAI::Models::Beta::AgentSessionTurnItemAddedEvent, OpenAI::Models::Beta::AgentSessionIdleEvent, OpenAI::Models::Beta::AgentSessionBudgetReachedEvent, OpenAI::Models::Beta::AgentSessionInProgressEvent, OpenAI::Models::Beta::AgentSessionRequiresActionEvent, OpenAI::Models::Beta::AgentSessionFailedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentPendingEvent, OpenAI::Models::Beta::AgentSessionEnvironmentConnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentDisconnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentFailedEvent, OpenAI::Models::Beta::AgentSessionSubagentCreatedEvent, OpenAI::Models::Beta::AgentSessionSubagentActiveEvent, OpenAI::Models::Beta::AgentSessionSubagentClosedEvent, OpenAI::Models::Beta::AgentSessionTurnItemDoneEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent>]
65
65
  #
66
66
  # @see OpenAI::Models::Beta::Agents::Sessions::EventStreamParams
67
67
  def stream_streaming(session_id, params = {})
@@ -46,7 +46,7 @@ module OpenAI
46
46
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
47
47
  # to use your own data as input for the model's response.
48
48
  #
49
- # @overload create(access_programs: nil, background: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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, betas: nil, request_options: {})
49
+ # @overload create(access_programs: nil, background: nil, background_options: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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, betas: nil, request_options: {})
50
50
  #
51
51
  # @param access_programs [OpenAI::Models::Beta::ResponseCreateParams::AccessPrograms]
52
52
  # Body param: Domain-specific access programs to use for this request.
@@ -55,6 +55,11 @@ module OpenAI
55
55
  # Body param: Whether to run the model response in the background.
56
56
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
57
57
  #
58
+ # @param background_options [OpenAI::Models::Beta::ResponseCreateParams::BackgroundOptions]
59
+ # Body param: Options for background execution on HTTP requests. The `2h` and `8h`
60
+ # completion windows require `background: true`, Standard processing, and
61
+ # `stream: false` or omitted.
62
+ #
58
63
  # @param context_management [Array<OpenAI::Models::Beta::ResponseCreateParams::ContextManagement>, nil]
59
64
  # Body param: Context management configuration for this request.
60
65
  #
@@ -352,7 +357,7 @@ module OpenAI
352
357
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
353
358
  # to use your own data as input for the model's response.
354
359
  #
355
- # @overload stream_raw(access_programs: nil, background: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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, betas: nil, request_options: {})
360
+ # @overload stream_raw(access_programs: nil, background: nil, background_options: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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, betas: nil, request_options: {})
356
361
  #
357
362
  # @param access_programs [OpenAI::Models::Beta::ResponseCreateParams::AccessPrograms]
358
363
  # Body param: Domain-specific access programs to use for this request.
@@ -361,6 +366,11 @@ module OpenAI
361
366
  # Body param: Whether to run the model response in the background.
362
367
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
363
368
  #
369
+ # @param background_options [OpenAI::Models::Beta::ResponseCreateParams::BackgroundOptions]
370
+ # Body param: Options for background execution on HTTP requests. The `2h` and `8h`
371
+ # completion windows require `background: true`, Standard processing, and
372
+ # `stream: false` or omitted.
373
+ #
364
374
  # @param context_management [Array<OpenAI::Models::Beta::ResponseCreateParams::ContextManagement>, nil]
365
375
  # Body param: Context management configuration for this request.
366
376
  #
@@ -47,7 +47,7 @@ module OpenAI
47
47
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
48
48
  # to use your own data as input for the model's response.
49
49
  #
50
- # @overload create(access_programs: nil, background: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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: {})
50
+ # @overload create(access_programs: nil, background: nil, background_options: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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: {})
51
51
  #
52
52
  # @param access_programs [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms]
53
53
  # Domain-specific access programs to use for this request.
@@ -56,6 +56,11 @@ module OpenAI
56
56
  # Whether to run the model response in the background.
57
57
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
58
58
  #
59
+ # @param background_options [OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions]
60
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
61
+ # windows require `background: true`, Standard processing, and `stream: false` or
62
+ # omitted.
63
+ #
59
64
  # @param context_management [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil]
60
65
  # Context management configuration for this request.
61
66
  #
@@ -345,7 +350,7 @@ module OpenAI
345
350
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
346
351
  # to use your own data as input for the model's response.
347
352
  #
348
- # @overload stream_raw(access_programs: nil, background: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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: {})
353
+ # @overload stream_raw(access_programs: nil, background: nil, background_options: nil, context_management: nil, conversation: nil, image: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: 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: {})
349
354
  #
350
355
  # @param access_programs [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms]
351
356
  # Domain-specific access programs to use for this request.
@@ -354,6 +359,11 @@ module OpenAI
354
359
  # Whether to run the model response in the background.
355
360
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
356
361
  #
362
+ # @param background_options [OpenAI::Models::Responses::ResponseCreateParams::BackgroundOptions]
363
+ # Options for background execution on HTTP requests. The `2h` and `8h` completion
364
+ # windows require `background: true`, Standard processing, and `stream: false` or
365
+ # omitted.
366
+ #
357
367
  # @param context_management [Array<OpenAI::Models::Responses::ResponseCreateParams::ContextManagement>, nil]
358
368
  # Context management configuration for this request.
359
369
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.125.0"
4
+ VERSION = "0.127.0"
5
5
  end
data/lib/openai.rb CHANGED
@@ -624,6 +624,7 @@ require_relative "openai/models/beta/agents/vault_update_params"
624
624
  require_relative "openai/models/beta/agent_send_subagent_input_call_item"
625
625
  require_relative "openai/models/beta/agent_session"
626
626
  require_relative "openai/models/beta/agent_session_assistant_message"
627
+ require_relative "openai/models/beta/agent_session_budget_reached_event"
627
628
  require_relative "openai/models/beta/agent_session_created_event"
628
629
  require_relative "openai/models/beta/agent_session_deleted"
629
630
  require_relative "openai/models/beta/agent_session_environment_connected_event"
@@ -54,6 +54,7 @@ module OpenAI
54
54
  GPT_6_CYBER = T.let(:"gpt-6-cyber", OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol)
55
55
  GPT_ROSALIND_RESEARCH = T.let(:"gpt-rosalind-research", OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol)
56
56
  GPT_6_ROSALIND = T.let(:"gpt-6-rosalind", OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol)
57
+ GPT_6_2_ASTRA_LAW = T.let(:"gpt-6.2-astra-law", OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol)
57
58
 
58
59
  sig { override.returns(T::Array[OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol]) }
59
60
  def self.values
@@ -84,8 +84,9 @@ module OpenAI
84
84
  sig { params(review: OpenAI::Beta::AgentSession::Review::OrSymbol).void }
85
85
  attr_writer :review
86
86
 
87
- # Configured spending limit and best-effort consumption, in USD cents. Unlimited
88
- # sessions omit this object.
87
+ # Spending limit and best-effort consumption, in USD cents. Present when
88
+ # spending-control visibility is enabled; limit is null without a cap. Older
89
+ # server responses may omit this object.
89
90
  sig { returns(T.nilable(OpenAI::Beta::AgentSession::SpendControl)) }
90
91
  attr_reader :spend_control
91
92
 
@@ -182,8 +183,9 @@ module OpenAI
182
183
  # and automatic review is not enabled. Omission means none.
183
184
  review: nil,
184
185
 
185
- # Configured spending limit and best-effort consumption, in USD cents. Unlimited
186
- # sessions omit this object.
186
+ # Spending limit and best-effort consumption, in USD cents. Present when
187
+ # spending-control visibility is enabled; limit is null without a cap. Older
188
+ # server responses may omit this object.
187
189
  spend_control: nil,
188
190
 
189
191
  # The object type. Always `agent.session`.
@@ -1148,6 +1150,9 @@ module OpenAI
1148
1150
  # The session failed.
1149
1151
  FAILED = T.let(:failed, OpenAI::Beta::AgentSession::Status::TaggedSymbol)
1150
1152
 
1153
+ # The session is paused because its spending limit was reached.
1154
+ BUDGET_REACHED = T.let(:budget_reached, OpenAI::Beta::AgentSession::Status::TaggedSymbol)
1155
+
1151
1156
  sig { override.returns(T::Array[OpenAI::Beta::AgentSession::Status::TaggedSymbol]) }
1152
1157
  def self.values
1153
1158
  end
@@ -1229,18 +1234,19 @@ module OpenAI
1229
1234
  sig { returns(T.nilable(Integer)) }
1230
1235
  attr_accessor :consumed
1231
1236
 
1232
- # The configured positive limit in USD cents.
1233
- sig { returns(Integer) }
1237
+ # The configured positive limit in USD cents, or null when unlimited.
1238
+ sig { returns(T.nilable(Integer)) }
1234
1239
  attr_accessor :limit
1235
1240
 
1236
- # Configured spending limit and best-effort consumption, in USD cents. Unlimited
1237
- # sessions omit this object.
1241
+ # Spending limit and best-effort consumption, in USD cents. Present when
1242
+ # spending-control visibility is enabled; limit is null without a cap. Older
1243
+ # server responses may omit this object.
1238
1244
  sig do
1239
1245
  params(
1240
1246
 
1241
1247
  consumed: T.nilable(Integer),
1242
1248
 
1243
- limit: Integer
1249
+ limit: T.nilable(Integer)
1244
1250
  )
1245
1251
  .returns(T.attached_class)
1246
1252
  end
@@ -1249,7 +1255,7 @@ module OpenAI
1249
1255
  # Best-effort recorded spend floored to whole USD cents, or null when unavailable.
1250
1256
  consumed:,
1251
1257
 
1252
- # The configured positive limit in USD cents.
1258
+ # The configured positive limit in USD cents, or null when unlimited.
1253
1259
 
1254
1260
  limit:
1255
1261
  )
@@ -1257,7 +1263,7 @@ module OpenAI
1257
1263
 
1258
1264
  sig do
1259
1265
  override.returns(
1260
- {consumed: T.nilable(Integer), limit: Integer}
1266
+ {consumed: T.nilable(Integer), limit: T.nilable(Integer)}
1261
1267
  )
1262
1268
  end
1263
1269
  def to_hash
@@ -0,0 +1,83 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Beta
7
+
8
+ class AgentSessionBudgetReachedEvent < OpenAI::Internal::Type::BaseModel
9
+
10
+ OrHash = T.type_alias do
11
+ T.any(
12
+ OpenAI::Beta::AgentSessionBudgetReachedEvent,
13
+ OpenAI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The unique ID of the event.
18
+ sig { returns(String) }
19
+ attr_accessor :event_id
20
+
21
+ # The paused session.
22
+ sig { returns(OpenAI::Beta::AgentSession) }
23
+ attr_reader :session
24
+
25
+ sig { params(session: OpenAI::Beta::AgentSession::OrHash).void }
26
+ attr_writer :session
27
+
28
+ # The type of the object. Always `agent.session.budget_reached`.
29
+ sig { returns(Symbol) }
30
+ attr_accessor :type
31
+
32
+ # Random alphanumeric padding. Present when stream obfuscation is enabled.
33
+ sig { returns(T.nilable(String)) }
34
+ attr_reader :obfuscation
35
+
36
+ sig { params(obfuscation: String).void }
37
+ attr_writer :obfuscation
38
+
39
+ # Emitted when a session pauses because its spending limit was reached.
40
+ sig do
41
+ params(
42
+
43
+ event_id: String,
44
+
45
+ session: OpenAI::Beta::AgentSession::OrHash,
46
+
47
+ obfuscation: String,
48
+
49
+ type: Symbol
50
+ )
51
+ .returns(T.attached_class)
52
+ end
53
+ def self.new(
54
+
55
+ # The unique ID of the event.
56
+ event_id:,
57
+
58
+ # The paused session.
59
+ session:,
60
+
61
+ # Random alphanumeric padding. Present when stream obfuscation is enabled.
62
+ obfuscation: nil,
63
+
64
+ # The type of the object. Always `agent.session.budget_reached`.
65
+
66
+ type: :"agent.session.budget_reached"
67
+ )
68
+ end
69
+
70
+ sig do
71
+ override.returns(
72
+ {event_id: String, session: OpenAI::Beta::AgentSession, type: Symbol, obfuscation: String}
73
+ )
74
+ end
75
+ def to_hash
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+ end
@@ -25,6 +25,7 @@ module OpenAI
25
25
  OpenAI::Beta::AgentSessionTurnCancelledEvent,
26
26
  OpenAI::Beta::AgentSessionTurnItemAddedEvent,
27
27
  OpenAI::Beta::AgentSessionIdleEvent,
28
+ OpenAI::Beta::AgentSessionBudgetReachedEvent,
28
29
  OpenAI::Beta::AgentSessionInProgressEvent,
29
30
  OpenAI::Beta::AgentSessionRequiresActionEvent,
30
31
  OpenAI::Beta::AgentSessionFailedEvent,
@@ -989,7 +989,9 @@ module OpenAI
989
989
  OrSymbol = T.type_alias { T.any(Symbol, String) }
990
990
 
991
991
  GPT_6_ASTRA = T.let(:"gpt-6-astra", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
992
+ GPT_6_2_ASTRA = T.let(:"gpt-6.2-astra", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
992
993
  GPT_6_1_SOL = T.let(:"gpt-6.1-sol", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
994
+ GPT_6_2_SOL = T.let(:"gpt-6.2-sol", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
993
995
  GPT_6_1_TERRA = T.let(:"gpt-6.1-terra", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
994
996
  GPT_6_SOL = T.let(:"gpt-6-sol", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
995
997
  GPT_6_LUNA = T.let(:"gpt-6-luna", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
@@ -1135,6 +1137,7 @@ module OpenAI
1135
1137
  GPT_5_6_CYBER = T.let(:"gpt-5.6-cyber", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
1136
1138
  GPT_6_CYBER = T.let(:"gpt-6-cyber", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
1137
1139
  GPT_ROSALIND_RESEARCH = T.let(:"gpt-rosalind-research", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
1140
+ GPT_6_2_ASTRA_LAW = T.let(:"gpt-6.2-astra-law", OpenAI::Beta::BetaResponse::Model::TaggedSymbol)
1138
1141
 
1139
1142
  end
1140
1143