openai 0.12.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/structured_output/json_schema_converter.rb +34 -10
  5. data/lib/openai/models/audio/transcription.rb +4 -4
  6. data/lib/openai/models/audio/transcription_verbose.rb +4 -4
  7. data/lib/openai/models/eval_create_params.rb +50 -5
  8. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +50 -5
  9. data/lib/openai/models/evals/run_cancel_response.rb +48 -5
  10. data/lib/openai/models/evals/run_create_params.rb +50 -5
  11. data/lib/openai/models/evals/run_create_response.rb +48 -5
  12. data/lib/openai/models/evals/run_list_response.rb +48 -5
  13. data/lib/openai/models/evals/run_retrieve_response.rb +48 -5
  14. data/lib/openai/models/file_object.rb +5 -4
  15. data/lib/openai/models/graders/label_model_grader.rb +48 -5
  16. data/lib/openai/models/graders/score_model_grader.rb +48 -5
  17. data/lib/openai/models/responses/response_input_file.rb +9 -1
  18. data/lib/openai/models/responses/response_mcp_call_arguments_delta_event.rb +5 -5
  19. data/lib/openai/models/responses/response_mcp_call_arguments_done_event.rb +5 -5
  20. data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +5 -5
  21. data/lib/openai/models/responses/response_stream_event.rb +3 -3
  22. data/lib/openai/models/responses/tool.rb +9 -1
  23. data/lib/openai/version.rb +1 -1
  24. data/rbi/openai/helpers/structured_output/json_schema_converter.rbi +4 -0
  25. data/rbi/openai/models/audio/transcription.rbi +4 -4
  26. data/rbi/openai/models/audio/transcription_verbose.rbi +4 -6
  27. data/rbi/openai/models/eval_create_params.rbi +76 -7
  28. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +76 -7
  29. data/rbi/openai/models/evals/run_cancel_response.rbi +70 -5
  30. data/rbi/openai/models/evals/run_create_params.rbi +76 -7
  31. data/rbi/openai/models/evals/run_create_response.rbi +70 -5
  32. data/rbi/openai/models/evals/run_list_response.rbi +70 -5
  33. data/rbi/openai/models/evals/run_retrieve_response.rbi +70 -5
  34. data/rbi/openai/models/file_object.rbi +7 -6
  35. data/rbi/openai/models/graders/label_model_grader.rbi +74 -7
  36. data/rbi/openai/models/graders/score_model_grader.rbi +74 -7
  37. data/rbi/openai/models/responses/response_input_file.rbi +11 -0
  38. data/rbi/openai/models/responses/response_mcp_call_arguments_delta_event.rbi +3 -3
  39. data/rbi/openai/models/responses/response_mcp_call_arguments_done_event.rbi +3 -3
  40. data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +3 -3
  41. data/rbi/openai/models/responses/tool.rbi +12 -1
  42. data/sig/openai/models/audio/transcription.rbs +4 -4
  43. data/sig/openai/models/audio/transcription_verbose.rbs +4 -4
  44. data/sig/openai/models/eval_create_params.rbs +29 -0
  45. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +29 -0
  46. data/sig/openai/models/evals/run_cancel_response.rbs +33 -0
  47. data/sig/openai/models/evals/run_create_params.rbs +33 -0
  48. data/sig/openai/models/evals/run_create_response.rbs +33 -0
  49. data/sig/openai/models/evals/run_list_response.rbs +33 -0
  50. data/sig/openai/models/evals/run_retrieve_response.rbs +33 -0
  51. data/sig/openai/models/file_object.rbs +2 -0
  52. data/sig/openai/models/graders/label_model_grader.rbs +29 -0
  53. data/sig/openai/models/graders/score_model_grader.rbs +29 -0
  54. data/sig/openai/models/responses/response_input_file.rbs +7 -0
  55. data/sig/openai/models/responses/response_mcp_call_arguments_delta_event.rbs +4 -4
  56. data/sig/openai/models/responses/response_mcp_call_arguments_done_event.rbs +4 -4
  57. data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +4 -4
  58. data/sig/openai/models/responses/tool.rbs +9 -2
  59. metadata +2 -2
@@ -457,9 +457,9 @@ module OpenAI
457
457
 
458
458
  class EvalItem < OpenAI::Internal::Type::BaseModel
459
459
  # @!attribute content
460
- # Text inputs to the model - can contain template strings.
460
+ # Inputs to the model - can contain template strings.
461
461
  #
