openai 0.35.1 → 0.36.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 (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +21 -15
  4. data/lib/openai/helpers/structured_output/union_of.rb +5 -1
  5. data/lib/openai/internal/transport/pooled_net_requester.rb +6 -2
  6. data/lib/openai/internal/type/enum.rb +6 -6
  7. data/lib/openai/models/batch_create_params.rb +9 -6
  8. data/lib/openai/models/beta/assistant_create_params.rb +9 -5
  9. data/lib/openai/models/beta/assistant_update_params.rb +9 -5
  10. data/lib/openai/models/beta/threads/run_create_params.rb +10 -6
  11. data/lib/openai/models/chat/completion_create_params.rb +37 -6
  12. data/lib/openai/models/chat_model.rb +5 -0
  13. data/lib/openai/models/conversations/conversation_create_params.rb +2 -2
  14. data/lib/openai/models/conversations/conversation_item.rb +13 -1
  15. data/lib/openai/models/conversations/conversation_item_list.rb +2 -2
  16. data/lib/openai/models/conversations/item_create_params.rb +2 -2
  17. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +9 -5
  18. data/lib/openai/models/evals/run_cancel_response.rb +20 -12
  19. data/lib/openai/models/evals/run_create_params.rb +20 -12
  20. data/lib/openai/models/evals/run_create_response.rb +20 -12
  21. data/lib/openai/models/evals/run_list_response.rb +20 -12
  22. data/lib/openai/models/evals/run_retrieve_response.rb +20 -12
  23. data/lib/openai/models/graders/score_model_grader.rb +9 -5
  24. data/lib/openai/models/reasoning.rb +10 -6
  25. data/lib/openai/models/reasoning_effort.rb +10 -5
  26. data/lib/openai/models/responses/apply_patch_tool.rb +20 -0
  27. data/lib/openai/models/responses/function_shell_tool.rb +20 -0
  28. data/lib/openai/models/responses/input_token_count_params.rb +14 -8
  29. data/lib/openai/models/responses/response.rb +46 -11
  30. data/lib/openai/models/responses/response_apply_patch_tool_call.rb +179 -0
  31. data/lib/openai/models/responses/response_apply_patch_tool_call_output.rb +77 -0
  32. data/lib/openai/models/responses/response_create_params.rb +42 -9
  33. data/lib/openai/models/responses/response_function_shell_call_output_content.rb +88 -0
  34. data/lib/openai/models/responses/response_function_shell_tool_call.rb +109 -0
  35. data/lib/openai/models/responses/response_function_shell_tool_call_output.rb +158 -0
  36. data/lib/openai/models/responses/response_input_item.rb +395 -1
  37. data/lib/openai/models/responses/response_item.rb +13 -1
  38. data/lib/openai/models/responses/response_item_list.rb +2 -2
  39. data/lib/openai/models/responses/response_output_item.rb +13 -1
  40. data/lib/openai/models/responses/response_output_item_added_event.rb +2 -2
  41. data/lib/openai/models/responses/response_output_item_done_event.rb +2 -2
  42. data/lib/openai/models/responses/tool.rb +7 -1
  43. data/lib/openai/models/responses/tool_choice_apply_patch.rb +20 -0
  44. data/lib/openai/models/responses/tool_choice_shell.rb +20 -0
  45. data/lib/openai/resources/chat/completions.rb +6 -2
  46. data/lib/openai/resources/conversations/items.rb +3 -3
  47. data/lib/openai/resources/conversations.rb +1 -1
  48. data/lib/openai/resources/responses/input_items.rb +1 -1
  49. data/lib/openai/resources/responses/input_tokens.rb +3 -3
  50. data/lib/openai/resources/responses.rb +12 -8
  51. data/lib/openai/version.rb +1 -1
  52. data/lib/openai.rb +10 -0
  53. data/manifest.yaml +1 -0
  54. data/rbi/openai/internal/transport/pooled_net_requester.rbi +6 -2
  55. data/rbi/openai/models/batch_create_params.rbi +17 -9
  56. data/rbi/openai/models/beta/assistant_create_params.rbi +18 -10
  57. data/rbi/openai/models/beta/assistant_update_params.rbi +18 -10
  58. data/rbi/openai/models/beta/threads/run_create_params.rbi +18 -10
  59. data/rbi/openai/models/chat/completion_create_params.rbi +82 -10
  60. data/rbi/openai/models/chat_model.rbi +7 -0
  61. data/rbi/openai/models/conversations/conversation_create_params.rbi +12 -0
  62. data/rbi/openai/models/conversations/conversation_item.rbi +4 -0
  63. data/rbi/openai/models/conversations/conversation_item_list.rbi +4 -0
  64. data/rbi/openai/models/conversations/item_create_params.rbi +12 -0
  65. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +18 -10
  66. data/rbi/openai/models/evals/run_cancel_response.rbi +40 -20
  67. data/rbi/openai/models/evals/run_create_params.rbi +44 -20
  68. data/rbi/openai/models/evals/run_create_response.rbi +40 -20
  69. data/rbi/openai/models/evals/run_list_response.rbi +40 -20
  70. data/rbi/openai/models/evals/run_retrieve_response.rbi +40 -20
  71. data/rbi/openai/models/graders/score_model_grader.rbi +18 -10
  72. data/rbi/openai/models/reasoning.rbi +18 -10
  73. data/rbi/openai/models/reasoning_effort.rbi +10 -5
  74. data/rbi/openai/models/responses/apply_patch_tool.rbi +30 -0
  75. data/rbi/openai/models/responses/function_shell_tool.rbi +33 -0
  76. data/rbi/openai/models/responses/input_token_count_params.rbi +18 -4
  77. data/rbi/openai/models/responses/response.rbi +73 -2
  78. data/rbi/openai/models/responses/response_apply_patch_tool_call.rbi +300 -0
  79. data/rbi/openai/models/responses/response_apply_patch_tool_call_output.rbi +129 -0
  80. data/rbi/openai/models/responses/response_create_params.rbi +87 -5
  81. data/rbi/openai/models/responses/response_function_shell_call_output_content.rbi +157 -0
  82. data/rbi/openai/models/responses/response_function_shell_tool_call.rbi +198 -0
  83. data/rbi/openai/models/responses/response_function_shell_tool_call_output.rbi +254 -0
  84. data/rbi/openai/models/responses/response_input_item.rbi +675 -0
  85. data/rbi/openai/models/responses/response_item.rbi +4 -0
  86. data/rbi/openai/models/responses/response_item_list.rbi +4 -0
  87. data/rbi/openai/models/responses/response_output_item.rbi +4 -0
  88. data/rbi/openai/models/responses/response_output_item_added_event.rbi +4 -0
  89. data/rbi/openai/models/responses/response_output_item_done_event.rbi +4 -0
  90. data/rbi/openai/models/responses/tool.rbi +2 -0
  91. data/rbi/openai/models/responses/tool_choice_apply_patch.rbi +33 -0
  92. data/rbi/openai/models/responses/tool_choice_shell.rbi +30 -0
  93. data/rbi/openai/resources/batches.rbi +4 -3
  94. data/rbi/openai/resources/beta/assistants.rbi +18 -10
  95. data/rbi/openai/resources/beta/threads/runs.rbi +18 -10
  96. data/rbi/openai/resources/chat/completions.rbi +38 -12
  97. data/rbi/openai/resources/conversations/items.rbi +4 -0
  98. data/rbi/openai/resources/conversations.rbi +4 -0
  99. data/rbi/openai/resources/responses/input_tokens.rbi +5 -1
  100. data/rbi/openai/resources/responses.rbi +28 -2
  101. data/sig/openai/internal/transport/pooled_net_requester.rbs +4 -1
  102. data/sig/openai/models/batch_create_params.rbs +2 -0
  103. data/sig/openai/models/chat/completion_create_params.rbs +16 -0
  104. data/sig/openai/models/chat_model.rbs +11 -1
  105. data/sig/openai/models/conversations/conversation_item.rbs +4 -0
  106. data/sig/openai/models/reasoning_effort.rbs +2 -1
  107. data/sig/openai/models/responses/apply_patch_tool.rbs +15 -0
  108. data/sig/openai/models/responses/function_shell_tool.rbs +15 -0
  109. data/sig/openai/models/responses/input_token_count_params.rbs +2 -0
  110. data/sig/openai/models/responses/response.rbs +18 -0
  111. data/sig/openai/models/responses/response_apply_patch_tool_call.rbs +123 -0
  112. data/sig/openai/models/responses/response_apply_patch_tool_call_output.rbs +60 -0
  113. data/sig/openai/models/responses/response_create_params.rbs +18 -0
  114. data/sig/openai/models/responses/response_function_shell_call_output_content.rbs +64 -0
  115. data/sig/openai/models/responses/response_function_shell_tool_call.rbs +88 -0
  116. data/sig/openai/models/responses/response_function_shell_tool_call_output.rbs +115 -0
  117. data/sig/openai/models/responses/response_input_item.rbs +276 -0
  118. data/sig/openai/models/responses/response_item.rbs +4 -0
  119. data/sig/openai/models/responses/response_output_item.rbs +4 -0
  120. data/sig/openai/models/responses/tool.rbs +2 -0
  121. data/sig/openai/models/responses/tool_choice_apply_patch.rbs +15 -0
  122. data/sig/openai/models/responses/tool_choice_shell.rbs +15 -0
  123. data/sig/openai/resources/chat/completions.rbs +2 -0
  124. data/sig/openai/resources/responses.rbs +2 -0
  125. metadata +29 -2
@@ -173,6 +173,19 @@ module OpenAI
173
173
  sig { params(prompt_cache_key: String).void }
174
174
  attr_writer :prompt_cache_key
175
175
 
176
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
177
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
178
+ # of 24 hours.
179
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
180
+ sig do
181
+ returns(
182
+ T.nilable(
183
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::OrSymbol
184
+ )
185
+ )
186
+ end
187
+ attr_accessor :prompt_cache_retention
188
+
176
189
  # **gpt-5 and o-series models only**
177
190
  #
178
191
  # Configuration options for
@@ -279,7 +292,9 @@ module OpenAI
279
292
  OpenAI::Responses::ToolChoiceTypes,
280
293
  OpenAI::Responses::ToolChoiceFunction,
281
294
  OpenAI::Responses::ToolChoiceMcp,
282
- OpenAI::Responses::ToolChoiceCustom
295
+ OpenAI::Responses::ToolChoiceCustom,
296
+ OpenAI::Responses::ToolChoiceApplyPatch,
297
+ OpenAI::Responses::ToolChoiceShell
283
298
  )
