openai 0.83.0 → 0.85.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 +59 -0
- data/README.md +1 -1
- data/SECURITY.md +10 -0
- data/docs/architecture/security-model.md +267 -0
- data/lib/openai/auth/workload_identity_auth.rb +17 -2
- data/lib/openai/client.rb +24 -6
- data/lib/openai/errors.rb +1 -1
- data/lib/openai/helpers/streaming/chat_completion_stream.rb +18 -10
- data/lib/openai/helpers/streaming/response_events.rb +2 -2
- data/lib/openai/helpers/streaming/response_stream.rb +80 -44
- data/lib/openai/helpers/structured_output/array_of.rb +2 -2
- data/lib/openai/helpers/structured_output/base_model.rb +19 -5
- data/lib/openai/helpers/structured_output/chat_completion_parser.rb +12 -3
- data/lib/openai/helpers/structured_output/json_schema_converter.rb +34 -11
- data/lib/openai/helpers/structured_output/response_parser.rb +1 -1
- data/lib/openai/internal/type/base_model.rb +2 -2
- data/lib/openai/internal/type/converter.rb +1 -1
- data/lib/openai/internal/util.rb +2 -2
- data/lib/openai/internal/vector_store_file_uploader.rb +1 -1
- data/lib/openai/models/admin/organization/usage_costs_params.rb +10 -1
- data/lib/openai/models/batch.rb +4 -4
- data/lib/openai/models/beta/beta_custom_tool.rb +13 -1
- data/lib/openai/models/beta/beta_function_tool.rb +8 -1
- data/lib/openai/models/beta/beta_namespace_tool.rb +10 -1
- data/lib/openai/models/beta/beta_response.rb +26 -18
- data/lib/openai/models/beta/beta_response_configuration_update_item.rb +103 -0
- data/lib/openai/models/beta/beta_response_configuration_update_item_param.rb +104 -0
- data/lib/openai/models/beta/beta_response_custom_tool_call.rb +9 -1
- data/lib/openai/models/beta/beta_response_custom_tool_call_item.rb +3 -1
- data/lib/openai/models/beta/beta_response_error.rb +96 -1
- data/lib/openai/models/beta/beta_response_function_tool_call.rb +9 -1
- data/lib/openai/models/beta/beta_response_function_tool_call_item.rb +3 -1
- data/lib/openai/models/beta/beta_response_incomplete_event.rb +4 -0
- data/lib/openai/models/beta/beta_response_inject_event.rb +2 -2
- data/lib/openai/models/beta/beta_response_inject_failed_event.rb +2 -2
- data/lib/openai/models/beta/beta_response_input_item.rb +6 -1
- data/lib/openai/models/beta/beta_response_item.rb +5 -1
- data/lib/openai/models/beta/beta_response_steer_accepted_event.rb +81 -0
- data/lib/openai/models/beta/beta_response_steer_error_code.rb +61 -0
- data/lib/openai/models/beta/beta_response_steer_event.rb +75 -0
- data/lib/openai/models/beta/beta_response_steer_failed_event.rb +151 -0
- data/lib/openai/models/beta/beta_response_steer_input.rb +360 -0
- data/lib/openai/models/beta/beta_response_steer_input_content.rb +28 -0
- data/lib/openai/models/beta/beta_response_steer_pending_event.rb +113 -0
- data/lib/openai/models/beta/beta_response_steer_pending_reason.rb +26 -0
- data/lib/openai/models/beta/beta_response_steer_required_input.rb +215 -0
- data/lib/openai/models/beta/beta_response_stream_event.rb +4 -0
- data/lib/openai/models/beta/beta_response_usage.rb +1 -12
- data/lib/openai/models/beta/beta_responses_client_event.rb +45 -16
- data/lib/openai/models/beta/beta_responses_server_event.rb +164 -2
- data/lib/openai/models/beta/response_compact_params.rb +13 -10
- data/lib/openai/models/beta/response_create_params.rb +14 -15
- data/lib/openai/models/beta/responses/beta_response_item_list.rb +2 -2
- data/lib/openai/models/beta/responses/input_token_count_params.rb +3 -3
- data/lib/openai/models/chat/completion_create_params.rb +8 -8
- data/lib/openai/models/chat_model.rb +1 -0
- data/lib/openai/models/completion_usage.rb +1 -12
- data/lib/openai/models/conversations/conversation_create_params.rb +2 -2
- data/lib/openai/models/conversations/conversation_item.rb +5 -1
- data/lib/openai/models/conversations/conversation_item_list.rb +2 -2
- data/lib/openai/models/conversations/item_create_params.rb +2 -2
- data/lib/openai/models/error_object.rb +90 -1
- data/lib/openai/models/eval_create_response.rb +1 -1
- data/lib/openai/models/eval_list_response.rb +1 -1
- data/lib/openai/models/eval_retrieve_response.rb +1 -1
- data/lib/openai/models/eval_update_response.rb +1 -1
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +2 -2
- data/lib/openai/models/reasoning.rb +0 -2
- data/lib/openai/models/responses/custom_tool.rb +13 -1
- data/lib/openai/models/responses/function_tool.rb +8 -1
- data/lib/openai/models/responses/input_token_count_params.rb +3 -3
- data/lib/openai/models/responses/namespace_tool.rb +10 -1
- data/lib/openai/models/responses/response.rb +20 -13
- data/lib/openai/models/responses/response_compact_params.rb +13 -10
- data/lib/openai/models/responses/response_configuration_update_item.rb +56 -0
- data/lib/openai/models/responses/response_configuration_update_item_param.rb +57 -0
- data/lib/openai/models/responses/response_create_params.rb +8 -10
- data/lib/openai/models/responses/response_custom_tool_call.rb +9 -1
- data/lib/openai/models/responses/response_custom_tool_call_item.rb +3 -1
- data/lib/openai/models/responses/response_error.rb +96 -1
- data/lib/openai/models/responses/response_function_tool_call.rb +9 -1
- data/lib/openai/models/responses/response_function_tool_call_item.rb +3 -1
- data/lib/openai/models/responses/response_incomplete_event.rb +4 -0
- data/lib/openai/models/responses/response_input_item.rb +6 -1
- data/lib/openai/models/responses/response_item.rb +5 -1
- data/lib/openai/models/responses/response_item_list.rb +2 -2
- data/lib/openai/models/responses/response_steer_accepted_event.rb +79 -0
- data/lib/openai/models/responses/response_steer_error_code.rb +59 -0
- data/lib/openai/models/responses/response_steer_event.rb +73 -0
- data/lib/openai/models/responses/response_steer_failed_event.rb +149 -0
- data/lib/openai/models/responses/response_steer_input.rb +304 -0
- data/lib/openai/models/responses/response_steer_input_content.rb +26 -0
- data/lib/openai/models/responses/response_steer_pending_event.rb +111 -0
- data/lib/openai/models/responses/response_steer_pending_reason.rb +24 -0
- data/lib/openai/models/responses/response_steer_required_input.rb +213 -0
- data/lib/openai/models/responses/response_stream_event.rb +4 -0
- data/lib/openai/models/responses/response_usage.rb +1 -12
- data/lib/openai/models/responses/responses_client_event.rb +872 -771
- data/lib/openai/models/responses/responses_server_event.rb +162 -2
- data/lib/openai/models/safety/alert_retrieve_params.rb +24 -0
- data/lib/openai/models/safety/safety_alert.rb +96 -0
- data/lib/openai/models/video_create_error.rb +93 -1
- data/lib/openai/models/webhooks/safety_alert_created_webhook_event.rb +63 -0
- data/lib/openai/models/webhooks/safety_org_alert_created_webhook_event.rb +63 -0
- data/lib/openai/models/webhooks/unwrap_webhook_event.rb +7 -1
- data/lib/openai/models.rb +2 -0
- data/lib/openai/net_http_client.rb +1 -1
- data/lib/openai/providers/bedrock.rb +20 -12
- data/lib/openai/resources/admin/organization/usage.rb +3 -1
- data/lib/openai/resources/beta/responses/input_items.rb +1 -1
- data/lib/openai/resources/beta/responses/input_tokens.rb +1 -1
- data/lib/openai/resources/beta/responses.rb +8 -8
- data/lib/openai/resources/chat/completions.rb +2 -2
- data/lib/openai/resources/conversations/items.rb +3 -3
- data/lib/openai/resources/conversations.rb +1 -1
- data/lib/openai/resources/responses/input_items.rb +1 -1
- data/lib/openai/resources/responses/input_tokens.rb +1 -1
- data/lib/openai/resources/responses.rb +10 -9
- data/lib/openai/resources/safety/alerts.rb +37 -0
- data/lib/openai/resources/safety.rb +18 -0
- data/lib/openai/resources/webhooks.rb +1 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +29 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/errors.rbi +1 -1
- data/rbi/openai/helpers/streaming/events.rbi +2 -2
- data/rbi/openai/helpers/streaming/response_stream.rbi +3 -3
- data/rbi/openai/models/admin/organization/usage_costs_params.rbi +15 -0
- data/rbi/openai/models/batch.rbi +6 -6
- data/rbi/openai/models/beta/beta_custom_tool.rbi +15 -0
- data/rbi/openai/models/beta/beta_function_tool.rbi +11 -0
- data/rbi/openai/models/beta/beta_namespace_tool.rbi +15 -0
- data/rbi/openai/models/beta/beta_response.rbi +21 -18
- data/rbi/openai/models/beta/beta_response_configuration_update_item.rbi +200 -0
- data/rbi/openai/models/beta/beta_response_configuration_update_item_param.rbi +207 -0
- data/rbi/openai/models/beta/beta_response_custom_tool_call.rbi +13 -0
- data/rbi/openai/models/beta/beta_response_custom_tool_call_item.rbi +6 -0
- data/rbi/openai/models/beta/beta_response_error.rbi +161 -3
- data/rbi/openai/models/beta/beta_response_function_tool_call.rbi +13 -0
- data/rbi/openai/models/beta/beta_response_function_tool_call_item.rbi +6 -0
- data/rbi/openai/models/beta/beta_response_incomplete_event.rbi +4 -0
- data/rbi/openai/models/beta/beta_response_inject_event.rbi +3 -0
- data/rbi/openai/models/beta/beta_response_inject_failed_event.rbi +3 -0
- data/rbi/openai/models/beta/beta_response_input_item.rbi +1 -0
- data/rbi/openai/models/beta/beta_response_item.rbi +1 -0
- data/rbi/openai/models/beta/beta_response_steer_accepted_event.rbi +148 -0
- data/rbi/openai/models/beta/beta_response_steer_error_code.rbi +65 -0
- data/rbi/openai/models/beta/beta_response_steer_event.rbi +118 -0
- data/rbi/openai/models/beta/beta_response_steer_failed_event.rbi +267 -0
- data/rbi/openai/models/beta/beta_response_steer_input.rbi +602 -0
- data/rbi/openai/models/beta/beta_response_steer_input_content.rbi +31 -0
- data/rbi/openai/models/beta/beta_response_steer_pending_event.rbi +222 -0
- data/rbi/openai/models/beta/beta_response_steer_pending_reason.rbi +35 -0
- data/rbi/openai/models/beta/beta_response_steer_required_input.rbi +379 -0
- data/rbi/openai/models/beta/beta_response_usage.rbi +3 -13
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +14 -15
- data/rbi/openai/models/beta/beta_responses_server_event.rbi +206 -3
- data/rbi/openai/models/beta/response_compact_params.rbi +10 -9
- data/rbi/openai/models/beta/response_create_params.rbi +10 -15
- data/rbi/openai/models/beta/responses/beta_response_item_list.rbi +1 -0
- data/rbi/openai/models/chat/completion_create_params.rbi +9 -9
- data/rbi/openai/models/chat_model.rbi +1 -0
- data/rbi/openai/models/completion_usage.rbi +0 -10
- data/rbi/openai/models/conversations/conversation_create_params.rbi +3 -0
- data/rbi/openai/models/conversations/conversation_item.rbi +1 -0
- data/rbi/openai/models/conversations/conversation_item_list.rbi +1 -0
- data/rbi/openai/models/conversations/item_create_params.rbi +3 -0
- data/rbi/openai/models/error_object.rbi +156 -3
- data/rbi/openai/models/eval_create_response.rbi +1 -1
- data/rbi/openai/models/eval_list_response.rbi +1 -1
- data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
- data/rbi/openai/models/eval_update_response.rbi +1 -1
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +2 -2
- data/rbi/openai/models/reasoning.rbi +0 -2
- data/rbi/openai/models/responses/custom_tool.rbi +15 -0
- data/rbi/openai/models/responses/function_tool.rbi +11 -0
- data/rbi/openai/models/responses/namespace_tool.rbi +15 -0
- data/rbi/openai/models/responses/response.rbi +17 -13
- data/rbi/openai/models/responses/response_compact_params.rbi +10 -9
- data/rbi/openai/models/responses/response_configuration_update_item.rbi +112 -0
- data/rbi/openai/models/responses/response_configuration_update_item_param.rbi +117 -0
- data/rbi/openai/models/responses/response_create_params.rbi +6 -10
- data/rbi/openai/models/responses/response_custom_tool_call.rbi +13 -0
- data/rbi/openai/models/responses/response_custom_tool_call_item.rbi +6 -0
- data/rbi/openai/models/responses/response_error.rbi +161 -3
- data/rbi/openai/models/responses/response_function_tool_call.rbi +13 -0
- data/rbi/openai/models/responses/response_function_tool_call_item.rbi +6 -0
- data/rbi/openai/models/responses/response_incomplete_event.rbi +4 -0
- data/rbi/openai/models/responses/response_input_item.rbi +1 -0
- data/rbi/openai/models/responses/response_item.rbi +1 -0
- data/rbi/openai/models/responses/response_item_list.rbi +1 -0
- data/rbi/openai/models/responses/response_steer_accepted_event.rbi +146 -0
- data/rbi/openai/models/responses/response_steer_error_code.rbi +63 -0
- data/rbi/openai/models/responses/response_steer_event.rbi +119 -0
- data/rbi/openai/models/responses/response_steer_failed_event.rbi +268 -0
- data/rbi/openai/models/responses/response_steer_input.rbi +474 -0
- data/rbi/openai/models/responses/response_steer_input_content.rbi +29 -0
- data/rbi/openai/models/responses/response_steer_pending_event.rbi +220 -0
- data/rbi/openai/models/responses/response_steer_pending_reason.rbi +33 -0
- data/rbi/openai/models/responses/response_steer_required_input.rbi +377 -0
- data/rbi/openai/models/responses/response_usage.rbi +3 -13
- data/rbi/openai/models/responses/responses_client_event.rbi +1205 -1041
- data/rbi/openai/models/responses/responses_server_event.rbi +202 -3
- data/rbi/openai/models/safety/alert_retrieve_params.rbi +55 -0
- data/rbi/openai/models/safety/safety_alert.rbi +147 -0
- data/rbi/openai/models/video_create_error.rbi +149 -3
- data/rbi/openai/models/webhooks/safety_alert_created_webhook_event.rbi +130 -0
- data/rbi/openai/models/webhooks/safety_org_alert_created_webhook_event.rbi +130 -0
- data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +3 -1
- data/rbi/openai/models.rbi +2 -0
- data/rbi/openai/resources/admin/organization/usage.rbi +4 -0
- data/rbi/openai/resources/beta/responses.rbi +7 -11
- data/rbi/openai/resources/chat/completions.rbi +6 -6
- data/rbi/openai/resources/conversations/items.rbi +1 -0
- data/rbi/openai/resources/conversations.rbi +1 -0
- data/rbi/openai/resources/responses.rbi +9 -13
- data/rbi/openai/resources/safety/alerts.rbi +30 -0
- data/rbi/openai/resources/safety.rbi +18 -0
- data/rbi/openai/resources/webhooks.rbi +3 -1
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/errors.rbs +1 -1
- data/sig/openai/internal/transport/base_client.rbs +4 -19
- data/sig/openai/models/admin/organization/usage_costs_params.rbs +7 -0
- data/sig/openai/models/beta/beta_custom_tool.rbs +7 -0
- data/sig/openai/models/beta/beta_function_tool.rbs +7 -0
- data/sig/openai/models/beta/beta_namespace_tool.rbs +7 -0
- data/sig/openai/models/beta/beta_response.rbs +7 -2
- data/sig/openai/models/beta/beta_response_configuration_update_item.rbs +91 -0
- data/sig/openai/models/beta/beta_response_configuration_update_item_param.rbs +87 -0
- data/sig/openai/models/beta/beta_response_custom_tool_call.rbs +7 -0
- data/sig/openai/models/beta/beta_response_custom_tool_call_item.rbs +3 -0
- data/sig/openai/models/beta/beta_response_error.rbs +82 -3
- data/sig/openai/models/beta/beta_response_function_tool_call.rbs +7 -0
- data/sig/openai/models/beta/beta_response_function_tool_call_item.rbs +3 -0
- data/sig/openai/models/beta/beta_response_input_item.rbs +1 -0
- data/sig/openai/models/beta/beta_response_item.rbs +1 -0
- data/sig/openai/models/beta/beta_response_steer_accepted_event.rbs +53 -0
- data/sig/openai/models/beta/beta_response_steer_error_code.rbs +31 -0
- data/sig/openai/models/beta/beta_response_steer_event.rbs +34 -0
- data/sig/openai/models/beta/beta_response_steer_failed_event.rbs +102 -0
- data/sig/openai/models/beta/beta_response_steer_input.rbs +214 -0
- data/sig/openai/models/beta/beta_response_steer_input_content.rbs +18 -0
- data/sig/openai/models/beta/beta_response_steer_pending_event.rbs +63 -0
- data/sig/openai/models/beta/beta_response_steer_pending_reason.rbs +16 -0
- data/sig/openai/models/beta/beta_response_steer_required_input.rbs +161 -0
- data/sig/openai/models/beta/beta_response_usage.rbs +3 -8
- data/sig/openai/models/beta/beta_responses_client_event.rbs +4 -1
- data/sig/openai/models/beta/beta_responses_server_event.rbs +80 -3
- data/sig/openai/models/beta/response_compact_params.rbs +3 -1
- data/sig/openai/models/beta/response_create_params.rbs +3 -1
- data/sig/openai/models/chat_model.rbs +3 -1
- data/sig/openai/models/completion_usage.rbs +0 -5
- data/sig/openai/models/conversations/conversation_item.rbs +1 -0
- data/sig/openai/models/error_object.rbs +82 -3
- data/sig/openai/models/responses/custom_tool.rbs +7 -0
- data/sig/openai/models/responses/function_tool.rbs +7 -0
- data/sig/openai/models/responses/namespace_tool.rbs +7 -0
- data/sig/openai/models/responses/response.rbs +4 -1
- data/sig/openai/models/responses/response_compact_params.rbs +3 -1
- data/sig/openai/models/responses/response_configuration_update_item.rbs +46 -0
- data/sig/openai/models/responses/response_configuration_update_item_param.rbs +46 -0
- data/sig/openai/models/responses/response_custom_tool_call.rbs +7 -0
- data/sig/openai/models/responses/response_custom_tool_call_item.rbs +3 -0
- data/sig/openai/models/responses/response_error.rbs +79 -3
- data/sig/openai/models/responses/response_function_tool_call.rbs +7 -0
- data/sig/openai/models/responses/response_function_tool_call_item.rbs +3 -0
- data/sig/openai/models/responses/response_input_item.rbs +1 -0
- data/sig/openai/models/responses/response_item.rbs +1 -0
- data/sig/openai/models/responses/response_steer_accepted_event.rbs +51 -0
- data/sig/openai/models/responses/response_steer_error_code.rbs +29 -0
- data/sig/openai/models/responses/response_steer_event.rbs +32 -0
- data/sig/openai/models/responses/response_steer_failed_event.rbs +100 -0
- data/sig/openai/models/responses/response_steer_input.rbs +182 -0
- data/sig/openai/models/responses/response_steer_input_content.rbs +16 -0
- data/sig/openai/models/responses/response_steer_pending_event.rbs +61 -0
- data/sig/openai/models/responses/response_steer_pending_reason.rbs +13 -0
- data/sig/openai/models/responses/response_steer_required_input.rbs +159 -0
- data/sig/openai/models/responses/response_usage.rbs +3 -8
- data/sig/openai/models/responses/responses_client_event.rbs +355 -344
- data/sig/openai/models/responses/responses_server_event.rbs +80 -3
- data/sig/openai/models/safety/alert_retrieve_params.rbs +22 -0
- data/sig/openai/models/safety/safety_alert.rbs +81 -0
- data/sig/openai/models/video_create_error.rbs +87 -3
- data/sig/openai/models/webhooks/safety_alert_created_webhook_event.rbs +52 -0
- data/sig/openai/models/webhooks/safety_org_alert_created_webhook_event.rbs +52 -0
- data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +2 -0
- data/sig/openai/models.rbs +2 -0
- data/sig/openai/resources/admin/organization/usage.rbs +1 -0
- data/sig/openai/resources/safety/alerts.rbs +14 -0
- data/sig/openai/resources/safety.rbs +9 -0
- data/sig/openai/resources/webhooks.rbs +3 -1
- metadata +86 -1
|
@@ -3,878 +3,979 @@
|
|
|
3
3
|
module OpenAI
|
|
4
4
|
module Models
|
|
5
5
|
module Responses
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
# call.
|
|
59
|
-
# - `message.input_image.image_url`: Include image urls from the input message.
|
|
60
|
-
# - `message.output_text.logprobs`: Include logprobs with assistant messages.
|
|
61
|
-
# - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
|
|
62
|
-
# tokens in reasoning item outputs. This enables reasoning items to be used in
|
|
63
|
-
# multi-turn conversations when using the Responses API statelessly (like when
|
|
64
|
-
# the `store` parameter is set to `false`, or when an organization is enrolled
|
|
65
|
-
# in the zero data retention program).
|
|
66
|
-
#
|
|
67
|
-
# @return [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil]
|
|
68
|
-
optional(
|
|
69
|
-
:include,
|
|
70
|
-
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::ResponseIncludable] },
|
|
71
|
-
nil?: true
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
# @!attribute input
|
|
75
|
-
# Text, image, or file inputs to the model, used to generate a response.
|
|
76
|
-
#
|
|
77
|
-
# Learn more:
|
|
78
|
-
#
|
|
79
|
-
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
|
80
|
-
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
|
81
|
-
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
|
82
|
-
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
|
83
|
-
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
84
|
-
#
|
|
85
|
-
# @return [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>, nil]
|
|
86
|
-
optional :input, union: -> { OpenAI::Responses::ResponsesClientEvent::Input }
|
|
87
|
-
|
|
88
|
-
# @!attribute instructions
|
|
89
|
-
# A system (or developer) message inserted into the model's context.
|
|
90
|
-
#
|
|
91
|
-
# When using along with `previous_response_id`, the instructions from a previous
|
|
92
|
-
# response will not be carried over to the next response. This makes it simple to
|
|
93
|
-
# swap out system (or developer) messages in new responses.
|
|
94
|
-
#
|
|
95
|
-
# @return [String, nil]
|
|
96
|
-
optional :instructions, String, nil?: true
|
|
97
|
-
|
|
98
|
-
# @!attribute max_output_tokens
|
|
99
|
-
# An upper bound for the number of tokens that can be generated for a response,
|
|
100
|
-
# including visible output tokens and
|
|
101
|
-
# [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
|
|
102
|
-
#
|
|
103
|
-
# @return [Integer, nil]
|
|
104
|
-
optional :max_output_tokens, Integer, nil?: true
|
|
105
|
-
|
|
106
|
-
# @!attribute max_tool_calls
|
|
107
|
-
# The maximum number of total calls to built-in tools that can be processed in a
|
|
108
|
-
# response. This maximum number applies across all built-in tool calls, not per
|
|
109
|
-
# individual tool. Any further attempts to call a tool by the model will be
|
|
110
|
-
# ignored.
|
|
111
|
-
#
|
|
112
|
-
# @return [Integer, nil]
|
|
113
|
-
optional :max_tool_calls, Integer, nil?: true
|
|
114
|
-
|
|
115
|
-
# @!attribute metadata
|
|
116
|
-
# Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
117
|
-
# for storing additional information about the object in a structured format, and
|
|
118
|
-
# querying for objects via API or the dashboard.
|
|
119
|
-
#
|
|
120
|
-
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
121
|
-
# a maximum length of 512 characters.
|
|
122
|
-
#
|
|
123
|
-
# @return [Hash{Symbol=>String}, nil]
|
|
124
|
-
optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true
|
|
125
|
-
|
|
126
|
-
# @!attribute model
|
|
127
|
-
# Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
|
|
128
|
-
# wide range of models with different capabilities, performance characteristics,
|
|
129
|
-
# and price points. Refer to the
|
|
130
|
-
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
|
131
|
-
# available models.
|
|
132
|
-
#
|
|
133
|
-
# @return [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel, nil]
|
|
134
|
-
optional :model, union: -> { OpenAI::ResponsesModel }
|
|
6
|
+
# Client events accepted by the Responses WebSocket server.
|
|
7
|
+
module ResponsesClientEvent
|
|
8
|
+
extend OpenAI::Internal::Type::Union
|
|
9
|
+
|
|
10
|
+
discriminator :type
|
|
11
|
+
|
|
12
|
+
# Client event for creating a response over a persistent WebSocket connection.
|
|
13
|
+
# This payload uses the same top-level fields as `POST /v1/responses`, plus
|
|
14
|
+
# WebSocket-only envelope metadata.
|
|
15
|
+
#
|
|
16
|
+
# Notes:
|
|
17
|
+
# - `stream` is implicit over WebSocket and should not be sent.
|
|
18
|
+
# - `background` is not supported over WebSocket.
|
|
19
|
+
# - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
|
|
20
|
+
variant :"response.create", -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate }
|
|
21
|
+
|
|
22
|
+
# Queues user input to steer a response on this WebSocket connection. Input
|
|
23
|
+
# can contain text, images, and files. Steering is supported only for
|
|
24
|
+
# single-agent responses on models and execution modes that support steering.
|
|
25
|
+
# Responses bound to a conversation or using automatic compaction do not
|
|
26
|
+
# support steering.
|
|
27
|
+
#
|
|
28
|
+
# A `response.steer.accepted` event acknowledges that the server owns the
|
|
29
|
+
# queued input, not that it has been applied. The successor's `response.created`
|
|
30
|
+
# event is the commit point. Input that cannot be committed is returned in
|
|
31
|
+
# `response.steer.failed`.
|
|
32
|
+
#
|
|
33
|
+
# Steering may cause the active response to finish at a safe output boundary
|
|
34
|
+
# with `response.incomplete` and `incomplete_details.reason` set to `steered`,
|
|
35
|
+
# followed automatically by a successor `response.created`. Normal completion
|
|
36
|
+
# can also be followed by an automatic successor. Automatic successors inherit
|
|
37
|
+
# the previous response's settings and continue from it with the queued input.
|
|
38
|
+
#
|
|
39
|
+
# If the response stops for client-owned tool output or approval, accepted
|
|
40
|
+
# steering input remains queued and `response.steer.pending` is emitted after
|
|
41
|
+
# `response.completed`. Fill the `required_input` stubs from that event with
|
|
42
|
+
# saved tool results or approval decisions, and send one explicit
|
|
43
|
+
# `response.create` per parent with the same `previous_response_id` and
|
|
44
|
+
# WebSocket lane. Do not rerun tools or resend accepted steering input. The
|
|
45
|
+
# queued input is prepended in submission order to that request's input, and
|
|
46
|
+
# the explicit request retains its own settings.
|
|
47
|
+
#
|
|
48
|
+
# This event accepts only `type`, `previous_response_id`, and `input`. Do not
|
|
49
|
+
# send `stream_id`; the target response determines the WebSocket lane.
|
|
50
|
+
variant :"response.steer", -> { OpenAI::Responses::ResponseSteerEvent }
|
|
51
|
+
|
|
52
|
+
class ResponseCreate < OpenAI::Internal::Type::BaseModel
|
|
53
|
+
# @!attribute type
|
|
54
|
+
# The type of the client event. Always `response.create`.
|
|
55
|
+
#
|
|
56
|
+
# @return [Symbol, :"response.create"]
|
|
57
|
+
required :type, const: :"response.create"
|
|
135
58
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
59
|
+
# @!attribute background
|
|
60
|
+
# Whether to run the model response in the background.
|
|
61
|
+
# [Learn more](https://platform.openai.com/docs/guides/background).
|
|
62
|
+
#
|
|
63
|
+
# @return [Boolean, nil]
|
|
64
|
+
optional :background, OpenAI::Internal::Type::Boolean, nil?: true
|
|
141
65
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
66
|
+
# @!attribute context_management
|
|
67
|
+
# Context management configuration for this request.
|
|
68
|
+
#
|
|
69
|
+
# @return [Array<OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement>, nil]
|
|
70
|
+
optional(
|
|
71
|
+
:context_management,
|
|
72
|
+
-> {
|
|
73
|
+
OpenAI::Internal::Type::ArrayOf[
|
|
74
|
+
OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
nil?: true
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# @!attribute conversation
|
|
81
|
+
# The conversation that this response belongs to. Items from this conversation are
|
|
82
|
+
# prepended to `input_items` for this response request. Input items and output
|
|
83
|
+
# items from this response are automatically added to this conversation after this
|
|
84
|
+
# response completes.
|
|
85
|
+
#
|
|
86
|
+
# @return [String, OpenAI::Models::Responses::ResponseConversationParam, nil]
|
|
87
|
+
optional(
|
|
88
|
+
:conversation,
|
|
89
|
+
union: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Conversation },
|
|
90
|
+
nil?: true
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# @!attribute include
|
|
94
|
+
# Specify additional output data to include in the model response. Currently
|
|
95
|
+
# supported values are:
|
|
96
|
+
#
|
|
97
|
+
# - `web_search_call.action.sources`: Include the sources of the web search tool
|
|
98
|
+
# call.
|
|
99
|
+
# - `code_interpreter_call.outputs`: Includes the outputs of python code execution
|
|
100
|
+
# in code interpreter tool call items.
|
|
101
|
+
# - `computer_call_output.output.image_url`: Include image urls from the computer
|
|
102
|
+
# call output.
|
|
103
|
+
# - `file_search_call.results`: Include the search results of the file search tool
|
|
104
|
+
# call.
|
|
105
|
+
# - `message.input_image.image_url`: Include image urls from the input message.
|
|
106
|
+
# - `message.output_text.logprobs`: Include logprobs with assistant messages.
|
|
107
|
+
# - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
|
|
108
|
+
# tokens in reasoning item outputs. This enables reasoning items to be used in
|
|
109
|
+
# multi-turn conversations when using the Responses API statelessly (like when
|
|
110
|
+
# the `store` parameter is set to `false`, or when an organization is enrolled
|
|
111
|
+
# in the zero data retention program).
|
|
112
|
+
#
|
|
113
|
+
# @return [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil]
|
|
114
|
+
optional(
|
|
115
|
+
:include,
|
|
116
|
+
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::ResponseIncludable] },
|
|
117
|
+
nil?: true
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# @!attribute input
|
|
121
|
+
# Text, image, or file inputs to the model, used to generate a response.
|
|
122
|
+
#
|
|
123
|
+
# Learn more:
|
|
124
|
+
#
|
|
125
|
+
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
|
126
|
+
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
|
127
|
+
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
|
128
|
+
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
|
129
|
+
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
130
|
+
#
|
|
131
|
+
# @return [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>, nil]
|
|
132
|
+
optional :input, union: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input }
|
|
156
133
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
134
|
+
# @!attribute instructions
|
|
135
|
+
# A system (or developer) message inserted into the model's context.
|
|
136
|
+
#
|
|
137
|
+
# When using along with `previous_response_id`, the instructions from a previous
|
|
138
|
+
# response will not be carried over to the next response. This makes it simple to
|
|
139
|
+
# swap out system (or developer) messages in new responses.
|
|
140
|
+
#
|
|
141
|
+
# @return [String, nil]
|
|
142
|
+
optional :instructions, String, nil?: true
|
|
163
143
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
# @!attribute prompt_cache_options
|
|
173
|
-
# Options for prompt caching. Supported for `gpt-5.6` and later models. By
|
|
174
|
-
# default, OpenAI automatically chooses one implicit cache breakpoint. You can add
|
|
175
|
-
# explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
|
|
176
|
-
# request can write up to four breakpoints. For cache matching, OpenAI considers
|
|
177
|
-
# up to the latest 80 breakpoints in the conversation, without a content-block
|
|
178
|
-
# lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
|
|
179
|
-
# `ttl` defaults to `30m`, which is currently the only supported value. See the
|
|
180
|
-
# [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
|
|
181
|
-
# for current details.
|
|
182
|
-
#
|
|
183
|
-
# @return [OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions, nil]
|
|
184
|
-
optional :prompt_cache_options, -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions }
|
|
144
|
+
# @!attribute max_output_tokens
|
|
145
|
+
# An upper bound for the number of tokens that can be generated for a response,
|
|
146
|
+
# including visible output tokens and
|
|
147
|
+
# [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
|
|
148
|
+
#
|
|
149
|
+
# @return [Integer, nil]
|
|
150
|
+
optional :max_output_tokens, Integer, nil?: true
|
|
185
151
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
|
|
195
|
-
# This field expresses a maximum retention policy, while
|
|
196
|
-
# `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
|
|
197
|
-
# are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
|
|
198
|
-
# models, only `24h` is supported.
|
|
199
|
-
#
|
|
200
|
-
# For older models that support both `in_memory` and `24h`, the default depends on
|
|
201
|
-
# your organization's data retention policy:
|
|
202
|
-
#
|
|
203
|
-
# - Organizations without ZDR enabled default to `24h`.
|
|
204
|
-
# - Organizations with ZDR enabled default to `in_memory` when
|
|
205
|
-
# `prompt_cache_retention` is not specified.
|
|
206
|
-
#
|
|
207
|
-
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheRetention, nil]
|
|
208
|
-
optional(
|
|
209
|
-
:prompt_cache_retention,
|
|
210
|
-
enum: -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention },
|
|
211
|
-
nil?: true
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
# @!attribute reasoning
|
|
215
|
-
# **gpt-5 and o-series models only**
|
|
216
|
-
#
|
|
217
|
-
# Configuration options for
|
|
218
|
-
# [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
219
|
-
#
|
|
220
|
-
# @return [OpenAI::Models::Reasoning, nil]
|
|
221
|
-
optional :reasoning, -> { OpenAI::Reasoning }, nil?: true
|
|
222
|
-
|
|
223
|
-
# @!attribute safety_identifier
|
|
224
|
-
# A stable identifier used to help detect users of your application that may be
|
|
225
|
-
# violating OpenAI's usage policies. The IDs should be a string that uniquely
|
|
226
|
-
# identifies each user, with a maximum length of 64 characters. We recommend
|
|
227
|
-
# hashing their username or email address, in order to avoid sending us any
|
|
228
|
-
# identifying information.
|
|
229
|
-
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
|
230
|
-
#
|
|
231
|
-
# @return [String, nil]
|
|
232
|
-
optional :safety_identifier, String, nil?: true
|
|
152
|
+
# @!attribute max_tool_calls
|
|
153
|
+
# The maximum number of total calls to built-in tools that can be processed in a
|
|
154
|
+
# response. This maximum number applies across all built-in tool calls, not per
|
|
155
|
+
# individual tool. Any further attempts to call a tool by the model will be
|
|
156
|
+
# ignored.
|
|
157
|
+
#
|
|
158
|
+
# @return [Integer, nil]
|
|
159
|
+
optional :max_tool_calls, Integer, nil?: true
|
|
233
160
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
# - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
|
|
245
|
-
# include the `service_tier=fast` or `service_tier=priority` parameter for
|
|
246
|
-
# Responses or Chat Completions. The response will show `service_tier=priority`
|
|
247
|
-
# regardless of if you specify `service_tier=fast` or `priority` in your
|
|
248
|
-
# request.
|
|
249
|
-
# - If set to 'ultrafast', then the request will be processed with the
|
|
250
|
-
# access-controlled Ultrafast Processing service tier. This tier is currently
|
|
251
|
-
# available for `gpt-5.6-sol`; a response served through it will show
|
|
252
|
-
# `service_tier=ultrafast`.
|
|
253
|
-
# - When not set, the default behavior is 'auto'.
|
|
254
|
-
#
|
|
255
|
-
# When the `service_tier` parameter is set, the response body will include the
|
|
256
|
-
# `service_tier` value based on the processing mode actually used to serve the
|
|
257
|
-
# request. This response value may be different from the value set in the
|
|
258
|
-
# parameter.
|
|
259
|
-
#
|
|
260
|
-
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ServiceTier, nil]
|
|
261
|
-
optional :service_tier, enum: -> { OpenAI::Responses::ResponsesClientEvent::ServiceTier }, nil?: true
|
|
161
|
+
# @!attribute metadata
|
|
162
|
+
# Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
163
|
+
# for storing additional information about the object in a structured format, and
|
|
164
|
+
# querying for objects via API or the dashboard.
|
|
165
|
+
#
|
|
166
|
+
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
167
|
+
# a maximum length of 512 characters.
|
|
168
|
+
#
|
|
169
|
+
# @return [Hash{Symbol=>String}, nil]
|
|
170
|
+
optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true
|
|
262
171
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
# [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
|
|
273
|
-
# See the
|
|
274
|
-
# [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
|
|
275
|
-
# for more information.
|
|
276
|
-
#
|
|
277
|
-
# @return [Boolean, nil]
|
|
278
|
-
optional :stream, OpenAI::Internal::Type::Boolean, nil?: true
|
|
172
|
+
# @!attribute model
|
|
173
|
+
# Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide
|
|
174
|
+
# range of models with different capabilities, performance characteristics, and
|
|
175
|
+
# price points. Refer to the
|
|
176
|
+
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
|
177
|
+
# available models.
|
|
178
|
+
#
|
|
179
|
+
# @return [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel, nil]
|
|
180
|
+
optional :model, union: -> { OpenAI::ResponsesModel }
|
|
279
181
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
182
|
+
# @!attribute moderation
|
|
183
|
+
# Configuration for running moderation on the input and output of this response.
|
|
184
|
+
#
|
|
185
|
+
# @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation, nil]
|
|
186
|
+
optional(
|
|
187
|
+
:moderation,
|
|
188
|
+
-> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation },
|
|
189
|
+
nil?: true
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
# @!attribute parallel_tool_calls
|
|
193
|
+
# Whether to allow the model to run tool calls in parallel.
|
|
194
|
+
#
|
|
195
|
+
# @return [Boolean, nil]
|
|
196
|
+
optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean, nil?: true
|
|
289
197
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
# make the output more random, while lower values like 0.2 will make it more
|
|
299
|
-
# focused and deterministic. We generally recommend altering this or `top_p` but
|
|
300
|
-
# not both.
|
|
301
|
-
#
|
|
302
|
-
# @return [Float, nil]
|
|
303
|
-
optional :temperature, Float, nil?: true
|
|
198
|
+
# @!attribute previous_response_id
|
|
199
|
+
# The unique ID of the previous response to the model. Use this to create
|
|
200
|
+
# multi-turn conversations. Learn more about
|
|
201
|
+
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
|
|
202
|
+
# Cannot be used in conjunction with `conversation`.
|
|
203
|
+
#
|
|
204
|
+
# @return [String, nil]
|
|
205
|
+
optional :previous_response_id, String, nil?: true
|
|
304
206
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
#
|
|
312
|
-
# @return [OpenAI::Models::Responses::ResponseTextConfig, nil]
|
|
313
|
-
optional :text, -> { OpenAI::Responses::ResponseTextConfig }
|
|
207
|
+
# @!attribute prompt
|
|
208
|
+
# Reference to a prompt template and its variables.
|
|
209
|
+
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
|
210
|
+
#
|
|
211
|
+
# @return [OpenAI::Models::Responses::ResponsePrompt, nil]
|
|
212
|
+
optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true
|
|
314
213
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
214
|
+
# @!attribute prompt_cache_key
|
|
215
|
+
# Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
216
|
+
# hit rates. Replaces the `user` field.
|
|
217
|
+
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
218
|
+
#
|
|
219
|
+
# @return [String, nil]
|
|
220
|
+
optional :prompt_cache_key, String, nil?: true
|
|
322
221
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
222
|
+
# @!attribute prompt_cache_options
|
|
223
|
+
# Options for prompt caching. Supported for `gpt-5.6` and later models. By
|
|
224
|
+
# default, OpenAI automatically chooses one implicit cache breakpoint. You can add
|
|
225
|
+
# explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
|
|
226
|
+
# request can write up to four breakpoints. For cache matching, OpenAI considers
|
|
227
|
+
# up to the latest 80 breakpoints in the conversation, without a content-block
|
|
228
|
+
# lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
|
|
229
|
+
# `ttl` defaults to `30m`, which is currently the only supported value. See the
|
|
230
|
+
# [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
|
|
231
|
+
# for current details.
|
|
232
|
+
#
|
|
233
|
+
# @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions, nil]
|
|
234
|
+
optional(
|
|
235
|
+
:prompt_cache_options,
|
|
236
|
+
-> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions }
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
# @!attribute prompt_cache_retention
|
|
240
|
+
# @deprecated
|
|
241
|
+
#
|
|
242
|
+
# Deprecated. Use `prompt_cache_options.ttl` instead.
|
|
243
|
+
#
|
|
244
|
+
# The retention policy for the prompt cache. Set to `24h` to enable extended
|
|
245
|
+
# prompt caching, which keeps cached prefixes active for longer, up to a maximum
|
|
246
|
+
# of 24 hours.
|
|
247
|
+
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
|
|
248
|
+
# This field expresses a maximum retention policy, while
|
|
249
|
+
# `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
|
|
250
|
+
# are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
|
|
251
|
+
# models, only `24h` is supported.
|
|
252
|
+
#
|
|
253
|
+
# For older models that support both `in_memory` and `24h`, the default depends on
|
|
254
|
+
# your organization's data retention policy:
|
|
255
|
+
#
|
|
256
|
+
# - Organizations without ZDR enabled default to `24h`.
|
|
257
|
+
# - Organizations with ZDR enabled default to `in_memory` when
|
|
258
|
+
# `prompt_cache_retention` is not specified.
|
|
259
|
+
#
|
|
260
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention, nil]
|
|
261
|
+
optional(
|
|
262
|
+
:prompt_cache_retention,
|
|
263
|
+
enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention },
|
|
264
|
+
nil?: true
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
# @!attribute reasoning
|
|
268
|
+
# Configuration options for
|
|
269
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
270
|
+
#
|
|
271
|
+
# @return [OpenAI::Models::Reasoning, nil]
|
|
272
|
+
optional :reasoning, -> { OpenAI::Reasoning }, nil?: true
|
|
273
|
+
|
|
274
|
+
# @!attribute safety_identifier
|
|
275
|
+
# A stable identifier used to help detect users of your application that may be
|
|
276
|
+
# violating OpenAI's usage policies. The IDs should be a string that uniquely
|
|
277
|
+
# identifies each user, with a maximum length of 64 characters. We recommend
|
|
278
|
+
# hashing their username or email address, in order to avoid sending us any
|
|
279
|
+
# identifying information.
|
|
280
|
+
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
|
281
|
+
#
|
|
282
|
+
# @return [String, nil]
|
|
283
|
+
optional :safety_identifier, String, nil?: true
|
|
346
284
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
285
|
+
# @!attribute service_tier
|
|
286
|
+
# Specifies the processing type used for serving the request.
|
|
287
|
+
#
|
|
288
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
|
289
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
|
290
|
+
# will use 'default'.
|
|
291
|
+
# - If set to 'default', then the request will be processed with the standard
|
|
292
|
+
# pricing and performance for the selected model.
|
|
293
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
|
|
294
|
+
# then the request will be processed with the Flex Processing service tier.
|
|
295
|
+
# - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
|
|
296
|
+
# include the `service_tier=fast` or `service_tier=priority` parameter for
|
|
297
|
+
# Responses or Chat Completions. The response will show `service_tier=priority`
|
|
298
|
+
# regardless of if you specify `service_tier=fast` or `priority` in your
|
|
299
|
+
# request.
|
|
300
|
+
# - If set to 'ultrafast', then the request will be processed with the
|
|
301
|
+
# access-controlled Ultrafast Processing service tier. This tier is currently
|
|
302
|
+
# available for `gpt-5.6-sol`; a response served through it will show
|
|
303
|
+
# `service_tier=ultrafast`.
|
|
304
|
+
# - When not set, the default behavior is 'auto'.
|
|
305
|
+
#
|
|
306
|
+
# When the `service_tier` parameter is set, the response body will include the
|
|
307
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
|
308
|
+
# request. This response value may be different from the value set in the
|
|
309
|
+
# parameter.
|
|
310
|
+
#
|
|
311
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier, nil]
|
|
312
|
+
optional(
|
|
313
|
+
:service_tier,
|
|
314
|
+
enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier },
|
|
315
|
+
nil?: true
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
# @!attribute store
|
|
319
|
+
# Whether to store the generated model response for later retrieval via API.
|
|
320
|
+
#
|
|
321
|
+
# @return [Boolean, nil]
|
|
322
|
+
optional :store, OpenAI::Internal::Type::Boolean, nil?: true
|
|
323
|
+
|
|
324
|
+
# @!attribute stream
|
|
325
|
+
# If set to true, the model response data will be streamed to the client as it is
|
|
326
|
+
# generated using
|
|
327
|
+
# [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
|
|
328
|
+
# See the
|
|
329
|
+
# [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
|
|
330
|
+
# for more information.
|
|
331
|
+
#
|
|
332
|
+
# @return [Boolean, nil]
|
|
333
|
+
optional :stream, OpenAI::Internal::Type::Boolean, nil?: true
|
|
354
334
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
335
|
+
# @!attribute stream_id
|
|
336
|
+
# The WebSocket lane for this response. Requests with the same `stream_id` are
|
|
337
|
+
# processed FIFO, and events for the response echo the same `stream_id`.
|
|
338
|
+
#
|
|
339
|
+
# `stream_id` controls routing; `previous_response_id` controls conversation
|
|
340
|
+
# lineage, so a new lane can fork from a response created on another lane.
|
|
341
|
+
#
|
|
342
|
+
# @return [String, nil]
|
|
343
|
+
optional :stream_id, String
|
|
364
344
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
345
|
+
# @!attribute stream_options
|
|
346
|
+
# Options for streaming responses. Only set this when you set `stream: true`.
|
|
347
|
+
#
|
|
348
|
+
# @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions, nil]
|
|
349
|
+
optional(
|
|
350
|
+
:stream_options,
|
|
351
|
+
-> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions },
|
|
352
|
+
nil?: true
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
# @!attribute temperature
|
|
356
|
+
# What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
357
|
+
# make the output more random, while lower values like 0.2 will make it more
|
|
358
|
+
# focused and deterministic. We generally recommend altering this or `top_p` but
|
|
359
|
+
# not both.
|
|
360
|
+
#
|
|
361
|
+
# @return [Float, nil]
|
|
362
|
+
optional :temperature, Float, nil?: true
|
|
378
363
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
# @return [String, nil]
|
|
389
|
-
optional :user, String
|
|
364
|
+
# @!attribute text
|
|
365
|
+
# Configuration options for a text response from the model. Can be plain text or
|
|
366
|
+
# structured JSON data. Learn more:
|
|
367
|
+
#
|
|
368
|
+
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
|
369
|
+
# - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
|
370
|
+
#
|
|
371
|
+
# @return [OpenAI::Models::Responses::ResponseTextConfig, nil]
|
|
372
|
+
optional :text, -> { OpenAI::Responses::ResponseTextConfig }
|
|
390
373
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
#
|
|
399
|
-
# @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
|
|
400
|
-
#
|
|
401
|
-
# @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
|
|
402
|
-
#
|
|
403
|
-
# @param input [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>] Text, image, or file inputs to the model, used to generate a response.
|
|
404
|
-
#
|
|
405
|
-
# @param instructions [String, nil] A system (or developer) message inserted into the model's context.
|
|
406
|
-
#
|
|
407
|
-
# @param max_output_tokens [Integer, nil] An upper bound for the number of tokens that can be generated for a response, in
|
|
408
|
-
#
|
|
409
|
-
# @param max_tool_calls [Integer, nil] The maximum number of total calls to built-in tools that can be processed in a r
|
|
410
|
-
#
|
|
411
|
-
# @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
|
|
412
|
-
#
|
|
413
|
-
# @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
|
|
414
|
-
#
|
|
415
|
-
# @param moderation [OpenAI::Models::Responses::ResponsesClientEvent::Moderation, nil] Configuration for running moderation on the input and output of this response.
|
|
416
|
-
#
|
|
417
|
-
# @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
|
|
418
|
-
#
|
|
419
|
-
# @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
|
|
420
|
-
#
|
|
421
|
-
# @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
|
|
422
|
-
#
|
|
423
|
-
# @param prompt_cache_key [String, nil] Used by OpenAI to cache responses for similar requests to optimize your cache hi
|
|
424
|
-
#
|
|
425
|
-
# @param prompt_cache_options [OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions] Options for prompt caching. Supported for `gpt-5.6` and later models. By default
|
|
426
|
-
#
|
|
427
|
-
# @param prompt_cache_retention [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheRetention, nil] Deprecated. Use `prompt_cache_options.ttl` instead.
|
|
428
|
-
#
|
|
429
|
-
# @param reasoning [OpenAI::Models::Reasoning, nil] **gpt-5 and o-series models only**
|
|
430
|
-
#
|
|
431
|
-
# @param safety_identifier [String, nil] A stable identifier used to help detect users of your application that may be vi
|
|
432
|
-
#
|
|
433
|
-
# @param service_tier [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ServiceTier, nil] Specifies the processing type used for serving the request.
|
|
434
|
-
#
|
|
435
|
-
# @param store [Boolean, nil] Whether to store the generated model response for later retrieval via
|
|
436
|
-
#
|
|
437
|
-
# @param stream [Boolean, nil] If set to true, the model response data will be streamed to the client
|
|
438
|
-
#
|
|
439
|
-
# @param stream_id [String] The WebSocket lane for this response. Requests with the same
|
|
440
|
-
#
|
|
441
|
-
# @param stream_options [OpenAI::Models::Responses::ResponsesClientEvent::StreamOptions, nil] Options for streaming responses. Only set this when you set `stream: true`.
|
|
442
|
-
#
|
|
443
|
-
# @param temperature [Float, nil] What sampling temperature to use, between 0 and 2. Higher values like 0.8 will m
|
|
444
|
-
#
|
|
445
|
-
# @param text [OpenAI::Models::Responses::ResponseTextConfig] Configuration options for a text response from the model. Can be plain
|
|
446
|
-
#
|
|
447
|
-
# @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell] How the model should select which tool (or tools) to use when generating
|
|
448
|
-
#
|
|
449
|
-
# @param tools [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>] An array of tools the model may call while generating a response. You
|
|
450
|
-
#
|
|
451
|
-
# @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely
|
|
452
|
-
#
|
|
453
|
-
# @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling,
|
|
454
|
-
#
|
|
455
|
-
# @param truncation [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Truncation, nil] The truncation strategy to use for the model response.
|
|
456
|
-
#
|
|
457
|
-
# @param user [String] This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
|
|
458
|
-
#
|
|
459
|
-
# @param type [Symbol, :"response.create"] The type of the client event. Always `response.create`.
|
|
374
|
+
# @!attribute tool_choice
|
|
375
|
+
# How the model should select which tool (or tools) to use when generating a
|
|
376
|
+
# response. See the `tools` parameter to see how to specify which tools the model
|
|
377
|
+
# can call.
|
|
378
|
+
#
|
|
379
|
+
# @return [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell, nil]
|
|
380
|
+
optional :tool_choice, union: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice }
|
|
460
381
|
|
|
461
|
-
|
|
462
|
-
#
|
|
463
|
-
#
|
|
382
|
+
# @!attribute tools
|
|
383
|
+
# An array of tools the model may call while generating a response. You can
|
|
384
|
+
# specify which tool to use by setting the `tool_choice` parameter.
|
|
385
|
+
#
|
|
386
|
+
# We support the following categories of tools:
|
|
387
|
+
#
|
|
388
|
+
# - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
|
389
|
+
# capabilities, like
|
|
390
|
+
# [web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
|
391
|
+
# [file search](https://platform.openai.com/docs/guides/tools-file-search).
|
|
392
|
+
# Learn more about
|
|
393
|
+
# [built-in tools](https://platform.openai.com/docs/guides/tools).
|
|
394
|
+
# - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
|
|
395
|
+
# predefined connectors such as Google Drive and SharePoint. Learn more about
|
|
396
|
+
# [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
|
|
397
|
+
# - **Function calls (custom tools)**: Functions that are defined by you, enabling
|
|
398
|
+
# the model to call your own code with strongly typed arguments and outputs.
|
|
399
|
+
# Learn more about
|
|
400
|
+
# [function calling](https://platform.openai.com/docs/guides/function-calling).
|
|
401
|
+
# You can also use custom tools to call your own code.
|
|
464
402
|
#
|
|
465
|
-
# @return [
|
|
466
|
-
|
|
403
|
+
# @return [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>, nil]
|
|
404
|
+
optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::Tool] }
|
|
467
405
|
|
|
468
|
-
# @!attribute
|
|
469
|
-
#
|
|
406
|
+
# @!attribute top_logprobs
|
|
407
|
+
# An integer between 0 and 20 specifying the maximum number of most likely tokens
|
|
408
|
+
# to return at each token position, each with an associated log probability. In
|
|
409
|
+
# some cases, the number of returned tokens may be fewer than requested.
|
|
470
410
|
#
|
|
471
411
|
# @return [Integer, nil]
|
|
472
|
-
optional :
|
|
412
|
+
optional :top_logprobs, Integer, nil?: true
|
|
473
413
|
|
|
474
|
-
# @!
|
|
475
|
-
#
|
|
414
|
+
# @!attribute top_p
|
|
415
|
+
# An alternative to sampling with temperature, called nucleus sampling, where the
|
|
416
|
+
# model considers the results of the tokens with top_p probability mass. So 0.1
|
|
417
|
+
# means only the tokens comprising the top 10% probability mass are considered.
|
|
476
418
|
#
|
|
477
|
-
#
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
# prepended to `input_items` for this response request. Input items and output
|
|
482
|
-
# items from this response are automatically added to this conversation after this
|
|
483
|
-
# response completes.
|
|
484
|
-
#
|
|
485
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent#conversation
|
|
486
|
-
module Conversation
|
|
487
|
-
extend OpenAI::Internal::Type::Union
|
|
419
|
+
# We generally recommend altering this or `temperature` but not both.
|
|
420
|
+
#
|
|
421
|
+
# @return [Float, nil]
|
|
422
|
+
optional :top_p, Float, nil?: true
|
|
488
423
|
|
|
489
|
-
#
|
|
490
|
-
|
|
424
|
+
# @!attribute truncation
|
|
425
|
+
# @deprecated
|
|
426
|
+
#
|
|
427
|
+
# The truncation strategy to use for the model response.
|
|
428
|
+
#
|
|
429
|
+
# - `auto`: If the input to this Response exceeds the model's context window size,
|
|
430
|
+
# the model will truncate the response to fit the context window by dropping
|
|
431
|
+
# items from the beginning of the conversation.
|
|
432
|
+
# - `disabled` (default): If the input size will exceed the context window size
|
|
433
|
+
# for a model, the request will fail with a 400 error.
|
|
434
|
+
#
|
|
435
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Truncation, nil]
|
|
436
|
+
optional(
|
|
437
|
+
:truncation,
|
|
438
|
+
enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation },
|
|
439
|
+
nil?: true
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
# @!attribute user
|
|
443
|
+
# @deprecated
|
|
444
|
+
#
|
|
445
|
+
# This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
|
|
446
|
+
# `prompt_cache_key` instead to maintain caching optimizations. A stable
|
|
447
|
+
# identifier for your end-users. Used to boost cache hit rates by better bucketing
|
|
448
|
+
# similar requests and to help OpenAI detect and prevent abuse.
|
|
449
|
+
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
|
450
|
+
#
|
|
451
|
+
# @return [String, nil]
|
|
452
|
+
optional :user, String
|
|
491
453
|
|
|
492
|
-
#
|
|
493
|
-
|
|
454
|
+
# @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
|
|
455
|
+
# Some parameter documentations has been truncated, see
|
|
456
|
+
# {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate} for more
|
|
457
|
+
# details.
|
|
458
|
+
#
|
|
459
|
+
# Client event for creating a response over a persistent WebSocket connection.
|
|
460
|
+
# This payload uses the same top-level fields as `POST /v1/responses`, plus
|
|
461
|
+
# WebSocket-only envelope metadata.
|
|
462
|
+
#
|
|
463
|
+
# Notes:
|
|
464
|
+
#
|
|
465
|
+
# - `stream` is implicit over WebSocket and should not be sent.
|
|
466
|
+
# - `background` is not supported over WebSocket.
|
|
467
|
+
# - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
|
|
468
|
+
#
|
|
469
|
+
# @param background [Boolean, nil] Whether to run the model response in the background.
|
|
470
|
+
#
|
|
471
|
+
# @param context_management [Array<OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement>, nil] Context management configuration for this request.
|
|
472
|
+
#
|
|
473
|
+
# @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
|
|
474
|
+
#
|
|
475
|
+
# @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
|
|
476
|
+
#
|
|
477
|
+
# @param input [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>] Text, image, or file inputs to the model, used to generate a response.
|
|
478
|
+
#
|
|
479
|
+
# @param instructions [String, nil] A system (or developer) message inserted into the model's context.
|
|
480
|
+
#
|
|
481
|
+
# @param max_output_tokens [Integer, nil] An upper bound for the number of tokens that can be generated for a response, in
|
|
482
|
+
#
|
|
483
|
+
# @param max_tool_calls [Integer, nil] The maximum number of total calls to built-in tools that can be processed in a r
|
|
484
|
+
#
|
|
485
|
+
# @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
|
|
486
|
+
#
|
|
487
|
+
# @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-6-astra`. OpenAI
|
|
488
|
+
#
|
|
489
|
+
# @param moderation [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation, nil] Configuration for running moderation on the input and output of this response.
|
|
490
|
+
#
|
|
491
|
+
# @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
|
|
492
|
+
#
|
|
493
|
+
# @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
|
|
494
|
+
#
|
|
495
|
+
# @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
|
|
496
|
+
#
|
|
497
|
+
# @param prompt_cache_key [String, nil] Used by OpenAI to cache responses for similar requests to optimize your cache hi
|
|
498
|
+
#
|
|
499
|
+
# @param prompt_cache_options [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions] Options for prompt caching. Supported for `gpt-5.6` and later models. By default
|
|
500
|
+
#
|
|
501
|
+
# @param prompt_cache_retention [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention, nil] Deprecated. Use `prompt_cache_options.ttl` instead.
|
|
502
|
+
#
|
|
503
|
+
# @param reasoning [OpenAI::Models::Reasoning, nil] Configuration options for
|
|
504
|
+
#
|
|
505
|
+
# @param safety_identifier [String, nil] A stable identifier used to help detect users of your application that may be vi
|
|
506
|
+
#
|
|
507
|
+
# @param service_tier [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier, nil] Specifies the processing type used for serving the request.
|
|
508
|
+
#
|
|
509
|
+
# @param store [Boolean, nil] Whether to store the generated model response for later retrieval via
|
|
510
|
+
#
|
|
511
|
+
# @param stream [Boolean, nil] If set to true, the model response data will be streamed to the client
|
|
512
|
+
#
|
|
513
|
+
# @param stream_id [String] The WebSocket lane for this response. Requests with the same
|
|
514
|
+
#
|
|
515
|
+
# @param stream_options [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions, nil] Options for streaming responses. Only set this when you set `stream: true`.
|
|
516
|
+
#
|
|
517
|
+
# @param temperature [Float, nil] What sampling temperature to use, between 0 and 2. Higher values like 0.8 will m
|
|
518
|
+
#
|
|
519
|
+
# @param text [OpenAI::Models::Responses::ResponseTextConfig] Configuration options for a text response from the model. Can be plain
|
|
520
|
+
#
|
|
521
|
+
# @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell] How the model should select which tool (or tools) to use when generating
|
|
522
|
+
#
|
|
523
|
+
# @param tools [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>] An array of tools the model may call while generating a response. You
|
|
524
|
+
#
|
|
525
|
+
# @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely
|
|
526
|
+
#
|
|
527
|
+
# @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling,
|
|
528
|
+
#
|
|
529
|
+
# @param truncation [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Truncation, nil] The truncation strategy to use for the model response.
|
|
530
|
+
#
|
|
531
|
+
# @param user [String] This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
|
|
532
|
+
#
|
|
533
|
+
# @param type [Symbol, :"response.create"] The type of the client event. Always `response.create`.
|
|
494
534
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
535
|
+
class ContextManagement < OpenAI::Internal::Type::BaseModel
|
|
536
|
+
# @!attribute type
|
|
537
|
+
# The context management entry type. Currently only 'compaction' is supported.
|
|
538
|
+
#
|
|
539
|
+
# @return [String]
|
|
540
|
+
required :type, String
|
|
498
541
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
|
505
|
-
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
|
506
|
-
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
|
507
|
-
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
508
|
-
#
|
|
509
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent#input
|
|
510
|
-
module Input
|
|
511
|
-
extend OpenAI::Internal::Type::Union
|
|
542
|
+
# @!attribute compact_threshold
|
|
543
|
+
# Token threshold at which compaction should be triggered for this entry.
|
|
544
|
+
#
|
|
545
|
+
# @return [Integer, nil]
|
|
546
|
+
optional :compact_threshold, Integer, nil?: true
|
|
512
547
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
548
|
+
# @!method initialize(type:, compact_threshold: nil)
|
|
549
|
+
# @param type [String] The context management entry type. Currently only 'compaction' is supported.
|
|
550
|
+
#
|
|
551
|
+
# @param compact_threshold [Integer, nil] Token threshold at which compaction should be triggered for this entry.
|
|
552
|
+
end
|
|
516
553
|
|
|
517
|
-
#
|
|
518
|
-
#
|
|
519
|
-
|
|
554
|
+
# The conversation that this response belongs to. Items from this conversation are
|
|
555
|
+
# prepended to `input_items` for this response request. Input items and output
|
|
556
|
+
# items from this response are automatically added to this conversation after this
|
|
557
|
+
# response completes.
|
|
558
|
+
#
|
|
559
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#conversation
|
|
560
|
+
module Conversation
|
|
561
|
+
extend OpenAI::Internal::Type::Union
|
|
520
562
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
end
|
|
563
|
+
# The unique ID of the conversation.
|
|
564
|
+
variant String
|
|
524
565
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
# @!attribute model
|
|
528
|
-
# The moderation model to use for moderated completions, e.g.
|
|
529
|
-
# 'omni-moderation-latest'.
|
|
530
|
-
#
|
|
531
|
-
# @return [String]
|
|
532
|
-
required :model, String
|
|
566
|
+
# The conversation that this response belongs to.
|
|
567
|
+
variant -> { OpenAI::Responses::ResponseConversationParam }
|
|
533
568
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
# @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy, nil]
|
|
538
|
-
optional :policy, -> { OpenAI::Responses::ResponsesClientEvent::Moderation::Policy }, nil?: true
|
|
569
|
+
# @!method self.variants
|
|
570
|
+
# @return [Array(String, OpenAI::Models::Responses::ResponseConversationParam)]
|
|
571
|
+
end
|
|
539
572
|
|
|
540
|
-
#
|
|
541
|
-
# Some parameter documentations has been truncated, see
|
|
542
|
-
# {OpenAI::Models::Responses::ResponsesClientEvent::Moderation} for more details.
|
|
573
|
+
# Text, image, or file inputs to the model, used to generate a response.
|
|
543
574
|
#
|
|
544
|
-
#
|
|
575
|
+
# Learn more:
|
|
545
576
|
#
|
|
546
|
-
#
|
|
577
|
+
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
|
578
|
+
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
|
579
|
+
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
|
580
|
+
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
|
581
|
+
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
547
582
|
#
|
|
548
|
-
#
|
|
583
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#input
|
|
584
|
+
module Input
|
|
585
|
+
extend OpenAI::Internal::Type::Union
|
|
586
|
+
|
|
587
|
+
# A text input to the model, equivalent to a text input with the
|
|
588
|
+
# `user` role.
|
|
589
|
+
variant String
|
|
590
|
+
|
|
591
|
+
# A list of one or many input items to the model, containing
|
|
592
|
+
# different content types.
|
|
593
|
+
variant -> { OpenAI::Responses::ResponseInput }
|
|
594
|
+
|
|
595
|
+
# @!method self.variants
|
|
596
|
+
# @return [Array(String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>)]
|
|
597
|
+
end
|
|
549
598
|
|
|
550
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent::
|
|
551
|
-
class
|
|
552
|
-
# @!attribute
|
|
553
|
-
# The moderation
|
|
599
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#moderation
|
|
600
|
+
class Moderation < OpenAI::Internal::Type::BaseModel
|
|
601
|
+
# @!attribute model
|
|
602
|
+
# The moderation model to use for moderated completions, e.g.
|
|
603
|
+
# 'omni-moderation-latest'.
|
|
554
604
|
#
|
|
555
|
-
# @return [
|
|
556
|
-
|
|
557
|
-
:input,
|
|
558
|
-
-> {
|
|
559
|
-
OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input
|
|
560
|
-
},
|
|
561
|
-
nil?: true
|
|
562
|
-
)
|
|
605
|
+
# @return [String]
|
|
606
|
+
required :model, String
|
|
563
607
|
|
|
564
|
-
# @!attribute
|
|
565
|
-
# The
|
|
608
|
+
# @!attribute policy
|
|
609
|
+
# The policy to apply to moderated response input and output.
|
|
566
610
|
#
|
|
567
|
-
# @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy
|
|
611
|
+
# @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy, nil]
|
|
568
612
|
optional(
|
|
569
|
-
:
|
|
570
|
-
-> {
|
|
571
|
-
OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output
|
|
572
|
-
},
|
|
613
|
+
:policy,
|
|
614
|
+
-> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy },
|
|
573
615
|
nil?: true
|
|
574
616
|
)
|
|
575
617
|
|
|
576
|
-
# @!method initialize(
|
|
577
|
-
#
|
|
618
|
+
# @!method initialize(model:, policy: nil)
|
|
619
|
+
# Some parameter documentations has been truncated, see
|
|
620
|
+
# {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation}
|
|
621
|
+
# for more details.
|
|
578
622
|
#
|
|
579
|
-
#
|
|
623
|
+
# Configuration for running moderation on the input and output of this response.
|
|
580
624
|
#
|
|
581
|
-
# @param
|
|
582
|
-
|
|
583
|
-
#
|
|
584
|
-
class Input < OpenAI::Internal::Type::BaseModel
|
|
585
|
-
# @!attribute mode
|
|
586
|
-
#
|
|
587
|
-
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode]
|
|
588
|
-
required :mode, enum: -> { OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode }
|
|
625
|
+
# @param model [String] The moderation model to use for moderated completions, e.g. 'omni-moderation-lat
|
|
626
|
+
#
|
|
627
|
+
# @param policy [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy, nil] The policy to apply to moderated response input and output.
|
|
589
628
|
|
|
590
|
-
|
|
629
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation#policy
|
|
630
|
+
class Policy < OpenAI::Internal::Type::BaseModel
|
|
631
|
+
# @!attribute input
|
|
591
632
|
# The moderation policy for the response input.
|
|
592
633
|
#
|
|
593
|
-
# @
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
634
|
+
# @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input, nil]
|
|
635
|
+
optional(
|
|
636
|
+
:input,
|
|
637
|
+
-> {
|
|
638
|
+
OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input
|
|
639
|
+
},
|
|
640
|
+
nil?: true
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
# @!attribute output
|
|
644
|
+
# The moderation policy for the response output.
|
|
645
|
+
#
|
|
646
|
+
# @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output, nil]
|
|
647
|
+
optional(
|
|
648
|
+
:output,
|
|
649
|
+
-> {
|
|
650
|
+
OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output
|
|
651
|
+
},
|
|
652
|
+
nil?: true
|
|
653
|
+
)
|
|
654
|
+
|
|
655
|
+
# @!method initialize(input: nil, output: nil)
|
|
656
|
+
# The policy to apply to moderated response input and output.
|
|
657
|
+
#
|
|
658
|
+
# @param input [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input, nil] The moderation policy for the response input.
|
|
659
|
+
#
|
|
660
|
+
# @param output [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output, nil] The moderation policy for the response output.
|
|
661
|
+
|
|
662
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy#input
|
|
663
|
+
class Input < OpenAI::Internal::Type::BaseModel
|
|
664
|
+
# @!attribute mode
|
|
665
|
+
#
|
|
666
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode]
|
|
667
|
+
required(
|
|
668
|
+
:mode,
|
|
669
|
+
enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode }
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
# @!method initialize(mode:)
|
|
673
|
+
# The moderation policy for the response input.
|
|
674
|
+
#
|
|
675
|
+
# @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode]
|
|
676
|
+
|
|
677
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input#mode
|
|
678
|
+
module Mode
|
|
679
|
+
extend OpenAI::Internal::Type::Enum
|
|
680
|
+
|
|
681
|
+
SCORE = :score
|
|
682
|
+
BLOCK = :block
|
|
683
|
+
|
|
684
|
+
# @!method self.values
|
|
685
|
+
# @return [Array<Symbol>]
|
|
686
|
+
end
|
|
687
|
+
end
|
|
601
688
|
|
|
602
|
-
|
|
603
|
-
|
|
689
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy#output
|
|
690
|
+
class Output < OpenAI::Internal::Type::BaseModel
|
|
691
|
+
# @!attribute mode
|
|
692
|
+
#
|
|
693
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode]
|
|
694
|
+
required(
|
|
695
|
+
:mode,
|
|
696
|
+
enum: -> {
|
|
697
|
+
OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode
|
|
698
|
+
}
|
|
699
|
+
)
|
|
700
|
+
|
|
701
|
+
# @!method initialize(mode:)
|
|
702
|
+
# The moderation policy for the response output.
|
|
703
|
+
#
|
|
704
|
+
# @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode]
|
|
705
|
+
|
|
706
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output#mode
|
|
707
|
+
module Mode
|
|
708
|
+
extend OpenAI::Internal::Type::Enum
|
|
709
|
+
|
|
710
|
+
SCORE = :score
|
|
711
|
+
BLOCK = :block
|
|
712
|
+
|
|
713
|
+
# @!method self.values
|
|
714
|
+
# @return [Array<Symbol>]
|
|
715
|
+
end
|
|
604
716
|
end
|
|
605
717
|
end
|
|
718
|
+
end
|
|
606
719
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
720
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#prompt_cache_options
|
|
721
|
+
class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
|
|
722
|
+
# @!attribute mode
|
|
723
|
+
# Controls whether OpenAI automatically creates an implicit cache breakpoint.
|
|
724
|
+
# Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
|
|
725
|
+
# and writes up to the latest three explicit breakpoints in the request. With
|
|
726
|
+
# `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
|
|
727
|
+
# latest four explicit breakpoints. If there are no explicit breakpoints, the
|
|
728
|
+
# request does not use prompt caching.
|
|
729
|
+
#
|
|
730
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode, nil]
|
|
731
|
+
optional(
|
|
732
|
+
:mode,
|
|
733
|
+
enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode }
|
|
734
|
+
)
|
|
613
735
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
736
|
+
# @!attribute ttl
|
|
737
|
+
# The minimum lifetime applied to every implicit and explicit cache breakpoint
|
|
738
|
+
# written by the request. Defaults to `30m`, which is currently the only supported
|
|
739
|
+
# value. The backend may retain cache entries for longer.
|
|
740
|
+
#
|
|
741
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl, nil]
|
|
742
|
+
optional(
|
|
743
|
+
:ttl,
|
|
744
|
+
enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl }
|
|
745
|
+
)
|
|
618
746
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
747
|
+
# @!method initialize(mode: nil, ttl: nil)
|
|
748
|
+
# Some parameter documentations has been truncated, see
|
|
749
|
+
# {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions}
|
|
750
|
+
# for more details.
|
|
751
|
+
#
|
|
752
|
+
# Options for prompt caching. Supported for `gpt-5.6` and later models. By
|
|
753
|
+
# default, OpenAI automatically chooses one implicit cache breakpoint. You can add
|
|
754
|
+
# explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
|
|
755
|
+
# request can write up to four breakpoints. For cache matching, OpenAI considers
|
|
756
|
+
# up to the latest 80 breakpoints in the conversation, without a content-block
|
|
757
|
+
# lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
|
|
758
|
+
# `ttl` defaults to `30m`, which is currently the only supported value. See the
|
|
759
|
+
# [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
|
|
760
|
+
# for current details.
|
|
761
|
+
#
|
|
762
|
+
# @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode] Controls whether OpenAI automatically creates an implicit cache breakpoint. Defa
|
|
763
|
+
#
|
|
764
|
+
# @param ttl [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl] The minimum lifetime applied to every implicit and explicit cache breakpoint wri
|
|
765
|
+
|
|
766
|
+
# Controls whether OpenAI automatically creates an implicit cache breakpoint.
|
|
767
|
+
# Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
|
|
768
|
+
# and writes up to the latest three explicit breakpoints in the request. With
|
|
769
|
+
# `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
|
|
770
|
+
# latest four explicit breakpoints. If there are no explicit breakpoints, the
|
|
771
|
+
# request does not use prompt caching.
|
|
772
|
+
#
|
|
773
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions#mode
|
|
774
|
+
module Mode
|
|
775
|
+
extend OpenAI::Internal::Type::Enum
|
|
622
776
|
|
|
623
|
-
|
|
624
|
-
|
|
777
|
+
IMPLICIT = :implicit
|
|
778
|
+
EXPLICIT = :explicit
|
|
625
779
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
end
|
|
780
|
+
# @!method self.values
|
|
781
|
+
# @return [Array<Symbol>]
|
|
629
782
|
end
|
|
630
|
-
end
|
|
631
|
-
end
|
|
632
783
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
# latest four explicit breakpoints. If there are no explicit breakpoints, the
|
|
641
|
-
# request does not use prompt caching.
|
|
642
|
-
#
|
|
643
|
-
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions::Mode, nil]
|
|
644
|
-
optional :mode, enum: -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode }
|
|
784
|
+
# The minimum lifetime applied to every implicit and explicit cache breakpoint
|
|
785
|
+
# written by the request. Defaults to `30m`, which is currently the only supported
|
|
786
|
+
# value. The backend may retain cache entries for longer.
|
|
787
|
+
#
|
|
788
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions#ttl
|
|
789
|
+
module Ttl
|
|
790
|
+
extend OpenAI::Internal::Type::Enum
|
|
645
791
|
|
|
646
|
-
|
|
647
|
-
# The minimum lifetime applied to every implicit and explicit cache breakpoint
|
|
648
|
-
# written by the request. Defaults to `30m`, which is currently the only supported
|
|
649
|
-
# value. The backend may retain cache entries for longer.
|
|
650
|
-
#
|
|
651
|
-
# @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl, nil]
|
|
652
|
-
optional :ttl, enum: -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl }
|
|
792
|
+
TTL_30M = :"30m"
|
|
653
793
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
794
|
+
# @!method self.values
|
|
795
|
+
# @return [Array<Symbol>]
|
|
796
|
+
end
|
|
797
|
+
end
|
|
798
|
+
|
|
799
|
+
# @deprecated
|
|
658
800
|
#
|
|
659
|
-
#
|
|
660
|
-
# default, OpenAI automatically chooses one implicit cache breakpoint. You can add
|
|
661
|
-
# explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
|
|
662
|
-
# request can write up to four breakpoints. For cache matching, OpenAI considers
|
|
663
|
-
# up to the latest 80 breakpoints in the conversation, without a content-block
|
|
664
|
-
# lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
|
|
665
|
-
# `ttl` defaults to `30m`, which is currently the only supported value. See the
|
|
666
|
-
# [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
|
|
667
|
-
# for current details.
|
|
801
|
+
# Deprecated. Use `prompt_cache_options.ttl` instead.
|
|
668
802
|
#
|
|
669
|
-
#
|
|
803
|
+
# The retention policy for the prompt cache. Set to `24h` to enable extended
|
|
804
|
+
# prompt caching, which keeps cached prefixes active for longer, up to a maximum
|
|
805
|
+
# of 24 hours.
|
|
806
|
+
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
|
|
807
|
+
# This field expresses a maximum retention policy, while
|
|
808
|
+
# `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
|
|
809
|
+
# are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
|
|
810
|
+
# models, only `24h` is supported.
|
|
670
811
|
#
|
|
671
|
-
#
|
|
672
|
-
|
|
673
|
-
#
|
|
674
|
-
#
|
|
675
|
-
#
|
|
676
|
-
#
|
|
677
|
-
# latest four explicit breakpoints. If there are no explicit breakpoints, the
|
|
678
|
-
# request does not use prompt caching.
|
|
812
|
+
# For older models that support both `in_memory` and `24h`, the default depends on
|
|
813
|
+
# your organization's data retention policy:
|
|
814
|
+
#
|
|
815
|
+
# - Organizations without ZDR enabled default to `24h`.
|
|
816
|
+
# - Organizations with ZDR enabled default to `in_memory` when
|
|
817
|
+
# `prompt_cache_retention` is not specified.
|
|
679
818
|
#
|
|
680
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent::
|
|
681
|
-
module
|
|
819
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#prompt_cache_retention
|
|
820
|
+
module PromptCacheRetention
|
|
682
821
|
extend OpenAI::Internal::Type::Enum
|
|
683
822
|
|
|
684
|
-
|
|
685
|
-
|
|
823
|
+
IN_MEMORY = :in_memory
|
|
824
|
+
PROMPT_CACHE_RETENTION_24H = :"24h"
|
|
686
825
|
|
|
687
826
|
# @!method self.values
|
|
688
827
|
# @return [Array<Symbol>]
|
|
689
828
|
end
|
|
690
829
|
|
|
691
|
-
#
|
|
692
|
-
#
|
|
693
|
-
#
|
|
830
|
+
# Specifies the processing type used for serving the request.
|
|
831
|
+
#
|
|
832
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
|
833
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
|
834
|
+
# will use 'default'.
|
|
835
|
+
# - If set to 'default', then the request will be processed with the standard
|
|
836
|
+
# pricing and performance for the selected model.
|
|
837
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
|
|
838
|
+
# then the request will be processed with the Flex Processing service tier.
|
|
839
|
+
# - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
|
|
840
|
+
# include the `service_tier=fast` or `service_tier=priority` parameter for
|
|
841
|
+
# Responses or Chat Completions. The response will show `service_tier=priority`
|
|
842
|
+
# regardless of if you specify `service_tier=fast` or `priority` in your
|
|
843
|
+
# request.
|
|
844
|
+
# - If set to 'ultrafast', then the request will be processed with the
|
|
845
|
+
# access-controlled Ultrafast Processing service tier. This tier is currently
|
|
846
|
+
# available for `gpt-5.6-sol`; a response served through it will show
|
|
847
|
+
# `service_tier=ultrafast`.
|
|
848
|
+
# - When not set, the default behavior is 'auto'.
|
|
849
|
+
#
|
|
850
|
+
# When the `service_tier` parameter is set, the response body will include the
|
|
851
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
|
852
|
+
# request. This response value may be different from the value set in the
|
|
853
|
+
# parameter.
|
|
694
854
|
#
|
|
695
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent::
|
|
696
|
-
module
|
|
855
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#service_tier
|
|
856
|
+
module ServiceTier
|
|
697
857
|
extend OpenAI::Internal::Type::Enum
|
|
698
858
|
|
|
699
|
-
|
|
859
|
+
AUTO = :auto
|
|
860
|
+
DEFAULT = :default
|
|
861
|
+
FLEX = :flex
|
|
862
|
+
SCALE = :scale
|
|
863
|
+
PRIORITY = :priority
|
|
864
|
+
FAST = :fast
|
|
865
|
+
ULTRAFAST = :ultrafast
|
|
700
866
|
|
|
701
867
|
# @!method self.values
|
|
702
868
|
# @return [Array<Symbol>]
|
|
703
869
|
end
|
|
704
|
-
end
|
|
705
|
-
|
|
706
|
-
# @deprecated
|
|
707
|
-
#
|
|
708
|
-
# Deprecated. Use `prompt_cache_options.ttl` instead.
|
|
709
|
-
#
|
|
710
|
-
# The retention policy for the prompt cache. Set to `24h` to enable extended
|
|
711
|
-
# prompt caching, which keeps cached prefixes active for longer, up to a maximum
|
|
712
|
-
# of 24 hours.
|
|
713
|
-
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
|
|
714
|
-
# This field expresses a maximum retention policy, while
|
|
715
|
-
# `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
|
|
716
|
-
# are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
|
|
717
|
-
# models, only `24h` is supported.
|
|
718
|
-
#
|
|
719
|
-
# For older models that support both `in_memory` and `24h`, the default depends on
|
|
720
|
-
# your organization's data retention policy:
|
|
721
|
-
#
|
|
722
|
-
# - Organizations without ZDR enabled default to `24h`.
|
|
723
|
-
# - Organizations with ZDR enabled default to `in_memory` when
|
|
724
|
-
# `prompt_cache_retention` is not specified.
|
|
725
|
-
#
|
|
726
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent#prompt_cache_retention
|
|
727
|
-
module PromptCacheRetention
|
|
728
|
-
extend OpenAI::Internal::Type::Enum
|
|
729
|
-
|
|
730
|
-
IN_MEMORY = :in_memory
|
|
731
|
-
PROMPT_CACHE_RETENTION_24H = :"24h"
|
|
732
|
-
|
|
733
|
-
# @!method self.values
|
|
734
|
-
# @return [Array<Symbol>]
|
|
735
|
-
end
|
|
736
870
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
# regardless of if you specify `service_tier=fast` or `priority` in your
|
|
750
|
-
# request.
|
|
751
|
-
# - If set to 'ultrafast', then the request will be processed with the
|
|
752
|
-
# access-controlled Ultrafast Processing service tier. This tier is currently
|
|
753
|
-
# available for `gpt-5.6-sol`; a response served through it will show
|
|
754
|
-
# `service_tier=ultrafast`.
|
|
755
|
-
# - When not set, the default behavior is 'auto'.
|
|
756
|
-
#
|
|
757
|
-
# When the `service_tier` parameter is set, the response body will include the
|
|
758
|
-
# `service_tier` value based on the processing mode actually used to serve the
|
|
759
|
-
# request. This response value may be different from the value set in the
|
|
760
|
-
# parameter.
|
|
761
|
-
#
|
|
762
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent#service_tier
|
|
763
|
-
module ServiceTier
|
|
764
|
-
extend OpenAI::Internal::Type::Enum
|
|
765
|
-
|
|
766
|
-
AUTO = :auto
|
|
767
|
-
DEFAULT = :default
|
|
768
|
-
FLEX = :flex
|
|
769
|
-
SCALE = :scale
|
|
770
|
-
PRIORITY = :priority
|
|
771
|
-
FAST = :fast
|
|
772
|
-
ULTRAFAST = :ultrafast
|
|
773
|
-
|
|
774
|
-
# @!method self.values
|
|
775
|
-
# @return [Array<Symbol>]
|
|
776
|
-
end
|
|
871
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#stream_options
|
|
872
|
+
class StreamOptions < OpenAI::Internal::Type::BaseModel
|
|
873
|
+
# @!attribute include_obfuscation
|
|
874
|
+
# When true, stream obfuscation will be enabled. Stream obfuscation adds random
|
|
875
|
+
# characters to an `obfuscation` field on streaming delta events to normalize
|
|
876
|
+
# payload sizes as a mitigation to certain side-channel attacks. These obfuscation
|
|
877
|
+
# fields are included by default, but add a small amount of overhead to the data
|
|
878
|
+
# stream. You can set `include_obfuscation` to false to optimize for bandwidth if
|
|
879
|
+
# you trust the network links between your application and the OpenAI API.
|
|
880
|
+
#
|
|
881
|
+
# @return [Boolean, nil]
|
|
882
|
+
optional :include_obfuscation, OpenAI::Internal::Type::Boolean
|
|
777
883
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
#
|
|
788
|
-
# @return [Boolean, nil]
|
|
789
|
-
optional :include_obfuscation, OpenAI::Internal::Type::Boolean
|
|
884
|
+
# @!method initialize(include_obfuscation: nil)
|
|
885
|
+
# Some parameter documentations has been truncated, see
|
|
886
|
+
# {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions}
|
|
887
|
+
# for more details.
|
|
888
|
+
#
|
|
889
|
+
# Options for streaming responses. Only set this when you set `stream: true`.
|
|
890
|
+
#
|
|
891
|
+
# @param include_obfuscation [Boolean] When true, stream obfuscation will be enabled. Stream obfuscation adds
|
|
892
|
+
end
|
|
790
893
|
|
|
791
|
-
#
|
|
792
|
-
#
|
|
793
|
-
#
|
|
794
|
-
# details.
|
|
795
|
-
#
|
|
796
|
-
# Options for streaming responses. Only set this when you set `stream: true`.
|
|
894
|
+
# How the model should select which tool (or tools) to use when generating a
|
|
895
|
+
# response. See the `tools` parameter to see how to specify which tools the model
|
|
896
|
+
# can call.
|
|
797
897
|
#
|
|
798
|
-
#
|
|
799
|
-
|
|
898
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#tool_choice
|
|
899
|
+
module ToolChoice
|
|
900
|
+
extend OpenAI::Internal::Type::Union
|
|
800
901
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
902
|
+
# Controls which (if any) tool is called by the model.
|
|
903
|
+
#
|
|
904
|
+
# `none` means the model will not call any tool and instead generates a message.
|
|
905
|
+
#
|
|
906
|
+
# `auto` means the model can pick between generating a message or calling one or
|
|
907
|
+
# more tools.
|
|
908
|
+
#
|
|
909
|
+
# `required` means the model must call one or more tools.
|
|
910
|
+
variant enum: -> { OpenAI::Responses::ToolChoiceOptions }
|
|
808
911
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
# `none` means the model will not call any tool and instead generates a message.
|
|
812
|
-
#
|
|
813
|
-
# `auto` means the model can pick between generating a message or calling one or
|
|
814
|
-
# more tools.
|
|
815
|
-
#
|
|
816
|
-
# `required` means the model must call one or more tools.
|
|
817
|
-
variant enum: -> { OpenAI::Responses::ToolChoiceOptions }
|
|
912
|
+
# Constrains the tools available to the model to a pre-defined set.
|
|
913
|
+
variant -> { OpenAI::Responses::ToolChoiceAllowed }
|
|
818
914
|
|
|
819
|
-
|
|
820
|
-
|
|
915
|
+
# Indicates that the model should use a built-in tool to generate a response.
|
|
916
|
+
# [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
|
|
917
|
+
variant -> { OpenAI::Responses::ToolChoiceTypes }
|
|
821
918
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
variant -> { OpenAI::Responses::ToolChoiceTypes }
|
|
919
|
+
# Use this option to force the model to call a specific function.
|
|
920
|
+
variant -> { OpenAI::Responses::ToolChoiceFunction }
|
|
825
921
|
|
|
826
|
-
|
|
827
|
-
|
|
922
|
+
# Use this option to force the model to call a specific tool on a remote MCP server.
|
|
923
|
+
variant -> { OpenAI::Responses::ToolChoiceMcp }
|
|
828
924
|
|
|
829
|
-
|
|
830
|
-
|
|
925
|
+
# Use this option to force the model to call a specific custom tool.
|
|
926
|
+
variant -> { OpenAI::Responses::ToolChoiceCustom }
|
|
831
927
|
|
|
832
|
-
|
|
833
|
-
|
|
928
|
+
variant(
|
|
929
|
+
-> {
|
|
930
|
+
OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam
|
|
931
|
+
}
|
|
932
|
+
)
|
|
834
933
|
|
|
835
|
-
|
|
934
|
+
# Forces the model to call the apply_patch tool when executing a tool call.
|
|
935
|
+
variant -> { OpenAI::Responses::ToolChoiceApplyPatch }
|
|
836
936
|
|
|
837
|
-
|
|
838
|
-
|
|
937
|
+
# Forces the model to call the shell tool when a tool call is required.
|
|
938
|
+
variant -> { OpenAI::Responses::ToolChoiceShell }
|
|
839
939
|
|
|
840
|
-
|
|
841
|
-
|
|
940
|
+
class SpecificProgrammaticToolCallingParam < OpenAI::Internal::Type::BaseModel
|
|
941
|
+
# @!attribute type
|
|
942
|
+
# The tool to call. Always `programmatic_tool_calling`.
|
|
943
|
+
#
|
|
944
|
+
# @return [Symbol, :programmatic_tool_calling]
|
|
945
|
+
required :type, const: :programmatic_tool_calling
|
|
842
946
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
#
|
|
847
|
-
# @return [Symbol, :programmatic_tool_calling]
|
|
848
|
-
required :type, const: :programmatic_tool_calling
|
|
947
|
+
# @!method initialize(type: :programmatic_tool_calling)
|
|
948
|
+
# @param type [Symbol, :programmatic_tool_calling] The tool to call. Always `programmatic_tool_calling`.
|
|
949
|
+
end
|
|
849
950
|
|
|
850
|
-
# @!method
|
|
851
|
-
# @
|
|
951
|
+
# @!method self.variants
|
|
952
|
+
# @return [Array(Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell)]
|
|
852
953
|
end
|
|
853
954
|
|
|
854
|
-
#
|
|
855
|
-
#
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
#
|
|
868
|
-
# @see OpenAI::Models::Responses::ResponsesClientEvent#truncation
|
|
869
|
-
module Truncation
|
|
870
|
-
extend OpenAI::Internal::Type::Enum
|
|
955
|
+
# @deprecated
|
|
956
|
+
#
|
|
957
|
+
# The truncation strategy to use for the model response.
|
|
958
|
+
#
|
|
959
|
+
# - `auto`: If the input to this Response exceeds the model's context window size,
|
|
960
|
+
# the model will truncate the response to fit the context window by dropping
|
|
961
|
+
# items from the beginning of the conversation.
|
|
962
|
+
# - `disabled` (default): If the input size will exceed the context window size
|
|
963
|
+
# for a model, the request will fail with a 400 error.
|
|
964
|
+
#
|
|
965
|
+
# @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#truncation
|
|
966
|
+
module Truncation
|
|
967
|
+
extend OpenAI::Internal::Type::Enum
|
|
871
968
|
|
|
872
|
-
|
|
873
|
-
|
|
969
|
+
AUTO = :auto
|
|
970
|
+
DISABLED = :disabled
|
|
874
971
|
|
|
875
|
-
|
|
876
|
-
|
|
972
|
+
# @!method self.values
|
|
973
|
+
# @return [Array<Symbol>]
|
|
974
|
+
end
|
|
877
975
|
end
|
|
976
|
+
|
|
977
|
+
# @!method self.variants
|
|
978
|
+
# @return [Array(OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate, OpenAI::Models::Responses::ResponseSteerEvent)]
|
|
878
979
|
end
|
|
879
980
|
end
|
|
880
981
|
end
|