462
- # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText]
462
+ # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array<Object>]
463
463
  required :content,
464
464
  union: -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content }
465
465
 
@@ -489,13 +489,13 @@ module OpenAI
489
489
  # `assistant` role are presumed to have been generated by the model in previous
490
490
  # interactions.
491
491
  #
492
- # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] Text inputs to the model - can contain template strings.
492
+ # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array<Object>] Inputs to the model - can contain template strings.
493
493
  #
494
494
  # @param role [Symbol, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role] The role of the message input. One of `user`, `assistant`, `system`, or
495
495
  #
496
496
  # @param type [Symbol, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`.
497
497
 
498
- # Text inputs to the model - can contain template strings.
498
+ # Inputs to the model - can contain template strings.
499
499
  #
500
500
  # @see OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem#content
501
501
  module Content
@@ -510,6 +510,12 @@ module OpenAI
510
510
  # A text output from the model.
511
511
  variant -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText }
512
512
 
513
+ # An image input to the model.
514
+ variant -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage }
515
+
516
+ # A list of inputs, each of which may be either an input text or input image object.
517
+ variant -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray }
518
+
513
519
  class OutputText < OpenAI::Internal::Type::BaseModel
514
520
  # @!attribute text
515
521
  # The text output from the model.
@@ -535,8 +541,45 @@ module OpenAI
535
541
  # @param type [Symbol, :output_text] The type of the output text. Always `output_text`.
536
542
  end
537
543
 
544
+ class InputImage < OpenAI::Internal::Type::BaseModel
545
+ # @!attribute image_url
546
+ # The URL of the image input.
547
+ #
548
+ # @return [String]
549
+ required :image_url, String
550
+
551
+ # @!attribute type
552
+ # The type of the image input. Always `input_image`.
553
+ #
554
+ # @return [Symbol, :input_image]
555
+ required :type, const: :input_image
556
+
557
+ # @!attribute detail
558
+ # The detail level of the image to be sent to the model. One of `high`, `low`, or
559
+ # `auto`. Defaults to `auto`.
560
+ #
561
+ # @return [String, nil]
562
+ optional :detail, String
563
+
564
+ # @!method initialize(image_url:, detail: nil, type: :input_image)
565
+ # Some parameter documentations has been truncated, see
566
+ # {OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage}
567
+ # for more details.
568
+ #
569
+ # An image input to the model.
570
+ #
571
+ # @param image_url [String] The URL of the image input.
572
+ #
573
+ # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or
574
+ #
575
+ # @param type [Symbol, :input_image] The type of the image input. Always `input_image`.
576
+ end
577
+
538
578
  # @!method self.variants
539
- # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText)]
579
+ # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array<Object>)]
580
+
581
+ # @type [OpenAI::Internal::Type::Converter]
582
+ AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
540
583
  end
541
584
 
542
585
  # The role of the message input. One of `user`, `assistant`, `system`, or
@@ -461,9 +461,9 @@ module OpenAI
461
461
 
462
462
  class EvalItem < OpenAI::Internal::Type::BaseModel
463
463
  # @!attribute content
464
- # Text inputs to the model - can contain template strings.
464
+ # Inputs to the model - can contain template strings.
465
465
  #
466
- # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText]
466
+ # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array<Object>]
467
467
  required :content,
468
468
  union: -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content }
469
469
 
@@ -493,13 +493,13 @@ module OpenAI
493
493
  # `assistant` role are presumed to have been generated by the model in previous
494
494
  # interactions.
495
495
  #
496
- # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] Text inputs to the model - can contain template strings.
496
+ # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array<Object>] Inputs to the model - can contain template strings.
497
497
  #
498
498
  # @param role [Symbol, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role] The role of the message input. One of `user`, `assistant`, `system`, or
499
499
  #
500
500
  # @param type [Symbol, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`.
501
501
 
502
- # Text inputs to the model - can contain template strings.
502
+ # Inputs to the model - can contain template strings.
503
503
  #
504
504
  # @see OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem#content
505
505
  module Content
@@ -514,6 +514,12 @@ module OpenAI
514
514
  # A text output from the model.
515
515
  variant -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText }
516
516
 
517
+ # An image input to the model.
518
+ variant -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage }
519
+
520
+ # A list of inputs, each of which may be either an input text or input image object.
521
+ variant -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray }
522
+
517
523
  class OutputText < OpenAI::Internal::Type::BaseModel
