Share via


AzureOpenAITextSimilarityGrader Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Wrapper class for OpenAI's string check graders.

Supplying a StringCheckGrader to the evaluate method will cause an asynchronous request to evaluate the grader via the OpenAI API. The results of the evaluation will then be merged into the standard evaluation results.

] :param evaluation_metric: The evaluation metric to use. :type evaluation_metric: Literal[

  "fuzzy_match",
  "bleu",
  "gleu",
  "meteor",
  "rouge_1",
  "rouge_2",
  "rouge_3",
  "rouge_4",
  "rouge_5",
  "rouge_l",
  "cosine",

]

Constructor

AzureOpenAITextSimilarityGrader(*, model_config: AzureOpenAIModelConfiguration | OpenAIModelConfiguration, evaluation_metric: Literal['fuzzy_match', 'bleu', 'gleu', 'meteor', 'rouge_1', 'rouge_2', 'rouge_3', 'rouge_4', 'rouge_5', 'rouge_l', 'cosine'], input: str, pass_threshold: float, reference: str, name: str, **kwargs: Any)

Parameters

Name Description
model_config
Required

The model configuration to use for the grader.

input
Required
str

The text being graded.

pass_threshold
Required

A float score where a value greater than or equal indicates a passing grade.

reference
Required
str

The text being graded against.

name
Required
str

The name of the grader.

kwargs
Required
Any

Additional keyword arguments to pass to the grader.

Keyword-Only Parameters

Name Description
model_config
Required
evaluation_metric
Required
input
Required
pass_threshold
Required
reference
Required
name
Required

Methods

get_client

Construct an appropriate OpenAI client using this grader's model configuration. Returns a slightly different client depending on whether or not this grader's model configuration is for Azure OpenAI or OpenAI.

get_client

Construct an appropriate OpenAI client using this grader's model configuration. Returns a slightly different client depending on whether or not this grader's model configuration is for Azure OpenAI or OpenAI.

get_client() -> Any

Returns

Type Description
[<xref:openai.OpenAI>, <xref:openai.AzureOpenAI>]

The OpenAI client.

Attributes

id

id = 'azureai://built-in/evaluators/azure-openai/text_similarity_grader'