openai 0.16.0 → 0.17.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 +24 -0
- data/README.md +14 -20
- data/lib/openai/internal/transport/base_client.rb +1 -1
- data/lib/openai/internal/type/enum.rb +6 -6
- data/lib/openai/internal/type/union.rb +13 -17
- data/lib/openai/models/beta/assistant_create_params.rb +4 -5
- data/lib/openai/models/beta/assistant_update_params.rb +22 -5
- data/lib/openai/models/beta/threads/run_create_params.rb +4 -5
- data/lib/openai/models/chat/chat_completion_allowed_tool_choice.rb +33 -0
- data/lib/openai/models/chat/chat_completion_allowed_tools.rb +64 -0
- data/lib/openai/models/chat/chat_completion_assistant_message_param.rb +3 -5
- data/lib/openai/models/chat/chat_completion_custom_tool.rb +163 -0
- data/lib/openai/models/chat/chat_completion_function_tool.rb +29 -0
- data/lib/openai/models/chat/chat_completion_message.rb +3 -5
- data/lib/openai/models/chat/chat_completion_message_custom_tool_call.rb +60 -0
- data/lib/openai/models/chat/chat_completion_message_function_tool_call.rb +73 -0
- data/lib/openai/models/chat/chat_completion_message_tool_call.rb +10 -56
- data/lib/openai/models/chat/chat_completion_named_tool_choice.rb +2 -2
- data/lib/openai/models/chat/chat_completion_named_tool_choice_custom.rb +42 -0
- data/lib/openai/models/chat/chat_completion_stream_options.rb +14 -1
- data/lib/openai/models/chat/chat_completion_tool.rb +12 -14
- data/lib/openai/models/chat/chat_completion_tool_choice_option.rb +7 -1
- data/lib/openai/models/chat/completion_create_params.rb +35 -12
- data/lib/openai/models/chat_model.rb +7 -0
- data/lib/openai/models/custom_tool_input_format.rb +76 -0
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +3 -3
- data/lib/openai/models/evals/run_cancel_response.rb +2 -2
- data/lib/openai/models/evals/run_create_params.rb +2 -2
- data/lib/openai/models/evals/run_create_response.rb +2 -2
- data/lib/openai/models/evals/run_list_response.rb +2 -2
- data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
- data/lib/openai/models/reasoning.rb +4 -5
- data/lib/openai/models/reasoning_effort.rb +4 -4
- data/lib/openai/models/response_format_text_grammar.rb +27 -0
- data/lib/openai/models/response_format_text_python.rb +20 -0
- data/lib/openai/models/responses/custom_tool.rb +48 -0
- data/lib/openai/models/responses/response.rb +20 -12
- data/lib/openai/models/responses/response_create_params.rb +48 -10
- data/lib/openai/models/responses/response_custom_tool_call.rb +55 -0
- data/lib/openai/models/responses/response_custom_tool_call_input_delta_event.rb +52 -0
- data/lib/openai/models/responses/response_custom_tool_call_input_done_event.rb +52 -0
- data/lib/openai/models/responses/response_custom_tool_call_output.rb +47 -0
- data/lib/openai/models/responses/response_input_item.rb +7 -1
- data/lib/openai/models/responses/response_output_item.rb +4 -1
- data/lib/openai/models/responses/response_output_item_added_event.rb +2 -2
- data/lib/openai/models/responses/response_output_item_done_event.rb +2 -2
- data/lib/openai/models/responses/response_reasoning_item.rb +36 -5
- data/lib/openai/models/responses/response_reasoning_text_delta_event.rb +63 -0
- data/lib/openai/models/responses/response_reasoning_text_done_event.rb +63 -0
- data/lib/openai/models/responses/response_retrieve_params.rb +14 -1
- data/lib/openai/models/responses/response_stream_event.rb +13 -11
- data/lib/openai/models/responses/response_text_config.rb +27 -1
- data/lib/openai/models/responses/tool.rb +5 -1
- data/lib/openai/models/responses/tool_choice_allowed.rb +73 -0
- data/lib/openai/models/responses/tool_choice_custom.rb +28 -0
- data/lib/openai/models/vector_store_search_params.rb +6 -1
- data/lib/openai/models.rb +6 -0
- data/lib/openai/resources/beta/assistants.rb +2 -2
- data/lib/openai/resources/beta/threads/runs.rb +2 -2
- data/lib/openai/resources/chat/completions.rb +16 -10
- data/lib/openai/resources/responses.rb +38 -22
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +19 -2
- data/rbi/openai/internal/transport/base_client.rbi +1 -1
- data/rbi/openai/models/beta/assistant_create_params.rbi +6 -8
- data/rbi/openai/models/beta/assistant_update_params.rbi +36 -8
- data/rbi/openai/models/beta/threads/run_create_params.rbi +6 -8
- data/rbi/openai/models/chat/chat_completion_allowed_tool_choice.rbi +60 -0
- data/rbi/openai/models/chat/chat_completion_allowed_tools.rbi +118 -0
- data/rbi/openai/models/chat/chat_completion_assistant_message_param.rbi +27 -4
- data/rbi/openai/models/chat/chat_completion_custom_tool.rbi +335 -0
- data/rbi/openai/models/chat/chat_completion_function_tool.rbi +51 -0
- data/rbi/openai/models/chat/chat_completion_message.rbi +17 -4
- data/rbi/openai/models/chat/chat_completion_message_custom_tool_call.rbi +105 -0
- data/rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi +118 -0
- data/rbi/openai/models/chat/chat_completion_message_tool_call.rbi +9 -92
- data/rbi/openai/models/chat/chat_completion_named_tool_choice.rbi +2 -2
- data/rbi/openai/models/chat/chat_completion_named_tool_choice_custom.rbi +89 -0
- data/rbi/openai/models/chat/chat_completion_stream_options.rbi +30 -2
- data/rbi/openai/models/chat/chat_completion_tool.rbi +11 -30
- data/rbi/openai/models/chat/chat_completion_tool_choice_option.rbi +3 -1
- data/rbi/openai/models/chat/completion_create_params.rbi +106 -25
- data/rbi/openai/models/chat_model.rbi +11 -0
- data/rbi/openai/models/custom_tool_input_format.rbi +136 -0
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +8 -4
- data/rbi/openai/models/evals/run_cancel_response.rbi +2 -0
- data/rbi/openai/models/evals/run_create_params.rbi +4 -0
- data/rbi/openai/models/evals/run_create_response.rbi +2 -0
- data/rbi/openai/models/evals/run_list_response.rbi +2 -0
- data/rbi/openai/models/evals/run_retrieve_response.rbi +2 -0
- data/rbi/openai/models/reasoning.rbi +6 -8
- data/rbi/openai/models/reasoning_effort.rbi +4 -4
- data/rbi/openai/models/response_format_text_grammar.rbi +35 -0
- data/rbi/openai/models/response_format_text_python.rbi +30 -0
- data/rbi/openai/models/responses/custom_tool.rbi +96 -0
- data/rbi/openai/models/responses/response.rbi +15 -5
- data/rbi/openai/models/responses/response_create_params.rbi +94 -7
- data/rbi/openai/models/responses/response_custom_tool_call.rbi +78 -0
- data/rbi/openai/models/responses/response_custom_tool_call_input_delta_event.rbi +75 -0
- data/rbi/openai/models/responses/response_custom_tool_call_input_done_event.rbi +75 -0
- data/rbi/openai/models/responses/response_custom_tool_call_output.rbi +65 -0
- data/rbi/openai/models/responses/response_input_item.rbi +2 -0
- data/rbi/openai/models/responses/response_output_item.rbi +2 -1
- data/rbi/openai/models/responses/response_output_item_added_event.rbi +2 -1
- data/rbi/openai/models/responses/response_output_item_done_event.rbi +2 -1
- data/rbi/openai/models/responses/response_reasoning_item.rbi +63 -4
- data/rbi/openai/models/responses/response_reasoning_text_delta_event.rbi +83 -0
- data/rbi/openai/models/responses/{response_reasoning_summary_done_event.rbi → response_reasoning_text_done_event.rbi} +20 -20
- data/rbi/openai/models/responses/response_retrieve_params.rbi +21 -0
- data/rbi/openai/models/responses/response_stream_event.rbi +4 -2
- data/rbi/openai/models/responses/response_text_config.rbi +64 -1
- data/rbi/openai/models/responses/tool.rbi +1 -0
- data/rbi/openai/models/responses/tool_choice_allowed.rbi +124 -0
- data/rbi/openai/models/responses/tool_choice_custom.rbi +39 -0
- data/rbi/openai/models/vector_store_search_params.rbi +12 -1
- data/rbi/openai/models.rbi +6 -0
- data/rbi/openai/resources/beta/assistants.rbi +6 -8
- data/rbi/openai/resources/beta/threads/runs.rbi +8 -10
- data/rbi/openai/resources/chat/completions.rbi +44 -19
- data/rbi/openai/resources/responses.rbi +215 -41
- data/sig/openai/internal/transport/base_client.rbs +1 -1
- data/sig/openai/models/beta/assistant_update_params.rbs +12 -0
- data/sig/openai/models/chat/chat_completion_allowed_tool_choice.rbs +29 -0
- data/sig/openai/models/chat/chat_completion_allowed_tools.rbs +38 -0
- data/sig/openai/models/chat/chat_completion_assistant_message_param.rbs +6 -6
- data/sig/openai/models/chat/chat_completion_custom_tool.rbs +137 -0
- data/sig/openai/models/chat/chat_completion_function_tool.rbs +26 -0
- data/sig/openai/models/chat/chat_completion_message.rbs +6 -6
- data/sig/openai/models/chat/chat_completion_message_custom_tool_call.rbs +46 -0
- data/sig/openai/models/chat/chat_completion_message_function_tool_call.rbs +46 -0
- data/sig/openai/models/chat/chat_completion_message_tool_call.rbs +6 -35
- data/sig/openai/models/chat/chat_completion_named_tool_choice_custom.rbs +39 -0
- data/sig/openai/models/chat/chat_completion_stream_options.rbs +11 -3
- data/sig/openai/models/chat/chat_completion_tool.rbs +6 -15
- data/sig/openai/models/chat/chat_completion_tool_choice_option.rbs +2 -0
- data/sig/openai/models/chat/completion_create_params.rbs +23 -6
- data/sig/openai/models/chat_model.rbs +15 -1
- data/sig/openai/models/custom_tool_input_format.rbs +61 -0
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +6 -6
- data/sig/openai/models/reasoning_effort.rbs +2 -1
- data/sig/openai/models/response_format_text_grammar.rbs +15 -0
- data/sig/openai/models/response_format_text_python.rbs +13 -0
- data/sig/openai/models/responses/custom_tool.rbs +43 -0
- data/sig/openai/models/responses/response.rbs +2 -0
- data/sig/openai/models/responses/response_create_params.rbs +19 -0
- data/sig/openai/models/responses/response_custom_tool_call.rbs +44 -0
- data/sig/openai/models/responses/response_custom_tool_call_input_delta_event.rbs +42 -0
- data/sig/openai/models/responses/response_custom_tool_call_input_done_event.rbs +42 -0
- data/sig/openai/models/responses/response_custom_tool_call_output.rbs +39 -0
- data/sig/openai/models/responses/response_input_item.rbs +2 -0
- data/sig/openai/models/responses/response_output_item.rbs +1 -0
- data/sig/openai/models/responses/response_reasoning_item.rbs +21 -0
- data/sig/openai/models/responses/{response_reasoning_summary_delta_event.rbs → response_reasoning_text_delta_event.rbs} +15 -15
- data/sig/openai/models/responses/{response_reasoning_summary_done_event.rbs → response_reasoning_text_done_event.rbs} +11 -11
- data/sig/openai/models/responses/response_retrieve_params.rbs +7 -0
- data/sig/openai/models/responses/response_stream_event.rbs +4 -2
- data/sig/openai/models/responses/response_text_config.rbs +22 -3
- data/sig/openai/models/responses/tool.rbs +1 -0
- data/sig/openai/models/responses/tool_choice_allowed.rbs +43 -0
- data/sig/openai/models/responses/tool_choice_custom.rbs +17 -0
- data/sig/openai/models/vector_store_search_params.rbs +2 -1
- data/sig/openai/models.rbs +6 -0
- data/sig/openai/resources/chat/completions.rbs +4 -2
- data/sig/openai/resources/responses.rbs +32 -0
- metadata +59 -8
- data/lib/openai/models/responses/response_reasoning_summary_delta_event.rb +0 -65
- data/lib/openai/models/responses/response_reasoning_summary_done_event.rb +0 -60
- data/rbi/openai/models/responses/response_reasoning_summary_delta_event.rbi +0 -85
@@ -225,12 +225,11 @@ module OpenAI
|
|
225
225
|
sig { params(prompt_cache_key: String).void }
|
226
226
|
attr_writer :prompt_cache_key
|
227
227
|
|
228
|
-
# **o-series models only**
|
229
|
-
#
|
230
228
|
# Constrains effort on reasoning for
|
231
229
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
232
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
233
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
230
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
231
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
232
|
+
# response.
|
234
233
|
sig { returns(T.nilable(OpenAI::ReasoningEffort::OrSymbol)) }
|
235
234
|
attr_accessor :reasoning_effort
|
236
235
|
|
@@ -368,7 +367,9 @@ module OpenAI
|
|
368
367
|
T.nilable(
|
369
368
|
T.any(
|
370
369
|
OpenAI::Chat::ChatCompletionToolChoiceOption::Auto::OrSymbol,
|
371
|
-
OpenAI::Chat::
|
370
|
+
OpenAI::Chat::ChatCompletionAllowedToolChoice,
|
371
|
+
OpenAI::Chat::ChatCompletionNamedToolChoice,
|
372
|
+
OpenAI::Chat::ChatCompletionNamedToolChoiceCustom
|
372
373
|
)
|
373
374
|
)
|
374
375
|
)
|
@@ -380,16 +381,29 @@ module OpenAI
|
|
380
381
|
tool_choice:
|
381
382
|
T.any(
|
382
383
|
OpenAI::Chat::ChatCompletionToolChoiceOption::Auto::OrSymbol,
|
383
|
-
OpenAI::Chat::
|
384
|
+
OpenAI::Chat::ChatCompletionAllowedToolChoice::OrHash,
|
385
|
+
OpenAI::Chat::ChatCompletionNamedToolChoice::OrHash,
|
386
|
+
OpenAI::Chat::ChatCompletionNamedToolChoiceCustom::OrHash
|
384
387
|
)
|
385
388
|
).void
|
386
389
|
end
|
387
390
|
attr_writer :tool_choice
|
388
391
|
|
389
|
-
# A list of tools the model may call.
|
390
|
-
#
|
391
|
-
#
|
392
|
-
sig
|
392
|
+
# A list of tools the model may call. You can provide either
|
393
|
+
# [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
|
394
|
+
# or [function tools](https://platform.openai.com/docs/guides/function-calling).
|
395
|
+
sig do
|
396
|
+
returns(
|
397
|
+
T.nilable(
|
398
|
+
T::Array[
|
399
|
+
T.any(
|
400
|
+
OpenAI::Chat::ChatCompletionFunctionTool,
|
401
|
+
OpenAI::Chat::ChatCompletionCustomTool
|
402
|
+
)
|
403
|
+
]
|
404
|
+
)
|
405
|
+
)
|
406
|
+
end
|
393
407
|
attr_reader :tools
|
394
408
|
|
395
409
|
sig do
|
@@ -397,8 +411,9 @@ module OpenAI
|
|
397
411
|
tools:
|
398
412
|
T::Array[
|
399
413
|
T.any(
|
400
|
-
OpenAI::
|
401
|
-
OpenAI::
|
414
|
+
OpenAI::StructuredOutput::JsonSchemaConverter,
|
415
|
+
OpenAI::Chat::ChatCompletionFunctionTool::OrHash,
|
416
|
+
OpenAI::Chat::ChatCompletionCustomTool::OrHash
|
402
417
|
)
|
403
418
|
]
|
404
419
|
).void
|
@@ -430,6 +445,16 @@ module OpenAI
|
|
430
445
|
sig { params(user: String).void }
|
431
446
|
attr_writer :user
|
432
447
|
|
448
|
+
# Constrains the verbosity of the model's response. Lower values will result in
|
449
|
+
# more concise responses, while higher values will result in more verbose
|
450
|
+
# responses. Currently supported values are `low`, `medium`, and `high`.
|
451
|
+
sig do
|
452
|
+
returns(
|
453
|
+
T.nilable(OpenAI::Chat::CompletionCreateParams::Verbosity::OrSymbol)
|
454
|
+
)
|
455
|
+
end
|
456
|
+
attr_accessor :verbosity
|
457
|
+
|
433
458
|
# This tool searches the web for relevant results to use in a response. Learn more
|
434
459
|
# about the
|
435
460
|
# [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
|
@@ -511,18 +536,25 @@ module OpenAI
|
|
511
536
|
tool_choice:
|
512
537
|
T.any(
|
513
538
|
OpenAI::Chat::ChatCompletionToolChoiceOption::Auto::OrSymbol,
|
514
|
-
OpenAI::Chat::
|
539
|
+
OpenAI::Chat::ChatCompletionAllowedToolChoice::OrHash,
|
540
|
+
OpenAI::Chat::ChatCompletionNamedToolChoice::OrHash,
|
541
|
+
OpenAI::Chat::ChatCompletionNamedToolChoiceCustom::OrHash
|
515
542
|
),
|
516
543
|
tools:
|
517
544
|
T::Array[
|
518
545
|
T.any(
|
519
|
-
OpenAI::
|
520
|
-
OpenAI::
|
546
|
+
OpenAI::StructuredOutput::JsonSchemaConverter,
|
547
|
+
OpenAI::Chat::ChatCompletionFunctionTool::OrHash,
|
548
|
+
OpenAI::Chat::ChatCompletionCustomTool::OrHash
|
521
549
|
)
|
522
550
|
],
|
523
551
|
top_logprobs: T.nilable(Integer),
|
524
552
|
top_p: T.nilable(Float),
|
525
553
|
user: String,
|
554
|
+
verbosity:
|
555
|
+
T.nilable(
|
556
|
+
OpenAI::Chat::CompletionCreateParams::Verbosity::OrSymbol
|
557
|
+
),
|
526
558
|
web_search_options:
|
527
559
|
OpenAI::Chat::CompletionCreateParams::WebSearchOptions::OrHash,
|
528
560
|
request_options: OpenAI::RequestOptions::OrHash
|
@@ -631,12 +663,11 @@ module OpenAI
|
|
631
663
|
# hit rates. Replaces the `user` field.
|
632
664
|
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
633
665
|
prompt_cache_key: nil,
|
634
|
-
# **o-series models only**
|
635
|
-
#
|
636
666
|
# Constrains effort on reasoning for
|
637
667
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
638
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
639
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
668
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
669
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
670
|
+
# response.
|
640
671
|
reasoning_effort: nil,
|
641
672
|
# An object specifying the format that the model must output.
|
642
673
|
#
|
@@ -707,9 +738,9 @@ module OpenAI
|
|
707
738
|
# `none` is the default when no tools are present. `auto` is the default if tools
|
708
739
|
# are present.
|
709
740
|
tool_choice: nil,
|
710
|
-
# A list of tools the model may call.
|
711
|
-
#
|
712
|
-
#
|
741
|
+
# A list of tools the model may call. You can provide either
|
742
|
+
# [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
|
743
|
+
# or [function tools](https://platform.openai.com/docs/guides/function-calling).
|
713
744
|
tools: nil,
|
714
745
|
# An integer between 0 and 20 specifying the number of most likely tokens to
|
715
746
|
# return at each token position, each with an associated log probability.
|
@@ -727,6 +758,10 @@ module OpenAI
|
|
727
758
|
# similar requests and to help OpenAI detect and prevent abuse.
|
728
759
|
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
729
760
|
user: nil,
|
761
|
+
# Constrains the verbosity of the model's response. Lower values will result in
|
762
|
+
# more concise responses, while higher values will result in more verbose
|
763
|
+
# responses. Currently supported values are `low`, `medium`, and `high`.
|
764
|
+
verbosity: nil,
|
730
765
|
# This tool searches the web for relevant results to use in a response. Learn more
|
731
766
|
# about the
|
732
767
|
# [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
|
@@ -798,18 +833,25 @@ module OpenAI
|
|
798
833
|
tool_choice:
|
799
834
|
T.any(
|
800
835
|
OpenAI::Chat::ChatCompletionToolChoiceOption::Auto::OrSymbol,
|
801
|
-
OpenAI::Chat::
|
836
|
+
OpenAI::Chat::ChatCompletionAllowedToolChoice,
|
837
|
+
OpenAI::Chat::ChatCompletionNamedToolChoice,
|
838
|
+
OpenAI::Chat::ChatCompletionNamedToolChoiceCustom
|
802
839
|
),
|
803
840
|
tools:
|
804
841
|
T::Array[
|
805
842
|
T.any(
|
806
|
-
OpenAI::
|
807
|
-
OpenAI::
|
843
|
+
OpenAI::StructuredOutput::JsonSchemaConverter,
|
844
|
+
OpenAI::Chat::ChatCompletionFunctionTool,
|
845
|
+
OpenAI::Chat::ChatCompletionCustomTool
|
808
846
|
)
|
809
847
|
],
|
810
848
|
top_logprobs: T.nilable(Integer),
|
811
849
|
top_p: T.nilable(Float),
|
812
850
|
user: String,
|
851
|
+
verbosity:
|
852
|
+
T.nilable(
|
853
|
+
OpenAI::Chat::CompletionCreateParams::Verbosity::OrSymbol
|
854
|
+
),
|
813
855
|
web_search_options:
|
814
856
|
OpenAI::Chat::CompletionCreateParams::WebSearchOptions,
|
815
857
|
request_options: OpenAI::RequestOptions
|
@@ -1137,6 +1179,45 @@ module OpenAI
|
|
1137
1179
|
)
|
1138
1180
|
end
|
1139
1181
|
|
1182
|
+
# Constrains the verbosity of the model's response. Lower values will result in
|
1183
|
+
# more concise responses, while higher values will result in more verbose
|
1184
|
+
# responses. Currently supported values are `low`, `medium`, and `high`.
|
1185
|
+
module Verbosity
|
1186
|
+
extend OpenAI::Internal::Type::Enum
|
1187
|
+
|
1188
|
+
TaggedSymbol =
|
1189
|
+
T.type_alias do
|
1190
|
+
T.all(Symbol, OpenAI::Chat::CompletionCreateParams::Verbosity)
|
1191
|
+
end
|
1192
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
1193
|
+
|
1194
|
+
LOW =
|
1195
|
+
T.let(
|
1196
|
+
:low,
|
1197
|
+
OpenAI::Chat::CompletionCreateParams::Verbosity::TaggedSymbol
|
1198
|
+
)
|
1199
|
+
MEDIUM =
|
1200
|
+
T.let(
|
1201
|
+
:medium,
|
1202
|
+
OpenAI::Chat::CompletionCreateParams::Verbosity::TaggedSymbol
|
1203
|
+
)
|
1204
|
+
HIGH =
|
1205
|
+
T.let(
|
1206
|
+
:high,
|
1207
|
+
OpenAI::Chat::CompletionCreateParams::Verbosity::TaggedSymbol
|
1208
|
+
)
|
1209
|
+
|
1210
|
+
sig do
|
1211
|
+
override.returns(
|
1212
|
+
T::Array[
|
1213
|
+
OpenAI::Chat::CompletionCreateParams::Verbosity::TaggedSymbol
|
1214
|
+
]
|
1215
|
+
)
|
1216
|
+
end
|
1217
|
+
def self.values
|
1218
|
+
end
|
1219
|
+
end
|
1220
|
+
|
1140
1221
|
class WebSearchOptions < OpenAI::Internal::Type::BaseModel
|
1141
1222
|
OrHash =
|
1142
1223
|
T.type_alias do
|
@@ -8,6 +8,17 @@ module OpenAI
|
|
8
8
|
TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::ChatModel) }
|
9
9
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
10
10
|
|
11
|
+
GPT_5 = T.let(:"gpt-5", OpenAI::ChatModel::TaggedSymbol)
|
12
|
+
GPT_5_MINI = T.let(:"gpt-5-mini", OpenAI::ChatModel::TaggedSymbol)
|
13
|
+
GPT_5_NANO = T.let(:"gpt-5-nano", OpenAI::ChatModel::TaggedSymbol)
|
14
|
+
GPT_5_2025_08_07 =
|
15
|
+
T.let(:"gpt-5-2025-08-07", OpenAI::ChatModel::TaggedSymbol)
|
16
|
+
GPT_5_MINI_2025_08_07 =
|
17
|
+
T.let(:"gpt-5-mini-2025-08-07", OpenAI::ChatModel::TaggedSymbol)
|
18
|
+
GPT_5_NANO_2025_08_07 =
|
19
|
+
T.let(:"gpt-5-nano-2025-08-07", OpenAI::ChatModel::TaggedSymbol)
|
20
|
+
GPT_5_CHAT_LATEST =
|
21
|
+
T.let(:"gpt-5-chat-latest", OpenAI::ChatModel::TaggedSymbol)
|
11
22
|
GPT_4_1 = T.let(:"gpt-4.1", OpenAI::ChatModel::TaggedSymbol)
|
12
23
|
GPT_4_1_MINI = T.let(:"gpt-4.1-mini", OpenAI::ChatModel::TaggedSymbol)
|
13
24
|
GPT_4_1_NANO = T.let(:"gpt-4.1-nano", OpenAI::ChatModel::TaggedSymbol)
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
# The input format for the custom tool. Default is unconstrained text.
|
6
|
+
module CustomToolInputFormat
|
7
|
+
extend OpenAI::Internal::Type::Union
|
8
|
+
|
9
|
+
Variants =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
OpenAI::CustomToolInputFormat::Text,
|
13
|
+
OpenAI::CustomToolInputFormat::Grammar
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
class Text < OpenAI::Internal::Type::BaseModel
|
18
|
+
OrHash =
|
19
|
+
T.type_alias do
|
20
|
+
T.any(
|
21
|
+
OpenAI::CustomToolInputFormat::Text,
|
22
|
+
OpenAI::Internal::AnyHash
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Unconstrained text format. Always `text`.
|
27
|
+
sig { returns(Symbol) }
|
28
|
+
attr_accessor :type
|
29
|
+
|
30
|
+
# Unconstrained free-form text.
|
31
|
+
sig { params(type: Symbol).returns(T.attached_class) }
|
32
|
+
def self.new(
|
33
|
+
# Unconstrained text format. Always `text`.
|
34
|
+
type: :text
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
sig { override.returns({ type: Symbol }) }
|
39
|
+
def to_hash
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Grammar < OpenAI::Internal::Type::BaseModel
|
44
|
+
OrHash =
|
45
|
+
T.type_alias do
|
46
|
+
T.any(
|
47
|
+
OpenAI::CustomToolInputFormat::Grammar,
|
48
|
+
OpenAI::Internal::AnyHash
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
# The grammar definition.
|
53
|
+
sig { returns(String) }
|
54
|
+
attr_accessor :definition
|
55
|
+
|
56
|
+
# The syntax of the grammar definition. One of `lark` or `regex`.
|
57
|
+
sig do
|
58
|
+
returns(OpenAI::CustomToolInputFormat::Grammar::Syntax::OrSymbol)
|
59
|
+
end
|
60
|
+
attr_accessor :syntax
|
61
|
+
|
62
|
+
# Grammar format. Always `grammar`.
|
63
|
+
sig { returns(Symbol) }
|
64
|
+
attr_accessor :type
|
65
|
+
|
66
|
+
# A grammar defined by the user.
|
67
|
+
sig do
|
68
|
+
params(
|
69
|
+
definition: String,
|
70
|
+
syntax: OpenAI::CustomToolInputFormat::Grammar::Syntax::OrSymbol,
|
71
|
+
type: Symbol
|
72
|
+
).returns(T.attached_class)
|
73
|
+
end
|
74
|
+
def self.new(
|
75
|
+
# The grammar definition.
|
76
|
+
definition:,
|
77
|
+
# The syntax of the grammar definition. One of `lark` or `regex`.
|
78
|
+
syntax:,
|
79
|
+
# Grammar format. Always `grammar`.
|
80
|
+
type: :grammar
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
sig do
|
85
|
+
override.returns(
|
86
|
+
{
|
87
|
+
definition: String,
|
88
|
+
syntax: OpenAI::CustomToolInputFormat::Grammar::Syntax::OrSymbol,
|
89
|
+
type: Symbol
|
90
|
+
}
|
91
|
+
)
|
92
|
+
end
|
93
|
+
def to_hash
|
94
|
+
end
|
95
|
+
|
96
|
+
# The syntax of the grammar definition. One of `lark` or `regex`.
|
97
|
+
module Syntax
|
98
|
+
extend OpenAI::Internal::Type::Enum
|
99
|
+
|
100
|
+
TaggedSymbol =
|
101
|
+
T.type_alias do
|
102
|
+
T.all(Symbol, OpenAI::CustomToolInputFormat::Grammar::Syntax)
|
103
|
+
end
|
104
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
105
|
+
|
106
|
+
LARK =
|
107
|
+
T.let(
|
108
|
+
:lark,
|
109
|
+
OpenAI::CustomToolInputFormat::Grammar::Syntax::TaggedSymbol
|
110
|
+
)
|
111
|
+
REGEX =
|
112
|
+
T.let(
|
113
|
+
:regex,
|
114
|
+
OpenAI::CustomToolInputFormat::Grammar::Syntax::TaggedSymbol
|
115
|
+
)
|
116
|
+
|
117
|
+
sig do
|
118
|
+
override.returns(
|
119
|
+
T::Array[
|
120
|
+
OpenAI::CustomToolInputFormat::Grammar::Syntax::TaggedSymbol
|
121
|
+
]
|
122
|
+
)
|
123
|
+
end
|
124
|
+
def self.values
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
sig do
|
130
|
+
override.returns(T::Array[OpenAI::CustomToolInputFormat::Variants])
|
131
|
+
end
|
132
|
+
def self.variants
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -935,12 +935,16 @@ module OpenAI
|
|
935
935
|
# A list of tools the model may call. Currently, only functions are supported as a
|
936
936
|
# tool. Use this to provide a list of functions the model may generate JSON inputs
|
937
937
|
# for. A max of 128 functions are supported.
|
938
|
-
sig
|
938
|
+
sig do
|
939
|
+
returns(
|
940
|
+
T.nilable(T::Array[OpenAI::Chat::ChatCompletionFunctionTool])
|
941
|
+
)
|
942
|
+
end
|
939
943
|
attr_reader :tools
|
940
944
|
|
941
945
|
sig do
|
942
946
|
params(
|
943
|
-
tools: T::Array[OpenAI::Chat::
|
947
|
+
tools: T::Array[OpenAI::Chat::ChatCompletionFunctionTool::OrHash]
|
944
948
|
).void
|
945
949
|
end
|
946
950
|
attr_writer :tools
|
@@ -963,7 +967,7 @@ module OpenAI
|
|
963
967
|
),
|
964
968
|
seed: Integer,
|
965
969
|
temperature: Float,
|
966
|
-
tools: T::Array[OpenAI::Chat::
|
970
|
+
tools: T::Array[OpenAI::Chat::ChatCompletionFunctionTool::OrHash],
|
967
971
|
top_p: Float
|
968
972
|
).returns(T.attached_class)
|
969
973
|
end
|
@@ -1006,7 +1010,7 @@ module OpenAI
|
|
1006
1010
|
),
|
1007
1011
|
seed: Integer,
|
1008
1012
|
temperature: Float,
|
1009
|
-
tools: T::Array[OpenAI::Chat::
|
1013
|
+
tools: T::Array[OpenAI::Chat::ChatCompletionFunctionTool],
|
1010
1014
|
top_p: Float
|
1011
1015
|
}
|
1012
1016
|
)
|
@@ -1174,6 +1174,7 @@ module OpenAI
|
|
1174
1174
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1175
1175
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1176
1176
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1177
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1177
1178
|
OpenAI::Responses::WebSearchTool::OrHash
|
1178
1179
|
)
|
1179
1180
|
]
|
@@ -1205,6 +1206,7 @@ module OpenAI
|
|
1205
1206
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1206
1207
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1207
1208
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1209
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1208
1210
|
OpenAI::Responses::WebSearchTool::OrHash
|
1209
1211
|
)
|
1210
1212
|
],
|
@@ -1125,6 +1125,7 @@ module OpenAI
|
|
1125
1125
|
OpenAI::Responses::Tool::CodeInterpreter,
|
1126
1126
|
OpenAI::Responses::Tool::ImageGeneration,
|
1127
1127
|
OpenAI::Responses::Tool::LocalShell,
|
1128
|
+
OpenAI::Responses::CustomTool,
|
1128
1129
|
OpenAI::Responses::WebSearchTool
|
1129
1130
|
)
|
1130
1131
|
]
|
@@ -1145,6 +1146,7 @@ module OpenAI
|
|
1145
1146
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1146
1147
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1147
1148
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1149
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1148
1150
|
OpenAI::Responses::WebSearchTool::OrHash
|
1149
1151
|
)
|
1150
1152
|
]
|
@@ -1176,6 +1178,7 @@ module OpenAI
|
|
1176
1178
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1177
1179
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1178
1180
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1181
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1179
1182
|
OpenAI::Responses::WebSearchTool::OrHash
|
1180
1183
|
)
|
1181
1184
|
],
|
@@ -1233,6 +1236,7 @@ module OpenAI
|
|
1233
1236
|
OpenAI::Responses::Tool::CodeInterpreter,
|
1234
1237
|
OpenAI::Responses::Tool::ImageGeneration,
|
1235
1238
|
OpenAI::Responses::Tool::LocalShell,
|
1239
|
+
OpenAI::Responses::CustomTool,
|
1236
1240
|
OpenAI::Responses::WebSearchTool
|
1237
1241
|
)
|
1238
1242
|
],
|
@@ -1174,6 +1174,7 @@ module OpenAI
|
|
1174
1174
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1175
1175
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1176
1176
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1177
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1177
1178
|
OpenAI::Responses::WebSearchTool::OrHash
|
1178
1179
|
)
|
1179
1180
|
]
|
@@ -1205,6 +1206,7 @@ module OpenAI
|
|
1205
1206
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1206
1207
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1207
1208
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1209
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1208
1210
|
OpenAI::Responses::WebSearchTool::OrHash
|
1209
1211
|
)
|
1210
1212
|
],
|
@@ -1170,6 +1170,7 @@ module OpenAI
|
|
1170
1170
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1171
1171
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1172
1172
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1173
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1173
1174
|
OpenAI::Responses::WebSearchTool::OrHash
|
1174
1175
|
)
|
1175
1176
|
]
|
@@ -1201,6 +1202,7 @@ module OpenAI
|
|
1201
1202
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1202
1203
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1203
1204
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1205
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1204
1206
|
OpenAI::Responses::WebSearchTool::OrHash
|
1205
1207
|
)
|
1206
1208
|
],
|
@@ -1176,6 +1176,7 @@ module OpenAI
|
|
1176
1176
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1177
1177
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1178
1178
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1179
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1179
1180
|
OpenAI::Responses::WebSearchTool::OrHash
|
1180
1181
|
)
|
1181
1182
|
]
|
@@ -1207,6 +1208,7 @@ module OpenAI
|
|
1207
1208
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1208
1209
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1209
1210
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1211
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1210
1212
|
OpenAI::Responses::WebSearchTool::OrHash
|
1211
1213
|
)
|
1212
1214
|
],
|
@@ -6,12 +6,11 @@ module OpenAI
|
|
6
6
|
OrHash =
|
7
7
|
T.type_alias { T.any(OpenAI::Reasoning, OpenAI::Internal::AnyHash) }
|
8
8
|
|
9
|
-
# **o-series models only**
|
10
|
-
#
|
11
9
|
# Constrains effort on reasoning for
|
12
10
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
13
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
14
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
11
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
12
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
13
|
+
# response.
|
15
14
|
sig { returns(T.nilable(OpenAI::ReasoningEffort::OrSymbol)) }
|
16
15
|
attr_accessor :effort
|
17
16
|
|
@@ -42,12 +41,11 @@ module OpenAI
|
|
42
41
|
).returns(T.attached_class)
|
43
42
|
end
|
44
43
|
def self.new(
|
45
|
-
# **o-series models only**
|
46
|
-
#
|
47
44
|
# Constrains effort on reasoning for
|
48
45
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
49
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
50
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
46
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
47
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
48
|
+
# response.
|
51
49
|
effort: nil,
|
52
50
|
# **Deprecated:** use `summary` instead.
|
53
51
|
#
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
|
-
# **o-series models only**
|
6
|
-
#
|
7
5
|
# Constrains effort on reasoning for
|
8
6
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
9
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
10
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
7
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
8
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
9
|
+
# response.
|
11
10
|
module ReasoningEffort
|
12
11
|
extend OpenAI::Internal::Type::Enum
|
13
12
|
|
14
13
|
TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::ReasoningEffort) }
|
15
14
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
16
15
|
|
16
|
+
MINIMAL = T.let(:minimal, OpenAI::ReasoningEffort::TaggedSymbol)
|
17
17
|
LOW = T.let(:low, OpenAI::ReasoningEffort::TaggedSymbol)
|
18
18
|
MEDIUM = T.let(:medium, OpenAI::ReasoningEffort::TaggedSymbol)
|
19
19
|
HIGH = T.let(:high, OpenAI::ReasoningEffort::TaggedSymbol)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ResponseFormatTextGrammar < OpenAI::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(OpenAI::ResponseFormatTextGrammar, OpenAI::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The custom grammar for the model to follow.
|
12
|
+
sig { returns(String) }
|
13
|
+
attr_accessor :grammar
|
14
|
+
|
15
|
+
# The type of response format being defined. Always `grammar`.
|
16
|
+
sig { returns(Symbol) }
|
17
|
+
attr_accessor :type
|
18
|
+
|
19
|
+
# A custom grammar for the model to follow when generating text. Learn more in the
|
20
|
+
# [custom grammars guide](https://platform.openai.com/docs/guides/custom-grammars).
|
21
|
+
sig { params(grammar: String, type: Symbol).returns(T.attached_class) }
|
22
|
+
def self.new(
|
23
|
+
# The custom grammar for the model to follow.
|
24
|
+
grammar:,
|
25
|
+
# The type of response format being defined. Always `grammar`.
|
26
|
+
type: :grammar
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
sig { override.returns({ grammar: String, type: Symbol }) }
|
31
|
+
def to_hash
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ResponseFormatTextPython < OpenAI::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(OpenAI::ResponseFormatTextPython, OpenAI::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The type of response format being defined. Always `python`.
|
12
|
+
sig { returns(Symbol) }
|
13
|
+
attr_accessor :type
|
14
|
+
|
15
|
+
# Configure the model to generate valid Python code. See the
|
16
|
+
# [custom grammars guide](https://platform.openai.com/docs/guides/custom-grammars)
|
17
|
+
# for more details.
|
18
|
+
sig { params(type: Symbol).returns(T.attached_class) }
|
19
|
+
def self.new(
|
20
|
+
# The type of response format being defined. Always `python`.
|
21
|
+
type: :python
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
sig { override.returns({ type: Symbol }) }
|
26
|
+
def to_hash
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|