518
524
  # @!attribute text
519
525
  # The text output from the model.
@@ -539,8 +545,45 @@ module OpenAI
539
545
  # @param type [Symbol, :output_text] The type of the output text. Always `output_text`.
540
546
  end
541
547
 
548
+ class InputImage < OpenAI::Internal::Type::BaseModel
549
+ # @!attribute image_url
550
+ # The URL of the image input.
551
+ #
552
+ # @return [String]
553
+ required :image_url, String
554
+
555
+ # @!attribute type
556
+ # The type of the image input. Always `input_image`.
557
+ #
558
+ # @return [Symbol, :input_image]
559
+ required :type, const: :input_image
560
+
561
+ # @!attribute detail
562
+ # The detail level of the image to be sent to the model. One of `high`, `low`, or
563
+ # `auto`. Defaults to `auto`.
564
+ #
565
+ # @return [String, nil]
566
+ optional :detail, String
567
+
568
+ # @!method initialize(image_url:, detail: nil, type: :input_image)
569
+ # Some parameter documentations has been truncated, see
570
+ # {OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage}
571
+ # for more details.
572
+ #
573
+ # An image input to the model.
574
+ #
575
+ # @param image_url [String] The URL of the image input.
576
+ #
577
+ # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or
578
+ #
579
+ # @param type [Symbol, :input_image] The type of the image input. Always `input_image`.
580
+ end
581
+
542
582
  # @!method self.variants
543
- # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText)]
583
+ # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array<Object>)]
584
+
585
+ # @type [OpenAI::Internal::Type::Converter]
586
+ AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
544
587
  end
545
588
 
546
589
  # The role of the message input. One of `user`, `assistant`, `system`, or
@@ -36,8 +36,8 @@ module OpenAI
36
36
 
37
37
  # @!attribute purpose
38
38
  # The intended purpose of the file. Supported values are `assistants`,
39
- # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
40
- # and `vision`.
39
+ # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
40
+ # `vision`, and `user_data`.
41
41
  #
42
42
  # @return [Symbol, OpenAI::Models::FileObject::Purpose]
43
43
  required :purpose, enum: -> { OpenAI::FileObject::Purpose }
@@ -91,8 +91,8 @@ module OpenAI
91
91
  # @param object [Symbol, :file] The object type, which is always `file`.
92
92
 
93
93
  # The intended purpose of the file. Supported values are `assistants`,
94
- # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
95
- # and `vision`.
94
+ # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
95
+ # `vision`, and `user_data`.
96
96
  #
97
97
  # @see OpenAI::Models::FileObject#purpose
98
98
  module Purpose
@@ -105,6 +105,7 @@ module OpenAI
105
105
  FINE_TUNE = :"fine-tune"
106
106
  FINE_TUNE_RESULTS = :"fine-tune-results"
107
107
  VISION = :vision
108
+ USER_DATA = :user_data
108
109
 
109
110
  # @!method self.values
110
111
  # @return [Array<Symbol>]
@@ -57,9 +57,9 @@ module OpenAI
57
57
 
58
58
  class Input < OpenAI::Internal::Type::BaseModel
59
59
  # @!attribute content
60
- # Text inputs to the model - can contain template strings.
60
+ # Inputs to the model - can contain template strings.
61
61
  #
62
- # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText]
62
+ # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, Array<Object>]
63
63
  required :content, union: -> { OpenAI::Graders::LabelModelGrader::Input::Content }
64
64
 
65
65
  # @!attribute role
@@ -85,13 +85,13 @@ module OpenAI
85
85
  # `assistant` role are presumed to have been generated by the model in previous
86
86
  # interactions.
87
87
  #
88
- # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText] Text inputs to the model - can contain template strings.
88
+ # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, Array<Object>] Inputs to the model - can contain template strings.
89
89
  #
90
90
  # @param role [Symbol, OpenAI::Models::Graders::LabelModelGrader::Input::Role] The role of the message input. One of `user`, `assistant`, `system`, or
91
91
  #
92
92
  # @param type [Symbol, OpenAI::Models::Graders::LabelModelGrader::Input::Type] The type of the message input. Always `message`.
93
93
 
94
- # Text inputs to the model - can contain template strings.
94
+ # Inputs to the model - can contain template strings.
95
95
  #
96
96
  # @see OpenAI::Models::Graders::LabelModelGrader::Input#content
