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
@@ -100,7 +100,9 @@ module OpenAI
100
100
  OpenAI::Responses::ToolChoiceTypes,
101
101
  OpenAI::Responses::ToolChoiceFunction,
102
102
  OpenAI::Responses::ToolChoiceMcp,
103
- OpenAI::Responses::ToolChoiceCustom
103
+ OpenAI::Responses::ToolChoiceCustom,
104
+ OpenAI::Responses::ToolChoiceApplyPatch,
105
+ OpenAI::Responses::ToolChoiceShell
104
106
  )
105
107
  )
106
108
  )
@@ -121,7 +123,9 @@ module OpenAI
121
123
  OpenAI::Responses::Tool::CodeInterpreter,
122
124
  OpenAI::Responses::Tool::ImageGeneration,
123
125
  OpenAI::Responses::Tool::LocalShell,
126
+ OpenAI::Responses::FunctionShellTool,
124
127
  OpenAI::Responses::CustomTool,
128
+ OpenAI::Responses::ApplyPatchTool,
125
129
  OpenAI::Responses::WebSearchTool,
126
130
  OpenAI::Responses::WebSearchPreviewTool
127
131
  )
@@ -181,7 +185,9 @@ module OpenAI
181
185
  OpenAI::Responses::ToolChoiceTypes::OrHash,
182
186
  OpenAI::Responses::ToolChoiceFunction::OrHash,
183
187
  OpenAI::Responses::ToolChoiceMcp::OrHash,
184
- OpenAI::Responses::ToolChoiceCustom::OrHash
188
+ OpenAI::Responses::ToolChoiceCustom::OrHash,
189
+ OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
190
+ OpenAI::Responses::ToolChoiceShell::OrHash
185
191
  )
186
192
  ),
187
193
  tools:
@@ -195,7 +201,9 @@ module OpenAI
195
201
  OpenAI::Responses::Tool::CodeInterpreter::OrHash,
196
202
  OpenAI::Responses::Tool::ImageGeneration::OrHash,
197
203
  OpenAI::Responses::Tool::LocalShell::OrHash,
204
+ OpenAI::Responses::FunctionShellTool::OrHash,
198
205
  OpenAI::Responses::CustomTool::OrHash,
206
+ OpenAI::Responses::ApplyPatchTool::OrHash,
199
207
  OpenAI::Responses::WebSearchTool::OrHash,
200
208
  OpenAI::Responses::WebSearchPreviewTool::OrHash
201
209
  )
@@ -283,7 +291,9 @@ module OpenAI
283
291
  OpenAI::Responses::ToolChoiceTypes,
284
292
  OpenAI::Responses::ToolChoiceFunction,
285
293
  OpenAI::Responses::ToolChoiceMcp,
286
- OpenAI::Responses::ToolChoiceCustom
294
+ OpenAI::Responses::ToolChoiceCustom,
295
+ OpenAI::Responses::ToolChoiceApplyPatch,
296
+ OpenAI::Responses::ToolChoiceShell
287
297
  )
288
298
  ),
289
299
  tools:
@@ -297,7 +307,9 @@ module OpenAI
297
307
  OpenAI::Responses::Tool::CodeInterpreter,
298
308
  OpenAI::Responses::Tool::ImageGeneration,
299
309
  OpenAI::Responses::Tool::LocalShell,
310
+ OpenAI::Responses::FunctionShellTool,
300
311
  OpenAI::Responses::CustomTool,
312
+ OpenAI::Responses::ApplyPatchTool,
301
313
  OpenAI::Responses::WebSearchTool,
302
314
  OpenAI::Responses::WebSearchPreviewTool
303
315
  )
@@ -542,7 +554,9 @@ module OpenAI
542
554
  OpenAI::Responses::ToolChoiceTypes,
543
555
  OpenAI::Responses::ToolChoiceFunction,
544
556
  OpenAI::Responses::ToolChoiceMcp,
545
- OpenAI::Responses::ToolChoiceCustom
557
+ OpenAI::Responses::ToolChoiceCustom,
558
+ OpenAI::Responses::ToolChoiceApplyPatch,
559
+ OpenAI::Responses::ToolChoiceShell
546
560
  )
547
561
  end
548
562
 
