openai 0.35.1 → 0.36.1

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 +25 -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 +286 -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 +672 -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 +119 -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 +274 -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,286 @@
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
+ # One of the create_file, delete_file, or update_file operations applied via
25
+ # apply_patch.
26
+ sig do
27
+ returns(
28
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::Variants
29
+ )
30
+ end
31
+ attr_accessor :operation
32
+
33
+ # The status of the apply patch tool call. One of `in_progress` or `completed`.
34
+ sig do
35
+ returns(
36
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
37
+ )
38
+ end
39
+ attr_accessor :status
40
+
41
+ # The type of the item. Always `apply_patch_call`.
42
+ sig { returns(Symbol) }
43
+ attr_accessor :type
44
+
45
+ # The ID of the entity that created this tool call.
46
+ sig { returns(T.nilable(String)) }
47
+ attr_reader :created_by
48
+
49
+ sig { params(created_by: String).void }
50
+ attr_writer :created_by
51
+
52
+ # A tool call that applies file diffs by creating, deleting, or updating files.
53
+ sig do
54
+ params(
55
+ id: String,
56
+ call_id: String,
57
+ operation:
58
+ T.any(
59
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile::OrHash,
60
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile::OrHash,
61
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile::OrHash
62
+ ),
63
+ status:
64
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::OrSymbol,
65
+ created_by: String,
66
+ type: Symbol
67
+ ).returns(T.attached_class)
68
+ end
69
+ def self.new(
70
+ # The unique ID of the apply patch tool call. Populated when this item is returned
71
+ # via API.
72
+ id:,
73
+ # The unique ID of the apply patch tool call generated by the model.
74
+ call_id:,
75
+ # One of the create_file, delete_file, or update_file operations applied via
76
+ # apply_patch.
77
+ operation:,
78
+ # The status of the apply patch tool call. One of `in_progress` or `completed`.
79
+ status:,
80
+ # The ID of the entity that created this tool call.
81
+ created_by: nil,
82
+ # The type of the item. Always `apply_patch_call`.
83
+ type: :apply_patch_call
84
+ )
85
+ end
86
+
87
+ sig do
88
+ override.returns(
89
+ {
90
+ id: String,
91
+ call_id: String,
92
+ operation:
93
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::Variants,
94
+ status:
95
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol,
96
+ type: Symbol,
97
+ created_by: String
98
+ }
99
+ )
100
+ end
101
+ def to_hash
102
+ end
103
+
104
+ # One of the create_file, delete_file, or update_file operations applied via
105
+ # apply_patch.
106
+ module Operation
107
+ extend OpenAI::Internal::Type::Union
108
+
109
+ Variants =
110
+ T.type_alias do
111
+ T.any(
112
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile,
113
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile,
114
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile
115
+ )
116
+ end
117
+
118
+ class CreateFile < OpenAI::Internal::Type::BaseModel
119
+ OrHash =
120
+ T.type_alias do
121
+ T.any(
122
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::CreateFile,
123
+ OpenAI::Internal::AnyHash
124
+ )
125
+ end
126
+
127
+ # Diff to apply.
128
+ sig { returns(String) }
129
+ attr_accessor :diff
130
+
131
+ # Path of the file to create.
132
+ sig { returns(String) }
133
+ attr_accessor :path
134
+
135
+ # Create a new file with the provided diff.
136
+ sig { returns(Symbol) }
137
+ attr_accessor :type
138
+
139
+ # Instruction describing how to create a file via the apply_patch tool.
140
+ sig do
141
+ params(diff: String, path: String, type: Symbol).returns(
142
+ T.attached_class
143
+ )
144
+ end
145
+ def self.new(
146
+ # Diff to apply.
147
+ diff:,
148
+ # Path of the file to create.
149
+ path:,
150
+ # Create a new file with the provided diff.
151
+ type: :create_file
152
+ )
153
+ end
154
+
155
+ sig do
156
+ override.returns({ diff: String, path: String, type: Symbol })
157
+ end
158
+ def to_hash
159
+ end
160
+ end
161
+
162
+ class DeleteFile < OpenAI::Internal::Type::BaseModel
163
+ OrHash =
164
+ T.type_alias do
165
+ T.any(
166
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::DeleteFile,
167
+ OpenAI::Internal::AnyHash
168
+ )
169
+ end
170
+
171
+ # Path of the file to delete.
172
+ sig { returns(String) }
173
+ attr_accessor :path
174
+
175
+ # Delete the specified file.
176
+ sig { returns(Symbol) }
177
+ attr_accessor :type
178
+
179
+ # Instruction describing how to delete a file via the apply_patch tool.
180
+ sig { params(path: String, type: Symbol).returns(T.attached_class) }
181
+ def self.new(
182
+ # Path of the file to delete.
183
+ path:,
184
+ # Delete the specified file.
185
+ type: :delete_file
186
+ )
187
+ end
188
+
189
+ sig { override.returns({ path: String, type: Symbol }) }
190
+ def to_hash
191
+ end
192
+ end
193
+
194
+ class UpdateFile < OpenAI::Internal::Type::BaseModel
195
+ OrHash =
196
+ T.type_alias do
197
+ T.any(
198
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::UpdateFile,
199
+ OpenAI::Internal::AnyHash
200
+ )
201
+ end
202
+
203
+ # Diff to apply.
204
+ sig { returns(String) }
205
+ attr_accessor :diff
206
+
207
+ # Path of the file to update.
208
+ sig { returns(String) }
209
+ attr_accessor :path
210
+
211
+ # Update an existing file with the provided diff.
212
+ sig { returns(Symbol) }
213
+ attr_accessor :type
214
+
215
+ # Instruction describing how to update a file via the apply_patch tool.
216
+ sig do
217
+ params(diff: String, path: String, type: Symbol).returns(
218
+ T.attached_class
219
+ )
220
+ end
221
+ def self.new(
222
+ # Diff to apply.
223
+ diff:,
224
+ # Path of the file to update.
225
+ path:,
226
+ # Update an existing file with the provided diff.
227
+ type: :update_file
228
+ )
229
+ end
230
+
231
+ sig do
232
+ override.returns({ diff: String, path: String, type: Symbol })
233
+ end
234
+ def to_hash
235
+ end
236
+ end
237
+
238
+ sig do
239
+ override.returns(
240
+ T::Array[
241
+ OpenAI::Responses::ResponseApplyPatchToolCall::Operation::Variants
242
+ ]
243
+ )
244
+ end
245
+ def self.variants
246
+ end
247
+ end
248
+
249
+ # The status of the apply patch tool call. One of `in_progress` or `completed`.
250
+ module Status
251
+ extend OpenAI::Internal::Type::Enum
252
+
253
+ TaggedSymbol =
254
+ T.type_alias do
255
+ T.all(
256
+ Symbol,
257
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status
258
+ )
259
+ end
260
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
261
+
262
+ IN_PROGRESS =
263
+ T.let(
264
+ :in_progress,
265
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
266
+ )
267
+ COMPLETED =
268
+ T.let(
269
+ :completed,
270
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
271
+ )
272
+
273
+ sig do
274
+ override.returns(
275
+ T::Array[
276
+ OpenAI::Responses::ResponseApplyPatchToolCall::Status::TaggedSymbol
277
+ ]
278
+ )
279
+ end
280
+ def self.values
281
+ end
282
+ end
283
+ end
284
+ end
285
+ end
286
+ 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
+ # The status of the apply patch tool call output. One of `completed` or `failed`.
25
+ sig do
26
+ returns(
27
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol
28
+ )
29
+ end
30
+ attr_accessor :status
31
+
32
+ # The type of the item. Always `apply_patch_call_output`.
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ # The ID of the entity that created this tool call output.
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
+ # Optional textual output returned by the apply patch tool.
44
+ sig { returns(T.nilable(String)) }
45
+ attr_accessor :output
46
+
47
+ # The output emitted by an apply patch tool call.
48
+ sig do
49
+ params(
50
+ id: String,
51
+ call_id: String,
52
+ status:
53
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::OrSymbol,
54
+ created_by: String,
55
+ output: T.nilable(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
+ # The status of the apply patch tool call output. One of `completed` or `failed`.
66
+ status:,
67
+ # The ID of the entity that created this tool call output.
68
+ created_by: nil,
69
+ # Optional textual output returned by the apply patch tool.
70
+ output: 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
+ status:
82
+ OpenAI::Responses::ResponseApplyPatchToolCallOutput::Status::TaggedSymbol,
83
+ type: Symbol,
84
+ created_by: String,
85
+ output: T.nilable(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