97
97
  module Content
@@ -106,6 +106,12 @@ module OpenAI
106
106
  # A text output from the model.
107
107
  variant -> { OpenAI::Graders::LabelModelGrader::Input::Content::OutputText }
108
108
 
109
+ # An image input to the model.
110
+ variant -> { OpenAI::Graders::LabelModelGrader::Input::Content::InputImage }
111
+
112
+ # A list of inputs, each of which may be either an input text or input image object.
113
+ variant -> { OpenAI::Models::Graders::LabelModelGrader::Input::Content::AnArrayOfInputTextAndInputImageArray }
114
+
109
115
  class OutputText < OpenAI::Internal::Type::BaseModel
110
116
  # @!attribute text
111
117
  # The text output from the model.
@@ -131,8 +137,45 @@ module OpenAI
131
137
  # @param type [Symbol, :output_text] The type of the output text. Always `output_text`.
132
138
  end
133
139
 
140
+ class InputImage < OpenAI::Internal::Type::BaseModel
141
+ # @!attribute image_url
142
+ # The URL of the image input.
143
+ #
144
+ # @return [String]
145
+ required :image_url, String
146
+
147
+ # @!attribute type
148
+ # The type of the image input. Always `input_image`.
149
+ #
150
+ # @return [Symbol, :input_image]
151
+ required :type, const: :input_image
152
+
153
+ # @!attribute detail
154
+ # The detail level of the image to be sent to the model. One of `high`, `low`, or
155
+ # `auto`. Defaults to `auto`.
156
+ #
157
+ # @return [String, nil]
158
+ optional :detail, String
159
+
160
+ # @!method initialize(image_url:, detail: nil, type: :input_image)
161
+ # Some parameter documentations has been truncated, see
162
+ # {OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage} for more
163
+ # details.
164
+ #
165
+ # An image input to the model.
166
+ #
167
+ # @param image_url [String] The URL of the image input.
168
+ #
169
+ # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or
170
+ #
171
+ # @param type [Symbol, :input_image] The type of the image input. Always `input_image`.
172
+ end
173
+
134
174
  # @!method self.variants
135
- # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText)]
175
+ # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, Array<Object>)]
176
+
177
+ # @type [OpenAI::Internal::Type::Converter]
178
+ AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
136
179
  end
137
180
 
138
181
  # The role of the message input. One of `user`, `assistant`, `system`, or
@@ -57,9 +57,9 @@ module OpenAI
57
57
 
58
58
  class Input < OpenAI::Internal::Type::BaseModel
59
59
  # @!attribute content
60
- # Text inputs to the model - can contain template strings.
60
+ # Inputs to the model - can contain template strings.
61
61
  #
62
- # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText]
62
+ # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage, Array<Object>]
63
63
  required :content, union: -> { OpenAI::Graders::ScoreModelGrader::Input::Content }
64
64
 
65
65
  # @!attribute role
@@ -85,13 +85,13 @@ module OpenAI
85
85
  # `assistant` role are presumed to have been generated by the model in previous
86
86
  # interactions.
87
87
  #
88
- # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText] Text inputs to the model - can contain template strings.
88
+ # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage, Array<Object>] Inputs to the model - can contain template strings.
89
89
  #
90
90
  # @param role [Symbol, OpenAI::Models::Graders::ScoreModelGrader::Input::Role] The role of the message input. One of `user`, `assistant`, `system`, or
91
91
  #
92
92
  # @param type [Symbol, OpenAI::Models::Graders::ScoreModelGrader::Input::Type] The type of the message input. Always `message`.
93
93
 
94
- # Text inputs to the model - can contain template strings.
94
+ # Inputs to the model - can contain template strings.
95
95
  #
96
96
  # @see OpenAI::Models::Graders::ScoreModelGrader::Input#content
97
97
  module Content
@@ -106,6 +106,12 @@ module OpenAI
106
106
  # A text output from the model.
107
107
  variant -> { OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText }
108
108
 
109
+ # An image input to the model.
110
+ variant -> { OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage }
111
+
112
+ # A list of inputs, each of which may be either an input text or input image object.
113
+ variant -> { OpenAI::Models::Graders::ScoreModelGrader::Input::Content::AnArrayOfInputTextAndInputImageArray }
114
+
109
115
  class OutputText < OpenAI::Internal::Type::BaseModel
110
116
  # @!attribute text
111
117
  # The text output from the model.
