Share via


AzureOpenAIStringCheckGrader 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.

Constructor

AzureOpenAIStringCheckGrader(*, model_config: AzureOpenAIModelConfiguration | OpenAIModelConfiguration, input: str, name: str, operation: Literal['eq', 'ne', 'like', 'ilike'], reference: str, credential: TokenCredential | None = None, **kwargs: Any)

Parameters

Name Description
model_config
Required

The model configuration to use for the grader.

input
Required
str

The input text. This may include template strings.

name
Required
str

The name of the grader.

operation
Required
Literal["eq", "ne", "like", "ilike"]

The string check operation to perform. One of eq, ne, like, or ilike.

reference
Required
str

The reference text. This may include template strings.

credential
Required

The credential to use to authenticate to the model. Only applicable to AzureOpenAI models.

kwargs
Required
Any

Additional keyword arguments to pass to the grader.

Keyword-Only Parameters

Name Description
model_config
Required
input
Required
name
Required
operation
Required
reference
Required
credential
Default value: None

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/string_check_grader'