openai 0.18.1 → 0.20.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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/helpers/structured_output/boolean.rb +1 -0
  6. data/lib/openai/internal/conversation_cursor_page.rb +92 -0
  7. data/lib/openai/internal/transport/base_client.rb +1 -4
  8. data/lib/openai/internal/transport/pooled_net_requester.rb +1 -9
  9. data/lib/openai/internal/util.rb +1 -1
  10. data/lib/openai/models/audio/transcription.rb +1 -4
  11. data/lib/openai/models/audio/transcription_create_params.rb +2 -7
  12. data/lib/openai/models/audio/transcription_text_done_event.rb +1 -4
  13. data/lib/openai/models/beta/assistant_create_params.rb +6 -19
  14. data/lib/openai/models/beta/assistant_stream_event.rb +6 -24
  15. data/lib/openai/models/beta/assistant_update_params.rb +1 -4
  16. data/lib/openai/models/beta/message_stream_event.rb +1 -4
  17. data/lib/openai/models/beta/run_step_stream_event.rb +1 -4
  18. data/lib/openai/models/beta/thread_create_and_run_params.rb +10 -32
  19. data/lib/openai/models/beta/thread_create_params.rb +7 -22
  20. data/lib/openai/models/beta/threads/message.rb +3 -10
  21. data/lib/openai/models/beta/threads/message_create_params.rb +2 -7
  22. data/lib/openai/models/beta/threads/run.rb +2 -7
  23. data/lib/openai/models/beta/threads/run_create_params.rb +3 -10
  24. data/lib/openai/models/beta/threads/run_submit_tool_outputs_params.rb +1 -3
  25. data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call.rb +5 -17
  26. data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rb +1 -3
  27. data/lib/openai/models/beta/threads/runs/file_search_tool_call.rb +4 -12
  28. data/lib/openai/models/beta/threads/runs/run_step_delta_message_delta.rb +1 -4
  29. data/lib/openai/models/beta/threads/runs/tool_calls_step_details.rb +1 -4
  30. data/lib/openai/models/beta/threads/text.rb +1 -4
  31. data/lib/openai/models/chat/chat_completion_chunk.rb +1 -3
  32. data/lib/openai/models/chat/chat_completion_custom_tool.rb +2 -7
  33. data/lib/openai/models/chat/chat_completion_message.rb +7 -5
  34. data/lib/openai/models/chat/chat_completion_message_function_tool_call.rb +7 -5
  35. data/lib/openai/models/conversations/computer_screenshot_content.rb +38 -0
  36. data/lib/openai/models/conversations/container_file_citation_body.rb +58 -0
  37. data/lib/openai/models/conversations/conversation.rb +51 -0
  38. data/lib/openai/models/conversations/conversation_create_params.rb +39 -0
  39. data/lib/openai/models/conversations/conversation_delete_params.rb +16 -0
  40. data/lib/openai/models/conversations/conversation_deleted.rb +29 -0
  41. data/lib/openai/models/conversations/conversation_deleted_resource.rb +30 -0
  42. data/lib/openai/models/conversations/conversation_item.rb +568 -0
  43. data/lib/openai/models/conversations/conversation_item_list.rb +55 -0
  44. data/lib/openai/models/conversations/conversation_retrieve_params.rb +16 -0
  45. data/lib/openai/models/conversations/conversation_update_params.rb +31 -0
  46. data/lib/openai/models/conversations/file_citation_body.rb +42 -0
  47. data/lib/openai/models/conversations/input_file_content.rb +42 -0
  48. data/lib/openai/models/conversations/input_image_content.rb +62 -0
  49. data/lib/openai/models/conversations/input_text_content.rb +26 -0
  50. data/lib/openai/models/conversations/item_create_params.rb +37 -0
  51. data/lib/openai/models/conversations/item_delete_params.rb +22 -0
  52. data/lib/openai/models/conversations/item_list_params.rb +86 -0
  53. data/lib/openai/models/conversations/item_retrieve_params.rb +36 -0
  54. data/lib/openai/models/conversations/lob_prob.rb +35 -0
  55. data/lib/openai/models/conversations/message.rb +115 -0
  56. data/lib/openai/models/conversations/output_text_content.rb +57 -0
  57. data/lib/openai/models/conversations/refusal_content.rb +26 -0
  58. data/lib/openai/models/conversations/summary_text_content.rb +23 -0
  59. data/lib/openai/models/conversations/text_content.rb +23 -0
  60. data/lib/openai/models/conversations/top_log_prob.rb +29 -0
  61. data/lib/openai/models/conversations/url_citation_body.rb +50 -0
  62. data/lib/openai/models/eval_create_params.rb +6 -20
  63. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +29 -53
  64. data/lib/openai/models/evals/create_eval_jsonl_run_data_source.rb +1 -3
  65. data/lib/openai/models/evals/run_cancel_response.rb +2 -2
  66. data/lib/openai/models/evals/run_create_params.rb +20 -56
  67. data/lib/openai/models/evals/run_create_response.rb +2 -2
  68. data/lib/openai/models/evals/run_list_response.rb +2 -2
  69. data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
  70. data/lib/openai/models/fine_tuning/reinforcement_hyperparameters.rb +1 -4
  71. data/lib/openai/models/moderation.rb +5 -15
  72. data/lib/openai/models/responses/input_item_list_params.rb +1 -9
  73. data/lib/openai/models/responses/response.rb +28 -3
  74. data/lib/openai/models/responses/response_computer_tool_call.rb +2 -6
  75. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +1 -3
  76. data/lib/openai/models/responses/response_conversation_param.rb +20 -0
  77. data/lib/openai/models/responses/response_create_params.rb +38 -3
  78. data/lib/openai/models/responses/response_function_tool_call.rb +7 -5
  79. data/lib/openai/models/responses/response_function_web_search.rb +35 -1
  80. data/lib/openai/models/responses/response_includable.rb +2 -0
  81. data/lib/openai/models/responses/response_input_item.rb +2 -7
  82. data/lib/openai/models/responses/response_input_message_item.rb +1 -4
  83. data/lib/openai/models/responses/response_output_item.rb +1 -3
  84. data/lib/openai/models/responses/response_output_message.rb +1 -3
  85. data/lib/openai/models/responses/response_output_text.rb +10 -15
  86. data/lib/openai/models/responses/response_stream_event.rb +4 -16
  87. data/lib/openai/models/responses/response_text_delta_event.rb +1 -3
  88. data/lib/openai/models/responses/response_text_done_event.rb +1 -3
  89. data/lib/openai/models/responses/tool.rb +303 -35
  90. data/lib/openai/models.rb +2 -0
  91. data/lib/openai/resources/conversations/items.rb +141 -0
  92. data/lib/openai/resources/conversations.rb +112 -0
  93. data/lib/openai/resources/responses/input_items.rb +1 -3
  94. data/lib/openai/resources/responses.rb +8 -4
  95. data/lib/openai/version.rb +1 -1
  96. data/lib/openai.rb +31 -0
  97. data/rbi/openai/client.rbi +3 -0
  98. data/rbi/openai/errors.rbi +5 -5
  99. data/rbi/openai/internal/conversation_cursor_page.rbi +25 -0
  100. data/rbi/openai/models/conversations/computer_screenshot_content.rbi +60 -0
  101. data/rbi/openai/models/conversations/container_file_citation_body.rbi +82 -0
  102. data/rbi/openai/models/conversations/conversation.rbi +76 -0
  103. data/rbi/openai/models/conversations/conversation_create_params.rbi +144 -0
  104. data/rbi/openai/models/conversations/conversation_delete_params.rbi +32 -0
  105. data/rbi/openai/models/conversations/conversation_deleted.rbi +40 -0
  106. data/rbi/openai/models/conversations/conversation_deleted_resource.rbi +40 -0
  107. data/rbi/openai/models/conversations/conversation_item.rbi +835 -0
  108. data/rbi/openai/models/conversations/conversation_item_list.rbi +101 -0
  109. data/rbi/openai/models/conversations/conversation_retrieve_params.rbi +32 -0
  110. data/rbi/openai/models/conversations/conversation_update_params.rbi +56 -0
  111. data/rbi/openai/models/conversations/file_citation_body.rbi +61 -0
  112. data/rbi/openai/models/conversations/input_file_content.rbi +72 -0
  113. data/rbi/openai/models/conversations/input_image_content.rbi +113 -0
  114. data/rbi/openai/models/conversations/input_text_content.rbi +38 -0
  115. data/rbi/openai/models/conversations/item_create_params.rbi +150 -0
  116. data/rbi/openai/models/conversations/item_delete_params.rbi +40 -0
  117. data/rbi/openai/models/conversations/item_list_params.rbi +178 -0
  118. data/rbi/openai/models/conversations/item_retrieve_params.rbi +70 -0
  119. data/rbi/openai/models/conversations/lob_prob.rbi +50 -0
  120. data/rbi/openai/models/conversations/message.rbi +196 -0
  121. data/rbi/openai/models/conversations/output_text_content.rbi +110 -0
  122. data/rbi/openai/models/conversations/refusal_content.rbi +38 -0
  123. data/rbi/openai/models/conversations/summary_text_content.rbi +31 -0
  124. data/rbi/openai/models/conversations/text_content.rbi +28 -0
  125. data/rbi/openai/models/conversations/top_log_prob.rbi +41 -0
  126. data/rbi/openai/models/conversations/url_citation_body.rbi +74 -0
  127. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +33 -33
  128. data/rbi/openai/models/evals/run_cancel_response.rbi +2 -0
  129. data/rbi/openai/models/evals/run_create_params.rbi +4 -0
  130. data/rbi/openai/models/evals/run_create_response.rbi +2 -0
  131. data/rbi/openai/models/evals/run_list_response.rbi +2 -0
  132. data/rbi/openai/models/evals/run_retrieve_response.rbi +2 -0
  133. data/rbi/openai/models/responses/input_item_list_params.rbi +0 -11
  134. data/rbi/openai/models/responses/response.rbi +50 -0
  135. data/rbi/openai/models/responses/response_conversation_param.rbi +33 -0
  136. data/rbi/openai/models/responses/response_create_params.rbi +62 -0
  137. data/rbi/openai/models/responses/response_function_web_search.rbi +78 -2
  138. data/rbi/openai/models/responses/response_includable.rbi +2 -0
  139. data/rbi/openai/models/responses/tool.rbi +590 -31
  140. data/rbi/openai/models.rbi +2 -0
  141. data/rbi/openai/resources/conversations/items.rbi +154 -0
  142. data/rbi/openai/resources/conversations.rbi +110 -0
  143. data/rbi/openai/resources/responses/input_items.rbi +0 -3
  144. data/rbi/openai/resources/responses.rbi +32 -0
  145. data/sig/openai/client.rbs +2 -0
  146. data/sig/openai/internal/conversation_cursor_page.rbs +15 -0
  147. data/sig/openai/models/conversations/computer_screenshot_content.rbs +28 -0
  148. data/sig/openai/models/conversations/container_file_citation_body.rbs +47 -0
  149. data/sig/openai/models/conversations/conversation.rbs +37 -0
  150. data/sig/openai/models/conversations/conversation_create_params.rbs +33 -0
  151. data/sig/openai/models/conversations/conversation_delete_params.rbs +17 -0
  152. data/sig/openai/models/conversations/conversation_deleted.rbs +28 -0
  153. data/sig/openai/models/conversations/conversation_deleted_resource.rbs +28 -0
  154. data/sig/openai/models/conversations/conversation_item.rbs +403 -0
  155. data/sig/openai/models/conversations/conversation_item_list.rbs +44 -0
  156. data/sig/openai/models/conversations/conversation_retrieve_params.rbs +17 -0
  157. data/sig/openai/models/conversations/conversation_update_params.rbs +26 -0
  158. data/sig/openai/models/conversations/file_citation_body.rbs +37 -0
  159. data/sig/openai/models/conversations/input_file_content.rbs +41 -0
  160. data/sig/openai/models/conversations/input_image_content.rbs +49 -0
  161. data/sig/openai/models/conversations/input_text_content.rbs +17 -0
  162. data/sig/openai/models/conversations/item_create_params.rbs +37 -0
  163. data/sig/openai/models/conversations/item_delete_params.rbs +25 -0
  164. data/sig/openai/models/conversations/item_list_params.rbs +66 -0
  165. data/sig/openai/models/conversations/item_retrieve_params.rbs +37 -0
  166. data/sig/openai/models/conversations/lob_prob.rbs +37 -0
  167. data/sig/openai/models/conversations/message.rbs +95 -0
  168. data/sig/openai/models/conversations/output_text_content.rbs +52 -0
  169. data/sig/openai/models/conversations/refusal_content.rbs +17 -0
  170. data/sig/openai/models/conversations/summary_text_content.rbs +17 -0
  171. data/sig/openai/models/conversations/text_content.rbs +17 -0
  172. data/sig/openai/models/conversations/top_log_prob.rbs +28 -0
  173. data/sig/openai/models/conversations/url_citation_body.rbs +42 -0
  174. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +22 -22
  175. data/sig/openai/models/responses/input_item_list_params.rbs +0 -7
  176. data/sig/openai/models/responses/response.rbs +15 -0
  177. data/sig/openai/models/responses/response_conversation_param.rbs +15 -0
  178. data/sig/openai/models/responses/response_create_params.rbs +14 -0
  179. data/sig/openai/models/responses/response_function_web_search.rbs +34 -3
  180. data/sig/openai/models/responses/tool.rbs +204 -18
  181. data/sig/openai/models.rbs +2 -0
  182. data/sig/openai/resources/conversations/items.rbs +38 -0
  183. data/sig/openai/resources/conversations.rbs +31 -0
  184. data/sig/openai/resources/responses/input_items.rbs +0 -1
  185. data/sig/openai/resources/responses.rbs +2 -0
  186. metadata +95 -2