@@ -131,8 +137,45 @@ module OpenAI
131
137
  # @param type [Symbol, :output_text] The type of the output text. Always `output_text`.
132
138
  end
133
139
 
140
+ class InputImage < OpenAI::Internal::Type::BaseModel
141
+ # @!attribute image_url
142
+ # The URL of the image input.
143
+ #
144
+ # @return [String]
145
+ required :image_url, String
146
+
147
+ # @!attribute type
148
+ # The type of the image input. Always `input_image`.
149
+ #
150
+ # @return [Symbol, :input_image]
151
+ required :type, const: :input_image
152
+
153
+ # @!attribute detail
154
+ # The detail level of the image to be sent to the model. One of `high`, `low`, or
155
+ # `auto`. Defaults to `auto`.
156
+ #
157
+ # @return [String, nil]
158
+ optional :detail, String
159
+
160
+ # @!method initialize(image_url:, detail: nil, type: :input_image)
161
+ # Some parameter documentations has been truncated, see
162
+ # {OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage} for more
163
+ # details.
164
+ #
165
+ # An image input to the model.
166
+ #
167
+ # @param image_url [String] The URL of the image input.
168
+ #
169
+ # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or
170
+ #
171
+ # @param type [Symbol, :input_image] The type of the image input. Always `input_image`.
172
+ end
173
+
134
174
  # @!method self.variants
135
- # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText)]
175
+ # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage, Array<Object>)]
176
+
177
+ # @type [OpenAI::Internal::Type::Converter]
178
+ AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
136
179
  end
137
180
 
138
181
  # The role of the message input. One of `user`, `assistant`, `system`, or
@@ -22,13 +22,19 @@ module OpenAI
22
22
  # @return [String, nil]
23
23
  optional :file_id, String, nil?: true
24
24
 
25
+ # @!attribute file_url
26
+ # The URL of the file to be sent to the model.
27
+ #
28
+ # @return [String, nil]
29
+ optional :file_url, String
30
+
25
31
  # @!attribute filename
26
32
  # The name of the file to be sent to the model.
27
33
  #
28
34
  # @return [String, nil]
29
35
  optional :filename, String
30
36
 
31
- # @!method initialize(file_data: nil, file_id: nil, filename: nil, type: :input_file)
37
+ # @!method initialize(file_data: nil, file_id: nil, file_url: nil, filename: nil, type: :input_file)
32
38
  # Some parameter documentations has been truncated, see
33
39
  # {OpenAI::Models::Responses::ResponseInputFile} for more details.
34
40
  #
@@ -38,6 +44,8 @@ module OpenAI
38
44
  #
39
45
  # @param file_id [String, nil] The ID of the file to be sent to the model.
40
46
  #
47
+ # @param file_url [String] The URL of the file to be sent to the model.
48
+ #
41
49
  # @param filename [String] The name of the file to be sent to the model.
42
50
  #
43
51
  # @param type [Symbol, :input_file] The type of the input item. Always `input_file`.
@@ -29,12 +29,12 @@ module OpenAI
29
29
  required :sequence_number, Integer
30
30
 
31
31
  # @!attribute type
32
- # The type of the event. Always 'response.mcp_call.arguments_delta'.
32
+ # The type of the event. Always 'response.mcp_call_arguments.delta'.
33
33
  #
34
- # @return [Symbol, :"response.mcp_call.arguments_delta"]
35
- required :type, const: :"response.mcp_call.arguments_delta"
34
+ # @return [Symbol, :"response.mcp_call_arguments.delta"]
35
+ required :type, const: :"response.mcp_call_arguments.delta"
36
36
 
37
- # @!method initialize(delta:, item_id:, output_index:, sequence_number:, type: :"response.mcp_call.arguments_delta")
37
+ # @!method initialize(delta:, item_id:, output_index:, sequence_number:, type: :"response.mcp_call_arguments.delta")
38
38
  # Emitted when there is a delta (partial update) to the arguments of an MCP tool
39
39
  # call.
40
40
  #
@@ -46,7 +46,7 @@ module OpenAI
46
46
  #
47
47
  # @param sequence_number [Integer] The sequence number of this event.
48
48
  #
49
- # @param type [Symbol, :"response.mcp_call.arguments_delta"] The type of the event. Always 'response.mcp_call.arguments_delta'.
49
+ # @param type [Symbol, :"response.mcp_call_arguments.delta"] The type of the event. Always 'response.mcp_call_arguments.delta'.
50
50
  end
