diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d52d2b97..3b07edf5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.13.0" + ".": "0.13.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 6539c603..4f41de4f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 109 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-2d116cda53321baa3479e628512def723207a81eb1cdaebb542bd0555e563bda.yml -openapi_spec_hash: 809d958fec261a32004a4b026b718793 -config_hash: e74d6791681e3af1b548748ff47a22c2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-79dcb0ae501ac17004f50aecb112a798290ab3727fbe7c7d1b34299e38ed4f8e.yml +openapi_spec_hash: c8d54bd1ae3d704f6b6f72ffd2f876d8 +config_hash: 167ad0ca036d0f023c78e6496b4311e8 diff --git a/CHANGELOG.md b/CHANGELOG.md index a2889f2a..3a106bef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.13.1 (2025-07-15) + +Full Changelog: [v0.13.0...v0.13.1](https://github.com/openai/openai-ruby/compare/v0.13.0...v0.13.1) + +### Bug Fixes + +* ensure openapi refs are correctly linked ([#746](https://github.com/openai/openai-ruby/issues/746)) ([ea3fccd](https://github.com/openai/openai-ruby/commit/ea3fccdc4f433e4e8a07ae6b47f8ef546b90d24b)) + + +### Chores + +* **api:** update realtime specs, build config ([8ccc35e](https://github.com/openai/openai-ruby/commit/8ccc35e04788eb52be853db6eafa585a9fd5140a)) + ## 0.13.0 (2025-07-10) Full Changelog: [v0.12.0...v0.13.0](https://github.com/openai/openai-ruby/compare/v0.12.0...v0.13.0) diff --git a/Gemfile.lock b/Gemfile.lock index 601e8853..68834dea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - openai (0.13.0) + openai (0.13.1) connection_pool GEM diff --git a/README.md b/README.md index 4d349e37..d1c98b07 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "openai", "~> 0.13.0" +gem "openai", "~> 0.13.1" ``` diff --git a/examples/structured_outputs_chat_completions.rb b/examples/structured_outputs_chat_completions.rb index fa6ec9cd..11aa6728 100755 --- a/examples/structured_outputs_chat_completions.rb +++ b/examples/structured_outputs_chat_completions.rb @@ -22,6 +22,7 @@ class CalendarEvent < OpenAI::BaseModel required :name, String required :date, String required :participants, OpenAI::ArrayOf[Participant] + required :optional_participants, OpenAI::ArrayOf[Participant], nil?: true required :is_virtual, OpenAI::Boolean required :location, OpenAI::UnionOf[String, Location], diff --git a/examples/structured_outputs_responses.rb b/examples/structured_outputs_responses.rb index fd8a7b5a..5a7be6ab 100755 --- a/examples/structured_outputs_responses.rb +++ b/examples/structured_outputs_responses.rb @@ -21,6 +21,7 @@ class CalendarEvent < OpenAI::BaseModel required :name, String required :date, String required :participants, OpenAI::ArrayOf[Participant] + required :optional_participants, OpenAI::ArrayOf[Participant], nil?: true required :is_virtual, OpenAI::Boolean required :location, OpenAI::UnionOf[String, Location], diff --git a/lib/openai/helpers/structured_output/json_schema_converter.rb b/lib/openai/helpers/structured_output/json_schema_converter.rb index d6d0c621..89564671 100644 --- a/lib/openai/helpers/structured_output/json_schema_converter.rb +++ b/lib/openai/helpers/structured_output/json_schema_converter.rb @@ -5,8 +5,24 @@ module Helpers module StructuredOutput # To customize the JSON schema conversion for a type, implement the `JsonSchemaConverter` interface. module JsonSchemaConverter - POINTER = Object.new.freeze - COUNTER = Object.new.freeze + # @api private + POINTER = Object.new.tap do + _1.define_singleton_method(:inspect) do + "#<#{OpenAI::Helpers::StructuredOutput::JsonSchemaConverter}::POINTER>" + end + end.freeze + # @api private + COUNTER = Object.new.tap do + _1.define_singleton_method(:inspect) do + "#<#{OpenAI::Helpers::StructuredOutput::JsonSchemaConverter}::COUNTER>" + end + end.freeze + # @api private + NO_REF = Object.new.tap do + _1.define_singleton_method(:inspect) do + "#<#{OpenAI::Helpers::StructuredOutput::JsonSchemaConverter}::NO_REF>" + end + end.freeze # rubocop:disable Lint/UnusedMethodArgument @@ -34,7 +50,12 @@ def to_nilable(schema) null = "null" case schema in {"$ref": String} - {anyOf: [schema, {type: null}]} + { + anyOf: [ + schema.update(OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::NO_REF => true), + {type: null} + ] + } in {anyOf: schemas} null = {type: null} schemas.any? { _1 == null || _1 == {type: ["null"]} } ? schema : {anyOf: [*schemas, null]} @@ -71,7 +92,7 @@ def cache_def!(state, type:, &blk) } defs.store(type, stored) schema = blk.call - ref_path.replace("#/definitions/#{path.join('/')}") + ref_path.replace("#/$defs/#{path.join('/')}") stored.update(schema) ref end @@ -92,17 +113,20 @@ def to_json_schema(type) reused_defs = {} defs.each_value do |acc| ref = acc.fetch(OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::POINTER) + if (no_ref = ref.delete(OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::NO_REF)) + acc[OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::COUNTER] -= 1 + end + cnt = acc.fetch(OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::COUNTER) + sch = acc.except( OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::POINTER, OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::COUNTER ) - if acc.fetch(OpenAI::Helpers::StructuredOutput::JsonSchemaConverter::COUNTER) > 1 - reused_defs.store(ref.fetch(:$ref), sch) - else - ref.replace(sch) - end + cnt > 1 && !no_ref ? reused_defs.store(ref.fetch(:$ref), sch) : ref.replace(sch) end - reused_defs.empty? ? schema : {"$defs": reused_defs}.update(schema) + + xformed = reused_defs.transform_keys { _1.delete_prefix("#/$defs/") } + xformed.empty? ? schema : {"$defs": xformed}.update(schema) end # @api private diff --git a/lib/openai/models/eval_create_params.rb b/lib/openai/models/eval_create_params.rb index cdf26b6c..1055a3ae 100644 --- a/lib/openai/models/eval_create_params.rb +++ b/lib/openai/models/eval_create_params.rb @@ -280,9 +280,9 @@ class SimpleInputMessage < OpenAI::Internal::Type::BaseModel class EvalItem < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, Array] required :content, union: -> { OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content @@ -318,13 +318,13 @@ class EvalItem < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem#content module Content @@ -341,6 +341,14 @@ module Content OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText } + # An image input to the model. + variant -> { + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage + } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -366,8 +374,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText, OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/evals/create_eval_completions_run_data_source.rb b/lib/openai/models/evals/create_eval_completions_run_data_source.rb index 6521c8f7..28b05c47 100644 --- a/lib/openai/models/evals/create_eval_completions_run_data_source.rb +++ b/lib/openai/models/evals/create_eval_completions_run_data_source.rb @@ -277,9 +277,9 @@ module Template class Message < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, Array] required :content, union: -> { OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content @@ -315,13 +315,13 @@ class Message < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message#content module Content @@ -338,6 +338,14 @@ module Content OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText } + # An image input to the model. + variant -> { + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage + } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -363,8 +371,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText, OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/evals/run_cancel_response.rb b/lib/openai/models/evals/run_cancel_response.rb index 74608cb9..0c9bb2d2 100644 --- a/lib/openai/models/evals/run_cancel_response.rb +++ b/lib/openai/models/evals/run_cancel_response.rb @@ -457,9 +457,9 @@ class ChatMessage < OpenAI::Internal::Type::BaseModel class EvalItem < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array] required :content, union: -> { OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content } @@ -489,13 +489,13 @@ class EvalItem < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem#content module Content @@ -510,6 +510,12 @@ module Content # A text output from the model. variant -> { OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText } + # An image input to the model. + variant -> { OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -535,8 +541,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/evals/run_create_params.rb b/lib/openai/models/evals/run_create_params.rb index 8b84487a..0237a2ab 100644 --- a/lib/openai/models/evals/run_create_params.rb +++ b/lib/openai/models/evals/run_create_params.rb @@ -409,9 +409,9 @@ class ChatMessage < OpenAI::Internal::Type::BaseModel class EvalItem < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, Array] required :content, union: -> { OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content @@ -447,13 +447,13 @@ class EvalItem < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem#content module Content @@ -470,6 +470,14 @@ module Content OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText } + # An image input to the model. + variant -> { + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage + } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -495,8 +503,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/evals/run_create_response.rb b/lib/openai/models/evals/run_create_response.rb index 73327ea2..6c0cdf67 100644 --- a/lib/openai/models/evals/run_create_response.rb +++ b/lib/openai/models/evals/run_create_response.rb @@ -457,9 +457,9 @@ class ChatMessage < OpenAI::Internal::Type::BaseModel class EvalItem < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array] required :content, union: -> { OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content } @@ -489,13 +489,13 @@ class EvalItem < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem#content module Content @@ -510,6 +510,12 @@ module Content # A text output from the model. variant -> { OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText } + # An image input to the model. + variant -> { OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -535,8 +541,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/evals/run_list_response.rb b/lib/openai/models/evals/run_list_response.rb index 0f8abfad..66bfa2f1 100644 --- a/lib/openai/models/evals/run_list_response.rb +++ b/lib/openai/models/evals/run_list_response.rb @@ -457,9 +457,9 @@ class ChatMessage < OpenAI::Internal::Type::BaseModel class EvalItem < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] + # @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] required :content, union: -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content } @@ -489,13 +489,13 @@ class EvalItem < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @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. + # @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] Inputs to the model - can contain template strings. # # @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 # # @param type [Symbol, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem#content module Content @@ -510,6 +510,12 @@ module Content # A text output from the model. variant -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText } + # An image input to the model. + variant -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -535,8 +541,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText)] + # @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)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/evals/run_retrieve_response.rb b/lib/openai/models/evals/run_retrieve_response.rb index 20526587..1c0a6f8b 100644 --- a/lib/openai/models/evals/run_retrieve_response.rb +++ b/lib/openai/models/evals/run_retrieve_response.rb @@ -461,9 +461,9 @@ class ChatMessage < OpenAI::Internal::Type::BaseModel class EvalItem < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText] + # @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] required :content, union: -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content } @@ -493,13 +493,13 @@ class EvalItem < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @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. + # @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] Inputs to the model - can contain template strings. # # @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 # # @param type [Symbol, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem#content module Content @@ -514,6 +514,12 @@ module Content # A text output from the model. variant -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText } + # An image input to the model. + variant -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -539,8 +545,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage} + # for more details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText)] + # @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)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/graders/label_model_grader.rb b/lib/openai/models/graders/label_model_grader.rb index 0f0d52aa..bfed8c30 100644 --- a/lib/openai/models/graders/label_model_grader.rb +++ b/lib/openai/models/graders/label_model_grader.rb @@ -57,9 +57,9 @@ class LabelModelGrader < OpenAI::Internal::Type::BaseModel class Input < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, Array] required :content, union: -> { OpenAI::Graders::LabelModelGrader::Input::Content } # @!attribute role @@ -85,13 +85,13 @@ class Input < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::Graders::LabelModelGrader::Input::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::Graders::LabelModelGrader::Input::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Graders::LabelModelGrader::Input#content module Content @@ -106,6 +106,12 @@ module Content # A text output from the model. variant -> { OpenAI::Graders::LabelModelGrader::Input::Content::OutputText } + # An image input to the model. + variant -> { OpenAI::Graders::LabelModelGrader::Input::Content::InputImage } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Graders::LabelModelGrader::Input::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -131,8 +137,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage} for more + # details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/models/graders/score_model_grader.rb b/lib/openai/models/graders/score_model_grader.rb index bdec7e50..47417994 100644 --- a/lib/openai/models/graders/score_model_grader.rb +++ b/lib/openai/models/graders/score_model_grader.rb @@ -57,9 +57,9 @@ class ScoreModelGrader < OpenAI::Internal::Type::BaseModel class Input < OpenAI::Internal::Type::BaseModel # @!attribute content - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # - # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText] + # @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage, Array] required :content, union: -> { OpenAI::Graders::ScoreModelGrader::Input::Content } # @!attribute role @@ -85,13 +85,13 @@ class Input < OpenAI::Internal::Type::BaseModel # `assistant` role are presumed to have been generated by the model in previous # interactions. # - # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText] Text inputs to the model - can contain template strings. + # @param content [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage, Array] Inputs to the model - can contain template strings. # # @param role [Symbol, OpenAI::Models::Graders::ScoreModelGrader::Input::Role] The role of the message input. One of `user`, `assistant`, `system`, or # # @param type [Symbol, OpenAI::Models::Graders::ScoreModelGrader::Input::Type] The type of the message input. Always `message`. - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. # # @see OpenAI::Models::Graders::ScoreModelGrader::Input#content module Content @@ -106,6 +106,12 @@ module Content # A text output from the model. variant -> { OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText } + # An image input to the model. + variant -> { OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage } + + # A list of inputs, each of which may be either an input text or input image object. + variant -> { OpenAI::Models::Graders::ScoreModelGrader::Input::Content::AnArrayOfInputTextAndInputImageArray } + class OutputText < OpenAI::Internal::Type::BaseModel # @!attribute text # The text output from the model. @@ -131,8 +137,45 @@ class OutputText < OpenAI::Internal::Type::BaseModel # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. end + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image input. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the image input. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!attribute detail + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + # + # @return [String, nil] + optional :detail, String + + # @!method initialize(image_url:, detail: nil, type: :input_image) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage} for more + # details. + # + # An image input to the model. + # + # @param image_url [String] The URL of the image input. + # + # @param detail [String] The detail level of the image to be sent to the model. One of `high`, `low`, or + # + # @param type [Symbol, :input_image] The type of the image input. Always `input_image`. + end + # @!method self.variants - # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText)] + # @return [Array(String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::ScoreModelGrader::Input::Content::InputImage, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AnArrayOfInputTextAndInputImageArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown] end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/lib/openai/version.rb b/lib/openai/version.rb index 69be28c0..ddfc5bda 100644 --- a/lib/openai/version.rb +++ b/lib/openai/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenAI - VERSION = "0.13.0" + VERSION = "0.13.1" end diff --git a/rbi/openai/helpers/structured_output/json_schema_converter.rbi b/rbi/openai/helpers/structured_output/json_schema_converter.rbi index 2d34df01..f32e2d04 100644 --- a/rbi/openai/helpers/structured_output/json_schema_converter.rbi +++ b/rbi/openai/helpers/structured_output/json_schema_converter.rbi @@ -7,8 +7,12 @@ module OpenAI # To customize the JSON schema conversion for a type, implement the `JsonSchemaConverter` interface. module JsonSchemaConverter + # @api private POINTER = T.let(Object.new.freeze, T.anything) + # @api private COUNTER = T.let(Object.new.freeze, T.anything) + # @api private + NO_REF = T.let(Object.new.freeze, T.anything) Input = T.type_alias do diff --git a/rbi/openai/models/eval_create_params.rbi b/rbi/openai/models/eval_create_params.rbi index 7131576a..379e276b 100644 --- a/rbi/openai/models/eval_create_params.rbi +++ b/rbi/openai/models/eval_create_params.rbi @@ -474,13 +474,15 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText, + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, + T::Array[T.anything] ) ) end @@ -524,7 +526,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText::OrHash + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText::OrHash, + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Role::OrSymbol, @@ -533,7 +537,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -550,7 +554,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText, + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, + T::Array[T.anything] ), role: OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Role::OrSymbol, @@ -562,7 +568,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -571,7 +577,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText, + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, + T::Array[T.anything] ) end @@ -609,6 +617,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -618,6 +679,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi b/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi index 8298b14c..d929b514 100644 --- a/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +++ b/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi @@ -515,13 +515,15 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText, + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, + T::Array[T.anything] ) ) end @@ -565,7 +567,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText::OrHash + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText::OrHash, + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Role::OrSymbol, @@ -574,7 +578,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -591,7 +595,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText, + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, + T::Array[T.anything] ), role: OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Role::OrSymbol, @@ -603,7 +609,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -612,7 +618,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText, + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, + T::Array[T.anything] ) end @@ -652,6 +660,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -661,6 +722,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/evals/run_cancel_response.rbi b/rbi/openai/models/evals/run_cancel_response.rbi index 9ac8bf15..d9c6617c 100644 --- a/rbi/openai/models/evals/run_cancel_response.rbi +++ b/rbi/openai/models/evals/run_cancel_response.rbi @@ -749,7 +749,7 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::Variants @@ -795,7 +795,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash + OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash, + OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role::OrSymbol, @@ -804,7 +806,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -829,7 +831,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -838,7 +840,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText + OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, + OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ) end @@ -878,6 +882,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -887,6 +944,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/evals/run_create_params.rbi b/rbi/openai/models/evals/run_create_params.rbi index 32ad2f72..c4577765 100644 --- a/rbi/openai/models/evals/run_create_params.rbi +++ b/rbi/openai/models/evals/run_create_params.rbi @@ -693,13 +693,15 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText, + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ) ) end @@ -743,7 +745,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash, + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Role::OrSymbol, @@ -752,7 +756,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -769,7 +773,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText, + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ), role: OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Role::OrSymbol, @@ -781,7 +787,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -790,7 +796,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText, + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ) end @@ -830,6 +838,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -839,6 +900,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/evals/run_create_response.rbi b/rbi/openai/models/evals/run_create_response.rbi index ae40fb83..7126ad47 100644 --- a/rbi/openai/models/evals/run_create_response.rbi +++ b/rbi/openai/models/evals/run_create_response.rbi @@ -749,7 +749,7 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::Variants @@ -795,7 +795,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash + OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash, + OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role::OrSymbol, @@ -804,7 +806,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -829,7 +831,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -838,7 +840,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText + OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText, + OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ) end @@ -878,6 +882,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -887,6 +944,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/evals/run_list_response.rbi b/rbi/openai/models/evals/run_list_response.rbi index 9d45d00b..28b81204 100644 --- a/rbi/openai/models/evals/run_list_response.rbi +++ b/rbi/openai/models/evals/run_list_response.rbi @@ -745,7 +745,7 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::Variants @@ -791,7 +791,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash + OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash, + OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role::OrSymbol, @@ -800,7 +802,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -825,7 +827,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -834,7 +836,9 @@ module OpenAI T.any( String, OpenAI::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::OutputText, + OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ) end @@ -874,6 +878,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -883,6 +940,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/evals/run_retrieve_response.rbi b/rbi/openai/models/evals/run_retrieve_response.rbi index 3a1d9ea8..306630c7 100644 --- a/rbi/openai/models/evals/run_retrieve_response.rbi +++ b/rbi/openai/models/evals/run_retrieve_response.rbi @@ -751,7 +751,7 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::Variants @@ -797,7 +797,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash + OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash, + OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Role::OrSymbol, @@ -806,7 +808,7 @@ module OpenAI ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -831,7 +833,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -840,7 +842,9 @@ module OpenAI T.any( String, OpenAI::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::OutputText, + OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + T::Array[T.anything] ) end @@ -880,6 +884,59 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params( + image_url: String, + detail: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -889,6 +946,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/graders/label_model_grader.rbi b/rbi/openai/models/graders/label_model_grader.rbi index 9d062b87..22a3f239 100644 --- a/rbi/openai/models/graders/label_model_grader.rbi +++ b/rbi/openai/models/graders/label_model_grader.rbi @@ -85,13 +85,15 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Graders::LabelModelGrader::Input::Content::OutputText + OpenAI::Graders::LabelModelGrader::Input::Content::OutputText, + OpenAI::Graders::LabelModelGrader::Input::Content::InputImage, + T::Array[T.anything] ) ) end @@ -132,14 +134,16 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Graders::LabelModelGrader::Input::Content::OutputText::OrHash + OpenAI::Graders::LabelModelGrader::Input::Content::OutputText::OrHash, + OpenAI::Graders::LabelModelGrader::Input::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Graders::LabelModelGrader::Input::Role::OrSymbol, type: OpenAI::Graders::LabelModelGrader::Input::Type::OrSymbol ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -156,7 +160,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Graders::LabelModelGrader::Input::Content::OutputText + OpenAI::Graders::LabelModelGrader::Input::Content::OutputText, + OpenAI::Graders::LabelModelGrader::Input::Content::InputImage, + T::Array[T.anything] ), role: OpenAI::Graders::LabelModelGrader::Input::Role::OrSymbol, type: OpenAI::Graders::LabelModelGrader::Input::Type::OrSymbol @@ -166,7 +172,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -175,7 +181,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Graders::LabelModelGrader::Input::Content::OutputText + OpenAI::Graders::LabelModelGrader::Input::Content::OutputText, + OpenAI::Graders::LabelModelGrader::Input::Content::InputImage, + T::Array[T.anything] ) end @@ -213,6 +221,57 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Graders::LabelModelGrader::Input::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params(image_url: String, detail: String, type: Symbol).returns( + T.attached_class + ) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -222,6 +281,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/rbi/openai/models/graders/score_model_grader.rbi b/rbi/openai/models/graders/score_model_grader.rbi index ab602eda..7baa4347 100644 --- a/rbi/openai/models/graders/score_model_grader.rbi +++ b/rbi/openai/models/graders/score_model_grader.rbi @@ -92,13 +92,15 @@ module OpenAI ) end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. sig do returns( T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText + OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText, + OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage, + T::Array[T.anything] ) ) end @@ -139,14 +141,16 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText::OrHash, - OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText::OrHash + OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText::OrHash, + OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage::OrHash, + T::Array[T.anything] ), role: OpenAI::Graders::ScoreModelGrader::Input::Role::OrSymbol, type: OpenAI::Graders::ScoreModelGrader::Input::Type::OrSymbol ).returns(T.attached_class) end def self.new( - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. content:, # The role of the message input. One of `user`, `assistant`, `system`, or # `developer`. @@ -163,7 +167,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText + OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText, + OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage, + T::Array[T.anything] ), role: OpenAI::Graders::ScoreModelGrader::Input::Role::OrSymbol, type: OpenAI::Graders::ScoreModelGrader::Input::Type::OrSymbol @@ -173,7 +179,7 @@ module OpenAI def to_hash end - # Text inputs to the model - can contain template strings. + # Inputs to the model - can contain template strings. module Content extend OpenAI::Internal::Type::Union @@ -182,7 +188,9 @@ module OpenAI T.any( String, OpenAI::Responses::ResponseInputText, - OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText + OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText, + OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage, + T::Array[T.anything] ) end @@ -220,6 +228,57 @@ module OpenAI end end + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image input. + sig { returns(String) } + attr_accessor :image_url + + # The type of the image input. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + sig { returns(T.nilable(String)) } + attr_reader :detail + + sig { params(detail: String).void } + attr_writer :detail + + # An image input to the model. + sig do + params(image_url: String, detail: String, type: Symbol).returns( + T.attached_class + ) + end + def self.new( + # The URL of the image input. + image_url:, + # The detail level of the image to be sent to the model. One of `high`, `low`, or + # `auto`. Defaults to `auto`. + detail: nil, + # The type of the image input. Always `input_image`. + type: :input_image + ) + end + + sig do + override.returns( + { image_url: String, type: Symbol, detail: String } + ) + end + def to_hash + end + end + sig do override.returns( T::Array[ @@ -229,6 +288,14 @@ module OpenAI end def self.variants end + + AnArrayOfInputTextAndInputImageArray = + T.let( + OpenAI::Internal::Type::ArrayOf[ + OpenAI::Internal::Type::Unknown + ], + OpenAI::Internal::Type::Converter + ) end # The role of the message input. One of `user`, `assistant`, `system`, or diff --git a/sig/openai/models/eval_create_params.rbs b/sig/openai/models/eval_create_params.rbs index 26468913..88abb4fb 100644 --- a/sig/openai/models/eval_create_params.rbs +++ b/sig/openai/models/eval_create_params.rbs @@ -218,6 +218,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText + | OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -234,7 +236,34 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { image_url: String, type: :input_image, detail: String } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/evals/create_eval_completions_run_data_source.rbs b/sig/openai/models/evals/create_eval_completions_run_data_source.rbs index 8c12eed5..a4e24364 100644 --- a/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +++ b/sig/openai/models/evals/create_eval_completions_run_data_source.rbs @@ -234,6 +234,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText + | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -250,7 +252,34 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { image_url: String, type: :input_image, detail: String } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/evals/run_cancel_response.rbs b/sig/openai/models/evals/run_cancel_response.rbs index b9897b66..3590bb4d 100644 --- a/sig/openai/models/evals/run_cancel_response.rbs +++ b/sig/openai/models/evals/run_cancel_response.rbs @@ -350,6 +350,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText + | OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -369,7 +371,38 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { + image_url: String, + type: :input_image, + detail: String + } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Evals::RunCancelResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/evals/run_create_params.rbs b/sig/openai/models/evals/run_create_params.rbs index 1d4e8ac2..c16120a9 100644 --- a/sig/openai/models/evals/run_create_params.rbs +++ b/sig/openai/models/evals/run_create_params.rbs @@ -313,6 +313,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText + | OpenAI::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -332,7 +334,38 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { + image_url: String, + type: :input_image, + detail: String + } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Evals::RunCreateParams::DataSource::CreateEvalResponsesRunDataSource::InputMessages::Template::Template::EvalItem::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/evals/run_create_response.rbs b/sig/openai/models/evals/run_create_response.rbs index 97e64211..d73a072b 100644 --- a/sig/openai/models/evals/run_create_response.rbs +++ b/sig/openai/models/evals/run_create_response.rbs @@ -350,6 +350,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::OutputText + | OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -369,7 +371,38 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { + image_url: String, + type: :input_image, + detail: String + } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Evals::RunCreateResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/evals/run_list_response.rbs b/sig/openai/models/evals/run_list_response.rbs index be5a46e1..5e91e0f5 100644 --- a/sig/openai/models/evals/run_list_response.rbs +++ b/sig/openai/models/evals/run_list_response.rbs @@ -350,6 +350,8 @@ module OpenAI String | OpenAI::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[top] module Content extend OpenAI::Internal::Type::Union @@ -369,7 +371,38 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { + image_url: String, + type: :input_image, + detail: String + } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Evals::RunListResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/evals/run_retrieve_response.rbs b/sig/openai/models/evals/run_retrieve_response.rbs index 63418be1..874cf7d0 100644 --- a/sig/openai/models/evals/run_retrieve_response.rbs +++ b/sig/openai/models/evals/run_retrieve_response.rbs @@ -350,6 +350,8 @@ module OpenAI String | OpenAI::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[top] module Content extend OpenAI::Internal::Type::Union @@ -369,7 +371,38 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { + image_url: String, + type: :input_image, + detail: String + } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Evals::RunRetrieveResponse::DataSource::Responses::InputMessages::Template::Template::EvalItem::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/graders/label_model_grader.rbs b/sig/openai/models/graders/label_model_grader.rbs index e6970199..29bcb103 100644 --- a/sig/openai/models/graders/label_model_grader.rbs +++ b/sig/openai/models/graders/label_model_grader.rbs @@ -78,6 +78,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::Graders::LabelModelGrader::Input::Content::OutputText + | OpenAI::Graders::LabelModelGrader::Input::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -94,7 +96,34 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { image_url: String, type: :input_image, detail: String } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Graders::LabelModelGrader::Input::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/sig/openai/models/graders/score_model_grader.rbs b/sig/openai/models/graders/score_model_grader.rbs index caf20048..5ff024a4 100644 --- a/sig/openai/models/graders/score_model_grader.rbs +++ b/sig/openai/models/graders/score_model_grader.rbs @@ -82,6 +82,8 @@ module OpenAI String | OpenAI::Responses::ResponseInputText | OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText + | OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage + | ::Array[top] module Content extend OpenAI::Internal::Type::Union @@ -98,7 +100,34 @@ module OpenAI def to_hash: -> { text: String, type: :output_text } end + type input_image = + { image_url: String, type: :input_image, detail: String } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + attr_reader detail: String? + + def detail=: (String) -> String + + def initialize: ( + image_url: String, + ?detail: String, + ?type: :input_image + ) -> void + + def to_hash: -> { + image_url: String, + type: :input_image, + detail: String + } + end + def self?.variants: -> ::Array[OpenAI::Models::Graders::ScoreModelGrader::Input::content] + + AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter end type role = :user | :assistant | :system | :developer diff --git a/test/openai/helpers/structured_output_test.rb b/test/openai/helpers/structured_output_test.rb index 05ee3ce7..5e42185e 100644 --- a/test/openai/helpers/structured_output_test.rb +++ b/test/openai/helpers/structured_output_test.rb @@ -137,78 +137,165 @@ class M5 < OpenAI::Helpers::StructuredOutput::BaseModel class M6 < OpenAI::Helpers::StructuredOutput::BaseModel required :a, String - required :b, -> { M6 }, nil?: true + required :b, -> { M6 } + end + + class M7 < OpenAI::Helpers::StructuredOutput::BaseModel + required :a, -> { M5 } + required :b, M5 + end + + class M8 < OpenAI::Helpers::StructuredOutput::BaseModel + required :a, -> { M5 } + required :b, M5, nil?: true + end + + class M9 < OpenAI::Helpers::StructuredOutput::BaseModel + required :a, -> { M10 } + required :b, -> { M10 } + end + + class M10 < OpenAI::Helpers::StructuredOutput::BaseModel + required :b, -> { M9 } end def test_definition_reusing cases = { - M4 => { - :$defs => { - "#/definitions/.a" => {type: "string", enum: ["one"]} + M6 => { + :$defs => + { + "" => + { + type: "object", + properties: {a: {type: "string"}, b: {:$ref => "#/$defs/"}}, + required: %w[a b], + additionalProperties: false + } + }, + :$ref => "#/$defs/" + }, + M7 => + { + :$defs => + { + ".a" => + { + type: "object", + properties: { + a: { + anyOf: [ + { + type: "array", + items: {anyOf: [{type: "string", enum: ["one"]}, {type: "null"}]} + }, + {type: "null"} + ] + }, + b: { + anyOf: [ + { + type: "array", + items: {anyOf: [{type: "string", enum: ["one"]}, {type: "null"}]} + }, + {type: "null"} + ] + } + }, + required: %w[a b], + additionalProperties: false + } + }, + :type => "object", + :properties => {a: {:$ref => "#/$defs/.a"}, b: {:$ref => "#/$defs/.a"}}, + :required => %w[a b], + :additionalProperties => false }, - :type => "object", - :properties => { - a: {"$ref": "#/definitions/.a"}, - b: { - anyOf: [ - {"$ref": "#/definitions/.a"}, - {type: "null"} - ] + M8 => { + type: "object", + properties: { + a: { + type: "object", + properties: { + a: { + anyOf: [ + { + type: "array", + items: {anyOf: [{type: "string", enum: ["one"]}, {type: "null"}]} + }, + {type: "null"} + ] + }, + b: { + anyOf: [ + { + type: "array", + items: {anyOf: [{type: "string", enum: ["one"]}, {type: "null"}]} + }, + {type: "null"} + ] + } + }, + required: %w[a b], + additionalProperties: false }, - c: { + b: { anyOf: [ { - type: "array", - items: { - anyOf: [ - {"$ref": "#/definitions/.a"}, - {type: "null"} - ] + type: "object", + properties: { + a: { + anyOf: [ + { + type: "array", + items: {anyOf: [{type: "string", enum: ["one"]}, {type: "null"}]} + }, + {type: "null"} + ] + }, + b: { + anyOf: [ + { + type: "array", + items: { + anyOf: [ + {type: "string", enum: ["one"]}, + {type: "null"} + ] + } + }, + {type: "null"} + ] + } }, - description: "nested" + required: %w[a b], + additionalProperties: false }, {type: "null"} ] } }, - :required => %w[a b c], - :additionalProperties => false - }, - M5 => { - :$defs => { - "#/definitions/.a/[]" => { - type: "array", - items: {anyOf: [{type: "string", enum: ["one"]}, {type: "null"}]} - } - }, - :type => "object", - :properties => { - a: {anyOf: [{:$ref => "#/definitions/.a/[]"}, {type: "null"}]}, - b: {anyOf: [{:$ref => "#/definitions/.a/[]"}, {type: "null"}]} - }, - :required => %w[a b], - :additionalProperties => false - }, - OpenAI::Helpers::StructuredOutput::UnionOf[E1, A2] => { - :$defs => {"#/definitions/?.0" => {type: "string", enum: ["one"]}}, - :anyOf => [ - {:$ref => "#/definitions/?.0"}, - {type: "array", items: {anyOf: [{:$ref => "#/definitions/?.0"}, {type: "null"}]}} - ] + required: %w[a b], + additionalProperties: false }, - M6 => { - :$defs => { - "#/definitions/" => { - type: "object", - properties: { - a: {type: "string"}, - b: {anyOf: [{:$ref => "#/definitions/"}, {type: "null"}]} - }, - required: %w[a b], - additionalProperties: false - } - }, - :$ref => "#/definitions/" + M10 => { + :$defs => + { + "" => + { + type: "object", + properties: { + b: { + type: "object", + properties: {a: {:$ref => "#/$defs/"}, b: {:$ref => "#/$defs/"}}, + required: %w[a b], + additionalProperties: false + } + }, + required: ["b"], + additionalProperties: false + } + }, + :$ref => "#/$defs/" } } @@ -220,23 +307,23 @@ def test_definition_reusing end end - class M7 < OpenAI::Helpers::StructuredOutput::BaseModel + class M11 < OpenAI::Helpers::StructuredOutput::BaseModel required :a, OpenAI::Helpers::StructuredOutput::ParsedJson end def test_parsed_json assert_pattern do - M7.new(a: {dog: "woof"}) => {a: {dog: "woof"}} + M11.new(a: {dog: "woof"}) => {a: {dog: "woof"}} end err = JSON::ParserError.new("unexpected token at 'invalid json'") - m1 = M7.new(a: err) + m1 = M11.new(a: err) assert_raises(OpenAI::Errors::ConversionError) do m1.a end - m2 = OpenAI::Internal::Type::Converter.coerce(M7, {a: err}) + m2 = OpenAI::Internal::Type::Converter.coerce(M11, {a: err}) assert_raises(OpenAI::Errors::ConversionError) do m2.a end