# frozen_string_literal: true

module OpenAI
  module Models
    module Graders
      class LabelModelGrader < OpenAI::Internal::Type::BaseModel
        # @!attribute input
        #
        #   @return [Array<OpenAI::Models::Graders::LabelModelGrader::Input>]
        required :input, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Graders::LabelModelGrader::Input] }

        # @!attribute labels
        #   The labels to assign to each item in the evaluation.
        #
        #   @return [Array<String>]
        required :labels, OpenAI::Internal::Type::ArrayOf[String]

        # @!attribute model
        #   The model to use for the evaluation. Must support structured outputs.
        #
        #   @return [String]
        required :model, String

        # @!attribute name
        #   The name of the grader.
        #
        #   @return [String]
        required :name, String

        # @!attribute passing_labels
        #   The labels that indicate a passing result. Must be a subset of labels.
        #
        #   @return [Array<String>]
        required :passing_labels, OpenAI::Internal::Type::ArrayOf[String]

        # @!attribute type
        #   The object type, which is always `label_model`.
        #
        #   @return [Symbol, :label_model]
        required :type, const: :label_model

        # @!method initialize(input:, labels:, model:, name:, passing_labels:, type: :label_model)
        #   A LabelModelGrader object which uses a model to assign labels to each item in
        #   the evaluation.
        #
        #   @param input [Array<OpenAI::Models::Graders::LabelModelGrader::Input>]
        #
        #   @param labels [Array<String>] The labels to assign to each item in the evaluation.
        #
        #   @param model [String] The model to use for the evaluation. Must support structured outputs.
        #
        #   @param name [String] The name of the grader.
        #
        #   @param passing_labels [Array<String>] The labels that indicate a passing result. Must be a subset of labels.
        #
        #   @param type [Symbol, :label_model] The object type, which is always `label_model`.

        class Input < OpenAI::Internal::Type::BaseModel
          # @!attribute content
          #   Inputs to the model - can contain template strings.
          #
          #   @return [String, OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, OpenAI::Models::Responses::ResponseInputAudio, Array<Object>]
          required :content, union: -> { OpenAI::Graders::LabelModelGrader::Input::Content }

          # @!attribute role
          #   The role of the message input. One of `user`, `assistant`, `system`, or
          #   `developer`.
          #
          #   @return [Symbol, OpenAI::Models::Graders::LabelModelGrader::Input::Role]
          required :role, enum: -> { OpenAI::Graders::LabelModelGrader::Input::Role }

          # @!attribute type
          #   The type of the message input. Always `message`.
          #
          #   @return [Symbol, OpenAI::Models::Graders::LabelModelGrader::Input::Type, nil]
          optional :type, enum: -> { OpenAI::Graders::LabelModelGrader::Input::Type }

          # @!method initialize(content:, role:, type: nil)
          #   Some parameter documentations has been truncated, see
          #   {OpenAI::Models::Graders::LabelModelGrader::Input} for more details.
          #
          #   A message input to the model with a role indicating instruction following
          #   hierarchy. Instructions given with the `developer` or `system` role take
          #   precedence over instructions given with the `user` role. Messages with the
          #   `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, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, OpenAI::Models::Responses::ResponseInputAudio, Array<Object>] 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`.

          # Inputs to the model - can contain template strings.
          #
          # @see OpenAI::Models::Graders::LabelModelGrader::Input#content
          module Content
            extend OpenAI::Internal::Type::Union

            # A text input to the model.
            variant String

            # A text input to the model.
            variant -> { OpenAI::Responses::ResponseInputText }

            # 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 }

            # An audio input to the model.
            variant -> { OpenAI::Responses::ResponseInputAudio }

            # A list of inputs, each of which may be either an input text, input image, or input audio object.
            variant -> { OpenAI::Models::Graders::LabelModelGrader::Input::Content::AnArrayOfInputTextInputImageAndInputAudioArray }

            class OutputText < OpenAI::Internal::Type::BaseModel
              # @!attribute text
              #   The text output from the model.
              #
              #   @return [String]
              required :text, String

              # @!attribute type
              #   The type of the output text. Always `output_text`.
              #
              #   @return [Symbol, :output_text]
              required :type, const: :output_text

              # @!method initialize(text:, type: :output_text)
              #   Some parameter documentations has been truncated, see
              #   {OpenAI::Models::Graders::LabelModelGrader::Input::Content::OutputText} for more
              #   details.
              #
              #   A text output from the model.
              #
              #   @param text [String] The text output from the model.
              #
              #   @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, OpenAI::Models::Graders::LabelModelGrader::Input::Content::InputImage, OpenAI::Models::Responses::ResponseInputAudio, Array<Object>)]

            # @type [OpenAI::Internal::Type::Converter]
            AnArrayOfInputTextInputImageAndInputAudioArray =
              OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
          end

          # The role of the message input. One of `user`, `assistant`, `system`, or
          # `developer`.
          #
          # @see OpenAI::Models::Graders::LabelModelGrader::Input#role
          module Role
            extend OpenAI::Internal::Type::Enum

            USER = :user
            ASSISTANT = :assistant
            SYSTEM = :system
            DEVELOPER = :developer

            # @!method self.values
            #   @return [Array<Symbol>]
          end

          # The type of the message input. Always `message`.
          #
          # @see OpenAI::Models::Graders::LabelModelGrader::Input#type
          module Type
            extend OpenAI::Internal::Type::Enum

            MESSAGE = :message

            # @!method self.values
            #   @return [Array<Symbol>]
          end
        end
      end
    end

    LabelModelGrader = Graders::LabelModelGrader
  end
end