@@ -193,6 +193,19 @@ module OpenAI
193
193
  sig { params(prompt_cache_key: String).void }
194
194
  attr_writer :prompt_cache_key
195
195
 
196
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
197
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
198
+ # of 24 hours.
199
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
200
+ sig do
201
+ returns(
202
+ T.nilable(
203
+ OpenAI::Responses::Response::PromptCacheRetention::TaggedSymbol
204
+ )
205
+ )
206
+ end
207
+ attr_accessor :prompt_cache_retention
208
+
196
209
  # **gpt-5 and o-series models only**
197
210
  #
198
211
  # Configuration options for
@@ -324,6 +337,10 @@ module OpenAI
324
337
  OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OrHash,
325
338
  OpenAI::Responses::ResponseCodeInterpreterToolCall::OrHash,
326
339
  OpenAI::Responses::ResponseOutputItem::LocalShellCall::OrHash,
340
+ OpenAI::Responses::ResponseFunctionShellToolCall::OrHash,
341
+ OpenAI::Responses::ResponseFunctionShellToolCallOutput::OrHash,
342
+ OpenAI::Responses::ResponseApplyPatchToolCall::OrHash,
343
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::OrHash,
327
344
  OpenAI::Responses::ResponseOutputItem::McpCall::OrHash,
328
345
  OpenAI::Responses::ResponseOutputItem::McpListTools::OrHash,
329
346
  OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash,
@@ -339,7 +356,9 @@ module OpenAI
339
356
  OpenAI::Responses::ToolChoiceTypes::OrHash,
340
357
  OpenAI::Responses::ToolChoiceFunction::OrHash,
341
358
  OpenAI::Responses::ToolChoiceMcp::OrHash,
342
- OpenAI::Responses::ToolChoiceCustom::OrHash
359
+ OpenAI::Responses::ToolChoiceCustom::OrHash,
360
+ OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
361
+ OpenAI::Responses::ToolChoiceShell::OrHash
343
362
  ),
344
363
  tools:
345
364
  T::Array[
@@ -351,7 +370,9 @@ module OpenAI
351
370
  OpenAI::Responses::Tool::CodeInterpreter::OrHash,
352
371
  OpenAI::Responses::Tool::ImageGeneration::OrHash,
353
372
  OpenAI::Responses::Tool::LocalShell::OrHash,
373
+ OpenAI::Responses::FunctionShellTool::OrHash,
354
374
  OpenAI::Responses::CustomTool::OrHash,
375
+ OpenAI::Responses::ApplyPatchTool::OrHash,
355
376
  OpenAI::Responses::WebSearchTool::OrHash,
356
377
  OpenAI::Responses::WebSearchPreviewTool::OrHash
357
378
  )
@@ -365,6 +386,10 @@ module OpenAI
365
386
  previous_response_id: T.nilable(String),
366
387
  prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
367
388
  prompt_cache_key: String,
389
+ prompt_cache_retention:
390
+ T.nilable(
391
+ OpenAI::Responses::Response::PromptCacheRetention::OrSymbol
392
+ ),
368
393
  reasoning: T.nilable(OpenAI::Reasoning::OrHash),
369
394
  safety_identifier: String,
370
395
  service_tier:
@@ -479,6 +504,11 @@ module OpenAI
479
504
  # hit rates. Replaces the `user` field.
480
505
  # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
481
506
  prompt_cache_key: nil,
507
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
508
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
509
+ # of 24 hours.
510
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
511
+ prompt_cache_retention: nil,
482
512
  # **gpt-5 and o-series models only**
483
513
  #
484
514
  # Configuration options for
@@ -568,6 +598,10 @@ module OpenAI
568
598
  previous_response_id: T.nilable(String),
569
599
  prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
570
600
  prompt_cache_key: String,
601
+ prompt_cache_retention:
602
+ T.nilable(
603
+ OpenAI::Responses::Response::PromptCacheRetention::TaggedSymbol
604
+ ),
571
605
  reasoning: T.nilable(OpenAI::Reasoning),
572
606
  safety_identifier: String,
573
607
  service_tier:
@@ -723,7 +757,9 @@ module OpenAI
723
757
  OpenAI::Responses::ToolChoiceTypes,
