openai 0.99.0 → 0.101.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 +26 -0
- data/README.md +1 -1
- data/bedrock.md +17 -1
- data/lib/openai/client.rb +13 -0
- data/lib/openai/helpers/agents/session_stream.rb +11 -36
- data/lib/openai/helpers/agents/tools.rb +34 -4
- data/lib/openai/helpers/beta/agents/creation_stream.rb +26 -0
- data/lib/openai/helpers/beta/agents/function_tool.rb +11 -4
- data/lib/openai/helpers/beta/agents/tool_dispatcher.rb +74 -0
- data/lib/openai/helpers/beta/agents/tool_error.rb +28 -0
- data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_completions_params.rb +9 -4
- data/lib/openai/models/admin/organization/usage_completions_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_costs_params.rb +16 -4
- data/lib/openai/models/admin/organization/usage_costs_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_embeddings_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_images_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_moderations_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +125 -3
- data/lib/openai/models/admin/organization/usage_web_search_calls_params.rb +9 -4
- data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +125 -3
- data/lib/openai/models/beta/agents/environments/template_create_params.rb +6 -6
- data/lib/openai/models/beta/agents/environments/template_update_params.rb +3 -6
- data/lib/openai/models/beta/agents/sessions/turns/item_list_params.rb +79 -0
- data/lib/openai/models/beta/beta_response_computer_tool_call_output_item.rb +2 -2
- data/lib/openai/models/beta/beta_response_error.rb +12 -1
- data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +1166 -3
- data/lib/openai/models/beta/beta_responses_server_event.rb +12 -1
- data/lib/openai/models/beta/beta_tool.rb +12 -9
- data/lib/openai/models/beta/beta_tool_search_output_namespace_tool.rb +176 -0
- data/lib/openai/models/beta/environment_param.rb +6 -6
- data/lib/openai/models/beta/session_turn_error.rb +9 -0
- data/lib/openai/models/chat/chat_completion_chunk.rb +85 -18
- data/lib/openai/models/decision.rb +313 -0
- data/lib/openai/models/decision_create_params.rb +233 -0
- data/lib/openai/models/decision_input_image.rb +53 -0
- data/lib/openai/models/decision_input_message.rb +60 -0
- data/lib/openai/models/decision_input_part.rb +20 -0
- data/lib/openai/models/decision_input_text.rb +21 -0
- data/lib/openai/models/error_object.rb +12 -1
- data/lib/openai/models/eval_create_params.rb +1 -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/fine_tuning/job_list_params.rb +14 -4
- data/lib/openai/models/graders/score_model_grader.rb +2 -2
- data/lib/openai/models/image_edit_params.rb +12 -9
- data/lib/openai/models/realtime/realtime_client_event.rb +9 -0
- data/lib/openai/models/realtime/session_update_event.rb +16 -0
- data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +2 -2
- data/lib/openai/models/responses/response_error.rb +12 -1
- data/lib/openai/models/responses/response_tool_search_output_item_param.rb +1166 -3
- data/lib/openai/models/responses/responses_server_event.rb +12 -1
- data/lib/openai/models/responses/tool.rb +12 -9
- data/lib/openai/models/responses/tool_search_output_namespace_tool.rb +174 -0
- data/lib/openai/models/video_create_error.rb +12 -1
- data/lib/openai/models.rb +12 -0
- data/lib/openai/providers/bedrock.rb +20 -1
- data/lib/openai/resources/admin/organization/usage.rb +15 -6
- data/lib/openai/resources/beta/agents/environments/templates.rb +3 -4
- data/lib/openai/resources/beta/agents/sessions/turns/items.rb +68 -0
- data/lib/openai/resources/beta/agents/sessions/turns.rb +4 -0
- data/lib/openai/resources/beta/agents/sessions.rb +22 -2
- data/lib/openai/resources/decisions.rb +59 -0
- data/lib/openai/resources/fine_tuning/jobs.rb +7 -2
- data/lib/openai/resources/images.rb +8 -6
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +11 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/helpers/agents.rbi +2 -0
- data/rbi/openai/helpers/beta/agents/function_tool.rbi +8 -3
- data/rbi/openai/helpers/beta/agents/tool_error.rbi +19 -0
- data/rbi/openai/helpers/beta/agents.rbi +12 -0
- data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_completions_params.rbi +9 -4
- data/rbi/openai/models/admin/organization/usage_completions_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_costs_params.rbi +16 -4
- data/rbi/openai/models/admin/organization/usage_costs_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_images_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +194 -1
- data/rbi/openai/models/admin/organization/usage_web_search_calls_params.rbi +12 -4
- data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +194 -1
- data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +6 -6
- data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +3 -6
- data/rbi/openai/models/beta/agents/sessions/turns/item_list_params.rbi +139 -0
- data/rbi/openai/models/beta/beta_response_computer_tool_call_output_item.rbi +2 -2
- data/rbi/openai/models/beta/beta_response_error.rbi +12 -0
- data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +1893 -18
- data/rbi/openai/models/beta/beta_responses_server_event.rbi +12 -0
- data/rbi/openai/models/beta/beta_tool.rbi +12 -9
- data/rbi/openai/models/beta/beta_tool_search_output_namespace_tool.rbi +272 -0
- data/rbi/openai/models/beta/environment_param.rbi +6 -6
- data/rbi/openai/models/beta/session_turn_error.rbi +18 -0
- data/rbi/openai/models/chat/chat_completion_chunk.rbi +123 -17
- data/rbi/openai/models/decision.rbi +586 -0
- data/rbi/openai/models/decision_create_params.rbi +435 -0
- data/rbi/openai/models/decision_input_image.rbi +81 -0
- data/rbi/openai/models/decision_input_message.rbi +96 -0
- data/rbi/openai/models/decision_input_part.rbi +24 -0
- data/rbi/openai/models/decision_input_text.rbi +49 -0
- data/rbi/openai/models/error_object.rbi +12 -0
- data/rbi/openai/models/eval_create_params.rbi +1 -1
- 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/fine_tuning/job_list_params.rbi +14 -4
- data/rbi/openai/models/graders/score_model_grader.rbi +2 -2
- data/rbi/openai/models/image_edit_params.rbi +12 -9
- data/rbi/openai/models/realtime/session_update_event.rbi +16 -0
- data/rbi/openai/models/responses/response_computer_tool_call_output_item.rbi +2 -2
- data/rbi/openai/models/responses/response_error.rbi +12 -0
- data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +1901 -18
- data/rbi/openai/models/responses/responses_server_event.rbi +12 -0
- data/rbi/openai/models/responses/tool.rbi +12 -9
- data/rbi/openai/models/responses/tool_search_output_namespace_tool.rbi +272 -0
- data/rbi/openai/models/video_create_error.rbi +12 -0
- data/rbi/openai/models.rbi +12 -0
- data/rbi/openai/resources/admin/organization/usage.rbi +15 -6
- data/rbi/openai/resources/beta/agents/environments/templates.rbi +3 -4
- data/rbi/openai/resources/beta/agents/sessions/turns/items.rbi +62 -0
- data/rbi/openai/resources/beta/agents/sessions/turns.rbi +3 -0
- data/rbi/openai/resources/beta/agents/sessions.rbi +2 -0
- data/rbi/openai/resources/decisions.rbi +57 -0
- data/rbi/openai/resources/fine_tuning/jobs.rbi +7 -2
- data/rbi/openai/resources/images.rbi +8 -6
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/helpers/agents.rbs +3 -0
- data/sig/openai/helpers/beta/agents/function_tool.rbs +5 -2
- data/sig/openai/helpers/beta/agents/tool_error.rbs +17 -0
- data/sig/openai/helpers/beta/agents.rbs +5 -0
- data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_completions_params.rbs +14 -6
- data/sig/openai/models/admin/organization/usage_completions_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_costs_params.rbs +25 -7
- data/sig/openai/models/admin/organization/usage_costs_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_images_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_moderations_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +87 -2
- data/sig/openai/models/admin/organization/usage_web_search_calls_params.rbs +19 -7
- data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +87 -2
- data/sig/openai/models/beta/agents/environments/template_create_params.rbs +4 -4
- data/sig/openai/models/beta/agents/environments/template_update_params.rbs +2 -4
- data/sig/openai/models/beta/agents/sessions/turns/item_list_params.rbs +91 -0
- data/sig/openai/models/beta/beta_response_computer_tool_call_output_item.rbs +2 -2
- data/sig/openai/models/beta/beta_response_error.rbs +10 -0
- data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +993 -4
- data/sig/openai/models/beta/beta_responses_server_event.rbs +10 -0
- data/sig/openai/models/beta/beta_tool.rbs +8 -6
- data/sig/openai/models/beta/beta_tool_search_output_namespace_tool.rbs +162 -0
- data/sig/openai/models/beta/environment_param.rbs +4 -4
- data/sig/openai/models/beta/session_turn_error.rbs +12 -0
- data/sig/openai/models/chat/chat_completion_chunk.rbs +96 -12
- data/sig/openai/models/decision.rbs +296 -0
- data/sig/openai/models/decision_create_params.rbs +227 -0
- data/sig/openai/models/decision_input_image.rbs +51 -0
- data/sig/openai/models/decision_input_message.rbs +57 -0
- data/sig/openai/models/decision_input_part.rbs +12 -0
- data/sig/openai/models/decision_input_text.rbs +15 -0
- data/sig/openai/models/error_object.rbs +10 -0
- data/sig/openai/models/eval_create_params.rbs +1 -1
- data/sig/openai/models/eval_create_response.rbs +1 -1
- data/sig/openai/models/eval_list_response.rbs +1 -1
- data/sig/openai/models/eval_retrieve_response.rbs +1 -1
- data/sig/openai/models/eval_update_response.rbs +1 -1
- data/sig/openai/models/fine_tuning/job_list_params.rbs +14 -4
- data/sig/openai/models/graders/score_model_grader.rbs +3 -3
- data/sig/openai/models/image_edit_params.rbs +8 -6
- data/sig/openai/models/responses/response_computer_tool_call_output_item.rbs +2 -2
- data/sig/openai/models/responses/response_error.rbs +10 -0
- data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +993 -4
- data/sig/openai/models/responses/responses_server_event.rbs +10 -0
- data/sig/openai/models/responses/tool.rbs +8 -6
- data/sig/openai/models/responses/tool_search_output_namespace_tool.rbs +160 -0
- data/sig/openai/models/video_create_error.rbs +10 -0
- data/sig/openai/models.rbs +12 -0
- data/sig/openai/resources/beta/agents/sessions/turns/items.rbs +24 -0
- data/sig/openai/resources/beta/agents/sessions/turns.rbs +2 -0
- data/sig/openai/resources/beta/agents/sessions.rbs +1 -0
- data/sig/openai/resources/decisions.rbs +15 -0
- metadata +38 -1
|
@@ -2258,6 +2258,13 @@ module OpenAI
|
|
|
2258
2258
|
union: -> { OpenAI::Responses::ResponsesServerEvent::ResponseWsError::Error::Misalignment::ErrorType }
|
|
2259
2259
|
)
|
|
2260
2260
|
|
|
2261
|
+
# @!attribute review_target
|
|
2262
|
+
# An opaque target for explicitly continuing this review, or null when
|
|
2263
|
+
# unavailable.
|
|
2264
|
+
#
|
|
2265
|
+
# @return [String, nil]
|
|
2266
|
+
optional :review_target, String, nil?: true
|
|
2267
|
+
|
|
2261
2268
|
# @!attribute steer
|
|
2262
2269
|
# An optional public continuation instruction.
|
|
2263
2270
|
#
|
|
@@ -2267,13 +2274,17 @@ module OpenAI
|
|
|
2267
2274
|
-> { OpenAI::Responses::ResponsesServerEvent::ResponseWsError::Error::Misalignment::Steer }
|
|
2268
2275
|
)
|
|
2269
2276
|
|
|
2270
|
-
# @!method initialize(detailed_explanation: nil, error_type: nil, steer: nil)
|
|
2277
|
+
# @!method initialize(detailed_explanation: nil, error_type: nil, review_target: nil, steer: nil)
|
|
2271
2278
|
# @param detailed_explanation [String]
|
|
2272
2279
|
# The public explanation for this block.
|
|
2273
2280
|
#
|
|
2274
2281
|
# @param error_type [String, Symbol, OpenAI::Models::Responses::ResponsesServerEvent::ResponseWsError::Error::Misalignment::ErrorType]
|
|
2275
2282
|
# An optional classification; clients must accept additional values.
|
|
2276
2283
|
#
|
|
2284
|
+
# @param review_target [String, nil]
|
|
2285
|
+
# An opaque target for explicitly continuing this review, or null when
|
|
2286
|
+
# unavailable.
|
|
2287
|
+
#
|
|
2277
2288
|
# @param steer [OpenAI::Models::Responses::ResponsesServerEvent::ResponseWsError::Error::Misalignment::Steer]
|
|
2278
2289
|
# An optional public continuation instruction.
|
|
2279
2290
|
|
|
@@ -634,9 +634,10 @@ module OpenAI
|
|
|
634
634
|
optional :background, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Background }
|
|
635
635
|
|
|
636
636
|
# @!attribute input_fidelity
|
|
637
|
-
#
|
|
638
|
-
#
|
|
639
|
-
# `gpt-image-
|
|
637
|
+
# Control how much effort the model will exert to match the style and features,
|
|
638
|
+
# especially facial features, of input images. Supports `high` and `low` on
|
|
639
|
+
# `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
|
|
640
|
+
# `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
|
|
640
641
|
#
|
|
641
642
|
# @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::InputFidelity, nil]
|
|
642
643
|
optional(
|
|
@@ -732,9 +733,10 @@ module OpenAI
|
|
|
732
733
|
# set the output format to `png` or `webp`.
|
|
733
734
|
#
|
|
734
735
|
# @param input_fidelity [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::InputFidelity, nil]
|
|
735
|
-
#
|
|
736
|
-
#
|
|
737
|
-
# `gpt-image-
|
|
736
|
+
# Control how much effort the model will exert to match the style and features,
|
|
737
|
+
# especially facial features, of input images. Supports `high` and `low` on
|
|
738
|
+
# `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
|
|
739
|
+
# `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
|
|
738
740
|
#
|
|
739
741
|
# @param input_image_mask [OpenAI::Models::Responses::Tool::ImageGeneration::InputImageMask]
|
|
740
742
|
# Optional mask for inpainting. Contains `image_url` (string, optional) and
|
|
@@ -818,9 +820,10 @@ module OpenAI
|
|
|
818
820
|
# @return [Array<Symbol>]
|
|
819
821
|
end
|
|
820
822
|
|
|
821
|
-
#
|
|
822
|
-
#
|
|
823
|
-
# `gpt-image-
|
|
823
|
+
# Control how much effort the model will exert to match the style and features,
|
|
824
|
+
# especially facial features, of input images. Supports `high` and `low` on
|
|
825
|
+
# `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
|
|
826
|
+
# `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
|
|
824
827
|
#
|
|
825
828
|
# @see OpenAI::Models::Responses::Tool::ImageGeneration#input_fidelity
|
|
826
829
|
module InputFidelity
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Responses
|
|
6
|
+
class ToolSearchOutputNamespaceTool < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute description
|
|
8
|
+
# A description of the namespace shown to the model.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :description, String
|
|
12
|
+
|
|
13
|
+
# @!attribute name
|
|
14
|
+
# The namespace name used in tool calls (for example, `crm`).
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :name, String
|
|
18
|
+
|
|
19
|
+
# @!attribute tools
|
|
20
|
+
# The function/custom tools loaded inside this namespace.
|
|
21
|
+
#
|
|
22
|
+
# @return [Array<OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool>]
|
|
23
|
+
required(
|
|
24
|
+
:tools,
|
|
25
|
+
-> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool] }
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# @!attribute type
|
|
29
|
+
# The type of the tool. Always `namespace`.
|
|
30
|
+
#
|
|
31
|
+
# @return [Symbol, :namespace]
|
|
32
|
+
required :type, const: :namespace
|
|
33
|
+
|
|
34
|
+
# @!method initialize(description:, name:, tools:, type: :namespace)
|
|
35
|
+
# Groups function/custom tools under a shared namespace.
|
|
36
|
+
#
|
|
37
|
+
# @param description [String]
|
|
38
|
+
# A description of the namespace shown to the model.
|
|
39
|
+
#
|
|
40
|
+
# @param name [String]
|
|
41
|
+
# The namespace name used in tool calls (for example, `crm`).
|
|
42
|
+
#
|
|
43
|
+
# @param tools [Array<OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool>]
|
|
44
|
+
# The function/custom tools loaded inside this namespace.
|
|
45
|
+
#
|
|
46
|
+
# @param type [Symbol, :namespace]
|
|
47
|
+
# The type of the tool. Always `namespace`.
|
|
48
|
+
|
|
49
|
+
# A function or custom tool loaded into a namespace by tool search.
|
|
50
|
+
module Tool
|
|
51
|
+
extend OpenAI::Internal::Type::Union
|
|
52
|
+
|
|
53
|
+
discriminator :type
|
|
54
|
+
|
|
55
|
+
variant :function, -> { OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function }
|
|
56
|
+
|
|
57
|
+
# A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools)
|
|
58
|
+
variant :custom, -> { OpenAI::Responses::CustomTool }
|
|
59
|
+
|
|
60
|
+
class Function < OpenAI::Internal::Type::BaseModel
|
|
61
|
+
# @!attribute name
|
|
62
|
+
# The name of the loaded function tool.
|
|
63
|
+
#
|
|
64
|
+
# @return [String]
|
|
65
|
+
required :name, String
|
|
66
|
+
|
|
67
|
+
# @!attribute type
|
|
68
|
+
#
|
|
69
|
+
# @return [Symbol, :function]
|
|
70
|
+
required :type, const: :function
|
|
71
|
+
|
|
72
|
+
# @!attribute allowed_callers
|
|
73
|
+
# The tool invocation context(s).
|
|
74
|
+
#
|
|
75
|
+
# @return [Array<Symbol, OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
|
|
76
|
+
optional(
|
|
77
|
+
:allowed_callers,
|
|
78
|
+
-> {
|
|
79
|
+
OpenAI::Internal::Type::ArrayOf[
|
|
80
|
+
enum: OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
nil?: true
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# @!attribute async
|
|
87
|
+
# Whether the tool response can be returned asynchronously versus immediately
|
|
88
|
+
# returned on next response creation.
|
|
89
|
+
#
|
|
90
|
+
# @return [Boolean, nil]
|
|
91
|
+
optional :async, OpenAI::Internal::Type::Boolean
|
|
92
|
+
|
|
93
|
+
# @!attribute defer_loading
|
|
94
|
+
# Whether this function should be deferred and discovered via tool search.
|
|
95
|
+
#
|
|
96
|
+
# @return [Boolean, nil]
|
|
97
|
+
optional :defer_loading, OpenAI::Internal::Type::Boolean
|
|
98
|
+
|
|
99
|
+
# @!attribute description
|
|
100
|
+
#
|
|
101
|
+
# @return [String, nil]
|
|
102
|
+
optional :description, String, nil?: true
|
|
103
|
+
|
|
104
|
+
# @!attribute output_schema
|
|
105
|
+
# A JSON Schema describing the JSON value encoded in string outputs for this
|
|
106
|
+
# function tool. This does not describe content-array outputs.
|
|
107
|
+
#
|
|
108
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
109
|
+
optional(
|
|
110
|
+
:output_schema,
|
|
111
|
+
OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown],
|
|
112
|
+
nil?: true
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# @!attribute parameters
|
|
116
|
+
#
|
|
117
|
+
# @return [Object, nil]
|
|
118
|
+
optional :parameters, OpenAI::Internal::Type::Unknown, nil?: true
|
|
119
|
+
|
|
120
|
+
# @!attribute strict
|
|
121
|
+
# Whether to enforce strict parameter validation. If omitted, Responses attempts
|
|
122
|
+
# to use strict validation when the schema is compatible, and falls back to
|
|
123
|
+
# non-strict validation otherwise.
|
|
124
|
+
#
|
|
125
|
+
# @return [Boolean, nil]
|
|
126
|
+
optional :strict, OpenAI::Internal::Type::Boolean, nil?: true
|
|
127
|
+
|
|
128
|
+
# @!method initialize(name:, allowed_callers: nil, async: nil, defer_loading: nil, description: nil, output_schema: nil, parameters: nil, strict: nil, type: :function)
|
|
129
|
+
# @param name [String]
|
|
130
|
+
# The name of the loaded function tool.
|
|
131
|
+
#
|
|
132
|
+
# @param allowed_callers [Array<Symbol, OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
|
|
133
|
+
# The tool invocation context(s).
|
|
134
|
+
#
|
|
135
|
+
# @param async [Boolean]
|
|
136
|
+
# Whether the tool response can be returned asynchronously versus immediately
|
|
137
|
+
# returned on next response creation.
|
|
138
|
+
#
|
|
139
|
+
# @param defer_loading [Boolean]
|
|
140
|
+
# Whether this function should be deferred and discovered via tool search.
|
|
141
|
+
#
|
|
142
|
+
# @param description [String, nil]
|
|
143
|
+
#
|
|
144
|
+
# @param output_schema [Hash{Symbol=>Object}, nil]
|
|
145
|
+
# A JSON Schema describing the JSON value encoded in string outputs for this
|
|
146
|
+
# function tool. This does not describe content-array outputs.
|
|
147
|
+
#
|
|
148
|
+
# @param parameters [Object, nil]
|
|
149
|
+
#
|
|
150
|
+
# @param strict [Boolean, nil]
|
|
151
|
+
# Whether to enforce strict parameter validation. If omitted, Responses attempts
|
|
152
|
+
# to use strict validation when the schema is compatible, and falls back to
|
|
153
|
+
# non-strict validation otherwise.
|
|
154
|
+
#
|
|
155
|
+
# @param type [Symbol, :function]
|
|
156
|
+
|
|
157
|
+
module AllowedCaller
|
|
158
|
+
extend OpenAI::Internal::Type::Enum
|
|
159
|
+
|
|
160
|
+
DIRECT = :direct
|
|
161
|
+
PROGRAMMATIC = :programmatic
|
|
162
|
+
|
|
163
|
+
# @!method self.values
|
|
164
|
+
# @return [Array<Symbol>]
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# @!method self.variants
|
|
169
|
+
# @return [Array(OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool)]
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
@@ -56,19 +56,30 @@ module OpenAI
|
|
|
56
56
|
# @return [String, Symbol, OpenAI::Models::VideoCreateError::Misalignment::ErrorType, nil]
|
|
57
57
|
optional :error_type, union: -> { OpenAI::VideoCreateError::Misalignment::ErrorType }
|
|
58
58
|
|
|
59
|
+
# @!attribute review_target
|
|
60
|
+
# An opaque target for explicitly continuing this review, or null when
|
|
61
|
+
# unavailable.
|
|
62
|
+
#
|
|
63
|
+
# @return [String, nil]
|
|
64
|
+
optional :review_target, String, nil?: true
|
|
65
|
+
|
|
59
66
|
# @!attribute steer
|
|
60
67
|
# An optional public continuation instruction.
|
|
61
68
|
#
|
|
62
69
|
# @return [OpenAI::Models::VideoCreateError::Misalignment::Steer, nil]
|
|
63
70
|
optional :steer, -> { OpenAI::VideoCreateError::Misalignment::Steer }
|
|
64
71
|
|
|
65
|
-
# @!method initialize(detailed_explanation: nil, error_type: nil, steer: nil)
|
|
72
|
+
# @!method initialize(detailed_explanation: nil, error_type: nil, review_target: nil, steer: nil)
|
|
66
73
|
# @param detailed_explanation [String]
|
|
67
74
|
# The public explanation for this block.
|
|
68
75
|
#
|
|
69
76
|
# @param error_type [String, Symbol, OpenAI::Models::VideoCreateError::Misalignment::ErrorType]
|
|
70
77
|
# An optional classification; clients must accept additional values.
|
|
71
78
|
#
|
|
79
|
+
# @param review_target [String, nil]
|
|
80
|
+
# An opaque target for explicitly continuing this review, or null when
|
|
81
|
+
# unavailable.
|
|
82
|
+
#
|
|
72
83
|
# @param steer [OpenAI::Models::VideoCreateError::Misalignment::Steer]
|
|
73
84
|
# An optional public continuation instruction.
|
|
74
85
|
|
data/lib/openai/models.rb
CHANGED
|
@@ -113,6 +113,18 @@ module OpenAI
|
|
|
113
113
|
|
|
114
114
|
CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
|
|
115
115
|
|
|
116
|
+
Decision = OpenAI::Models::Decision
|
|
117
|
+
|
|
118
|
+
DecisionCreateParams = OpenAI::Models::DecisionCreateParams
|
|
119
|
+
|
|
120
|
+
DecisionInputImage = OpenAI::Models::DecisionInputImage
|
|
121
|
+
|
|
122
|
+
DecisionInputMessage = OpenAI::Models::DecisionInputMessage
|
|
123
|
+
|
|
124
|
+
DecisionInputPart = OpenAI::Models::DecisionInputPart
|
|
125
|
+
|
|
126
|
+
DecisionInputText = OpenAI::Models::DecisionInputText
|
|
127
|
+
|
|
116
128
|
DeletedSkill = OpenAI::Models::DeletedSkill
|
|
117
129
|
|
|
118
130
|
Embedding = OpenAI::Models::Embedding
|
|
@@ -90,10 +90,29 @@ module OpenAI
|
|
|
90
90
|
OpenAI::Internal::Provider::Runtime.new(
|
|
91
91
|
name: name,
|
|
92
92
|
base_url: base_url,
|
|
93
|
-
prepare_request:
|
|
93
|
+
prepare_request: lambda do |request|
|
|
94
|
+
url = request.fetch(:url)
|
|
95
|
+
# AWS documents a separate inference path for this exact Mantle model.
|
|
96
|
+
if @base_url.nil? && @endpoint == :mantle && sol_inference_request?(request)
|
|
97
|
+
url = url.dup
|
|
98
|
+
url.path = "/openai#{url.path}"
|
|
99
|
+
request = request.merge(url: url)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
auth.prepare_request(request)
|
|
103
|
+
end,
|
|
94
104
|
authentication_headers: AUTH_HEADERS
|
|
95
105
|
)
|
|
96
106
|
end
|
|
107
|
+
|
|
108
|
+
private def sol_inference_request?(request)
|
|
109
|
+
unless request[:method] == :post &&
|
|
110
|
+
%w[/v1/responses /v1/chat/completions].include?(request.fetch(:url).path)
|
|
111
|
+
return false
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
request[:provider_request_model] == "openai.gpt-6.1-sol"
|
|
115
|
+
end
|
|
97
116
|
end
|
|
98
117
|
|
|
99
118
|
class BearerAuth
|
|
@@ -196,8 +196,10 @@ module OpenAI
|
|
|
196
196
|
#
|
|
197
197
|
# @param group_by [Array<Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsParams::GroupBy>]
|
|
198
198
|
# Group the usage data by the specified fields. Support fields include
|
|
199
|
-
# `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier
|
|
200
|
-
# combination of them.
|
|
199
|
+
# `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
|
|
200
|
+
# `api_source` or any combination of them. When grouped by `api_source`, results
|
|
201
|
+
# use `agents_api` for attributed Agents API activity and `unlabeled` for all
|
|
202
|
+
# other activity. Without source grouping, `api_source` is null.
|
|
201
203
|
#
|
|
202
204
|
# @param limit [Integer]
|
|
203
205
|
# Specifies the number of buckets to return.
|
|
@@ -255,8 +257,13 @@ module OpenAI
|
|
|
255
257
|
# End time (Unix seconds) of the query time range, exclusive.
|
|
256
258
|
#
|
|
257
259
|
# @param group_by [Array<Symbol, OpenAI::Models::Admin::Organization::UsageCostsParams::GroupBy>]
|
|
258
|
-
# Group the costs by the specified fields.
|
|
259
|
-
# `line_item`, `api_key_id
|
|
260
|
+
# Group the costs by the specified fields. Supported fields include `project_id`,
|
|
261
|
+
# `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
|
|
262
|
+
# `user_id` with `project_id` grouping or the `project_ids` filter depends on the
|
|
263
|
+
# organization and requested time range. Unsupported combinations return HTTP 400.
|
|
264
|
+
# When grouped by `api_source`, results use `agents_api` for attributed Agents API
|
|
265
|
+
# activity and `unlabeled` for all other activity. Without source grouping,
|
|
266
|
+
# `api_source` is null.
|
|
260
267
|
#
|
|
261
268
|
# @param limit [Integer]
|
|
262
269
|
# A limit on the number of buckets to be returned. Limit can range between 1 and
|
|
@@ -609,8 +616,10 @@ module OpenAI
|
|
|
609
616
|
#
|
|
610
617
|
# @param group_by [Array<Symbol, OpenAI::Models::Admin::Organization::UsageWebSearchCallsParams::GroupBy>]
|
|
611
618
|
# Group the usage data by the specified fields. Support fields include
|
|
612
|
-
# `project_id`, `user_id`, `api_key_id`, `model`, `context_level` or
|
|
613
|
-
# combination of them.
|
|
619
|
+
# `project_id`, `user_id`, `api_key_id`, `model`, `context_level`, `api_source` or
|
|
620
|
+
# any combination of them. When grouped by `api_source`, results use `agents_api`
|
|
621
|
+
# for attributed Agents API activity and `unlabeled` for all other activity.
|
|
622
|
+
# Without source grouping, `api_source` is null.
|
|
614
623
|
#
|
|
615
624
|
# @param limit [Integer]
|
|
616
625
|
# Specifies the number of buckets to return.
|
|
@@ -30,8 +30,8 @@ module OpenAI
|
|
|
30
30
|
# An optional human-readable display name for the template.
|
|
31
31
|
#
|
|
32
32
|
# @param network [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network, nil]
|
|
33
|
-
# Network access policy for the environment.
|
|
34
|
-
#
|
|
33
|
+
# Network access policy for the environment. If omitted, the API version
|
|
34
|
+
# determines whether network access is enabled or disabled.
|
|
35
35
|
#
|
|
36
36
|
# @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Packages, nil]
|
|
37
37
|
# Packages to install in the environment. Defaults to empty package lists.
|
|
@@ -113,8 +113,7 @@ module OpenAI
|
|
|
113
113
|
#
|
|
114
114
|
# @param network [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network, nil]
|
|
115
115
|
# Network access available after setup completes. Omit to preserve the current
|
|
116
|
-
# policy, or pass `null` to reset to
|
|
117
|
-
# requests.
|
|
116
|
+
# policy, or pass `null` to reset to the default policy.
|
|
118
117
|
#
|
|
119
118
|
# @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Packages, nil]
|
|
120
119
|
# Packages installed before the runtime network policy applies.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
class Beta
|
|
6
|
+
class Agents
|
|
7
|
+
class Sessions
|
|
8
|
+
class Turns
|
|
9
|
+
class Items
|
|
10
|
+
# Lists items belonging to one root-agent turn, including its interactions with
|
|
11
|
+
# subagents. See
|
|
12
|
+
# [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).
|
|
13
|
+
#
|
|
14
|
+
# @overload list(turn_id, session_id:, after: nil, limit: nil, order: nil, request_options: {})
|
|
15
|
+
#
|
|
16
|
+
# @param turn_id [String]
|
|
17
|
+
# Path param: The ID of the turn.
|
|
18
|
+
#
|
|
19
|
+
# @param session_id [String]
|
|
20
|
+
# Path param: The ID of the session that owns the turn.
|
|
21
|
+
#
|
|
22
|
+
# @param after [String]
|
|
23
|
+
# Query param: Return items after this cursor in the selected order. Pass the
|
|
24
|
+
# previous response's last_id, which can differ from the last item's ID.
|
|
25
|
+
#
|
|
26
|
+
# @param limit [Integer]
|
|
27
|
+
# Query param: The maximum number of resources to return, between 1 and 100.
|
|
28
|
+
# Defaults to 20.
|
|
29
|
+
#
|
|
30
|
+
# @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Turns::ItemListParams::Order]
|
|
31
|
+
# Query param: The order in which resources are returned. Defaults to `desc`.
|
|
32
|
+
#
|
|
33
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
34
|
+
#
|
|
35
|
+
# @return [OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Beta::AgentSessionMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentSessionItem::FunctionCallOutput, OpenAI::Models::Beta::AgentSessionItem::AgentMessage, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentSessionItem::ComputerUseCall, OpenAI::Models::Beta::AgentSessionItem::ComputerUseApprovalRequest, OpenAI::Models::Beta::AgentSessionItem::ComputerUseApprovalRequestResult, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem>]
|
|
36
|
+
#
|
|
37
|
+
# @see OpenAI::Models::Beta::Agents::Sessions::Turns::ItemListParams
|
|
38
|
+
def list(turn_id, params)
|
|
39
|
+
parsed, options = OpenAI::Beta::Agents::Sessions::Turns::ItemListParams.dump_request(params)
|
|
40
|
+
session_id = parsed.delete(:session_id) do
|
|
41
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
query = OpenAI::Internal::Util.encode_query_params(parsed)
|
|
45
|
+
@client.request(
|
|
46
|
+
method: :get,
|
|
47
|
+
path: ["agents/sessions/%1$s/turns/%2$s/items", session_id, turn_id],
|
|
48
|
+
query: query,
|
|
49
|
+
page: OpenAI::Internal::ConversationCursorPage,
|
|
50
|
+
model: OpenAI::Beta::AgentSessionItem,
|
|
51
|
+
security: {bearer_auth: true},
|
|
52
|
+
options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options}
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @api private
|
|
57
|
+
#
|
|
58
|
+
# @param client [OpenAI::Client]
|
|
59
|
+
def initialize(client:)
|
|
60
|
+
@client = client
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -6,6 +6,9 @@ module OpenAI
|
|
|
6
6
|
class Agents
|
|
7
7
|
class Sessions
|
|
8
8
|
class Turns
|
|
9
|
+
# @return [OpenAI::Resources::Beta::Agents::Sessions::Turns::Items]
|
|
10
|
+
attr_reader :items
|
|
11
|
+
|
|
9
12
|
# Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if
|
|
10
13
|
# the turn does not belong to the session. See
|
|
11
14
|
# [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).
|
|
@@ -80,6 +83,7 @@ module OpenAI
|
|
|
80
83
|
# @param client [OpenAI::Client]
|
|
81
84
|
def initialize(client:)
|
|
82
85
|
@client = client
|
|
86
|
+
@items = OpenAI::Resources::Beta::Agents::Sessions::Turns::Items.new(client: client)
|
|
83
87
|
end
|
|
84
88
|
end
|
|
85
89
|
end
|
|
@@ -85,7 +85,7 @@ module OpenAI
|
|
|
85
85
|
# the session or streams its events when stream is true. See
|
|
86
86
|
# [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions).
|
|
87
87
|
#
|
|
88
|
-
# @overload create_streaming(environment:, agent: nil, agent_id: nil, input: nil, output_type: nil, metadata: nil, vault_ids: nil, request_options: {})
|
|
88
|
+
# @overload create_streaming(environment:, agent: nil, agent_id: nil, input: nil, output_type: nil, tool_handlers: {}, metadata: nil, vault_ids: nil, request_options: {})
|
|
89
89
|
#
|
|
90
90
|
# @param environment [OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted]
|
|
91
91
|
# An inline execution environment or a reference to an environment template.
|
|
@@ -112,6 +112,7 @@ module OpenAI
|
|
|
112
112
|
# The IDs of vaults made available to the session.
|
|
113
113
|
#
|
|
114
114
|
# @param output_type [Class<OpenAI::BaseModel>, nil] Beta: configure and parse a structured answer.
|
|
115
|
+
# @param tool_handlers [Hash{String=>Proc}] Local handlers for initial-turn function calls (not sent to the API).
|
|
115
116
|
#
|
|
116
117
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
117
118
|
#
|
|
@@ -121,6 +122,7 @@ module OpenAI
|
|
|
121
122
|
def create_streaming(params)
|
|
122
123
|
params = params.to_h.transform_keys { _1.is_a?(String) ? _1.to_sym : _1 }
|
|
123
124
|
output_type = params.delete(:output_type)
|
|
125
|
+
tool_handlers = params.delete(:tool_handlers)
|
|
124
126
|
parser = OpenAI::Helpers::Beta::Agents::OutputParser.new(output_type) unless output_type.nil?
|
|
125
127
|
parsed, options = OpenAI::Beta::Agents::SessionCreateParams.dump_request(params)
|
|
126
128
|
unless parsed.fetch(:stream, true)
|
|
@@ -140,6 +142,10 @@ module OpenAI
|
|
|
140
142
|
security: {bearer_auth: true},
|
|
141
143
|
options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options}
|
|
142
144
|
)
|
|
145
|
+
if tool_handlers
|
|
146
|
+
stream.configure_tool_handlers(sessions: self, tool_handlers: tool_handlers, request_options: options)
|
|
147
|
+
end
|
|
148
|
+
|
|
143
149
|
stream.configure_output_parser(parser)
|
|
144
150
|
end
|
|
145
151
|
|
|
@@ -274,17 +280,31 @@ module OpenAI
|
|
|
274
280
|
# @param session_id [String]
|
|
275
281
|
# @param input [String, Array<OpenAI::Models::Beta::AgentSessionInputMessageParam>]
|
|
276
282
|
# @param tool_handlers [Hash{String=>Proc}]
|
|
283
|
+
# @param on_tool_error [Proc, nil]
|
|
284
|
+
# Beta: use with tool_handlers to log or monitor argument parsing, handler
|
|
285
|
+
# execution, and output conversion failures locally. Receives ToolError;
|
|
286
|
+
# API/transport errors still propagate normally. Ordinary observer errors
|
|
287
|
+
# are ignored, and the submitted tool failure stays generic.
|
|
277
288
|
# @param idempotency_key [String, nil] Applies only to the input submission.
|
|
278
289
|
# @param output_type [Class<OpenAI::BaseModel>, nil] Beta: parse output without changing session configuration.
|
|
279
290
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
280
291
|
# @yieldparam stream [OpenAI::Helpers::Agents::SessionStream]
|
|
281
292
|
# @return [OpenAI::Helpers::Agents::SessionStream]
|
|
282
|
-
def stream(
|
|
293
|
+
def stream(
|
|
294
|
+
session_id,
|
|
295
|
+
input:,
|
|
296
|
+
tool_handlers: {},
|
|
297
|
+
on_tool_error: nil,
|
|
298
|
+
idempotency_key: nil,
|
|
299
|
+
output_type: nil,
|
|
300
|
+
request_options: {}
|
|
301
|
+
)
|
|
283
302
|
stream = OpenAI::Helpers::Agents::SessionStream.new(
|
|
284
303
|
sessions: self,
|
|
285
304
|
session_id: session_id,
|
|
286
305
|
input: input,
|
|
287
306
|
tool_handlers: tool_handlers,
|
|
307
|
+
on_tool_error: on_tool_error,
|
|
288
308
|
idempotency_key: idempotency_key,
|
|
289
309
|
output_type: output_type,
|
|
290
310
|
request_options: request_options
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
class Decisions
|
|
6
|
+
# Evaluate ordered classification and scoring questions against shared input.
|
|
7
|
+
# Answers are returned in question order.
|
|
8
|
+
#
|
|
9
|
+
# Supply input as a string or user messages containing text and inline images.
|
|
10
|
+
# Only user messages with `input_text` and `input_image` parts are supported;
|
|
11
|
+
# non-user roles, function calls, files, audio, and item references are not
|
|
12
|
+
# supported. Images require a data URL, not an external URL or file ID. At most
|
|
13
|
+
# 128 images are allowed across the request.
|
|
14
|
+
#
|
|
15
|
+
# Each question can return a refusal instead of a scored answer. A refusal has
|
|
16
|
+
# type `refusal` and the corresponding question name, or null if unnamed.
|
|
17
|
+
#
|
|
18
|
+
# @overload create(input:, model:, questions:, safety_identifier: nil, request_options: {})
|
|
19
|
+
#
|
|
20
|
+
# @param input [String, Array<OpenAI::Models::DecisionInputMessage>]
|
|
21
|
+
# Shared evidence, as a string or an array of user messages containing text and
|
|
22
|
+
# inline images. Non-user roles, function calls, function-call outputs, files,
|
|
23
|
+
# audio, and item references are not supported. At most 128 image parts are
|
|
24
|
+
# allowed across all messages in one request.
|
|
25
|
+
#
|
|
26
|
+
# @param model [String]
|
|
27
|
+
#
|
|
28
|
+
# @param questions [Array<OpenAI::Models::DecisionCreateParams::Question::Predicate, OpenAI::Models::DecisionCreateParams::Question::Choice, OpenAI::Models::DecisionCreateParams::Question::Score>]
|
|
29
|
+
#
|
|
30
|
+
# @param safety_identifier [String, nil]
|
|
31
|
+
# Opaque caller-provided end-user identifier, scoped by the verified org. Match
|
|
32
|
+
# Responses' limit; this is never the authenticated user identity.
|
|
33
|
+
#
|
|
34
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
35
|
+
#
|
|
36
|
+
# @return [OpenAI::Models::Decision]
|
|
37
|
+
#
|
|
38
|
+
# @see OpenAI::Models::DecisionCreateParams
|
|
39
|
+
def create(params)
|
|
40
|
+
parsed, options = OpenAI::DecisionCreateParams.dump_request(params)
|
|
41
|
+
@client.request(
|
|
42
|
+
method: :post,
|
|
43
|
+
path: "decisions",
|
|
44
|
+
body: parsed,
|
|
45
|
+
model: OpenAI::Decision,
|
|
46
|
+
security: {bearer_auth: true},
|
|
47
|
+
options: options
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @api private
|
|
52
|
+
#
|
|
53
|
+
# @param client [OpenAI::Client]
|
|
54
|
+
def initialize(client:)
|
|
55
|
+
@client = client
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -141,8 +141,13 @@ module OpenAI
|
|
|
141
141
|
# Number of fine-tuning jobs to retrieve.
|
|
142
142
|
#
|
|
143
143
|
# @param metadata [Hash{Symbol=>String}, nil]
|
|
144
|
-
# Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
|
|
145
|
-
#
|
|
144
|
+
# Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Omitting
|
|
145
|
+
# the parameter or passing an empty object applies no metadata filter. An empty
|
|
146
|
+
# value, such as `metadata[k]=`, filters for that key with an empty string value.
|
|
147
|
+
# To select jobs with null metadata, send the literal query string
|
|
148
|
+
# `metadata=null`. Nullable caller types do not specify how a client serializes
|
|
149
|
+
# null for a deep-object parameter. Use a raw query parameter if the client omits
|
|
150
|
+
# null. Do not combine the two query forms.
|
|
146
151
|
#
|
|
147
152
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
148
153
|
#
|