@@ -0,0 +1,178 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class ItemListParams < OpenAI::Internal::Type::BaseModel
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ OpenAI::Conversations::ItemListParams,
14
+ OpenAI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # An item ID to list items after, used in pagination.
19
+ sig { returns(T.nilable(String)) }
20
+ attr_reader :after
21
+
22
+ sig { params(after: String).void }
23
+ attr_writer :after
24
+
25
+ # Specify additional output data to include in the model response. Currently
26
+ # supported values are:
27
+ #
28
+ # - `web_search_call.action.sources`: Include the sources of the web search tool
29
+ # call.
30
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
31
+ # in code interpreter tool call items.
32
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
33
+ # call output.
34
+ # - `file_search_call.results`: Include the search results of the file search tool
35
+ # call.
36
+ # - `message.input_image.image_url`: Include image urls from the input message.
37
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
38
+ # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
39
+ # tokens in reasoning item outputs. This enables reasoning items to be used in
40
+ # multi-turn conversations when using the Responses API statelessly (like when
41
+ # the `store` parameter is set to `false`, or when an organization is enrolled
42
+ # in the zero data retention program).
43
+ sig do
44
+ returns(
45
+ T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol])
46
+ )
47
+ end
48
+ attr_reader :include
49
+
50
+ sig do
51
+ params(
52
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
53
+ ).void
54
+ end
55
+ attr_writer :include
56
+
57
+ # A limit on the number of objects to be returned. Limit can range between 1 and
58
+ # 100, and the default is 20.
59
+ sig { returns(T.nilable(Integer)) }
60
+ attr_reader :limit
61
+
62
+ sig { params(limit: Integer).void }
63
+ attr_writer :limit
64
+
65
+ # The order to return the input items in. Default is `desc`.
66
+ #
67
+ # - `asc`: Return the input items in ascending order.
68
+ # - `desc`: Return the input items in descending order.
69
+ sig do
70
+ returns(
71
+ T.nilable(OpenAI::Conversations::ItemListParams::Order::OrSymbol)
72
+ )
73
+ end
74
+ attr_reader :order
75
+
76
+ sig do
77
+ params(
78
+ order: OpenAI::Conversations::ItemListParams::Order::OrSymbol
79
+ ).void
80
+ end
81
+ attr_writer :order
82
+
83
+ sig do
84
+ params(
85
+ after: String,
86
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
87
+ limit: Integer,
88
+ order: OpenAI::Conversations::ItemListParams::Order::OrSymbol,
89
+ request_options: OpenAI::RequestOptions::OrHash
90
+ ).returns(T.attached_class)
91
+ end
92
+ def self.new(
93
+ # An item ID to list items after, used in pagination.
94
+ after: nil,
95
+ # Specify additional output data to include in the model response. Currently
96
+ # supported values are:
97
+ #
98
+ # - `web_search_call.action.sources`: Include the sources of the web search tool
99
+ # call.
100
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
101
+ # in code interpreter tool call items.
102
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
103
+ # call output.
104
+ # - `file_search_call.results`: Include the search results of the file search tool
105
+ # call.
106
+ # - `message.input_image.image_url`: Include image urls from the input message.
107
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
108
+ # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
109
+ # tokens in reasoning item outputs. This enables reasoning items to be used in
110
+ # multi-turn conversations when using the Responses API statelessly (like when
111
+ # the `store` parameter is set to `false`, or when an organization is enrolled
112
+ # in the zero data retention program).
113
+ include: nil,
114
+ # A limit on the number of objects to be returned. Limit can range between 1 and
115
+ # 100, and the default is 20.
116
+ limit: nil,
117
+ # The order to return the input items in. Default is `desc`.
118
+ #
119
+ # - `asc`: Return the input items in ascending order.
120
+ # - `desc`: Return the input items in descending order.
121
+ order: nil,
122
+ request_options: {}
123
+ )
124
+ end
125
+
126
+ sig do
127
+ override.returns(
128
+ {
129
+ after: String,
130
+ include:
131
+ T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
132
+ limit: Integer,
133
+ order: OpenAI::Conversations::ItemListParams::Order::OrSymbol,
134
+ request_options: OpenAI::RequestOptions
135
+ }
136
+ )
137
+ end
138
+ def to_hash
139
+ end
140
+
141
+ # The order to return the input items in. Default is `desc`.
142
+ #
143
+ # - `asc`: Return the input items in ascending order.
144
+ # - `desc`: Return the input items in descending order.
145
+ module Order
146
+ extend OpenAI::Internal::Type::Enum
147
+
148
+ TaggedSymbol =
149
+ T.type_alias do
150
+ T.all(Symbol, OpenAI::Conversations::ItemListParams::Order)
151
+ end
152
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
153
+
154
+ ASC =
155
+ T.let(
156
+ :asc,
157
+ OpenAI::Conversations::ItemListParams::Order::TaggedSymbol
158
+ )
159
+ DESC =
160
+ T.let(
161
+ :desc,
162
+ OpenAI::Conversations::ItemListParams::Order::TaggedSymbol
163
+ )
164
+
165
+ sig do
166
+ override.returns(
167
+ T::Array[
168
+ OpenAI::Conversations::ItemListParams::Order::TaggedSymbol
169
+ ]
170
+ )
171
+ end
172
+ def self.values
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,70 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class ItemRetrieveParams < OpenAI::Internal::Type::BaseModel
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ OpenAI::Conversations::ItemRetrieveParams,
14
+ OpenAI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :conversation_id
20
+
21
+ # Additional fields to include in the response. See the `include` parameter for
22
+ # [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
23
+ # for more information.
24
+ sig do
25
+ returns(
26
+ T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol])
27
+ )
28
+ end
29
+ attr_reader :include
30
+
31
+ sig do
32
+ params(
33
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
34
+ ).void
35
+ end
36
+ attr_writer :include
37
+
38
+ sig do
39
+ params(
40
+ conversation_id: String,
41
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
42
+ request_options: OpenAI::RequestOptions::OrHash
43
+ ).returns(T.attached_class)
44
+ end
45
+ def self.new(
46
+ conversation_id:,
47
+ # Additional fields to include in the response. See the `include` parameter for
48
+ # [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
49
+ # for more information.
50
+ include: nil,
51
+ request_options: {}
52
+ )
53
+ end
54
+
55
+ sig do
56
+ override.returns(
57
+ {
58
+ conversation_id: String,
59
+ include:
60
+ T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
61
+ request_options: OpenAI::RequestOptions
62
+ }
63
+ )
64
+ end
65
+ def to_hash
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,50 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class LobProb < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(OpenAI::Conversations::LobProb, OpenAI::Internal::AnyHash)
10
+ end
11
+
12
+ sig { returns(String) }
13
+ attr_accessor :token
14
+
15
+ sig { returns(T::Array[Integer]) }
16
+ attr_accessor :bytes
17
+
18
+ sig { returns(Float) }
19
+ attr_accessor :logprob
20
+
21
+ sig { returns(T::Array[OpenAI::Conversations::TopLogProb]) }
22
+ attr_accessor :top_logprobs
23
+
24
+ sig do
25
+ params(
26
+ token: String,
27
+ bytes: T::Array[Integer],
28
+ logprob: Float,
29
+ top_logprobs: T::Array[OpenAI::Conversations::TopLogProb::OrHash]
30
+ ).returns(T.attached_class)
31
+ end
32
+ def self.new(token:, bytes:, logprob:, top_logprobs:)
33
+ end
34
+
35
+ sig do
36
+ override.returns(
37
+ {
38
+ token: String,
39
+ bytes: T::Array[Integer],
40
+ logprob: Float,
41
+ top_logprobs: T::Array[OpenAI::Conversations::TopLogProb]
42
+ }
43
+ )
44
+ end
45
+ def to_hash
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,196 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class Message < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(OpenAI::Conversations::Message, OpenAI::Internal::AnyHash)
10
+ end
11
+
12
+ # The unique ID of the message.
13
+ sig { returns(String) }
14
+ attr_accessor :id
15
+
16
+ # The content of the message
17
+ sig do
18
+ returns(T::Array[OpenAI::Conversations::Message::Content::Variants])
19
+ end
20
+ attr_accessor :content
21
+
22
+ # The role of the message. One of `unknown`, `user`, `assistant`, `system`,
23
+ # `critic`, `discriminator`, `developer`, or `tool`.
24
+ sig { returns(OpenAI::Conversations::Message::Role::TaggedSymbol) }
25
+ attr_accessor :role
26
+
27
+ # The status of item. One of `in_progress`, `completed`, or `incomplete`.
28
+ # Populated when items are returned via API.
29
+ sig { returns(OpenAI::Conversations::Message::Status::TaggedSymbol) }
30
+ attr_accessor :status
31
+
32
+ # The type of the message. Always set to `message`.
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ sig do
37
+ params(
38
+ id: String,
39
+ content:
40
+ T::Array[
41
+ T.any(
42
+ OpenAI::Conversations::InputTextContent::OrHash,
43
+ OpenAI::Conversations::OutputTextContent::OrHash,
44
+ OpenAI::Conversations::TextContent::OrHash,
45
+ OpenAI::Conversations::SummaryTextContent::OrHash,
46
+ OpenAI::Conversations::RefusalContent::OrHash,
47
+ OpenAI::Conversations::InputImageContent::OrHash,
48
+ OpenAI::Conversations::ComputerScreenshotContent::OrHash,
49
+ OpenAI::Conversations::InputFileContent::OrHash
50
+ )
51
+ ],
52
+ role: OpenAI::Conversations::Message::Role::OrSymbol,
53
+ status: OpenAI::Conversations::Message::Status::OrSymbol,
54
+ type: Symbol
55
+ ).returns(T.attached_class)
56
+ end
57
+ def self.new(
58
+ # The unique ID of the message.
59
+ id:,
60
+ # The content of the message
61
+ content:,
62
+ # The role of the message. One of `unknown`, `user`, `assistant`, `system`,
63
+ # `critic`, `discriminator`, `developer`, or `tool`.
64
+ role:,
65
+ # The status of item. One of `in_progress`, `completed`, or `incomplete`.
66
+ # Populated when items are returned via API.
67
+ status:,
68
+ # The type of the message. Always set to `message`.
69
+ type: :message
70
+ )
71
+ end
72
+
73
+ sig do
74
+ override.returns(
75
+ {
76
+ id: String,
77
+ content:
78
+ T::Array[OpenAI::Conversations::Message::Content::Variants],
79
+ role: OpenAI::Conversations::Message::Role::TaggedSymbol,
80
+ status: OpenAI::Conversations::Message::Status::TaggedSymbol,
81
+ type: Symbol
82
+ }
83
+ )
84
+ end
85
+ def to_hash
86
+ end
87
+
88
+ module Content
89
+ extend OpenAI::Internal::Type::Union
90
+
91
+ Variants =
92
+ T.type_alias do
93
+ T.any(
94
+ OpenAI::Conversations::InputTextContent,
95
+ OpenAI::Conversations::OutputTextContent,
96
+ OpenAI::Conversations::TextContent,
97
+ OpenAI::Conversations::SummaryTextContent,
98
+ OpenAI::Conversations::RefusalContent,
99
+ OpenAI::Conversations::InputImageContent,
100
+ OpenAI::Conversations::ComputerScreenshotContent,
101
+ OpenAI::Conversations::InputFileContent
102
+ )
103
+ end
104
+
105
+ sig do
106
+ override.returns(
107
+ T::Array[OpenAI::Conversations::Message::Content::Variants]
108
+ )
109
+ end
110
+ def self.variants
111
+ end
112
+ end
113
+
114
+ # The role of the message. One of `unknown`, `user`, `assistant`, `system`,
115
+ # `critic`, `discriminator`, `developer`, or `tool`.
116
+ module Role
117
+ extend OpenAI::Internal::Type::Enum
118
+
119
+ TaggedSymbol =
120
+ T.type_alias { T.all(Symbol, OpenAI::Conversations::Message::Role) }
121
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
122
+
123
+ UNKNOWN =
124
+ T.let(:unknown, OpenAI::Conversations::Message::Role::TaggedSymbol)
125
+ USER =
126
+ T.let(:user, OpenAI::Conversations::Message::Role::TaggedSymbol)
127
+ ASSISTANT =
128
+ T.let(
129
+ :assistant,
130
+ OpenAI::Conversations::Message::Role::TaggedSymbol
131
+ )
132
+ SYSTEM =
133
+ T.let(:system, OpenAI::Conversations::Message::Role::TaggedSymbol)
134
+ CRITIC =
135
+ T.let(:critic, OpenAI::Conversations::Message::Role::TaggedSymbol)
136
+ DISCRIMINATOR =
137
+ T.let(
138
+ :discriminator,
139
+ OpenAI::Conversations::Message::Role::TaggedSymbol
140
+ )
141
+ DEVELOPER =
142
+ T.let(
143
+ :developer,
144
+ OpenAI::Conversations::Message::Role::TaggedSymbol
145
+ )
146
+ TOOL =
147
+ T.let(:tool, OpenAI::Conversations::Message::Role::TaggedSymbol)
148
+
149
+ sig do
150
+ override.returns(
151
+ T::Array[OpenAI::Conversations::Message::Role::TaggedSymbol]
152
+ )
153
+ end
154
+ def self.values
155
+ end
156
+ end
157
+
158
+ # The status of item. One of `in_progress`, `completed`, or `incomplete`.
159
+ # Populated when items are returned via API.
160
+ module Status
161
+ extend OpenAI::Internal::Type::Enum
162
+
163
+ TaggedSymbol =
164
+ T.type_alias do
165
+ T.all(Symbol, OpenAI::Conversations::Message::Status)
166
+ end
167
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
168
+
169
+ IN_PROGRESS =
170
+ T.let(
171
+ :in_progress,
172
+ OpenAI::Conversations::Message::Status::TaggedSymbol
173
+ )
174
+ COMPLETED =
175
+ T.let(
176
+ :completed,
177
+ OpenAI::Conversations::Message::Status::TaggedSymbol
178
+ )
179
+ INCOMPLETE =
180
+ T.let(
181
+ :incomplete,
182
+ OpenAI::Conversations::Message::Status::TaggedSymbol
183
+ )
184
+
185
+ sig do
186
+ override.returns(
187
+ T::Array[OpenAI::Conversations::Message::Status::TaggedSymbol]
188
+ )
189
+ end
190
+ def self.values
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,110 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class OutputTextContent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Conversations::OutputTextContent,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The annotations of the text output.
16
+ sig do
17
+ returns(
18
+ T::Array[
19
+ OpenAI::Conversations::OutputTextContent::Annotation::Variants
20
+ ]
21
+ )
22
+ end
23
+ attr_accessor :annotations
24
+
25
+ # The text output from the model.
26
+ sig { returns(String) }
27
+ attr_accessor :text
28
+
29
+ # The type of the output text. Always `output_text`.
30
+ sig { returns(Symbol) }
31
+ attr_accessor :type
32
+
33
+ sig { returns(T.nilable(T::Array[OpenAI::Conversations::LobProb])) }
34
+ attr_reader :logprobs
35
+
36
+ sig do
37
+ params(
38
+ logprobs: T::Array[OpenAI::Conversations::LobProb::OrHash]
39
+ ).void
40
+ end
41
+ attr_writer :logprobs
42
+
43
+ sig do
44
+ params(
45
+ annotations:
46
+ T::Array[
47
+ T.any(
48
+ OpenAI::Conversations::FileCitationBody::OrHash,
49
+ OpenAI::Conversations::URLCitationBody::OrHash,
50
+ OpenAI::Conversations::ContainerFileCitationBody::OrHash
51
+ )
52
+ ],
53
+ text: String,
54
+ logprobs: T::Array[OpenAI::Conversations::LobProb::OrHash],
55
+ type: Symbol
56
+ ).returns(T.attached_class)
57
+ end
58
+ def self.new(
59
+ # The annotations of the text output.
60
+ annotations:,
61
+ # The text output from the model.
62
+ text:,
63
+ logprobs: nil,
64
+ # The type of the output text. Always `output_text`.
65
+ type: :output_text
66
+ )
67
+ end
68
+
69
+ sig do
70
+ override.returns(
71
+ {
72
+ annotations:
73
+ T::Array[
74
+ OpenAI::Conversations::OutputTextContent::Annotation::Variants
75
+ ],
76
+ text: String,
77
+ type: Symbol,
78
+ logprobs: T::Array[OpenAI::Conversations::LobProb]
79
+ }
80
+ )
81
+ end
82
+ def to_hash
83
+ end
84
+
85
+ module Annotation
86
+ extend OpenAI::Internal::Type::Union
87
+
88
+ Variants =
89
+ T.type_alias do
90
+ T.any(
91
+ OpenAI::Conversations::FileCitationBody,
92
+ OpenAI::Conversations::URLCitationBody,
93
+ OpenAI::Conversations::ContainerFileCitationBody
94
+ )
95
+ end
96
+
97
+ sig do
98
+ override.returns(
99
+ T::Array[
100
+ OpenAI::Conversations::OutputTextContent::Annotation::Variants
101
+ ]
102
+ )
103
+ end
104
+ def self.variants
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,38 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class RefusalContent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Conversations::RefusalContent,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The refusal explanation from the model.
16
+ sig { returns(String) }
17
+ attr_accessor :refusal
18
+
19
+ # The type of the refusal. Always `refusal`.
20
+ sig { returns(Symbol) }
21
+ attr_accessor :type
22
+
23
+ sig { params(refusal: String, type: Symbol).returns(T.attached_class) }
24
+ def self.new(
25
+ # The refusal explanation from the model.
26
+ refusal:,
27
+ # The type of the refusal. Always `refusal`.
28
+ type: :refusal
29
+ )
30
+ end
31
+
32
+ sig { override.returns({ refusal: String, type: Symbol }) }
33
+ def to_hash
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,31 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class SummaryTextContent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Conversations::SummaryTextContent,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ sig { returns(String) }
16
+ attr_accessor :text
17
+
18
+ sig { returns(Symbol) }
19
+ attr_accessor :type
20
+
21
+ sig { params(text: String, type: Symbol).returns(T.attached_class) }
22
+ def self.new(text:, type: :summary_text)
23
+ end
24
+
25
+ sig { override.returns({ text: String, type: Symbol }) }
26
+ def to_hash
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Conversations
6
+ class TextContent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(OpenAI::Conversations::TextContent, OpenAI::Internal::AnyHash)
10
+ end
11
+
12
+ sig { returns(String) }
13
+ attr_accessor :text
14
+
15
+ sig { returns(Symbol) }
16
+ attr_accessor :type
17
+
18
+ sig { params(text: String, type: Symbol).returns(T.attached_class) }
19
+ def self.new(text:, type: :text)
20
+ end
21
+
22
+ sig { override.returns({ text: String, type: Symbol }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end