284
299
  )
285
300
  )
@@ -295,7 +310,9 @@ module OpenAI
295
310
  OpenAI::Responses::ToolChoiceTypes::OrHash,
296
311
  OpenAI::Responses::ToolChoiceFunction::OrHash,
297
312
  OpenAI::Responses::ToolChoiceMcp::OrHash,
298
- OpenAI::Responses::ToolChoiceCustom::OrHash
313
+ OpenAI::Responses::ToolChoiceCustom::OrHash,
314
+ OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
315
+ OpenAI::Responses::ToolChoiceShell::OrHash
299
316
  )
300
317
  ).void
301
318
  end
@@ -332,7 +349,9 @@ module OpenAI
332
349
  OpenAI::Responses::Tool::CodeInterpreter,
333
350
  OpenAI::Responses::Tool::ImageGeneration,
334
351
  OpenAI::Responses::Tool::LocalShell,
352
+ OpenAI::Responses::FunctionShellTool,
335
353
  OpenAI::Responses::CustomTool,
354
+ OpenAI::Responses::ApplyPatchTool,
336
355
  OpenAI::Responses::WebSearchTool,
337
356
  OpenAI::Responses::WebSearchPreviewTool
338
357
  )
@@ -354,7 +373,9 @@ module OpenAI
354
373
  OpenAI::Responses::Tool::CodeInterpreter::OrHash,
