Class: OpenAI::Models::Graders::TextSimilarityGrader

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/graders/text_similarity_grader.rb,
sig/openai/models/graders/text_similarity_grader.rbs

Defined Under Namespace

Modules: EvaluationMetric

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, 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, coerce_with_error, 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(evaluation_metric:, input:, name:, reference:, type: :text_similarity) ⇒ Object

Parameters:

  • evaluation_metric —

    The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_l.

  • input —

    The text being graded.

  • name —

    The name of the grader.

  • reference —

    The text being graded against.

  • type (defaults to: :text_similarity) —

    The type of grader.



# File 'lib/openai/models/graders/text_similarity_grader.rb', line 38

Instance Attribute Details

#evaluation_metric ⇒ OpenAI::Models::Graders::TextSimilarityGrader::evaluation_metric

The evaluation metric to use. One of cosine, fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, or rouge_l.

Returns:

  • (OpenAI::Models::Graders::TextSimilarityGrader::evaluation_metric)


12
# File 'lib/openai/models/graders/text_similarity_grader.rb', line 12

required :evaluation_metric, enum: -> { OpenAI::Graders::TextSimilarityGrader::EvaluationMetric }

#input ⇒ String

The text being graded.

Returns:

  • (String)


18
# File 'lib/openai/models/graders/text_similarity_grader.rb', line 18

required :input, String

#name ⇒ String

The name of the grader.

Returns:

  • (String)


24
# File 'lib/openai/models/graders/text_similarity_grader.rb', line 24

required :name, String

#reference ⇒ String

The text being graded against.

Returns:

  • (String)


30
# File 'lib/openai/models/graders/text_similarity_grader.rb', line 30

required :reference, String

#type ⇒ :text_similarity

The type of grader.

Returns:

  • (:text_similarity)


36
# File 'lib/openai/models/graders/text_similarity_grader.rb', line 36

required :type, const: :text_similarity

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


51
# File 'sig/openai/models/graders/text_similarity_grader.rbs', line 51

def to_hash: -> {