51
51
  end
52
52
  end
@@ -29,12 +29,12 @@ module OpenAI
29
29
  required :sequence_number, Integer
30
30
 
31
31
  # @!attribute type
32
- # The type of the event. Always 'response.mcp_call.arguments_done'.
32
+ # The type of the event. Always 'response.mcp_call_arguments.done'.
33
33
  #
34
- # @return [Symbol, :"response.mcp_call.arguments_done"]
35
- required :type, const: :"response.mcp_call.arguments_done"
34
+ # @return [Symbol, :"response.mcp_call_arguments.done"]
35
+ required :type, const: :"response.mcp_call_arguments.done"
36
36
 
37
- # @!method initialize(arguments:, item_id:, output_index:, sequence_number:, type: :"response.mcp_call.arguments_done")
37
+ # @!method initialize(arguments:, item_id:, output_index:, sequence_number:, type: :"response.mcp_call_arguments.done")
38
38
  # Emitted when the arguments for an MCP tool call are finalized.
39
39
  #
40
40
  # @param arguments [Object] The finalized arguments for the MCP tool call.
@@ -45,7 +45,7 @@ module OpenAI
45
45
  #
46
46
  # @param sequence_number [Integer] The sequence number of this event.
47
47
  #
48
- # @param type [Symbol, :"response.mcp_call.arguments_done"] The type of the event. Always 'response.mcp_call.arguments_done'.
48
+ # @param type [Symbol, :"response.mcp_call_arguments.done"] The type of the event. Always 'response.mcp_call_arguments.done'.
49
49
  end
50
50
  end
51
51
  end
@@ -41,12 +41,12 @@ module OpenAI
41
41
  required :sequence_number, Integer
42
42
 
43
43
  # @!attribute type
44
- # The type of the event. Always 'response.output_text_annotation.added'.
44
+ # The type of the event. Always 'response.output_text.annotation.added'.
45
45
  #
46
- # @return [Symbol, :"response.output_text_annotation.added"]
47
- required :type, const: :"response.output_text_annotation.added"
46
+ # @return [Symbol, :"response.output_text.annotation.added"]
47
+ required :type, const: :"response.output_text.annotation.added"
48
48
 
49
- # @!method initialize(annotation:, annotation_index:, content_index:, item_id:, output_index:, sequence_number:, type: :"response.output_text_annotation.added")
49
+ # @!method initialize(annotation:, annotation_index:, content_index:, item_id:, output_index:, sequence_number:, type: :"response.output_text.annotation.added")
50
50
  # Emitted when an annotation is added to output text content.
51
51
  #
52
52
  # @param annotation [Object] The annotation object being added. (See annotation schema for details.)
@@ -61,7 +61,7 @@ module OpenAI
61
61
  #
62
62
  # @param sequence_number [Integer] The sequence number of this event.
63
63
  #
64
- # @param type [Symbol, :"response.output_text_annotation.added"] The type of the event. Always 'response.output_text_annotation.added'.
64
+ # @param type [Symbol, :"response.output_text.annotation.added"] The type of the event. Always 'response.output_text.annotation.added'.
65
65
  end
66
66
  end
67
67
  end
@@ -151,13 +151,13 @@ module OpenAI
151
151
  -> { OpenAI::Responses::ResponseImageGenCallPartialImageEvent }
152
152
 
153
153
  # Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
154
- variant :"response.mcp_call.arguments_delta",
154
+ variant :"response.mcp_call_arguments.delta",
155
155
  -> {
156
156
  OpenAI::Responses::ResponseMcpCallArgumentsDeltaEvent
157
157
  }
158
158
 
159
159
  # Emitted when the arguments for an MCP tool call are finalized.
160
- variant :"response.mcp_call.arguments_done",
160
+ variant :"response.mcp_call_arguments.done",
161
161
  -> {
162
162
  OpenAI::Responses::ResponseMcpCallArgumentsDoneEvent
163
163
  }
@@ -185,7 +185,7 @@ module OpenAI
185
185
  -> { OpenAI::Responses::ResponseMcpListToolsInProgressEvent }
186
186
 
187
187
  # Emitted when an annotation is added to output text content.
188
- variant :"response.output_text_annotation.added",
188
+ variant :"response.output_text.annotation.added",
189
189
  -> { OpenAI::Responses::ResponseOutputTextAnnotationAddedEvent }
190
190
 
