66# Code generated by Microsoft (R) Python Code Generator.
77# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88# --------------------------------------------------------------------------
9+ from collections .abc import MutableMapping
910from io import IOBase
1011import json
11- import sys
1212from typing import Any , AsyncIterable , Callable , Dict , IO , List , Optional , TypeVar , Union , overload
1313import urllib .parse
1414
4949 build_deployments_list_request ,
5050 build_evaluation_results_create_version_request ,
5151 build_evaluation_results_delete_version_request ,
52- build_evaluation_results_fetch_asset_credentials_request ,
52+ build_evaluation_results_get_credentials_request ,
5353 build_evaluation_results_get_version_request ,
5454 build_evaluation_results_list_latest_request ,
5555 build_evaluation_results_list_versions_request ,
5858 build_evaluations_create_run_request ,
5959 build_evaluations_get_request ,
6060 build_evaluations_list_request ,
61+ build_evaluations_operation_results_request ,
6162 build_evaluations_submit_annotation_request ,
6263 build_evaluations_upload_run_request ,
6364 build_evaluations_upload_update_run_request ,
8182)
8283from .._configuration import AIProjectClientConfiguration
8384
84- if sys .version_info >= (3 , 9 ):
85- from collections .abc import MutableMapping
86- else :
87- from typing import MutableMapping # type: ignore
8885T = TypeVar ("T" )
8986ClsType = Optional [Callable [[PipelineResponse [HttpRequest , AsyncHttpResponse ], T , Dict [str , Any ]], Any ]]
90- JSON = MutableMapping [str , Any ] # pylint: disable=unsubscriptable-object
87+ JSON = MutableMapping [str , Any ]
9188
9289
9390class ServicePatternsOperations :
@@ -883,6 +880,70 @@ async def submit_annotation(
883880
884881 return deserialized # type: ignore
885882
883+ @distributed_trace_async
884+ @api_version_validation (
885+ method_added_on = "2025-05-15-preview" ,
886+ params_added_on = {"2025-05-15-preview" : ["api_version" , "operation_id" , "accept" ]},
887+ )
888+ async def operation_results (self , operation_id : str , ** kwargs : Any ) -> Dict [str , Any ]:
889+ """Poll for the operation results.
890+
891+ :param operation_id: Operation ID for the polling operation. Required.
892+ :type operation_id: str
893+ :return: dict mapping str to any
894+ :rtype: dict[str, any]
895+ :raises ~azure.core.exceptions.HttpResponseError:
896+ """
897+ error_map : MutableMapping = {
898+ 401 : ClientAuthenticationError ,
899+ 404 : ResourceNotFoundError ,
900+ 409 : ResourceExistsError ,
901+ 304 : ResourceNotModifiedError ,
902+ }
903+ error_map .update (kwargs .pop ("error_map" , {}) or {})
904+
905+ _headers = kwargs .pop ("headers" , {}) or {}
906+ _params = kwargs .pop ("params" , {}) or {}
907+
908+ cls : ClsType [Dict [str , Any ]] = kwargs .pop ("cls" , None )
909+
910+ _request = build_evaluations_operation_results_request (
911+ operation_id = operation_id ,
912+ api_version = self ._config .api_version ,
913+ headers = _headers ,
914+ params = _params ,
915+ )
916+ path_format_arguments = {
917+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
918+ }
919+ _request .url = self ._client .format_url (_request .url , ** path_format_arguments )
920+
921+ _stream = kwargs .pop ("stream" , False )
922+ pipeline_response : PipelineResponse = await self ._client ._pipeline .run ( # pylint: disable=protected-access
923+ _request , stream = _stream , ** kwargs
924+ )
925+
926+ response = pipeline_response .http_response
927+
928+ if response .status_code not in [202 ]:
929+ if _stream :
930+ try :
931+ await response .read () # Load the body in memory and close the socket
932+ except (StreamConsumedError , StreamClosedError ):
933+ pass
934+ map_error (status_code = response .status_code , response = response , error_map = error_map )
935+ raise HttpResponseError (response = response )
936+
937+ if _stream :
938+ deserialized = response .iter_bytes ()
939+ else :
940+ deserialized = _deserialize (Dict [str , Any ], response .json ())
941+
942+ if cls :
943+ return cls (pipeline_response , deserialized , {}) # type: ignore
944+
945+ return deserialized # type: ignore
946+
886947 @overload
887948 async def upload_run (
888949 self , evaluation : _models .EvaluationUpload , * , content_type : str = "application/json" , ** kwargs : Any
@@ -4267,7 +4328,7 @@ async def start_pending_upload(
42674328 return deserialized # type: ignore
42684329
42694330 @overload
4270- async def fetch_asset_credentials (
4331+ async def get_credentials (
42714332 self ,
42724333 name : str ,
42734334 version : str ,
@@ -4293,7 +4354,7 @@ async def fetch_asset_credentials(
42934354 """
42944355
42954356 @overload
4296- async def fetch_asset_credentials (
4357+ async def get_credentials (
42974358 self , name : str , version : str , body : JSON , * , content_type : str = "application/json" , ** kwargs : Any
42984359 ) -> _models .AssetCredentialResponse :
42994360 """Enable downloading json.
@@ -4313,7 +4374,7 @@ async def fetch_asset_credentials(
43134374 """
43144375
43154376 @overload
4316- async def fetch_asset_credentials (
4377+ async def get_credentials (
43174378 self , name : str , version : str , body : IO [bytes ], * , content_type : str = "application/json" , ** kwargs : Any
43184379 ) -> _models .AssetCredentialResponse :
43194380 """Enable downloading json.
@@ -4337,7 +4398,7 @@ async def fetch_asset_credentials(
43374398 method_added_on = "2025-05-15-preview" ,
43384399 params_added_on = {"2025-05-15-preview" : ["api_version" , "name" , "version" , "content_type" , "accept" ]},
43394400 )
4340- async def fetch_asset_credentials (
4401+ async def get_credentials (
43414402 self , name : str , version : str , body : Union [_models .AssetCredentialRequest , JSON , IO [bytes ]], ** kwargs : Any
43424403 ) -> _models .AssetCredentialResponse :
43434404 """Enable downloading json.
@@ -4374,7 +4435,7 @@ async def fetch_asset_credentials(
43744435 else :
43754436 _content = json .dumps (body , cls = SdkJSONEncoder , exclude_readonly = True ) # type: ignore
43764437
4377- _request = build_evaluation_results_fetch_asset_credentials_request (
4438+ _request = build_evaluation_results_get_credentials_request (
43784439 name = name ,
43794440 version = version ,
43804441 content_type = content_type ,
0 commit comments