724
758
  OpenAI::Responses::ToolChoiceFunction,
725
759
  OpenAI::Responses::ToolChoiceMcp,
726
- OpenAI::Responses::ToolChoiceCustom
760
+ OpenAI::Responses::ToolChoiceCustom,
761
+ OpenAI::Responses::ToolChoiceApplyPatch,
762
+ OpenAI::Responses::ToolChoiceShell
727
763
  )
728
764
  end
729
765
 
@@ -763,6 +799,41 @@ module OpenAI
763
799
  end
764
800
  end
765
801
 
802
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
803
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
804
+ # of 24 hours.
805
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
806
+ module PromptCacheRetention
807
+ extend OpenAI::Internal::Type::Enum
808
+
809
+ TaggedSymbol =
810
+ T.type_alias do
811
+ T.all(Symbol, OpenAI::Responses::Response::PromptCacheRetention)
812
+ end
813
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
814
+
815
+ IN_MEMORY =
816
+ T.let(
817
+ :"in-memory",
818
+ OpenAI::Responses::Response::PromptCacheRetention::TaggedSymbol
819
+ )
820
+ PROMPT_CACHE_RETENTION_24H =
821
+ T.let(
822
+ :"24h",
823
+ OpenAI::Responses::Response::PromptCacheRetention::TaggedSymbol
824
+ )
825
+
826
+ sig do
827
+ override.returns(
828
+ T::Array[
829
+ OpenAI::Responses::Response::PromptCacheRetention::TaggedSymbol
830
+ ]
831
+ )
832
+ end
833
+ def self.values
834
+ end
835
+ end
836
+
766
837
  # Specifies the processing type used for serving the request.
767
838
  #
768
839
  # - If set to 'auto', then the request will be processed with the service tier
