SimilarityEvaluator Class
Initialize a similarity evaluator configured for a specific Azure OpenAI model.
Usage
eval_fn = SimilarityEvaluator(model_config)
result = eval_fn(
query="What is the capital of Japan?",
response="The capital of Japan is Tokyo.",
ground_truth="Tokyo is Japan's capital.")
Output format
{
"similarity": 3.0,
"gpt_similarity": 3.0,
}
Note: To align with our support of a diverse set of models, a 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
SimilarityEvaluator(model_config)
Parameters
Name | Description |
---|---|
model_config
Required
|
Configuration for the Azure OpenAI model. |