Skip to content

Commit

Permalink
Evaluation: Remove parallel from composite evaluators (Azure#38168)
Browse files Browse the repository at this point in the history
* Remove `parallel` from composite evaluators

* update recording

* update

* output_dir check

* fix the test recording

* fix the failed unit-test

* update changelog

* update

* fix black issue

* revert output_path related change

* Update sdk/evaluation/azure-ai-evaluation/CHANGELOG.md

Co-authored-by: Neehar Duvvuri <40341266+needuv@users.noreply.github.com>

---------

Co-authored-by: Neehar Duvvuri <40341266+needuv@users.noreply.github.com>
  • Loading branch information
2 people authored and allenkim0129 committed Nov 5, 2024
1 parent 83dfe39 commit 2c3ad69
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 340 deletions.
1 change: 1 addition & 0 deletions sdk/evaluation/azure-ai-evaluation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features Added

### Breaking Changes
- The `parallel` parameter has been removed from composite evaluators: `QAEvaluator`, `ContentSafetyChatEvaluator`, and `ContentSafetyMultimodalEvaluator`. To control evaluator parallelism, you can now use the `_parallel` keyword argument, though please note that this private parameter may change in the future.

### Bugs Fixed
- Output of adversarial simulators are of type `JsonLineList` and the helper function `to_eval_qr_json_lines` now outputs context from both user and assistant turns along with `category` if it exists in the conversation
Expand Down
2 changes: 1 addition & 1 deletion sdk/evaluation/azure-ai-evaluation/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/evaluation/azure-ai-evaluation",
"Tag": "python/evaluation/azure-ai-evaluation_e3ec13551e"
"Tag": "python/evaluation/azure-ai-evaluation_daf1ed16fc"
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def wrapper(*args: P.args, **kwargs: P.kwargs) -> EvaluationResult:
user_agent=USER_AGENT,
)

track_in_cloud = bool(pf_client._config.get_trace_destination()) # pylint: disable=protected-access
trace_destination = pf_client._config.get_trace_destination() # pylint: disable=protected-access
track_in_cloud = bool(trace_destination) if trace_destination != "none" else False
evaluate_target = bool(kwargs.get("target", None))
evaluator_config = bool(kwargs.get("evaluator_config", None))
custom_dimensions: Dict[str, Union[str, bool]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ContentSafetyEvaluator(EvaluatorBase[Union[str, float]]):
# TODO address 3579092 to re-enabled parallel evals.
def __init__(self, credential, azure_ai_project, eval_last_turn: bool = False, **kwargs):
super().__init__(eval_last_turn=eval_last_turn)
self._parallel = kwargs.pop("parallel", False)
self._parallel = kwargs.pop("_parallel", False)
self._evaluators: List[Callable[..., Dict[str, Union[str, float]]]] = [
ViolenceEvaluator(credential, azure_ai_project),
SexualEvaluator(credential, azure_ai_project),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ class ContentSafetyMultimodalEvaluator:
:param azure_ai_project: The scope of the Azure AI project, containing the subscription ID,
resource group, and project name.
:type azure_ai_project: ~azure.ai.evaluation.AzureAIProject
:param parallel: Specifies whether to use parallel execution for evaluators.
If True, evaluators execute in parallel; otherwise, they execute sequentially. Defaults to True.
:type parallel: bool
:param kwargs: Additional arguments to pass to the evaluator.
:type kwargs: Any
:return: A function that evaluates multimodal chat messages and generates content safety metrics.
:rtype: Callable
Expand Down Expand Up @@ -92,8 +91,8 @@ class ContentSafetyMultimodalEvaluator:
"""

def __init__(self, credential, azure_ai_project, parallel: bool = False):
self._parallel = parallel
def __init__(self, credential, azure_ai_project, **kwargs):
self._parallel = kwargs.pop("_parallel", False)
self._evaluators: List[Callable[..., Dict[str, Union[str, float]]]] = [
ViolenceMultimodalEvaluator(credential=credential, azure_ai_project=azure_ai_project),
SexualMultimodalEvaluator(credential=credential, azure_ai_project=azure_ai_project),
Expand Down
Loading

0 comments on commit 2c3ad69

Please sign in to comment.