355
374
  OpenAI::Responses::Tool::ImageGeneration::OrHash,
356
375
  OpenAI::Responses::Tool::LocalShell::OrHash,
376
+ OpenAI::Responses::FunctionShellTool::OrHash,
357
377
  OpenAI::Responses::CustomTool::OrHash,
378
+ OpenAI::Responses::ApplyPatchTool::OrHash,
358
379
  OpenAI::Responses::WebSearchTool::OrHash,
359
380
  OpenAI::Responses::WebSearchPreviewTool::OrHash
360
381
  )
@@ -432,6 +453,10 @@ module OpenAI
432
453
  previous_response_id: T.nilable(String),
433
454
  prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
434
455
  prompt_cache_key: String,
456
+ prompt_cache_retention:
457
+ T.nilable(
458
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::OrSymbol
459
+ ),
435
460
  reasoning: T.nilable(OpenAI::Reasoning::OrHash),
436
461
  safety_identifier: String,
437
462
  service_tier:
@@ -452,7 +477,9 @@ module OpenAI
452
477
  OpenAI::Responses::ToolChoiceTypes::OrHash,
453
478
  OpenAI::Responses::ToolChoiceFunction::OrHash,
454
479
  OpenAI::Responses::ToolChoiceMcp::OrHash,
455
- OpenAI::Responses::ToolChoiceCustom::OrHash
480
+ OpenAI::Responses::ToolChoiceCustom::OrHash,
481
+ OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
482
+ OpenAI::Responses::ToolChoiceShell::OrHash
456
483
  ),
