Share via


FluencyEvaluator Class

Evaluates the fluency of a given response or a multi-turn conversation, including reasoning.

The fluency measure assesses the extent to which the generated text conforms to grammatical rules, syntactic structures, and appropriate vocabulary usage, resulting in linguistically correct responses.

Fluency scores range from 1 to 5, with 1 being the least fluent and 5 being the most fluent.

Note

To align with our support of a diverse set of models, an output key without the gpt_ prefix has been added.

To maintain backwards compatibility, the old key with the gpt_ prefix is still be present in the output;

however, it is recommended to use the new key moving forward as the old key will be deprecated in the future.

Constructor

FluencyEvaluator(model_config, *, credential=None, threshold=3)

Parameters

Name Description
model_config
Required

Configuration for the Azure OpenAI model.

threshold
Required
int

The threshold for the fluency evaluator. Default is 3.

Keyword-Only Parameters

Name Description
credential
Default value: None
threshold
Default value: 3

Examples

Initialize and call FluencyEvaluator using Azure AI Project URL in the following format https://{resource_name}.services.ai.azure.com/api/projects/{project_name}


   import os
   from azure.ai.evaluation import FluencyEvaluator

   model_config = {
       "azure_endpoint": os.environ.get("AZURE_OPENAI_ENDPOINT"),  # https://<account_name>.services.ai.azure.com
       "api_key": os.environ.get("AZURE_OPENAI_KEY"),
       "azure_deployment": os.environ.get("AZURE_OPENAI_DEPLOYMENT"),
   }

   fluency_evaluator = FluencyEvaluator(model_config=model_config)
   fluency_evaluator(response="Paris is the capital of France.")

Attributes

id

Evaluator identifier, experimental and to be used only with evaluation in cloud.

id = 'azureai://built-in/evaluators/fluency'