openai 0.18.1 → 0.19.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +1 -1
- data/lib/openai/client.rb +4 -0
- data/lib/openai/helpers/structured_output/boolean.rb +1 -0
- data/lib/openai/internal/conversation_cursor_page.rb +92 -0
- data/lib/openai/internal/transport/base_client.rb +1 -4
- data/lib/openai/internal/transport/pooled_net_requester.rb +1 -9
- data/lib/openai/internal/util.rb +1 -1
- data/lib/openai/models/audio/transcription.rb +1 -4
- data/lib/openai/models/audio/transcription_create_params.rb +2 -7
- data/lib/openai/models/audio/transcription_text_done_event.rb +1 -4
- data/lib/openai/models/beta/assistant_create_params.rb +6 -19
- data/lib/openai/models/beta/assistant_stream_event.rb +6 -24
- data/lib/openai/models/beta/assistant_update_params.rb +1 -4
- data/lib/openai/models/beta/message_stream_event.rb +1 -4
- data/lib/openai/models/beta/run_step_stream_event.rb +1 -4
- data/lib/openai/models/beta/thread_create_and_run_params.rb +10 -32
- data/lib/openai/models/beta/thread_create_params.rb +7 -22
- data/lib/openai/models/beta/threads/message.rb +3 -10
- data/lib/openai/models/beta/threads/message_create_params.rb +2 -7
- data/lib/openai/models/beta/threads/run.rb +2 -7
- data/lib/openai/models/beta/threads/run_create_params.rb +3 -10
- data/lib/openai/models/beta/threads/run_submit_tool_outputs_params.rb +1 -3
- data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call.rb +5 -17
- data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rb +1 -3
- data/lib/openai/models/beta/threads/runs/file_search_tool_call.rb +4 -12
- data/lib/openai/models/beta/threads/runs/run_step_delta_message_delta.rb +1 -4
- data/lib/openai/models/beta/threads/runs/tool_calls_step_details.rb +1 -4
- data/lib/openai/models/beta/threads/text.rb +1 -4
- data/lib/openai/models/chat/chat_completion_chunk.rb +1 -3
- data/lib/openai/models/chat/chat_completion_custom_tool.rb +2 -7
- data/lib/openai/models/conversations/computer_screenshot_content.rb +38 -0
- data/lib/openai/models/conversations/container_file_citation_body.rb +58 -0
- data/lib/openai/models/conversations/conversation.rb +51 -0
- data/lib/openai/models/conversations/conversation_create_params.rb +39 -0
- data/lib/openai/models/conversations/conversation_delete_params.rb +16 -0
- data/lib/openai/models/conversations/conversation_deleted.rb +29 -0
- data/lib/openai/models/conversations/conversation_deleted_resource.rb +30 -0
- data/lib/openai/models/conversations/conversation_item.rb +568 -0
- data/lib/openai/models/conversations/conversation_item_list.rb +55 -0
- data/lib/openai/models/conversations/conversation_retrieve_params.rb +16 -0
- data/lib/openai/models/conversations/conversation_update_params.rb +31 -0
- data/lib/openai/models/conversations/file_citation_body.rb +42 -0
- data/lib/openai/models/conversations/input_file_content.rb +42 -0
- data/lib/openai/models/conversations/input_image_content.rb +62 -0
- data/lib/openai/models/conversations/input_text_content.rb +26 -0
- data/lib/openai/models/conversations/item_create_params.rb +37 -0
- data/lib/openai/models/conversations/item_delete_params.rb +22 -0
- data/lib/openai/models/conversations/item_list_params.rb +84 -0
- data/lib/openai/models/conversations/item_retrieve_params.rb +36 -0
- data/lib/openai/models/conversations/lob_prob.rb +35 -0
- data/lib/openai/models/conversations/message.rb +115 -0
- data/lib/openai/models/conversations/output_text_content.rb +57 -0
- data/lib/openai/models/conversations/refusal_content.rb +26 -0
- data/lib/openai/models/conversations/summary_text_content.rb +23 -0
- data/lib/openai/models/conversations/text_content.rb +23 -0
- data/lib/openai/models/conversations/top_log_prob.rb +29 -0
- data/lib/openai/models/conversations/url_citation_body.rb +50 -0
- data/lib/openai/models/eval_create_params.rb +6 -20
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +29 -53
- data/lib/openai/models/evals/create_eval_jsonl_run_data_source.rb +1 -3
- data/lib/openai/models/evals/run_create_params.rb +18 -54
- data/lib/openai/models/fine_tuning/reinforcement_hyperparameters.rb +1 -4
- data/lib/openai/models/moderation.rb +5 -15
- data/lib/openai/models/responses/input_item_list_params.rb +1 -9
- data/lib/openai/models/responses/response.rb +26 -1
- data/lib/openai/models/responses/response_computer_tool_call.rb +2 -6
- data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +1 -3
- data/lib/openai/models/responses/response_conversation_param.rb +20 -0
- data/lib/openai/models/responses/response_create_params.rb +34 -1
- data/lib/openai/models/responses/response_input_item.rb +2 -7
- data/lib/openai/models/responses/response_input_message_item.rb +1 -4
- data/lib/openai/models/responses/response_output_item.rb +1 -3
- data/lib/openai/models/responses/response_output_message.rb +1 -3
- data/lib/openai/models/responses/response_output_text.rb +3 -10
- data/lib/openai/models/responses/response_stream_event.rb +4 -16
- data/lib/openai/models/responses/response_text_delta_event.rb +1 -3
- data/lib/openai/models/responses/response_text_done_event.rb +1 -3
- data/lib/openai/models/responses/tool.rb +145 -34
- data/lib/openai/models.rb +2 -0
- data/lib/openai/resources/conversations/items.rb +141 -0
- data/lib/openai/resources/conversations.rb +112 -0
- data/lib/openai/resources/responses/input_items.rb +1 -3
- data/lib/openai/resources/responses.rb +6 -2
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +31 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/errors.rbi +5 -5
- data/rbi/openai/internal/conversation_cursor_page.rbi +25 -0
- data/rbi/openai/models/conversations/computer_screenshot_content.rbi +60 -0
- data/rbi/openai/models/conversations/container_file_citation_body.rbi +82 -0
- data/rbi/openai/models/conversations/conversation.rbi +76 -0
- data/rbi/openai/models/conversations/conversation_create_params.rbi +144 -0
- data/rbi/openai/models/conversations/conversation_delete_params.rbi +32 -0
- data/rbi/openai/models/conversations/conversation_deleted.rbi +40 -0
- data/rbi/openai/models/conversations/conversation_deleted_resource.rbi +40 -0
- data/rbi/openai/models/conversations/conversation_item.rbi +835 -0
- data/rbi/openai/models/conversations/conversation_item_list.rbi +101 -0
- data/rbi/openai/models/conversations/conversation_retrieve_params.rbi +32 -0
- data/rbi/openai/models/conversations/conversation_update_params.rbi +56 -0
- data/rbi/openai/models/conversations/file_citation_body.rbi +61 -0
- data/rbi/openai/models/conversations/input_file_content.rbi +72 -0
- data/rbi/openai/models/conversations/input_image_content.rbi +113 -0
- data/rbi/openai/models/conversations/input_text_content.rbi +38 -0
- data/rbi/openai/models/conversations/item_create_params.rbi +150 -0
- data/rbi/openai/models/conversations/item_delete_params.rbi +40 -0
- data/rbi/openai/models/conversations/item_list_params.rbi +174 -0
- data/rbi/openai/models/conversations/item_retrieve_params.rbi +70 -0
- data/rbi/openai/models/conversations/lob_prob.rbi +50 -0
- data/rbi/openai/models/conversations/message.rbi +196 -0
- data/rbi/openai/models/conversations/output_text_content.rbi +110 -0
- data/rbi/openai/models/conversations/refusal_content.rbi +38 -0
- data/rbi/openai/models/conversations/summary_text_content.rbi +31 -0
- data/rbi/openai/models/conversations/text_content.rbi +28 -0
- data/rbi/openai/models/conversations/top_log_prob.rbi +41 -0
- data/rbi/openai/models/conversations/url_citation_body.rbi +74 -0
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +33 -33
- data/rbi/openai/models/responses/input_item_list_params.rbi +0 -11
- data/rbi/openai/models/responses/response.rbi +49 -0
- data/rbi/openai/models/responses/response_conversation_param.rbi +33 -0
- data/rbi/openai/models/responses/response_create_params.rbi +54 -0
- data/rbi/openai/models/responses/tool.rbi +243 -31
- data/rbi/openai/models.rbi +2 -0
- data/rbi/openai/resources/conversations/items.rbi +152 -0
- data/rbi/openai/resources/conversations.rbi +110 -0
- data/rbi/openai/resources/responses/input_items.rbi +0 -3
- data/rbi/openai/resources/responses.rbi +26 -0
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/internal/conversation_cursor_page.rbs +15 -0
- data/sig/openai/models/conversations/computer_screenshot_content.rbs +28 -0
- data/sig/openai/models/conversations/container_file_citation_body.rbs +47 -0
- data/sig/openai/models/conversations/conversation.rbs +37 -0
- data/sig/openai/models/conversations/conversation_create_params.rbs +33 -0
- data/sig/openai/models/conversations/conversation_delete_params.rbs +17 -0
- data/sig/openai/models/conversations/conversation_deleted.rbs +28 -0
- data/sig/openai/models/conversations/conversation_deleted_resource.rbs +28 -0
- data/sig/openai/models/conversations/conversation_item.rbs +403 -0
- data/sig/openai/models/conversations/conversation_item_list.rbs +44 -0
- data/sig/openai/models/conversations/conversation_retrieve_params.rbs +17 -0
- data/sig/openai/models/conversations/conversation_update_params.rbs +26 -0
- data/sig/openai/models/conversations/file_citation_body.rbs +37 -0
- data/sig/openai/models/conversations/input_file_content.rbs +41 -0
- data/sig/openai/models/conversations/input_image_content.rbs +49 -0
- data/sig/openai/models/conversations/input_text_content.rbs +17 -0
- data/sig/openai/models/conversations/item_create_params.rbs +37 -0
- data/sig/openai/models/conversations/item_delete_params.rbs +25 -0
- data/sig/openai/models/conversations/item_list_params.rbs +66 -0
- data/sig/openai/models/conversations/item_retrieve_params.rbs +37 -0
- data/sig/openai/models/conversations/lob_prob.rbs +37 -0
- data/sig/openai/models/conversations/message.rbs +95 -0
- data/sig/openai/models/conversations/output_text_content.rbs +52 -0
- data/sig/openai/models/conversations/refusal_content.rbs +17 -0
- data/sig/openai/models/conversations/summary_text_content.rbs +17 -0
- data/sig/openai/models/conversations/text_content.rbs +17 -0
- data/sig/openai/models/conversations/top_log_prob.rbs +28 -0
- data/sig/openai/models/conversations/url_citation_body.rbs +42 -0
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +22 -22
- data/sig/openai/models/responses/input_item_list_params.rbs +0 -7
- data/sig/openai/models/responses/response.rbs +15 -0
- data/sig/openai/models/responses/response_conversation_param.rbs +15 -0
- data/sig/openai/models/responses/response_create_params.rbs +14 -0
- data/sig/openai/models/responses/tool.rbs +83 -18
- data/sig/openai/models.rbs +2 -0
- data/sig/openai/resources/conversations/items.rbs +38 -0
- data/sig/openai/resources/conversations.rbs +31 -0
- data/sig/openai/resources/responses/input_items.rbs +0 -1
- data/sig/openai/resources/responses.rbs +2 -0
- metadata +95 -2
@@ -0,0 +1,174 @@
|
|
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
|
+
# - `code_interpreter_call.outputs`: Includes the outputs of python code execution
|
29
|
+
# in code interpreter tool call items.
|
30
|
+
# - `computer_call_output.output.image_url`: Include image urls from the computer
|
31
|
+
# call output.
|
32
|
+
# - `file_search_call.results`: Include the search results of the file search tool
|
33
|
+
# call.
|
34
|
+
# - `message.input_image.image_url`: Include image urls from the input message.
|
35
|
+
# - `message.output_text.logprobs`: Include logprobs with assistant messages.
|
36
|
+
# - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
|
37
|
+
# tokens in reasoning item outputs. This enables reasoning items to be used in
|
38
|
+
# multi-turn conversations when using the Responses API statelessly (like when
|
39
|
+
# the `store` parameter is set to `false`, or when an organization is enrolled
|
40
|
+
# in the zero data retention program).
|
41
|
+
sig do
|
42
|
+
returns(
|
43
|
+
T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol])
|
44
|
+
)
|
45
|
+
end
|
46
|
+
attr_reader :include
|
47
|
+
|
48
|
+
sig do
|
49
|
+
params(
|
50
|
+
include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
|
51
|
+
).void
|
52
|
+
end
|
53
|
+
attr_writer :include
|
54
|
+
|
55
|
+
# A limit on the number of objects to be returned. Limit can range between 1 and
|
56
|
+
# 100, and the default is 20.
|
57
|
+
sig { returns(T.nilable(Integer)) }
|
58
|
+
attr_reader :limit
|
59
|
+
|
60
|
+
sig { params(limit: Integer).void }
|
61
|
+
attr_writer :limit
|
62
|
+
|
63
|
+
# The order to return the input items in. Default is `desc`.
|
64
|
+
#
|
65
|
+
# - `asc`: Return the input items in ascending order.
|
66
|
+
# - `desc`: Return the input items in descending order.
|
67
|
+
sig do
|
68
|
+
returns(
|
69
|
+
T.nilable(OpenAI::Conversations::ItemListParams::Order::OrSymbol)
|
70
|
+
)
|
71
|
+
end
|
72
|
+
attr_reader :order
|
73
|
+
|
74
|
+
sig do
|
75
|
+
params(
|
76
|
+
order: OpenAI::Conversations::ItemListParams::Order::OrSymbol
|
77
|
+
).void
|
78
|
+
end
|
79
|
+
attr_writer :order
|
80
|
+
|
81
|
+
sig do
|
82
|
+
params(
|
83
|
+
after: String,
|
84
|
+
include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
|
85
|
+
limit: Integer,
|
86
|
+
order: OpenAI::Conversations::ItemListParams::Order::OrSymbol,
|
87
|
+
request_options: OpenAI::RequestOptions::OrHash
|
88
|
+
).returns(T.attached_class)
|
89
|
+
end
|
90
|
+
def self.new(
|
91
|
+
# An item ID to list items after, used in pagination.
|
92
|
+
after: nil,
|
93
|
+
# Specify additional output data to include in the model response. Currently
|
94
|
+
# supported values are:
|
95
|
+
#
|
96
|
+
# - `code_interpreter_call.outputs`: Includes the outputs of python code execution
|
97
|
+
# in code interpreter tool call items.
|
98
|
+
# - `computer_call_output.output.image_url`: Include image urls from the computer
|
99
|
+
# call output.
|
100
|
+
# - `file_search_call.results`: Include the search results of the file search tool
|
101
|
+
# call.
|
102
|
+
# - `message.input_image.image_url`: Include image urls from the input message.
|
103
|
+
# - `message.output_text.logprobs`: Include logprobs with assistant messages.
|
104
|
+
# - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
|
105
|
+
# tokens in reasoning item outputs. This enables reasoning items to be used in
|
106
|
+
# multi-turn conversations when using the Responses API statelessly (like when
|
107
|
+
# the `store` parameter is set to `false`, or when an organization is enrolled
|
108
|
+
# in the zero data retention program).
|
109
|
+
include: nil,
|
110
|
+
# A limit on the number of objects to be returned. Limit can range between 1 and
|
111
|
+
# 100, and the default is 20.
|
112
|
+
limit: nil,
|
113
|
+
# The order to return the input items in. Default is `desc`.
|
114
|
+
#
|
115
|
+
# - `asc`: Return the input items in ascending order.
|
116
|
+
# - `desc`: Return the input items in descending order.
|
117
|
+
order: nil,
|
118
|
+
request_options: {}
|
119
|
+
)
|
120
|
+
end
|
121
|
+
|
122
|
+
sig do
|
123
|
+
override.returns(
|
124
|
+
{
|
125
|
+
after: String,
|
126
|
+
include:
|
127
|
+
T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
|
128
|
+
limit: Integer,
|
129
|
+
order: OpenAI::Conversations::ItemListParams::Order::OrSymbol,
|
130
|
+
request_options: OpenAI::RequestOptions
|
131
|
+
}
|
132
|
+
)
|
133
|
+
end
|
134
|
+
def to_hash
|
135
|
+
end
|
136
|
+
|
137
|
+
# The order to return the input items in. Default is `desc`.
|
138
|
+
#
|
139
|
+
# - `asc`: Return the input items in ascending order.
|
140
|
+
# - `desc`: Return the input items in descending order.
|
141
|
+
module Order
|
142
|
+
extend OpenAI::Internal::Type::Enum
|
143
|
+
|
144
|
+
TaggedSymbol =
|
145
|
+
T.type_alias do
|
146
|
+
T.all(Symbol, OpenAI::Conversations::ItemListParams::Order)
|
147
|
+
end
|
148
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
149
|
+
|
150
|
+
ASC =
|
151
|
+
T.let(
|
152
|
+
:asc,
|
153
|
+
OpenAI::Conversations::ItemListParams::Order::TaggedSymbol
|
154
|
+
)
|
155
|
+
DESC =
|
156
|
+
T.let(
|
157
|
+
:desc,
|
158
|
+
OpenAI::Conversations::ItemListParams::Order::TaggedSymbol
|
159
|
+
)
|
160
|
+
|
161
|
+
sig do
|
162
|
+
override.returns(
|
163
|
+
T::Array[
|
164
|
+
OpenAI::Conversations::ItemListParams::Order::TaggedSymbol
|
165
|
+
]
|
166
|
+
)
|
167
|
+
end
|
168
|
+
def self.values
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
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
|