Skip to content

Commit b044fee

Browse files
authored
Adding new changes for Metrics on Upload Eval (#40689)
1 parent 597650e commit b044fee

File tree

3 files changed

+124
-115
lines changed

3 files changed

+124
-115
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_common/onedp/aio/operations/_operations.py

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
build_connections_get_request,
3939
build_connections_get_with_credentials_request,
4040
build_connections_list_request,
41-
build_datasets_create_version_request,
41+
build_datasets_create_or_update_version_request,
4242
build_datasets_delete_version_request,
4343
build_datasets_get_credentials_request,
4444
build_datasets_get_version_request,
@@ -47,7 +47,7 @@
4747
build_datasets_start_pending_upload_version_request,
4848
build_deployments_get_request,
4949
build_deployments_list_request,
50-
build_evaluation_results_create_version_request,
50+
build_evaluation_results_create_or_update_version_request,
5151
build_evaluation_results_delete_version_request,
5252
build_evaluation_results_get_credentials_request,
5353
build_evaluation_results_get_version_request,
@@ -62,7 +62,7 @@
6262
build_evaluations_submit_annotation_request,
6363
build_evaluations_upload_run_request,
6464
build_evaluations_upload_update_run_request,
65-
build_indexes_create_version_request,
65+
build_indexes_create_or_update_version_request,
6666
build_indexes_delete_version_request,
6767
build_indexes_get_version_request,
6868
build_indexes_list_latest_request,
@@ -885,13 +885,13 @@ async def submit_annotation(
885885
method_added_on="2025-05-15-preview",
886886
params_added_on={"2025-05-15-preview": ["api_version", "operation_id", "accept"]},
887887
)
888-
async def operation_results(self, operation_id: str, **kwargs: Any) -> Dict[str, Any]:
888+
async def operation_results(self, operation_id: str, **kwargs: Any) -> List[Dict[str, Any]]:
889889
"""Poll for the operation results.
890890
891891
:param operation_id: Operation ID for the polling operation. Required.
892892
:type operation_id: str
893-
:return: dict mapping str to any
894-
:rtype: dict[str, any]
893+
:return: list of dict mapping str to any
894+
:rtype: list[dict[str, any]]
895895
:raises ~azure.core.exceptions.HttpResponseError:
896896
"""
897897
error_map: MutableMapping = {
@@ -905,7 +905,7 @@ async def operation_results(self, operation_id: str, **kwargs: Any) -> Dict[str,
905905
_headers = kwargs.pop("headers", {}) or {}
906906
_params = kwargs.pop("params", {}) or {}
907907

908-
cls: ClsType[Dict[str, Any]] = kwargs.pop("cls", None)
908+
cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None)
909909

910910
_request = build_evaluations_operation_results_request(
911911
operation_id=operation_id,
@@ -925,7 +925,7 @@ async def operation_results(self, operation_id: str, **kwargs: Any) -> Dict[str,
925925

926926
response = pipeline_response.http_response
927927

928-
if response.status_code not in [202]:
928+
if response.status_code not in [200]:
929929
if _stream:
930930
try:
931931
await response.read() # Load the body in memory and close the socket
@@ -937,7 +937,7 @@ async def operation_results(self, operation_id: str, **kwargs: Any) -> Dict[str,
937937
if _stream:
938938
deserialized = response.iter_bytes()
939939
else:
940-
deserialized = _deserialize(Dict[str, Any], response.json())
940+
deserialized = _deserialize(List[Dict[str, Any]], response.json())
941941

942942
if cls:
943943
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1550,7 +1550,7 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None:
15501550
return cls(pipeline_response, None, {}) # type: ignore
15511551

15521552
@overload
1553-
async def create_version(
1553+
async def create_or_update_version(
15541554
self,
15551555
name: str,
15561556
version: str,
@@ -1559,13 +1559,13 @@ async def create_version(
15591559
content_type: str = "application/json",
15601560
**kwargs: Any
15611561
) -> _models.DatasetVersion:
1562-
"""Create a new or replace an existing DatasetVersion with the given version id.
1562+
"""Create a new or update an existing DatasetVersion with the given version id.
15631563
15641564
:param name: The name of the resource. Required.
15651565
:type name: str
15661566
:param version: The specific version id of the DatasetVersion to create or replace. Required.
15671567
:type version: str
1568-
:param body: The definition of the DatasetVersion to create. Required.
1568+
:param body: The definition of the DatasetVersion to create or update. Required.
15691569
:type body: ~azure.ai.projects.onedp.models.DatasetVersion
15701570
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
15711571
Default value is "application/json".
@@ -1576,16 +1576,16 @@ async def create_version(
15761576
"""
15771577

15781578
@overload
1579-
async def create_version(
1579+
async def create_or_update_version(
15801580
self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
15811581
) -> _models.DatasetVersion:
1582-
"""Create a new or replace an existing DatasetVersion with the given version id.
1582+
"""Create a new or update an existing DatasetVersion with the given version id.
15831583
15841584
:param name: The name of the resource. Required.
15851585
:type name: str
15861586
:param version: The specific version id of the DatasetVersion to create or replace. Required.
15871587
:type version: str
1588-
:param body: The definition of the DatasetVersion to create. Required.
1588+
:param body: The definition of the DatasetVersion to create or update. Required.
15891589
:type body: JSON
15901590
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
15911591
Default value is "application/json".
@@ -1596,16 +1596,16 @@ async def create_version(
15961596
"""
15971597

15981598
@overload
1599-
async def create_version(
1599+
async def create_or_update_version(
16001600
self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
16011601
) -> _models.DatasetVersion:
1602-
"""Create a new or replace an existing DatasetVersion with the given version id.
1602+
"""Create a new or update an existing DatasetVersion with the given version id.
16031603
16041604
:param name: The name of the resource. Required.
16051605
:type name: str
16061606
:param version: The specific version id of the DatasetVersion to create or replace. Required.
16071607
:type version: str
1608-
:param body: The definition of the DatasetVersion to create. Required.
1608+
:param body: The definition of the DatasetVersion to create or update. Required.
16091609
:type body: IO[bytes]
16101610
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
16111611
Default value is "application/json".
@@ -1616,17 +1616,17 @@ async def create_version(
16161616
"""
16171617

16181618
@distributed_trace_async
1619-
async def create_version(
1619+
async def create_or_update_version(
16201620
self, name: str, version: str, body: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any
16211621
) -> _models.DatasetVersion:
1622-
"""Create a new or replace an existing DatasetVersion with the given version id.
1622+
"""Create a new or update an existing DatasetVersion with the given version id.
16231623
16241624
:param name: The name of the resource. Required.
16251625
:type name: str
16261626
:param version: The specific version id of the DatasetVersion to create or replace. Required.
16271627
:type version: str
1628-
:param body: The definition of the DatasetVersion to create. Is one of the following types:
1629-
DatasetVersion, JSON, IO[bytes] Required.
1628+
:param body: The definition of the DatasetVersion to create or update. Is one of the following
1629+
types: DatasetVersion, JSON, IO[bytes] Required.
16301630
:type body: ~azure.ai.projects.onedp.models.DatasetVersion or JSON or IO[bytes]
16311631
:return: DatasetVersion. The DatasetVersion is compatible with MutableMapping
16321632
:rtype: ~azure.ai.projects.onedp.models.DatasetVersion
@@ -1653,7 +1653,7 @@ async def create_version(
16531653
else:
16541654
_content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
16551655

1656-
_request = build_datasets_create_version_request(
1656+
_request = build_datasets_create_or_update_version_request(
16571657
name=name,
16581658
version=version,
16591659
content_type=content_type,
@@ -2258,16 +2258,16 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None:
22582258
return cls(pipeline_response, None, {}) # type: ignore
22592259

22602260
@overload
2261-
async def create_version(
2261+
async def create_or_update_version(
22622262
self, name: str, version: str, body: _models.Index, *, content_type: str = "application/json", **kwargs: Any
22632263
) -> _models.Index:
2264-
"""Create a new or replace an existing Index with the given version id.
2264+
"""Create a new or update an existing Index with the given version id.
22652265
22662266
:param name: The name of the resource. Required.
22672267
:type name: str
22682268
:param version: The specific version id of the Index to create or replace. Required.
22692269
:type version: str
2270-
:param body: The definition of the Index to create. Required.
2270+
:param body: The definition of the Index to create or update. Required.
22712271
:type body: ~azure.ai.projects.onedp.models.Index
22722272
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
22732273
Default value is "application/json".
@@ -2278,16 +2278,16 @@ async def create_version(
22782278
"""
22792279

22802280
@overload
2281-
async def create_version(
2281+
async def create_or_update_version(
22822282
self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
22832283
) -> _models.Index:
2284-
"""Create a new or replace an existing Index with the given version id.
2284+
"""Create a new or update an existing Index with the given version id.
22852285
22862286
:param name: The name of the resource. Required.
22872287
:type name: str
22882288
:param version: The specific version id of the Index to create or replace. Required.
22892289
:type version: str
2290-
:param body: The definition of the Index to create. Required.
2290+
:param body: The definition of the Index to create or update. Required.
22912291
:type body: JSON
22922292
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
22932293
Default value is "application/json".
@@ -2298,16 +2298,16 @@ async def create_version(
22982298
"""
22992299

23002300
@overload
2301-
async def create_version(
2301+
async def create_or_update_version(
23022302
self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
23032303
) -> _models.Index:
2304-
"""Create a new or replace an existing Index with the given version id.
2304+
"""Create a new or update an existing Index with the given version id.
23052305
23062306
:param name: The name of the resource. Required.
23072307
:type name: str
23082308
:param version: The specific version id of the Index to create or replace. Required.
23092309
:type version: str
2310-
:param body: The definition of the Index to create. Required.
2310+
:param body: The definition of the Index to create or update. Required.
23112311
:type body: IO[bytes]
23122312
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
23132313
Default value is "application/json".
@@ -2318,17 +2318,17 @@ async def create_version(
23182318
"""
23192319

23202320
@distributed_trace_async
2321-
async def create_version(
2321+
async def create_or_update_version(
23222322
self, name: str, version: str, body: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any
23232323
) -> _models.Index:
2324-
"""Create a new or replace an existing Index with the given version id.
2324+
"""Create a new or update an existing Index with the given version id.
23252325
23262326
:param name: The name of the resource. Required.
23272327
:type name: str
23282328
:param version: The specific version id of the Index to create or replace. Required.
23292329
:type version: str
2330-
:param body: The definition of the Index to create. Is one of the following types: Index, JSON,
2331-
IO[bytes] Required.
2330+
:param body: The definition of the Index to create or update. Is one of the following types:
2331+
Index, JSON, IO[bytes] Required.
23322332
:type body: ~azure.ai.projects.onedp.models.Index or JSON or IO[bytes]
23332333
:return: Index. The Index is compatible with MutableMapping
23342334
:rtype: ~azure.ai.projects.onedp.models.Index
@@ -2355,7 +2355,7 @@ async def create_version(
23552355
else:
23562356
_content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
23572357

2358-
_request = build_indexes_create_version_request(
2358+
_request = build_indexes_create_or_update_version_request(
23592359
name=name,
23602360
version=version,
23612361
content_type=content_type,
@@ -4032,7 +4032,7 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None:
40324032
return cls(pipeline_response, None, {}) # type: ignore
40334033

40344034
@overload
4035-
async def create_version(
4035+
async def create_or_update_version(
40364036
self,
40374037
name: str,
40384038
version: str,
@@ -4041,13 +4041,13 @@ async def create_version(
40414041
content_type: str = "application/json",
40424042
**kwargs: Any
40434043
) -> _models.EvaluationResult:
4044-
"""Create a new or replace an existing EvaluationResult with the given version id.
4044+
"""Create a new or update an existing EvaluationResult with the given version id.
40454045
40464046
:param name: The name of the resource. Required.
40474047
:type name: str
40484048
:param version: The specific version id of the EvaluationResult to create or replace. Required.
40494049
:type version: str
4050-
:param body: The definition of the EvaluationResult to create. Required.
4050+
:param body: The definition of the EvaluationResult to create or update. Required.
40514051
:type body: ~azure.ai.projects.onedp.models.EvaluationResult
40524052
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
40534053
Default value is "application/json".
@@ -4058,16 +4058,16 @@ async def create_version(
40584058
"""
40594059

40604060
@overload
4061-
async def create_version(
4061+
async def create_or_update_version(
40624062
self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any
40634063
) -> _models.EvaluationResult:
4064-
"""Create a new or replace an existing EvaluationResult with the given version id.
4064+
"""Create a new or update an existing EvaluationResult with the given version id.
40654065
40664066
:param name: The name of the resource. Required.
40674067
:type name: str
40684068
:param version: The specific version id of the EvaluationResult to create or replace. Required.
40694069
:type version: str
4070-
:param body: The definition of the EvaluationResult to create. Required.
4070+
:param body: The definition of the EvaluationResult to create or update. Required.
40714071
:type body: JSON
40724072
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
40734073
Default value is "application/json".
@@ -4078,16 +4078,16 @@ async def create_version(
40784078
"""
40794079

40804080
@overload
4081-
async def create_version(
4081+
async def create_or_update_version(
40824082
self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
40834083
) -> _models.EvaluationResult:
4084-
"""Create a new or replace an existing EvaluationResult with the given version id.
4084+
"""Create a new or update an existing EvaluationResult with the given version id.
40854085
40864086
:param name: The name of the resource. Required.
40874087
:type name: str
40884088
:param version: The specific version id of the EvaluationResult to create or replace. Required.
40894089
:type version: str
4090-
:param body: The definition of the EvaluationResult to create. Required.
4090+
:param body: The definition of the EvaluationResult to create or update. Required.
40914091
:type body: IO[bytes]
40924092
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
40934093
Default value is "application/json".
@@ -4102,17 +4102,17 @@ async def create_version(
41024102
method_added_on="2025-05-15-preview",
41034103
params_added_on={"2025-05-15-preview": ["api_version", "name", "version", "content_type", "accept"]},
41044104
)
4105-
async def create_version(
4105+
async def create_or_update_version(
41064106
self, name: str, version: str, body: Union[_models.EvaluationResult, JSON, IO[bytes]], **kwargs: Any
41074107
) -> _models.EvaluationResult:
4108-
"""Create a new or replace an existing EvaluationResult with the given version id.
4108+
"""Create a new or update an existing EvaluationResult with the given version id.
41094109
41104110
:param name: The name of the resource. Required.
41114111
:type name: str
41124112
:param version: The specific version id of the EvaluationResult to create or replace. Required.
41134113
:type version: str
4114-
:param body: The definition of the EvaluationResult to create. Is one of the following types:
4115-
EvaluationResult, JSON, IO[bytes] Required.
4114+
:param body: The definition of the EvaluationResult to create or update. Is one of the
4115+
following types: EvaluationResult, JSON, IO[bytes] Required.
41164116
:type body: ~azure.ai.projects.onedp.models.EvaluationResult or JSON or IO[bytes]
41174117
:return: EvaluationResult. The EvaluationResult is compatible with MutableMapping
41184118
:rtype: ~azure.ai.projects.onedp.models.EvaluationResult
@@ -4139,7 +4139,7 @@ async def create_version(
41394139
else:
41404140
_content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
41414141

4142-
_request = build_evaluation_results_create_version_request(
4142+
_request = build_evaluation_results_create_or_update_version_request(
41434143
name=name,
41444144
version=version,
41454145
content_type=content_type,

0 commit comments

Comments
 (0)