From 9d780e8a05d335f38ac4e40fd0990c26e6676012 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 21 May 2026 15:26:39 -0700 Subject: [PATCH 1/4] Part 1: Emit SDK from TypeSpec Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../azure-ai-projects/apiview-properties.json | 6 +- .../azure/ai/projects/_utils/utils.py | 19 +- .../ai/projects/aio/operations/_operations.py | 347 +++++++++-------- .../aio/operations/_patch_agents_async.py | 4 +- .../azure/ai/projects/models/__init__.py | 12 +- .../azure/ai/projects/models/_enums.py | 12 +- .../azure/ai/projects/models/_models.py | 95 ++--- .../ai/projects/operations/_operations.py | 353 +++++++++--------- .../ai/projects/operations/_patch_agents.py | 5 +- .../tests/samples/llm_instructions.py | 32 +- sdk/ai/azure-ai-projects/tsp-location.yaml | 2 +- 11 files changed, 467 insertions(+), 420 deletions(-) diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index 6b220f8903f9..7e6e38b214d3 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -119,12 +119,12 @@ "azure.ai.projects.models.DatasetVersion": "Azure.AI.Projects.DatasetVersion", "azure.ai.projects.models.DeleteAgentResponse": "Azure.AI.Projects.DeleteAgentResponse", "azure.ai.projects.models.DeleteAgentVersionResponse": "Azure.AI.Projects.DeleteAgentVersionResponse", - "azure.ai.projects.models.DeleteMemoryResponse": "Azure.AI.Projects.DeleteMemoryResponse", + "azure.ai.projects.models.DeleteMemoryResult": "Azure.AI.Projects.DeleteMemoryResponse", "azure.ai.projects.models.DeleteMemoryStoreResult": "Azure.AI.Projects.DeleteMemoryStoreResponse", "azure.ai.projects.models.DeleteSkillResult": "Azure.AI.Projects.DeleteSkillResponse", "azure.ai.projects.models.Deployment": "Azure.AI.Projects.Deployment", "azure.ai.projects.models.Dimension": "Azure.AI.Projects.Dimension", - "azure.ai.projects.models.DispatchRoutineResponse": "Azure.AI.Projects.DispatchRoutineResponse", + "azure.ai.projects.models.DispatchRoutineResult": "Azure.AI.Projects.DispatchRoutineResponse", "azure.ai.projects.models.EmbeddingConfiguration": "Azure.AI.Projects.EmbeddingConfiguration", "azure.ai.projects.models.EntraAuthorizationScheme": "Azure.AI.Projects.EntraAuthorizationScheme", "azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials", @@ -249,7 +249,7 @@ "azure.ai.projects.models.TelemetryEndpoint": "Azure.AI.Projects.TelemetryEndpoint", "azure.ai.projects.models.OtlpTelemetryEndpoint": "Azure.AI.Projects.OtlpTelemetryEndpoint", "azure.ai.projects.models.PendingUploadRequest": "Azure.AI.Projects.PendingUploadRequest", - "azure.ai.projects.models.PendingUploadResult": "Azure.AI.Projects.PendingUploadResponse", + "azure.ai.projects.models.PendingUploadResponse": "Azure.AI.Projects.PendingUploadResponse", "azure.ai.projects.models.ProceduralMemoryItem": "Azure.AI.Projects.ProceduralMemoryItem", "azure.ai.projects.models.PromptAgentDefinition": "Azure.AI.Projects.PromptAgentDefinition", "azure.ai.projects.models.PromptAgentDefinitionTextOptions": "Azure.AI.Projects.PromptAgentDefinitionTextOptions", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py index 74ca7f7b13ba..bd821750f4c6 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py @@ -10,6 +10,7 @@ from .._utils.model_base import Model, SdkJSONEncoder + # file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` FileContent = Union[str, bytes, IO[str], IO[bytes]] @@ -33,17 +34,6 @@ def prepare_multipart_form_data( body: Mapping[str, Any], multipart_fields: list[str], data_fields: list[str] ) -> list[FileType]: files: list[FileType] = [] - - # Append data fields first so they appear before file parts in the encoded - # multipart body. Some streaming server-side parsers (e.g. the Foundry - # hosted-agents `create_agent_version_from_code` endpoint) require small - # JSON metadata parts to precede large binary file parts; otherwise they - # report the metadata part as missing. - for data_field in data_fields: - data_entry = body.get(data_field) - if data_entry: - files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) - for multipart_field in multipart_fields: multipart_entry = body.get(multipart_field) if isinstance(multipart_entry, list): @@ -51,4 +41,11 @@ def prepare_multipart_form_data( elif multipart_entry: files.append((multipart_field, multipart_entry)) + # if files is empty, sdk core library can't handle multipart/form-data correctly, so + # we put data fields into files with filename as None to avoid that scenario. + for data_field in data_fields: + data_entry = body.get(data_field) + if data_entry: + files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) + return files diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 5e6c7cc31436..4c8a14cfe79a 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -52,7 +52,7 @@ build_beta_agents_delete_optimization_job_request, build_beta_agents_delete_session_file_request, build_beta_agents_delete_session_request, - build_beta_agents_download_agent_code_request, + build_beta_agents_download_code_request, build_beta_agents_download_session_file_request, build_beta_agents_get_optimization_candidate_config_request, build_beta_agents_get_optimization_candidate_request, @@ -105,12 +105,12 @@ build_beta_memory_stores_update_memories_request, build_beta_memory_stores_update_memory_request, build_beta_memory_stores_update_request, - build_beta_models_create_async_request, build_beta_models_delete_request, build_beta_models_get_credentials_request, build_beta_models_get_request, build_beta_models_list_request, build_beta_models_list_versions_request, + build_beta_models_pending_create_version_request, build_beta_models_pending_upload_request, build_beta_models_update_request, build_beta_red_teams_create_request, @@ -119,7 +119,7 @@ build_beta_routines_create_or_update_request, build_beta_routines_delete_request, build_beta_routines_disable_request, - build_beta_routines_dispatch_async_request, + build_beta_routines_dispatch_request, build_beta_routines_enable_request, build_beta_routines_get_request, build_beta_routines_list_request, @@ -302,8 +302,8 @@ async def delete( :param agent_name: The name of the agent to delete. Required. :type agent_name: str :keyword force: For Hosted Agents, if true, force-deletes the agent even if its versions have - active sessions, cascading deletion to all associated sessions. This value is not relevant for - other Agent types. Defaults to false. Default value is None. + active sessions, cascading deletion to all associated sessions. Defaults to ``false``. This + value is not relevant for other Agent types. Default value is None. :paramtype force: bool :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DeleteAgentResponse @@ -953,8 +953,8 @@ async def delete_version( :param agent_version: The version of the agent to delete. Required. :type agent_version: str :keyword force: For Hosted Agents, if true, force-deletes the version even if it has active - sessions, cascading deletion to all associated sessions. This value is not relevant for other - Agent types. Defaults to false. Default value is None. + sessions, cascading deletion to all associated sessions. Defaults to ``false``. This value is + not relevant for other Agent types. Default value is None. :paramtype force: bool :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with MutableMapping @@ -2195,7 +2195,7 @@ async def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -2207,8 +2207,8 @@ async def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2221,7 +2221,7 @@ async def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -2233,8 +2233,8 @@ async def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2247,7 +2247,7 @@ async def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -2259,8 +2259,8 @@ async def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2271,7 +2271,7 @@ async def pending_upload( version: str, pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -2282,8 +2282,8 @@ async def pending_upload( types: PendingUploadRequest, JSON, IO[bytes] Required. :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or IO[bytes] - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2298,7 +2298,7 @@ async def pending_upload( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -2341,7 +2341,7 @@ async def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResult, response.json()) + deserialized = _deserialize(_models.PendingUploadResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3371,7 +3371,7 @@ async def create_version_from_code( return deserialized # type: ignore @distributed_trace_async - async def download_agent_code( + async def download_code( self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: """Download the code zip for a code-based hosted agent. @@ -3405,7 +3405,7 @@ async def download_agent_code( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_agents_download_agent_code_request( + _request = build_beta_agents_download_code_request( agent_name=agent_name, agent_version=agent_version, api_version=self._config.api_version, @@ -3887,23 +3887,29 @@ async def get_session_log_stream( Each SSE frame contains: * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) + * `data`: a plain-text log line (currently JSON-formatted, but the schema + is not contractual and may include additional keys or change format + over time — clients should treat it as an opaque string) Example SSE frames: .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting + FoundryCBAgent server on port 8088"} event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application + startup complete."} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully + connected to container"} event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since + last 60 seconds"} The stream remains open until the client disconnects or the server terminates the connection. Clients should handle reconnection as needed. @@ -3945,7 +3951,7 @@ async def get_session_log_stream( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5223,10 +5229,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5656,10 +5659,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5759,10 +5759,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -6216,7 +6213,7 @@ async def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -6228,8 +6225,8 @@ async def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -6242,7 +6239,7 @@ async def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -6254,8 +6251,8 @@ async def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -6268,7 +6265,7 @@ async def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -6280,8 +6277,8 @@ async def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -6292,7 +6289,7 @@ async def pending_upload( version: str, pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -6303,8 +6300,8 @@ async def pending_upload( types: PendingUploadRequest, JSON, IO[bytes] Required. :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or IO[bytes] - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6319,7 +6316,7 @@ async def pending_upload( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -6366,7 +6363,7 @@ async def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResult, response.json()) + deserialized = _deserialize(_models.PendingUploadResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7278,10 +7275,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -7949,7 +7943,7 @@ async def _search_memories( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items": items, + "items_property": items, "options": options, "previous_search_id": previous_search_id, "scope": scope, @@ -8035,7 +8029,7 @@ async def _update_memories_initial( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items": items, + "items_property": items, "previous_update_id": previous_update_id, "scope": scope, "update_delay": update_delay, @@ -8933,14 +8927,6 @@ def list_memories( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) - - # BUG? These lines were inside the prepare_request() method. Moved here instead. - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = {"scope": scope} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -8949,6 +8935,12 @@ def list_memories( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(_continuation_token=None): + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = {"scope": scope} + body = {k: v for k, v in body.items() if v is not None} + _request = build_beta_memory_stores_list_memories_request( name=name, kind=kind, @@ -9000,15 +8992,15 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResponse: + async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResult: """Delete a memory item from a memory store. :param name: The name of the memory store. Required. :type name: str :param memory_id: The ID of the memory item to delete. Required. :type memory_id: str - :return: DeleteMemoryResponse. The DeleteMemoryResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryResponse + :return: DeleteMemoryResult. The DeleteMemoryResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteMemoryResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9022,7 +9014,7 @@ async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.DeleteMemoryResult] = kwargs.pop("cls", None) _request = build_beta_memory_stores_delete_memory_request( name=name, @@ -9060,7 +9052,7 @@ async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _mode if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryResponse, response.json()) + deserialized = _deserialize(_models.DeleteMemoryResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9135,10 +9127,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9223,10 +9212,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9537,11 +9523,11 @@ async def update( return deserialized # type: ignore @overload - async def create_async( + async def pending_create_version( self, name: str, version: str, - body: _models.ModelVersion, + model_version: _models.ModelVersion, *, content_type: str = "application/json", **kwargs: Any @@ -9553,8 +9539,8 @@ async def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Required. - :type body: ~azure.ai.projects.models.ModelVersion + :param model_version: Model version to create. Required. + :type model_version: ~azure.ai.projects.models.ModelVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9564,8 +9550,8 @@ async def create_async( """ @overload - async def create_async( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + async def pending_create_version( + self, name: str, version: str, model_version: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.CreateAsyncResponse: """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling. @@ -9574,8 +9560,8 @@ async def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Required. - :type body: JSON + :param model_version: Model version to create. Required. + :type model_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9585,8 +9571,14 @@ async def create_async( """ @overload - async def create_async( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + async def pending_create_version( + self, + name: str, + version: str, + model_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.CreateAsyncResponse: """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling. @@ -9595,8 +9587,8 @@ async def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Required. - :type body: IO[bytes] + :param model_version: Model version to create. Required. + :type model_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9606,8 +9598,8 @@ async def create_async( """ @distributed_trace_async - async def create_async( - self, name: str, version: str, body: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any + async def pending_create_version( + self, name: str, version: str, model_version: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any ) -> _models.CreateAsyncResponse: """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling. @@ -9616,9 +9608,9 @@ async def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Is one of the following types: ModelVersion, JSON, - IO[bytes] Required. - :type body: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] + :param model_version: Model version to create. Is one of the following types: ModelVersion, + JSON, IO[bytes] Required. + :type model_version: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.CreateAsyncResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -9639,12 +9631,12 @@ async def create_async( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(model_version, (IOBase, bytes)): + _content = model_version else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(model_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_models_create_async_request( + _request = build_beta_models_pending_create_version_request( name=name, version=version, content_type=content_type, @@ -9693,7 +9685,7 @@ async def pending_upload( self, name: str, version: str, - body: _models.ModelPendingUploadRequest, + pending_upload_request: _models.ModelPendingUploadRequest, *, content_type: str = "application/json", **kwargs: Any @@ -9704,8 +9696,8 @@ async def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: ~azure.ai.projects.models.ModelPendingUploadRequest + :param pending_upload_request: Required. + :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9717,7 +9709,13 @@ async def pending_upload( @overload async def pending_upload( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ModelPendingUploadResponse: """Start or retrieve a pending upload for a model version. @@ -9725,8 +9723,8 @@ async def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: JSON + :param pending_upload_request: Required. + :type pending_upload_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9738,7 +9736,13 @@ async def pending_upload( @overload async def pending_upload( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ModelPendingUploadResponse: """Start or retrieve a pending upload for a model version. @@ -9746,8 +9750,8 @@ async def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: IO[bytes] + :param pending_upload_request: Required. + :type pending_upload_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9759,7 +9763,11 @@ async def pending_upload( @distributed_trace_async async def pending_upload( - self, name: str, version: str, body: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + version: str, + pending_upload_request: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], + **kwargs: Any ) -> _models.ModelPendingUploadResponse: """Start or retrieve a pending upload for a model version. @@ -9767,9 +9775,10 @@ async def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Is one of the following types: ModelPendingUploadRequest, JSON, IO[bytes] - Required. - :type body: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or IO[bytes] + :param pending_upload_request: Is one of the following types: ModelPendingUploadRequest, JSON, + IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or + IO[bytes] :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse @@ -9791,10 +9800,10 @@ async def pending_upload( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_beta_models_pending_upload_request( name=name, @@ -9842,7 +9851,7 @@ async def get_credentials( self, name: str, version: str, - body: _models.ModelCredentialRequest, + credential_request: _models.ModelCredentialRequest, *, content_type: str = "application/json", **kwargs: Any @@ -9853,8 +9862,8 @@ async def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: ~azure.ai.projects.models.ModelCredentialRequest + :param credential_request: Required. + :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9865,7 +9874,13 @@ async def get_credentials( @overload async def get_credentials( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.DatasetCredential: """Get credentials for a model version asset. @@ -9873,8 +9888,8 @@ async def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: JSON + :param credential_request: Required. + :type credential_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9885,7 +9900,13 @@ async def get_credentials( @overload async def get_credentials( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.DatasetCredential: """Get credentials for a model version asset. @@ -9893,8 +9914,8 @@ async def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: IO[bytes] + :param credential_request: Required. + :type credential_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9905,7 +9926,11 @@ async def get_credentials( @distributed_trace_async async def get_credentials( - self, name: str, version: str, body: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + version: str, + credential_request: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], + **kwargs: Any ) -> _models.DatasetCredential: """Get credentials for a model version asset. @@ -9913,8 +9938,9 @@ async def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Is one of the following types: ModelCredentialRequest, JSON, IO[bytes] Required. - :type body: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] + :param credential_request: Is one of the following types: ModelCredentialRequest, JSON, + IO[bytes] Required. + :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: @@ -9935,10 +9961,10 @@ async def get_credentials( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(credential_request, (IOBase, bytes)): + _content = credential_request else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_beta_models_get_credentials_request( name=name, @@ -10107,10 +10133,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -10896,14 +10919,14 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @overload - async def dispatch_async( + async def dispatch( self, routine_name: str, *, content_type: str = "application/json", payload: Optional[_models.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -10914,15 +10937,15 @@ async def dispatch_async( :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def dispatch_async( + async def dispatch( self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -10932,15 +10955,15 @@ async def dispatch_async( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def dispatch_async( + async def dispatch( self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -10950,20 +10973,20 @@ async def dispatch_async( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def dispatch_async( + async def dispatch( self, routine_name: str, body: Union[JSON, IO[bytes]] = _Unset, *, payload: Optional[_models.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -10973,8 +10996,8 @@ async def dispatch_async( :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10989,7 +11012,7 @@ async def dispatch_async( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DispatchRoutineResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.DispatchRoutineResult] = kwargs.pop("cls", None) if body is _Unset: body = {"payload": payload} @@ -11001,7 +11024,7 @@ async def dispatch_async( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_routines_dispatch_async_request( + _request = build_beta_routines_dispatch_request( routine_name=routine_name, content_type=content_type, api_version=self._config.api_version, @@ -11038,7 +11061,7 @@ async def dispatch_async( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DispatchRoutineResponse, response.json()) + deserialized = _deserialize(_models.DispatchRoutineResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11232,10 +11255,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11535,10 +11555,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 29b38664a588..46a4d7a9e456 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -69,7 +69,7 @@ async def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -160,7 +160,7 @@ async def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py index 1b8c85aace5a..18cf2f3c5d96 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py @@ -118,12 +118,12 @@ DatasetVersion, DeleteAgentResponse, DeleteAgentVersionResponse, - DeleteMemoryResponse, + DeleteMemoryResult, DeleteMemoryStoreResult, DeleteSkillResult, Deployment, Dimension, - DispatchRoutineResponse, + DispatchRoutineResult, EmbeddingConfiguration, EntraAuthorizationScheme, EntraIDCredentials, @@ -251,7 +251,7 @@ OptimizationTaskResult, OtlpTelemetryEndpoint, PendingUploadRequest, - PendingUploadResult, + PendingUploadResponse, ProceduralMemoryItem, PromptAgentDefinition, PromptAgentDefinitionTextOptions, @@ -540,12 +540,12 @@ "DatasetVersion", "DeleteAgentResponse", "DeleteAgentVersionResponse", - "DeleteMemoryResponse", + "DeleteMemoryResult", "DeleteMemoryStoreResult", "DeleteSkillResult", "Deployment", "Dimension", - "DispatchRoutineResponse", + "DispatchRoutineResult", "EmbeddingConfiguration", "EntraAuthorizationScheme", "EntraIDCredentials", @@ -673,7 +673,7 @@ "OptimizationTaskResult", "OtlpTelemetryEndpoint", "PendingUploadRequest", - "PendingUploadResult", + "PendingUploadResponse", "ProceduralMemoryItem", "PromptAgentDefinition", "PromptAgentDefinitionTextOptions", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py index f728019a7cb4..e1cd128d2703 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py @@ -76,8 +76,8 @@ class AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ACTIVITY.""" RESPONSES = "responses" """RESPONSES.""" - A2A = "a2a" - """A2A.""" + A2_A = "a2a" + """A2_A.""" MCP = "mcp" """MCP.""" INVOCATIONS = "invocations" @@ -825,8 +825,8 @@ class RankerVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO = "auto" """AUTO.""" - DEFAULT_2024_11_15 = "default-2024-11-15" - """DEFAULT_2024_11_15.""" + DEFAULT2024_11_15 = "default-2024-11-15" + """DEFAULT2024_11_15.""" class RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1050,8 +1050,8 @@ class ToolChoiceParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """WEB_SEARCH_PREVIEW.""" COMPUTER_USE_PREVIEW = "computer_use_preview" """COMPUTER_USE_PREVIEW.""" - WEB_SEARCH_PREVIEW_2025_03_11 = "web_search_preview_2025_03_11" - """WEB_SEARCH_PREVIEW_2025_03_11.""" + WEB_SEARCH_PREVIEW2025_03_11 = "web_search_preview_2025_03_11" + """WEB_SEARCH_PREVIEW2025_03_11.""" IMAGE_GENERATION = "image_generation" """IMAGE_GENERATION.""" CODE_INTERPRETER = "code_interpreter" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py index b73ace6881df..aa1737d11b26 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py @@ -4077,7 +4077,7 @@ class CronTrigger(Trigger, discriminator="Cron"): :vartype type: str or ~azure.ai.projects.models.CRON :ivar expression: Cron expression that defines the schedule frequency. Required. :vartype expression: str - :ivar time_zone: Time zone for the cron schedule. + :ivar time_zone: Time zone for the cron schedule. Defaults to ``UTC``. :vartype time_zone: str :ivar start_time: Start time for the cron schedule in ISO 8601 format. :vartype start_time: ~datetime.datetime @@ -4090,7 +4090,7 @@ class CronTrigger(Trigger, discriminator="Cron"): expression: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Cron expression that defines the schedule frequency. Required.""" time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) - """Time zone for the cron schedule.""" + """Time zone for the cron schedule. Defaults to ``UTC``.""" start_time: Optional[datetime.datetime] = rest_field( name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) @@ -5161,7 +5161,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DeleteMemoryResponse(_Model): +class DeleteMemoryResult(_Model): """Response for deleting a memory item from a memory store. :ivar object: The object type. Always 'memory_store.item.deleted'. Required. MEMORY_DELETED. @@ -5329,7 +5329,7 @@ class Dimension(_Model): :ivar always_applicable: When true, the LLM judge always scores this dimension regardless of relevance (skips applicability assessment). The service-generated general quality/policy dimension has this set to true and is non-editable. Users may set this on their own custom - dimensions. + dimensions. Defaults to ``false``. :vartype always_applicable: bool """ @@ -5347,7 +5347,8 @@ class Dimension(_Model): always_applicable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """When true, the LLM judge always scores this dimension regardless of relevance (skips applicability assessment). The service-generated general quality/policy dimension has this set - to true and is non-editable. Users may set this on their own custom dimensions.""" + to true and is non-editable. Users may set this on their own custom dimensions. Defaults to + ``false``.""" @overload def __init__( @@ -5370,7 +5371,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DispatchRoutineResponse(_Model): +class DispatchRoutineResult(_Model): """Identifiers returned after a routine dispatch is queued. :ivar dispatch_id: The dispatch identifier created for the routine dispatch. @@ -9384,14 +9385,14 @@ class MemoryStoreDefaultOptions(_Model): :ivar user_profile_details: Specific categories or types of user profile information to extract and store. :vartype user_profile_details: str - :ivar chat_summary_enabled: Whether to enable chat summary extraction and storage. Default is - true. Required. + :ivar chat_summary_enabled: Whether to enable chat summary extraction and storage. Defaults to + ``true``. Required. :vartype chat_summary_enabled: bool :ivar procedural_memory_enabled: Whether to enable procedural memory extraction and storage. - Default is true. + Defaults to ``true``. :vartype procedural_memory_enabled: bool - :ivar default_ttl_seconds: The default time-to-live for memories in seconds. A value of 0 - indicates that memories do not expire. + :ivar default_ttl_seconds: The default time-to-live for memories in seconds. A value of ``0`` + indicates that memories do not expire. Defaults to ``0``. :vartype default_ttl_seconds: int """ @@ -9400,12 +9401,12 @@ class MemoryStoreDefaultOptions(_Model): user_profile_details: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Specific categories or types of user profile information to extract and store.""" chat_summary_enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether to enable chat summary extraction and storage. Default is true. Required.""" + """Whether to enable chat summary extraction and storage. Defaults to ``true``. Required.""" procedural_memory_enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether to enable procedural memory extraction and storage. Default is true.""" + """Whether to enable procedural memory extraction and storage. Defaults to ``true``.""" default_ttl_seconds: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The default time-to-live for memories in seconds. A value of 0 indicates that memories do not - expire.""" + """The default time-to-live for memories in seconds. A value of ``0`` indicates that memories do + not expire. Defaults to ``0``.""" @overload def __init__( @@ -10260,7 +10261,7 @@ class OneTimeTrigger(Trigger, discriminator="OneTime"): :vartype type: str or ~azure.ai.projects.models.ONE_TIME :ivar trigger_at: Date and time for the one-time trigger in ISO 8601 format. Required. :vartype trigger_at: ~datetime.datetime - :ivar time_zone: Time zone for the one-time trigger. + :ivar time_zone: Time zone for the one-time trigger. Defaults to ``UTC``. :vartype time_zone: str """ @@ -10271,7 +10272,7 @@ class OneTimeTrigger(Trigger, discriminator="OneTime"): ) """Date and time for the one-time trigger in ISO 8601 format. Required.""" time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) - """Time zone for the one-time trigger.""" + """Time zone for the one-time trigger. Defaults to ``UTC``.""" @overload def __init__( @@ -11430,7 +11431,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PendingUploadResult(_Model): +class PendingUploadResponse(_Model): """Represents the response for a pending upload request. :ivar blob_reference: Container-level read, write, list SAS. Required. @@ -11537,14 +11538,13 @@ class PromptAgentDefinition(AgentDefinition, discriminator="prompt"): :vartype instructions: str :ivar temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and - deterministic. We generally recommend altering this or ``top_p`` but not both. + deterministic. We generally recommend altering this or ``top_p`` but not both. Defaults to + ``1``. :vartype temperature: float - :ivar top_p: An alternative to sampling with temperature, called nucleus sampling, - where the model considers the results of the tokens with top_p probability - mass. So 0.1 means only the tokens comprising the top 10% probability mass - are considered. - - We generally recommend altering this or ``temperature`` but not both. + :ivar top_p: An alternative to sampling with temperature, called nucleus sampling, where the + model considers the results of the tokens with top_p probability mass. So 0.1 means only the + tokens comprising the top 10% probability mass are considered. We generally recommend altering + this or ``temperature`` but not both. Defaults to ``1``. :vartype top_p: float :ivar reasoning: :vartype reasoning: ~azure.ai.projects.models.Reasoning @@ -11572,14 +11572,12 @@ class PromptAgentDefinition(AgentDefinition, discriminator="prompt"): temperature: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We - generally recommend altering this or ``top_p`` but not both.""" + generally recommend altering this or ``top_p`` but not both. Defaults to ``1``.""" top_p: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An alternative to sampling with temperature, called nucleus sampling, - where the model considers the results of the tokens with top_p probability - mass. So 0.1 means only the tokens comprising the top 10% probability mass - are considered. - - We generally recommend altering this or ``temperature`` but not both.""" + """An alternative to sampling with temperature, called nucleus sampling, where the model considers + the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising + the top 10% probability mass are considered. We generally recommend altering this or + ``temperature`` but not both. Defaults to ``1``.""" reasoning: Optional["_models.Reasoning"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) tools: Optional[list["_models.Tool"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """An array of tools the model may call while generating a response. You can specify which tool to @@ -11958,7 +11956,7 @@ class RecurrenceTrigger(Trigger, discriminator="Recurrence"): :vartype start_time: ~datetime.datetime :ivar end_time: End time for the recurrence schedule in ISO 8601 format. :vartype end_time: ~datetime.datetime - :ivar time_zone: Time zone for the recurrence schedule. + :ivar time_zone: Time zone for the recurrence schedule. Defaults to ``UTC``. :vartype time_zone: str :ivar interval: Interval for the recurrence schedule. Required. :vartype interval: int @@ -11977,7 +11975,7 @@ class RecurrenceTrigger(Trigger, discriminator="Recurrence"): ) """End time for the recurrence schedule in ISO 8601 format.""" time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) - """Time zone for the recurrence schedule.""" + """Time zone for the recurrence schedule. Defaults to ``UTC``.""" interval: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Interval for the recurrence schedule. Required.""" schedule: "_models.RecurrenceSchedule" = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -12781,10 +12779,12 @@ class SessionLogEvent(_Model): .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server + on port 18080"} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully + connected to container"}. :ivar event: The SSE event type. Currently ``log``, but additional event types may be added in the future. Clients should ignore unrecognized event types. Required. "log" @@ -13160,7 +13160,8 @@ class StructuredInputDefinition(_Model): :vartype default_value: any :ivar schema: The JSON schema for the structured input (optional). :vartype schema: dict[str, any] - :ivar required: Whether the input property is required when the agent is invoked. + :ivar required: Whether the input property is required when the agent is invoked. Defaults to + ``false``. :vartype required: bool """ @@ -13171,7 +13172,7 @@ class StructuredInputDefinition(_Model): schema: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The JSON schema for the structured input (optional).""" required: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether the input property is required when the agent is invoked.""" + """Whether the input property is required when the agent is invoked. Defaults to ``false``.""" @overload def __init__( @@ -13825,7 +13826,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): or a Literal["required"] type. :vartype mode: str or str :ivar tools: A list of tool definitions that the model should be allowed to call. For the - Responses API, the list of tool definitions might look like the following. Required. + Responses API, the list of tool definitions might look like: .. code-block:: json @@ -13833,7 +13834,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): { "type": "function", "name": "get_weather" }, { "type": "mcp", "server_label": "deepwiki" }, { "type": "image_generation" } - ] + ]. Required. :vartype tools: list[dict[str, any]] """ @@ -13846,7 +13847,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): Literal[\"required\"] type.""" tools: list[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """A list of tool definitions that the model should be allowed to call. For the Responses API, the - list of tool definitions might look like the following. Required. + list of tool definitions might look like: .. code-block:: json @@ -13854,7 +13855,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): { \"type\": \"function\", \"name\": \"get_weather\" }, { \"type\": \"mcp\", \"server_label\": \"deepwiki\" }, { \"type\": \"image_generation\" } - ]""" + ]. Required.""" @overload def __init__( @@ -14123,12 +14124,12 @@ class ToolChoiceWebSearchPreview20250311(ToolChoiceParam, discriminator="web_sea """Indicates that the model should use a built-in tool to generate a response. `Learn more about built-in tools `_. - :ivar type: Required. WEB_SEARCH_PREVIEW_2025_03_11. - :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_PREVIEW_2025_03_11 + :ivar type: Required. WEB_SEARCH_PREVIEW2025_03_11. + :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_PREVIEW2025_03_11 """ - type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. WEB_SEARCH_PREVIEW_2025_03_11.""" + type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW2025_03_11] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. WEB_SEARCH_PREVIEW2025_03_11.""" @overload def __init__( @@ -14144,7 +14145,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11 # type: ignore + self.type = ToolChoiceParamType.WEB_SEARCH_PREVIEW2025_03_11 # type: ignore class ToolConfig(_Model): diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 7a758cf07acd..8ea45d846c31 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -860,7 +860,7 @@ def build_beta_agents_create_version_from_code_request( # pylint: disable=name- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_download_agent_code_request( # pylint: disable=name-too-long +def build_beta_agents_download_code_request( agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2506,7 +2506,9 @@ def build_beta_models_update_request(name: str, version: str, **kwargs: Any) -> return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_models_create_async_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_beta_models_pending_create_version_request( # pylint: disable=name-too-long + name: str, version: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2853,9 +2855,7 @@ def build_beta_routines_list_runs_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_routines_dispatch_async_request( # pylint: disable=name-too-long - routine_name: str, **kwargs: Any -) -> HttpRequest: +def build_beta_routines_dispatch_request(routine_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3693,8 +3693,8 @@ def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any :param agent_name: The name of the agent to delete. Required. :type agent_name: str :keyword force: For Hosted Agents, if true, force-deletes the agent even if its versions have - active sessions, cascading deletion to all associated sessions. This value is not relevant for - other Agent types. Defaults to false. Default value is None. + active sessions, cascading deletion to all associated sessions. Defaults to ``false``. This + value is not relevant for other Agent types. Default value is None. :paramtype force: bool :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DeleteAgentResponse @@ -4344,8 +4344,8 @@ def delete_version( :param agent_version: The version of the agent to delete. Required. :type agent_version: str :keyword force: For Hosted Agents, if true, force-deletes the version even if it has active - sessions, cascading deletion to all associated sessions. This value is not relevant for other - Agent types. Defaults to false. Default value is None. + sessions, cascading deletion to all associated sessions. Defaults to ``false``. This value is + not relevant for other Agent types. Default value is None. :paramtype force: bool :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with MutableMapping @@ -5586,7 +5586,7 @@ def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -5598,8 +5598,8 @@ def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5612,7 +5612,7 @@ def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -5624,8 +5624,8 @@ def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5638,7 +5638,7 @@ def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -5650,8 +5650,8 @@ def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5662,7 +5662,7 @@ def pending_upload( version: str, pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of a dataset for a specific version. :param name: The name of the resource. Required. @@ -5673,8 +5673,8 @@ def pending_upload( types: PendingUploadRequest, JSON, IO[bytes] Required. :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or IO[bytes] - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5689,7 +5689,7 @@ def pending_upload( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -5732,7 +5732,7 @@ def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResult, response.json()) + deserialized = _deserialize(_models.PendingUploadResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6762,9 +6762,7 @@ def create_version_from_code( return deserialized # type: ignore @distributed_trace - def download_agent_code( - self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: + def download_code(self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any) -> Iterator[bytes]: """Download the code zip for a code-based hosted agent. Returns the previously-uploaded zip (``application/zip``). @@ -6796,7 +6794,7 @@ def download_agent_code( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_agents_download_agent_code_request( + _request = build_beta_agents_download_code_request( agent_name=agent_name, agent_version=agent_version, api_version=self._config.api_version, @@ -7278,23 +7276,29 @@ def get_session_log_stream( Each SSE frame contains: * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) + * `data`: a plain-text log line (currently JSON-formatted, but the schema + is not contractual and may include additional keys or change format + over time — clients should treat it as an opaque string) Example SSE frames: .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting + FoundryCBAgent server on port 8088"} event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application + startup complete."} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully + connected to container"} event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since + last 60 seconds"} The stream remains open until the client disconnects or the server terminates the connection. Clients should handle reconnection as needed. @@ -7336,7 +7340,7 @@ def get_session_log_stream( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8616,10 +8620,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9049,10 +9050,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9152,10 +9150,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9611,7 +9606,7 @@ def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -9623,8 +9618,8 @@ def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9637,7 +9632,7 @@ def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -9649,8 +9644,8 @@ def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9663,7 +9658,7 @@ def pending_upload( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -9675,8 +9670,8 @@ def pending_upload( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9687,7 +9682,7 @@ def pending_upload( version: str, pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], **kwargs: Any - ) -> _models.PendingUploadResult: + ) -> _models.PendingUploadResponse: """Start a new or get an existing pending upload of an evaluator for a specific version. :param name: Required. @@ -9698,8 +9693,8 @@ def pending_upload( types: PendingUploadRequest, JSON, IO[bytes] Required. :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or IO[bytes] - :return: PendingUploadResult. The PendingUploadResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResult + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9714,7 +9709,7 @@ def pending_upload( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -9761,7 +9756,7 @@ def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResult, response.json()) + deserialized = _deserialize(_models.PendingUploadResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10668,10 +10663,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11339,7 +11331,7 @@ def _search_memories( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items": items, + "items_property": items, "options": options, "previous_search_id": previous_search_id, "scope": scope, @@ -11425,7 +11417,7 @@ def _update_memories_initial( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items": items, + "items_property": items, "previous_update_id": previous_update_id, "scope": scope, "update_delay": update_delay, @@ -12322,14 +12314,6 @@ def list_memories( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) - - # BUG? These lines were inside the prepare_request() method. Moved here instead. - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = {"scope": scope} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -12338,6 +12322,12 @@ def list_memories( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(_continuation_token=None): + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = {"scope": scope} + body = {k: v for k, v in body.items() if v is not None} + _request = build_beta_memory_stores_list_memories_request( name=name, kind=kind, @@ -12389,15 +12379,15 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResponse: + def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResult: """Delete a memory item from a memory store. :param name: The name of the memory store. Required. :type name: str :param memory_id: The ID of the memory item to delete. Required. :type memory_id: str - :return: DeleteMemoryResponse. The DeleteMemoryResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryResponse + :return: DeleteMemoryResult. The DeleteMemoryResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteMemoryResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12411,7 +12401,7 @@ def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Del _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.DeleteMemoryResult] = kwargs.pop("cls", None) _request = build_beta_memory_stores_delete_memory_request( name=name, @@ -12449,7 +12439,7 @@ def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Del if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryResponse, response.json()) + deserialized = _deserialize(_models.DeleteMemoryResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12524,10 +12514,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12612,10 +12599,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12926,11 +12910,11 @@ def update( return deserialized # type: ignore @overload - def create_async( + def pending_create_version( self, name: str, version: str, - body: _models.ModelVersion, + model_version: _models.ModelVersion, *, content_type: str = "application/json", **kwargs: Any @@ -12942,8 +12926,8 @@ def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Required. - :type body: ~azure.ai.projects.models.ModelVersion + :param model_version: Model version to create. Required. + :type model_version: ~azure.ai.projects.models.ModelVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -12953,8 +12937,8 @@ def create_async( """ @overload - def create_async( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + def pending_create_version( + self, name: str, version: str, model_version: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.CreateAsyncResponse: """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling. @@ -12963,8 +12947,8 @@ def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Required. - :type body: JSON + :param model_version: Model version to create. Required. + :type model_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -12974,8 +12958,14 @@ def create_async( """ @overload - def create_async( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + def pending_create_version( + self, + name: str, + version: str, + model_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.CreateAsyncResponse: """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling. @@ -12984,8 +12974,8 @@ def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Required. - :type body: IO[bytes] + :param model_version: Model version to create. Required. + :type model_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -12995,8 +12985,8 @@ def create_async( """ @distributed_trace - def create_async( - self, name: str, version: str, body: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any + def pending_create_version( + self, name: str, version: str, model_version: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any ) -> _models.CreateAsyncResponse: """Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling. @@ -13005,9 +12995,9 @@ def create_async( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Model version to create. Is one of the following types: ModelVersion, JSON, - IO[bytes] Required. - :type body: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] + :param model_version: Model version to create. Is one of the following types: ModelVersion, + JSON, IO[bytes] Required. + :type model_version: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.CreateAsyncResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -13028,12 +13018,12 @@ def create_async( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(model_version, (IOBase, bytes)): + _content = model_version else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(model_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_models_create_async_request( + _request = build_beta_models_pending_create_version_request( name=name, version=version, content_type=content_type, @@ -13082,7 +13072,7 @@ def pending_upload( self, name: str, version: str, - body: _models.ModelPendingUploadRequest, + pending_upload_request: _models.ModelPendingUploadRequest, *, content_type: str = "application/json", **kwargs: Any @@ -13093,8 +13083,8 @@ def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: ~azure.ai.projects.models.ModelPendingUploadRequest + :param pending_upload_request: Required. + :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13106,7 +13096,13 @@ def pending_upload( @overload def pending_upload( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ModelPendingUploadResponse: """Start or retrieve a pending upload for a model version. @@ -13114,8 +13110,8 @@ def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: JSON + :param pending_upload_request: Required. + :type pending_upload_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13127,7 +13123,13 @@ def pending_upload( @overload def pending_upload( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ModelPendingUploadResponse: """Start or retrieve a pending upload for a model version. @@ -13135,8 +13137,8 @@ def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: IO[bytes] + :param pending_upload_request: Required. + :type pending_upload_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -13148,7 +13150,11 @@ def pending_upload( @distributed_trace def pending_upload( - self, name: str, version: str, body: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + version: str, + pending_upload_request: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], + **kwargs: Any ) -> _models.ModelPendingUploadResponse: """Start or retrieve a pending upload for a model version. @@ -13156,9 +13162,10 @@ def pending_upload( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Is one of the following types: ModelPendingUploadRequest, JSON, IO[bytes] - Required. - :type body: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or IO[bytes] + :param pending_upload_request: Is one of the following types: ModelPendingUploadRequest, JSON, + IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or + IO[bytes] :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse @@ -13180,10 +13187,10 @@ def pending_upload( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_beta_models_pending_upload_request( name=name, @@ -13231,7 +13238,7 @@ def get_credentials( self, name: str, version: str, - body: _models.ModelCredentialRequest, + credential_request: _models.ModelCredentialRequest, *, content_type: str = "application/json", **kwargs: Any @@ -13242,8 +13249,8 @@ def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: ~azure.ai.projects.models.ModelCredentialRequest + :param credential_request: Required. + :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13254,7 +13261,13 @@ def get_credentials( @overload def get_credentials( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.DatasetCredential: """Get credentials for a model version asset. @@ -13262,8 +13275,8 @@ def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: JSON + :param credential_request: Required. + :type credential_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -13274,7 +13287,13 @@ def get_credentials( @overload def get_credentials( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.DatasetCredential: """Get credentials for a model version asset. @@ -13282,8 +13301,8 @@ def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Required. - :type body: IO[bytes] + :param credential_request: Required. + :type credential_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -13294,7 +13313,11 @@ def get_credentials( @distributed_trace def get_credentials( - self, name: str, version: str, body: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + version: str, + credential_request: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], + **kwargs: Any ) -> _models.DatasetCredential: """Get credentials for a model version asset. @@ -13302,8 +13325,9 @@ def get_credentials( :type name: str :param version: Version of the model. Required. :type version: str - :param body: Is one of the following types: ModelCredentialRequest, JSON, IO[bytes] Required. - :type body: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] + :param credential_request: Is one of the following types: ModelCredentialRequest, JSON, + IO[bytes] Required. + :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: @@ -13324,10 +13348,10 @@ def get_credentials( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(credential_request, (IOBase, bytes)): + _content = credential_request else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_beta_models_get_credentials_request( name=name, @@ -13496,10 +13520,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -14283,14 +14304,14 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @overload - def dispatch_async( + def dispatch( self, routine_name: str, *, content_type: str = "application/json", payload: Optional[_models.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -14301,15 +14322,15 @@ def dispatch_async( :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def dispatch_async( + def dispatch( self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -14319,15 +14340,15 @@ def dispatch_async( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def dispatch_async( + def dispatch( self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -14337,20 +14358,20 @@ def dispatch_async( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def dispatch_async( + def dispatch( self, routine_name: str, body: Union[JSON, IO[bytes]] = _Unset, *, payload: Optional[_models.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResponse: + ) -> _models.DispatchRoutineResult: """Queue an asynchronous routine dispatch. :param routine_name: The unique name of the routine. Required. @@ -14360,8 +14381,8 @@ def dispatch_async( :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResponse. The DispatchRoutineResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResponse + :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14376,7 +14397,7 @@ def dispatch_async( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DispatchRoutineResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.DispatchRoutineResult] = kwargs.pop("cls", None) if body is _Unset: body = {"payload": payload} @@ -14388,7 +14409,7 @@ def dispatch_async( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_routines_dispatch_async_request( + _request = build_beta_routines_dispatch_request( routine_name=routine_name, content_type=content_type, api_version=self._config.api_version, @@ -14425,7 +14446,7 @@ def dispatch_async( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DispatchRoutineResponse, response.json()) + deserialized = _deserialize(_models.DispatchRoutineResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14619,10 +14640,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( @@ -14922,10 +14940,7 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - params=_next_request_params, - headers=_headers, + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) path_format_arguments = { "endpoint": self._serialize.url( diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index b79e64ba0781..a2f129f1dae1 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -21,6 +21,7 @@ _PREVIEW_FEATURE_ADDED_ERROR_MESSAGE, ) + class AgentsOperations(GeneratedAgentsOperations): """ .. warning:: @@ -68,7 +69,7 @@ def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -186,7 +187,7 @@ def create_version( ) except HttpResponseError as exc: """ - Example service response payload when the caller is trying to use a feature preview without opt-in flag (service error 403 (Forbidden)): + Example service response payload when the caller is trying to use a feature preview without opt-in flag (service error 403 (Forbidden)): "error": { "code": "preview_feature_required", diff --git a/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py b/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py index af98d794a98d..0e0f776441cf 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py +++ b/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py @@ -18,7 +18,8 @@ from typing import Final -agent_tools_instructions: Final[str] = """ +agent_tools_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a tool-driven assistant workflow. @@ -43,9 +44,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -memories_instructions: Final[str] = """ +memories_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a memories workflow. @@ -70,9 +73,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -agents_instructions: Final[str] = """ +agents_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct. @@ -103,9 +108,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -chat_completions_instructions: Final[str] = """ +chat_completions_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for Chat Completions scenarios. @@ -124,9 +131,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -resource_management_instructions: Final[str] = """ +resource_management_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for resource-management samples (for example connections, files, and deployments). @@ -152,9 +161,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -fine_tuning_instructions: Final[str] = """ +fine_tuning_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a fine-tuning workflow. @@ -178,9 +189,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -evaluations_instructions: Final[str] = """ +evaluations_instructions: Final[str] = ( + """ We just ran Python code for an evaluation sample and captured print/log output in an attached log file (TXT). Your job: determine if the sample code executed to completion WITHOUT throwing an unhandled exception. @@ -202,9 +215,11 @@ Always respond with `reason` indicating the reason for the response. """.strip() +) -hosted_agents_instructions: Final[str] = """ +hosted_agents_instructions: Final[str] = ( + """ We just ran Python code for a hosted-agent sample and captured print/log output in an attached log file (TXT). Validate whether the sample executed correctly. @@ -226,6 +241,7 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) # Folder (under samples/) -> instructions. diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml index 18c876d87f07..1d28b6a52b56 100644 --- a/sdk/ai/azure-ai-projects/tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai-foundry/data-plane/Foundry -commit: 18ccc2a0bfd5cccccf78608f9faaa88185c66f5a +commit: 53fbe53ff36e1d41dc9d12dbfd949182b07a88bf repo: Azure/azure-rest-api-specs additionalDirectories: From c9e5c9236bba81d64e7830bec023977c737fcef5 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 21 May 2026 15:28:29 -0700 Subject: [PATCH 2/4] Part 2: Apply post-emitter-fixes.cmd Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../azure/ai/projects/_utils/utils.py | 18 +++-- .../ai/projects/aio/operations/_operations.py | 67 ++++++++++++------- .../azure/ai/projects/models/_enums.py | 12 ++-- .../azure/ai/projects/models/_models.py | 24 +++---- .../ai/projects/operations/_operations.py | 67 ++++++++++++------- 5 files changed, 116 insertions(+), 72 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py index bd821750f4c6..a25abbf8a518 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_utils/utils.py @@ -34,6 +34,17 @@ def prepare_multipart_form_data( body: Mapping[str, Any], multipart_fields: list[str], data_fields: list[str] ) -> list[FileType]: files: list[FileType] = [] + + # Append data fields first so they appear before file parts in the encoded + # multipart body. Some streaming server-side parsers (e.g. the Foundry + # hosted-agents `create_agent_version_from_code` endpoint) require small + # JSON metadata parts to precede large binary file parts; otherwise they + # report the metadata part as missing. + for data_field in data_fields: + data_entry = body.get(data_field) + if data_entry: + files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) + for multipart_field in multipart_fields: multipart_entry = body.get(multipart_field) if isinstance(multipart_entry, list): @@ -41,11 +52,4 @@ def prepare_multipart_form_data( elif multipart_entry: files.append((multipart_field, multipart_entry)) - # if files is empty, sdk core library can't handle multipart/form-data correctly, so - # we put data fields into files with filename as None to avoid that scenario. - for data_field in data_fields: - data_entry = body.get(data_field) - if data_entry: - files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) - return files diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 4c8a14cfe79a..95ace8f08900 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -3887,29 +3887,23 @@ async def get_session_log_stream( Each SSE frame contains: * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema - is not contractual and may include additional keys or change format - over time — clients should treat it as an opaque string) + * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) Example SSE frames: .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting - FoundryCBAgent server on port 8088"} + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application - startup complete."} + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully - connected to container"} + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since - last 60 seconds"} + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} The stream remains open until the client disconnects or the server terminates the connection. Clients should handle reconnection as needed. @@ -3951,7 +3945,7 @@ async def get_session_log_stream( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5229,7 +5223,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5659,7 +5656,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5759,7 +5759,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -7275,7 +7278,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -7943,7 +7949,7 @@ async def _search_memories( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items_property": items, + "items": items, "options": options, "previous_search_id": previous_search_id, "scope": scope, @@ -8029,7 +8035,7 @@ async def _update_memories_initial( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items_property": items, + "items": items, "previous_update_id": previous_update_id, "scope": scope, "update_delay": update_delay, @@ -9127,7 +9133,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9212,7 +9221,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -10133,7 +10145,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11255,7 +11270,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11555,7 +11573,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py index e1cd128d2703..f728019a7cb4 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py @@ -76,8 +76,8 @@ class AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ACTIVITY.""" RESPONSES = "responses" """RESPONSES.""" - A2_A = "a2a" - """A2_A.""" + A2A = "a2a" + """A2A.""" MCP = "mcp" """MCP.""" INVOCATIONS = "invocations" @@ -825,8 +825,8 @@ class RankerVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO = "auto" """AUTO.""" - DEFAULT2024_11_15 = "default-2024-11-15" - """DEFAULT2024_11_15.""" + DEFAULT_2024_11_15 = "default-2024-11-15" + """DEFAULT_2024_11_15.""" class RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1050,8 +1050,8 @@ class ToolChoiceParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """WEB_SEARCH_PREVIEW.""" COMPUTER_USE_PREVIEW = "computer_use_preview" """COMPUTER_USE_PREVIEW.""" - WEB_SEARCH_PREVIEW2025_03_11 = "web_search_preview_2025_03_11" - """WEB_SEARCH_PREVIEW2025_03_11.""" + WEB_SEARCH_PREVIEW_2025_03_11 = "web_search_preview_2025_03_11" + """WEB_SEARCH_PREVIEW_2025_03_11.""" IMAGE_GENERATION = "image_generation" """IMAGE_GENERATION.""" CODE_INTERPRETER = "code_interpreter" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py index aa1737d11b26..f904d16f9caa 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py @@ -12779,12 +12779,10 @@ class SessionLogEvent(_Model): .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server - on port 18080"} + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting server on port 18080"} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully - connected to container"}. + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} :ivar event: The SSE event type. Currently ``log``, but additional event types may be added in the future. Clients should ignore unrecognized event types. Required. "log" @@ -13826,7 +13824,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): or a Literal["required"] type. :vartype mode: str or str :ivar tools: A list of tool definitions that the model should be allowed to call. For the - Responses API, the list of tool definitions might look like: + Responses API, the list of tool definitions might look like the following. Required. .. code-block:: json @@ -13834,7 +13832,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): { "type": "function", "name": "get_weather" }, { "type": "mcp", "server_label": "deepwiki" }, { "type": "image_generation" } - ]. Required. + ] :vartype tools: list[dict[str, any]] """ @@ -13847,7 +13845,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): Literal[\"required\"] type.""" tools: list[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """A list of tool definitions that the model should be allowed to call. For the Responses API, the - list of tool definitions might look like: + list of tool definitions might look like the following. Required. .. code-block:: json @@ -13855,7 +13853,7 @@ class ToolChoiceAllowed(ToolChoiceParam, discriminator="allowed_tools"): { \"type\": \"function\", \"name\": \"get_weather\" }, { \"type\": \"mcp\", \"server_label\": \"deepwiki\" }, { \"type\": \"image_generation\" } - ]. Required.""" + ]""" @overload def __init__( @@ -14124,12 +14122,12 @@ class ToolChoiceWebSearchPreview20250311(ToolChoiceParam, discriminator="web_sea """Indicates that the model should use a built-in tool to generate a response. `Learn more about built-in tools `_. - :ivar type: Required. WEB_SEARCH_PREVIEW2025_03_11. - :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_PREVIEW2025_03_11 + :ivar type: Required. WEB_SEARCH_PREVIEW_2025_03_11. + :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_PREVIEW_2025_03_11 """ - type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW2025_03_11] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. WEB_SEARCH_PREVIEW2025_03_11.""" + type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. WEB_SEARCH_PREVIEW_2025_03_11.""" @overload def __init__( @@ -14145,7 +14143,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = ToolChoiceParamType.WEB_SEARCH_PREVIEW2025_03_11 # type: ignore + self.type = ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11 # type: ignore class ToolConfig(_Model): diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 8ea45d846c31..01258eecf8cc 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -7276,29 +7276,23 @@ def get_session_log_stream( Each SSE frame contains: * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema - is not contractual and may include additional keys or change format - over time — clients should treat it as an opaque string) + * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) Example SSE frames: .. code-block:: event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting - FoundryCBAgent server on port 8088"} + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application - startup complete."} + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully - connected to container"} + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since - last 60 seconds"} + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} The stream remains open until the client disconnects or the server terminates the connection. Clients should handle reconnection as needed. @@ -7340,7 +7334,7 @@ def get_session_log_stream( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8620,7 +8614,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9050,7 +9047,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9150,7 +9150,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -10663,7 +10666,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11331,7 +11337,7 @@ def _search_memories( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items_property": items, + "items": items, "options": options, "previous_search_id": previous_search_id, "scope": scope, @@ -11417,7 +11423,7 @@ def _update_memories_initial( if scope is _Unset: raise TypeError("missing required argument: scope") body = { - "items_property": items, + "items": items, "previous_update_id": previous_update_id, "scope": scope, "update_delay": update_delay, @@ -12514,7 +12520,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12599,7 +12608,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -13520,7 +13532,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -14640,7 +14655,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -14940,7 +14958,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + params=_next_request_params, + headers=_headers, ) path_format_arguments = { "endpoint": self._serialize.url( From 72f5f8c861fd12ba1ebbee28227726025dbbc3e7 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 21 May 2026 15:39:52 -0700 Subject: [PATCH 3/4] Part 3: Additional edits Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- sdk/ai/azure-ai-projects/CHANGELOG.md | 7 +++---- .../ai/projects/aio/operations/_patch_datasets_async.py | 4 ++-- .../azure/ai/projects/operations/_patch_datasets.py | 4 ++-- .../hosted_agents/sample_create_hosted_agent_from_code.py | 2 +- .../sample_create_hosted_agent_from_code_async.py | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sdk/ai/azure-ai-projects/CHANGELOG.md b/sdk/ai/azure-ai-projects/CHANGELOG.md index b4e7fcf1ec65..435f53cddf7c 100644 --- a/sdk/ai/azure-ai-projects/CHANGELOG.md +++ b/sdk/ai/azure-ai-projects/CHANGELOG.md @@ -10,10 +10,10 @@ * New optional string properties `description` and `name` added to Agent tools classes which did not have them before. * New optional `tool_configs` added to Agent tool classes. * New `.beta.datasets` sub-client with data generation job operations: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`. -* New `.beta.models` sub-client to handle AI model weights: `list_versions`, `list`, `get`, `delete`, `update`, `create_async`, `pending_upload`, `get_credentials`. -* New `.beta.routines` sub-client with routine operations: `create_or_update`, `get`, `enable`, `disable`, `list`, `delete`, `list_runs`, `dispatch_async`. +* New `.beta.models` sub-client to handle AI model weights: `list_versions`, `list`, `get`, `delete`, `update`, `pending_create_version`, `pending_upload`, `get_credentials`. +* New `.beta.routines` sub-client with routine operations: `create_or_update`, `get`, `enable`, `disable`, `list`, `delete`, `list_runs`, `dispatch`. * New methods on `.beta.evaluators` for evaluator generation jobs: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`. -* New methods on `.beta.agents` for code-based hosted agents: `create_version_from_code`, `download_agent_code`. +* New methods on `.beta.agents` for code-based hosted agents: `create_version_from_code`, `download_code`. * New methods on `.beta.agents` for optimization jobs: `create_optimization_job`, `get_optimization_job`, `list_optimization_jobs`, `cancel_optimization_job`, `list_optimization_candidates`. * New methods on `.beta.memory_stores` to handle individual memory items:`.beta.memory_stores`: `get_memory`, `delete_memory`. * New read-only property `content_hash` on `CodeConfiguration`, returning the SHA-256 hex digest of the uploaded code zip. @@ -33,7 +33,6 @@ Breaking changes in beta classes: * Required property `isolation_key_source` removed from class `EntraAuthorizationScheme`. * Renamed class `AgentEndpoint` to `AgentEndpointConfig`. * Renamed class `DeleteSkillResponse` to `DeleteSkillResult`. -* Renamed class `PendingUploadResponse` to `PendingUploadResult`. * Renamed class `SessionDirectoryListResponse` to `SessionDirectoryListResult`. * Renamed class `SessionFileWriteResponse` to `SessionFileWriteResult`. * Renamed class `SkillObject` to `SkillDetails`. diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_datasets_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_datasets_async.py index f4983d79e7f9..dc7095c827ea 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_datasets_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_datasets_async.py @@ -22,7 +22,7 @@ FileDatasetVersion, FolderDatasetVersion, PendingUploadRequest, - PendingUploadResult, + PendingUploadResponse, PendingUploadType, ) @@ -48,7 +48,7 @@ async def _create_dataset_and_get_its_container_client( connection_name: Optional[str] = None, ) -> Tuple[ContainerClient, str]: - pending_upload_response: PendingUploadResult = await self.pending_upload( + pending_upload_response: PendingUploadResponse = await self.pending_upload( name=name, version=input_version, pending_upload_request=PendingUploadRequest( diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_datasets.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_datasets.py index e8c13ff64627..bf2c0db51271 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_datasets.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_datasets.py @@ -21,7 +21,7 @@ FileDatasetVersion, FolderDatasetVersion, PendingUploadRequest, - PendingUploadResult, + PendingUploadResponse, PendingUploadType, ) @@ -47,7 +47,7 @@ def _create_dataset_and_get_its_container_client( connection_name: Optional[str] = None, ) -> Tuple[ContainerClient, str]: - pending_upload_response: PendingUploadResult = self.pending_upload( + pending_upload_response: PendingUploadResponse = self.pending_upload( name=name, version=input_version, pending_upload_request=PendingUploadRequest( diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py index 1db86d1dee18..cdd4a3396125 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py @@ -114,7 +114,7 @@ version_zip_path = Path(tempfile.gettempdir()) / f"{agent_name}-{created.version}.zip" sha = hashlib.sha256() with open(version_zip_path, "wb") as f: - for chunk in project_client.beta.agents.download_agent_code( + for chunk in project_client.beta.agents.download_code( agent_name=agent_name, agent_version=created.version, ): diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py index 630bb7925a08..cd05ad4b472e 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py @@ -119,7 +119,7 @@ async def main() -> None: # Download the zip for the version we just created, streaming to a temp file. version_zip_path = Path(tempfile.gettempdir()) / f"{agent_name}-{created.version}.zip" sha = hashlib.sha256() - version_stream = await project_client.beta.agents.download_agent_code( + version_stream = await project_client.beta.agents.download_code( agent_name=agent_name, agent_version=created.version, ) From 0c6c93d43f1c2c9ecd55ce9ac3a9157388f419d1 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 21 May 2026 15:56:04 -0700 Subject: [PATCH 4/4] Fix emitted code --- .../azure/ai/projects/aio/operations/_operations.py | 13 ++++++++----- .../azure/ai/projects/operations/_operations.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 95ace8f08900..7a9f6d37dc42 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -8933,6 +8933,14 @@ def list_memories( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) + + # BUG? These lines were inside the prepare_request() method. Moved here instead. + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = {"scope": scope} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -8941,11 +8949,6 @@ def list_memories( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(_continuation_token=None): - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = {"scope": scope} - body = {k: v for k, v in body.items() if v is not None} _request = build_beta_memory_stores_list_memories_request( name=name, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 01258eecf8cc..598044703105 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -12320,6 +12320,14 @@ def list_memories( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) + + # BUG? These lines were inside the prepare_request() method. Moved here instead. + if body is _Unset: + if scope is _Unset: + raise TypeError("missing required argument: scope") + body = {"scope": scope} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -12328,11 +12336,6 @@ def list_memories( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(_continuation_token=None): - if body is _Unset: - if scope is _Unset: - raise TypeError("missing required argument: scope") - body = {"scope": scope} - body = {k: v for k, v in body.items() if v is not None} _request = build_beta_memory_stores_list_memories_request( name=name,