191
191
  # Emitted when a response is queued and waiting to be processed.
@@ -74,7 +74,13 @@ module OpenAI
74
74
  # @return [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter, Symbol, OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalSetting, nil]
75
75
  optional :require_approval, union: -> { OpenAI::Responses::Tool::Mcp::RequireApproval }, nil?: true
76
76
 
77
- # @!method initialize(server_label:, server_url:, allowed_tools: nil, headers: nil, require_approval: nil, type: :mcp)
77
+ # @!attribute server_description
78
+ # Optional description of the MCP server, used to provide more context.
79
+ #
80
+ # @return [String, nil]
81
+ optional :server_description, String
82
+
83
+ # @!method initialize(server_label:, server_url:, allowed_tools: nil, headers: nil, require_approval: nil, server_description: nil, type: :mcp)
78
84
  # Some parameter documentations has been truncated, see
79
85
  # {OpenAI::Models::Responses::Tool::Mcp} for more details.
80
86
  #
@@ -92,6 +98,8 @@ module OpenAI
92
98
  #
93
99
  # @param require_approval [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter, Symbol, OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalSetting, nil] Specify which of the MCP server's tools require approval.
94
100
  #
101
+ # @param server_description [String] Optional description of the MCP server, used to provide more context.
102
+ #
95
103
  # @param type [Symbol, :mcp] The type of the MCP tool. Always `mcp`.
96
104
 
97
105
  # List of allowed tool names or a filter object.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.12.0"
4
+ VERSION = "0.13.1"
5
5
  end
@@ -7,8 +7,12 @@ module OpenAI
7
7
 
8
8
  # To customize the JSON schema conversion for a type, implement the `JsonSchemaConverter` interface.
9
9
  module JsonSchemaConverter
10
+ # @api private
10
11
  POINTER = T.let(Object.new.freeze, T.anything)
12
+ # @api private
11
13
  COUNTER = T.let(Object.new.freeze, T.anything)
14
+ # @api private
15
+ NO_REF = T.let(Object.new.freeze, T.anything)
12
16
 
13
17
  Input =
14
18
  T.type_alias do
@@ -291,7 +291,7 @@ module OpenAI
291
291
 
292
292
  # Duration of the input audio in seconds.
293
293
  sig { returns(Float) }
294
- attr_accessor :duration
294
+ attr_accessor :seconds
295
295
 
296
296
  # The type of the usage object. Always `duration` for this variant.
297
297
  sig { returns(Symbol) }
@@ -299,17 +299,17 @@ module OpenAI
299
299
 
300
300
  # Usage statistics for models billed by audio input duration.
301
301
  sig do
302
- params(duration: Float, type: Symbol).returns(T.attached_class)
302
+ params(seconds: Float, type: Symbol).returns(T.attached_class)
303
303
  end
304
304
  def self.new(
305
305
  # Duration of the input audio in seconds.
306
- duration:,
306
+ seconds:,
307
307
  # The type of the usage object. Always `duration` for this variant.
308
308
  type: :duration
309
309
  )
310
310
  end
311
311
 
312
- sig { override.returns({ duration: Float, type: Symbol }) }
312
+ sig { override.returns({ seconds: Float, type: Symbol }) }
313
313
  def to_hash
314
314
  end
315
315
  end
@@ -109,25 +109,23 @@ module OpenAI
109
109
 
110
110
  # Duration of the input audio in seconds.
111
111
  sig { returns(Float) }
112
- attr_accessor :duration
112
+ attr_accessor :seconds
113
113
 
114
114
  # The type of the usage object. Always `duration` for this variant.
115
115
  sig { returns(Symbol) }
116
116
  attr_accessor :type
117
117
 
118
118
  # Usage statistics for models billed by audio input duration.
119
- sig do
120
- params(duration: Float, type: Symbol).returns(T.attached_class)
121
- end
119
+ sig { params(seconds: Float, type: Symbol).returns(T.attached_class) }
122
120
  def self.new(
123
121
  # Duration of the input audio in seconds.
124
- duration:,
122
+ seconds:,
125
123
  # The type of the usage object. Always `duration` for this variant.
126
124
  type: :duration
127
125
  )
128
126
  end
129
127
 
130
- sig { override.returns({ duration: Float, type: Symbol }) }
128
+ sig { override.returns({ seconds: Float, type: Symbol }) }
131
129
  def to_hash
132
130
  end
133
131
  end