457
484
  tools:
458
485
  T::Array[
@@ -464,7 +491,9 @@ module OpenAI
464
491
  OpenAI::Responses::Tool::CodeInterpreter::OrHash,
465
492
  OpenAI::Responses::Tool::ImageGeneration::OrHash,
466
493
  OpenAI::Responses::Tool::LocalShell::OrHash,
494
+ OpenAI::Responses::FunctionShellTool::OrHash,
467
495
  OpenAI::Responses::CustomTool::OrHash,
496
+ OpenAI::Responses::ApplyPatchTool::OrHash,
468
497
  OpenAI::Responses::WebSearchTool::OrHash,
469
498
  OpenAI::Responses::WebSearchPreviewTool::OrHash
470
499
  )
@@ -559,6 +588,11 @@ module OpenAI
559
588
  # hit rates. Replaces the `user` field.
560
589
  # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
561
590
  prompt_cache_key: nil,
591
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
592
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
593
+ # of 24 hours.
594
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
595
+ prompt_cache_retention: nil,
562
596
  # **gpt-5 and o-series models only**
563
597
  #
564
598
  # Configuration options for
@@ -680,6 +714,10 @@ module OpenAI
680
714
  previous_response_id: T.nilable(String),
681
715
  prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
682
716
  prompt_cache_key: String,
717
+ prompt_cache_retention:
718
+ T.nilable(
719
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::OrSymbol
720
+ ),
683
721
  reasoning: T.nilable(OpenAI::Reasoning),
684
722
  safety_identifier: String,
685
723
  service_tier:
@@ -700,7 +738,9 @@ module OpenAI
700
738
  OpenAI::Responses::ToolChoiceTypes,
701
739
  OpenAI::Responses::ToolChoiceFunction,
702
740
  OpenAI::Responses::ToolChoiceMcp,
703
- OpenAI::Responses::ToolChoiceCustom
741
+ OpenAI::Responses::ToolChoiceCustom,
742
+ OpenAI::Responses::ToolChoiceApplyPatch,
743
+ OpenAI::Responses::ToolChoiceShell
704
744
  ),
705
745
  tools:
