Class: OpenAI::Models::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/chat/chat_completion_chunk.rb

Defined Under Namespace

Modules: CategoryAppliedInputType

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(model:, results:, type: :moderation_results) ⇒ Object

Successful moderation results for the request input or generated output.

Parameters:



602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 602

class Result < OpenAI::Internal::Type::BaseModel
  # @!attribute categories
  #   A dictionary of moderation categories to booleans, True if the input is flagged
  #   under this category.
  #
  #   @return [Hash{Symbol=>Boolean}]
  required :categories, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Boolean]

  # @!attribute category_applied_input_types
  #   Which modalities of input are reflected by the score for each category.
  #
  #   @return [Hash{Symbol=>Array<Symbol, OpenAI::Models::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result::CategoryAppliedInputType>}]
  required :category_applied_input_types,
           -> do
             OpenAI::Internal::Type::HashOf[
               OpenAI::Internal::Type::ArrayOf[
                 enum: OpenAI::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result::CategoryAppliedInputType
               ]
             ]
           end

  # @!attribute category_scores
  #   A dictionary of moderation categories to scores.
  #
  #   @return [Hash{Symbol=>Float}]
  required :category_scores, OpenAI::Internal::Type::HashOf[Float]

  # @!attribute flagged
  #   A boolean indicating whether the content was flagged by any category.
  #
  #   @return [Boolean]
  required :flagged, OpenAI::Internal::Type::Boolean

  # @!attribute model
  #   The moderation model that produced this result.
  #
  #   @return [String]
  required :model, String

  # @!attribute type
  #   The object type, which was always `moderation_result` for successful moderation
  #   results.
  #
  #   @return [Symbol, :moderation_result]
  required :type, const: :moderation_result

  # @!method initialize(categories:, category_applied_input_types:, category_scores:, flagged:, model:, type: :moderation_result)
  #   Some parameter documentations has been truncated, see
  #   {OpenAI::Models::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result}
  #   for more details.
  #
  #   A moderation result produced for the response input or output.
  #
  #   @param categories [Hash{Symbol=>Boolean}] A dictionary of moderation categories to booleans, True if the input is flagged
  #
  #   @param category_applied_input_types [Hash{Symbol=>Array<Symbol, OpenAI::Models::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result::CategoryAppliedInputType>}] Which modalities of input are reflected by the score for each category.
  #
  #   @param category_scores [Hash{Symbol=>Float}] A dictionary of moderation categories to scores.
  #
  #   @param flagged [Boolean] A boolean indicating whether the content was flagged by any category.
  #
  #   @param model [String] The moderation model that produced this result.
  #
  #   @param type [Symbol, :moderation_result] The object type, which was always `moderation_result` for successful moderation

  module CategoryAppliedInputType
    extend OpenAI::Internal::Type::Enum

    TEXT = :text
    IMAGE = :image

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

Instance Attribute Details

#categoriesHash{Symbol=>Boolean}

A dictionary of moderation categories to booleans, True if the input is flagged under this category.

Returns:



608
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 608

required :categories, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Boolean]

#category_applied_input_typesHash{Symbol=>Array<Symbol, OpenAI::Models::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result::CategoryAppliedInputType>}

Which modalities of input are reflected by the score for each category.



614
615
616
617
618
619
620
621
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 614

required :category_applied_input_types,
-> do
  OpenAI::Internal::Type::HashOf[
    OpenAI::Internal::Type::ArrayOf[
      enum: OpenAI::Chat::ChatCompletionChunk::Moderation::Output::ModerationResults::Result::CategoryAppliedInputType
    ]
  ]
end

#category_scoresHash{Symbol=>Float}

A dictionary of moderation categories to scores.

Returns:

  • (Hash{Symbol=>Float})


627
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 627

required :category_scores, OpenAI::Internal::Type::HashOf[Float]

#flaggedBoolean

A boolean indicating whether the content was flagged by any category.

Returns:



633
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 633

required :flagged, OpenAI::Internal::Type::Boolean

#modelString

The moderation model that produced this result.

Returns:

  • (String)


639
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 639

required :model, String

#typeSymbol, :moderation_result

The object type, which was always ‘moderation_result` for successful moderation results.

Returns:

  • (Symbol, :moderation_result)


646
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 646

required :type, const: :moderation_result