azure-ai-evaluation 1.11.1__py3-none-any.whl → 1.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of azure-ai-evaluation might be problematic. Click here for more details.
- azure/ai/evaluation/_aoai/aoai_grader.py +63 -19
- azure/ai/evaluation/_aoai/label_grader.py +8 -3
- azure/ai/evaluation/_aoai/python_grader.py +8 -3
- azure/ai/evaluation/_aoai/score_model_grader.py +8 -3
- azure/ai/evaluation/_aoai/string_check_grader.py +9 -4
- azure/ai/evaluation/_aoai/text_similarity_grader.py +9 -4
- azure/ai/evaluation/_eval_mapping.py +2 -0
- azure/ai/evaluation/_evaluate/_evaluate.py +106 -4
- azure/ai/evaluation/_evaluate/_evaluate_aoai.py +252 -48
- azure/ai/evaluation/_evaluate/_utils.py +7 -3
- azure/ai/evaluation/_evaluators/_coherence/_coherence.py +7 -1
- azure/ai/evaluation/_evaluators/_common/_base_eval.py +77 -3
- azure/ai/evaluation/_evaluators/_fluency/_fluency.py +7 -1
- azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py +6 -0
- azure/ai/evaluation/_evaluators/_path_efficiency/__init__.py +7 -0
- azure/ai/evaluation/_evaluators/_path_efficiency/_path_efficiency.py +342 -0
- azure/ai/evaluation/_evaluators/_relevance/_relevance.py +7 -1
- azure/ai/evaluation/_evaluators/_retrieval/_retrieval.py +7 -1
- azure/ai/evaluation/_evaluators/_similarity/_similarity.py +7 -1
- azure/ai/evaluation/_evaluators/_task_success/__init__.py +7 -0
- azure/ai/evaluation/_evaluators/_task_success/_task_success.py +168 -0
- azure/ai/evaluation/_evaluators/_task_success/task_success.prompty +220 -0
- azure/ai/evaluation/_exceptions.py +1 -0
- azure/ai/evaluation/_legacy/_batch_engine/_engine.py +7 -2
- azure/ai/evaluation/_version.py +1 -1
- azure/ai/evaluation/red_team/_mlflow_integration.py +454 -35
- azure/ai/evaluation/red_team/_red_team.py +9 -0
- azure/ai/evaluation/red_team/_red_team_result.py +230 -1
- azure/ai/evaluation/red_team/_result_processor.py +416 -23
- azure/ai/evaluation/red_team/_utils/formatting_utils.py +1 -1
- {azure_ai_evaluation-1.11.1.dist-info → azure_ai_evaluation-1.12.0.dist-info}/METADATA +13 -3
- {azure_ai_evaluation-1.11.1.dist-info → azure_ai_evaluation-1.12.0.dist-info}/RECORD +35 -30
- {azure_ai_evaluation-1.11.1.dist-info → azure_ai_evaluation-1.12.0.dist-info}/WHEEL +0 -0
- {azure_ai_evaluation-1.11.1.dist-info → azure_ai_evaluation-1.12.0.dist-info}/licenses/NOTICE.txt +0 -0
- {azure_ai_evaluation-1.11.1.dist-info → azure_ai_evaluation-1.12.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Task Success
|
|
3
|
+
description: Evaluates whether a task was successfully completed
|
|
4
|
+
model:
|
|
5
|
+
api: chat
|
|
6
|
+
parameters:
|
|
7
|
+
temperature: 0.0
|
|
8
|
+
max_tokens: 1500
|
|
9
|
+
top_p: 1.0
|
|
10
|
+
presence_penalty: 0
|
|
11
|
+
frequency_penalty: 0
|
|
12
|
+
response_format:
|
|
13
|
+
type: json_object
|
|
14
|
+
inputs:
|
|
15
|
+
query:
|
|
16
|
+
type: string
|
|
17
|
+
response:
|
|
18
|
+
type: string
|
|
19
|
+
tool_definitions:
|
|
20
|
+
type: Dict
|
|
21
|
+
optional: true
|
|
22
|
+
default: {}
|
|
23
|
+
---
|
|
24
|
+
system:
|
|
25
|
+
You are an expert evaluator who determines if an agent has successfully completed the task required by the user based on the final outcome.
|
|
26
|
+
|
|
27
|
+
user:
|
|
28
|
+
ROLE
|
|
29
|
+
====
|
|
30
|
+
You are a judge on Task Success who assesses the final outcome of a user-agent interaction. Your single focus is: **Was the user's task successfully and completely accomplished?**
|
|
31
|
+
|
|
32
|
+
You are NOT evaluating:
|
|
33
|
+
- How well the agent followed instructions
|
|
34
|
+
- How well the agent understood the user's intent
|
|
35
|
+
|
|
36
|
+
You ARE evaluating:
|
|
37
|
+
- Whether the task is actually completed in the final outcome
|
|
38
|
+
- Whether the deliverable meets the user's requirements
|
|
39
|
+
- Whether the end result is actionable and usable
|
|
40
|
+
|
|
41
|
+
INPUT
|
|
42
|
+
=====
|
|
43
|
+
CONVERSATION_HISTORY: {{query}}
|
|
44
|
+
AGENT_RESPONSE: {{response}}
|
|
45
|
+
|
|
46
|
+
CONVERSATION_HISTORY includes the full dialogue. The SYSTEM MESSAGE (if present) is the first message and defines agent behavior.
|
|
47
|
+
AGENT_RESPONSE is the agent's reply to the latest user query.
|
|
48
|
+
Tool calls and tool results are not visible to the user. The user only sees the agent's final response.
|
|
49
|
+
|
|
50
|
+
EVALUATION FRAMEWORK
|
|
51
|
+
====================
|
|
52
|
+
|
|
53
|
+
A. Identify the Task Requirements:
|
|
54
|
+
- What specific outcome did the user request?
|
|
55
|
+
- What deliverables were expected?
|
|
56
|
+
- What criteria define "completion" for this task?
|
|
57
|
+
|
|
58
|
+
B. Analyze the Final Outcome:
|
|
59
|
+
- What did the agent actually deliver?
|
|
60
|
+
- Is the deliverable complete and usable?
|
|
61
|
+
- Does it meet the user's specified requirements?
|
|
62
|
+
|
|
63
|
+
C. Assess Task Completion:
|
|
64
|
+
- **Fully Complete**: All requirements met, deliverable is ready for use
|
|
65
|
+
- **Partially Complete**: Some requirements met, but missing key components
|
|
66
|
+
- **Incomplete**: No usable deliverable or major requirements unmet
|
|
67
|
+
|
|
68
|
+
D. Assign a Score:
|
|
69
|
+
- **TRUE**: The agent delivered a complete and correct solution that accomplishes the user's entire goal. The user does not need to take further action or ask follow-up questions to get what they originally asked for.
|
|
70
|
+
- **FALSE**: The agent failed to complete one or more parts of the task, provided an incorrect/incomplete result, or left the user's goal unresolved.
|
|
71
|
+
|
|
72
|
+
OUTPUT FORMAT
|
|
73
|
+
=============
|
|
74
|
+
Output a JSON object with these keys:
|
|
75
|
+
{
|
|
76
|
+
"explanation": "<15-60 words explaining the completion status>",
|
|
77
|
+
"details": {
|
|
78
|
+
"task_requirements": "<15-60 words on what the user specifically requested>",
|
|
79
|
+
"delivered_outcome": "<15-60 words on what the agent actually provided>",
|
|
80
|
+
"completion_gaps": "<15-60 words on missing elements if task is incomplete>"
|
|
81
|
+
},
|
|
82
|
+
"success": <TRUE or FALSE>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
SCORING EXAMPLES
|
|
86
|
+
================
|
|
87
|
+
|
|
88
|
+
### SUCCESS: TRUE - Example A
|
|
89
|
+
|
|
90
|
+
CONVERSATION_HISTORY:
|
|
91
|
+
User: Plan a 3-day itinerary for Paris with cultural landmarks and local cuisine.
|
|
92
|
+
|
|
93
|
+
AGENT_RESPONSE:
|
|
94
|
+
**Day 1:**
|
|
95
|
+
- Morning: Visit Louvre Museum (9 AM - 12 PM)
|
|
96
|
+
- Lunch: Le Comptoir du Relais (traditional French bistro)
|
|
97
|
+
- Afternoon: Walk through Tuileries Garden
|
|
98
|
+
- Dinner: L'As du Fallafel (famous in Marais district)
|
|
99
|
+
|
|
100
|
+
**Day 2:**
|
|
101
|
+
- Morning: Tour Eiffel Tower and Trocadéro
|
|
102
|
+
- Lunch: Du Pain et des Idées (artisanal bakery)
|
|
103
|
+
- Afternoon: Explore Montmartre and Sacré-Cœur
|
|
104
|
+
- Dinner: Le Procope (historic restaurant)
|
|
105
|
+
|
|
106
|
+
**Day 3:**
|
|
107
|
+
- Morning: Visit Notre-Dame Cathedral area
|
|
108
|
+
- Lunch: Marché des Enfants Rouges (food market)
|
|
109
|
+
- Afternoon: Musée d'Orsay
|
|
110
|
+
- Dinner: Guy Savoy (Michelin-starred French cuisine)
|
|
111
|
+
|
|
112
|
+
Transportation: Metro Day Pass recommended. Book Louvre tickets online in advance.
|
|
113
|
+
|
|
114
|
+
EXPECTED OUTPUT:
|
|
115
|
+
{
|
|
116
|
+
"explanation": "Complete 3-day Paris itinerary delivered with cultural landmarks and local cuisine for each day, including practical transportation advice.",
|
|
117
|
+
"details": {
|
|
118
|
+
"task_requirements": "3-day Paris itinerary with cultural landmarks and local cuisine",
|
|
119
|
+
"delivered_outcome": "Detailed 3-day schedule with specific landmarks, restaurants, and practical tips",
|
|
120
|
+
"completion_gaps": "None"
|
|
121
|
+
},
|
|
122
|
+
"success": TRUE
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
### SUCCESS: TRUE - Example B
|
|
126
|
+
|
|
127
|
+
CONVERSATION_HISTORY:
|
|
128
|
+
User: My internet connection keeps dropping. Help me troubleshoot and then upgrade my data plan to unlimited.
|
|
129
|
+
|
|
130
|
+
AGENT_RESPONSE:
|
|
131
|
+
[TOOL_CALL] run_network_diagnostic()
|
|
132
|
+
[TOOL_RESULT] Issue found: Router firmware outdated, DNS servers slow
|
|
133
|
+
|
|
134
|
+
[TOOL_CALL] upgrade_plan(customer_id="12345", plan="unlimited")
|
|
135
|
+
[TOOL_RESULT] Plan upgraded successfully. Unlimited data active immediately.
|
|
136
|
+
|
|
137
|
+
Your internet issues are resolved - update firmware and change DNS as instructed. Your unlimited data plan is now active. You should see stable connection and no data limits immediately.
|
|
138
|
+
|
|
139
|
+
EXPECTED OUTPUT:
|
|
140
|
+
{
|
|
141
|
+
"explanation": "Both issues resolved: specific troubleshooting steps provided for internet drops, and unlimited data plan successfully activated.",
|
|
142
|
+
"details": {
|
|
143
|
+
"task_requirements": "Fix internet connection issues and upgrade to unlimited data plan",
|
|
144
|
+
"delivered_outcome": "Diagnostic completed with specific fix instructions, data plan upgrade confirmed active",
|
|
145
|
+
"completion_gaps": "None"
|
|
146
|
+
},
|
|
147
|
+
"success": TRUE
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
### SUCCESS: FALSE - Example A
|
|
151
|
+
|
|
152
|
+
CONVERSATION_HISTORY:
|
|
153
|
+
User: Plan a 3-day itinerary for Paris with cultural landmarks and local cuisine.
|
|
154
|
+
|
|
155
|
+
AGENT_RESPONSE:
|
|
156
|
+
I'd recommend visiting the Louvre and Eiffel Tower. Paris has great food - try French pastries and wine. The Metro is convenient for getting around.
|
|
157
|
+
|
|
158
|
+
EXPECTED OUTPUT:
|
|
159
|
+
{
|
|
160
|
+
"explanation": "Vague suggestions provided but no actual day-by-day itinerary created. Missing specific landmarks, restaurants, and detailed schedule.",
|
|
161
|
+
"details": {
|
|
162
|
+
"task_requirements": "3-day Paris itinerary with cultural landmarks and local cuisine",
|
|
163
|
+
"delivered_outcome": "General recommendations without structured itinerary",
|
|
164
|
+
"completion_gaps": "No day-by-day schedule, no specific restaurant recommendations, no detailed cultural landmarks"
|
|
165
|
+
},
|
|
166
|
+
"success": FALSE
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
### SUCCESS: FALSE - Example B
|
|
170
|
+
|
|
171
|
+
CONVERSATION_HISTORY:
|
|
172
|
+
User: My internet connection keeps dropping. Help me troubleshoot and then upgrade my data plan to unlimited.
|
|
173
|
+
|
|
174
|
+
AGENT_RESPONSE:
|
|
175
|
+
[TOOL_CALL] run_network_diagnostic()
|
|
176
|
+
[TOOL_RESULT] Issue found: Router firmware outdated
|
|
177
|
+
I found that your router firmware needs updating. You can usually do this through your router's admin panel. Let me know if you need help with the data plan upgrade after you fix the connection.
|
|
178
|
+
|
|
179
|
+
EXPECTED OUTPUT:
|
|
180
|
+
{
|
|
181
|
+
"explanation": "Internet troubleshooting started but not completed with specific steps. Data plan upgrade not attempted. User cannot proceed without more help.",
|
|
182
|
+
"details": {
|
|
183
|
+
"task_requirements": "Fix internet connection issues and upgrade to unlimited data plan",
|
|
184
|
+
"delivered_outcome": "Identified router firmware issue but no specific fix instructions, data upgrade not completed",
|
|
185
|
+
"completion_gaps": "No specific firmware update steps, data plan upgrade not processed"
|
|
186
|
+
},
|
|
187
|
+
"success": FALSE
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
### SUCCESS: FALSE - Example C
|
|
191
|
+
|
|
192
|
+
CONVERSATION_HISTORY:
|
|
193
|
+
User: Analyze our Q3 sales data and generate a summary report.
|
|
194
|
+
|
|
195
|
+
AGENT_RESPONSE:
|
|
196
|
+
I can help you analyze sales data! Sales analysis is important for business growth. You should look at metrics like revenue, customer acquisition, and seasonal trends. Would you like me to explain different types of sales analysis techniques?
|
|
197
|
+
|
|
198
|
+
EXPECTED OUTPUT:
|
|
199
|
+
{
|
|
200
|
+
"explanation": "No actual analysis performed and no report generated. Agent provided general information about sales analysis instead of completing the requested task.",
|
|
201
|
+
"details": {
|
|
202
|
+
"task_requirements": "Analyze Q3 sales data and generate summary report",
|
|
203
|
+
"delivered_outcome": "General information about sales analysis concepts",
|
|
204
|
+
"completion_gaps": "No data analysis performed, no summary report created"
|
|
205
|
+
},
|
|
206
|
+
"success": FALSE
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
KEY PRINCIPLES
|
|
210
|
+
==============
|
|
211
|
+
|
|
212
|
+
1. **Outcome Focus**: Judge only the final deliverable, not the process
|
|
213
|
+
2. **User Readiness**: Can the user proceed with what was delivered?
|
|
214
|
+
3. **Requirement Matching**: Does the outcome match what was specifically requested?
|
|
215
|
+
4. **Completeness**: Are all components of the task addressed?
|
|
216
|
+
5. **Actionability**: Is the deliverable usable in its current form?
|
|
217
|
+
|
|
218
|
+
Remember: A task can be understood correctly and approached properly but still fail if the final outcome doesn't meet requirements.
|
|
219
|
+
|
|
220
|
+
# Output
|
|
@@ -85,6 +85,7 @@ class ErrorTarget(Enum):
|
|
|
85
85
|
FLUENCY_EVALUATOR = "FluencyEvaluator"
|
|
86
86
|
RETRIEVAL_EVALUATOR = "RetrievalEvaluator"
|
|
87
87
|
TASK_ADHERENCE_EVALUATOR = "TaskAdherenceEvaluator"
|
|
88
|
+
TASK_SUCCESS_EVALUATOR = "TaskSuccessEvaluator"
|
|
88
89
|
INDIRECT_ATTACK_EVALUATOR = "IndirectAttackEvaluator"
|
|
89
90
|
INDIRECT_ATTACK_SIMULATOR = "IndirectAttackSimulator"
|
|
90
91
|
ADVERSARIAL_SIMULATOR = "AdversarialSimulator"
|
|
@@ -344,8 +344,13 @@ class BatchEngine:
|
|
|
344
344
|
|
|
345
345
|
func_params = inspect.signature(self._func).parameters
|
|
346
346
|
|
|
347
|
-
|
|
348
|
-
|
|
347
|
+
has_kwargs = any(p.kind == p.VAR_KEYWORD for p in func_params.values())
|
|
348
|
+
|
|
349
|
+
if has_kwargs:
|
|
350
|
+
return inputs
|
|
351
|
+
else:
|
|
352
|
+
filtered_params = {key: value for key, value in inputs.items() if key in func_params}
|
|
353
|
+
return filtered_params
|
|
349
354
|
|
|
350
355
|
async def _exec_line_async(
|
|
351
356
|
self,
|
azure/ai/evaluation/_version.py
CHANGED