706
746
  T::Array[
@@ -712,7 +752,9 @@ module OpenAI
712
752
  OpenAI::Responses::Tool::CodeInterpreter,
713
753
  OpenAI::Responses::Tool::ImageGeneration,
714
754
  OpenAI::Responses::Tool::LocalShell,
755
+ OpenAI::Responses::FunctionShellTool,
715
756
  OpenAI::Responses::CustomTool,
757
+ OpenAI::Responses::ApplyPatchTool,
716
758
  OpenAI::Responses::WebSearchTool,
717
759
  OpenAI::Responses::WebSearchPreviewTool
718
760
  )
@@ -783,6 +825,44 @@ module OpenAI
783
825
  end
784
826
  end
785
827
 
828
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
829
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
830
+ # of 24 hours.
831
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
832
+ module PromptCacheRetention
833
+ extend OpenAI::Internal::Type::Enum
834
+
835
+ TaggedSymbol =
836
+ T.type_alias do
837
+ T.all(
838
+ Symbol,
839
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention
840
+ )
841
+ end
842
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
843
+
844
+ IN_MEMORY =
845
+ T.let(
846
+ :"in-memory",
847
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::TaggedSymbol
848
+ )
849
+ PROMPT_CACHE_RETENTION_24H =
850
+ T.let(
851
+ :"24h",
852
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::TaggedSymbol
853
+ )
854
+
855
+ sig do
856
+ override.returns(
857
+ T::Array[
858
+ OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::TaggedSymbol
859
+ ]
860
+ )
861
+ end
862
+ def self.values
863
+ end
864
+ end
865
+
786
866
  # Specifies the processing type used for serving the request.
787
867
  #
788
868
  # - If set to 'auto', then the request will be processed with the service tier
@@ -903,7 +983,9 @@ module OpenAI
903
983
  OpenAI::Responses::ToolChoiceTypes,
904
984
  OpenAI::Responses::ToolChoiceFunction,
905
985
  OpenAI::Responses::ToolChoiceMcp,
906
- OpenAI::Responses::ToolChoiceCustom
986
+ OpenAI::Responses::ToolChoiceCustom,
987
+ OpenAI::Responses::ToolChoiceApplyPatch,
988
+ OpenAI::Responses::ToolChoiceShell
907
989
  )
908
990
  end
909
991
 
