@@ -73,32 +73,33 @@ import os
73
73
from azure.ai.evaluation import AzureOpenAIModelConfiguration
74
74
from azure.identity import DefaultAzureCredential
75
75
from azure.ai.evaluation import IntentResolutionEvaluator, ResponseCompletenessEvaluator
76
-
77
-
76
+
77
+
78
78
model_config = AzureOpenAIModelConfiguration(
79
79
azure_endpoint = os.environ[" AZURE_OPENAI_ENDPOINT" ],
80
80
api_key = os.environ[" AZURE_OPENAI_API_KEY" ],
81
81
api_version = os.environ[" AZURE_OPENAI_API_VERSION" ],
82
82
azure_deployment = os.environ[" MODEL_DEPLOYMENT_NAME" ],
83
83
)
84
-
84
+
85
85
intent_resolution_evaluator = IntentResolutionEvaluator(model_config)
86
- completeness_evaluator = CompletenessEvaluator (model_config = model_config)
87
-
86
+ response_completeness_evaluator = ResponseCompletenessEvaluator (model_config = model_config)
87
+
88
88
# Evaluating query and response as strings
89
89
# A positive example. Intent is identified and understood and the response correctly resolves user intent
90
90
result = intent_resolution_evaluator(
91
91
query = " What are the opening hours of the Eiffel Tower?" ,
92
92
response = " Opening hours of the Eiffel Tower are 9:00 AM to 11:00 PM." ,
93
93
)
94
94
print (result)
95
-
95
+
96
96
# A negative example. Only half of the statements in the response were complete according to the ground truth
97
- result = completeness_evaluator (
97
+ result = response_completeness_evaluator (
98
98
response = " Itinery: Day 1 take a train to visit Disneyland outside of the city; Day 2 rests in hotel." ,
99
99
ground_truth = " Itinery: Day 1 take a train to visit the downtown area for city sightseeing; Day 2 rests in hotel."
100
100
)
101
101
print (result)
102
+ ```
102
103
103
104
```
104
105
0 commit comments