|
4 | 4 |
|
5 | 5 | import inspect
|
6 | 6 | from abc import ABC, abstractmethod
|
7 |
| -from typing import Any, Callable, Dict, Generic, List, TypedDict, TypeVar, Union, cast, final, Optional |
| 7 | +from typing import ( |
| 8 | + Any, |
| 9 | + Callable, |
| 10 | + Dict, |
| 11 | + Generic, |
| 12 | + List, |
| 13 | + TypedDict, |
| 14 | + TypeVar, |
| 15 | + Union, |
| 16 | + cast, |
| 17 | + final, |
| 18 | + Optional, |
| 19 | +) |
8 | 20 |
|
9 | 21 | from azure.ai.evaluation._legacy._adapters.utils import async_run_allowing_running_loop
|
10 | 22 | from typing_extensions import ParamSpec, TypeAlias, get_overloads
|
11 | 23 |
|
12 |
| -from azure.ai.evaluation._exceptions import ErrorBlame, ErrorCategory, ErrorTarget, EvaluationException |
| 24 | +from azure.ai.evaluation._exceptions import ( |
| 25 | + ErrorBlame, |
| 26 | + ErrorCategory, |
| 27 | + ErrorTarget, |
| 28 | + EvaluationException, |
| 29 | +) |
13 | 30 | from azure.ai.evaluation._common.utils import remove_optional_singletons
|
14 |
| -from azure.ai.evaluation._constants import _AggregationType, EVALUATION_PASS_FAIL_MAPPING |
| 31 | +from azure.ai.evaluation._constants import ( |
| 32 | + _AggregationType, |
| 33 | + EVALUATION_PASS_FAIL_MAPPING, |
| 34 | +) |
15 | 35 | from azure.ai.evaluation._model_configurations import Conversation
|
16 | 36 | from azure.ai.evaluation._common._experimental import experimental
|
17 | 37 |
|
@@ -176,7 +196,9 @@ def _derive_singleton_inputs(self) -> List[str]:
|
176 | 196 | singletons.extend([p for p in params if p != "self"])
|
177 | 197 | return singletons
|
178 | 198 |
|
179 |
| - def _derive_conversation_converter(self) -> Callable[[Dict], List[DerivedEvalInput]]: |
| 199 | + def _derive_conversation_converter( |
| 200 | + self, |
| 201 | + ) -> Callable[[Dict], List[DerivedEvalInput]]: |
180 | 202 | """Produce the function that will be used to convert conversations to a list of evaluable inputs.
|
181 | 203 | This uses the inputs derived from the _derive_singleton_inputs function to determine which
|
182 | 204 | aspects of a conversation ought to be extracted.
|
@@ -235,7 +257,9 @@ def converter(conversation: Dict) -> List[DerivedEvalInput]:
|
235 | 257 |
|
236 | 258 | return converter
|
237 | 259 |
|
238 |
| - def _derive_multi_modal_conversation_converter(self) -> Callable[[Dict], List[Dict[str, Any]]]: |
| 260 | + def _derive_multi_modal_conversation_converter( |
| 261 | + self, |
| 262 | + ) -> Callable[[Dict], List[Dict[str, Any]]]: |
239 | 263 | """Produce the function that will be used to convert multi-modal conversations to a list of evaluable inputs.
|
240 | 264 | This uses the inputs derived from the _derive_singleton_inputs function to determine which
|
241 | 265 | aspects of a conversation ought to be extracted.
|
@@ -288,7 +312,7 @@ def multi_modal_converter(conversation: Dict) -> List[Dict[str, Any]]:
|
288 | 312 |
|
289 | 313 | return multi_modal_converter
|
290 | 314 |
|
291 |
| - def _convert_kwargs_to_eval_input(self, **kwargs) -> Union[List[Dict], List[DerivedEvalInput]]: |
| 315 | + def _convert_kwargs_to_eval_input(self, **kwargs) -> Union[List[Dict], List[DerivedEvalInput], Dict[str, Any]]: |
292 | 316 | """Convert an arbitrary input into a list of inputs for evaluators.
|
293 | 317 | It is assumed that evaluators generally make use of their inputs in one of two ways.
|
294 | 318 | Either they receive a collection of keyname inputs that are all single values
|
|
0 commit comments