@@ -0,0 +1,157 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ class ResponseFunctionShellCallOutputContent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The exit or timeout outcome associated with this chunk.
16
+ sig do
17
+ returns(
18
+ T.any(
19
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Timeout,
20
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Exit
21
+ )
22
+ )
23
+ end
24
+ attr_accessor :outcome
25
+
26
+ # Captured stderr output for this chunk of the shell call.
27
+ sig { returns(String) }
28
+ attr_accessor :stderr
29
+
30
+ # Captured stdout output for this chunk of the shell call.
31
+ sig { returns(String) }
32
+ attr_accessor :stdout
33
+
34
+ # Captured stdout and stderr for a portion of a function shell tool call output.
35
+ sig do
36
+ params(
37
+ outcome:
38
+ T.any(
39
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Timeout::OrHash,
40
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Exit::OrHash
41
+ ),
42
+ stderr: String,
43
+ stdout: String
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ # The exit or timeout outcome associated with this chunk.
48
+ outcome:,
49
+ # Captured stderr output for this chunk of the shell call.
50
+ stderr:,
51
+ # Captured stdout output for this chunk of the shell call.
52
+ stdout:
53
+ )
54
+ end
55
+
56
+ sig do
57
+ override.returns(
58
+ {
59
+ outcome:
60
+ T.any(
61
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Timeout,
62
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Exit
63
+ ),
64
+ stderr: String,
65
+ stdout: String
66
+ }
67
+ )
68
+ end
69
+ def to_hash
70
+ end
71
+
72
+ # The exit or timeout outcome associated with this chunk.
73
+ module Outcome
74
+ extend OpenAI::Internal::Type::Union
75
+
76
+ Variants =
77
+ T.type_alias do
78
+ T.any(
79
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Timeout,
80
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Exit
81
+ )
82
+ end
83
+
84
+ class Timeout < OpenAI::Internal::Type::BaseModel
85
+ OrHash =
86
+ T.type_alias do
87
+ T.any(
88
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Timeout,
89
+ OpenAI::Internal::AnyHash
90
+ )
91
+ end
92
+
93
+ # The outcome type. Always `timeout`.
94
+ sig { returns(Symbol) }
95
+ attr_accessor :type
96
+
97
+ # Indicates that the function shell call exceeded its configured time limit.
98
+ sig { params(type: Symbol).returns(T.attached_class) }
99
+ def self.new(
100
+ # The outcome type. Always `timeout`.
101
+ type: :timeout
102
+ )
103
+ end
104
+
105
+ sig { override.returns({ type: Symbol }) }
106
+ def to_hash
107
+ end
108
+ end
109
+
110
+ class Exit < OpenAI::Internal::Type::BaseModel
111
+ OrHash =
112
+ T.type_alias do
113
+ T.any(
114
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Exit,
115
+ OpenAI::Internal::AnyHash
116
+ )
117
+ end
118
+
119
+ # The exit code returned by the shell process.
120
+ sig { returns(Integer) }
121
+ attr_accessor :exit_code
122
+
123
+ # The outcome type. Always `exit`.
124
+ sig { returns(Symbol) }
125
+ attr_accessor :type
126
+
127
+ # Indicates that the shell commands finished and returned an exit code.
128
+ sig do
129
+ params(exit_code: Integer, type: Symbol).returns(T.attached_class)
130
+ end
131
+ def self.new(
132
+ # The exit code returned by the shell process.
133
+ exit_code:,
134
+ # The outcome type. Always `exit`.
135
+ type: :exit
136
+ )
137
+ end
138
+
139
+ sig { override.returns({ exit_code: Integer, type: Symbol }) }
140
+ def to_hash
141
+ end
142
+ end
143
+
144
+ sig do
145
+ override.returns(
146
+ T::Array[
147
+ OpenAI::Responses::ResponseFunctionShellCallOutputContent::Outcome::Variants
148
+ ]
149
+ )
150
+ end
151
+ def self.variants
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,198 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ class ResponseFunctionShellToolCall < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Responses::ResponseFunctionShellToolCall,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The unique ID of the function shell tool call. Populated when this item is
16
+ # returned via API.
17
+ sig { returns(String) }
18
+ attr_accessor :id
19
+
20
+ # The shell commands and limits that describe how to run the tool call.
21
+ sig do
22
+ returns(OpenAI::Responses::ResponseFunctionShellToolCall::Action)
23
+ end
24
+ attr_reader :action
25
+
26
+ sig do
27
+ params(
28
+ action:
29
+ OpenAI::Responses::ResponseFunctionShellToolCall::Action::OrHash
30
+ ).void
31
+ end
32
+ attr_writer :action
33
+
34
+ # The unique ID of the function shell tool call generated by the model.
35
+ sig { returns(String) }
36
+ attr_accessor :call_id
37
+
38
+ # The status of the shell call. One of `in_progress`, `completed`, or
39
+ # `incomplete`.
40
+ sig do
41
+ returns(
42
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::TaggedSymbol
43
+ )
44
+ end
45
+ attr_accessor :status
46
+
47
+ # The type of the item. Always `shell_call`.
48
+ sig { returns(Symbol) }
49
+ attr_accessor :type
50
+
51
+ # The ID of the entity that created this tool call.
52
+ sig { returns(T.nilable(String)) }
53
+ attr_reader :created_by
54
+
55
+ sig { params(created_by: String).void }
56
+ attr_writer :created_by
57
+
58
+ # A tool call that executes one or more shell commands in a managed environment.
59
+ sig do
60
+ params(
61
+ id: String,
62
+ action:
63
+ OpenAI::Responses::ResponseFunctionShellToolCall::Action::OrHash,
64
+ call_id: String,
65
+ status:
66
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::OrSymbol,
67
+ created_by: String,
68
+ type: Symbol
69
+ ).returns(T.attached_class)
70
+ end
71
+ def self.new(
72
+ # The unique ID of the function shell tool call. Populated when this item is
73
+ # returned via API.
74
+ id:,
75
+ # The shell commands and limits that describe how to run the tool call.
76
+ action:,
77
+ # The unique ID of the function shell tool call generated by the model.
78
+ call_id:,
79
+ # The status of the shell call. One of `in_progress`, `completed`, or
80
+ # `incomplete`.
81
+ status:,
82
+ # The ID of the entity that created this tool call.
83
+ created_by: nil,
84
+ # The type of the item. Always `shell_call`.
85
+ type: :shell_call
86
+ )
87
+ end
88
+
89
+ sig do
90
+ override.returns(
91
+ {
92
+ id: String,
93
+ action: OpenAI::Responses::ResponseFunctionShellToolCall::Action,
94
+ call_id: String,
95
+ status:
96
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::TaggedSymbol,
97
+ type: Symbol,
98
+ created_by: String
99
+ }
100
+ )
101
+ end
102
+ def to_hash
103
+ end
104
+
105
+ class Action < OpenAI::Internal::Type::BaseModel
106
+ OrHash =
107
+ T.type_alias do
108
+ T.any(
109
+ OpenAI::Responses::ResponseFunctionShellToolCall::Action,
110
+ OpenAI::Internal::AnyHash
111
+ )
112
+ end
113
+
114
+ sig { returns(T::Array[String]) }
115
+ attr_accessor :commands
116
+
117
+ # Optional maximum number of characters to return from each command.
118
+ sig { returns(T.nilable(Integer)) }
119
+ attr_accessor :max_output_length
120
+
121
+ # Optional timeout in milliseconds for the commands.
122
+ sig { returns(T.nilable(Integer)) }
123
+ attr_accessor :timeout_ms
124
+
125
+ # The shell commands and limits that describe how to run the tool call.
126
+ sig do
127
+ params(
128
+ commands: T::Array[String],
129
+ max_output_length: T.nilable(Integer),
130
+ timeout_ms: T.nilable(Integer)
131
+ ).returns(T.attached_class)
132
+ end
133
+ def self.new(
134
+ commands:,
135
+ # Optional maximum number of characters to return from each command.
136
+ max_output_length:,
137
+ # Optional timeout in milliseconds for the commands.
138
+ timeout_ms:
139
+ )
140
+ end
141
+
142
+ sig do
143
+ override.returns(
144
+ {
145
+ commands: T::Array[String],
146
+ max_output_length: T.nilable(Integer),
147
+ timeout_ms: T.nilable(Integer)
148
+ }
149
+ )
150
+ end
151
+ def to_hash
152
+ end
153
+ end
154
+
155
+ # The status of the shell call. One of `in_progress`, `completed`, or
156
+ # `incomplete`.
157
+ module Status
158
+ extend OpenAI::Internal::Type::Enum
159
+
160
+ TaggedSymbol =
161
+ T.type_alias do
162
+ T.all(
163
+ Symbol,
164
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status
165
+ )
166
+ end
167
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
168
+
169
+ IN_PROGRESS =
170
+ T.let(
171
+ :in_progress,
172
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::TaggedSymbol
173
+ )
174
+ COMPLETED =
175
+ T.let(
176
+ :completed,
177
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::TaggedSymbol
178
+ )
179
+ INCOMPLETE =
180
+ T.let(
181
+ :incomplete,
182
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::TaggedSymbol
183
+ )
184
+
185
+ sig do
186
+ override.returns(
187
+ T::Array[
188
+ OpenAI::Responses::ResponseFunctionShellToolCall::Status::TaggedSymbol
189
+ ]
190
+ )
191
+ end
192
+ def self.values
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end