@@ -0,0 +1,300 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ class ResponseApplyPatchToolCall < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Responses::ResponseApplyPatchToolCall,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The unique ID of the apply patch tool call. Populated when this item is returned
16
+ # via API.
17
+ sig { returns(String) }
18
+ attr_accessor :id
19
+
20
+ # The unique ID of the apply patch tool call generated by the model.
21
+ sig { returns(String) }
22
+ attr_accessor :call_id
23
+
24
+ # The status of the apply patch tool call. One of `in_progress` or `completed`.
25
+ sig do
26
+ returns(
27
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
28
+ )
29
+ end
30
+ attr_accessor :status
31
+
32
+ # The type of the item. Always `apply_patch_call`.
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ # The ID of the entity that created this tool call.
37
+ sig { returns(T.nilable(String)) }
38
+ attr_reader :created_by
39
+
40
+ sig { params(created_by: String).void }
41
+ attr_writer :created_by
42
+
43
+ # One of the create_file, delete_file, or update_file operations applied via
44
+ # apply_patch.
45
+ sig do
46
+ returns(
47
+ T.nilable(
48
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::Variants
49
+ )
50
+ )
51
+ end
52
+ attr_reader :operation
53
+
54
+ sig do
55
+ params(
56
+ operation:
57
+ T.any(
58
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile::OrHash,
59
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile::OrHash,
60
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile::OrHash
61
+ )
62
+ ).void
63
+ end
64
+ attr_writer :operation
65
+
66
+ # A tool call that applies file diffs by creating, deleting, or updating files.
67
+ sig do
68
+ params(
69
+ id: String,
70
+ call_id: String,
71
+ status:
72
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::OrSymbol,
73
+ created_by: String,
74
+ operation:
75
+ T.any(
76
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile::OrHash,
77
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile::OrHash,
78
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile::OrHash
79
+ ),
80
+ type: Symbol
81
+ ).returns(T.attached_class)
82
+ end
83
+ def self.new(
84
+ # The unique ID of the apply patch tool call. Populated when this item is returned
85
+ # via API.
86
+ id:,
87
+ # The unique ID of the apply patch tool call generated by the model.
88
+ call_id:,
89
+ # The status of the apply patch tool call. One of `in_progress` or `completed`.
90
+ status:,
91
+ # The ID of the entity that created this tool call.
92
+ created_by: nil,
93
+ # One of the create_file, delete_file, or update_file operations applied via
94
+ # apply_patch.
95
+ operation: nil,
96
+ # The type of the item. Always `apply_patch_call`.
97
+ type: :apply_patch_call
98
+ )
99
+ end
100
+
101
+ sig do
102
+ override.returns(
103
+ {
104
+ id: String,
105
+ call_id: String,
106
+ status:
107
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol,
108
+ type: Symbol,
109
+ created_by: String,
110
+ operation:
111
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::Variants
112
+ }
113
+ )
114
+ end
115
+ def to_hash
116
+ end
117
+
118
+ # The status of the apply patch tool call. One of `in_progress` or `completed`.
119
+ module Status
120
+ extend OpenAI::Internal::Type::Enum
121
+
122
+ TaggedSymbol =
123
+ T.type_alias do
124
+ T.all(
125
+ Symbol,
126
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status
127
+ )
128
+ end
129
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
130
+
131
+ IN_PROGRESS =
132
+ T.let(
133
+ :in_progress,
134
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
135
+ )
136
+ COMPLETED =
137
+ T.let(
138
+ :completed,
139
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
140
+ )
141
+
142
+ sig do
143
+ override.returns(
144
+ T::Array[
145
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
146
+ ]
147
+ )
148
+ end
149
+ def self.values
150
+ end
151
+ end
152
+
153
+ # One of the create_file, delete_file, or update_file operations applied via
154
+ # apply_patch.
155
+ module Operation
156
+ extend OpenAI::Internal::Type::Union
157
+
158
+ Variants =
159
+ T.type_alias do
160
+ T.any(
161
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile,
162
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile,
163
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile
164
+ )
165
+ end
166
+
167
+ class CreateFile < OpenAI::Internal::Type::BaseModel
168
+ OrHash =
169
+ T.type_alias do
170
+ T.any(
171
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile,
172
+ OpenAI::Internal::AnyHash
173
+ )
174
+ end
175
+
176
+ # Diff to apply.
177
+ sig { returns(String) }
178
+ attr_accessor :diff
179
+
180
+ # Path of the file to create.
181
+ sig { returns(String) }
182
+ attr_accessor :path
183
+
184
+ # Create a new file with the provided diff.
185
+ sig { returns(Symbol) }
186
+ attr_accessor :type
187
+
188
+ # Instruction describing how to create a file via the apply_patch tool.
189
+ sig do
190
+ params(diff: String, path: String, type: Symbol).returns(
191
+ T.attached_class
192
+ )
193
+ end
194
+ def self.new(
195
+ # Diff to apply.
196
+ diff:,
197
+ # Path of the file to create.
198
+ path:,
199
+ # Create a new file with the provided diff.
200
+ type: :create_file
201
+ )
202
+ end
203
+
204
+ sig do
205
+ override.returns({ diff: String, path: String, type: Symbol })
206
+ end
207
+ def to_hash
208
+ end
209
+ end
210
+
211
+ class DeleteFile < OpenAI::Internal::Type::BaseModel
212
+ OrHash =
213
+ T.type_alias do
214
+ T.any(
215
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile,
216
+ OpenAI::Internal::AnyHash
217
+ )
218
+ end
219
+
220
+ # Path of the file to delete.
221
+ sig { returns(String) }
222
+ attr_accessor :path
223
+
224
+ # Delete the specified file.
225
+ sig { returns(Symbol) }
226
+ attr_accessor :type
227
+
228
+ # Instruction describing how to delete a file via the apply_patch tool.
229
+ sig { params(path: String, type: Symbol).returns(T.attached_class) }
230
+ def self.new(
231
+ # Path of the file to delete.
232
+ path:,
233
+ # Delete the specified file.
234
+ type: :delete_file
235
+ )
236
+ end
237
+
238
+ sig { override.returns({ path: String, type: Symbol }) }
239
+ def to_hash
240
+ end
241
+ end
242
+
243
+ class UpdateFile < OpenAI::Internal::Type::BaseModel
244
+ OrHash =
245
+ T.type_alias do
246
+ T.any(
247
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile,
248
+ OpenAI::Internal::AnyHash
249
+ )
250
+ end
251
+
252
+ # Diff to apply.
253
+ sig { returns(String) }
254
+ attr_accessor :diff
255
+
256
+ # Path of the file to update.
257
+ sig { returns(String) }
258
+ attr_accessor :path
259
+
260
+ # Update an existing file with the provided diff.
261
+ sig { returns(Symbol) }
262
+ attr_accessor :type
263
+
264
+ # Instruction describing how to update a file via the apply_patch tool.
265
+ sig do
266
+ params(diff: String, path: String, type: Symbol).returns(
267
+ T.attached_class
268
+ )
269
+ end
270
+ def self.new(
271
+ # Diff to apply.
272
+ diff:,
273
+ # Path of the file to update.
274
+ path:,
275
+ # Update an existing file with the provided diff.
276
+ type: :update_file
277
+ )
278
+ end
279
+
280
+ sig do
281
+ override.returns({ diff: String, path: String, type: Symbol })
282
+ end
283
+ def to_hash
284
+ end
285
+ end
286
+
287
+ sig do
288
+ override.returns(
289
+ T::Array[
290
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::Variants
291
+ ]
292
+ )
293
+ end
294
+ def self.variants
295
+ end
296
+ end
297
+ end
298
+ end
299
+ end
300
+ end
@@ -0,0 +1,129 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ class ResponseApplyPatchToolCallOutput < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The unique ID of the apply patch tool call output. Populated when this item is
16
+ # returned via API.
17
+ sig { returns(String) }
18
+ attr_accessor :id
19
+
20
+ # The unique ID of the apply patch tool call generated by the model.
21
+ sig { returns(String) }
22
+ attr_accessor :call_id
23
+
24
+ # Optional textual output returned by the apply patch tool.
25
+ sig { returns(T.nilable(String)) }
26
+ attr_accessor :output
27
+
28
+ # The status of the apply patch tool call output. One of `completed` or `failed`.
29
+ sig do
30
+ returns(
31
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol
32
+ )
33
+ end
34
+ attr_accessor :status
35
+
36
+ # The type of the item. Always `apply_patch_call_output`.
37
+ sig { returns(Symbol) }
38
+ attr_accessor :type
39
+
40
+ # The ID of the entity that created this tool call output.
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :created_by
43
+
44
+ sig { params(created_by: String).void }
45
+ attr_writer :created_by
46
+
47
+ # The output emitted by an apply patch tool call.
48
+ sig do
49
+ params(
50
+ id: String,
51
+ call_id: String,
52
+ output: T.nilable(String),
53
+ status:
54
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::OrSymbol,
55
+ created_by: String,
56
+ type: Symbol
57
+ ).returns(T.attached_class)
58
+ end
59
+ def self.new(
60
+ # The unique ID of the apply patch tool call output. Populated when this item is
61
+ # returned via API.
62
+ id:,
63
+ # The unique ID of the apply patch tool call generated by the model.
64
+ call_id:,
65
+ # Optional textual output returned by the apply patch tool.
66
+ output:,
67
+ # The status of the apply patch tool call output. One of `completed` or `failed`.
68
+ status:,
69
+ # The ID of the entity that created this tool call output.
70
+ created_by: nil,
71
+ # The type of the item. Always `apply_patch_call_output`.
72
+ type: :apply_patch_call_output
73
+ )
74
+ end
75
+
76
+ sig do
77
+ override.returns(
78
+ {
79
+ id: String,
80
+ call_id: String,
81
+ output: T.nilable(String),
82
+ status:
83
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol,
84
+ type: Symbol,
85
+ created_by: String
86
+ }
87
+ )
88
+ end
89
+ def to_hash
90
+ end
91
+
92
+ # The status of the apply patch tool call output. One of `completed` or `failed`.
93
+ module Status
94
+ extend OpenAI::Internal::Type::Enum
95
+
96
+ TaggedSymbol =
97
+ T.type_alias do
98
+ T.all(
99
+ Symbol,
100
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status
101
+ )
102
+ end
103
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
104
+
105
+ COMPLETED =
106
+ T.let(
107
+ :completed,
108
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol
109
+ )
110
+ FAILED =
111
+ T.let(
112
+ :failed,
113
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol
114
+ )
115
+
116
+ sig do
117
+ override.returns(
118
+ T::Array[
119
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol
120
+ ]
121
+ )
122
+ end
123
+ def self.values
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end