azure-ai-evaluation 1.11.0__py3-none-any.whl → 1.11.2__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/_common/utils.py +68 -0
- azure/ai/evaluation/_evaluate/_evaluate_aoai.py +27 -2
- azure/ai/evaluation/_evaluators/_common/_base_eval.py +13 -3
- azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py +86 -33
- azure/ai/evaluation/_evaluators/_groundedness/groundedness_with_query.prompty +30 -29
- azure/ai/evaluation/_legacy/_batch_engine/_engine.py +7 -2
- azure/ai/evaluation/_version.py +1 -1
- {azure_ai_evaluation-1.11.0.dist-info → azure_ai_evaluation-1.11.2.dist-info}/METADATA +14 -2
- {azure_ai_evaluation-1.11.0.dist-info → azure_ai_evaluation-1.11.2.dist-info}/RECORD +12 -12
- {azure_ai_evaluation-1.11.0.dist-info → azure_ai_evaluation-1.11.2.dist-info}/WHEEL +0 -0
- {azure_ai_evaluation-1.11.0.dist-info → azure_ai_evaluation-1.11.2.dist-info}/licenses/NOTICE.txt +0 -0
- {azure_ai_evaluation-1.11.0.dist-info → azure_ai_evaluation-1.11.2.dist-info}/top_level.txt +0 -0
|
@@ -659,6 +659,74 @@ def reformat_tool_definitions(tool_definitions, logger=None):
|
|
|
659
659
|
return tool_definitions
|
|
660
660
|
|
|
661
661
|
|
|
662
|
+
def simplify_messages(messages, drop_system=True, drop_tool_calls=False, logger=None):
|
|
663
|
+
"""
|
|
664
|
+
Simplify a list of conversation messages by keeping only role and content.
|
|
665
|
+
Optionally filter out system messages and/or tool calls.
|
|
666
|
+
|
|
667
|
+
:param messages: List of message dicts (e.g., from query or response)
|
|
668
|
+
:param drop_system: If True, remove system role messages
|
|
669
|
+
:param drop_tool_calls: If True, remove tool_call items from assistant content
|
|
670
|
+
:return: New simplified list of messages
|
|
671
|
+
"""
|
|
672
|
+
if isinstance(messages, str):
|
|
673
|
+
return messages
|
|
674
|
+
try:
|
|
675
|
+
# Validate input is a list
|
|
676
|
+
if not isinstance(messages, list):
|
|
677
|
+
return messages
|
|
678
|
+
|
|
679
|
+
simplified_msgs = []
|
|
680
|
+
for msg in messages:
|
|
681
|
+
# Ensure msg is a dict
|
|
682
|
+
if not isinstance(msg, dict):
|
|
683
|
+
simplified_msgs.append(msg)
|
|
684
|
+
continue
|
|
685
|
+
|
|
686
|
+
role = msg.get("role")
|
|
687
|
+
content = msg.get("content", [])
|
|
688
|
+
|
|
689
|
+
# Drop system message (if should)
|
|
690
|
+
if drop_system and role == "system":
|
|
691
|
+
continue
|
|
692
|
+
|
|
693
|
+
# Simplify user messages
|
|
694
|
+
if role == "user":
|
|
695
|
+
simplified_msg = {
|
|
696
|
+
"role": role,
|
|
697
|
+
"content": _extract_text_from_content(content),
|
|
698
|
+
}
|
|
699
|
+
simplified_msgs.append(simplified_msg)
|
|
700
|
+
continue
|
|
701
|
+
|
|
702
|
+
# Drop tool results (if should)
|
|
703
|
+
if drop_tool_calls and role == "tool":
|
|
704
|
+
continue
|
|
705
|
+
|
|
706
|
+
# Simplify assistant messages
|
|
707
|
+
if role == "assistant":
|
|
708
|
+
simplified_content = _extract_text_from_content(content)
|
|
709
|
+
# Check if message has content
|
|
710
|
+
if simplified_content:
|
|
711
|
+
simplified_msg = {"role": role, "content": simplified_content}
|
|
712
|
+
simplified_msgs.append(simplified_msg)
|
|
713
|
+
continue
|
|
714
|
+
|
|
715
|
+
# Drop tool calls (if should)
|
|
716
|
+
if drop_tool_calls and any(c.get("type") == "tool_call" for c in content if isinstance(c, dict)):
|
|
717
|
+
continue
|
|
718
|
+
|
|
719
|
+
# If we reach here, it means we want to keep the message
|
|
720
|
+
simplified_msgs.append(msg)
|
|
721
|
+
|
|
722
|
+
return simplified_msgs
|
|
723
|
+
|
|
724
|
+
except Exception as ex:
|
|
725
|
+
if logger:
|
|
726
|
+
logger.debug(f"Error simplifying messages: {str(ex)}. Returning original messages.")
|
|
727
|
+
return messages
|
|
728
|
+
|
|
729
|
+
|
|
662
730
|
def upload(path: str, container_client: ContainerClient, logger=None):
|
|
663
731
|
"""Upload files or directories to Azure Blob Storage using a container client.
|
|
664
732
|
|
|
@@ -272,8 +272,33 @@ def _get_single_run_results(
|
|
|
272
272
|
for row_result in all_results:
|
|
273
273
|
listed_results["index"].append(row_result.datasource_item_id)
|
|
274
274
|
for single_grader_row_result in row_result.results:
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
if isinstance(single_grader_row_result, dict):
|
|
276
|
+
result_dict = single_grader_row_result
|
|
277
|
+
elif hasattr(single_grader_row_result, "model_dump"):
|
|
278
|
+
result_dict = single_grader_row_result.model_dump()
|
|
279
|
+
elif hasattr(single_grader_row_result, "dict"):
|
|
280
|
+
result_dict = single_grader_row_result.dict()
|
|
281
|
+
elif hasattr(single_grader_row_result, "__dict__"):
|
|
282
|
+
result_dict = vars(single_grader_row_result)
|
|
283
|
+
else:
|
|
284
|
+
raise EvaluationException(
|
|
285
|
+
message=("Unsupported AOAI evaluation result type: " f"{type(single_grader_row_result)!r}."),
|
|
286
|
+
blame=ErrorBlame.UNKNOWN,
|
|
287
|
+
category=ErrorCategory.FAILED_EXECUTION,
|
|
288
|
+
target=ErrorTarget.AOAI_GRADER,
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
grader_result_name = result_dict.get("name", None)
|
|
292
|
+
if grader_result_name is None:
|
|
293
|
+
raise EvaluationException(
|
|
294
|
+
message="AOAI evaluation response missing grader result name; unable to map to original grader.",
|
|
295
|
+
blame=ErrorBlame.UNKNOWN,
|
|
296
|
+
category=ErrorCategory.FAILED_EXECUTION,
|
|
297
|
+
target=ErrorTarget.AOAI_GRADER,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
grader_name = run_info["grader_name_map"][grader_result_name]
|
|
301
|
+
for name, value in result_dict.items():
|
|
277
302
|
if name in ["name"]:
|
|
278
303
|
continue
|
|
279
304
|
if name.lower() == "passed":
|
|
@@ -37,6 +37,8 @@ from azure.ai.evaluation._common._experimental import experimental
|
|
|
37
37
|
|
|
38
38
|
from ._conversation_aggregators import GetAggregator, GetAggregatorType
|
|
39
39
|
|
|
40
|
+
import copy
|
|
41
|
+
|
|
40
42
|
P = ParamSpec("P")
|
|
41
43
|
T = TypeVar("T")
|
|
42
44
|
T_EvalValue = TypeVar("T_EvalValue")
|
|
@@ -486,8 +488,12 @@ class EvaluatorBase(ABC, Generic[T_EvalValue]):
|
|
|
486
488
|
"""
|
|
487
489
|
tool_calls = []
|
|
488
490
|
tool_results_map = {}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
+
|
|
492
|
+
# Work on a deep copy to avoid modifying the original object
|
|
493
|
+
response_copy = copy.deepcopy(response)
|
|
494
|
+
|
|
495
|
+
if isinstance(response_copy, list):
|
|
496
|
+
for message in response_copy:
|
|
491
497
|
# Extract tool calls from assistant messages
|
|
492
498
|
if message.get("role") == "assistant" and isinstance(message.get("content"), list):
|
|
493
499
|
for content_item in message.get("content"):
|
|
@@ -519,7 +525,11 @@ class EvaluatorBase(ABC, Generic[T_EvalValue]):
|
|
|
519
525
|
:rtype: Union[DoEvalResult[T_EvalValue], AggregateResult[T_EvalValue]]
|
|
520
526
|
"""
|
|
521
527
|
# Convert inputs into list of evaluable inputs.
|
|
522
|
-
|
|
528
|
+
try:
|
|
529
|
+
eval_input_list = self._convert_kwargs_to_eval_input(**kwargs)
|
|
530
|
+
except Exception as e:
|
|
531
|
+
print(f"Error converting kwargs to eval_input_list: {e}")
|
|
532
|
+
raise e
|
|
523
533
|
per_turn_results = []
|
|
524
534
|
# Evaluate all inputs.
|
|
525
535
|
for eval_input in eval_input_list:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
# ---------------------------------------------------------
|
|
4
4
|
import os, logging
|
|
5
|
-
from typing import Dict, List, Optional, Union
|
|
5
|
+
from typing import Dict, List, Optional, Union, Any, Tuple
|
|
6
6
|
|
|
7
7
|
from typing_extensions import overload, override
|
|
8
8
|
from azure.ai.evaluation._legacy._adapters._flows import AsyncPrompty
|
|
@@ -16,6 +16,7 @@ from ..._common.utils import (
|
|
|
16
16
|
ErrorCategory,
|
|
17
17
|
construct_prompty_model_config,
|
|
18
18
|
validate_model_config,
|
|
19
|
+
simplify_messages,
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
try:
|
|
@@ -207,6 +208,42 @@ class GroundednessEvaluator(PromptyEvaluatorBase[Union[str, float]]):
|
|
|
207
208
|
|
|
208
209
|
return super().__call__(*args, **kwargs)
|
|
209
210
|
|
|
211
|
+
def _has_context(self, eval_input: dict) -> bool:
|
|
212
|
+
"""
|
|
213
|
+
Return True if eval_input contains a non-empty 'context' field.
|
|
214
|
+
Treats None, empty strings, empty lists, and lists of empty strings as no context.
|
|
215
|
+
"""
|
|
216
|
+
context = eval_input.get("context", None)
|
|
217
|
+
if not context:
|
|
218
|
+
return False
|
|
219
|
+
if context == "<>": # Special marker for no context
|
|
220
|
+
return False
|
|
221
|
+
if isinstance(context, list):
|
|
222
|
+
return any(str(c).strip() for c in context)
|
|
223
|
+
if isinstance(context, str):
|
|
224
|
+
return bool(context.strip())
|
|
225
|
+
return True
|
|
226
|
+
|
|
227
|
+
@override
|
|
228
|
+
async def _do_eval(self, eval_input: Dict) -> Dict[str, Union[float, str]]:
|
|
229
|
+
if "query" not in eval_input:
|
|
230
|
+
return await super()._do_eval(eval_input)
|
|
231
|
+
|
|
232
|
+
contains_context = self._has_context(eval_input)
|
|
233
|
+
|
|
234
|
+
simplified_query = simplify_messages(eval_input["query"], drop_tool_calls=contains_context)
|
|
235
|
+
simplified_response = simplify_messages(eval_input["response"], drop_tool_calls=False)
|
|
236
|
+
|
|
237
|
+
# Build simplified input
|
|
238
|
+
simplified_eval_input = {
|
|
239
|
+
"query": simplified_query,
|
|
240
|
+
"response": simplified_response,
|
|
241
|
+
"context": eval_input["context"],
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
# Replace and call the parent method
|
|
245
|
+
return await super()._do_eval(simplified_eval_input)
|
|
246
|
+
|
|
210
247
|
async def _real_call(self, **kwargs):
|
|
211
248
|
"""The asynchronous call where real end-to-end evaluation logic is performed.
|
|
212
249
|
|
|
@@ -230,57 +267,73 @@ class GroundednessEvaluator(PromptyEvaluatorBase[Union[str, float]]):
|
|
|
230
267
|
raise ex
|
|
231
268
|
|
|
232
269
|
def _convert_kwargs_to_eval_input(self, **kwargs):
|
|
233
|
-
if "context"
|
|
270
|
+
if kwargs.get("context") or kwargs.get("conversation"):
|
|
234
271
|
return super()._convert_kwargs_to_eval_input(**kwargs)
|
|
235
|
-
|
|
236
272
|
query = kwargs.get("query")
|
|
237
273
|
response = kwargs.get("response")
|
|
238
274
|
tool_definitions = kwargs.get("tool_definitions")
|
|
239
275
|
|
|
240
|
-
if not query or not response or not tool_definitions:
|
|
241
|
-
msg = f"{type(self).__name__}: Either 'conversation' or individual inputs must be provided. For Agent groundedness 'query'
|
|
276
|
+
if (not query) or (not response): # or not tool_definitions:
|
|
277
|
+
msg = f"{type(self).__name__}: Either 'conversation' or individual inputs must be provided. For Agent groundedness 'query' and 'response' are required."
|
|
242
278
|
raise EvaluationException(
|
|
243
279
|
message=msg,
|
|
244
280
|
blame=ErrorBlame.USER_ERROR,
|
|
245
281
|
category=ErrorCategory.INVALID_VALUE,
|
|
246
282
|
target=ErrorTarget.GROUNDEDNESS_EVALUATOR,
|
|
247
283
|
)
|
|
248
|
-
|
|
249
284
|
context = self._get_context_from_agent_response(response, tool_definitions)
|
|
250
|
-
if not context:
|
|
251
|
-
raise EvaluationException(
|
|
252
|
-
message=f"Context could not be extracted from agent response. Supported tools for groundedness are {self._SUPPORTED_TOOLS}. If supported tools are not used groundedness is not calculated.",
|
|
253
|
-
blame=ErrorBlame.USER_ERROR,
|
|
254
|
-
category=ErrorCategory.NOT_APPLICABLE,
|
|
255
|
-
target=ErrorTarget.GROUNDEDNESS_EVALUATOR,
|
|
256
|
-
)
|
|
257
285
|
|
|
258
|
-
|
|
286
|
+
filtered_response = self._filter_file_search_results(response)
|
|
287
|
+
return super()._convert_kwargs_to_eval_input(response=filtered_response, context=context, query=query)
|
|
288
|
+
|
|
289
|
+
def _filter_file_search_results(self, messages: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
290
|
+
"""Filter out file_search tool results from the messages."""
|
|
291
|
+
file_search_ids = self._get_file_search_tool_call_ids(messages)
|
|
292
|
+
return [
|
|
293
|
+
msg for msg in messages if not (msg.get("role") == "tool" and msg.get("tool_call_id") in file_search_ids)
|
|
294
|
+
]
|
|
259
295
|
|
|
260
296
|
def _get_context_from_agent_response(self, response, tool_definitions):
|
|
297
|
+
"""Extract context text from file_search tool results in the agent response."""
|
|
298
|
+
NO_CONTEXT = "<>"
|
|
261
299
|
context = ""
|
|
262
300
|
try:
|
|
263
301
|
logger.debug("Extracting context from response")
|
|
264
302
|
tool_calls = self._parse_tools_from_response(response=response)
|
|
265
|
-
logger.debug(f"Tool Calls parsed successfully
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
303
|
+
logger.debug(f"Tool Calls parsed successfully: {tool_calls}")
|
|
304
|
+
|
|
305
|
+
if not tool_calls:
|
|
306
|
+
return NO_CONTEXT
|
|
307
|
+
|
|
308
|
+
context_lines = []
|
|
309
|
+
for tool_call in tool_calls:
|
|
310
|
+
if not isinstance(tool_call, dict) or tool_call.get("type") != "tool_call":
|
|
311
|
+
continue
|
|
312
|
+
|
|
313
|
+
tool_name = tool_call.get("name")
|
|
314
|
+
if tool_name != "file_search":
|
|
315
|
+
continue
|
|
316
|
+
|
|
317
|
+
# Extract tool results
|
|
318
|
+
for result in tool_call.get("tool_result", []):
|
|
319
|
+
results = result if isinstance(result, list) else [result]
|
|
320
|
+
for r in results:
|
|
321
|
+
file_name = r.get("file_name", "Unknown file name")
|
|
322
|
+
for content in r.get("content", []):
|
|
323
|
+
text = content.get("text")
|
|
324
|
+
if text:
|
|
325
|
+
context_lines.append(f"{file_name}:\n- {text}---\n\n")
|
|
326
|
+
|
|
327
|
+
context = "\n".join(context_lines) if len(context_lines) > 0 else None
|
|
328
|
+
|
|
282
329
|
except Exception as ex:
|
|
283
330
|
logger.debug(f"Error extracting context from agent response : {str(ex)}")
|
|
284
|
-
context =
|
|
331
|
+
context = None
|
|
332
|
+
|
|
333
|
+
context = context if context else NO_CONTEXT
|
|
334
|
+
return context
|
|
285
335
|
|
|
286
|
-
|
|
336
|
+
def _get_file_search_tool_call_ids(self, query_or_response):
|
|
337
|
+
"""Return a list of tool_call_ids for file search tool calls."""
|
|
338
|
+
tool_calls = self._parse_tools_from_response(query_or_response)
|
|
339
|
+
return [tc.get("tool_call_id") for tc in tool_calls if tc.get("name") == "file_search"]
|
|
@@ -32,52 +32,53 @@ system:
|
|
|
32
32
|
|
|
33
33
|
user:
|
|
34
34
|
# Definition
|
|
35
|
-
**Groundedness** refers to how well an answer is anchored in the provided context, evaluating its relevance, accuracy, and completeness based exclusively on that context. It assesses the extent to which the answer directly and fully addresses the question without introducing unrelated or incorrect information.
|
|
35
|
+
**Groundedness** refers to how well an answer is anchored in the provided context, evaluating its relevance, accuracy, and completeness based exclusively on that context. It assesses the extent to which the answer directly and fully addresses the question without introducing unrelated or incorrect information.
|
|
36
|
+
|
|
37
|
+
> Context is the source of truth for evaluating the response. If it's empty, rely on the tool results in the response and query.
|
|
38
|
+
> Evaluate the groundedness of the response message, not the chat history.
|
|
36
39
|
|
|
37
40
|
# Ratings
|
|
38
41
|
## [Groundedness: 1] (Completely Unrelated Response)
|
|
39
|
-
**Definition:** An answer that does not relate to the question or the context in any way.
|
|
42
|
+
**Definition:** An answer that does not relate to the question or the context in any way.
|
|
43
|
+
- Does not relate to the question or context at all.
|
|
44
|
+
- Talks about the general topic but does not respond to the query.
|
|
40
45
|
|
|
41
46
|
**Examples:**
|
|
42
47
|
**Context:** The company's annual meeting will be held next Thursday.
|
|
43
48
|
**Query:** When is the company's annual meeting?
|
|
44
49
|
**Response:** I enjoy hiking in the mountains during summer.
|
|
45
50
|
|
|
46
|
-
**Context:** The new policy aims to reduce carbon emissions by 20% over the next five years.
|
|
47
|
-
**Query:** What is the goal of the new policy?
|
|
48
|
-
**Response:** My favorite color is blue.
|
|
49
|
-
|
|
50
|
-
## [Groundedness: 2] (Related Topic but Does Not Respond to the Query)
|
|
51
|
-
**Definition:** An answer that relates to the general topic of the context but does not answer the specific question asked. It may mention concepts from the context but fails to provide a direct or relevant response.
|
|
52
|
-
|
|
53
|
-
**Examples:**
|
|
54
51
|
**Context:** The museum will exhibit modern art pieces from various local artists.
|
|
55
52
|
**Query:** What kind of art will be exhibited at the museum?
|
|
56
53
|
**Response:** Museums are important cultural institutions.
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
**Response:** Software updates can sometimes fix bugs.
|
|
61
|
-
|
|
62
|
-
## [Groundedness: 3] (Attempts to Respond but Contains Incorrect Information)
|
|
63
|
-
**Definition:** An answer that attempts to respond to the question but includes incorrect information not supported by the context. It may misstate facts, misinterpret the context, or provide erroneous details.
|
|
55
|
+
## [Groundedness: 2] (Attempts to Respond but Contains Incorrect Information)
|
|
56
|
+
**Definition:** An answer that attempts to respond to the question but includes incorrect information not supported by the context. It may misstate facts, misinterpret the context, or provide erroneous details. Even if some points are correct, the presence of inaccuracies makes the response unreliable.
|
|
64
57
|
|
|
65
58
|
**Examples:**
|
|
66
|
-
**Context:** The festival starts on June 5th and features international musicians.
|
|
59
|
+
**Context:** - The festival starts on June 5th and features international musicians.
|
|
67
60
|
**Query:** When does the festival start?
|
|
68
61
|
**Response:** The festival starts on July 5th and features local artists.
|
|
69
62
|
|
|
70
|
-
**Context:**
|
|
71
|
-
**Query:**
|
|
72
|
-
**Response:**
|
|
63
|
+
**Context:** bakery_menu.txt: - Croissant au Beurre — flaky, buttery croissant
|
|
64
|
+
**Query:** [{"role":"user","content":"Are there croissants?"}]
|
|
65
|
+
**Response:** [{"role":"assistant","content":"Yes, Croissant au Beurre is on the menu, served with jam."}]
|
|
66
|
+
|
|
67
|
+
## [Groundedness: 3] (Nothing to be Grounded)
|
|
68
|
+
Definition: An answer that does not provide any information that can be evaluated against the context. This includes responses that are asking for clarification, providing polite fillers, or follow-up questions.
|
|
69
|
+
|
|
70
|
+
**Examples:**
|
|
71
|
+
**Context:**
|
|
72
|
+
**Query:** [{"role":"user","content":"How many eggs are needed for the recipe?"}, {"role":"tool","content":"tool_result": [{"file_name": "recipe.txt", "content": "The recipe requires two eggs and one cup of milk."}]}, {"role":"assistant","content":"You need three eggs for the recipe."}, {"role":"user","content":"Thank you."}]
|
|
73
|
+
**Response:** [{"role":"assistant","content":"You're welcome, anything else I can help with?"}]
|
|
73
74
|
|
|
74
75
|
## [Groundedness: 4] (Partially Correct Response)
|
|
75
76
|
**Definition:** An answer that provides a correct response to the question but is incomplete or lacks specific details mentioned in the context. It captures some of the necessary information but omits key elements needed for a full understanding.
|
|
76
77
|
|
|
77
78
|
**Examples:**
|
|
78
|
-
**Context:** The bookstore offers a 15% discount to students and a 10% discount to senior citizens.
|
|
79
|
-
**Query:** What discount does the bookstore offer to students?
|
|
80
|
-
**Response:**
|
|
79
|
+
**Context:** - store_details.txt: The bookstore offers a 15% discount to students and a 10% discount to senior citizens.
|
|
80
|
+
**Query:** [{"role":"user","content":"What discount does the bookstore offer to students, if any?"}]
|
|
81
|
+
**Response:** [{"role":"assistant","content":"Yes, students get a discount at the bookstore."}]
|
|
81
82
|
|
|
82
83
|
**Context:** The company's headquarters are located in Berlin, Germany.
|
|
83
84
|
**Query:** Where are the company's headquarters?
|
|
@@ -87,13 +88,13 @@ user:
|
|
|
87
88
|
**Definition:** An answer that thoroughly and accurately responds to the question, including all relevant details from the context. It directly addresses the question with precise information, demonstrating complete understanding without adding extraneous information.
|
|
88
89
|
|
|
89
90
|
**Examples:**
|
|
90
|
-
**
|
|
91
|
-
**
|
|
92
|
-
**
|
|
91
|
+
**CONTEXT:** The author released her latest novel, 'The Silent Echo', on September 1st.
|
|
92
|
+
**QUERY:** [{"role":"user","content":"When was 'The Silent Echo' released?"}]
|
|
93
|
+
**RESPONSE:** [{"role":"assistant","content":"The 'Silent Echo' was released on September 1st."}]
|
|
93
94
|
|
|
94
|
-
**Context:**
|
|
95
|
+
**Context:**
|
|
95
96
|
**Query:** By what date must participants register to receive early bird pricing?
|
|
96
|
-
**Response:** Participants must register by May 31st to receive early bird pricing.
|
|
97
|
+
**Response:** [{"role":"tool","content":"tool_result": [{"file_name": "store_guidelines.txt", "content": "Participants registering before and including May 31st will be eligible for early bird pricing."}]}, {"role":"assistant","content":"Participants must register by May 31st to receive early bird pricing."}]
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
# Data
|
|
@@ -103,7 +104,7 @@ RESPONSE: {{response}}
|
|
|
103
104
|
|
|
104
105
|
|
|
105
106
|
# Tasks
|
|
106
|
-
## Please provide your assessment Score for the previous RESPONSE in relation to the CONTEXT and
|
|
107
|
+
## Please provide your assessment Score for the previous RESPONSE message in relation to the CONTEXT, QUERY and RESPONSE tools based on the Definitions above. Your output should include the following information:
|
|
107
108
|
- **ThoughtChain**: To improve the reasoning process, think step by step and include a step-by-step explanation of your thought process as you analyze the data based on the definitions. Keep it brief and start your ThoughtChain with "Let's think step by step:".
|
|
108
109
|
- **Explanation**: a very short explanation of why you think the input Data should get that Score.
|
|
109
110
|
- **Score**: based on your previous analysis, provide your Score. The Score you give MUST be a integer score (i.e., "1", "2"...) based on the levels of the definitions.
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: azure-ai-evaluation
|
|
3
|
-
Version: 1.11.
|
|
3
|
+
Version: 1.11.2
|
|
4
4
|
Summary: Microsoft Azure Evaluation Library for Python
|
|
5
5
|
Home-page: https://github.com/Azure/azure-sdk-for-python
|
|
6
6
|
Author: Microsoft Corporation
|
|
@@ -28,13 +28,14 @@ Requires-Dist: nltk>=3.9.1
|
|
|
28
28
|
Requires-Dist: azure-storage-blob>=12.10.0
|
|
29
29
|
Requires-Dist: httpx>=0.25.1
|
|
30
30
|
Requires-Dist: pandas<3.0.0,>=2.1.2
|
|
31
|
-
Requires-Dist: openai>=1.
|
|
31
|
+
Requires-Dist: openai>=1.108.0
|
|
32
32
|
Requires-Dist: ruamel.yaml<1.0.0,>=0.17.10
|
|
33
33
|
Requires-Dist: msrest>=0.6.21
|
|
34
34
|
Requires-Dist: Jinja2>=3.1.6
|
|
35
35
|
Requires-Dist: aiohttp>=3.0
|
|
36
36
|
Provides-Extra: redteam
|
|
37
37
|
Requires-Dist: pyrit==0.8.1; extra == "redteam"
|
|
38
|
+
Requires-Dist: duckdb==1.3.2; extra == "redteam"
|
|
38
39
|
Dynamic: author
|
|
39
40
|
Dynamic: author-email
|
|
40
41
|
Dynamic: classifier
|
|
@@ -412,6 +413,17 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
|
|
|
412
413
|
|
|
413
414
|
# Release History
|
|
414
415
|
|
|
416
|
+
## 1.11.2 (2025-10-09)
|
|
417
|
+
|
|
418
|
+
### Bugs Fixed
|
|
419
|
+
|
|
420
|
+
- **kwargs in an evaluator signature receives input columns that are not otherwise named in the evaluator's signature
|
|
421
|
+
|
|
422
|
+
## 1.11.1 (2025-09-17)
|
|
423
|
+
|
|
424
|
+
### Bugs Fixed
|
|
425
|
+
- Pinning duckdb version to 1.3.2 for redteam extra to fix error `TypeError: unhashable type: '_duckdb.typing.DuckDBPyType'`
|
|
426
|
+
|
|
415
427
|
## 1.11.0 (2025-09-02)
|
|
416
428
|
|
|
417
429
|
### Features Added
|
|
@@ -5,7 +5,7 @@ azure/ai/evaluation/_exceptions.py,sha256=XTKiPpQlsT67Bj6WgL_ZkVOtHs1Pfvtb_T8W57
|
|
|
5
5
|
azure/ai/evaluation/_http_utils.py,sha256=d1McnMRT5lnaoR8x4r3pkfH2ic4T3JArclOK4kAaUmg,17261
|
|
6
6
|
azure/ai/evaluation/_model_configurations.py,sha256=MNN6cQlz7P9vNfHmfEKsUcly3j1FEOEFsA8WV7GPuKQ,4043
|
|
7
7
|
azure/ai/evaluation/_user_agent.py,sha256=SgUm6acnwyoENu8KroyaWRrJroJNqLZBccpQoeKyrHw,1144
|
|
8
|
-
azure/ai/evaluation/_version.py,sha256=
|
|
8
|
+
azure/ai/evaluation/_version.py,sha256=DqtIZmz08HGGbHEfU-owp0u6ZIhGgAZ6qpdATfHzxVs,230
|
|
9
9
|
azure/ai/evaluation/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
azure/ai/evaluation/_aoai/__init__.py,sha256=0Ji05ShlsJaytvexXUpCe69t0jSNd3PpNbhr0zCkr6A,265
|
|
11
11
|
azure/ai/evaluation/_aoai/aoai_grader.py,sha256=8mp_dwMK-MdKkoiTud9ra6ExKyYV1SAPXr1m46j4lm4,4434
|
|
@@ -25,7 +25,7 @@ azure/ai/evaluation/_common/constants.py,sha256=lkdGK6xrMhVogqBudU4B8-6Ko2aSxKl3
|
|
|
25
25
|
azure/ai/evaluation/_common/evaluation_onedp_client.py,sha256=3HMiG37Cl46q9-kE6zxIEoQbgK96YelX1AFWldfk7Ok,7485
|
|
26
26
|
azure/ai/evaluation/_common/math.py,sha256=d4bwWe35_RWDIZNcbV1BTBbHNx2QHQ4-I3EofDyyNE0,2863
|
|
27
27
|
azure/ai/evaluation/_common/rai_service.py,sha256=jyBLRWpaQY2qGumP3JyTrRb3bAIqu5d6CPRtMYaJi5w,35491
|
|
28
|
-
azure/ai/evaluation/_common/utils.py,sha256=
|
|
28
|
+
azure/ai/evaluation/_common/utils.py,sha256=GKcGHHCoR3wwDP9fWkq6TiZ5AGOdY3YCerv9DqM7j_c,32544
|
|
29
29
|
azure/ai/evaluation/_common/onedp/__init__.py,sha256=C7Ddtjy__BxKkRCydRS7BhtQnM7TFZo179UUVC5krVY,1026
|
|
30
30
|
azure/ai/evaluation/_common/onedp/_client.py,sha256=cE37dQkl6aFfPZD-jyDa1QKUYKe5UQuC3SJX6XndFFY,6667
|
|
31
31
|
azure/ai/evaluation/_common/onedp/_configuration.py,sha256=F_KmJnzEgtmPTZViFS2nTMtKYHxi_YOn81BDx24L3gI,3629
|
|
@@ -99,7 +99,7 @@ azure/ai/evaluation/_converters/_sk_services.py,sha256=NfjflVgeJUF0MrvAiUd_uF2ma
|
|
|
99
99
|
azure/ai/evaluation/_evaluate/__init__.py,sha256=Yx1Iq2GNKQ5lYxTotvPwkPL4u0cm6YVxUe-iVbu1clI,180
|
|
100
100
|
azure/ai/evaluation/_evaluate/_eval_run.py,sha256=57rfW4MkE9LSlQNqdzxvq_nw8xYW-mqPQLw4WY_k-YU,22564
|
|
101
101
|
azure/ai/evaluation/_evaluate/_evaluate.py,sha256=FwANTG-K2MtL6yOIawXV1We27IC9nMJLA5o6nb6nfMg,57108
|
|
102
|
-
azure/ai/evaluation/_evaluate/_evaluate_aoai.py,sha256=
|
|
102
|
+
azure/ai/evaluation/_evaluate/_evaluate_aoai.py,sha256=sVVNBVx3aEDcGIVz53zEUrU9TA06Aiv5yfMOoGgCUZ4,29138
|
|
103
103
|
azure/ai/evaluation/_evaluate/_utils.py,sha256=DRLY9rtYdTtlcJMMv9UbzuD3U41sCq3UBKwvgVAcEp4,19227
|
|
104
104
|
azure/ai/evaluation/_evaluate/_batch_run/__init__.py,sha256=cPLi_MJ_pCp8eKBxJbiSoxgTnN3nDLuaP57dMkKuyhg,552
|
|
105
105
|
azure/ai/evaluation/_evaluate/_batch_run/_run_submitter_client.py,sha256=2Rl4j_f4qK6_J-Gl_qUV-4elpWbegWzIkJuQOdPP-ig,7046
|
|
@@ -118,7 +118,7 @@ azure/ai/evaluation/_evaluators/_coherence/__init__.py,sha256=GRqcSCQse02Spyki0U
|
|
|
118
118
|
azure/ai/evaluation/_evaluators/_coherence/_coherence.py,sha256=GntdMq4fZCp8C90wIv1WaHOIR10tHX4ozF6iNn-I6OI,5896
|
|
119
119
|
azure/ai/evaluation/_evaluators/_coherence/coherence.prompty,sha256=ANvh9mDFW7KMejrgdWqBLjj4SIqEO5WW9gg5pE0RLJk,6798
|
|
120
120
|
azure/ai/evaluation/_evaluators/_common/__init__.py,sha256=xAymP_CZy4aPzWplMdXgQUQVDIUEMI-0nbgdm_umFYY,498
|
|
121
|
-
azure/ai/evaluation/_evaluators/_common/_base_eval.py,sha256=
|
|
121
|
+
azure/ai/evaluation/_evaluators/_common/_base_eval.py,sha256=KWGBv4eFEBRxXR49AyHwZlpN0UUKcuth7GBJKEbN0ZM,30536
|
|
122
122
|
azure/ai/evaluation/_evaluators/_common/_base_multi_eval.py,sha256=yYFpoCDe2wMFQck0ykbX8IJBBidk6NT1wUTkVFlVSy8,2728
|
|
123
123
|
azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py,sha256=uvCwyUXInYfB2CxntbRiGla8n9lXRmsaUJsuFrckL-w,7047
|
|
124
124
|
azure/ai/evaluation/_evaluators/_common/_base_rai_svc_eval.py,sha256=JSZhRxVKljM4XE4P2DGrJSnD6iWr7tlDIJ8g95rHaGg,9078
|
|
@@ -141,8 +141,8 @@ azure/ai/evaluation/_evaluators/_fluency/fluency.prompty,sha256=n9v0W9eYwgIO-JSs
|
|
|
141
141
|
azure/ai/evaluation/_evaluators/_gleu/__init__.py,sha256=Ae2EvQ7gqiYAoNO3LwGIhdAAjJPJDfT85rQGKrRrmbA,260
|
|
142
142
|
azure/ai/evaluation/_evaluators/_gleu/_gleu.py,sha256=bm46V_t4NpIEaAAZMtMAxMMe_u3SgOY0201RihpFxEc,4884
|
|
143
143
|
azure/ai/evaluation/_evaluators/_groundedness/__init__.py,sha256=UYNJUeRvBwcSVFyZpdsf29un5eyaDzYoo3QvC1gvlLg,274
|
|
144
|
-
azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py,sha256=
|
|
145
|
-
azure/ai/evaluation/_evaluators/_groundedness/groundedness_with_query.prompty,sha256=
|
|
144
|
+
azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py,sha256=hyuVR14_6YOADGSrOi2y_bnJ7W4FbnHRp9u3M6w-qXY,14969
|
|
145
|
+
azure/ai/evaluation/_evaluators/_groundedness/groundedness_with_query.prompty,sha256=sVqRhcCVU64StCTkPmeiC2PP0KW990Sr72ejTbZ4P44,6504
|
|
146
146
|
azure/ai/evaluation/_evaluators/_groundedness/groundedness_without_query.prompty,sha256=8kNShdfxQvkII7GnqjmdqQ5TNelA2B6cjnqWZk8FFe4,5296
|
|
147
147
|
azure/ai/evaluation/_evaluators/_intent_resolution/__init__.py,sha256=Lr8krXt2yfShFTAuwjTFgrUbO75boLLrRSnF1mriN_Q,280
|
|
148
148
|
azure/ai/evaluation/_evaluators/_intent_resolution/_intent_resolution.py,sha256=ybZCa8HQ6Q3BCtA0_6cPlj0HbFBbWHOZruN64PILrV4,11542
|
|
@@ -194,7 +194,7 @@ azure/ai/evaluation/_legacy/_adapters/types.py,sha256=q7n0TtpFxd1WttbUR_Q8ODd8bT
|
|
|
194
194
|
azure/ai/evaluation/_legacy/_adapters/utils.py,sha256=2KdYqfeuHLcfqk1qJRviNoqqsghxBZNmyoGcUTNphl0,1306
|
|
195
195
|
azure/ai/evaluation/_legacy/_batch_engine/__init__.py,sha256=NNX2DhtPVzJCX8kR_QzZ6EkUsdGifvwip2LHEcRwy1Y,594
|
|
196
196
|
azure/ai/evaluation/_legacy/_batch_engine/_config.py,sha256=9fdRz5YVdf_95mCOugiJuna2pYMEmWKcsWaZCT4IwXM,1820
|
|
197
|
-
azure/ai/evaluation/_legacy/_batch_engine/_engine.py,sha256=
|
|
197
|
+
azure/ai/evaluation/_legacy/_batch_engine/_engine.py,sha256=mBhML4TM3kvfsBRxY6W17pAgTfrWwFEKlaM9trUofAs,19732
|
|
198
198
|
azure/ai/evaluation/_legacy/_batch_engine/_exceptions.py,sha256=_QQLowht6ww4wBJbShQBo00Y8HFdaWh-dWd44sGvJBc,2870
|
|
199
199
|
azure/ai/evaluation/_legacy/_batch_engine/_openai_injector.py,sha256=jP_ZHre2REdQh2l2JJNuP6arW9pHxOlc-WHG5jLnX6g,5059
|
|
200
200
|
azure/ai/evaluation/_legacy/_batch_engine/_result.py,sha256=mqwCNATvH2Tavpnk_u1000HfXLauNMgcPT9dpqKh4L4,3516
|
|
@@ -279,8 +279,8 @@ azure/ai/evaluation/simulator/_model_tools/models.py,sha256=H7tjmj9wzLT-6bI542eA
|
|
|
279
279
|
azure/ai/evaluation/simulator/_prompty/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
280
280
|
azure/ai/evaluation/simulator/_prompty/task_query_response.prompty,sha256=2BzSqDDYilDushvR56vMRDmqFIaIYAewdUlUZg_elMg,2182
|
|
281
281
|
azure/ai/evaluation/simulator/_prompty/task_simulate.prompty,sha256=NE6lH4bfmibgMn4NgJtm9_l3PMoHSFrfjjosDJEKM0g,939
|
|
282
|
-
azure_ai_evaluation-1.11.
|
|
283
|
-
azure_ai_evaluation-1.11.
|
|
284
|
-
azure_ai_evaluation-1.11.
|
|
285
|
-
azure_ai_evaluation-1.11.
|
|
286
|
-
azure_ai_evaluation-1.11.
|
|
282
|
+
azure_ai_evaluation-1.11.2.dist-info/licenses/NOTICE.txt,sha256=4tzi_Yq4-eBGhBvveobWHCgUIVF-ZeouGN0m7hVq5Mk,3592
|
|
283
|
+
azure_ai_evaluation-1.11.2.dist-info/METADATA,sha256=DOAvkYQ2yCXM_87qjNDl5mCjWhOLdI4AlS-ZUuZvvCg,45445
|
|
284
|
+
azure_ai_evaluation-1.11.2.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
|
285
|
+
azure_ai_evaluation-1.11.2.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
|
286
|
+
azure_ai_evaluation-1.11.2.dist-info/RECORD,,
|
|
File without changes
|
{azure_ai_evaluation-1.11.0.dist-info → azure_ai_evaluation-1.11.2.dist-info}/licenses/NOTICE.txt
RENAMED
|
File without changes
|
|
File without changes
|