diff --git a/sdk/agentserver/azure-ai-agentserver-responses/_metadata.json b/sdk/agentserver/azure-ai-agentserver-responses/_metadata.json new file mode 100644 index 000000000000..d5e9ee4c04bb --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/_metadata.json @@ -0,0 +1,6 @@ +{ + "apiVersion": "virtual-public-preview", + "apiVersions": { + "Azure.AI.Projects": "virtual-public-preview" + } +} \ No newline at end of file diff --git a/sdk/agentserver/azure-ai-agentserver-responses/apiview-properties.json b/sdk/agentserver/azure-ai-agentserver-responses/apiview-properties.json new file mode 100644 index 000000000000..204a4452fc7b --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/apiview-properties.json @@ -0,0 +1,77 @@ +{ + "CrossLanguagePackageId": "Azure.AI.Projects", + "CrossLanguageDefinitionId": { + "azure.ai.agentserver.responses.models.models.TextResponseFormatConfigurationType": "OpenAI.TextResponseFormatConfigurationType", + "azure.ai.agentserver.responses.models.models.ToolType": "OpenAI.ToolType", + "azure.ai.agentserver.responses.models.models.AzureAISearchQueryType": "Azure.AI.Projects.AzureAISearchQueryType", + "azure.ai.agentserver.responses.models.models.ContainerMemoryLimit": "OpenAI.ContainerMemoryLimit", + "azure.ai.agentserver.responses.models.models.ContainerNetworkPolicyParamType": "OpenAI.ContainerNetworkPolicyParamType", + "azure.ai.agentserver.responses.models.models.ComputerEnvironment": "OpenAI.ComputerEnvironment", + "azure.ai.agentserver.responses.models.models.CustomToolParamFormatType": "OpenAI.CustomToolParamFormatType", + "azure.ai.agentserver.responses.models.models.GrammarSyntax1": "OpenAI.GrammarSyntax1", + "azure.ai.agentserver.responses.models.models.RankerVersionType": "OpenAI.RankerVersionType", + "azure.ai.agentserver.responses.models.models.InputFidelity": "OpenAI.InputFidelity", + "azure.ai.agentserver.responses.models.models.ImageGenActionEnum": "OpenAI.ImageGenActionEnum", + "azure.ai.agentserver.responses.models.models.OpenApiAuthType": "Azure.AI.Projects.OpenApiAuthType", + "azure.ai.agentserver.responses.models.models.FunctionShellToolParamEnvironmentType": "OpenAI.FunctionShellToolParamEnvironmentType", + "azure.ai.agentserver.responses.models.models.ContainerSkillType": "OpenAI.ContainerSkillType", + "azure.ai.agentserver.responses.models.models.SearchContextSize": "OpenAI.SearchContextSize", + "azure.ai.agentserver.responses.models.models.ToolChoiceOptions": "OpenAI.ToolChoiceOptions", + "azure.ai.agentserver.responses.models.models.ToolChoiceParamType": "OpenAI.ToolChoiceParamType", + "azure.ai.agentserver.responses.models.models.ResponseErrorCode": "OpenAI.ResponseErrorCode", + "azure.ai.agentserver.responses.models.models.OutputItemType": "OpenAI.OutputItemType", + "azure.ai.agentserver.responses.models.models.ToolCallStatus": "Azure.AI.Projects.ToolCallStatus", + "azure.ai.agentserver.responses.models.models.ApplyPatchCallStatus": "OpenAI.ApplyPatchCallStatus", + "azure.ai.agentserver.responses.models.models.ApplyPatchFileOperationType": "OpenAI.ApplyPatchFileOperationType", + "azure.ai.agentserver.responses.models.models.ApplyPatchCallOutputStatus": "OpenAI.ApplyPatchCallOutputStatus", + "azure.ai.agentserver.responses.models.models.ComputerActionType": "OpenAI.ComputerActionType", + "azure.ai.agentserver.responses.models.models.ClickButtonType": "OpenAI.ClickButtonType", + "azure.ai.agentserver.responses.models.models.FunctionAndCustomToolCallOutputType": "OpenAI.FunctionAndCustomToolCallOutputType", + "azure.ai.agentserver.responses.models.models.ImageDetail": "OpenAI.ImageDetail", + "azure.ai.agentserver.responses.models.models.MCPToolCallStatus": "OpenAI.MCPToolCallStatus", + "azure.ai.agentserver.responses.models.models.MemoryItemKind": "Azure.AI.Projects.MemoryItemKind", + "azure.ai.agentserver.responses.models.models.MessageStatus": "OpenAI.MessageStatus", + "azure.ai.agentserver.responses.models.models.MessageRole": "OpenAI.MessageRole", + "azure.ai.agentserver.responses.models.models.MessageContentType": "OpenAI.MessageContentType", + "azure.ai.agentserver.responses.models.models.AnnotationType": "OpenAI.AnnotationType", + "azure.ai.agentserver.responses.models.models.OutputMessageContentType": "OpenAI.OutputMessageContentType", + "azure.ai.agentserver.responses.models.models.LocalShellCallStatus": "OpenAI.LocalShellCallStatus", + "azure.ai.agentserver.responses.models.models.FunctionShellCallEnvironmentType": "OpenAI.FunctionShellCallEnvironmentType", + "azure.ai.agentserver.responses.models.models.LocalShellCallOutputStatusEnum": "OpenAI.LocalShellCallOutputStatusEnum", + "azure.ai.agentserver.responses.models.models.FunctionShellCallOutputOutcomeType": "OpenAI.FunctionShellCallOutputOutcomeType", + "azure.ai.agentserver.responses.models.models.ItemType": "OpenAI.ItemType", + "azure.ai.agentserver.responses.models.models.ApplyPatchCallStatusParam": "OpenAI.ApplyPatchCallStatusParam", + "azure.ai.agentserver.responses.models.models.ApplyPatchOperationParamType": "OpenAI.ApplyPatchOperationParamType", + "azure.ai.agentserver.responses.models.models.ApplyPatchCallOutputStatusParam": "OpenAI.ApplyPatchCallOutputStatusParam", + "azure.ai.agentserver.responses.models.models.FunctionCallItemStatus": "OpenAI.FunctionCallItemStatus", + "azure.ai.agentserver.responses.models.models.DetailEnum": "OpenAI.DetailEnum", + "azure.ai.agentserver.responses.models.models.FunctionShellCallItemStatus": "OpenAI.FunctionShellCallItemStatus", + "azure.ai.agentserver.responses.models.models.FunctionShellCallItemParamEnvironmentType": "OpenAI.FunctionShellCallItemParamEnvironmentType", + "azure.ai.agentserver.responses.models.models.FunctionShellCallOutputOutcomeParamType": "OpenAI.FunctionShellCallOutputOutcomeParamType", + "azure.ai.agentserver.responses.models.models.IncludeEnum": "OpenAI.IncludeEnum", + "azure.ai.agentserver.responses.models.models.ResponseStreamEventType": "OpenAI.ResponseStreamEventType", + "azure.ai.agentserver.responses.models.models.OutputContentType": "OpenAI.OutputContentType", + "azure.ai.agentserver.responses.models.models.PageOrder": "Azure.AI.Projects.PageOrder", + "azure.ai.agentserver.responses.models.models.ItemFieldType": "OpenAI.ItemFieldType", + "azure.ai.agentserver.responses.models.models.ModelIdsCompaction": "OpenAI.ModelIdsCompaction", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.create_response": "Azure.AI.Projects.Responses.createResponse", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.create_response": "Azure.AI.Projects.Responses.createResponse", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.create_response_stream": "Azure.AI.Projects.Responses.createResponseStream", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.create_response_stream": "Azure.AI.Projects.Responses.createResponseStream", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.get_response": "Azure.AI.Projects.Responses.getResponse", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.get_response": "Azure.AI.Projects.Responses.getResponse", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.get_response_stream": "Azure.AI.Projects.Responses.getResponseStream", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.get_response_stream": "Azure.AI.Projects.Responses.getResponseStream", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.delete_response": "Azure.AI.Projects.Responses.deleteResponse", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.delete_response": "Azure.AI.Projects.Responses.deleteResponse", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.cancel_response": "Azure.AI.Projects.Responses.cancelResponse", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.cancel_response": "Azure.AI.Projects.Responses.cancelResponse", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.list_input_items": "Azure.AI.Projects.Responses.listInputItems", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.list_input_items": "Azure.AI.Projects.Responses.listInputItems", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.list_responses": "Azure.AI.Projects.Responses.listResponses", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.list_responses": "Azure.AI.Projects.Responses.listResponses", + "azure.ai.agentserver.responses.models.operations.ResponsesOperations.compact_response_conversation": "Azure.AI.Projects.Responses.compactResponseConversation", + "azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations.compact_response_conversation": "Azure.AI.Projects.Responses.compactResponseConversation" + }, + "CrossLanguageVersion": "8daa8c9e22b2" +} \ No newline at end of file diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_client.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_client.py new file mode 100644 index 000000000000..8e9304961d5e --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_client.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +import sys +from typing import Any, TYPE_CHECKING, Union + +from azure.core import PipelineClient +from azure.core.credentials import AzureKeyCredential +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse + +from ._configuration import ProjectsClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ResponsesOperations + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class ProjectsClient: # pylint: disable=client-accepts-api-version-keyword + """ProjectsClient. + + :ivar responses: ResponsesOperations operations + :vartype responses: azure.ai.agentserver.responses.models.operations.ResponsesOperations + :param endpoint: Foundry Project endpoint in the form + "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you + only have one Project in your Foundry Hub, or to target the default Project in your Hub, use + the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". + Required. + :type endpoint: str + :param credential: Credential used to authenticate requests to the service. Is either a key + credential type or a token credential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials.TokenCredential + """ + + def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: + _endpoint = "{endpoint}" + self._config = ProjectsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.responses = ResponsesOperations(self._client, self._config, self._serialize, self._deserialize) + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_configuration.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_configuration.py new file mode 100644 index 000000000000..d8003dceaa12 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING, Union + +from azure.core.credentials import AzureKeyCredential +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class ProjectsClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ProjectsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Foundry Project endpoint in the form + "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you + only have one Project in your Foundry Hub, or to target the default Project in your Hub, use + the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". + Required. + :type endpoint: str + :param credential: Credential used to authenticate requests to the service. Is either a key + credential type or a token credential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials.TokenCredential + """ + + def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.credential_scopes = kwargs.pop("credential_scopes", ["https://ai.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "ai-agentserver-responses/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _infer_policy(self, **kwargs): + if isinstance(self.credential, AzureKeyCredential): + return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs) + if hasattr(self.credential, "get_token"): + return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + raise TypeError(f"Unsupported credential: {self.credential}") + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = self._infer_policy(**kwargs) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_patch.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_unions.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_unions.py new file mode 100644 index 000000000000..d64fad734dab --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_unions.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from . import types as _types +Filters = Union["_types.ComparisonFilter", "_types.CompoundFilter"] +ToolCallOutputContent = Union[dict[str, Any], str, list[Any]] +InputParam = Union[str, list["_types.Item"]] +ConversationParam = Union[str, "_types.ConversationParam_2"] +CreateResponseStreamingResponse = Union[ + "_types.ResponseAudioDeltaEvent", + "_types.ResponseAudioTranscriptDeltaEvent", + "_types.ResponseCodeInterpreterCallCodeDeltaEvent", + "_types.ResponseCodeInterpreterCallInProgressEvent", + "_types.ResponseCodeInterpreterCallInterpretingEvent", + "_types.ResponseContentPartAddedEvent", + "_types.ResponseCreatedEvent", + "_types.ResponseErrorEvent", + "_types.ResponseFileSearchCallInProgressEvent", + "_types.ResponseFileSearchCallSearchingEvent", + "_types.ResponseFunctionCallArgumentsDeltaEvent", + "_types.ResponseInProgressEvent", + "_types.ResponseFailedEvent", + "_types.ResponseIncompleteEvent", + "_types.ResponseOutputItemAddedEvent", + "_types.ResponseReasoningSummaryPartAddedEvent", + "_types.ResponseReasoningSummaryTextDeltaEvent", + "_types.ResponseReasoningTextDeltaEvent", + "_types.ResponseRefusalDeltaEvent", + "_types.ResponseTextDeltaEvent", + "_types.ResponseWebSearchCallInProgressEvent", + "_types.ResponseWebSearchCallSearchingEvent", + "_types.ResponseImageGenCallGeneratingEvent", + "_types.ResponseImageGenCallInProgressEvent", + "_types.ResponseImageGenCallPartialImageEvent", + "_types.ResponseMCPCallArgumentsDeltaEvent", + "_types.ResponseMCPCallFailedEvent", + "_types.ResponseMCPCallInProgressEvent", + "_types.ResponseMCPListToolsFailedEvent", + "_types.ResponseMCPListToolsInProgressEvent", + "_types.ResponseOutputTextAnnotationAddedEvent", + "_types.ResponseQueuedEvent", + "_types.ResponseCustomToolCallInputDeltaEvent", + "_types.ResponseAudioDoneEvent", + "_types.ResponseAudioTranscriptDoneEvent", + "_types.ResponseCodeInterpreterCallCodeDoneEvent", + "_types.ResponseCodeInterpreterCallCompletedEvent", + "_types.ResponseCompletedEvent", + "_types.ResponseContentPartDoneEvent", + "_types.ResponseFileSearchCallCompletedEvent", + "_types.ResponseFunctionCallArgumentsDoneEvent", + "_types.ResponseOutputItemDoneEvent", + "_types.ResponseReasoningSummaryPartDoneEvent", + "_types.ResponseReasoningSummaryTextDoneEvent", + "_types.ResponseReasoningTextDoneEvent", + "_types.ResponseRefusalDoneEvent", + "_types.ResponseTextDoneEvent", + "_types.ResponseWebSearchCallCompletedEvent", + "_types.ResponseImageGenCallCompletedEvent", + "_types.ResponseMCPCallArgumentsDoneEvent", + "_types.ResponseMCPCallCompletedEvent", + "_types.ResponseMCPListToolsCompletedEvent", + "_types.ResponseCustomToolCallInputDoneEvent", +] diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_utils/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_utils/serialization.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_utils/serialization.py new file mode 100644 index 000000000000..a088671e9c51 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_utils/serialization.py @@ -0,0 +1,2066 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_version.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_version.py new file mode 100644 index 000000000000..be71c81bd282 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/__init__.py new file mode 100644 index 000000000000..52998e7e9eee --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/__init__.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import ProjectsClient # type: ignore +from . import types # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ProjectsClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_client.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_client.py new file mode 100644 index 000000000000..7b6650c19a9f --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_client.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +import sys +from typing import Any, Awaitable, TYPE_CHECKING, Union + +from azure.core import AsyncPipelineClient +from azure.core.credentials import AzureKeyCredential +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest + +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ProjectsClientConfiguration +from .operations import ResponsesOperations + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class ProjectsClient: # pylint: disable=client-accepts-api-version-keyword + """ProjectsClient. + + :ivar responses: ResponsesOperations operations + :vartype responses: azure.ai.agentserver.responses.models.aio.operations.ResponsesOperations + :param endpoint: Foundry Project endpoint in the form + "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you + only have one Project in your Foundry Hub, or to target the default Project in your Hub, use + the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". + Required. + :type endpoint: str + :param credential: Credential used to authenticate requests to the service. Is either a key + credential type or a token credential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + self._config = ProjectsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.responses = ResponsesOperations(self._client, self._config, self._serialize, self._deserialize) + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_configuration.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_configuration.py new file mode 100644 index 000000000000..29e2586f87fc --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING, Union + +from azure.core.credentials import AzureKeyCredential +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class ProjectsClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ProjectsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Foundry Project endpoint in the form + "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you + only have one Project in your Foundry Hub, or to target the default Project in your Hub, use + the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project". + Required. + :type endpoint: str + :param credential: Credential used to authenticate requests to the service. Is either a key + credential type or a token credential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any + ) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.credential_scopes = kwargs.pop("credential_scopes", ["https://ai.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "ai-agentserver-responses/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _infer_policy(self, **kwargs): + if isinstance(self.credential, AzureKeyCredential): + return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs) + if hasattr(self.credential, "get_token"): + return policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + raise TypeError(f"Unsupported credential: {self.credential}") + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = self._infer_policy(**kwargs) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_patch.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/__init__.py new file mode 100644 index 000000000000..9b86cda3e392 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import ResponsesOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResponsesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/_operations.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/_operations.py new file mode 100644 index 000000000000..25e11c586bd4 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/_operations.py @@ -0,0 +1,3532 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Literal, Optional, TYPE_CHECKING, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ... import types, types as _types +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_responses_cancel_response_request, + build_responses_compact_response_conversation_request, + build_responses_create_response_request, + build_responses_create_response_stream_request, + build_responses_delete_response_request, + build_responses_get_response_request, + build_responses_get_response_stream_request, + build_responses_list_input_items_request, + build_responses_list_responses_request, +) +from .._configuration import ProjectsClientConfiguration + +if TYPE_CHECKING: + from ... import _unions +JSON = MutableMapping[str, Any] +_Unset: Any = object() +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class ResponsesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.agentserver.responses.models.aio.ProjectsClient`'s + :attr:`responses` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ProjectsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create_response( # pylint: disable=too-many-locals + self, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.ResponseObject: + """Creates a model response. + + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + + @overload + async def create_response( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.ResponseObject: + """Creates a model response. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + + @overload + async def create_response( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _types.ResponseObject: + """Creates a model response. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + + @distributed_trace_async + async def create_response( # pylint: disable=too-many-locals + self, + body: Union[JSON, IO[bytes]] = _Unset, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + **kwargs: Any + ) -> _types.ResponseObject: + """Creates a model response. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_types.ResponseObject] = kwargs.pop("cls", None) + + if body is _Unset: + body = { + "agent": agent, + "agent_reference": agent_reference, + "agent_session_id": agent_session_id, + "background": background, + "context_management": context_management, + "conversation": conversation, + "include": include, + "input": input, + "instructions": instructions, + "max_output_tokens": max_output_tokens, + "max_tool_calls": max_tool_calls, + "metadata": metadata, + "model": model, + "parallel_tool_calls": parallel_tool_calls, + "previous_response_id": previous_response_id, + "prompt": prompt, + "prompt_cache_key": prompt_cache_key, + "prompt_cache_retention": prompt_cache_retention, + "reasoning": reasoning, + "safety_identifier": safety_identifier, + "service_tier": service_tier, + "store": store, + "stream": stream_parameter, + "stream_options": stream_options, + "structured_inputs": structured_inputs, + "temperature": temperature, + "text": text, + "tool_choice": tool_choice, + "tools": tools, + "top_logprobs": top_logprobs, + "top_p": top_p, + "truncation": truncation, + "user": user, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_responses_create_response_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_response_stream( # pylint: disable=too-many-locals + self, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + + @overload + async def create_response_stream( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + + @overload + async def create_response_stream( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + + @distributed_trace_async + async def create_response_stream( # pylint: disable=too-many-locals + self, + body: Union[JSON, IO[bytes]] = _Unset, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType["_unions.CreateResponseStreamingResponse"] = kwargs.pop("cls", None) + + if body is _Unset: + body = { + "agent": agent, + "agent_reference": agent_reference, + "agent_session_id": agent_session_id, + "background": background, + "context_management": context_management, + "conversation": conversation, + "include": include, + "input": input, + "instructions": instructions, + "max_output_tokens": max_output_tokens, + "max_tool_calls": max_tool_calls, + "metadata": metadata, + "model": model, + "parallel_tool_calls": parallel_tool_calls, + "previous_response_id": previous_response_id, + "prompt": prompt, + "prompt_cache_key": prompt_cache_key, + "prompt_cache_retention": prompt_cache_retention, + "reasoning": reasoning, + "safety_identifier": safety_identifier, + "service_tier": service_tier, + "store": store, + "stream": stream_parameter, + "stream_options": stream_options, + "structured_inputs": structured_inputs, + "temperature": temperature, + "text": text, + "tool_choice": tool_choice, + "tools": tools, + "top_logprobs": top_logprobs, + "top_p": top_p, + "truncation": truncation, + "user": user, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_responses_create_response_stream_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_response( + self, + response_id: str, + *, + includables: Optional[list[types.IncludeEnum]] = None, + stream_parameter: Optional[bool] = None, + starting_after: Optional[int] = None, + **kwargs: Any + ) -> _types.ResponseObject: + """Retrieves a model response with the given ID. + + :param response_id: Required. + :type response_id: str + :keyword includables: Default value is None. + :paramtype includables: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :keyword stream_parameter: Default value is None. + :paramtype stream_parameter: bool + :keyword starting_after: Default value is None. + :paramtype starting_after: int + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_types.ResponseObject] = kwargs.pop("cls", None) + + _request = build_responses_get_response_request( + response_id=response_id, + includables=includables, + stream_parameter=stream_parameter, + starting_after=starting_after, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_response_stream( + self, + response_id: str, + *, + includables: Optional[list[types.IncludeEnum]] = None, + starting_after: Optional[int] = None, + **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Retrieves a model response with the given ID (streaming response). + + :param response_id: Required. + :type response_id: str + :keyword includables: Default value is None. + :paramtype includables: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :keyword starting_after: Default value is None. + :paramtype starting_after: int + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + accept: Literal["text/event-stream"] = kwargs.pop("accept", _headers.pop("accept", "text/event-stream")) + cls: ClsType["_unions.CreateResponseStreamingResponse"] = kwargs.pop("cls", None) + + _request = build_responses_get_response_stream_request( + response_id=response_id, + includables=includables, + starting_after=starting_after, + accept=accept, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_response(self, response_id: str, **kwargs: Any) -> _types.DeleteResponseResult: + """Deletes a model response. + + :param response_id: The ID of the response to delete. Required. + :type response_id: str + :return: DeleteResponseResult + :rtype: ~azure.ai.agentserver.responses.models.types.DeleteResponseResult + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": True, + "id": "str", + "object": "response" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_types.DeleteResponseResult] = kwargs.pop("cls", None) + + _request = build_responses_delete_response_request( + response_id=response_id, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def cancel_response(self, response_id: str, **kwargs: Any) -> _types.ResponseObject: + """Cancels a model response. + + :param response_id: The ID of the response to cancel. Required. + :type response_id: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_types.ResponseObject] = kwargs.pop("cls", None) + + _request = build_responses_cancel_response_request( + response_id=response_id, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_input_items( + self, + response_id: str, + *, + limit: Optional[int] = None, + order: Optional[types.PageOrder] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_types.OutputItem"]: + """Returns a list of input items for a given response. + + :param response_id: Required. + :type response_id: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.agentserver.responses.models.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of OutputItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.agentserver.responses.models.types.OutputItem] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "a2a_preview_call": + output_item = { + "arguments": "str", + "call_id": "str", + "id": "str", + "name": "str", + "status": "str", + "type": "a2a_preview_call", + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_by": { + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "response_id": "str" + }, + "response_id": "str" + } + + # JSON input template for discriminator value "a2a_preview_call_output": + output_item = { + "call_id": "str", + "id": "str", + "name": "str", + "status": "str", + "type": "a2a_preview_call_output", + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_by": { + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "response_id": "str" + }, + "output": { + "str": {} + }, + "response_id": "str" + } + + # JSON input template for discriminator value "apply_patch_call": + output_item = { + "call_id": "str", + "id": "str", + "operation": apply_patch_file_operation, + "status": "str", + "type": "apply_patch_call", + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_by": { + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "response_id": "str" + }, + "response_id": "str" + } + + # JSON input template for discriminator value "create_file": + apply_patch_file_operation = { + "diff": "str", + "path": "str", + "type": "create_file" + } + + # JSON input template for discriminator value "delete_file": + apply_patch_file_operation = { + "path": "str", + "type": "delete_file" + } + + # response body for status code(s): 200 + response == output_item + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_types.OutputItem]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_responses_list_input_items_request( + response_id=response_id, + limit=limit, + order=order, + after=_continuation_token, + before=before, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = deserialized.get("data", []) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_responses( + self, + *, + limit: Optional[int] = None, + order: Optional[types.PageOrder] = None, + before: Optional[str] = None, + agent_name: Optional[str] = None, + agent_id: Optional[str] = None, + conversation_id: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_types.ResponseObject"]: + """Returns the list of all responses. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.agentserver.responses.models.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :keyword agent_name: Filter by agent name. If provided, only items associated with the + specified agent will be returned. Default value is None. + :paramtype agent_name: str + :keyword agent_id: Filter by agent ID in the format ``name:version``. If provided, only items + associated with the specified agent ID will be returned. Default value is None. + :paramtype agent_id: str + :keyword conversation_id: Filter by conversation ID. If provided, only responses associated + with the specified conversation will be returned. Default value is None. + :paramtype conversation_id: str + :return: An iterator like instance of ResponseObject + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.agentserver.responses.models.types.ResponseObject] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_types.ResponseObject]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_responses_list_responses_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + agent_name=agent_name, + agent_id=agent_id, + conversation_id=conversation_id, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = deserialized.get("data", []) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def compact_response_conversation( + self, + model: types.ModelIdsCompaction, + input: Optional[Union[str, list[_types.Item]]] = None, + previous_response_id: Optional[str] = None, + instructions: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param model: Known values are: "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", + "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", + "gpt-5.1-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", + "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", + "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", + "o1-mini-2024-09-12", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", + "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", + "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", + "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", + "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", + "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5-pro", + "gpt-5-pro-2025-10-06", and "gpt-5.1-codex-max". Required. + :type model: str or ~azure.ai.agentserver.responses.models.models.ModelIdsCompaction + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param instructions: Default value is None. + :type instructions: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + + @overload + async def compact_response_conversation( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "model": "str", + "input": "str", + "instructions": "str", + "previous_response_id": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + + @overload + async def compact_response_conversation( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + + @distributed_trace_async + async def compact_response_conversation( + self, + model: types.ModelIdsCompaction = _Unset, + body: Union[JSON, IO[bytes]] = _Unset, + input: Optional[Union[str, list[_types.Item]]] = None, + previous_response_id: Optional[str] = None, + instructions: Optional[str] = None, + **kwargs: Any + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param model: Known values are: "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", + "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", + "gpt-5.1-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", + "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", + "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", + "o1-mini-2024-09-12", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", + "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", + "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", + "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", + "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", + "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5-pro", + "gpt-5-pro-2025-10-06", and "gpt-5.1-codex-max". Required. + :type model: str or ~azure.ai.agentserver.responses.models.models.ModelIdsCompaction + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param instructions: Default value is None. + :type instructions: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "model": "str", + "input": "str", + "instructions": "str", + "previous_response_id": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_types.CompactResource] = kwargs.pop("cls", None) + + if body is _Unset: + if model is _Unset: + raise TypeError("missing required argument: model") + body = { + "input": input, + "instructions": instructions, + "model": model, + "previous_response_id": previous_response_id, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_responses_compact_response_conversation_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/_patch.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/models/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/models/__init__.py new file mode 100644 index 000000000000..e3b4c5295f07 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/models/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/models/_patch.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/__init__.py new file mode 100644 index 000000000000..9b86cda3e392 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import ResponsesOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResponsesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/_operations.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/_operations.py new file mode 100644 index 000000000000..3cc7b1394232 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/_operations.py @@ -0,0 +1,3762 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Literal, Optional, TYPE_CHECKING, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .. import types, types as _types +from .._configuration import ProjectsClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +if TYPE_CHECKING: + from .. import _unions +JSON = MutableMapping[str, Any] +_Unset: Any = object() +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_responses_create_response_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_responses_create_response_stream_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "text/event-stream") + + # Construct URL + _url = "/openai/v1/responses" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_responses_get_response_request( + response_id: str, + *, + includables: Optional[list[types.IncludeEnum]] = None, + stream_parameter: Optional[bool] = None, + starting_after: Optional[int] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses/{response_id}" + path_format_arguments = { + "response_id": _SERIALIZER.url("response_id", response_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if includables is not None: + _params["include[]"] = [ + _SERIALIZER.query("includables", q, "str") if q is not None else "" for q in includables + ] + if stream_parameter is not None: + _params["stream"] = _SERIALIZER.query("stream_parameter", stream_parameter, "bool") + if starting_after is not None: + _params["starting_after"] = _SERIALIZER.query("starting_after", starting_after, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_responses_get_response_stream_request( # pylint: disable=name-too-long + response_id: str, + *, + includables: Optional[list[types.IncludeEnum]] = None, + starting_after: Optional[int] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept: Literal["text/event-stream"] = kwargs.pop("accept", _headers.pop("accept", "text/event-stream")) + # Construct URL + _url = "/openai/v1/responses/{response_id}" + path_format_arguments = { + "response_id": _SERIALIZER.url("response_id", response_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if includables is not None: + _params["include[]"] = [ + _SERIALIZER.query("includables", q, "str") if q is not None else "" for q in includables + ] + if starting_after is not None: + _params["starting_after"] = _SERIALIZER.query("starting_after", starting_after, "int") + + # Construct headers + _headers["accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_responses_delete_response_request(response_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses/{response_id}" + path_format_arguments = { + "response_id": _SERIALIZER.url("response_id", response_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_responses_cancel_response_request(response_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses/{response_id}/cancel" + path_format_arguments = { + "response_id": _SERIALIZER.url("response_id", response_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_responses_list_input_items_request( + response_id: str, + *, + limit: Optional[int] = None, + order: Optional[types.PageOrder] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses/{response_id}/input_items" + path_format_arguments = { + "response_id": _SERIALIZER.url("response_id", response_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_responses_list_responses_request( + *, + limit: Optional[int] = None, + order: Optional[types.PageOrder] = None, + after: Optional[str] = None, + before: Optional[str] = None, + agent_name: Optional[str] = None, + agent_id: Optional[str] = None, + conversation_id: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses" + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + if agent_name is not None: + _params["agent_name"] = _SERIALIZER.query("agent_name", agent_name, "str") + if agent_id is not None: + _params["agent_id"] = _SERIALIZER.query("agent_id", agent_id, "str") + if conversation_id is not None: + _params["conversation_id"] = _SERIALIZER.query("conversation_id", conversation_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_responses_compact_response_conversation_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/openai/v1/responses/compact" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +class ResponsesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.agentserver.responses.models.ProjectsClient`'s + :attr:`responses` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ProjectsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_response( # pylint: disable=too-many-locals + self, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _types.ResponseObject: + """Creates a model response. + + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + + @overload + def create_response( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.ResponseObject: + """Creates a model response. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + + @overload + def create_response( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _types.ResponseObject: + """Creates a model response. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + + @distributed_trace + def create_response( # pylint: disable=too-many-locals + self, + body: Union[JSON, IO[bytes]] = _Unset, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + **kwargs: Any, + ) -> _types.ResponseObject: + """Creates a model response. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_types.ResponseObject] = kwargs.pop("cls", None) + + if body is _Unset: + body = { + "agent": agent, + "agent_reference": agent_reference, + "agent_session_id": agent_session_id, + "background": background, + "context_management": context_management, + "conversation": conversation, + "include": include, + "input": input, + "instructions": instructions, + "max_output_tokens": max_output_tokens, + "max_tool_calls": max_tool_calls, + "metadata": metadata, + "model": model, + "parallel_tool_calls": parallel_tool_calls, + "previous_response_id": previous_response_id, + "prompt": prompt, + "prompt_cache_key": prompt_cache_key, + "prompt_cache_retention": prompt_cache_retention, + "reasoning": reasoning, + "safety_identifier": safety_identifier, + "service_tier": service_tier, + "store": store, + "stream": stream_parameter, + "stream_options": stream_options, + "structured_inputs": structured_inputs, + "temperature": temperature, + "text": text, + "tool_choice": tool_choice, + "tools": tools, + "top_logprobs": top_logprobs, + "top_p": top_p, + "truncation": truncation, + "user": user, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_responses_create_response_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_response_stream( # pylint: disable=too-many-locals + self, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + + @overload + def create_response_stream( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + + @overload + def create_response_stream( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + + @distributed_trace + def create_response_stream( # pylint: disable=too-many-locals + self, + body: Union[JSON, IO[bytes]] = _Unset, + metadata: Optional[_types.Metadata] = None, + top_logprobs: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + user: Optional[str] = None, + safety_identifier: Optional[str] = None, + prompt_cache_key: Optional[str] = None, + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] = None, + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] = None, + previous_response_id: Optional[str] = None, + model: Optional[str] = None, + reasoning: Optional[_types.Reasoning] = None, + background: Optional[bool] = None, + max_output_tokens: Optional[int] = None, + max_tool_calls: Optional[int] = None, + text: Optional[_types.ResponseTextParam] = None, + tools: Optional[list[_types.Tool]] = None, + tool_choice: Optional[Union[types.ToolChoiceOptions, _types.ToolChoiceParam]] = None, + prompt: Optional[_types.Prompt] = None, + truncation: Optional[Literal["auto", "disabled"]] = None, + input: Optional["_unions.InputParam"] = None, + include: Optional[list[types.IncludeEnum]] = None, + parallel_tool_calls: Optional[bool] = None, + store: Optional[bool] = None, + instructions: Optional[str] = None, + stream_parameter: Optional[bool] = None, + stream_options: Optional[_types.ResponseStreamOptions] = None, + conversation: Optional["_unions.ConversationParam"] = None, + context_management: Optional[list[_types.ContextManagementParam]] = None, + agent: Optional[_types.AgentReference] = None, + agent_session_id: Optional[str] = None, + agent_reference: Optional[_types.AgentReference] = None, + structured_inputs: Optional[dict[str, Any]] = None, + **kwargs: Any, + ) -> "_unions.CreateResponseStreamingResponse": + """Creates a model response (streaming response). + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :param metadata: Default value is None. + :type metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :param top_logprobs: Default value is None. + :type top_logprobs: int + :param temperature: Default value is None. + :type temperature: float + :param top_p: Default value is None. + :type top_p: float + :param user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. + Use ``prompt_cache_key`` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI + detect and prevent abuse. `Learn more + `_. Default value is None. + :type user: str + :param safety_identifier: A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user. We recommend hashing their + username or email address, in order to avoid sending us any identifying information. `Learn + more `_. Default value is None. + :type safety_identifier: str + :param prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the ``user`` field. `Learn more `_. + Default value is None. + :type prompt_cache_key: str + :param service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] Default value is None. + :type service_tier: str or str or str or str or str + :param prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + Default value is None. + :type prompt_cache_retention: str or str + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param model: The model deployment to use for the creation of this response. Default value is + None. + :type model: str + :param reasoning: Default value is None. + :type reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :param background: Default value is None. + :type background: bool + :param max_output_tokens: Default value is None. + :type max_output_tokens: int + :param max_tool_calls: Default value is None. + :type max_tool_calls: int + :param text: Default value is None. + :type text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :param tools: Default value is None. + :type tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :param tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. Default + value is None. + :type tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :param prompt: Default value is None. + :type prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :param truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. Default + value is None. + :type truncation: str or str + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param include: Default value is None. + :type include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :param parallel_tool_calls: Default value is None. + :type parallel_tool_calls: bool + :param store: Default value is None. + :type store: bool + :param instructions: Default value is None. + :type instructions: str + :param stream_parameter: Default value is None. + :type stream_parameter: bool + :param stream_options: Default value is None. + :type stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :param conversation: Is either a str type or a ConversationParam_2 type. Default value is None. + :type conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :param context_management: Context management configuration for this request. Default value is + None. + :type context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :param agent: (Deprecated) Use agent_reference instead. + The agent to use for generating the response. Default value is None. + :type agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :param agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated. Default value is None. + :type agent_session_id: str + :param agent_reference: The agent to use for generating the response. Default value is None. + :type agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :param structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. Default value is None. + :type structured_inputs: dict[str, any] + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # JSON input template you can fill out and use as your body input. + body = { + "agent": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "context_management": [ + { + "type": "str", + "compact_threshold": 0 + } + ], + "conversation": "str", + "include": [ + "str" + ], + "input": "str", + "instructions": "str", + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "parallel_tool_calls": bool, + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "store": bool, + "stream": bool, + "stream_options": { + "include_obfuscation": bool + }, + "structured_inputs": { + "str": {} + }, + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "user": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType["_unions.CreateResponseStreamingResponse"] = kwargs.pop("cls", None) + + if body is _Unset: + body = { + "agent": agent, + "agent_reference": agent_reference, + "agent_session_id": agent_session_id, + "background": background, + "context_management": context_management, + "conversation": conversation, + "include": include, + "input": input, + "instructions": instructions, + "max_output_tokens": max_output_tokens, + "max_tool_calls": max_tool_calls, + "metadata": metadata, + "model": model, + "parallel_tool_calls": parallel_tool_calls, + "previous_response_id": previous_response_id, + "prompt": prompt, + "prompt_cache_key": prompt_cache_key, + "prompt_cache_retention": prompt_cache_retention, + "reasoning": reasoning, + "safety_identifier": safety_identifier, + "service_tier": service_tier, + "store": store, + "stream": stream_parameter, + "stream_options": stream_options, + "structured_inputs": structured_inputs, + "temperature": temperature, + "text": text, + "tool_choice": tool_choice, + "tools": tools, + "top_logprobs": top_logprobs, + "top_p": top_p, + "truncation": truncation, + "user": user, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_responses_create_response_stream_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_response( + self, + response_id: str, + *, + includables: Optional[list[types.IncludeEnum]] = None, + stream_parameter: Optional[bool] = None, + starting_after: Optional[int] = None, + **kwargs: Any, + ) -> _types.ResponseObject: + """Retrieves a model response with the given ID. + + :param response_id: Required. + :type response_id: str + :keyword includables: Default value is None. + :paramtype includables: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :keyword stream_parameter: Default value is None. + :paramtype stream_parameter: bool + :keyword starting_after: Default value is None. + :paramtype starting_after: int + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_types.ResponseObject] = kwargs.pop("cls", None) + + _request = build_responses_get_response_request( + response_id=response_id, + includables=includables, + stream_parameter=stream_parameter, + starting_after=starting_after, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_response_stream( + self, + response_id: str, + *, + includables: Optional[list[types.IncludeEnum]] = None, + starting_after: Optional[int] = None, + **kwargs: Any, + ) -> "_unions.CreateResponseStreamingResponse": + """Retrieves a model response with the given ID (streaming response). + + :param response_id: Required. + :type response_id: str + :keyword includables: Default value is None. + :paramtype includables: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :keyword starting_after: Default value is None. + :paramtype starting_after: int + :return: ResponseAudioDeltaEvent or ResponseAudioTranscriptDeltaEvent or + ResponseCodeInterpreterCallCodeDeltaEvent or ResponseCodeInterpreterCallInProgressEvent or + ResponseCodeInterpreterCallInterpretingEvent or ResponseContentPartAddedEvent or + ResponseCreatedEvent or ResponseErrorEvent or ResponseFileSearchCallInProgressEvent or + ResponseFileSearchCallSearchingEvent or ResponseFunctionCallArgumentsDeltaEvent or + ResponseInProgressEvent or ResponseFailedEvent or ResponseIncompleteEvent or + ResponseOutputItemAddedEvent or ResponseReasoningSummaryPartAddedEvent or + ResponseReasoningSummaryTextDeltaEvent or ResponseReasoningTextDeltaEvent or + ResponseRefusalDeltaEvent or ResponseTextDeltaEvent or ResponseWebSearchCallInProgressEvent or + ResponseWebSearchCallSearchingEvent or ResponseImageGenCallGeneratingEvent or + ResponseImageGenCallInProgressEvent or ResponseImageGenCallPartialImageEvent or + ResponseMCPCallArgumentsDeltaEvent or ResponseMCPCallFailedEvent or + ResponseMCPCallInProgressEvent or ResponseMCPListToolsFailedEvent or + ResponseMCPListToolsInProgressEvent or ResponseOutputTextAnnotationAddedEvent or + ResponseQueuedEvent or ResponseCustomToolCallInputDeltaEvent or ResponseAudioDoneEvent or + ResponseAudioTranscriptDoneEvent or ResponseCodeInterpreterCallCodeDoneEvent or + ResponseCodeInterpreterCallCompletedEvent or ResponseCompletedEvent or + ResponseContentPartDoneEvent or ResponseFileSearchCallCompletedEvent or + ResponseFunctionCallArgumentsDoneEvent or ResponseOutputItemDoneEvent or + ResponseReasoningSummaryPartDoneEvent or ResponseReasoningSummaryTextDoneEvent or + ResponseReasoningTextDoneEvent or ResponseRefusalDoneEvent or ResponseTextDoneEvent or + ResponseWebSearchCallCompletedEvent or ResponseImageGenCallCompletedEvent or + ResponseMCPCallArgumentsDoneEvent or ResponseMCPCallCompletedEvent or + ResponseMCPListToolsCompletedEvent or ResponseCustomToolCallInputDoneEvent + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseAudioDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallInterpretingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCreatedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseErrorEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallSearchingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallGeneratingEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallPartialImageEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsFailedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsInProgressEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputTextAnnotationAddedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseQueuedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDeltaEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseAudioTranscriptDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCodeDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCodeInterpreterCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseContentPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFileSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseFunctionCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseOutputItemDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseReasoningTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseRefusalDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseTextDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseWebSearchCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseImageGenCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallArgumentsDoneEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPCallCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseMCPListToolsCompletedEvent or + ~azure.ai.agentserver.responses.models.types.ResponseCustomToolCallInputDoneEvent + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "response.audio.delta": + response_stream_event = { + "delta": bytes("bytes", encoding="utf-8"), + "sequence_number": 0, + "type": "response.audio.delta" + } + + # JSON input template for discriminator value "response.audio.transcript.delta": + response_stream_event = { + "delta": "str", + "sequence_number": 0, + "type": "response.audio.transcript.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call_code.delta": + response_stream_event = { + "delta": "str", + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call_code.delta" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.in_progress": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.in_progress" + } + + # JSON input template for discriminator value + "response.code_interpreter_call.interpreting": + response_stream_event = { + "item_id": "str", + "output_index": 0, + "sequence_number": 0, + "type": "response.code_interpreter_call.interpreting" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + accept: Literal["text/event-stream"] = kwargs.pop("accept", _headers.pop("accept", "text/event-stream")) + cls: ClsType["_unions.CreateResponseStreamingResponse"] = kwargs.pop("cls", None) + + _request = build_responses_get_response_stream_request( + response_id=response_id, + includables=includables, + starting_after=starting_after, + accept=accept, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_response(self, response_id: str, **kwargs: Any) -> _types.DeleteResponseResult: + """Deletes a model response. + + :param response_id: The ID of the response to delete. Required. + :type response_id: str + :return: DeleteResponseResult + :rtype: ~azure.ai.agentserver.responses.models.types.DeleteResponseResult + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": True, + "id": "str", + "object": "response" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_types.DeleteResponseResult] = kwargs.pop("cls", None) + + _request = build_responses_delete_response_request( + response_id=response_id, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def cancel_response(self, response_id: str, **kwargs: Any) -> _types.ResponseObject: + """Cancels a model response. + + :param response_id: The ID of the response to cancel. Required. + :type response_id: str + :return: ResponseObject + :rtype: ~azure.ai.agentserver.responses.models.types.ResponseObject + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_types.ResponseObject] = kwargs.pop("cls", None) + + _request = build_responses_cancel_response_request( + response_id=response_id, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_input_items( + self, + response_id: str, + *, + limit: Optional[int] = None, + order: Optional[types.PageOrder] = None, + before: Optional[str] = None, + **kwargs: Any, + ) -> ItemPaged["_types.OutputItem"]: + """Returns a list of input items for a given response. + + :param response_id: Required. + :type response_id: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.agentserver.responses.models.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of OutputItem + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.agentserver.responses.models.types.OutputItem] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "a2a_preview_call": + output_item = { + "arguments": "str", + "call_id": "str", + "id": "str", + "name": "str", + "status": "str", + "type": "a2a_preview_call", + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_by": { + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "response_id": "str" + }, + "response_id": "str" + } + + # JSON input template for discriminator value "a2a_preview_call_output": + output_item = { + "call_id": "str", + "id": "str", + "name": "str", + "status": "str", + "type": "a2a_preview_call_output", + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_by": { + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "response_id": "str" + }, + "output": { + "str": {} + }, + "response_id": "str" + } + + # JSON input template for discriminator value "apply_patch_call": + output_item = { + "call_id": "str", + "id": "str", + "operation": apply_patch_file_operation, + "status": "str", + "type": "apply_patch_call", + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_by": { + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "response_id": "str" + }, + "response_id": "str" + } + + # JSON input template for discriminator value "create_file": + apply_patch_file_operation = { + "diff": "str", + "path": "str", + "type": "create_file" + } + + # JSON input template for discriminator value "delete_file": + apply_patch_file_operation = { + "path": "str", + "type": "delete_file" + } + + # response body for status code(s): 200 + response == output_item + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_types.OutputItem]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_responses_list_input_items_request( + response_id=response_id, + limit=limit, + order=order, + after=_continuation_token, + before=before, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = deserialized.get("data", []) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_responses( + self, + *, + limit: Optional[int] = None, + order: Optional[types.PageOrder] = None, + before: Optional[str] = None, + agent_name: Optional[str] = None, + agent_id: Optional[str] = None, + conversation_id: Optional[str] = None, + **kwargs: Any, + ) -> ItemPaged["_types.ResponseObject"]: + """Returns the list of all responses. + + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.agentserver.responses.models.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :keyword agent_name: Filter by agent name. If provided, only items associated with the + specified agent will be returned. Default value is None. + :paramtype agent_name: str + :keyword agent_id: Filter by agent ID in the format ``name:version``. If provided, only items + associated with the specified agent ID will be returned. Default value is None. + :paramtype agent_id: str + :keyword conversation_id: Filter by conversation ID. If provided, only responses associated + with the specified conversation will be returned. Default value is None. + :paramtype conversation_id: str + :return: An iterator like instance of ResponseObject + :rtype: + ~azure.core.paging.ItemPaged[~azure.ai.agentserver.responses.models.types.ResponseObject] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "json_object": + text_response_format_configuration = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format_configuration = { + "name": "str", + "schema": {}, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template for discriminator value "text": + text_response_format_configuration = { + "type": "text" + } + + # response body for status code(s): 200 + response == { + "agent_reference": { + "name": "str", + "type": "agent_reference", + "version": "str" + }, + "created_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str" + }, + "id": "str", + "incomplete_details": { + "reason": "max_output_tokens" + }, + "instructions": "str", + "object": "response", + "output": [ + output_item + ], + "parallel_tool_calls": bool, + "agent": { + "name": "str", + "type": "agent_id", + "version": "str" + }, + "agent_session_id": "str", + "background": bool, + "completed_at": "2020-02-20 00:00:00", + "conversation": { + "id": "str" + }, + "max_output_tokens": 0, + "max_tool_calls": 0, + "metadata": {}, + "model": "str", + "output_text": "str", + "previous_response_id": "str", + "prompt": { + "id": "str", + "variables": {}, + "version": "str" + }, + "prompt_cache_key": "str", + "prompt_cache_retention": "in-memory", + "reasoning": { + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "safety_identifier": "str", + "service_tier": "auto", + "status": "completed", + "temperature": 0.0, + "text": { + "format": text_response_format_configuration, + "verbosity": "low" + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_logprobs": 0, + "top_p": 0.0, + "truncation": "auto", + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_types.ResponseObject]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(_continuation_token=None): + + _request = build_responses_list_responses_request( + limit=limit, + order=order, + after=_continuation_token, + before=before, + agent_name=agent_name, + agent_id=agent_id, + conversation_id=conversation_id, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = deserialized.get("data", []) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) + + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def compact_response_conversation( + self, + model: types.ModelIdsCompaction, + input: Optional[Union[str, list[_types.Item]]] = None, + previous_response_id: Optional[str] = None, + instructions: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param model: Known values are: "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", + "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", + "gpt-5.1-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", + "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", + "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", + "o1-mini-2024-09-12", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", + "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", + "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", + "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", + "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", + "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5-pro", + "gpt-5-pro-2025-10-06", and "gpt-5.1-codex-max". Required. + :type model: str or ~azure.ai.agentserver.responses.models.models.ModelIdsCompaction + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param instructions: Default value is None. + :type instructions: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + + @overload + def compact_response_conversation( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "model": "str", + "input": "str", + "instructions": "str", + "previous_response_id": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + + @overload + def compact_response_conversation( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + + @distributed_trace + def compact_response_conversation( + self, + model: types.ModelIdsCompaction = _Unset, + body: Union[JSON, IO[bytes]] = _Unset, + input: Optional[Union[str, list[_types.Item]]] = None, + previous_response_id: Optional[str] = None, + instructions: Optional[str] = None, + **kwargs: Any, + ) -> _types.CompactResource: + """Produces a compaction of a responses conversation. + + :param model: Known values are: "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", + "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", + "gpt-5.1-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", + "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", + "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", + "o1-mini-2024-09-12", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", + "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", + "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", + "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", + "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", + "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5-pro", + "gpt-5-pro-2025-10-06", and "gpt-5.1-codex-max". Required. + :type model: str or ~azure.ai.agentserver.responses.models.models.ModelIdsCompaction + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :param input: Is either a str type or a [Item] type. Default value is None. + :type input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :param previous_response_id: Default value is None. + :type previous_response_id: str + :param instructions: Default value is None. + :type instructions: str + :return: CompactResource + :rtype: ~azure.ai.agentserver.responses.models.types.CompactResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "model": "str", + "input": "str", + "instructions": "str", + "previous_response_id": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "object": "response.compaction", + "output": [ + item_field + ], + "usage": { + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_types.CompactResource] = kwargs.pop("cls", None) + + if body is _Unset: + if model is _Unset: + raise TypeError("missing required argument: model") + body = { + "input": input, + "instructions": instructions, + "model": model, + "previous_response_id": previous_response_id, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_responses_compact_response_conversation_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/_patch.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/py.typed b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/types.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/types.py new file mode 100644 index 000000000000..f914f1437874 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/types.py @@ -0,0 +1,10134 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Literal, Optional, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +from .models._enums import ( + AnnotationType, + ApplyPatchFileOperationType, + ApplyPatchOperationParamType, + ComputerActionType, + ContainerNetworkPolicyParamType, + ContainerSkillType, + CustomToolParamFormatType, + FunctionAndCustomToolCallOutputType, + FunctionShellCallEnvironmentType, + FunctionShellCallItemParamEnvironmentType, + FunctionShellCallOutputOutcomeParamType, + FunctionShellCallOutputOutcomeType, + FunctionShellToolParamEnvironmentType, + ItemFieldType, + ItemType, + MemoryItemKind, + MessageContentType, + OpenApiAuthType, + OutputContentType, + OutputItemType, + OutputMessageContentType, + ResponseStreamEventType, + TextResponseFormatConfigurationType, + ToolChoiceParamType, + ToolType, +) + +if TYPE_CHECKING: + from . import _unions + +AnnotationType = Literal["file_citation", "url_citation", "container_file_citation", "file_path"] +"""Type of AnnotationType.""" + +ApplyPatchCallOutputStatus = Literal["completed", "failed"] +"""Type of ApplyPatchCallOutputStatus.""" + +ApplyPatchCallOutputStatusParam = Literal["completed", "failed"] +"""Apply patch call output status.""" + +ApplyPatchCallStatus = Literal["in_progress", "completed"] +"""Type of ApplyPatchCallStatus.""" + +ApplyPatchCallStatusParam = Literal["in_progress", "completed"] +"""Apply patch call status.""" + +ApplyPatchFileOperationType = Literal["create_file", "delete_file", "update_file"] +"""Type of ApplyPatchFileOperationType.""" + +ApplyPatchOperationParamType = Literal["create_file", "delete_file", "update_file"] +"""Type of ApplyPatchOperationParamType.""" + +AzureAISearchQueryType = Literal["simple", "semantic", "vector", "vector_simple_hybrid", "vector_semantic_hybrid"] +"""Available query types for Azure AI Search tool.""" + +ClickButtonType = Literal["left", "right", "wheel", "back", "forward"] +"""Type of ClickButtonType.""" + +ComputerActionType = Literal[ + "click", "double_click", "drag", "keypress", "move", "screenshot", "scroll", "type", "wait" +] +"""Type of ComputerActionType.""" + +ComputerEnvironment = Literal["windows", "mac", "linux", "ubuntu", "browser"] +"""Type of ComputerEnvironment.""" + +ContainerMemoryLimit = Literal["1g", "4g", "16g", "64g"] +"""Type of ContainerMemoryLimit.""" + +ContainerNetworkPolicyParamType = Literal["disabled", "allowlist"] +"""Type of ContainerNetworkPolicyParamType.""" + +ContainerSkillType = Literal["skill_reference", "inline"] +"""Type of ContainerSkillType.""" + +CustomToolParamFormatType = Literal["text", "grammar"] +"""Type of CustomToolParamFormatType.""" + +DetailEnum = Literal["low", "high", "auto"] +"""Type of DetailEnum.""" + +FunctionAndCustomToolCallOutputType = Literal["input_text", "input_image", "input_file"] +"""Type of FunctionAndCustomToolCallOutputType.""" + +FunctionCallItemStatus = Literal["in_progress", "completed", "incomplete"] +"""Type of FunctionCallItemStatus.""" + +FunctionShellCallEnvironmentType = Literal["local", "container_reference"] +"""Type of FunctionShellCallEnvironmentType.""" + +FunctionShellCallItemParamEnvironmentType = Literal["local", "container_reference"] +"""Type of FunctionShellCallItemParamEnvironmentType.""" + +FunctionShellCallItemStatus = Literal["in_progress", "completed", "incomplete"] +"""Shell call status.""" + +FunctionShellCallOutputOutcomeParamType = Literal["timeout", "exit"] +"""Type of FunctionShellCallOutputOutcomeParamType.""" + +FunctionShellCallOutputOutcomeType = Literal["timeout", "exit"] +"""Type of FunctionShellCallOutputOutcomeType.""" + +FunctionShellToolParamEnvironmentType = Literal["container_auto", "local", "container_reference"] +"""Type of FunctionShellToolParamEnvironmentType.""" + +GrammarSyntax1 = Literal["lark", "regex"] +"""Type of GrammarSyntax1.""" + +ImageDetail = Literal["low", "high", "auto"] +"""Type of ImageDetail.""" + +ImageGenActionEnum = Literal["generate", "edit", "auto"] +"""Type of ImageGenActionEnum.""" + +IncludeEnum = Literal[ + "file_search_call.results", + "web_search_call.results", + "web_search_call.action.sources", + "message.input_image.image_url", + "computer_call_output.output.image_url", + "code_interpreter_call.outputs", + "reasoning.encrypted_content", + "message.output_text.logprobs", + "memory_search_call.results", +] +"""Specify additional output data to include in the model response. Currently supported values +are: + +* `web_search_call.action.sources`: Include the sources of the web search tool call. +* `code_interpreter_call.outputs`: Includes the outputs of python code execution in code +interpreter tool call items. +* `computer_call_output.output.image_url`: Include image urls from the computer call output. +* `file_search_call.results`: Include the search results of the file search tool call. +* `message.input_image.image_url`: Include image urls from the input message. +* `message.output_text.logprobs`: Include logprobs with assistant messages. +* `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning +item outputs. This enables reasoning items to be used in multi-turn conversations when using +the Responses API statelessly (like when the `store` parameter is set to `false`, or when an +organization is enrolled in the zero data retention program).""" + +InputFidelity = Literal["high", "low"] +"""Control how much effort the model will exert to match the style and features, especially facial +features, of input images. This parameter is only supported for ``gpt-image-1`` and +``gpt-image-1.5`` and later models, unsupported for ``gpt-image-1-mini``. Supports ``high`` and +``low``. Defaults to ``low``.""" + +ItemFieldType = Literal[ + "message", + "function_call", + "function_call_output", + "file_search_call", + "web_search_call", + "image_generation_call", + "computer_call", + "computer_call_output", + "reasoning", + "compaction", + "code_interpreter_call", + "local_shell_call", + "local_shell_call_output", + "shell_call", + "shell_call_output", + "apply_patch_call", + "apply_patch_call_output", + "mcp_list_tools", + "mcp_approval_request", + "mcp_approval_response", + "mcp_call", + "custom_tool_call", + "custom_tool_call_output", +] +"""Type of ItemFieldType.""" + +ItemType = Literal[ + "message", + "output_message", + "file_search_call", + "computer_call", + "computer_call_output", + "web_search_call", + "function_call", + "function_call_output", + "reasoning", + "compaction", + "image_generation_call", + "code_interpreter_call", + "local_shell_call", + "local_shell_call_output", + "shell_call", + "shell_call_output", + "apply_patch_call", + "apply_patch_call_output", + "mcp_list_tools", + "mcp_approval_request", + "mcp_approval_response", + "mcp_call", + "custom_tool_call_output", + "custom_tool_call", + "item_reference", + "structured_outputs", + "oauth_consent_request", + "memory_search_call", + "workflow_action", + "a2a_preview_call", + "a2a_preview_call_output", + "bing_grounding_call", + "bing_grounding_call_output", + "sharepoint_grounding_preview_call", + "sharepoint_grounding_preview_call_output", + "azure_ai_search_call", + "azure_ai_search_call_output", + "bing_custom_search_preview_call", + "bing_custom_search_preview_call_output", + "openapi_call", + "openapi_call_output", + "browser_automation_preview_call", + "browser_automation_preview_call_output", + "fabric_dataagent_preview_call", + "fabric_dataagent_preview_call_output", + "azure_function_call", + "azure_function_call_output", +] +"""Type of ItemType.""" + +LocalShellCallOutputStatusEnum = Literal["in_progress", "completed", "incomplete"] +"""Type of LocalShellCallOutputStatusEnum.""" + +LocalShellCallStatus = Literal["in_progress", "completed", "incomplete"] +"""Type of LocalShellCallStatus.""" + +MCPToolCallStatus = Literal["in_progress", "completed", "incomplete", "calling", "failed"] +"""Type of MCPToolCallStatus.""" + +MemoryItemKind = Literal["user_profile", "chat_summary"] +"""Memory item kind.""" + +MessageContentType = Literal[ + "input_text", + "output_text", + "text", + "summary_text", + "reasoning_text", + "refusal", + "input_image", + "computer_screenshot", + "input_file", +] +"""Type of MessageContentType.""" + +MessageRole = Literal["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"] +"""Type of MessageRole.""" + +MessageStatus = Literal["in_progress", "completed", "incomplete"] +"""Type of MessageStatus.""" + +ModelIdsCompaction = Literal[ + "gpt-5.2", + "gpt-5.2-2025-12-11", + "gpt-5.2-chat-latest", + "gpt-5.2-pro", + "gpt-5.2-pro-2025-12-11", + "gpt-5.1", + "gpt-5.1-2025-11-13", + "gpt-5.1-codex", + "gpt-5.1-mini", + "gpt-5.1-chat-latest", + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", + "gpt-5-chat-latest", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-4.1-2025-04-14", + "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", + "o4-mini", + "o4-mini-2025-04-16", + "o3", + "o3-2025-04-16", + "o3-mini", + "o3-mini-2025-01-31", + "o1", + "o1-2024-12-17", + "o1-preview", + "o1-preview-2024-09-12", + "o1-mini", + "o1-mini-2024-09-12", + "gpt-4o", + "gpt-4o-2024-11-20", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", + "gpt-4o-audio-preview-2024-10-01", + "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", + "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", + "gpt-4o-search-preview", + "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", + "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", + "codex-mini-latest", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613", + "o1-pro", + "o1-pro-2025-03-19", + "o3-pro", + "o3-pro-2025-06-10", + "o3-deep-research", + "o3-deep-research-2025-06-26", + "o4-mini-deep-research", + "o4-mini-deep-research-2025-06-26", + "computer-use-preview", + "computer-use-preview-2025-03-11", + "gpt-5-codex", + "gpt-5-pro", + "gpt-5-pro-2025-10-06", + "gpt-5.1-codex-max", +] +"""Model ID used to generate the response, like ``gpt-5`` or ``o3``. OpenAI offers a wide range of +models with different capabilities, performance characteristics, and price points. Refer to the +`model guide `_ to browse and compare available models.""" + +OpenApiAuthType = Literal["anonymous", "project_connection", "managed_identity"] +"""Authentication type for OpenApi endpoint. Allowed types are: + +* Anonymous (no authentication required) +* Project Connection (requires project_connection_id to endpoint, as setup in AI Foundry) +* Managed_Identity (requires audience for identity based auth).""" + +OutputContentType = Literal["output_text", "refusal", "reasoning_text"] +"""Type of OutputContentType.""" + +OutputItemType = Literal[ + "output_message", + "file_search_call", + "function_call", + "web_search_call", + "computer_call", + "reasoning", + "compaction", + "image_generation_call", + "code_interpreter_call", + "local_shell_call", + "shell_call", + "shell_call_output", + "apply_patch_call", + "apply_patch_call_output", + "mcp_call", + "mcp_list_tools", + "mcp_approval_request", + "custom_tool_call", + "message", + "computer_call_output", + "function_call_output", + "local_shell_call_output", + "mcp_approval_response", + "custom_tool_call_output", + "structured_outputs", + "oauth_consent_request", + "memory_search_call", + "workflow_action", + "a2a_preview_call", + "a2a_preview_call_output", + "bing_grounding_call", + "bing_grounding_call_output", + "sharepoint_grounding_preview_call", + "sharepoint_grounding_preview_call_output", + "azure_ai_search_call", + "azure_ai_search_call_output", + "bing_custom_search_preview_call", + "bing_custom_search_preview_call_output", + "openapi_call", + "openapi_call_output", + "browser_automation_preview_call", + "browser_automation_preview_call_output", + "fabric_dataagent_preview_call", + "fabric_dataagent_preview_call_output", + "azure_function_call", + "azure_function_call_output", +] +"""Type of OutputItemType.""" + +OutputMessageContentType = Literal["output_text", "refusal"] +"""Type of OutputMessageContentType.""" + +PageOrder = Literal["asc", "desc"] +"""Type of PageOrder.""" + +RankerVersionType = Literal["auto", "default-2024-11-15"] +"""Type of RankerVersionType.""" + +ResponseErrorCode = Literal[ + "server_error", + "rate_limit_exceeded", + "invalid_prompt", + "vector_store_timeout", + "invalid_image", + "invalid_image_format", + "invalid_base64_image", + "invalid_image_url", + "image_too_large", + "image_too_small", + "image_parse_error", + "image_content_policy_violation", + "invalid_image_mode", + "image_file_too_large", + "unsupported_image_media_type", + "empty_image_file", + "failed_to_download_image", + "image_file_not_found", +] +"""The error code for the response.""" + +ResponseStreamEventType = Literal[ + "response.audio.delta", + "response.audio.done", + "response.audio.transcript.delta", + "response.audio.transcript.done", + "response.code_interpreter_call_code.delta", + "response.code_interpreter_call_code.done", + "response.code_interpreter_call.completed", + "response.code_interpreter_call.in_progress", + "response.code_interpreter_call.interpreting", + "response.completed", + "response.content_part.added", + "response.content_part.done", + "response.created", + "error", + "response.file_search_call.completed", + "response.file_search_call.in_progress", + "response.file_search_call.searching", + "response.function_call_arguments.delta", + "response.function_call_arguments.done", + "response.in_progress", + "response.failed", + "response.incomplete", + "response.output_item.added", + "response.output_item.done", + "response.reasoning_summary_part.added", + "response.reasoning_summary_part.done", + "response.reasoning_summary_text.delta", + "response.reasoning_summary_text.done", + "response.reasoning_text.delta", + "response.reasoning_text.done", + "response.refusal.delta", + "response.refusal.done", + "response.output_text.delta", + "response.output_text.done", + "response.web_search_call.completed", + "response.web_search_call.in_progress", + "response.web_search_call.searching", + "response.image_generation_call.completed", + "response.image_generation_call.generating", + "response.image_generation_call.in_progress", + "response.image_generation_call.partial_image", + "response.mcp_call_arguments.delta", + "response.mcp_call_arguments.done", + "response.mcp_call.completed", + "response.mcp_call.failed", + "response.mcp_call.in_progress", + "response.mcp_list_tools.completed", + "response.mcp_list_tools.failed", + "response.mcp_list_tools.in_progress", + "response.output_text.annotation.added", + "response.queued", + "response.custom_tool_call_input.delta", + "response.custom_tool_call_input.done", +] +"""Type of ResponseStreamEventType.""" + +SearchContextSize = Literal["low", "medium", "high"] +"""Type of SearchContextSize.""" + +TextResponseFormatConfigurationType = Literal["text", "json_schema", "json_object"] +"""Type of TextResponseFormatConfigurationType.""" + +ToolCallStatus = Literal["in_progress", "completed", "incomplete", "failed"] +"""The status of a tool call.""" + +ToolChoiceOptions = Literal["none", "auto", "required"] +"""Tool choice mode.""" + +ToolChoiceParamType = Literal[ + "allowed_tools", + "function", + "mcp", + "custom", + "apply_patch", + "shell", + "file_search", + "web_search_preview", + "computer_use_preview", + "web_search_preview_2025_03_11", + "image_generation", + "code_interpreter", +] +"""Type of ToolChoiceParamType.""" + +ToolType = Literal[ + "function", + "file_search", + "computer_use_preview", + "web_search", + "mcp", + "code_interpreter", + "image_generation", + "local_shell", + "shell", + "custom", + "web_search_preview", + "apply_patch", + "a2a_preview", + "bing_custom_search_preview", + "browser_automation_preview", + "fabric_dataagent_preview", + "sharepoint_grounding_preview", + "memory_search_preview", + "work_iq_preview", + "azure_ai_search", + "azure_function", + "bing_grounding", + "capture_structured_outputs", + "openapi", + "memory_search", +] +"""Type of ToolType.""" + + +class A2APreviewTool(TypedDict, total=False): + """An agent implementing the A2A protocol. + + :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2_A_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.A2_A_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar base_url: Base URL of the agent. + :vartype base_url: str + :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not + provided, defaults to ``/.well-known/agent-card.json``. + :vartype agent_card_path: str + :ivar project_connection_id: The connection ID in the project for the A2A server. The + connection stores authentication and other connection details needed to connect to the A2A + server. + :vartype project_connection_id: str + """ + + type: Required[Literal[ToolType.A2_A_PREVIEW]] + """The type of the tool. Always ``\"a2a_preview``. Required. A2_A_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + base_url: str + """Base URL of the agent.""" + agent_card_path: str + """The path to the agent card relative to the ``base_url``. If not provided, defaults to + ``/.well-known/agent-card.json``.""" + project_connection_id: str + """The connection ID in the project for the A2A server. The connection stores authentication and + other connection details needed to connect to the A2A server.""" + + +class A2AToolCall(TypedDict, total=False): + """An A2A (Agent-to-Agent) tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2_A_PREVIEW_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.A2_A_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.A2_A_PREVIEW_CALL]] + """Required. A2_A_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the A2A agent card being called. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class A2AToolCallOutput(TypedDict, total=False): + """The output of an A2A (Agent-to-Agent) tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2_A_PREVIEW_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.A2_A_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card that was called. Required. + :vartype name: str + :ivar output: The output from the A2A tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.A2_A_PREVIEW_CALL_OUTPUT]] + """Required. A2_A_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the A2A agent card that was called. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the A2A tool call. Is one of the following types: {str: Any}, str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class AgentId(TypedDict, total=False): + """AgentId. + + :ivar type: Required. Default value is "agent_id". + :vartype type: str + :ivar name: The name of the agent. Required. + :vartype name: str + :ivar version: The version identifier of the agent. Required. + :vartype version: str + """ + + type: Required[Literal["agent_id"]] + """Required. Default value is \"agent_id\".""" + name: Required[str] + """The name of the agent. Required.""" + version: Required[str] + """The version identifier of the agent. Required.""" + + +class AgentReference(TypedDict, total=False): + """AgentReference. + + :ivar type: Required. Default value is "agent_reference". + :vartype type: str + :ivar name: The name of the agent. Required. + :vartype name: str + :ivar version: The version identifier of the agent. + :vartype version: str + """ + + type: Required[Literal["agent_reference"]] + """Required. Default value is \"agent_reference\".""" + name: Required[str] + """The name of the agent. Required.""" + version: str + """The version identifier of the agent.""" + + +class AISearchIndexResource(TypedDict, total=False): + """A AI Search Index resource. + + :ivar project_connection_id: An index connection ID in an IndexResource attached to this agent. + :vartype project_connection_id: str + :ivar index_name: The name of an index in an IndexResource attached to this agent. + :vartype index_name: str + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar query_type: Type of query in an AIIndexResource attached to this agent. Known values are: + "simple", "semantic", "vector", "vector_simple_hybrid", and "vector_semantic_hybrid". + :vartype query_type: str or + ~azure.ai.agentserver.responses.models.models.AzureAISearchQueryType + :ivar top_k: Number of documents to retrieve from search and present to the model. + :vartype top_k: int + :ivar filter: filter string for search resource. `Learn more here + `_. + :vartype filter: str + :ivar index_asset_id: Index asset id for search resource. + :vartype index_asset_id: str + """ + + project_connection_id: str + """An index connection ID in an IndexResource attached to this agent.""" + index_name: str + """The name of an index in an IndexResource attached to this agent.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + query_type: AzureAISearchQueryType + """Type of query in an AIIndexResource attached to this agent. Known values are: \"simple\", + \"semantic\", \"vector\", \"vector_simple_hybrid\", and \"vector_semantic_hybrid\".""" + top_k: int + """Number of documents to retrieve from search and present to the model.""" + filter: str + """filter string for search resource. `Learn more here + `_.""" + index_asset_id: str + """Index asset id for search resource.""" + + +class ApiErrorResponse(TypedDict, total=False): + """Error response for API failures. + + :ivar error: Required. + :vartype error: ~azure.ai.agentserver.responses.models.types.Error + """ + + error: Required["Error"] + """Required.""" + + +class ApplyPatchCreateFileOperation(TypedDict, total=False): + """Apply patch create file operation. + + :ivar type: Create a new file with the provided diff. Required. CREATE_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CREATE_FILE + :ivar path: Path of the file to create. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + + type: Required[Literal[ApplyPatchFileOperationType.CREATE_FILE]] + """Create a new file with the provided diff. Required. CREATE_FILE.""" + path: Required[str] + """Path of the file to create. Required.""" + diff: Required[str] + """Diff to apply. Required.""" + + +class ApplyPatchCreateFileOperationParam(TypedDict, total=False): + """Apply patch create file operation. + + :ivar type: The operation type. Always ``create_file``. Required. CREATE_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CREATE_FILE + :ivar path: Path of the file to create relative to the workspace root. Required. + :vartype path: str + :ivar diff: Unified diff content to apply when creating the file. Required. + :vartype diff: str + """ + + type: Required[Literal[ApplyPatchOperationParamType.CREATE_FILE]] + """The operation type. Always ``create_file``. Required. CREATE_FILE.""" + path: Required[str] + """Path of the file to create relative to the workspace root. Required.""" + diff: Required[str] + """Unified diff content to apply when creating the file. Required.""" + + +class ApplyPatchDeleteFileOperation(TypedDict, total=False): + """Apply patch delete file operation. + + :ivar type: Delete the specified file. Required. DELETE_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.DELETE_FILE + :ivar path: Path of the file to delete. Required. + :vartype path: str + """ + + type: Required[Literal[ApplyPatchFileOperationType.DELETE_FILE]] + """Delete the specified file. Required. DELETE_FILE.""" + path: Required[str] + """Path of the file to delete. Required.""" + + +class ApplyPatchDeleteFileOperationParam(TypedDict, total=False): + """Apply patch delete file operation. + + :ivar type: The operation type. Always ``delete_file``. Required. DELETE_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.DELETE_FILE + :ivar path: Path of the file to delete relative to the workspace root. Required. + :vartype path: str + """ + + type: Required[Literal[ApplyPatchOperationParamType.DELETE_FILE]] + """The operation type. Always ``delete_file``. Required. DELETE_FILE.""" + path: Required[str] + """Path of the file to delete relative to the workspace root. Required.""" + + +class ApplyPatchToolCallItemParam(TypedDict, total=False): + """Apply patch tool call. + + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH_CALL + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ApplyPatchCallStatusParam + :ivar operation: The specific create, delete, or update instruction for the apply_patch tool + call. Required. + :vartype operation: ~azure.ai.agentserver.responses.models.types.ApplyPatchOperationParam + """ + + type: Required[Literal[ItemType.APPLY_PATCH_CALL]] + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: Optional[str] + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Required[ApplyPatchCallStatusParam] + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: Required["ApplyPatchOperationParam"] + """The specific create, delete, or update instruction for the apply_patch tool call. Required.""" + + +class ApplyPatchToolCallOutputItemParam(TypedDict, total=False): + """Apply patch tool call output. + + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH_CALL_OUTPUT + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.ApplyPatchCallOutputStatusParam + :ivar output: + :vartype output: str + """ + + type: Required[Literal[ItemType.APPLY_PATCH_CALL_OUTPUT]] + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: Optional[str] + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Required[ApplyPatchCallOutputStatusParam] + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] + + +class ApplyPatchToolParam(TypedDict, total=False): + """Apply patch tool. + + :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH + """ + + type: Required[Literal[ToolType.APPLY_PATCH]] + """The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.""" + + +class ApplyPatchUpdateFileOperation(TypedDict, total=False): + """Apply patch update file operation. + + :ivar type: Update an existing file with the provided diff. Required. UPDATE_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.UPDATE_FILE + :ivar path: Path of the file to update. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + + type: Required[Literal[ApplyPatchFileOperationType.UPDATE_FILE]] + """Update an existing file with the provided diff. Required. UPDATE_FILE.""" + path: Required[str] + """Path of the file to update. Required.""" + diff: Required[str] + """Diff to apply. Required.""" + + +class ApplyPatchUpdateFileOperationParam(TypedDict, total=False): + """Apply patch update file operation. + + :ivar type: The operation type. Always ``update_file``. Required. UPDATE_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.UPDATE_FILE + :ivar path: Path of the file to update relative to the workspace root. Required. + :vartype path: str + :ivar diff: Unified diff content to apply to the existing file. Required. + :vartype diff: str + """ + + type: Required[Literal[ApplyPatchOperationParamType.UPDATE_FILE]] + """The operation type. Always ``update_file``. Required. UPDATE_FILE.""" + path: Required[str] + """Path of the file to update relative to the workspace root. Required.""" + diff: Required[str] + """Unified diff content to apply to the existing file. Required.""" + + +class ApproximateLocation(TypedDict, total=False): + """ApproximateLocation. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: str + :ivar country: + :vartype country: str + :ivar region: + :vartype region: str + :ivar city: + :vartype city: str + :ivar timezone: + :vartype timezone: str + """ + + type: Required[Literal["approximate"]] + """The type of location approximation. Always ``approximate``. Required. Default value is + \"approximate\".""" + country: Optional[str] + region: Optional[str] + city: Optional[str] + timezone: Optional[str] + + +class AutoCodeInterpreterToolParam(TypedDict, total=False): + """Automatic Code Interpreter Tool Parameters. + + :ivar type: Always ``auto``. Required. Default value is "auto". + :vartype type: str + :ivar file_ids: An optional list of uploaded files to make available to your code. + :vartype file_ids: list[str] + :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". + :vartype memory_limit: str or + ~azure.ai.agentserver.responses.models.models.ContainerMemoryLimit + :ivar network_policy: + :vartype network_policy: + ~azure.ai.agentserver.responses.models.types.ContainerNetworkPolicyParam + """ + + type: Required[Literal["auto"]] + """Always ``auto``. Required. Default value is \"auto\".""" + file_ids: list[str] + """An optional list of uploaded files to make available to your code.""" + memory_limit: Optional[ContainerMemoryLimit] + """Known values are: \"1g\", \"4g\", \"16g\", and \"64g\".""" + network_policy: "ContainerNetworkPolicyParam" + + +class AzureAISearchTool(TypedDict, total=False): + """The input definition information for an Azure AI search tool as used to configure an agent. + + :ivar type: The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.AZURE_AI_SEARCH + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar azure_ai_search: The azure ai search index resource. Required. + :vartype azure_ai_search: + ~azure.ai.agentserver.responses.models.types.AzureAISearchToolResource + """ + + type: Required[Literal[ToolType.AZURE_AI_SEARCH]] + """The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + azure_ai_search: Required["AzureAISearchToolResource"] + """The azure ai search index resource. Required.""" + + +class AzureAISearchToolCall(TypedDict, total=False): + """An Azure AI Search tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.AZURE_AI_SEARCH_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.AZURE_AI_SEARCH_CALL]] + """Required. AZURE_AI_SEARCH_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class AzureAISearchToolCallOutput(TypedDict, total=False): + """The output of an Azure AI Search tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.AZURE_AI_SEARCH_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Azure AI Search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.AZURE_AI_SEARCH_CALL_OUTPUT]] + """Required. AZURE_AI_SEARCH_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Azure AI Search tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class AzureAISearchToolResource(TypedDict, total=False): + """A set of index resources used by the ``azure_ai_search`` tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar indexes: The indices attached to this agent. There can be a maximum of 1 index resource + attached to the agent. Required. + :vartype indexes: list[~azure.ai.agentserver.responses.models.types.AISearchIndexResource] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + indexes: Required[list["AISearchIndexResource"]] + """The indices attached to this agent. There can be a maximum of 1 index resource attached to the + agent. Required.""" + + +class AzureFunctionBinding(TypedDict, total=False): + """The structure for keeping storage queue name and URI. + + :ivar type: The type of binding, which is always 'storage_queue'. Required. Default value is + "storage_queue". + :vartype type: str + :ivar storage_queue: Storage queue. Required. + :vartype storage_queue: ~azure.ai.agentserver.responses.models.types.AzureFunctionStorageQueue + """ + + type: Required[Literal["storage_queue"]] + """The type of binding, which is always 'storage_queue'. Required. Default value is + \"storage_queue\".""" + storage_queue: Required["AzureFunctionStorageQueue"] + """Storage queue. Required.""" + + +class AzureFunctionDefinition(TypedDict, total=False): + """The definition of Azure function. + + :ivar function: The definition of azure function and its parameters. Required. + :vartype function: ~azure.ai.agentserver.responses.models.types.AzureFunctionDefinitionFunction + :ivar input_binding: Input storage queue. The queue storage trigger runs a function as messages + are added to it. Required. + :vartype input_binding: ~azure.ai.agentserver.responses.models.types.AzureFunctionBinding + :ivar output_binding: Output storage queue. The function writes output to this queue when the + input items are processed. Required. + :vartype output_binding: ~azure.ai.agentserver.responses.models.types.AzureFunctionBinding + """ + + function: Required["AzureFunctionDefinitionFunction"] + """The definition of azure function and its parameters. Required.""" + input_binding: Required["AzureFunctionBinding"] + """Input storage queue. The queue storage trigger runs a function as messages are added to it. + Required.""" + output_binding: Required["AzureFunctionBinding"] + """Output storage queue. The function writes output to this queue when the input items are + processed. Required.""" + + +class AzureFunctionDefinitionFunction(TypedDict, total=False): + """AzureFunctionDefinitionFunction. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, any] + """ + + name: Required[str] + """The name of the function to be called. Required.""" + description: str + """A description of what the function does, used by the model to choose when and how to call the + function.""" + parameters: Required[dict[str, Any]] + """The parameters the functions accepts, described as a JSON Schema object. Required.""" + + +class AzureFunctionStorageQueue(TypedDict, total=False): + """The structure for keeping storage queue name and URI. + + :ivar queue_service_endpoint: URI to the Azure Storage Queue service allowing you to manipulate + a queue. Required. + :vartype queue_service_endpoint: str + :ivar queue_name: The name of an Azure function storage queue. Required. + :vartype queue_name: str + """ + + queue_service_endpoint: Required[str] + """URI to the Azure Storage Queue service allowing you to manipulate a queue. Required.""" + queue_name: Required[str] + """The name of an Azure function storage queue. Required.""" + + +class AzureFunctionTool(TypedDict, total=False): + """The input definition information for an Azure Function Tool, as used to configure an Agent. + + :ivar type: The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.AZURE_FUNCTION + :ivar azure_function: The Azure Function Tool definition. Required. + :vartype azure_function: ~azure.ai.agentserver.responses.models.types.AzureFunctionDefinition + """ + + type: Required[Literal[ToolType.AZURE_FUNCTION]] + """The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION.""" + azure_function: Required["AzureFunctionDefinition"] + """The Azure Function Tool definition. Required.""" + + +class AzureFunctionToolCall(TypedDict, total=False): + """An Azure Function tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.AZURE_FUNCTION_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.AZURE_FUNCTION_CALL]] + """Required. AZURE_FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the Azure Function being called. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class AzureFunctionToolCallOutput(TypedDict, total=False): + """The output of an Azure Function tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.AZURE_FUNCTION_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function that was called. Required. + :vartype name: str + :ivar output: The output from the Azure Function tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.AZURE_FUNCTION_CALL_OUTPUT]] + """Required. AZURE_FUNCTION_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the Azure Function that was called. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Azure Function tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BingCustomSearchConfiguration(TypedDict, total=False): + """A bing custom search configuration. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar instance_name: Name of the custom configuration instance given to config. Required. + :vartype instance_name: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str + :ivar count: The number of search results to return in the bing api response. + :vartype count: int + :ivar freshness: Filter search results by a specific time range. See `accepted values here + `_. + :vartype freshness: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """Project connection id for grounding with bing search. Required.""" + instance_name: Required[str] + """Name of the custom configuration instance given to config. Required.""" + market: str + """The market where the results come from.""" + set_lang: str + """The language to use for user interface strings when calling Bing API.""" + count: int + """The number of search results to return in the bing api response.""" + freshness: str + """Filter search results by a specific time range. See `accepted values here + `_.""" + + +class BingCustomSearchPreviewTool(TypedDict, total=False): + """The input definition information for a Bing custom search tool as used to configure an agent. + + :ivar type: The object type, which is always 'bing_custom_search_preview'. Required. + BING_CUSTOM_SEARCH_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.BING_CUSTOM_SEARCH_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. + :vartype bing_custom_search_preview: + ~azure.ai.agentserver.responses.models.types.BingCustomSearchToolParameters + """ + + type: Required[Literal[ToolType.BING_CUSTOM_SEARCH_PREVIEW]] + """The object type, which is always 'bing_custom_search_preview'. Required. + BING_CUSTOM_SEARCH_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + bing_custom_search_preview: Required["BingCustomSearchToolParameters"] + """The bing custom search tool parameters. Required.""" + + +class BingCustomSearchToolCall(TypedDict, total=False): + """A Bing custom search tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.BING_CUSTOM_SEARCH_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.BING_CUSTOM_SEARCH_PREVIEW_CALL]] + """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BingCustomSearchToolCallOutput(TypedDict, total=False): + """The output of a Bing custom search tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing custom search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT]] + """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Bing custom search tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BingCustomSearchToolParameters(TypedDict, total=False): + """The bing custom search tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar search_configurations: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. Required. + :vartype search_configurations: + list[~azure.ai.agentserver.responses.models.types.BingCustomSearchConfiguration] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + search_configurations: Required[list["BingCustomSearchConfiguration"]] + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool. Required.""" + + +class BingGroundingSearchConfiguration(TypedDict, total=False): + """Search configuration for Bing Grounding. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str + :ivar count: The number of search results to return in the bing api response. + :vartype count: int + :ivar freshness: Filter search results by a specific time range. See `accepted values here + `_. + :vartype freshness: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """Project connection id for grounding with bing search. Required.""" + market: str + """The market where the results come from.""" + set_lang: str + """The language to use for user interface strings when calling Bing API.""" + count: int + """The number of search results to return in the bing api response.""" + freshness: str + """Filter search results by a specific time range. See `accepted values here + `_.""" + + +class BingGroundingSearchToolParameters(TypedDict, total=False): + """The bing grounding search tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar search_configurations: The search configurations attached to this tool. There can be a + maximum of 1 search configuration resource attached to the tool. Required. + :vartype search_configurations: + list[~azure.ai.agentserver.responses.models.types.BingGroundingSearchConfiguration] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + search_configurations: Required[list["BingGroundingSearchConfiguration"]] + """The search configurations attached to this tool. There can be a maximum of 1 search + configuration resource attached to the tool. Required.""" + + +class BingGroundingTool(TypedDict, total=False): + """The input definition information for a bing grounding search tool as used to configure an + agent. + + :ivar type: The object type, which is always 'bing_grounding'. Required. BING_GROUNDING. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.BING_GROUNDING + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar bing_grounding: The bing grounding search tool parameters. Required. + :vartype bing_grounding: + ~azure.ai.agentserver.responses.models.types.BingGroundingSearchToolParameters + """ + + type: Required[Literal[ToolType.BING_GROUNDING]] + """The object type, which is always 'bing_grounding'. Required. BING_GROUNDING.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + bing_grounding: Required["BingGroundingSearchToolParameters"] + """The bing grounding search tool parameters. Required.""" + + +class BingGroundingToolCall(TypedDict, total=False): + """A Bing grounding tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.BING_GROUNDING_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.BING_GROUNDING_CALL]] + """Required. BING_GROUNDING_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BingGroundingToolCallOutput(TypedDict, total=False): + """The output of a Bing grounding tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.BING_GROUNDING_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing grounding tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.BING_GROUNDING_CALL_OUTPUT]] + """Required. BING_GROUNDING_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Bing grounding tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BrowserAutomationPreviewTool(TypedDict, total=False): + """The input definition information for a Browser Automation Tool, as used to configure an Agent. + + :ivar type: The object type, which is always 'browser_automation_preview'. Required. + BROWSER_AUTOMATION_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.BROWSER_AUTOMATION_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. + :vartype browser_automation_preview: + ~azure.ai.agentserver.responses.models.types.BrowserAutomationToolParameters + """ + + type: Required[Literal[ToolType.BROWSER_AUTOMATION_PREVIEW]] + """The object type, which is always 'browser_automation_preview'. Required. + BROWSER_AUTOMATION_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + browser_automation_preview: Required["BrowserAutomationToolParameters"] + """The Browser Automation Tool parameters. Required.""" + + +class BrowserAutomationToolCall(TypedDict, total=False): + """A browser automation tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.BROWSER_AUTOMATION_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.BROWSER_AUTOMATION_PREVIEW_CALL]] + """Required. BROWSER_AUTOMATION_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BrowserAutomationToolCallOutput(TypedDict, total=False): + """The output of a browser automation tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the browser automation tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT]] + """Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the browser automation tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class BrowserAutomationToolConnectionParameters(TypedDict, total=False): # pylint: disable=name-too-long + """Definition of input parameters for the connection used by the Browser Automation Tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: The ID of the project connection to your Azure Playwright + resource. Required. + :vartype project_connection_id: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """The ID of the project connection to your Azure Playwright resource. Required.""" + + +class BrowserAutomationToolParameters(TypedDict, total=False): + """Definition of input parameters for the Browser Automation Tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar connection: The project connection parameters associated with the Browser Automation + Tool. Required. + :vartype connection: + ~azure.ai.agentserver.responses.models.types.BrowserAutomationToolConnectionParameters + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + connection: Required["BrowserAutomationToolConnectionParameters"] + """The project connection parameters associated with the Browser Automation Tool. Required.""" + + +class CaptureStructuredOutputsTool(TypedDict, total=False): + """A tool for capturing structured outputs. + + :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required. + CAPTURE_STRUCTURED_OUTPUTS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CAPTURE_STRUCTURED_OUTPUTS + :ivar outputs: The structured outputs to capture from the model. Required. + :vartype outputs: ~azure.ai.agentserver.responses.models.types.StructuredOutputDefinition + """ + + type: Required[Literal[ToolType.CAPTURE_STRUCTURED_OUTPUTS]] + """The type of the tool. Always ``capture_structured_outputs``. Required. + CAPTURE_STRUCTURED_OUTPUTS.""" + outputs: Required["StructuredOutputDefinition"] + """The structured outputs to capture from the model. Required.""" + + +class ChatSummaryMemoryItem(TypedDict, total=False): + """A memory item containing a summary extracted from conversations. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: ~datetime.datetime + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. Summary of chat conversations. + :vartype kind: str or ~azure.ai.agentserver.responses.models.models.CHAT_SUMMARY + """ + + memory_id: Required[str] + """The unique ID of the memory item. Required.""" + updated_at: Required[int] + """The last update time of the memory item. Required.""" + scope: Required[str] + """The namespace that logically groups and isolates memories, such as a user ID. Required.""" + content: Required[str] + """The content of the memory. Required.""" + kind: Required[Literal[MemoryItemKind.CHAT_SUMMARY]] + """The kind of the memory item. Required. Summary of chat conversations.""" + + +class ClickParam(TypedDict, total=False): + """Click. + + :ivar type: Specifies the event type. For a click action, this property is always ``click``. + Required. CLICK. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CLICK + :ivar button: Indicates which mouse button was pressed during the click. One of ``left``, + ``right``, ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right", + "wheel", "back", and "forward". + :vartype button: str or ~azure.ai.agentserver.responses.models.models.ClickButtonType + :ivar x: The x-coordinate where the click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the click occurred. Required. + :vartype y: int + """ + + type: Required[Literal[ComputerActionType.CLICK]] + """Specifies the event type. For a click action, this property is always ``click``. Required. + CLICK.""" + button: Required[ClickButtonType] + """Indicates which mouse button was pressed during the click. One of ``left``, ``right``, + ``wheel``, ``back``, or ``forward``. Required. Known values are: \"left\", \"right\", + \"wheel\", \"back\", and \"forward\".""" + x: Required[int] + """The x-coordinate where the click occurred. Required.""" + y: Required[int] + """The y-coordinate where the click occurred. Required.""" + + +class CodeInterpreterOutputImage(TypedDict, total=False): + """Code interpreter output image. + + :ivar type: The type of the output. Always ``image``. Required. Default value is "image". + :vartype type: str + :ivar url: The URL of the image output from the code interpreter. Required. + :vartype url: str + """ + + type: Required[Literal["image"]] + """The type of the output. Always ``image``. Required. Default value is \"image\".""" + url: Required[str] + """The URL of the image output from the code interpreter. Required.""" + + +class CodeInterpreterOutputLogs(TypedDict, total=False): + """Code interpreter output logs. + + :ivar type: The type of the output. Always ``logs``. Required. Default value is "logs". + :vartype type: str + :ivar logs: The logs output from the code interpreter. Required. + :vartype logs: str + """ + + type: Required[Literal["logs"]] + """The type of the output. Always ``logs``. Required. Default value is \"logs\".""" + logs: Required[str] + """The logs output from the code interpreter. Required.""" + + +class CodeInterpreterTool(TypedDict, total=False): + """Code interpreter. + + :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required. + CODE_INTERPRETER. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CODE_INTERPRETER + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar container: The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an optional + ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a + AutoCodeInterpreterToolParam type. + :vartype container: str or + ~azure.ai.agentserver.responses.models.types.AutoCodeInterpreterToolParam + """ + + type: Required[Literal[ToolType.CODE_INTERPRETER]] + """The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + container: Union[str, "AutoCodeInterpreterToolParam"] + """The code interpreter container. Can be a container ID or an object that specifies uploaded file + IDs to make available to your code, along with an optional ``memory_limit`` setting. If not + provided, the service assumes auto. Is either a str type or a AutoCodeInterpreterToolParam + type.""" + + +class CompactionSummaryItemParam(TypedDict, total=False): + """Compaction item. + + :ivar id: + :vartype id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPACTION + :ivar encrypted_content: The encrypted content of the compaction summary. Required. + :vartype encrypted_content: str + """ + + id: Optional[str] + type: Required[Literal[ItemType.COMPACTION]] + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + encrypted_content: Required[str] + """The encrypted content of the compaction summary. Required.""" + + +class CompactResource(TypedDict, total=False): + """The compacted response object. + + :ivar id: The unique identifier for the compacted response. Required. + :vartype id: str + :ivar object: The object type. Always ``response.compaction``. Required. Default value is + "response.compaction". + :vartype object: str + :ivar output: The compacted list of output items. Required. + :vartype output: list[~azure.ai.agentserver.responses.models.types.ItemField] + :ivar created_at: Unix timestamp (in seconds) when the compacted conversation was created. + Required. + :vartype created_at: ~datetime.datetime + :ivar usage: Token accounting for the compaction pass, including cached, reasoning, and total + tokens. Required. + :vartype usage: ~azure.ai.agentserver.responses.models.types.ResponseUsage + """ + + id: Required[str] + """The unique identifier for the compacted response. Required.""" + object: Required[Literal["response.compaction"]] + """The object type. Always ``response.compaction``. Required. Default value is + \"response.compaction\".""" + output: Required[list["ItemField"]] + """The compacted list of output items. Required.""" + created_at: Required[int] + """Unix timestamp (in seconds) when the compacted conversation was created. Required.""" + usage: Required["ResponseUsage"] + """Token accounting for the compaction pass, including cached, reasoning, and total tokens. + Required.""" + + +class ComparisonFilter(TypedDict, total=False): + """Comparison Filter. + + :ivar type: Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, + ``lte``, ``in``, ``nin``. + + * `eq`: equals + * `ne`: not equal + * `gt`: greater than + * `gte`: greater than or equal + * `lt`: less than + * `lte`: less than or equal + * `in`: in + * `nin`: not in. Required. Is one of the following types: Literal["eq"], Literal["ne"], + Literal["gt"], Literal["gte"], Literal["lt"], Literal["lte"] + :vartype type: str or str or str or str or str or str + :ivar key: The key to compare against the value. Required. + :vartype key: str + :ivar value: The value to compare against the attribute key; supports string, number, or + boolean types. Required. Is one of the following types: str, float, bool, [Union[str, float]] + :vartype value: str or float or bool or list[str or float] + """ + + type: Required[Literal["eq", "ne", "gt", "gte", "lt", "lte"]] + """Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, ``lte``, ``in``, + ``nin``. + + * `eq`: equals + * `ne`: not equal + * `gt`: greater than + * `gte`: greater than or equal + * `lt`: less than + * `lte`: less than or equal + * `in`: in + * `nin`: not in. Required. Is one of the following types: Literal[\"eq\"], + Literal[\"ne\"], Literal[\"gt\"], Literal[\"gte\"], Literal[\"lt\"], Literal[\"lte\"]""" + key: Required[str] + """The key to compare against the value. Required.""" + value: Required[Union[str, float, bool, list[Union[str, float]]]] + """The value to compare against the attribute key; supports string, number, or boolean types. + Required. Is one of the following types: str, float, bool, [Union[str, float]]""" + + +class CompoundFilter(TypedDict, total=False): + """Compound Filter. + + :ivar type: Type of operation: ``and`` or ``or``. Required. Is either a Literal["and"] type or + a Literal["or"] type. + :vartype type: str or str + :ivar filters: Array of filters to combine. Items can be ``ComparisonFilter`` or + ``CompoundFilter``. Required. + :vartype filters: list[~azure.ai.agentserver.responses.models.types.ComparisonFilter or any] + """ + + type: Required[Literal["and", "or"]] + """Type of operation: ``and`` or ``or``. Required. Is either a Literal[\"and\"] type or a + Literal[\"or\"] type.""" + filters: Required[list[Union["ComparisonFilter", Any]]] + """Array of filters to combine. Items can be ``ComparisonFilter`` or ``CompoundFilter``. Required.""" + + +class ComputerCallOutputItemParam(TypedDict, total=False): + """Computer tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_CALL_OUTPUT + :ivar output: Required. + :vartype output: ~azure.ai.agentserver.responses.models.types.ComputerScreenshotImage + :ivar acknowledged_safety_checks: + :vartype acknowledged_safety_checks: + list[~azure.ai.agentserver.responses.models.types.ComputerCallSafetyCheckParam] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.FunctionCallItemStatus + """ + + id: Optional[str] + call_id: Required[str] + """The ID of the computer tool call that produced the output. Required.""" + type: Required[Literal[ItemType.COMPUTER_CALL_OUTPUT]] + """The type of the computer tool call output. Always ``computer_call_output``. Required. + COMPUTER_CALL_OUTPUT.""" + output: Required["ComputerScreenshotImage"] + """Required.""" + acknowledged_safety_checks: Optional[list["ComputerCallSafetyCheckParam"]] + status: Optional[FunctionCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + + +class ComputerCallSafetyCheckParam(TypedDict, total=False): + """A pending safety check for the computer call. + + :ivar id: The ID of the pending safety check. Required. + :vartype id: str + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + id: Required[str] + """The ID of the pending safety check. Required.""" + code: Optional[str] + message: Optional[str] + + +class ComputerScreenshotContent(TypedDict, total=False): + """Computer screenshot. + + :ivar type: Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. COMPUTER_SCREENSHOT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_SCREENSHOT + :ivar image_url: Required. + :vartype image_url: str + :ivar file_id: Required. + :vartype file_id: str + """ + + type: Required[Literal[MessageContentType.COMPUTER_SCREENSHOT]] + """Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. COMPUTER_SCREENSHOT.""" + image_url: Required[Optional[str]] + """Required.""" + file_id: Required[Optional[str]] + """Required.""" + + +class ComputerScreenshotImage(TypedDict, total=False): + """A computer screenshot image used with the computer use tool. + + :ivar type: Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. Default value is "computer_screenshot". + :vartype type: str + :ivar image_url: The URL of the screenshot image. + :vartype image_url: str + :ivar file_id: The identifier of an uploaded file that contains the screenshot. + :vartype file_id: str + """ + + type: Required[Literal["computer_screenshot"]] + """Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. Default value is \"computer_screenshot\".""" + image_url: str + """The URL of the screenshot image.""" + file_id: str + """The identifier of an uploaded file that contains the screenshot.""" + + +class ComputerUsePreviewTool(TypedDict, total=False): + """Computer use preview. + + :ivar type: The type of the computer use tool. Always ``computer_use_preview``. Required. + COMPUTER_USE_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_USE_PREVIEW + :ivar environment: The type of computer environment to control. Required. Known values are: + "windows", "mac", "linux", "ubuntu", and "browser". + :vartype environment: str or ~azure.ai.agentserver.responses.models.models.ComputerEnvironment + :ivar display_width: The width of the computer display. Required. + :vartype display_width: int + :ivar display_height: The height of the computer display. Required. + :vartype display_height: int + """ + + type: Required[Literal[ToolType.COMPUTER_USE_PREVIEW]] + """The type of the computer use tool. Always ``computer_use_preview``. Required. + COMPUTER_USE_PREVIEW.""" + environment: Required[ComputerEnvironment] + """The type of computer environment to control. Required. Known values are: \"windows\", \"mac\", + \"linux\", \"ubuntu\", and \"browser\".""" + display_width: Required[int] + """The width of the computer display. Required.""" + display_height: Required[int] + """The height of the computer display. Required.""" + + +class ContainerAutoParam(TypedDict, total=False): + """ContainerAutoParam. + + :ivar type: Automatically creates a container for this request. Required. CONTAINER_AUTO. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CONTAINER_AUTO + :ivar file_ids: An optional list of uploaded files to make available to your code. + :vartype file_ids: list[str] + :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". + :vartype memory_limit: str or + ~azure.ai.agentserver.responses.models.models.ContainerMemoryLimit + :ivar skills: An optional list of skills referenced by id or inline data. + :vartype skills: list[~azure.ai.agentserver.responses.models.types.ContainerSkill] + :ivar network_policy: + :vartype network_policy: + ~azure.ai.agentserver.responses.models.types.ContainerNetworkPolicyParam + """ + + type: Required[Literal[FunctionShellToolParamEnvironmentType.CONTAINER_AUTO]] + """Automatically creates a container for this request. Required. CONTAINER_AUTO.""" + file_ids: list[str] + """An optional list of uploaded files to make available to your code.""" + memory_limit: Optional[ContainerMemoryLimit] + """Known values are: \"1g\", \"4g\", \"16g\", and \"64g\".""" + skills: list["ContainerSkill"] + """An optional list of skills referenced by id or inline data.""" + network_policy: "ContainerNetworkPolicyParam" + + +class ContainerFileCitationBody(TypedDict, total=False): + """Container file citation. + + :ivar type: The type of the container file citation. Always ``container_file_citation``. + Required. CONTAINER_FILE_CITATION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CONTAINER_FILE_CITATION + :ivar container_id: The ID of the container file. Required. + :vartype container_id: str + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar start_index: The index of the first character of the container file citation in the + message. Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the container file citation in the message. + Required. + :vartype end_index: int + :ivar filename: The filename of the container file cited. Required. + :vartype filename: str + """ + + type: Required[Literal[AnnotationType.CONTAINER_FILE_CITATION]] + """The type of the container file citation. Always ``container_file_citation``. Required. + CONTAINER_FILE_CITATION.""" + container_id: Required[str] + """The ID of the container file. Required.""" + file_id: Required[str] + """The ID of the file. Required.""" + start_index: Required[int] + """The index of the first character of the container file citation in the message. Required.""" + end_index: Required[int] + """The index of the last character of the container file citation in the message. Required.""" + filename: Required[str] + """The filename of the container file cited. Required.""" + + +class ContainerNetworkPolicyAllowlistParam(TypedDict, total=False): + """ContainerNetworkPolicyAllowlistParam. + + :ivar type: Allow outbound network access only to specified domains. Always ``allowlist``. + Required. ALLOWLIST. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.ALLOWLIST + :ivar allowed_domains: A list of allowed domains when type is ``allowlist``. Required. + :vartype allowed_domains: list[str] + :ivar domain_secrets: Optional domain-scoped secrets for allowlisted domains. + :vartype domain_secrets: + list[~azure.ai.agentserver.responses.models.types.ContainerNetworkPolicyDomainSecretParam] + """ + + type: Required[Literal[ContainerNetworkPolicyParamType.ALLOWLIST]] + """Allow outbound network access only to specified domains. Always ``allowlist``. Required. + ALLOWLIST.""" + allowed_domains: Required[list[str]] + """A list of allowed domains when type is ``allowlist``. Required.""" + domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"] + """Optional domain-scoped secrets for allowlisted domains.""" + + +class ContainerNetworkPolicyDisabledParam(TypedDict, total=False): + """ContainerNetworkPolicyDisabledParam. + + :ivar type: Disable outbound network access. Always ``disabled``. Required. DISABLED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.DISABLED + """ + + type: Required[Literal[ContainerNetworkPolicyParamType.DISABLED]] + """Disable outbound network access. Always ``disabled``. Required. DISABLED.""" + + +class ContainerNetworkPolicyDomainSecretParam(TypedDict, total=False): + """ContainerNetworkPolicyDomainSecretParam. + + :ivar domain: The domain associated with the secret. Required. + :vartype domain: str + :ivar name: The name of the secret to inject for the domain. Required. + :vartype name: str + :ivar value: The secret value to inject for the domain. Required. + :vartype value: str + """ + + domain: Required[str] + """The domain associated with the secret. Required.""" + name: Required[str] + """The name of the secret to inject for the domain. Required.""" + value: Required[str] + """The secret value to inject for the domain. Required.""" + + +class ContainerReferenceResource(TypedDict, total=False): + """Container Reference. + + :ivar type: The environment type. Always ``container_reference``. Required. + CONTAINER_REFERENCE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CONTAINER_REFERENCE + :ivar container_id: Required. + :vartype container_id: str + """ + + type: Required[Literal[FunctionShellCallEnvironmentType.CONTAINER_REFERENCE]] + """The environment type. Always ``container_reference``. Required. CONTAINER_REFERENCE.""" + container_id: Required[str] + """Required.""" + + +class ContextManagementParam(TypedDict, total=False): + """ContextManagementParam. + + :ivar type: The context management entry type. Currently only 'compaction' is supported. + Required. + :vartype type: str + :ivar compact_threshold: + :vartype compact_threshold: int + """ + + type: Required[str] + """The context management entry type. Currently only 'compaction' is supported. Required.""" + compact_threshold: Optional[int] + + +class ConversationParam_2(TypedDict, total=False): + """Conversation object. + + :ivar id: The unique ID of the conversation. Required. + :vartype id: str + """ + + id: Required[str] + """The unique ID of the conversation. Required.""" + + +class ConversationReference(TypedDict, total=False): + """Conversation. + + :ivar id: The unique ID of the conversation that this response was associated with. Required. + :vartype id: str + """ + + id: Required[str] + """The unique ID of the conversation that this response was associated with. Required.""" + + +class CoordParam(TypedDict, total=False): + """Coordinate. + + :ivar x: The x-coordinate. Required. + :vartype x: int + :ivar y: The y-coordinate. Required. + :vartype y: int + """ + + x: Required[int] + """The x-coordinate. Required.""" + y: Required[int] + """The y-coordinate. Required.""" + + +class CreatedBy(TypedDict, total=False): + """CreatedBy. + + :ivar agent: The agent that created the item. + :vartype agent: ~azure.ai.agentserver.responses.models.types.AgentId + :ivar response_id: The response on which the item is created. + :vartype response_id: str + """ + + agent: "AgentId" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + + +class CreateResponse(TypedDict, total=False): + """CreateResponse. + + :ivar metadata: + :vartype metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :ivar top_logprobs: + :vartype top_logprobs: int + :ivar temperature: + :vartype temperature: float + :ivar top_p: + :vartype top_p: float + :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. `Learn more + `_. + :vartype user: str + :ivar safety_identifier: A stable identifier used to help detect users of your application that + may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies + each user. We recommend hashing their username or email address, in order to avoid sending us + any identifying information. `Learn more + `_. + :vartype safety_identifier: str + :ivar prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your + cache hit rates. Replaces the ``user`` field. `Learn more `_. + :vartype prompt_cache_key: str + :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] + :vartype service_tier: str or str or str or str or str + :ivar prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + :vartype prompt_cache_retention: str or str + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar model: The model deployment to use for the creation of this response. + :vartype model: str + :ivar reasoning: + :vartype reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :ivar background: + :vartype background: bool + :ivar max_output_tokens: + :vartype max_output_tokens: int + :ivar max_tool_calls: + :vartype max_tool_calls: int + :ivar text: + :vartype text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :ivar tools: + :vartype tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. + :vartype tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :ivar prompt: + :vartype prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. + :vartype truncation: str or str + :ivar input: Is either a str type or a [Item] type. + :vartype input: str or list[~azure.ai.agentserver.responses.models.types.Item] + :ivar include: + :vartype include: list[str or ~azure.ai.agentserver.responses.models.models.IncludeEnum] + :ivar parallel_tool_calls: + :vartype parallel_tool_calls: bool + :ivar store: + :vartype store: bool + :ivar instructions: + :vartype instructions: str + :ivar stream: + :vartype stream: bool + :ivar stream_options: + :vartype stream_options: ~azure.ai.agentserver.responses.models.types.ResponseStreamOptions + :ivar conversation: Is either a str type or a ConversationParam_2 type. + :vartype conversation: str or ~azure.ai.agentserver.responses.models.types.ConversationParam_2 + :ivar context_management: Context management configuration for this request. + :vartype context_management: + list[~azure.ai.agentserver.responses.models.types.ContextManagementParam] + :ivar agent: (Deprecated) Use agent_reference instead. The agent to use for generating the + response. + :vartype agent: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar agent_session_id: Optional session identifier for sandbox affinity. Currently only + relevant for hosted agents. When provided, the request is routed to the same sandbox. When + omitted, auto-derived from conversation_id/prev_response_id or a new UUID is generated. + :vartype agent_session_id: str + :ivar agent_reference: The agent to use for generating the response. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. + :vartype structured_inputs: dict[str, any] + """ + + metadata: Optional["Metadata"] + top_logprobs: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + user: str + """This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. `Learn more + `_.""" + safety_identifier: str + """A stable identifier used to help detect users of your application that may be violating + OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We + recommend hashing their username or email address, in order to avoid sending us any identifying + information. `Learn more `_.""" + prompt_cache_key: str + """Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. + Replaces the ``user`` field. `Learn more `_.""" + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"default\"], Literal[\"flex\"], + Literal[\"scale\"], Literal[\"priority\"]""" + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] + """Is either a Literal[\"in-memory\"] type or a Literal[\"24h\"] type.""" + previous_response_id: Optional[str] + model: str + """The model deployment to use for the creation of this response.""" + reasoning: Optional["Reasoning"] + background: Optional[bool] + max_output_tokens: Optional[int] + max_tool_calls: Optional[int] + text: "ResponseTextParam" + tools: list["Tool"] + tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + """Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.""" + prompt: "Prompt" + truncation: Optional[Literal["auto", "disabled"]] + """Is either a Literal[\"auto\"] type or a Literal[\"disabled\"] type.""" + input: "_unions.InputParam" + """Is either a str type or a [Item] type.""" + include: Optional[list[IncludeEnum]] + parallel_tool_calls: Optional[bool] + store: Optional[bool] + instructions: Optional[str] + stream: Optional[bool] + stream_options: Optional["ResponseStreamOptions"] + conversation: Optional["_unions.ConversationParam"] + """Is either a str type or a ConversationParam_2 type.""" + context_management: Optional[list["ContextManagementParam"]] + """Context management configuration for this request.""" + agent: "AgentReference" + """(Deprecated) Use agent_reference instead. The agent to use for generating the response.""" + agent_session_id: str + """Optional session identifier for sandbox affinity. Currently only relevant for hosted agents. + When provided, the request is routed to the same sandbox. When omitted, auto-derived from + conversation_id/prev_response_id or a new UUID is generated.""" + agent_reference: "AgentReference" + """The agent to use for generating the response.""" + structured_inputs: dict[str, Any] + """The structured inputs to the response that can participate in prompt template substitution or + tool argument bindings.""" + + +class CustomGrammarFormatParam(TypedDict, total=False): + """Grammar format. + + :ivar type: Grammar format. Always ``grammar``. Required. GRAMMAR. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.GRAMMAR + :ivar syntax: The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. + Known values are: "lark" and "regex". + :vartype syntax: str or ~azure.ai.agentserver.responses.models.models.GrammarSyntax1 + :ivar definition: The grammar definition. Required. + :vartype definition: str + """ + + type: Required[Literal[CustomToolParamFormatType.GRAMMAR]] + """Grammar format. Always ``grammar``. Required. GRAMMAR.""" + syntax: Required[GrammarSyntax1] + """The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. Known values are: + \"lark\" and \"regex\".""" + definition: Required[str] + """The grammar definition. Required.""" + + +class CustomTextFormatParam(TypedDict, total=False): + """Text format. + + :ivar type: Unconstrained text format. Always ``text``. Required. TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.TEXT + """ + + type: Required[Literal[CustomToolParamFormatType.TEXT]] + """Unconstrained text format. Always ``text``. Required. TEXT.""" + + +class CustomToolParam(TypedDict, total=False): + """Custom tool. + + :ivar type: The type of the custom tool. Always ``custom``. Required. CUSTOM. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM + :ivar name: The name of the custom tool, used to identify it in tool calls. Required. + :vartype name: str + :ivar description: Optional description of the custom tool, used to provide more context. + :vartype description: str + :ivar format: The input format for the custom tool. Default is unconstrained text. + :vartype format: ~azure.ai.agentserver.responses.models.types.CustomToolParamFormat + """ + + type: Required[Literal[ToolType.CUSTOM]] + """The type of the custom tool. Always ``custom``. Required. CUSTOM.""" + name: Required[str] + """The name of the custom tool, used to identify it in tool calls. Required.""" + description: str + """Optional description of the custom tool, used to provide more context.""" + format: "CustomToolParamFormat" + """The input format for the custom tool. Default is unconstrained text.""" + + +class DeleteResponseResult(TypedDict, total=False): + """The result of a delete response operation. + + :ivar id: The operation ID. Required. + :vartype id: str + :ivar deleted: Always return true. Required. Default value is True. + :vartype deleted: bool + :ivar object: Required. Default value is "response". + :vartype object: str + """ + + id: Required[str] + """The operation ID. Required.""" + deleted: Required[Literal[True]] + """Always return true. Required. Default value is True.""" + object: Required[Literal["response"]] + """Required. Default value is \"response\".""" + + +class DoubleClickAction(TypedDict, total=False): + """DoubleClick. + + :ivar type: Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.DOUBLE_CLICK + :ivar x: The x-coordinate where the double click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the double click occurred. Required. + :vartype y: int + """ + + type: Required[Literal[ComputerActionType.DOUBLE_CLICK]] + """Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK.""" + x: Required[int] + """The x-coordinate where the double click occurred. Required.""" + y: Required[int] + """The y-coordinate where the double click occurred. Required.""" + + +class DragParam(TypedDict, total=False): + """Drag. + + :ivar type: Specifies the event type. For a drag action, this property is always set to + ``drag``. Required. DRAG. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.DRAG + :ivar path: An array of coordinates representing the path of the drag action. Coordinates will + appear as an array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ]. Required. + :vartype path: list[~azure.ai.agentserver.responses.models.types.CoordParam] + """ + + type: Required[Literal[ComputerActionType.DRAG]] + """Specifies the event type. For a drag action, this property is always set to ``drag``. Required. + DRAG.""" + path: Required[list["CoordParam"]] + """An array of coordinates representing the path of the drag action. Coordinates will appear as an + array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ]. Required.""" + + +class Error(TypedDict, total=False): + """Error. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar param: + :vartype param: str + :ivar type: + :vartype type: str + :ivar details: + :vartype details: list[~azure.ai.agentserver.responses.models.types.Error] + :ivar additional_info: + :vartype additional_info: dict[str, any] + :ivar debug_info: + :vartype debug_info: dict[str, any] + """ + + code: Required[Optional[str]] + """Required.""" + message: Required[str] + """Required.""" + param: Optional[str] + type: str + details: list["Error"] + additionalInfo: dict[str, Any] + debugInfo: dict[str, Any] + + +class FabricDataAgentToolCall(TypedDict, total=False): + """A Fabric data agent tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.FABRIC_DATAAGENT_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.FABRIC_DATAAGENT_PREVIEW_CALL]] + """Required. FABRIC_DATAAGENT_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class FabricDataAgentToolCallOutput(TypedDict, total=False): + """The output of a Fabric data agent tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Fabric data agent tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT]] + """Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Fabric data agent tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class FabricDataAgentToolParameters(TypedDict, total=False): + """The fabric data agent tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: + list[~azure.ai.agentserver.responses.models.types.ToolProjectConnection] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connections: list["ToolProjectConnection"] + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + +class FileCitationBody(TypedDict, total=False): + """File citation. + + :ivar type: The type of the file citation. Always ``file_citation``. Required. FILE_CITATION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_CITATION + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + :ivar filename: The filename of the file cited. Required. + :vartype filename: str + """ + + type: Required[Literal[AnnotationType.FILE_CITATION]] + """The type of the file citation. Always ``file_citation``. Required. FILE_CITATION.""" + file_id: Required[str] + """The ID of the file. Required.""" + index: Required[int] + """The index of the file in the list of files. Required.""" + filename: Required[str] + """The filename of the file cited. Required.""" + + +class FilePath(TypedDict, total=False): + """File path. + + :ivar type: The type of the file path. Always ``file_path``. Required. FILE_PATH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_PATH + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + """ + + type: Required[Literal[AnnotationType.FILE_PATH]] + """The type of the file path. Always ``file_path``. Required. FILE_PATH.""" + file_id: Required[str] + """The ID of the file. Required.""" + index: Required[int] + """The index of the file in the list of files. Required.""" + + +class FileSearchTool(TypedDict, total=False): + """File search. + + :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_SEARCH + :ivar vector_store_ids: The IDs of the vector stores to search. Required. + :vartype vector_store_ids: list[str] + :ivar max_num_results: The maximum number of results to return. This number should be between 1 + and 50 inclusive. + :vartype max_num_results: int + :ivar ranking_options: Ranking options for search. + :vartype ranking_options: ~azure.ai.agentserver.responses.models.types.RankingOptions + :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. + :vartype filters: ~azure.ai.agentserver.responses.models.types.ComparisonFilter or + ~azure.ai.agentserver.responses.models.types.CompoundFilter + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal[ToolType.FILE_SEARCH]] + """The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.""" + vector_store_ids: Required[list[str]] + """The IDs of the vector stores to search. Required.""" + max_num_results: int + """The maximum number of results to return. This number should be between 1 and 50 inclusive.""" + ranking_options: "RankingOptions" + """Ranking options for search.""" + filters: Optional["_unions.Filters"] + """Is either a ComparisonFilter type or a CompoundFilter type.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + +class FileSearchToolCallResults(TypedDict, total=False): + """FileSearchToolCallResults. + + :ivar file_id: + :vartype file_id: str + :ivar text: + :vartype text: str + :ivar filename: + :vartype filename: str + :ivar attributes: + :vartype attributes: ~azure.ai.agentserver.responses.models.types.VectorStoreFileAttributes + :ivar score: + :vartype score: float + """ + + file_id: str + text: str + filename: str + attributes: Optional["VectorStoreFileAttributes"] + score: float + + +class FunctionAndCustomToolCallOutputInputFileContent(TypedDict, total=False): # pylint: disable=name-too-long + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INPUT_FILE + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + """ + + type: Required[Literal[FunctionAndCustomToolCallOutputType.INPUT_FILE]] + """The type of the input item. Always ``input_file``. Required. INPUT_FILE.""" + file_id: Optional[str] + filename: str + """The name of the file to be sent to the model.""" + file_url: str + """The URL of the file to be sent to the model.""" + file_data: str + """The content of the file to be sent to the model.""" + + +class FunctionAndCustomToolCallOutputInputImageContent(TypedDict, total=False): # pylint: disable=name-too-long + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INPUT_IMAGE + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + or ``auto``. Defaults to ``auto``. Required. Known values are: "low", "high", and "auto". + :vartype detail: str or ~azure.ai.agentserver.responses.models.models.ImageDetail + """ + + type: Required[Literal[FunctionAndCustomToolCallOutputType.INPUT_IMAGE]] + """The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.""" + image_url: Optional[str] + file_id: Optional[str] + detail: Required[ImageDetail] + """The detail level of the image to be sent to the model. One of ``high``, ``low``, or ``auto``. + Defaults to ``auto``. Required. Known values are: \"low\", \"high\", and \"auto\".""" + + +class FunctionAndCustomToolCallOutputInputTextContent(TypedDict, total=False): # pylint: disable=name-too-long + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INPUT_TEXT + :ivar text: The text input to the model. Required. + :vartype text: str + """ + + type: Required[Literal[FunctionAndCustomToolCallOutputType.INPUT_TEXT]] + """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" + text: Required[str] + """The text input to the model. Required.""" + + +class FunctionCallOutputItemParam(TypedDict, total=False): + """Function tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION_CALL_OUTPUT + :ivar output: Text, image, or file output of the function tool call. Required. Is either a str + type or a [Union["_types.InputTextContentParam", "_types.InputImageContentParamAutoParam", + "_types.InputFileContentParam"]] type. + :vartype output: str or list[~azure.ai.agentserver.responses.models.types.InputTextContentParam + or ~azure.ai.agentserver.responses.models.types.InputImageContentParamAutoParam or + ~azure.ai.agentserver.responses.models.types.InputFileContentParam] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.FunctionCallItemStatus + """ + + id: Optional[str] + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + type: Required[Literal[ItemType.FUNCTION_CALL_OUTPUT]] + """The type of the function tool call output. Always ``function_call_output``. Required. + FUNCTION_CALL_OUTPUT.""" + output: Required[ + Union[str, list[Union["InputTextContentParam", "InputImageContentParamAutoParam", "InputFileContentParam"]]] + ] + """Text, image, or file output of the function tool call. Required. Is either a str type or a + [Union[\"_types.InputTextContentParam\", \"_types.InputImageContentParamAutoParam\", + \"_types.InputFileContentParam\"]] type.""" + status: Optional[FunctionCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + + +class FunctionShellAction(TypedDict, total=False): + """Shell exec action. + + :ivar commands: Required. + :vartype commands: list[str] + :ivar timeout_ms: Required. + :vartype timeout_ms: int + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + + commands: Required[list[str]] + """Required.""" + timeout_ms: Required[Optional[int]] + """Required.""" + max_output_length: Required[Optional[int]] + """Required.""" + + +class FunctionShellActionParam(TypedDict, total=False): + """Shell action. + + :ivar commands: Ordered shell commands for the execution environment to run. Required. + :vartype commands: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar max_output_length: + :vartype max_output_length: int + """ + + commands: Required[list[str]] + """Ordered shell commands for the execution environment to run. Required.""" + timeout_ms: Optional[int] + max_output_length: Optional[int] + + +class FunctionShellCallItemParam(TypedDict, total=False): + """Shell tool call. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL_CALL + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.FunctionShellActionParam + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.FunctionShellCallItemStatus + :ivar environment: + :vartype environment: + ~azure.ai.agentserver.responses.models.types.FunctionShellCallItemParamEnvironment + """ + + id: Optional[str] + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + type: Required[Literal[ItemType.SHELL_CALL]] + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + action: Required["FunctionShellActionParam"] + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Optional[FunctionShellCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: Optional["FunctionShellCallItemParamEnvironment"] + + +class FunctionShellCallItemParamEnvironmentContainerReferenceParam( + TypedDict, total=False +): # pylint: disable=name-too-long + """FunctionShellCallItemParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CONTAINER_REFERENCE + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + + type: Required[Literal[FunctionShellCallItemParamEnvironmentType.CONTAINER_REFERENCE]] + """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" + container_id: Required[str] + """The ID of the referenced container. Required.""" + + +class FunctionShellCallItemParamEnvironmentLocalEnvironmentParam( + TypedDict, total=False +): # pylint: disable=name-too-long + """FunctionShellCallItemParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL + :ivar skills: An optional list of skills. + :vartype skills: list[~azure.ai.agentserver.responses.models.types.LocalSkillParam] + """ + + type: Required[Literal[FunctionShellCallItemParamEnvironmentType.LOCAL]] + """Use a local computer environment. Required. LOCAL.""" + skills: list["LocalSkillParam"] + """An optional list of skills.""" + + +class FunctionShellCallOutputContent(TypedDict, total=False): + """Shell call output content. + + :ivar stdout: The standard output that was captured. Required. + :vartype stdout: str + :ivar stderr: The standard error output that was captured. Required. + :vartype stderr: str + :ivar outcome: Shell call outcome. Required. + :vartype outcome: ~azure.ai.agentserver.responses.models.types.FunctionShellCallOutputOutcome + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + stdout: Required[str] + """The standard output that was captured. Required.""" + stderr: Required[str] + """The standard error output that was captured. Required.""" + outcome: Required["FunctionShellCallOutputOutcome"] + """Shell call outcome. Required.""" + created_by: str + """The identifier of the actor that created the item.""" + + +class FunctionShellCallOutputContentParam(TypedDict, total=False): + """Shell output content. + + :ivar stdout: Captured stdout output for the shell call. Required. + :vartype stdout: str + :ivar stderr: Captured stderr output for the shell call. Required. + :vartype stderr: str + :ivar outcome: The exit or timeout outcome associated with this shell call. Required. + :vartype outcome: + ~azure.ai.agentserver.responses.models.types.FunctionShellCallOutputOutcomeParam + """ + + stdout: Required[str] + """Captured stdout output for the shell call. Required.""" + stderr: Required[str] + """Captured stderr output for the shell call. Required.""" + outcome: Required["FunctionShellCallOutputOutcomeParam"] + """The exit or timeout outcome associated with this shell call. Required.""" + + +class FunctionShellCallOutputExitOutcome(TypedDict, total=False): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.EXIT + :ivar exit_code: Exit code from the shell process. Required. + :vartype exit_code: int + """ + + type: Required[Literal[FunctionShellCallOutputOutcomeType.EXIT]] + """The outcome type. Always ``exit``. Required. EXIT.""" + exit_code: Required[int] + """Exit code from the shell process. Required.""" + + +class FunctionShellCallOutputExitOutcomeParam(TypedDict, total=False): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.EXIT + :ivar exit_code: The exit code returned by the shell process. Required. + :vartype exit_code: int + """ + + type: Required[Literal[FunctionShellCallOutputOutcomeParamType.EXIT]] + """The outcome type. Always ``exit``. Required. EXIT.""" + exit_code: Required[int] + """The exit code returned by the shell process. Required.""" + + +class FunctionShellCallOutputItemParam(TypedDict, total=False): + """Shell tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar type: The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL_CALL_OUTPUT + :ivar output: Captured chunks of stdout and stderr output, along with their associated + outcomes. Required. + :vartype output: + list[~azure.ai.agentserver.responses.models.types.FunctionShellCallOutputContentParam] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.FunctionShellCallItemStatus + :ivar max_output_length: + :vartype max_output_length: int + """ + + id: Optional[str] + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + type: Required[Literal[ItemType.SHELL_CALL_OUTPUT]] + """The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + output: Required[list["FunctionShellCallOutputContentParam"]] + """Captured chunks of stdout and stderr output, along with their associated outcomes. Required.""" + status: Optional[FunctionShellCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + max_output_length: Optional[int] + + +class FunctionShellCallOutputTimeoutOutcome(TypedDict, total=False): + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.TIMEOUT + """ + + type: Required[Literal[FunctionShellCallOutputOutcomeType.TIMEOUT]] + """The outcome type. Always ``timeout``. Required. TIMEOUT.""" + + +class FunctionShellCallOutputTimeoutOutcomeParam(TypedDict, total=False): # pylint: disable=name-too-long + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.TIMEOUT + """ + + type: Required[Literal[FunctionShellCallOutputOutcomeParamType.TIMEOUT]] + """The outcome type. Always ``timeout``. Required. TIMEOUT.""" + + +class FunctionShellToolParam(TypedDict, total=False): + """Shell tool. + + :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL + :ivar environment: + :vartype environment: + ~azure.ai.agentserver.responses.models.types.FunctionShellToolParamEnvironment + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal[ToolType.SHELL]] + """The type of the shell tool. Always ``shell``. Required. SHELL.""" + environment: Optional["FunctionShellToolParamEnvironment"] + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + +class FunctionShellToolParamEnvironmentContainerReferenceParam(TypedDict, total=False): # pylint: disable=name-too-long + """FunctionShellToolParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CONTAINER_REFERENCE + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + + type: Required[Literal[FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE]] + """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" + container_id: Required[str] + """The ID of the referenced container. Required.""" + + +class FunctionShellToolParamEnvironmentLocalEnvironmentParam(TypedDict, total=False): # pylint: disable=name-too-long + """FunctionShellToolParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL + :ivar skills: An optional list of skills. + :vartype skills: list[~azure.ai.agentserver.responses.models.types.LocalSkillParam] + """ + + type: Required[Literal[FunctionShellToolParamEnvironmentType.LOCAL]] + """Use a local computer environment. Required. LOCAL.""" + skills: list["LocalSkillParam"] + """An optional list of skills.""" + + +class FunctionTool(TypedDict, total=False): + """Function. + + :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION + :ivar name: The name of the function to call. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar parameters: Required. + :vartype parameters: dict[str, any] + :ivar strict: Required. + :vartype strict: bool + """ + + type: Required[Literal[ToolType.FUNCTION]] + """The type of the function tool. Always ``function``. Required. FUNCTION.""" + name: Required[str] + """The name of the function to call. Required.""" + description: Optional[str] + parameters: Required[Optional[dict[str, Any]]] + """Required.""" + strict: Required[Optional[bool]] + """Required.""" + + +class FunctionToolCallOutput(TypedDict, total=False): + """Function tool call output. + + :ivar id: The unique ID of the function tool call output. Populated when this item is returned + via API. + :vartype id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION_CALL_OUTPUT + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the function call generated by your code. Can be a string or an + list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] + type. + :vartype output: str or + list[~azure.ai.agentserver.responses.models.types.FunctionAndCustomToolCallOutput] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + id: str + """The unique ID of the function tool call output. Populated when this item is returned via API.""" + type: Required[Literal[ItemFieldType.FUNCTION_CALL_OUTPUT]] + """The type of the function tool call output. Always ``function_call_output``. Required. + FUNCTION_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the function call generated by your code. Can be a string or an list of output + content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class FunctionToolCallOutputResource(TypedDict, total=False): + """FunctionToolCallOutputResource. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call output. Populated when this item is returned + via API. + :vartype id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION_CALL_OUTPUT + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the function call generated by your code. Can be a string or an + list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] + type. + :vartype output: str or + list[~azure.ai.agentserver.responses.models.types.FunctionAndCustomToolCallOutput] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: str + """The unique ID of the function tool call output. Populated when this item is returned via API.""" + type: Required[Literal[OutputItemType.FUNCTION_CALL_OUTPUT]] + """The type of the function tool call output. Always ``function_call_output``. Required. + FUNCTION_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the function call generated by your code. Can be a string or an list of output + content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class HybridSearchOptions(TypedDict, total=False): + """HybridSearchOptions. + + :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required. + :vartype embedding_weight: float + :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required. + :vartype text_weight: float + """ + + embedding_weight: Required[float] + """The weight of the embedding in the reciprocal ranking fusion. Required.""" + text_weight: Required[float] + """The weight of the text in the reciprocal ranking fusion. Required.""" + + +class ImageGenTool(TypedDict, total=False): + """Image generation tool. + + :ivar type: The type of the image generation tool. Always ``image_generation``. Required. + IMAGE_GENERATION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.IMAGE_GENERATION + :ivar model: Is one of the following types: Literal["gpt-image-1"], + Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str + :vartype model: str or str or str or str + :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or + ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"], Literal["auto"] + :vartype quality: str or str or str or str + :ivar size: The size of the generated image. One of ``1024x1024``, ``1024x1536``, + ``1536x1024``, or ``auto``. Default: ``auto``. Is one of the following types: + Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"] + :vartype size: str or str or str or str + :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or + ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"], + Literal["jpeg"] + :vartype output_format: str or str or str + :ivar output_compression: Compression level for the output image. Default: 100. + :vartype output_compression: int + :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a + Literal["auto"] type or a Literal["low"] type. + :vartype moderation: str or str + :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``, + or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"], + Literal["opaque"], Literal["auto"] + :vartype background: str or str or str + :ivar input_fidelity: Known values are: "high" and "low". + :vartype input_fidelity: str or ~azure.ai.agentserver.responses.models.models.InputFidelity + :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional) + and ``file_id`` (string, optional). + :vartype input_image_mask: + ~azure.ai.agentserver.responses.models.types.ImageGenToolInputImageMask + :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default + value) to 3. + :vartype partial_images: int + :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. + Known values are: "generate", "edit", and "auto". + :vartype action: str or ~azure.ai.agentserver.responses.models.models.ImageGenActionEnum + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal[ToolType.IMAGE_GENERATION]] + """The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION.""" + model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str] + """Is one of the following types: Literal[\"gpt-image-1\"], Literal[\"gpt-image-1-mini\"], + Literal[\"gpt-image-1.5\"], str""" + quality: Literal["low", "medium", "high", "auto"] + """The quality of the generated image. One of ``low``, ``medium``, ``high``, or ``auto``. Default: + ``auto``. Is one of the following types: Literal[\"low\"], Literal[\"medium\"], + Literal[\"high\"], Literal[\"auto\"]""" + size: Literal["1024x1024", "1024x1536", "1536x1024", "auto"] + """The size of the generated image. One of ``1024x1024``, ``1024x1536``, ``1536x1024``, or + ``auto``. Default: ``auto``. Is one of the following types: Literal[\"1024x1024\"], + Literal[\"1024x1536\"], Literal[\"1536x1024\"], Literal[\"auto\"]""" + output_format: Literal["png", "webp", "jpeg"] + """The output format of the generated image. One of ``png``, ``webp``, or ``jpeg``. Default: + ``png``. Is one of the following types: Literal[\"png\"], Literal[\"webp\"], Literal[\"jpeg\"]""" + output_compression: int + """Compression level for the output image. Default: 100.""" + moderation: Literal["auto", "low"] + """Moderation level for the generated image. Default: ``auto``. Is either a Literal[\"auto\"] type + or a Literal[\"low\"] type.""" + background: Literal["transparent", "opaque", "auto"] + """Background type for the generated image. One of ``transparent``, ``opaque``, or ``auto``. + Default: ``auto``. Is one of the following types: Literal[\"transparent\"], + Literal[\"opaque\"], Literal[\"auto\"]""" + input_fidelity: Optional[InputFidelity] + """Known values are: \"high\" and \"low\".""" + input_image_mask: "ImageGenToolInputImageMask" + """Optional mask for inpainting. Contains ``image_url`` (string, optional) and ``file_id`` + (string, optional).""" + partial_images: int + """Number of partial images to generate in streaming mode, from 0 (default value) to 3.""" + action: ImageGenActionEnum + """Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: + \"generate\", \"edit\", and \"auto\".""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + +class ImageGenToolInputImageMask(TypedDict, total=False): + """ImageGenToolInputImageMask. + + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + """ + + image_url: str + file_id: str + + +class InlineSkillParam(TypedDict, total=False): + """InlineSkillParam. + + :ivar type: Defines an inline skill for this request. Required. INLINE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INLINE + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar source: Inline skill payload. Required. + :vartype source: ~azure.ai.agentserver.responses.models.types.InlineSkillSourceParam + """ + + type: Required[Literal[ContainerSkillType.INLINE]] + """Defines an inline skill for this request. Required. INLINE.""" + name: Required[str] + """The name of the skill. Required.""" + description: Required[str] + """The description of the skill. Required.""" + source: Required["InlineSkillSourceParam"] + """Inline skill payload. Required.""" + + +class InlineSkillSourceParam(TypedDict, total=False): + """Inline skill payload. + + :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is + "base64". + :vartype type: str + :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``. + Required. Default value is "application/zip". + :vartype media_type: str + :ivar data: Base64-encoded skill zip bundle. Required. + :vartype data: str + """ + + type: Required[Literal["base64"]] + """The type of the inline skill source. Must be ``base64``. Required. Default value is \"base64\".""" + media_type: Required[Literal["application/zip"]] + """The media type of the inline skill payload. Must be ``application/zip``. Required. Default + value is \"application/zip\".""" + data: Required[str] + """Base64-encoded skill zip bundle. Required.""" + + +class InputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. Default value is + "input_file". + :vartype type: str + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + """ + + type: Required[Literal["input_file"]] + """The type of the input item. Always ``input_file``. Required. Default value is \"input_file\".""" + file_id: Optional[str] + filename: str + """The name of the file to be sent to the model.""" + file_url: str + """The URL of the file to be sent to the model.""" + file_data: str + """The content of the file to be sent to the model.""" + + +class InputFileContentParam(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. Default value is + "input_file". + :vartype type: str + :ivar file_id: + :vartype file_id: str + :ivar filename: + :vartype filename: str + :ivar file_data: + :vartype file_data: str + :ivar file_url: + :vartype file_url: str + """ + + type: Required[Literal["input_file"]] + """The type of the input item. Always ``input_file``. Required. Default value is \"input_file\".""" + file_id: Optional[str] + filename: Optional[str] + file_data: Optional[str] + file_url: Optional[str] + + +class InputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. Default value is + "input_image". + :vartype type: str + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + or ``auto``. Defaults to ``auto``. Required. Known values are: "low", "high", and "auto". + :vartype detail: str or ~azure.ai.agentserver.responses.models.models.ImageDetail + """ + + type: Required[Literal["input_image"]] + """The type of the input item. Always ``input_image``. Required. Default value is \"input_image\".""" + image_url: Optional[str] + file_id: Optional[str] + detail: Required[ImageDetail] + """The detail level of the image to be sent to the model. One of ``high``, ``low``, or ``auto``. + Defaults to ``auto``. Required. Known values are: \"low\", \"high\", and \"auto\".""" + + +class InputImageContentParamAutoParam(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. Default value is + "input_image". + :vartype type: str + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: Known values are: "low", "high", and "auto". + :vartype detail: str or ~azure.ai.agentserver.responses.models.models.DetailEnum + """ + + type: Required[Literal["input_image"]] + """The type of the input item. Always ``input_image``. Required. Default value is \"input_image\".""" + image_url: Optional[str] + file_id: Optional[str] + detail: Optional[DetailEnum] + """Known values are: \"low\", \"high\", and \"auto\".""" + + +class InputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. Default value is + "input_text". + :vartype type: str + :ivar text: The text input to the model. Required. + :vartype text: str + """ + + type: Required[Literal["input_text"]] + """The type of the input item. Always ``input_text``. Required. Default value is \"input_text\".""" + text: Required[str] + """The text input to the model. Required.""" + + +class InputTextContentParam(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. Default value is + "input_text". + :vartype type: str + :ivar text: The text input to the model. Required. + :vartype text: str + """ + + type: Required[Literal["input_text"]] + """The type of the input item. Always ``input_text``. Required. Default value is \"input_text\".""" + text: Required[str] + """The text input to the model. Required.""" + + +class ItemCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CODE_INTERPRETER_CALL + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[~azure.ai.agentserver.responses.models.types.CodeInterpreterOutputLogs + or ~azure.ai.agentserver.responses.models.types.CodeInterpreterOutputImage] + """ + + type: Required[Literal[ItemType.CODE_INTERPRETER_CALL]] + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. + CODE_INTERPRETER_CALL.""" + id: Required[str] + """The unique ID of the code interpreter tool call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: Required[str] + """The ID of the container used to run the code. Required.""" + code: Required[Optional[str]] + """Required.""" + outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] + """Required.""" + + +class ItemComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_CALL + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.ComputerAction + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: + list[~azure.ai.agentserver.responses.models.types.ComputerCallSafetyCheckParam] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemType.COMPUTER_CALL]] + """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" + id: Required[str] + """The unique ID of the computer call. Required.""" + call_id: Required[str] + """An identifier used when responding to the tool call with output. Required.""" + action: Required["ComputerAction"] + """Required.""" + pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] + """The pending safety checks for the computer call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM_TOOL_CALL + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + + type: Required[Literal[ItemType.CUSTOM_TOOL_CALL]] + """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" + id: str + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: Required[str] + """An identifier used to map this custom tool call to a tool call output. Required.""" + name: Required[str] + """The name of the custom tool being called. Required.""" + input: Required[str] + """The input for the custom tool call generated by the model. Required.""" + + +class ItemCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM_TOOL_CALL_OUTPUT + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: str or + list[~azure.ai.agentserver.responses.models.types.FunctionAndCustomToolCallOutput] + """ + + type: Required[Literal[ItemType.CUSTOM_TOOL_CALL_OUTPUT]] + """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. + CUSTOM_TOOL_CALL_OUTPUT.""" + id: str + """The unique ID of the custom tool call output in the OpenAI platform.""" + call_id: Required[str] + """The call ID, used to map this custom tool call output to a custom tool call. Required.""" + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the custom tool call generated by your code. Can be a string or an list of + output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + + +class ItemFieldApplyPatchToolCall(TypedDict, total=False): + """Apply patch tool call. + + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH_CALL + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: ~azure.ai.agentserver.responses.models.types.ApplyPatchFileOperation + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str + """ + + type: Required[Literal[ItemFieldType.APPLY_PATCH_CALL]] + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: Required[str] + """The unique ID of the apply patch tool call. Populated when this item is returned via API. + Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Required[ApplyPatchCallStatus] + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: Required["ApplyPatchFileOperation"] + """Apply patch operation. Required.""" + created_by: str + """The ID of the entity that created this tool call.""" + + +class ItemFieldApplyPatchToolCallOutput(TypedDict, total=False): + """Apply patch tool call output. + + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH_CALL_OUTPUT + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + :ivar created_by: The ID of the entity that created this tool call output. + :vartype created_by: str + """ + + type: Required[Literal[ItemFieldType.APPLY_PATCH_CALL_OUTPUT]] + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the apply patch tool call output. Populated when this item is returned via + API. Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Required[ApplyPatchCallOutputStatus] + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] + created_by: str + """The ID of the entity that created this tool call output.""" + + +class ItemFieldCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CODE_INTERPRETER_CALL + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[~azure.ai.agentserver.responses.models.types.CodeInterpreterOutputLogs + or ~azure.ai.agentserver.responses.models.types.CodeInterpreterOutputImage] + """ + + type: Required[Literal[ItemFieldType.CODE_INTERPRETER_CALL]] + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. + CODE_INTERPRETER_CALL.""" + id: Required[str] + """The unique ID of the code interpreter tool call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: Required[str] + """The ID of the container used to run the code. Required.""" + code: Required[Optional[str]] + """Required.""" + outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] + """Required.""" + + +class ItemFieldCompactionBody(TypedDict, total=False): + """Compaction item. + + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPACTION + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + type: Required[Literal[ItemFieldType.COMPACTION]] + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + id: Required[str] + """The unique ID of the compaction item. Required.""" + encrypted_content: Required[str] + """The encrypted content that was produced by compaction. Required.""" + created_by: str + """The identifier of the actor that created the item.""" + + +class ItemFieldComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_CALL + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.ComputerAction + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: + list[~azure.ai.agentserver.responses.models.types.ComputerCallSafetyCheckParam] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemFieldType.COMPUTER_CALL]] + """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" + id: Required[str] + """The unique ID of the computer call. Required.""" + call_id: Required[str] + """An identifier used when responding to the tool call with output. Required.""" + action: Required["ComputerAction"] + """Required.""" + pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] + """The pending safety checks for the computer call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemFieldComputerToolCallOutputResource(TypedDict, total=False): + """ItemFieldComputerToolCallOutputResource. + + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_CALL_OUTPUT + :ivar id: The ID of the computer tool call output. + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar acknowledged_safety_checks: The safety checks reported by the API that have been + acknowledged by the developer. + :vartype acknowledged_safety_checks: + list[~azure.ai.agentserver.responses.models.types.ComputerCallSafetyCheckParam] + :ivar output: Required. + :vartype output: ~azure.ai.agentserver.responses.models.types.ComputerScreenshotImage + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemFieldType.COMPUTER_CALL_OUTPUT]] + """The type of the computer tool call output. Always ``computer_call_output``. Required. + COMPUTER_CALL_OUTPUT.""" + id: str + """The ID of the computer tool call output.""" + call_id: Required[str] + """The ID of the computer tool call that produced the output. Required.""" + acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + """The safety checks reported by the API that have been acknowledged by the developer.""" + output: Required["ComputerScreenshotImage"] + """Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemFieldCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM_TOOL_CALL + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + + type: Required[Literal[ItemFieldType.CUSTOM_TOOL_CALL]] + """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" + id: str + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: Required[str] + """An identifier used to map this custom tool call to a tool call output. Required.""" + name: Required[str] + """The name of the custom tool being called. Required.""" + input: Required[str] + """The input for the custom tool call generated by the model. Required.""" + + +class ItemFieldCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM_TOOL_CALL_OUTPUT + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: str or + list[~azure.ai.agentserver.responses.models.types.FunctionAndCustomToolCallOutput] + """ + + type: Required[Literal[ItemFieldType.CUSTOM_TOOL_CALL_OUTPUT]] + """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. + CUSTOM_TOOL_CALL_OUTPUT.""" + id: str + """The unique ID of the custom tool call output in the OpenAI platform.""" + call_id: Required[str] + """The call ID, used to map this custom tool call output to a custom tool call. Required.""" + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the custom tool call generated by your code. Can be a string or an list of + output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + + +class ItemFieldFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_SEARCH_CALL + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list[~azure.ai.agentserver.responses.models.types.FileSearchToolCallResults] + """ + + id: Required[str] + """The unique ID of the file search tool call. Required.""" + type: Required[Literal[ItemFieldType.FILE_SEARCH_CALL]] + """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: Required[list[str]] + """The queries used to search for files. Required.""" + results: Optional[list["FileSearchToolCallResults"]] + + +class ItemFieldFunctionShellCall(TypedDict, total=False): + """Shell tool call. + + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL_CALL + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.FunctionShellAction + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.LocalShellCallStatus + :ivar environment: Required. + :vartype environment: ~azure.ai.agentserver.responses.models.types.FunctionShellCallEnvironment + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str + """ + + type: Required[Literal[ItemFieldType.SHELL_CALL]] + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + id: Required[str] + """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + action: Required["FunctionShellAction"] + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Required[LocalShellCallStatus] + """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: Required[Optional["FunctionShellCallEnvironment"]] + """Required.""" + created_by: str + """The ID of the entity that created this tool call.""" + + +class ItemFieldFunctionShellCallOutput(TypedDict, total=False): + """Shell call output. + + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL_CALL_OUTPUT + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.LocalShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: + list[~azure.ai.agentserver.responses.models.types.FunctionShellCallOutputContent] + :ivar max_output_length: Required. + :vartype max_output_length: int + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + type: Required[Literal[ItemFieldType.SHELL_CALL_OUTPUT]] + """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + status: Required[LocalShellCallOutputStatusEnum] + """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + output: Required[list["FunctionShellCallOutputContent"]] + """An array of shell call output contents. Required.""" + max_output_length: Required[Optional[int]] + """Required.""" + created_by: str + """The identifier of the actor that created the item.""" + + +class ItemFieldFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar id: The unique ID of the function tool call. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION_CALL + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + id: str + """The unique ID of the function tool call.""" + type: Required[Literal[ItemFieldType.FUNCTION_CALL]] + """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + name: Required[str] + """The name of the function to run. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the function. Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemFieldImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.IMAGE_GENERATION_CALL + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: str or str or str or str + :ivar result: Required. + :vartype result: str + """ + + type: Required[Literal[ItemFieldType.IMAGE_GENERATION_CALL]] + """The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL.""" + id: Required[str] + """The unique ID of the image generation call. Required.""" + status: Required[Literal["in_progress", "completed", "generating", "failed"]] + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: Required[Optional[str]] + """Required.""" + + +class ItemFieldLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL_CALL + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.LocalShellExecAction + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemFieldType.LOCAL_SHELL_CALL]] + """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" + id: Required[str] + """The unique ID of the local shell call. Required.""" + call_id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + action: Required["LocalShellExecAction"] + """Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemFieldLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL_CALL_OUTPUT + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemFieldType.LOCAL_SHELL_CALL_OUTPUT]] + """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. + LOCAL_SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + output: Required[str] + """A JSON string of the output of the local shell tool call. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] + """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], + Literal[\"incomplete\"]""" + + +class ItemFieldMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_APPROVAL_REQUEST + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + + type: Required[Literal[ItemFieldType.MCP_APPROVAL_REQUEST]] + """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" + id: Required[str] + """The unique ID of the approval request. Required.""" + server_label: Required[str] + """The label of the MCP server making the request. Required.""" + name: Required[str] + """The name of the tool to run. Required.""" + arguments: Required[str] + """A JSON string of arguments for the tool. Required.""" + + +class ItemFieldMcpApprovalResponseResource(TypedDict, total=False): + """MCP approval response. + + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_APPROVAL_RESPONSE + :ivar id: The unique ID of the approval response. Required. + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + + type: Required[Literal[ItemFieldType.MCP_APPROVAL_RESPONSE]] + """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" + id: Required[str] + """The unique ID of the approval response. Required.""" + approval_request_id: Required[str] + """The ID of the approval request being answered. Required.""" + approve: Required[bool] + """Whether the request was approved. Required.""" + reason: Optional[str] + + +class ItemFieldMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_LIST_TOOLS + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list[~azure.ai.agentserver.responses.models.types.MCPListToolsTool] + :ivar error: + :vartype error: str + """ + + type: Required[Literal[ItemFieldType.MCP_LIST_TOOLS]] + """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" + id: Required[str] + """The unique ID of the list. Required.""" + server_label: Required[str] + """The label of the MCP server. Required.""" + tools: Required[list["MCPListToolsTool"]] + """The tools available on the server. Required.""" + error: Optional[str] + + +class ItemFieldMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_CALL + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: + :vartype error: dict[str, any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + type: Required[Literal[ItemFieldType.MCP_CALL]] + """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" + id: Required[str] + """The unique ID of the tool call. Required.""" + server_label: Required[str] + """The label of the MCP server running the tool. Required.""" + name: Required[str] + """The name of the tool that was run. Required.""" + arguments: Required[str] + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] + error: dict[str, Any] + status: MCPToolCallStatus + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] + + +class ItemFieldMessage(TypedDict, total=False): + """Message. + + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MESSAGE + :ivar id: The unique ID of the message. Required. + :vartype id: str + :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.MessageStatus + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: str or ~azure.ai.agentserver.responses.models.models.MessageRole + :ivar content: The content of the message. Required. + :vartype content: list[~azure.ai.agentserver.responses.models.types.MessageContent] + """ + + type: Required[Literal[ItemFieldType.MESSAGE]] + """The type of the message. Always set to ``message``. Required. MESSAGE.""" + id: Required[str] + """The unique ID of the message. Required.""" + status: Required[MessageStatus] + """The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when + items are returned via API. Required. Known values are: \"in_progress\", \"completed\", and + \"incomplete\".""" + role: Required[MessageRole] + """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, + ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", + \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and + \"tool\".""" + content: Required[list["MessageContent"]] + """The content of the message. Required.""" + + +class ItemFieldReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REASONING + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list[~azure.ai.agentserver.responses.models.types.SummaryTextContent] + :ivar content: Reasoning text content. + :vartype content: list[~azure.ai.agentserver.responses.models.types.ReasoningTextContent] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemFieldType.REASONING]] + """The type of the object. Always ``reasoning``. Required. REASONING.""" + id: Required[str] + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] + summary: Required[list["SummaryTextContent"]] + """Reasoning summary content. Required.""" + content: list["ReasoningTextContent"] + """Reasoning text content.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemFieldWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WEB_SEARCH_CALL + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"] + :vartype status: str or str or str or str + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: ~azure.ai.agentserver.responses.models.types.WebSearchActionSearch or + ~azure.ai.agentserver.responses.models.types.WebSearchActionOpenPage or + ~azure.ai.agentserver.responses.models.types.WebSearchActionFind + """ + + id: Required[str] + """The unique ID of the web search tool call. Required.""" + type: Required[Literal[ItemFieldType.WEB_SEARCH_CALL]] + """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "failed"]] + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"]""" + action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" + + +class ItemFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_SEARCH_CALL + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list[~azure.ai.agentserver.responses.models.types.FileSearchToolCallResults] + """ + + id: Required[str] + """The unique ID of the file search tool call. Required.""" + type: Required[Literal[ItemType.FILE_SEARCH_CALL]] + """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: Required[list[str]] + """The queries used to search for files. Required.""" + results: Optional[list["FileSearchToolCallResults"]] + + +class ItemFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar id: The unique ID of the function tool call. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION_CALL + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + id: str + """The unique ID of the function tool call.""" + type: Required[Literal[ItemType.FUNCTION_CALL]] + """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + name: Required[str] + """The name of the function to run. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the function. Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.IMAGE_GENERATION_CALL + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: str or str or str or str + :ivar result: Required. + :vartype result: str + """ + + type: Required[Literal[ItemType.IMAGE_GENERATION_CALL]] + """The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL.""" + id: Required[str] + """The unique ID of the image generation call. Required.""" + status: Required[Literal["in_progress", "completed", "generating", "failed"]] + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: Required[Optional[str]] + """Required.""" + + +class ItemLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL_CALL + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.LocalShellExecAction + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemType.LOCAL_SHELL_CALL]] + """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" + id: Required[str] + """The unique ID of the local shell call. Required.""" + call_id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + action: Required["LocalShellExecAction"] + """Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL_CALL_OUTPUT + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemType.LOCAL_SHELL_CALL_OUTPUT]] + """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. + LOCAL_SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + output: Required[str] + """A JSON string of the output of the local shell tool call. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] + """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], + Literal[\"incomplete\"]""" + + +class ItemMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_APPROVAL_REQUEST + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + + type: Required[Literal[ItemType.MCP_APPROVAL_REQUEST]] + """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" + id: Required[str] + """The unique ID of the approval request. Required.""" + server_label: Required[str] + """The label of the MCP server making the request. Required.""" + name: Required[str] + """The name of the tool to run. Required.""" + arguments: Required[str] + """A JSON string of arguments for the tool. Required.""" + + +class ItemMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_LIST_TOOLS + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list[~azure.ai.agentserver.responses.models.types.MCPListToolsTool] + :ivar error: + :vartype error: str + """ + + type: Required[Literal[ItemType.MCP_LIST_TOOLS]] + """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" + id: Required[str] + """The unique ID of the list. Required.""" + server_label: Required[str] + """The label of the MCP server. Required.""" + tools: Required[list["MCPListToolsTool"]] + """The tools available on the server. Required.""" + error: Optional[str] + + +class ItemMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_CALL + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: + :vartype error: dict[str, any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + type: Required[Literal[ItemType.MCP_CALL]] + """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" + id: Required[str] + """The unique ID of the tool call. Required.""" + server_label: Required[str] + """The label of the MCP server running the tool. Required.""" + name: Required[str] + """The name of the tool that was run. Required.""" + arguments: Required[str] + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] + error: dict[str, Any] + status: MCPToolCallStatus + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] + + +class ItemMessage(TypedDict, total=False): + """Message. + + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MESSAGE + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: str or ~azure.ai.agentserver.responses.models.models.MessageRole + :ivar content: Required. Is either a str type or a [MessageContent] type. + :vartype content: str or list[~azure.ai.agentserver.responses.models.types.MessageContent] + """ + + type: Required[Literal[ItemType.MESSAGE]] + """The type of the message. Always set to ``message``. Required. MESSAGE.""" + role: Required[MessageRole] + """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, + ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", + \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and + \"tool\".""" + content: Required[Union[str, list["MessageContent"]]] + """Required. Is either a str type or a [MessageContent] type.""" + + +class ItemOutputMessage(TypedDict, total=False): + """Output message. + + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OUTPUT_MESSAGE + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: str + :ivar content: The content of the output message. Required. + :vartype content: list[~azure.ai.agentserver.responses.models.types.OutputMessageContent] + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + id: Required[str] + """The unique ID of the output message. Required.""" + type: Required[Literal[ItemType.OUTPUT_MESSAGE]] + """The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.""" + role: Required[Literal["assistant"]] + """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" + content: Required[list["OutputMessageContent"]] + """The content of the output message. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REASONING + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list[~azure.ai.agentserver.responses.models.types.SummaryTextContent] + :ivar content: Reasoning text content. + :vartype content: list[~azure.ai.agentserver.responses.models.types.ReasoningTextContent] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + type: Required[Literal[ItemType.REASONING]] + """The type of the object. Always ``reasoning``. Required. REASONING.""" + id: Required[str] + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] + summary: Required[list["SummaryTextContent"]] + """Reasoning summary content. Required.""" + content: list["ReasoningTextContent"] + """Reasoning text content.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class ItemReferenceParam(TypedDict, total=False): + """Item reference. + + :ivar type: The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.ITEM_REFERENCE + :ivar id: The ID of the item to reference. Required. + :vartype id: str + """ + + type: Required[Literal[ItemType.ITEM_REFERENCE]] + """The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE.""" + id: Required[str] + """The ID of the item to reference. Required.""" + + +class ItemWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WEB_SEARCH_CALL + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"] + :vartype status: str or str or str or str + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: ~azure.ai.agentserver.responses.models.types.WebSearchActionSearch or + ~azure.ai.agentserver.responses.models.types.WebSearchActionOpenPage or + ~azure.ai.agentserver.responses.models.types.WebSearchActionFind + """ + + id: Required[str] + """The unique ID of the web search tool call. Required.""" + type: Required[Literal[ItemType.WEB_SEARCH_CALL]] + """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "failed"]] + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"]""" + action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" + + +class KeyPressAction(TypedDict, total=False): + """KeyPress. + + :ivar type: Specifies the event type. For a keypress action, this property is always set to + ``keypress``. Required. KEYPRESS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.KEYPRESS + :ivar keys_property: The combination of keys the model is requesting to be pressed. This is an + array of strings, each representing a key. Required. + :vartype keys_property: list[str] + """ + + type: Required[Literal[ComputerActionType.KEYPRESS]] + """Specifies the event type. For a keypress action, this property is always set to ``keypress``. + Required. KEYPRESS.""" + keys: Required[list[str]] + """The combination of keys the model is requesting to be pressed. This is an array of strings, + each representing a key. Required.""" + + +class LocalEnvironmentResource(TypedDict, total=False): + """Local Environment. + + :ivar type: The environment type. Always ``local``. Required. LOCAL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL + """ + + type: Required[Literal[FunctionShellCallEnvironmentType.LOCAL]] + """The environment type. Always ``local``. Required. LOCAL.""" + + +class LocalShellExecAction(TypedDict, total=False): + """Local shell exec action. + + :ivar type: The type of the local shell action. Always ``exec``. Required. Default value is + "exec". + :vartype type: str + :ivar command: The command to run. Required. + :vartype command: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar working_directory: + :vartype working_directory: str + :ivar env: Environment variables to set for the command. Required. + :vartype env: dict[str, str] + :ivar user: + :vartype user: str + """ + + type: Required[Literal["exec"]] + """The type of the local shell action. Always ``exec``. Required. Default value is \"exec\".""" + command: Required[list[str]] + """The command to run. Required.""" + timeout_ms: Optional[int] + working_directory: Optional[str] + env: Required[dict[str, str]] + """Environment variables to set for the command. Required.""" + user: Optional[str] + + +class LocalShellToolParam(TypedDict, total=False): + """Local shell tool. + + :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal[ToolType.LOCAL_SHELL]] + """The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + +class LocalSkillParam(TypedDict, total=False): + """LocalSkillParam. + + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar path: The path to the directory containing the skill. Required. + :vartype path: str + """ + + name: Required[str] + """The name of the skill. Required.""" + description: Required[str] + """The description of the skill. Required.""" + path: Required[str] + """The path to the directory containing the skill. Required.""" + + +class LogProb(TypedDict, total=False): + """Log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: float + :ivar bytes: Required. + :vartype bytes: list[int] + :ivar top_logprobs: Required. + :vartype top_logprobs: list[~azure.ai.agentserver.responses.models.types.TopLogProb] + """ + + token: Required[str] + """Required.""" + logprob: Required[float] + """Required.""" + bytes: Required[list[int]] + """Required.""" + top_logprobs: Required[list["TopLogProb"]] + """Required.""" + + +class MCPApprovalResponse(TypedDict, total=False): + """MCP approval response. + + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_APPROVAL_RESPONSE + :ivar id: + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + + type: Required[Literal[ItemType.MCP_APPROVAL_RESPONSE]] + """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" + id: Optional[str] + approval_request_id: Required[str] + """The ID of the approval request being answered. Required.""" + approve: Required[bool] + """Whether the request was approved. Required.""" + reason: Optional[str] + + +class MCPListToolsTool(TypedDict, total=False): + """MCP list tools tool. + + :ivar name: The name of the tool. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar input_schema: The JSON schema describing the tool's input. Required. + :vartype input_schema: ~azure.ai.agentserver.responses.models.types.MCPListToolsToolInputSchema + :ivar annotations: + :vartype annotations: ~azure.ai.agentserver.responses.models.types.MCPListToolsToolAnnotations + """ + + name: Required[str] + """The name of the tool. Required.""" + description: Optional[str] + input_schema: Required["MCPListToolsToolInputSchema"] + """The JSON schema describing the tool's input. Required.""" + annotations: Optional["MCPListToolsToolAnnotations"] + + +class MCPListToolsToolAnnotations(TypedDict, total=False): + """MCPListToolsToolAnnotations.""" + + +class MCPListToolsToolInputSchema(TypedDict, total=False): + """MCPListToolsToolInputSchema.""" + + +class MCPTool(TypedDict, total=False): + """MCP tool. + + :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP + :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. + :vartype server_label: str + :ivar server_url: The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be + provided. + :vartype server_url: str + :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of + ``server_url`` or ``connector_id`` must be provided. Learn more about service connectors `here + `_. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], + Literal["connector_googledrive"], Literal["connector_microsoftteams"], + Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], + Literal["connector_sharepoint"] + :vartype connector_id: str or str or str or str or str or str or str or str + :ivar authorization: An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application must handle the OAuth + authorization flow and provide the token here. + :vartype authorization: str + :ivar server_description: Optional description of the MCP server, used to provide more context. + :vartype server_description: str + :ivar headers: + :vartype headers: dict[str, str] + :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. + :vartype allowed_tools: list[str] or ~azure.ai.agentserver.responses.models.types.MCPToolFilter + :ivar require_approval: Is one of the following types: MCPToolRequireApproval, + Literal["always"], Literal["never"] + :vartype require_approval: ~azure.ai.agentserver.responses.models.types.MCPToolRequireApproval + or str or str + :ivar project_connection_id: The connection ID in the project for the MCP server. The + connection stores authentication and other connection details needed to connect to the MCP + server. + :vartype project_connection_id: str + """ + + type: Required[Literal[ToolType.MCP]] + """The type of the MCP tool. Always ``mcp``. Required. MCP.""" + server_label: Required[str] + """A label for this MCP server, used to identify it in tool calls. Required.""" + server_url: str + """The URL for the MCP server. One of ``server_url`` or ``connector_id`` must be provided.""" + connector_id: Literal[ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint", + ] + """Identifier for service connectors, like those available in ChatGPT. One of ``server_url`` or + ``connector_id`` must be provided. Learn more about service connectors `here + `_. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal[\"connector_dropbox\"], Literal[\"connector_gmail\"], + Literal[\"connector_googlecalendar\"], Literal[\"connector_googledrive\"], + Literal[\"connector_microsoftteams\"], Literal[\"connector_outlookcalendar\"], + Literal[\"connector_outlookemail\"], Literal[\"connector_sharepoint\"]""" + authorization: str + """An OAuth access token that can be used with a remote MCP server, either with a custom MCP + server URL or a service connector. Your application must handle the OAuth authorization flow + and provide the token here.""" + server_description: str + """Optional description of the MCP server, used to provide more context.""" + headers: Optional[dict[str, str]] + allowed_tools: Optional[Union[list[str], "MCPToolFilter"]] + """Is either a [str] type or a MCPToolFilter type.""" + require_approval: Optional[Union["MCPToolRequireApproval", Literal["always"], Literal["never"]]] + """Is one of the following types: MCPToolRequireApproval, Literal[\"always\"], Literal[\"never\"]""" + project_connection_id: str + """The connection ID in the project for the MCP server. The connection stores authentication and + other connection details needed to connect to the MCP server.""" + + +class MCPToolFilter(TypedDict, total=False): + """MCP tool filter. + + :ivar tool_names: MCP allowed tools. + :vartype tool_names: list[str] + :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP + server is `annotated with `readOnlyHint` + `_, + it will match this filter. + :vartype read_only: bool + """ + + tool_names: list[str] + """MCP allowed tools.""" + read_only: bool + """Indicates whether or not a tool modifies data or is read-only. If an MCP server is `annotated + with `readOnlyHint` + `_, + it will match this filter.""" + + +class MCPToolRequireApproval(TypedDict, total=False): + """MCPToolRequireApproval. + + :ivar always: + :vartype always: ~azure.ai.agentserver.responses.models.types.MCPToolFilter + :ivar never: + :vartype never: ~azure.ai.agentserver.responses.models.types.MCPToolFilter + """ + + always: "MCPToolFilter" + never: "MCPToolFilter" + + +class MemorySearchItem(TypedDict, total=False): + """A retrieved memory item from memory search. + + :ivar memory_item: Retrieved memory item. Required. + :vartype memory_item: ~azure.ai.agentserver.responses.models.types.MemoryItem + """ + + memory_item: Required["MemoryItem"] + """Retrieved memory item. Required.""" + + +class MemorySearchOptions(TypedDict, total=False): + """Memory search options. + + :ivar max_memories: Maximum number of memory items to return. + :vartype max_memories: int + """ + + max_memories: int + """Maximum number of memory items to return.""" + + +class MemorySearchPreviewTool(TypedDict, total=False): + """A tool for integrating memories into the agent. + + :ivar type: The type of the tool. Always ``memory_search_preview``. Required. + MEMORY_SEARCH_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MEMORY_SEARCH_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar memory_store_name: The name of the memory store to use. Required. + :vartype memory_store_name: str + :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which + memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to + the current signed-in user. Required. + :vartype scope: str + :ivar search_options: Options for searching the memory store. + :vartype search_options: ~azure.ai.agentserver.responses.models.types.MemorySearchOptions + :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default + 300. + :vartype update_delay: int + """ + + type: Required[Literal[ToolType.MEMORY_SEARCH_PREVIEW]] + """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + memory_store_name: Required[str] + """The name of the memory store to use. Required.""" + scope: Required[str] + """The namespace used to group and isolate memories, such as a user ID. Limits which memories can + be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current + signed-in user. Required.""" + search_options: "MemorySearchOptions" + """Options for searching the memory store.""" + update_delay: int + """Time to wait before updating memories after inactivity (seconds). Default 300.""" + + +class MemorySearchTool(TypedDict, total=False): + """A tool for integrating memories into the agent. + + :ivar type: The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MEMORY_SEARCH + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar memory_store_name: The name of the memory store to use. Required. + :vartype memory_store_name: str + :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which + memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to + the current signed-in user. Required. + :vartype scope: str + :ivar search_options: Options for searching the memory store. + :vartype search_options: ~azure.ai.agentserver.responses.models.types.MemorySearchOptions + :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default + 300. + :vartype update_delay: int + """ + + type: Required[Literal[ToolType.MEMORY_SEARCH]] + """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + memory_store_name: Required[str] + """The name of the memory store to use. Required.""" + scope: Required[str] + """The namespace used to group and isolate memories, such as a user ID. Limits which memories can + be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current + signed-in user. Required.""" + search_options: "MemorySearchOptions" + """Options for searching the memory store.""" + update_delay: int + """Time to wait before updating memories after inactivity (seconds). Default 300.""" + + +class MemorySearchToolCallItemParam(TypedDict, total=False): + """MemorySearchToolCallItemParam. + + :ivar type: Required. MEMORY_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MEMORY_SEARCH_CALL + :ivar results: The results returned from the memory search. + :vartype results: list[~azure.ai.agentserver.responses.models.types.MemorySearchItem] + """ + + type: Required[Literal[ItemType.MEMORY_SEARCH_CALL]] + """Required. MEMORY_SEARCH_CALL.""" + results: Optional[list["MemorySearchItem"]] + """The results returned from the memory search.""" + + +class MemorySearchToolCallItemResource(TypedDict, total=False): + """MemorySearchToolCallItemResource. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. MEMORY_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MEMORY_SEARCH_CALL + :ivar status: The status of the memory search tool call. One of ``in_progress``, ``searching``, + ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["incomplete"], + Literal["failed"] + :vartype status: str or str or str or str or str + :ivar results: The results returned from the memory search. + :vartype results: list[~azure.ai.agentserver.responses.models.types.MemorySearchItem] + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.MEMORY_SEARCH_CALL]] + """Required. MEMORY_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the memory search tool call. One of ``in_progress``, ``searching``, + ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], + Literal[\"incomplete\"], Literal[\"failed\"]""" + results: Optional[list["MemorySearchItem"]] + """The results returned from the memory search.""" + id: Required[str] + """Required.""" + + +class MessageContentInputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INPUT_FILE + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + """ + + type: Required[Literal[MessageContentType.INPUT_FILE]] + """The type of the input item. Always ``input_file``. Required. INPUT_FILE.""" + file_id: Optional[str] + filename: str + """The name of the file to be sent to the model.""" + file_url: str + """The URL of the file to be sent to the model.""" + file_data: str + """The content of the file to be sent to the model.""" + + +class MessageContentInputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INPUT_IMAGE + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + or ``auto``. Defaults to ``auto``. Required. Known values are: "low", "high", and "auto". + :vartype detail: str or ~azure.ai.agentserver.responses.models.models.ImageDetail + """ + + type: Required[Literal[MessageContentType.INPUT_IMAGE]] + """The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.""" + image_url: Optional[str] + file_id: Optional[str] + detail: Required[ImageDetail] + """The detail level of the image to be sent to the model. One of ``high``, ``low``, or ``auto``. + Defaults to ``auto``. Required. Known values are: \"low\", \"high\", and \"auto\".""" + + +class MessageContentInputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.INPUT_TEXT + :ivar text: The text input to the model. Required. + :vartype text: str + """ + + type: Required[Literal[MessageContentType.INPUT_TEXT]] + """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" + text: Required[str] + """The text input to the model. Required.""" + + +class MessageContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OUTPUT_TEXT + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. Required. + :vartype annotations: list[~azure.ai.agentserver.responses.models.types.Annotation] + :ivar logprobs: Required. + :vartype logprobs: list[~azure.ai.agentserver.responses.models.types.LogProb] + """ + + type: Required[Literal[MessageContentType.OUTPUT_TEXT]] + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: Required[str] + """The text output from the model. Required.""" + annotations: Required[list["Annotation"]] + """The annotations of the text output. Required.""" + logprobs: Required[list["LogProb"]] + """Required.""" + + +class MessageContentReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. + REASONING_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REASONING_TEXT + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Required[Literal[MessageContentType.REASONING_TEXT]] + """The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.""" + text: Required[str] + """The reasoning text from the model. Required.""" + + +class MessageContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REFUSAL + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + + type: Required[Literal[MessageContentType.REFUSAL]] + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: Required[str] + """The refusal explanation from the model. Required.""" + + +class Metadata(TypedDict, total=False): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters. + + """ + + +class MicrosoftFabricPreviewTool(TypedDict, total=False): + """The input definition information for a Microsoft Fabric tool as used to configure an agent. + + :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FABRIC_DATAAGENT_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. + :vartype fabric_dataagent_preview: + ~azure.ai.agentserver.responses.models.types.FabricDataAgentToolParameters + """ + + type: Required[Literal[ToolType.FABRIC_DATAAGENT_PREVIEW]] + """The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + fabric_dataagent_preview: Required["FabricDataAgentToolParameters"] + """The fabric data agent tool parameters. Required.""" + + +class MoveParam(TypedDict, total=False): + """Move. + + :ivar type: Specifies the event type. For a move action, this property is always set to + ``move``. Required. MOVE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MOVE + :ivar x: The x-coordinate to move to. Required. + :vartype x: int + :ivar y: The y-coordinate to move to. Required. + :vartype y: int + """ + + type: Required[Literal[ComputerActionType.MOVE]] + """Specifies the event type. For a move action, this property is always set to ``move``. Required. + MOVE.""" + x: Required[int] + """The x-coordinate to move to. Required.""" + y: Required[int] + """The y-coordinate to move to. Required.""" + + +class OAuthConsentRequestOutputItem(TypedDict, total=False): + """Request from the service for the user to perform OAuth consent. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: Required. + :vartype id: str + :ivar type: Required. OAUTH_CONSENT_REQUEST. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OAUTH_CONSENT_REQUEST + :ivar consent_link: The link the user can use to perform OAuth consent. Required. + :vartype consent_link: str + :ivar server_label: The server label for the OAuth consent request. Required. + :vartype server_label: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """Required.""" + type: Required[Literal[OutputItemType.OAUTH_CONSENT_REQUEST]] + """Required. OAUTH_CONSENT_REQUEST.""" + consent_link: Required[str] + """The link the user can use to perform OAuth consent. Required.""" + server_label: Required[str] + """The server label for the OAuth consent request. Required.""" + + +class OpenApiAnonymousAuthDetails(TypedDict, total=False): + """Security details for OpenApi anonymous authentication. + + :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.ANONYMOUS + """ + + type: Required[Literal[OpenApiAuthType.ANONYMOUS]] + """The object type, which is always 'anonymous'. Required. ANONYMOUS.""" + + +class OpenApiFunctionDefinition(TypedDict, total=False): + """The input definition information for an openapi function. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar spec: The openapi function shape, described as a JSON Schema object. Required. + :vartype spec: dict[str, any] + :ivar auth: Open API authentication details. Required. + :vartype auth: ~azure.ai.agentserver.responses.models.types.OpenApiAuthDetails + :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults. + :vartype default_params: list[str] + :ivar functions: List of function definitions used by OpenApi tool. + :vartype functions: + list[~azure.ai.agentserver.responses.models.types.OpenApiFunctionDefinitionFunction] + """ + + name: Required[str] + """The name of the function to be called. Required.""" + description: str + """A description of what the function does, used by the model to choose when and how to call the + function.""" + spec: Required[dict[str, Any]] + """The openapi function shape, described as a JSON Schema object. Required.""" + auth: Required["OpenApiAuthDetails"] + """Open API authentication details. Required.""" + default_params: list[str] + """List of OpenAPI spec parameters that will use user-provided defaults.""" + functions: list["OpenApiFunctionDefinitionFunction"] + """List of function definitions used by OpenApi tool.""" + + +class OpenApiFunctionDefinitionFunction(TypedDict, total=False): + """OpenApiFunctionDefinitionFunction. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, any] + """ + + name: Required[str] + """The name of the function to be called. Required.""" + description: str + """A description of what the function does, used by the model to choose when and how to call the + function.""" + parameters: Required[dict[str, Any]] + """The parameters the functions accepts, described as a JSON Schema object. Required.""" + + +class OpenApiManagedAuthDetails(TypedDict, total=False): + """Security details for OpenApi managed_identity authentication. + + :ivar type: The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MANAGED_IDENTITY + :ivar security_scheme: Connection auth security details. Required. + :vartype security_scheme: + ~azure.ai.agentserver.responses.models.types.OpenApiManagedSecurityScheme + """ + + type: Required[Literal[OpenApiAuthType.MANAGED_IDENTITY]] + """The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY.""" + security_scheme: Required["OpenApiManagedSecurityScheme"] + """Connection auth security details. Required.""" + + +class OpenApiManagedSecurityScheme(TypedDict, total=False): + """Security scheme for OpenApi managed_identity authentication. + + :ivar audience: Authentication scope for managed_identity auth type. Required. + :vartype audience: str + """ + + audience: Required[str] + """Authentication scope for managed_identity auth type. Required.""" + + +class OpenApiProjectConnectionAuthDetails(TypedDict, total=False): + """Security details for OpenApi project connection authentication. + + :ivar type: The object type, which is always 'project_connection'. Required. + PROJECT_CONNECTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.PROJECT_CONNECTION + :ivar security_scheme: Project connection auth security details. Required. + :vartype security_scheme: + ~azure.ai.agentserver.responses.models.types.OpenApiProjectConnectionSecurityScheme + """ + + type: Required[Literal[OpenApiAuthType.PROJECT_CONNECTION]] + """The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION.""" + security_scheme: Required["OpenApiProjectConnectionSecurityScheme"] + """Project connection auth security details. Required.""" + + +class OpenApiProjectConnectionSecurityScheme(TypedDict, total=False): + """Security scheme for OpenApi managed_identity authentication. + + :ivar project_connection_id: Project connection id for Project Connection auth type. Required. + :vartype project_connection_id: str + """ + + project_connection_id: Required[str] + """Project connection id for Project Connection auth type. Required.""" + + +class OpenApiTool(TypedDict, total=False): + """The input definition information for an OpenAPI tool as used to configure an agent. + + :ivar type: The object type, which is always 'openapi'. Required. OPENAPI. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OPENAPI + :ivar openapi: The openapi function definition. Required. + :vartype openapi: ~azure.ai.agentserver.responses.models.types.OpenApiFunctionDefinition + """ + + type: Required[Literal[ToolType.OPENAPI]] + """The object type, which is always 'openapi'. Required. OPENAPI.""" + openapi: Required["OpenApiFunctionDefinition"] + """The openapi function definition. Required.""" + + +class OpenApiToolCall(TypedDict, total=False): + """An OpenAPI tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OPENAPI_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.OPENAPI_CALL]] + """Required. OPENAPI_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the OpenAPI operation being called. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class OpenApiToolCallOutput(TypedDict, total=False): + """The output of an OpenAPI tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OPENAPI_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation that was called. Required. + :vartype name: str + :ivar output: The output from the OpenAPI tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.OPENAPI_CALL_OUTPUT]] + """Required. OPENAPI_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the OpenAPI operation that was called. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the OpenAPI tool call. Is one of the following types: {str: Any}, str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class OutputContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OUTPUT_TEXT + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. Required. + :vartype annotations: list[~azure.ai.agentserver.responses.models.types.Annotation] + :ivar logprobs: Required. + :vartype logprobs: list[~azure.ai.agentserver.responses.models.types.LogProb] + """ + + type: Required[Literal[OutputContentType.OUTPUT_TEXT]] + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: Required[str] + """The text output from the model. Required.""" + annotations: Required[list["Annotation"]] + """The annotations of the text output. Required.""" + logprobs: Required[list["LogProb"]] + """Required.""" + + +class OutputContentReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. + REASONING_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REASONING_TEXT + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Required[Literal[OutputContentType.REASONING_TEXT]] + """The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.""" + text: Required[str] + """The reasoning text from the model. Required.""" + + +class OutputContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REFUSAL + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + + type: Required[Literal[OutputContentType.REFUSAL]] + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: Required[str] + """The refusal explanation from the model. Required.""" + + +class OutputItemApplyPatchToolCall(TypedDict, total=False): + """Apply patch tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH_CALL + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: ~azure.ai.agentserver.responses.models.types.ApplyPatchFileOperation + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.APPLY_PATCH_CALL]] + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: Required[str] + """The unique ID of the apply patch tool call. Populated when this item is returned via API. + Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Required[ApplyPatchCallStatus] + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: Required["ApplyPatchFileOperation"] + """Apply patch operation. Required.""" + + +class OutputItemApplyPatchToolCallOutput(TypedDict, total=False): + """Apply patch tool call output. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH_CALL_OUTPUT + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.APPLY_PATCH_CALL_OUTPUT]] + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the apply patch tool call output. Populated when this item is returned via + API. Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + status: Required[ApplyPatchCallOutputStatus] + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] + + +class OutputItemCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CODE_INTERPRETER_CALL + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[~azure.ai.agentserver.responses.models.types.CodeInterpreterOutputLogs + or ~azure.ai.agentserver.responses.models.types.CodeInterpreterOutputImage] + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.CODE_INTERPRETER_CALL]] + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. + CODE_INTERPRETER_CALL.""" + id: Required[str] + """The unique ID of the code interpreter tool call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: Required[str] + """The ID of the container used to run the code. Required.""" + code: Required[Optional[str]] + """Required.""" + outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] + """Required.""" + + +class OutputItemCompactionBody(TypedDict, total=False): + """Compaction item. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPACTION + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.COMPACTION]] + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + id: Required[str] + """The unique ID of the compaction item. Required.""" + encrypted_content: Required[str] + """The encrypted content that was produced by compaction. Required.""" + + +class OutputItemComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_CALL + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.ComputerAction + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: + list[~azure.ai.agentserver.responses.models.types.ComputerCallSafetyCheckParam] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.COMPUTER_CALL]] + """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" + id: Required[str] + """The unique ID of the computer call. Required.""" + call_id: Required[str] + """An identifier used when responding to the tool call with output. Required.""" + action: Required["ComputerAction"] + """Required.""" + pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] + """The pending safety checks for the computer call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class OutputItemComputerToolCallOutputResource(TypedDict, total=False): + """OutputItemComputerToolCallOutputResource. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_CALL_OUTPUT + :ivar id: The ID of the computer tool call output. + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar acknowledged_safety_checks: The safety checks reported by the API that have been + acknowledged by the developer. + :vartype acknowledged_safety_checks: + list[~azure.ai.agentserver.responses.models.types.ComputerCallSafetyCheckParam] + :ivar output: Required. + :vartype output: ~azure.ai.agentserver.responses.models.types.ComputerScreenshotImage + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.COMPUTER_CALL_OUTPUT]] + """The type of the computer tool call output. Always ``computer_call_output``. Required. + COMPUTER_CALL_OUTPUT.""" + id: str + """The ID of the computer tool call output.""" + call_id: Required[str] + """The ID of the computer tool call that produced the output. Required.""" + acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + """The safety checks reported by the API that have been acknowledged by the developer.""" + output: Required["ComputerScreenshotImage"] + """Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class OutputItemCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM_TOOL_CALL + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.CUSTOM_TOOL_CALL]] + """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" + id: str + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: Required[str] + """An identifier used to map this custom tool call to a tool call output. Required.""" + name: Required[str] + """The name of the custom tool being called. Required.""" + input: Required[str] + """The input for the custom tool call generated by the model. Required.""" + + +class OutputItemCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM_TOOL_CALL_OUTPUT + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: str or + list[~azure.ai.agentserver.responses.models.types.FunctionAndCustomToolCallOutput] + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.CUSTOM_TOOL_CALL_OUTPUT]] + """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. + CUSTOM_TOOL_CALL_OUTPUT.""" + id: str + """The unique ID of the custom tool call output in the OpenAI platform.""" + call_id: Required[str] + """The call ID, used to map this custom tool call output to a custom tool call. Required.""" + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the custom tool call generated by your code. Can be a string or an list of + output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + + +class OutputItemFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_SEARCH_CALL + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: str or str or str or str or str + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list[~azure.ai.agentserver.responses.models.types.FileSearchToolCallResults] + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the file search tool call. Required.""" + type: Required[Literal[OutputItemType.FILE_SEARCH_CALL]] + """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: Required[list[str]] + """The queries used to search for files. Required.""" + results: Optional[list["FileSearchToolCallResults"]] + + +class OutputItemFunctionShellCall(TypedDict, total=False): + """Shell tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL_CALL + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.FunctionShellAction + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.LocalShellCallStatus + :ivar environment: Required. + :vartype environment: ~azure.ai.agentserver.responses.models.types.FunctionShellCallEnvironment + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.SHELL_CALL]] + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + id: Required[str] + """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + action: Required["FunctionShellAction"] + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Required[LocalShellCallStatus] + """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: Required[Optional["FunctionShellCallEnvironment"]] + """Required.""" + + +class OutputItemFunctionShellCallOutput(TypedDict, total=False): + """Shell call output. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL_CALL_OUTPUT + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: str or + ~azure.ai.agentserver.responses.models.models.LocalShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: + list[~azure.ai.agentserver.responses.models.types.FunctionShellCallOutputContent] + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.SHELL_CALL_OUTPUT]] + """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + status: Required[LocalShellCallOutputStatusEnum] + """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + output: Required[list["FunctionShellCallOutputContent"]] + """An array of shell call output contents. Required.""" + max_output_length: Required[Optional[int]] + """Required.""" + + +class OutputItemFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION_CALL + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: str + """The unique ID of the function tool call.""" + type: Required[Literal[OutputItemType.FUNCTION_CALL]] + """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + name: Required[str] + """The name of the function to run. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the function. Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class OutputItemImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.IMAGE_GENERATION_CALL + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: str or str or str or str + :ivar result: Required. + :vartype result: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.IMAGE_GENERATION_CALL]] + """The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL.""" + id: Required[str] + """The unique ID of the image generation call. Required.""" + status: Required[Literal["in_progress", "completed", "generating", "failed"]] + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: Required[Optional[str]] + """Required.""" + + +class OutputItemLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL_CALL + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: ~azure.ai.agentserver.responses.models.types.LocalShellExecAction + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.LOCAL_SHELL_CALL]] + """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" + id: Required[str] + """The unique ID of the local shell call. Required.""" + call_id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + action: Required["LocalShellExecAction"] + """Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class OutputItemLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.LOCAL_SHELL_CALL_OUTPUT + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.LOCAL_SHELL_CALL_OUTPUT]] + """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. + LOCAL_SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + output: Required[str] + """A JSON string of the output of the local shell tool call. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] + """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], + Literal[\"incomplete\"]""" + + +class OutputItemMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_APPROVAL_REQUEST + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.MCP_APPROVAL_REQUEST]] + """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" + id: Required[str] + """The unique ID of the approval request. Required.""" + server_label: Required[str] + """The label of the MCP server making the request. Required.""" + name: Required[str] + """The name of the tool to run. Required.""" + arguments: Required[str] + """A JSON string of arguments for the tool. Required.""" + + +class OutputItemMcpApprovalResponseResource(TypedDict, total=False): + """MCP approval response. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_APPROVAL_RESPONSE + :ivar id: The unique ID of the approval response. Required. + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.MCP_APPROVAL_RESPONSE]] + """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" + id: Required[str] + """The unique ID of the approval response. Required.""" + approval_request_id: Required[str] + """The ID of the approval request being answered. Required.""" + approve: Required[bool] + """Whether the request was approved. Required.""" + reason: Optional[str] + + +class OutputItemMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_LIST_TOOLS + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list[~azure.ai.agentserver.responses.models.types.MCPListToolsTool] + :ivar error: + :vartype error: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.MCP_LIST_TOOLS]] + """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" + id: Required[str] + """The unique ID of the list. Required.""" + server_label: Required[str] + """The label of the MCP server. Required.""" + tools: Required[list["MCPListToolsTool"]] + """The tools available on the server. Required.""" + error: Optional[str] + + +class OutputItemMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP_CALL + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: + :vartype error: dict[str, any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.MCP_CALL]] + """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" + id: Required[str] + """The unique ID of the tool call. Required.""" + server_label: Required[str] + """The label of the MCP server running the tool. Required.""" + name: Required[str] + """The name of the tool that was run. Required.""" + arguments: Required[str] + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] + error: dict[str, Any] + status: MCPToolCallStatus + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] + + +class OutputItemMessage(TypedDict, total=False): + """Message. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MESSAGE + :ivar id: The unique ID of the message. Required. + :vartype id: str + :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.MessageStatus + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: str or ~azure.ai.agentserver.responses.models.models.MessageRole + :ivar content: The content of the message. Required. + :vartype content: list[~azure.ai.agentserver.responses.models.types.MessageContent] + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.MESSAGE]] + """The type of the message. Always set to ``message``. Required. MESSAGE.""" + id: Required[str] + """The unique ID of the message. Required.""" + status: Required[MessageStatus] + """The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when + items are returned via API. Required. Known values are: \"in_progress\", \"completed\", and + \"incomplete\".""" + role: Required[MessageRole] + """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, + ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", + \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and + \"tool\".""" + content: Required[list["MessageContent"]] + """The content of the message. Required.""" + + +class OutputItemOutputMessage(TypedDict, total=False): + """Output message. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OUTPUT_MESSAGE + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: str + :ivar content: The content of the output message. Required. + :vartype content: list[~azure.ai.agentserver.responses.models.types.OutputMessageContent] + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the output message. Required.""" + type: Required[Literal[OutputItemType.OUTPUT_MESSAGE]] + """The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.""" + role: Required[Literal["assistant"]] + """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" + content: Required[list["OutputMessageContent"]] + """The content of the output message. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class OutputItemReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REASONING + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list[~azure.ai.agentserver.responses.models.types.SummaryTextContent] + :ivar content: Reasoning text content. + :vartype content: list[~azure.ai.agentserver.responses.models.types.ReasoningTextContent] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: str or str or str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.REASONING]] + """The type of the object. Always ``reasoning``. Required. REASONING.""" + id: Required[str] + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] + summary: Required[list["SummaryTextContent"]] + """Reasoning summary content. Required.""" + content: list["ReasoningTextContent"] + """Reasoning text content.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + +class OutputItemWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WEB_SEARCH_CALL + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"] + :vartype status: str or str or str or str + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: ~azure.ai.agentserver.responses.models.types.WebSearchActionSearch or + ~azure.ai.agentserver.responses.models.types.WebSearchActionOpenPage or + ~azure.ai.agentserver.responses.models.types.WebSearchActionFind + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the web search tool call. Required.""" + type: Required[Literal[OutputItemType.WEB_SEARCH_CALL]] + """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "failed"]] + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"]""" + action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" + + +class OutputMessageContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.OUTPUT_TEXT + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. Required. + :vartype annotations: list[~azure.ai.agentserver.responses.models.types.Annotation] + :ivar logprobs: Required. + :vartype logprobs: list[~azure.ai.agentserver.responses.models.types.LogProb] + """ + + type: Required[Literal[OutputMessageContentType.OUTPUT_TEXT]] + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: Required[str] + """The text output from the model. Required.""" + annotations: Required[list["Annotation"]] + """The annotations of the text output. Required.""" + logprobs: Required[list["LogProb"]] + """Required.""" + + +class OutputMessageContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.REFUSAL + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + + type: Required[Literal[OutputMessageContentType.REFUSAL]] + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: Required[str] + """The refusal explanation from the model. Required.""" + + +class Prompt(TypedDict, total=False): + """Reference to a prompt template and its variables. `Learn more + `_. + + :ivar id: The unique identifier of the prompt template to use. Required. + :vartype id: str + :ivar version: + :vartype version: str + :ivar variables: + :vartype variables: ~azure.ai.agentserver.responses.models.types.ResponsePromptVariables + """ + + id: Required[str] + """The unique identifier of the prompt template to use. Required.""" + version: Optional[str] + variables: Optional["ResponsePromptVariables"] + + +class RankingOptions(TypedDict, total=False): + """RankingOptions. + + :ivar ranker: The ranker to use for the file search. Known values are: "auto" and + "default-2024-11-15". + :vartype ranker: str or ~azure.ai.agentserver.responses.models.models.RankerVersionType + :ivar score_threshold: The score threshold for the file search, a number between 0 and 1. + Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer + results. + :vartype score_threshold: float + :ivar hybrid_search: Weights that control how reciprocal rank fusion balances semantic + embedding matches versus sparse keyword matches when hybrid search is enabled. + :vartype hybrid_search: ~azure.ai.agentserver.responses.models.types.HybridSearchOptions + """ + + ranker: RankerVersionType + """The ranker to use for the file search. Known values are: \"auto\" and \"default-2024-11-15\".""" + score_threshold: float + """The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will + attempt to return only the most relevant results, but may return fewer results.""" + hybrid_search: "HybridSearchOptions" + """Weights that control how reciprocal rank fusion balances semantic embedding matches versus + sparse keyword matches when hybrid search is enabled.""" + + +class Reasoning(TypedDict, total=False): + """Reasoning. + + :ivar effort: Is one of the following types: Literal["none"], Literal["minimal"], + Literal["low"], Literal["medium"], Literal["high"], Literal["xhigh"] + :vartype effort: str or str or str or str or str or str + :ivar summary: Is one of the following types: Literal["auto"], Literal["concise"], + Literal["detailed"] + :vartype summary: str or str or str + :ivar generate_summary: Is one of the following types: Literal["auto"], Literal["concise"], + Literal["detailed"] + :vartype generate_summary: str or str or str + """ + + effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] + """Is one of the following types: Literal[\"none\"], Literal[\"minimal\"], Literal[\"low\"], + Literal[\"medium\"], Literal[\"high\"], Literal[\"xhigh\"]""" + summary: Optional[Literal["auto", "concise", "detailed"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"concise\"], Literal[\"detailed\"]""" + generate_summary: Optional[Literal["auto", "concise", "detailed"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"concise\"], Literal[\"detailed\"]""" + + +class ReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. Default value + is "reasoning_text". + :vartype type: str + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Required[Literal["reasoning_text"]] + """The type of the reasoning text. Always ``reasoning_text``. Required. Default value is + \"reasoning_text\".""" + text: Required[str] + """The reasoning text from the model. Required.""" + + +class ResponseAudioDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial audio response. + + :ivar type: The type of the event. Always ``response.audio.delta``. Required. + RESPONSE_AUDIO_DELTA. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_AUDIO_DELTA + :ivar sequence_number: A sequence number for this chunk of the stream response. Required. + :vartype sequence_number: int + :ivar delta: A chunk of Base64 encoded response audio bytes. Required. + :vartype delta: bytes + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_AUDIO_DELTA]] + """The type of the event. Always ``response.audio.delta``. Required. RESPONSE_AUDIO_DELTA.""" + sequence_number: Required[int] + """A sequence number for this chunk of the stream response. Required.""" + delta: Required[str] + """A chunk of Base64 encoded response audio bytes. Required.""" + + +class ResponseAudioDoneEvent(TypedDict, total=False): + """Emitted when the audio response is complete. + + :ivar type: The type of the event. Always ``response.audio.done``. Required. + RESPONSE_AUDIO_DONE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_AUDIO_DONE + :ivar sequence_number: The sequence number of the delta. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_AUDIO_DONE]] + """The type of the event. Always ``response.audio.done``. Required. RESPONSE_AUDIO_DONE.""" + sequence_number: Required[int] + """The sequence number of the delta. Required.""" + + +class ResponseAudioTranscriptDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial transcript of audio. + + :ivar type: The type of the event. Always ``response.audio.transcript.delta``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_AUDIO_TRANSCRIPT_DELTA + :ivar delta: The partial transcript of the audio response. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_AUDIO_TRANSCRIPT_DELTA]] + """The type of the event. Always ``response.audio.transcript.delta``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DELTA.""" + delta: Required[str] + """The partial transcript of the audio response. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseAudioTranscriptDoneEvent(TypedDict, total=False): + """Emitted when the full audio transcript is completed. + + :ivar type: The type of the event. Always ``response.audio.transcript.done``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_AUDIO_TRANSCRIPT_DONE + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_AUDIO_TRANSCRIPT_DONE]] + """The type of the event. Always ``response.audio.transcript.done``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DONE.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseCodeInterpreterCallCodeDeltaEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when a partial code snippet is streamed by the code interpreter. + + :ivar type: The type of the event. Always ``response.code_interpreter_call_code.delta``. + Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA + :ivar output_index: The index of the output item in the response for which the code is being + streamed. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar delta: The partial code snippet being streamed by the code interpreter. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA]] + """The type of the event. Always ``response.code_interpreter_call_code.delta``. Required. + RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA.""" + output_index: Required[int] + """The index of the output item in the response for which the code is being streamed. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + delta: Required[str] + """The partial code snippet being streamed by the code interpreter. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + +class ResponseCodeInterpreterCallCodeDoneEvent(TypedDict, total=False): + """Emitted when the code snippet is finalized by the code interpreter. + + :ivar type: The type of the event. Always ``response.code_interpreter_call_code.done``. + Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE + :ivar output_index: The index of the output item in the response for which the code is + finalized. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar code: The final code snippet output by the code interpreter. Required. + :vartype code: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE]] + """The type of the event. Always ``response.code_interpreter_call_code.done``. Required. + RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE.""" + output_index: Required[int] + """The index of the output item in the response for which the code is finalized. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + code: Required[str] + """The final code snippet output by the code interpreter. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + +class ResponseCodeInterpreterCallCompletedEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when the code interpreter call is completed. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.completed``. + Required. RESPONSE_CODE_INTERPRETER_CALL_COMPLETED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CODE_INTERPRETER_CALL_COMPLETED + :ivar output_index: The index of the output item in the response for which the code interpreter + call is completed. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CODE_INTERPRETER_CALL_COMPLETED]] + """The type of the event. Always ``response.code_interpreter_call.completed``. Required. + RESPONSE_CODE_INTERPRETER_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item in the response for which the code interpreter call is completed. + Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + +class ResponseCodeInterpreterCallInProgressEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when a code interpreter call is in progress. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.in_progress``. + Required. RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS + :ivar output_index: The index of the output item in the response for which the code interpreter + call is in progress. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS]] + """The type of the event. Always ``response.code_interpreter_call.in_progress``. Required. + RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item in the response for which the code interpreter call is in + progress. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + +class ResponseCodeInterpreterCallInterpretingEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when the code interpreter is actively interpreting the code snippet. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.interpreting``. + Required. RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING + :ivar output_index: The index of the output item in the response for which the code interpreter + is interpreting code. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING]] + """The type of the event. Always ``response.code_interpreter_call.interpreting``. Required. + RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING.""" + output_index: Required[int] + """The index of the output item in the response for which the code interpreter is interpreting + code. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + +class ResponseCompletedEvent(TypedDict, total=False): + """Emitted when the model response is complete. + + :ivar type: The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_COMPLETED + :ivar response: Properties of the completed response. Required. + :vartype response: ~azure.ai.agentserver.responses.models.types.ResponseObject + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_COMPLETED]] + """The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED.""" + response: Required["ResponseObject"] + """Properties of the completed response. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + + +class ResponseContentPartAddedEvent(TypedDict, total=False): + """Emitted when a new content part is added. + + :ivar type: The type of the event. Always ``response.content_part.added``. Required. + RESPONSE_CONTENT_PART_ADDED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_CONTENT_PART_ADDED + :ivar item_id: The ID of the output item that the content part was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the content part was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that was added. Required. + :vartype content_index: int + :ivar part: The content part that was added. Required. + :vartype part: ~azure.ai.agentserver.responses.models.types.OutputContent + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CONTENT_PART_ADDED]] + """The type of the event. Always ``response.content_part.added``. Required. + RESPONSE_CONTENT_PART_ADDED.""" + item_id: Required[str] + """The ID of the output item that the content part was added to. Required.""" + output_index: Required[int] + """The index of the output item that the content part was added to. Required.""" + content_index: Required[int] + """The index of the content part that was added. Required.""" + part: Required["OutputContent"] + """The content part that was added. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseContentPartDoneEvent(TypedDict, total=False): + """Emitted when a content part is done. + + :ivar type: The type of the event. Always ``response.content_part.done``. Required. + RESPONSE_CONTENT_PART_DONE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_CONTENT_PART_DONE + :ivar item_id: The ID of the output item that the content part was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the content part was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that is done. Required. + :vartype content_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The content part that is done. Required. + :vartype part: ~azure.ai.agentserver.responses.models.types.OutputContent + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CONTENT_PART_DONE]] + """The type of the event. Always ``response.content_part.done``. Required. + RESPONSE_CONTENT_PART_DONE.""" + item_id: Required[str] + """The ID of the output item that the content part was added to. Required.""" + output_index: Required[int] + """The index of the output item that the content part was added to. Required.""" + content_index: Required[int] + """The index of the content part that is done. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + part: Required["OutputContent"] + """The content part that is done. Required.""" + + +class ResponseCreatedEvent(TypedDict, total=False): + """An event that is emitted when a response is created. + + :ivar type: The type of the event. Always ``response.created``. Required. RESPONSE_CREATED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_CREATED + :ivar response: The response that was created. Required. + :vartype response: ~azure.ai.agentserver.responses.models.types.ResponseObject + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CREATED]] + """The type of the event. Always ``response.created``. Required. RESPONSE_CREATED.""" + response: Required["ResponseObject"] + """The response that was created. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + + +class ResponseCustomToolCallInputDeltaEvent(TypedDict, total=False): + """ResponseCustomToolCallInputDelta. + + :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output this delta applies to. Required. + :vartype output_index: int + :ivar item_id: Unique identifier for the API item associated with this event. Required. + :vartype item_id: str + :ivar delta: The incremental input data (delta) for the custom tool call. Required. + :vartype delta: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA]] + """The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + output_index: Required[int] + """The index of the output this delta applies to. Required.""" + item_id: Required[str] + """Unique identifier for the API item associated with this event. Required.""" + delta: Required[str] + """The incremental input data (delta) for the custom tool call. Required.""" + + +class ResponseCustomToolCallInputDoneEvent(TypedDict, total=False): + """ResponseCustomToolCallInputDone. + + :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output this event applies to. Required. + :vartype output_index: int + :ivar item_id: Unique identifier for the API item associated with this event. Required. + :vartype item_id: str + :ivar input: The complete input data for the custom tool call. Required. + :vartype input: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE]] + """The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + output_index: Required[int] + """The index of the output this event applies to. Required.""" + item_id: Required[str] + """Unique identifier for the API item associated with this event. Required.""" + input: Required[str] + """The complete input data for the custom tool call. Required.""" + + +class ResponseErrorEvent(TypedDict, total=False): + """Emitted when an error occurs. + + :ivar type: The type of the event. Always ``error``. Required. ERROR. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.ERROR + :ivar code: Required. + :vartype code: str + :ivar message: The error message. Required. + :vartype message: str + :ivar param: Required. + :vartype param: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.ERROR]] + """The type of the event. Always ``error``. Required. ERROR.""" + code: Required[Optional[str]] + """Required.""" + message: Required[str] + """The error message. Required.""" + param: Required[Optional[str]] + """Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseErrorInfo(TypedDict, total=False): + """An error object returned when the model fails to generate a Response. + + :ivar code: Required. Known values are: "server_error", "rate_limit_exceeded", + "invalid_prompt", "vector_store_timeout", "invalid_image", "invalid_image_format", + "invalid_base64_image", "invalid_image_url", "image_too_large", "image_too_small", + "image_parse_error", "image_content_policy_violation", "invalid_image_mode", + "image_file_too_large", "unsupported_image_media_type", "empty_image_file", + "failed_to_download_image", and "image_file_not_found". + :vartype code: str or ~azure.ai.agentserver.responses.models.models.ResponseErrorCode + :ivar message: A human-readable description of the error. Required. + :vartype message: str + """ + + code: Required[ResponseErrorCode] + """Required. Known values are: \"server_error\", \"rate_limit_exceeded\", \"invalid_prompt\", + \"vector_store_timeout\", \"invalid_image\", \"invalid_image_format\", + \"invalid_base64_image\", \"invalid_image_url\", \"image_too_large\", \"image_too_small\", + \"image_parse_error\", \"image_content_policy_violation\", \"invalid_image_mode\", + \"image_file_too_large\", \"unsupported_image_media_type\", \"empty_image_file\", + \"failed_to_download_image\", and \"image_file_not_found\".""" + message: Required[str] + """A human-readable description of the error. Required.""" + + +class ResponseFailedEvent(TypedDict, total=False): + """An event that is emitted when a response fails. + + :ivar type: The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_FAILED + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar response: The response that failed. Required. + :vartype response: ~azure.ai.agentserver.responses.models.types.ResponseObject + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_FAILED]] + """The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + response: Required["ResponseObject"] + """The response that failed. Required.""" + + +class ResponseFileSearchCallCompletedEvent(TypedDict, total=False): + """Emitted when a file search call is completed (results found). + + :ivar type: The type of the event. Always ``response.file_search_call.completed``. Required. + RESPONSE_FILE_SEARCH_CALL_COMPLETED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_FILE_SEARCH_CALL_COMPLETED + :ivar output_index: The index of the output item that the file search call is initiated. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_FILE_SEARCH_CALL_COMPLETED]] + """The type of the event. Always ``response.file_search_call.completed``. Required. + RESPONSE_FILE_SEARCH_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item that the file search call is initiated. Required.""" + item_id: Required[str] + """The ID of the output item that the file search call is initiated. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseFileSearchCallInProgressEvent(TypedDict, total=False): + """Emitted when a file search call is initiated. + + :ivar type: The type of the event. Always ``response.file_search_call.in_progress``. Required. + RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS + :ivar output_index: The index of the output item that the file search call is initiated. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS]] + """The type of the event. Always ``response.file_search_call.in_progress``. Required. + RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item that the file search call is initiated. Required.""" + item_id: Required[str] + """The ID of the output item that the file search call is initiated. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseFileSearchCallSearchingEvent(TypedDict, total=False): + """Emitted when a file search is currently searching. + + :ivar type: The type of the event. Always ``response.file_search_call.searching``. Required. + RESPONSE_FILE_SEARCH_CALL_SEARCHING. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_FILE_SEARCH_CALL_SEARCHING + :ivar output_index: The index of the output item that the file search call is searching. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_FILE_SEARCH_CALL_SEARCHING]] + """The type of the event. Always ``response.file_search_call.searching``. Required. + RESPONSE_FILE_SEARCH_CALL_SEARCHING.""" + output_index: Required[int] + """The index of the output item that the file search call is searching. Required.""" + item_id: Required[str] + """The ID of the output item that the file search call is initiated. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseFormatJsonSchemaSchema(TypedDict, total=False): + """JSON schema.""" + + +class ResponseFunctionCallArgumentsDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial function-call arguments delta. + + :ivar type: The type of the event. Always ``response.function_call_arguments.delta``. Required. + RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA + :ivar item_id: The ID of the output item that the function-call arguments delta is added to. + Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the function-call arguments delta is + added to. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar delta: The function-call arguments delta that is added. Required. + :vartype delta: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA]] + """The type of the event. Always ``response.function_call_arguments.delta``. Required. + RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA.""" + item_id: Required[str] + """The ID of the output item that the function-call arguments delta is added to. Required.""" + output_index: Required[int] + """The index of the output item that the function-call arguments delta is added to. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + delta: Required[str] + """The function-call arguments delta that is added. Required.""" + + +class ResponseFunctionCallArgumentsDoneEvent(TypedDict, total=False): + """Emitted when function-call arguments are finalized. + + :ivar type: Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE + :ivar item_id: The ID of the item. Required. + :vartype item_id: str + :ivar name: The name of the function that was called. Required. + :vartype name: str + :ivar output_index: The index of the output item. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar arguments: The function-call arguments. Required. + :vartype arguments: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE]] + """Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE.""" + item_id: Required[str] + """The ID of the item. Required.""" + name: Required[str] + """The name of the function that was called. Required.""" + output_index: Required[int] + """The index of the output item. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + arguments: Required[str] + """The function-call arguments. Required.""" + + +class ResponseImageGenCallCompletedEvent(TypedDict, total=False): + """ResponseImageGenCallCompletedEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.completed'. Required. + RESPONSE_IMAGE_GENERATION_CALL_COMPLETED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_IMAGE_GENERATION_CALL_COMPLETED + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_IMAGE_GENERATION_CALL_COMPLETED]] + """The type of the event. Always 'response.image_generation_call.completed'. Required. + RESPONSE_IMAGE_GENERATION_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + + +class ResponseImageGenCallGeneratingEvent(TypedDict, total=False): + """ResponseImageGenCallGeneratingEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.generating'. + Required. RESPONSE_IMAGE_GENERATION_CALL_GENERATING. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_IMAGE_GENERATION_CALL_GENERATING + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_IMAGE_GENERATION_CALL_GENERATING]] + """The type of the event. Always 'response.image_generation_call.generating'. Required. + RESPONSE_IMAGE_GENERATION_CALL_GENERATING.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + sequence_number: Required[int] + """The sequence number of the image generation item being processed. Required.""" + + +class ResponseImageGenCallInProgressEvent(TypedDict, total=False): + """ResponseImageGenCallInProgressEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.in_progress'. + Required. RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS]] + """The type of the event. Always 'response.image_generation_call.in_progress'. Required. + RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + sequence_number: Required[int] + """The sequence number of the image generation item being processed. Required.""" + + +class ResponseImageGenCallPartialImageEvent(TypedDict, total=False): + """ResponseImageGenCallPartialImageEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.partial_image'. + Required. RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + :ivar partial_image_index: 0-based index for the partial image (backend is 1-based, but this is + 0-based for the user). Required. + :vartype partial_image_index: int + :ivar partial_image_b64: Base64-encoded partial image data, suitable for rendering as an image. + Required. + :vartype partial_image_b64: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE]] + """The type of the event. Always 'response.image_generation_call.partial_image'. Required. + RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + sequence_number: Required[int] + """The sequence number of the image generation item being processed. Required.""" + partial_image_index: Required[int] + """0-based index for the partial image (backend is 1-based, but this is 0-based for the user). + Required.""" + partial_image_b64: Required[str] + """Base64-encoded partial image data, suitable for rendering as an image. Required.""" + + +class ResponseIncompleteDetails(TypedDict, total=False): + """ResponseIncompleteDetails. + + :ivar reason: Is either a Literal["max_output_tokens"] type or a Literal["content_filter"] + type. + :vartype reason: str or str + """ + + reason: Literal["max_output_tokens", "content_filter"] + """Is either a Literal[\"max_output_tokens\"] type or a Literal[\"content_filter\"] type.""" + + +class ResponseIncompleteEvent(TypedDict, total=False): + """An event that is emitted when a response finishes as incomplete. + + :ivar type: The type of the event. Always ``response.incomplete``. Required. + RESPONSE_INCOMPLETE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_INCOMPLETE + :ivar response: The response that was incomplete. Required. + :vartype response: ~azure.ai.agentserver.responses.models.types.ResponseObject + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_INCOMPLETE]] + """The type of the event. Always ``response.incomplete``. Required. RESPONSE_INCOMPLETE.""" + response: Required["ResponseObject"] + """The response that was incomplete. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseInProgressEvent(TypedDict, total=False): + """Emitted when the response is in progress. + + :ivar type: The type of the event. Always ``response.in_progress``. Required. + RESPONSE_IN_PROGRESS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_IN_PROGRESS + :ivar response: The response that is in progress. Required. + :vartype response: ~azure.ai.agentserver.responses.models.types.ResponseObject + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_IN_PROGRESS]] + """The type of the event. Always ``response.in_progress``. Required. RESPONSE_IN_PROGRESS.""" + response: Required["ResponseObject"] + """The response that is in progress. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseLogProb(TypedDict, total=False): + """A logprob is the logarithmic probability that the model assigns to producing a particular token + at a given position in the sequence. Less-negative (higher) logprob values indicate greater + model confidence in that token choice. + + :ivar token: A possible text token. Required. + :vartype token: str + :ivar logprob: The log probability of this token. Required. + :vartype logprob: float + :ivar top_logprobs: The log probability of the top 20 most likely tokens. + :vartype top_logprobs: + list[~azure.ai.agentserver.responses.models.types.ResponseLogProbTopLogprobs] + """ + + token: Required[str] + """A possible text token. Required.""" + logprob: Required[float] + """The log probability of this token. Required.""" + top_logprobs: list["ResponseLogProbTopLogprobs"] + """The log probability of the top 20 most likely tokens.""" + + +class ResponseLogProbTopLogprobs(TypedDict, total=False): + """ResponseLogProbTopLogprobs. + + :ivar token: + :vartype token: str + :ivar logprob: + :vartype logprob: float + """ + + token: str + logprob: float + + +class ResponseMCPCallArgumentsDeltaEvent(TypedDict, total=False): + """ResponseMCPCallArgumentsDeltaEvent. + + :ivar type: The type of the event. Always 'response.mcp_call_arguments.delta'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_CALL_ARGUMENTS_DELTA + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + :ivar delta: A JSON string containing the partial update to the arguments for the MCP tool + call. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_CALL_ARGUMENTS_DELTA]] + """The type of the event. Always 'response.mcp_call_arguments.delta'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DELTA.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the MCP tool call item being processed. Required.""" + delta: Required[str] + """A JSON string containing the partial update to the arguments for the MCP tool call. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseMCPCallArgumentsDoneEvent(TypedDict, total=False): + """ResponseMCPCallArgumentsDoneEvent. + + :ivar type: The type of the event. Always 'response.mcp_call_arguments.done'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_CALL_ARGUMENTS_DONE + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + :ivar arguments: A JSON string containing the finalized arguments for the MCP tool call. + Required. + :vartype arguments: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_CALL_ARGUMENTS_DONE]] + """The type of the event. Always 'response.mcp_call_arguments.done'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DONE.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the MCP tool call item being processed. Required.""" + arguments: Required[str] + """A JSON string containing the finalized arguments for the MCP tool call. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseMCPCallCompletedEvent(TypedDict, total=False): + """ResponseMCPCallCompletedEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.completed'. Required. + RESPONSE_MCP_CALL_COMPLETED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_CALL_COMPLETED + :ivar item_id: The ID of the MCP tool call item that completed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that completed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_CALL_COMPLETED]] + """The type of the event. Always 'response.mcp_call.completed'. Required. + RESPONSE_MCP_CALL_COMPLETED.""" + item_id: Required[str] + """The ID of the MCP tool call item that completed. Required.""" + output_index: Required[int] + """The index of the output item that completed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseMCPCallFailedEvent(TypedDict, total=False): + """ResponseMCPCallFailedEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.failed'. Required. + RESPONSE_MCP_CALL_FAILED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_CALL_FAILED + :ivar item_id: The ID of the MCP tool call item that failed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that failed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_CALL_FAILED]] + """The type of the event. Always 'response.mcp_call.failed'. Required. RESPONSE_MCP_CALL_FAILED.""" + item_id: Required[str] + """The ID of the MCP tool call item that failed. Required.""" + output_index: Required[int] + """The index of the output item that failed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseMCPCallInProgressEvent(TypedDict, total=False): + """ResponseMCPCallInProgressEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.in_progress'. Required. + RESPONSE_MCP_CALL_IN_PROGRESS. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_CALL_IN_PROGRESS + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_CALL_IN_PROGRESS]] + """The type of the event. Always 'response.mcp_call.in_progress'. Required. + RESPONSE_MCP_CALL_IN_PROGRESS.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the MCP tool call item being processed. Required.""" + + +class ResponseMCPListToolsCompletedEvent(TypedDict, total=False): + """ResponseMCPListToolsCompletedEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.completed'. Required. + RESPONSE_MCP_LIST_TOOLS_COMPLETED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_LIST_TOOLS_COMPLETED + :ivar item_id: The ID of the MCP tool call item that produced this output. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that was processed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_LIST_TOOLS_COMPLETED]] + """The type of the event. Always 'response.mcp_list_tools.completed'. Required. + RESPONSE_MCP_LIST_TOOLS_COMPLETED.""" + item_id: Required[str] + """The ID of the MCP tool call item that produced this output. Required.""" + output_index: Required[int] + """The index of the output item that was processed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseMCPListToolsFailedEvent(TypedDict, total=False): + """ResponseMCPListToolsFailedEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.failed'. Required. + RESPONSE_MCP_LIST_TOOLS_FAILED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_LIST_TOOLS_FAILED + :ivar item_id: The ID of the MCP tool call item that failed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that failed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_LIST_TOOLS_FAILED]] + """The type of the event. Always 'response.mcp_list_tools.failed'. Required. + RESPONSE_MCP_LIST_TOOLS_FAILED.""" + item_id: Required[str] + """The ID of the MCP tool call item that failed. Required.""" + output_index: Required[int] + """The index of the output item that failed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseMCPListToolsInProgressEvent(TypedDict, total=False): + """ResponseMCPListToolsInProgressEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. + RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS + :ivar item_id: The ID of the MCP tool call item that is being processed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that is being processed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS]] + """The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. + RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS.""" + item_id: Required[str] + """The ID of the MCP tool call item that is being processed. Required.""" + output_index: Required[int] + """The index of the output item that is being processed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseObject(TypedDict, total=False): + """The response object. + + :ivar metadata: + :vartype metadata: ~azure.ai.agentserver.responses.models.types.Metadata + :ivar top_logprobs: + :vartype top_logprobs: int + :ivar temperature: + :vartype temperature: float + :ivar top_p: + :vartype top_p: float + :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. `Learn more + `_. + :vartype user: str + :ivar safety_identifier: A stable identifier used to help detect users of your application that + may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies + each user. We recommend hashing their username or email address, in order to avoid sending us + any identifying information. `Learn more + `_. + :vartype safety_identifier: str + :ivar prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your + cache hit rates. Replaces the ``user`` field. `Learn more `_. + :vartype prompt_cache_key: str + :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"] + :vartype service_tier: str or str or str or str or str + :ivar prompt_cache_retention: Is either a Literal["in-memory"] type or a Literal["24h"] type. + :vartype prompt_cache_retention: str or str + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar model: The model deployment to use for the creation of this response. + :vartype model: str + :ivar reasoning: + :vartype reasoning: ~azure.ai.agentserver.responses.models.types.Reasoning + :ivar background: + :vartype background: bool + :ivar max_output_tokens: + :vartype max_output_tokens: int + :ivar max_tool_calls: + :vartype max_tool_calls: int + :ivar text: + :vartype text: ~azure.ai.agentserver.responses.models.types.ResponseTextParam + :ivar tools: + :vartype tools: list[~azure.ai.agentserver.responses.models.types.Tool] + :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. + :vartype tool_choice: str or ~azure.ai.agentserver.responses.models.models.ToolChoiceOptions or + ~azure.ai.agentserver.responses.models.types.ToolChoiceParam + :ivar prompt: + :vartype prompt: ~azure.ai.agentserver.responses.models.types.Prompt + :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. + :vartype truncation: str or str + :ivar id: Unique identifier for this Response. Required. + :vartype id: str + :ivar object: The object type of this resource - always set to ``response``. Required. Default + value is "response". + :vartype object: str + :ivar status: The status of the response generation. One of ``completed``, ``failed``, + ``in_progress``, ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: + Literal["completed"], Literal["failed"], Literal["in_progress"], Literal["cancelled"], + Literal["queued"], Literal["incomplete"] + :vartype status: str or str or str or str or str or str + :ivar created_at: Unix timestamp (in seconds) of when this Response was created. Required. + :vartype created_at: ~datetime.datetime + :ivar completed_at: + :vartype completed_at: ~datetime.datetime + :ivar error: Required. + :vartype error: ~azure.ai.agentserver.responses.models.types.ResponseErrorInfo + :ivar incomplete_details: Required. + :vartype incomplete_details: + ~azure.ai.agentserver.responses.models.types.ResponseIncompleteDetails + :ivar output: An array of content items generated by the model. + + * The length and order of items in the `output` array is dependent + on the model's response. + * Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. Required. + :vartype output: list[~azure.ai.agentserver.responses.models.types.OutputItem] + :ivar instructions: Required. Is either a str type or a [Item] type. + :vartype instructions: str or list[~azure.ai.agentserver.responses.models.types.Item] + :ivar output_text: + :vartype output_text: str + :ivar usage: + :vartype usage: ~azure.ai.agentserver.responses.models.types.ResponseUsage + :ivar parallel_tool_calls: Whether to allow the model to run tool calls in parallel. Required. + :vartype parallel_tool_calls: bool + :ivar conversation: + :vartype conversation: ~azure.ai.agentserver.responses.models.types.ConversationReference + :ivar agent: (Deprecated) Use agent_reference instead. The agent used for this response. + :vartype agent: ~azure.ai.agentserver.responses.models.types.AgentId + :ivar agent_session_id: The session identifier for this response. Currently only relevant for + hosted agents. Always returned for hosted agents — either the caller-provided value, the + auto-derived value, or an auto-generated UUID. Use for session-scoped operations and to + maintain sandbox affinity in follow-up calls. + :vartype agent_session_id: str + :ivar agent_reference: The agent used for this response. Required. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + """ + + metadata: Optional["Metadata"] + top_logprobs: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + user: str + """This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. `Learn more + `_.""" + safety_identifier: str + """A stable identifier used to help detect users of your application that may be violating + OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We + recommend hashing their username or email address, in order to avoid sending us any identifying + information. `Learn more `_.""" + prompt_cache_key: str + """Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. + Replaces the ``user`` field. `Learn more `_.""" + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"default\"], Literal[\"flex\"], + Literal[\"scale\"], Literal[\"priority\"]""" + prompt_cache_retention: Optional[Literal["in-memory", "24h"]] + """Is either a Literal[\"in-memory\"] type or a Literal[\"24h\"] type.""" + previous_response_id: Optional[str] + model: str + """The model deployment to use for the creation of this response.""" + reasoning: Optional["Reasoning"] + background: Optional[bool] + max_output_tokens: Optional[int] + max_tool_calls: Optional[int] + text: "ResponseTextParam" + tools: list["Tool"] + tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + """Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.""" + prompt: "Prompt" + truncation: Optional[Literal["auto", "disabled"]] + """Is either a Literal[\"auto\"] type or a Literal[\"disabled\"] type.""" + id: Required[str] + """Unique identifier for this Response. Required.""" + object: Required[Literal["response"]] + """The object type of this resource - always set to ``response``. Required. Default value is + \"response\".""" + status: Literal["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"] + """The status of the response generation. One of ``completed``, ``failed``, ``in_progress``, + ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: + Literal[\"completed\"], Literal[\"failed\"], Literal[\"in_progress\"], Literal[\"cancelled\"], + Literal[\"queued\"], Literal[\"incomplete\"]""" + created_at: Required[int] + """Unix timestamp (in seconds) of when this Response was created. Required.""" + completed_at: Optional[int] + error: Required[Optional["ResponseErrorInfo"]] + """Required.""" + incomplete_details: Required[Optional["ResponseIncompleteDetails"]] + """Required.""" + output: Required[list["OutputItem"]] + """An array of content items generated by the model. + + * The length and order of items in the `output` array is dependent + on the model's response. + * Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. Required.""" + instructions: Required[Optional[Union[str, list["Item"]]]] + """Required. Is either a str type or a [Item] type.""" + output_text: Optional[str] + usage: "ResponseUsage" + parallel_tool_calls: Required[bool] + """Whether to allow the model to run tool calls in parallel. Required.""" + conversation: Optional["ConversationReference"] + agent: "AgentId" + """(Deprecated) Use agent_reference instead. The agent used for this response.""" + agent_session_id: str + """The session identifier for this response. Currently only relevant for hosted agents. Always + returned for hosted agents — either the caller-provided value, the auto-derived value, or an + auto-generated UUID. Use for session-scoped operations and to maintain sandbox affinity in + follow-up calls.""" + agent_reference: Required[Optional["AgentReference"]] + """The agent used for this response. Required.""" + + +class ResponseOutputItemAddedEvent(TypedDict, total=False): + """Emitted when a new output item is added. + + :ivar type: The type of the event. Always ``response.output_item.added``. Required. + RESPONSE_OUTPUT_ITEM_ADDED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_OUTPUT_ITEM_ADDED + :ivar output_index: The index of the output item that was added. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item: The output item that was added. Required. + :vartype item: ~azure.ai.agentserver.responses.models.types.OutputItem + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_OUTPUT_ITEM_ADDED]] + """The type of the event. Always ``response.output_item.added``. Required. + RESPONSE_OUTPUT_ITEM_ADDED.""" + output_index: Required[int] + """The index of the output item that was added. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + item: Required["OutputItem"] + """The output item that was added. Required.""" + + +class ResponseOutputItemDoneEvent(TypedDict, total=False): + """Emitted when an output item is marked done. + + :ivar type: The type of the event. Always ``response.output_item.done``. Required. + RESPONSE_OUTPUT_ITEM_DONE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_OUTPUT_ITEM_DONE + :ivar output_index: The index of the output item that was marked done. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item: The output item that was marked done. Required. + :vartype item: ~azure.ai.agentserver.responses.models.types.OutputItem + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_OUTPUT_ITEM_DONE]] + """The type of the event. Always ``response.output_item.done``. Required. + RESPONSE_OUTPUT_ITEM_DONE.""" + output_index: Required[int] + """The index of the output item that was marked done. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + item: Required["OutputItem"] + """The output item that was marked done. Required.""" + + +class ResponseOutputTextAnnotationAddedEvent(TypedDict, total=False): + """ResponseOutputTextAnnotationAddedEvent. + + :ivar type: The type of the event. Always 'response.output_text.annotation.added'. Required. + RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED + :ivar item_id: The unique identifier of the item to which the annotation is being added. + Required. + :vartype item_id: str + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar content_index: The index of the content part within the output item. Required. + :vartype content_index: int + :ivar annotation_index: The index of the annotation within the content part. Required. + :vartype annotation_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar annotation: The annotation object being added. (See annotation schema for details.). + Required. + :vartype annotation: ~azure.ai.agentserver.responses.models.types.Annotation + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED]] + """The type of the event. Always 'response.output_text.annotation.added'. Required. + RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED.""" + item_id: Required[str] + """The unique identifier of the item to which the annotation is being added. Required.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + content_index: Required[int] + """The index of the content part within the output item. Required.""" + annotation_index: Required[int] + """The index of the annotation within the content part. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + annotation: Required["Annotation"] + """The annotation object being added. (See annotation schema for details.). Required.""" + + +class ResponsePromptVariables(TypedDict, total=False): + """Prompt Variables.""" + + +class ResponseQueuedEvent(TypedDict, total=False): + """ResponseQueuedEvent. + + :ivar type: The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_QUEUED + :ivar response: The full response object that is queued. Required. + :vartype response: ~azure.ai.agentserver.responses.models.types.ResponseObject + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_QUEUED]] + """The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED.""" + response: Required["ResponseObject"] + """The full response object that is queued. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + + +class ResponseReasoningSummaryPartAddedEvent(TypedDict, total=False): + """Emitted when a new reasoning summary part is added. + + :ivar type: The type of the event. Always ``response.reasoning_summary_part.added``. Required. + RESPONSE_REASONING_SUMMARY_PART_ADDED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_REASONING_SUMMARY_PART_ADDED + :ivar item_id: The ID of the item this summary part is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary part is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The summary part that was added. Required. + :vartype part: + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartAddedEventPart + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REASONING_SUMMARY_PART_ADDED]] + """The type of the event. Always ``response.reasoning_summary_part.added``. Required. + RESPONSE_REASONING_SUMMARY_PART_ADDED.""" + item_id: Required[str] + """The ID of the item this summary part is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary part is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + part: Required["ResponseReasoningSummaryPartAddedEventPart"] + """The summary part that was added. Required.""" + + +class ResponseReasoningSummaryPartAddedEventPart(TypedDict, total=False): # pylint: disable=name-too-long + """ResponseReasoningSummaryPartAddedEventPart. + + :ivar type: Required. Default value is "summary_text". + :vartype type: str + :ivar text: Required. + :vartype text: str + """ + + type: Required[Literal["summary_text"]] + """Required. Default value is \"summary_text\".""" + text: Required[str] + """Required.""" + + +class ResponseReasoningSummaryPartDoneEvent(TypedDict, total=False): + """Emitted when a reasoning summary part is completed. + + :ivar type: The type of the event. Always ``response.reasoning_summary_part.done``. Required. + RESPONSE_REASONING_SUMMARY_PART_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_REASONING_SUMMARY_PART_DONE + :ivar item_id: The ID of the item this summary part is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary part is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The completed summary part. Required. + :vartype part: + ~azure.ai.agentserver.responses.models.types.ResponseReasoningSummaryPartDoneEventPart + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REASONING_SUMMARY_PART_DONE]] + """The type of the event. Always ``response.reasoning_summary_part.done``. Required. + RESPONSE_REASONING_SUMMARY_PART_DONE.""" + item_id: Required[str] + """The ID of the item this summary part is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary part is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + part: Required["ResponseReasoningSummaryPartDoneEventPart"] + """The completed summary part. Required.""" + + +class ResponseReasoningSummaryPartDoneEventPart(TypedDict, total=False): # pylint: disable=name-too-long + """ResponseReasoningSummaryPartDoneEventPart. + + :ivar type: Required. Default value is "summary_text". + :vartype type: str + :ivar text: Required. + :vartype text: str + """ + + type: Required[Literal["summary_text"]] + """Required. Default value is \"summary_text\".""" + text: Required[str] + """Required.""" + + +class ResponseReasoningSummaryTextDeltaEvent(TypedDict, total=False): + """Emitted when a delta is added to a reasoning summary text. + + :ivar type: The type of the event. Always ``response.reasoning_summary_text.delta``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_REASONING_SUMMARY_TEXT_DELTA + :ivar item_id: The ID of the item this summary text delta is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary text delta is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar delta: The text delta that was added to the summary. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REASONING_SUMMARY_TEXT_DELTA]] + """The type of the event. Always ``response.reasoning_summary_text.delta``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DELTA.""" + item_id: Required[str] + """The ID of the item this summary text delta is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary text delta is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + delta: Required[str] + """The text delta that was added to the summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseReasoningSummaryTextDoneEvent(TypedDict, total=False): + """Emitted when a reasoning summary text is completed. + + :ivar type: The type of the event. Always ``response.reasoning_summary_text.done``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_REASONING_SUMMARY_TEXT_DONE + :ivar item_id: The ID of the item this summary text is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary text is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar text: The full text of the completed reasoning summary. Required. + :vartype text: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REASONING_SUMMARY_TEXT_DONE]] + """The type of the event. Always ``response.reasoning_summary_text.done``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DONE.""" + item_id: Required[str] + """The ID of the item this summary text is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary text is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + text: Required[str] + """The full text of the completed reasoning summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseReasoningTextDeltaEvent(TypedDict, total=False): + """Emitted when a delta is added to a reasoning text. + + :ivar type: The type of the event. Always ``response.reasoning_text.delta``. Required. + RESPONSE_REASONING_TEXT_DELTA. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_REASONING_TEXT_DELTA + :ivar item_id: The ID of the item this reasoning text delta is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this reasoning text delta is associated with. + Required. + :vartype output_index: int + :ivar content_index: The index of the reasoning content part this delta is associated with. + Required. + :vartype content_index: int + :ivar delta: The text delta that was added to the reasoning content. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REASONING_TEXT_DELTA]] + """The type of the event. Always ``response.reasoning_text.delta``. Required. + RESPONSE_REASONING_TEXT_DELTA.""" + item_id: Required[str] + """The ID of the item this reasoning text delta is associated with. Required.""" + output_index: Required[int] + """The index of the output item this reasoning text delta is associated with. Required.""" + content_index: Required[int] + """The index of the reasoning content part this delta is associated with. Required.""" + delta: Required[str] + """The text delta that was added to the reasoning content. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseReasoningTextDoneEvent(TypedDict, total=False): + """Emitted when a reasoning text is completed. + + :ivar type: The type of the event. Always ``response.reasoning_text.done``. Required. + RESPONSE_REASONING_TEXT_DONE. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_REASONING_TEXT_DONE + :ivar item_id: The ID of the item this reasoning text is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this reasoning text is associated with. + Required. + :vartype output_index: int + :ivar content_index: The index of the reasoning content part. Required. + :vartype content_index: int + :ivar text: The full text of the completed reasoning content. Required. + :vartype text: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REASONING_TEXT_DONE]] + """The type of the event. Always ``response.reasoning_text.done``. Required. + RESPONSE_REASONING_TEXT_DONE.""" + item_id: Required[str] + """The ID of the item this reasoning text is associated with. Required.""" + output_index: Required[int] + """The index of the output item this reasoning text is associated with. Required.""" + content_index: Required[int] + """The index of the reasoning content part. Required.""" + text: Required[str] + """The full text of the completed reasoning content. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseRefusalDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial refusal text. + + :ivar type: The type of the event. Always ``response.refusal.delta``. Required. + RESPONSE_REFUSAL_DELTA. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_REFUSAL_DELTA + :ivar item_id: The ID of the output item that the refusal text is added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the refusal text is added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the refusal text is added to. Required. + :vartype content_index: int + :ivar delta: The refusal text that is added. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REFUSAL_DELTA]] + """The type of the event. Always ``response.refusal.delta``. Required. RESPONSE_REFUSAL_DELTA.""" + item_id: Required[str] + """The ID of the output item that the refusal text is added to. Required.""" + output_index: Required[int] + """The index of the output item that the refusal text is added to. Required.""" + content_index: Required[int] + """The index of the content part that the refusal text is added to. Required.""" + delta: Required[str] + """The refusal text that is added. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseRefusalDoneEvent(TypedDict, total=False): + """Emitted when refusal text is finalized. + + :ivar type: The type of the event. Always ``response.refusal.done``. Required. + RESPONSE_REFUSAL_DONE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_REFUSAL_DONE + :ivar item_id: The ID of the output item that the refusal text is finalized. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the refusal text is finalized. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the refusal text is finalized. + Required. + :vartype content_index: int + :ivar refusal: The refusal text that is finalized. Required. + :vartype refusal: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_REFUSAL_DONE]] + """The type of the event. Always ``response.refusal.done``. Required. RESPONSE_REFUSAL_DONE.""" + item_id: Required[str] + """The ID of the output item that the refusal text is finalized. Required.""" + output_index: Required[int] + """The index of the output item that the refusal text is finalized. Required.""" + content_index: Required[int] + """The index of the content part that the refusal text is finalized. Required.""" + refusal: Required[str] + """The refusal text that is finalized. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + +class ResponseStreamOptions(TypedDict, total=False): + """Options for streaming responses. Only set this when you set ``stream: true``. + + :ivar include_obfuscation: When true, stream obfuscation will be enabled. Stream obfuscation + adds random characters to an ``obfuscation`` field on streaming delta events to normalize + payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are + included by default, but add a small amount of overhead to the data stream. You can set + ``include_obfuscation`` to false to optimize for bandwidth if you trust the network links + between your application and the OpenAI API. + :vartype include_obfuscation: bool + """ + + include_obfuscation: bool + """When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an + ``obfuscation`` field on streaming delta events to normalize payload sizes as a mitigation to + certain side-channel attacks. These obfuscation fields are included by default, but add a small + amount of overhead to the data stream. You can set ``include_obfuscation`` to false to optimize + for bandwidth if you trust the network links between your application and the OpenAI API.""" + + +class ResponseTextDeltaEvent(TypedDict, total=False): + """Emitted when there is an additional text delta. + + :ivar type: The type of the event. Always ``response.output_text.delta``. Required. + RESPONSE_OUTPUT_TEXT_DELTA. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_OUTPUT_TEXT_DELTA + :ivar item_id: The ID of the output item that the text delta was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the text delta was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the text delta was added to. Required. + :vartype content_index: int + :ivar delta: The text delta that was added. Required. + :vartype delta: str + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + :ivar logprobs: The log probabilities of the tokens in the delta. Required. + :vartype logprobs: list[~azure.ai.agentserver.responses.models.types.ResponseLogProb] + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_OUTPUT_TEXT_DELTA]] + """The type of the event. Always ``response.output_text.delta``. Required. + RESPONSE_OUTPUT_TEXT_DELTA.""" + item_id: Required[str] + """The ID of the output item that the text delta was added to. Required.""" + output_index: Required[int] + """The index of the output item that the text delta was added to. Required.""" + content_index: Required[int] + """The index of the content part that the text delta was added to. Required.""" + delta: Required[str] + """The text delta that was added. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + logprobs: Required[list["ResponseLogProb"]] + """The log probabilities of the tokens in the delta. Required.""" + + +class ResponseTextDoneEvent(TypedDict, total=False): + """Emitted when text content is finalized. + + :ivar type: The type of the event. Always ``response.output_text.done``. Required. + RESPONSE_OUTPUT_TEXT_DONE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.RESPONSE_OUTPUT_TEXT_DONE + :ivar item_id: The ID of the output item that the text content is finalized. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the text content is finalized. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the text content is finalized. + Required. + :vartype content_index: int + :ivar text: The text content that is finalized. Required. + :vartype text: str + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + :ivar logprobs: The log probabilities of the tokens in the delta. Required. + :vartype logprobs: list[~azure.ai.agentserver.responses.models.types.ResponseLogProb] + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_OUTPUT_TEXT_DONE]] + """The type of the event. Always ``response.output_text.done``. Required. + RESPONSE_OUTPUT_TEXT_DONE.""" + item_id: Required[str] + """The ID of the output item that the text content is finalized. Required.""" + output_index: Required[int] + """The index of the output item that the text content is finalized. Required.""" + content_index: Required[int] + """The index of the content part that the text content is finalized. Required.""" + text: Required[str] + """The text content that is finalized. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + logprobs: Required[list["ResponseLogProb"]] + """The log probabilities of the tokens in the delta. Required.""" + + +class ResponseTextParam(TypedDict, total=False): + """Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + + * [Text inputs and outputs](/docs/guides/text) + * [Structured Outputs](/docs/guides/structured-outputs). + + :ivar format: + :vartype format: ~azure.ai.agentserver.responses.models.types.TextResponseFormatConfiguration + :ivar verbosity: Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"] + :vartype verbosity: str or str or str + """ + + format: "TextResponseFormatConfiguration" + verbosity: Optional[Literal["low", "medium", "high"]] + """Is one of the following types: Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" + + +class ResponseUsage(TypedDict, total=False): + """Represents token usage details including input tokens, output tokens, a breakdown of output + tokens, and the total tokens used. + + :ivar input_tokens: The number of input tokens. Required. + :vartype input_tokens: int + :ivar input_tokens_details: A detailed breakdown of the input tokens. Required. + :vartype input_tokens_details: + ~azure.ai.agentserver.responses.models.types.ResponseUsageInputTokensDetails + :ivar output_tokens: The number of output tokens. Required. + :vartype output_tokens: int + :ivar output_tokens_details: A detailed breakdown of the output tokens. Required. + :vartype output_tokens_details: + ~azure.ai.agentserver.responses.models.types.ResponseUsageOutputTokensDetails + :ivar total_tokens: The total number of tokens used. Required. + :vartype total_tokens: int + """ + + input_tokens: Required[int] + """The number of input tokens. Required.""" + input_tokens_details: Required["ResponseUsageInputTokensDetails"] + """A detailed breakdown of the input tokens. Required.""" + output_tokens: Required[int] + """The number of output tokens. Required.""" + output_tokens_details: Required["ResponseUsageOutputTokensDetails"] + """A detailed breakdown of the output tokens. Required.""" + total_tokens: Required[int] + """The total number of tokens used. Required.""" + + +class ResponseUsageInputTokensDetails(TypedDict, total=False): + """ResponseUsageInputTokensDetails. + + :ivar cached_tokens: Required. + :vartype cached_tokens: int + """ + + cached_tokens: Required[int] + """Required.""" + + +class ResponseUsageOutputTokensDetails(TypedDict, total=False): + """ResponseUsageOutputTokensDetails. + + :ivar reasoning_tokens: Required. + :vartype reasoning_tokens: int + """ + + reasoning_tokens: Required[int] + """Required.""" + + +class ResponseWebSearchCallCompletedEvent(TypedDict, total=False): + """Emitted when a web search call is completed. + + :ivar type: The type of the event. Always ``response.web_search_call.completed``. Required. + RESPONSE_WEB_SEARCH_CALL_COMPLETED. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_WEB_SEARCH_CALL_COMPLETED + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_WEB_SEARCH_CALL_COMPLETED]] + """The type of the event. Always ``response.web_search_call.completed``. Required. + RESPONSE_WEB_SEARCH_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item that the web search call is associated with. Required.""" + item_id: Required[str] + """Unique ID for the output item associated with the web search call. Required.""" + sequence_number: Required[int] + """The sequence number of the web search call being processed. Required.""" + + +class ResponseWebSearchCallInProgressEvent(TypedDict, total=False): + """Emitted when a web search call is initiated. + + :ivar type: The type of the event. Always ``response.web_search_call.in_progress``. Required. + RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS]] + """The type of the event. Always ``response.web_search_call.in_progress``. Required. + RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item that the web search call is associated with. Required.""" + item_id: Required[str] + """Unique ID for the output item associated with the web search call. Required.""" + sequence_number: Required[int] + """The sequence number of the web search call being processed. Required.""" + + +class ResponseWebSearchCallSearchingEvent(TypedDict, total=False): + """Emitted when a web search call is executing. + + :ivar type: The type of the event. Always ``response.web_search_call.searching``. Required. + RESPONSE_WEB_SEARCH_CALL_SEARCHING. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.RESPONSE_WEB_SEARCH_CALL_SEARCHING + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + + type: Required[Literal[ResponseStreamEventType.RESPONSE_WEB_SEARCH_CALL_SEARCHING]] + """The type of the event. Always ``response.web_search_call.searching``. Required. + RESPONSE_WEB_SEARCH_CALL_SEARCHING.""" + output_index: Required[int] + """The index of the output item that the web search call is associated with. Required.""" + item_id: Required[str] + """Unique ID for the output item associated with the web search call. Required.""" + sequence_number: Required[int] + """The sequence number of the web search call being processed. Required.""" + + +class ScreenshotParam(TypedDict, total=False): + """Screenshot. + + :ivar type: Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SCREENSHOT + """ + + type: Required[Literal[ComputerActionType.SCREENSHOT]] + """Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT.""" + + +class ScrollParam(TypedDict, total=False): + """Scroll. + + :ivar type: Specifies the event type. For a scroll action, this property is always set to + ``scroll``. Required. SCROLL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SCROLL + :ivar x: The x-coordinate where the scroll occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the scroll occurred. Required. + :vartype y: int + :ivar scroll_x: The horizontal scroll distance. Required. + :vartype scroll_x: int + :ivar scroll_y: The vertical scroll distance. Required. + :vartype scroll_y: int + """ + + type: Required[Literal[ComputerActionType.SCROLL]] + """Specifies the event type. For a scroll action, this property is always set to ``scroll``. + Required. SCROLL.""" + x: Required[int] + """The x-coordinate where the scroll occurred. Required.""" + y: Required[int] + """The y-coordinate where the scroll occurred. Required.""" + scroll_x: Required[int] + """The horizontal scroll distance. Required.""" + scroll_y: Required[int] + """The vertical scroll distance. Required.""" + + +class SharepointGroundingToolCall(TypedDict, total=False): + """A SharePoint grounding tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.SHAREPOINT_GROUNDING_PREVIEW_CALL + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.SHAREPOINT_GROUNDING_PREVIEW_CALL]] + """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class SharepointGroundingToolCallOutput(TypedDict, total=False): + """The output of a SharePoint grounding tool call. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the SharePoint grounding tool call. Is one of the following + types: {str: Any}, str, [Any] + :vartype output: dict[str, any] or str or list[any] + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: str or ~azure.ai.agentserver.responses.models.models.ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT]] + """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the SharePoint grounding tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + +class SharepointGroundingToolParameters(TypedDict, total=False): + """The sharepoint grounding tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: + list[~azure.ai.agentserver.responses.models.types.ToolProjectConnection] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connections: list["ToolProjectConnection"] + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + +class SharepointPreviewTool(TypedDict, total=False): + """The input definition information for a sharepoint tool as used to configure an agent. + + :ivar type: The object type, which is always 'sharepoint_grounding_preview'. Required. + SHAREPOINT_GROUNDING_PREVIEW. + :vartype type: str or + ~azure.ai.agentserver.responses.models.models.SHAREPOINT_GROUNDING_PREVIEW + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. + :vartype sharepoint_grounding_preview: + ~azure.ai.agentserver.responses.models.types.SharepointGroundingToolParameters + """ + + type: Required[Literal[ToolType.SHAREPOINT_GROUNDING_PREVIEW]] + """The object type, which is always 'sharepoint_grounding_preview'. Required. + SHAREPOINT_GROUNDING_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + sharepoint_grounding_preview: Required["SharepointGroundingToolParameters"] + """The sharepoint grounding tool parameters. Required.""" + + +class SkillReferenceParam(TypedDict, total=False): + """SkillReferenceParam. + + :ivar type: References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SKILL_REFERENCE + :ivar skill_id: The ID of the referenced skill. Required. + :vartype skill_id: str + :ivar version: Optional skill version. Use a positive integer or 'latest'. Omit for default. + :vartype version: str + """ + + type: Required[Literal[ContainerSkillType.SKILL_REFERENCE]] + """References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE.""" + skill_id: Required[str] + """The ID of the referenced skill. Required.""" + version: str + """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" + + +class SpecificApplyPatchParam(TypedDict, total=False): + """Specific apply patch tool choice. + + :ivar type: The tool to call. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.APPLY_PATCH + """ + + type: Required[Literal[ToolChoiceParamType.APPLY_PATCH]] + """The tool to call. Always ``apply_patch``. Required. APPLY_PATCH.""" + + +class SpecificFunctionShellParam(TypedDict, total=False): + """Specific shell tool choice. + + :ivar type: The tool to call. Always ``shell``. Required. SHELL. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SHELL + """ + + type: Required[Literal[ToolChoiceParamType.SHELL]] + """The tool to call. Always ``shell``. Required. SHELL.""" + + +class StructuredOutputDefinition(TypedDict, total=False): + """A structured output that can be produced by the agent. + + :ivar name: The name of the structured output. Required. + :vartype name: str + :ivar description: A description of the output to emit. Used by the model to determine when to + emit the output. Required. + :vartype description: str + :ivar schema: The JSON schema for the structured output. Required. + :vartype schema: dict[str, any] + :ivar strict: Whether to enforce strict validation. Default ``true``. Required. + :vartype strict: bool + """ + + name: Required[str] + """The name of the structured output. Required.""" + description: Required[str] + """A description of the output to emit. Used by the model to determine when to emit the output. + Required.""" + schema: Required[dict[str, Any]] + """The JSON schema for the structured output. Required.""" + strict: Required[Optional[bool]] + """Whether to enforce strict validation. Default ``true``. Required.""" + + +class StructuredOutputsOutputItem(TypedDict, total=False): + """StructuredOutputsOutputItem. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. STRUCTURED_OUTPUTS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.STRUCTURED_OUTPUTS + :ivar output: The structured output captured during the response. Required. + :vartype output: any + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.STRUCTURED_OUTPUTS]] + """Required. STRUCTURED_OUTPUTS.""" + output: Required[Any] + """The structured output captured during the response. Required.""" + id: Required[str] + """Required.""" + + +class SummaryTextContent(TypedDict, total=False): + """Summary text. + + :ivar type: The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.SUMMARY_TEXT + :ivar text: A summary of the reasoning output from the model so far. Required. + :vartype text: str + """ + + type: Required[Literal[MessageContentType.SUMMARY_TEXT]] + """The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT.""" + text: Required[str] + """A summary of the reasoning output from the model so far. Required.""" + + +class TextContent(TypedDict, total=False): + """Text Content. + + :ivar type: Required. TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.TEXT + :ivar text: Required. + :vartype text: str + """ + + type: Required[Literal[MessageContentType.TEXT]] + """Required. TEXT.""" + text: Required[str] + """Required.""" + + +class TextResponseFormatConfigurationResponseFormatJsonObject(TypedDict, total=False): # pylint: disable=name-too-long + """JSON object. + + :ivar type: The type of response format being defined. Always ``json_object``. Required. + JSON_OBJECT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.JSON_OBJECT + """ + + type: Required[Literal[TextResponseFormatConfigurationType.JSON_OBJECT]] + """The type of response format being defined. Always ``json_object``. Required. JSON_OBJECT.""" + + +class TextResponseFormatConfigurationResponseFormatText(TypedDict, total=False): # pylint: disable=name-too-long + """Text. + + :ivar type: The type of response format being defined. Always ``text``. Required. TEXT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.TEXT + """ + + type: Required[Literal[TextResponseFormatConfigurationType.TEXT]] + """The type of response format being defined. Always ``text``. Required. TEXT.""" + + +class TextResponseFormatJsonSchema(TypedDict, total=False): + """JSON schema. + + :ivar type: The type of response format being defined. Always ``json_schema``. Required. + JSON_SCHEMA. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.JSON_SCHEMA + :ivar description: A description of what the response format is for, used by the model to + determine how to respond in the format. + :vartype description: str + :ivar name: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and + dashes, with a maximum length of 64. Required. + :vartype name: str + :ivar schema: Required. + :vartype schema: ~azure.ai.agentserver.responses.models.types.ResponseFormatJsonSchemaSchema + :ivar strict: + :vartype strict: bool + """ + + type: Required[Literal[TextResponseFormatConfigurationType.JSON_SCHEMA]] + """The type of response format being defined. Always ``json_schema``. Required. JSON_SCHEMA.""" + description: str + """A description of what the response format is for, used by the model to determine how to respond + in the format.""" + name: Required[str] + """The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with + a maximum length of 64. Required.""" + schema: Required["ResponseFormatJsonSchemaSchema"] + """Required.""" + strict: Optional[bool] + + +class ToolChoiceAllowed(TypedDict, total=False): + """Allowed tools. + + :ivar type: Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.ALLOWED_TOOLS + :ivar mode: Constrains the tools available to the model to a pre-defined set. ``auto`` allows + the model to pick from among the allowed tools and generate a message. ``required`` requires + the model to call one or more of the allowed tools. Required. Is either a Literal["auto"] type + 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: + + .. code-block:: json + + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ]. Required. + :vartype tools: list[dict[str, any]] + """ + + type: Required[Literal[ToolChoiceParamType.ALLOWED_TOOLS]] + """Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS.""" + mode: Required[Literal["auto", "required"]] + """Constrains the tools available to the model to a pre-defined set. ``auto`` allows the model to + pick from among the allowed tools and generate a message. ``required`` requires the model to + call one or more of the allowed tools. Required. Is either a Literal[\"auto\"] type or a + Literal[\"required\"] type.""" + tools: Required[list[dict[str, Any]]] + """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: + + .. code-block:: json + + [ + { \"type\": \"function\", \"name\": \"get_weather\" }, + { \"type\": \"mcp\", \"server_label\": \"deepwiki\" }, + { \"type\": \"image_generation\" } + ]. Required.""" + + +class ToolChoiceCodeInterpreter(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. `Learn more about + built-in tools `_. + + :ivar type: Required. CODE_INTERPRETER. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CODE_INTERPRETER + """ + + type: Required[Literal[ToolChoiceParamType.CODE_INTERPRETER]] + """Required. CODE_INTERPRETER.""" + + +class ToolChoiceComputerUsePreview(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. `Learn more about + built-in tools `_. + + :ivar type: Required. COMPUTER_USE_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.COMPUTER_USE_PREVIEW + """ + + type: Required[Literal[ToolChoiceParamType.COMPUTER_USE_PREVIEW]] + """Required. COMPUTER_USE_PREVIEW.""" + + +class ToolChoiceCustom(TypedDict, total=False): + """Custom tool. + + :ivar type: For custom tool calling, the type is always ``custom``. Required. CUSTOM. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.CUSTOM + :ivar name: The name of the custom tool to call. Required. + :vartype name: str + """ + + type: Required[Literal[ToolChoiceParamType.CUSTOM]] + """For custom tool calling, the type is always ``custom``. Required. CUSTOM.""" + name: Required[str] + """The name of the custom tool to call. Required.""" + + +class ToolChoiceFileSearch(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. `Learn more about + built-in tools `_. + + :ivar type: Required. FILE_SEARCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FILE_SEARCH + """ + + type: Required[Literal[ToolChoiceParamType.FILE_SEARCH]] + """Required. FILE_SEARCH.""" + + +class ToolChoiceFunction(TypedDict, total=False): + """Function tool. + + :ivar type: For function calling, the type is always ``function``. Required. FUNCTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.FUNCTION + :ivar name: The name of the function to call. Required. + :vartype name: str + """ + + type: Required[Literal[ToolChoiceParamType.FUNCTION]] + """For function calling, the type is always ``function``. Required. FUNCTION.""" + name: Required[str] + """The name of the function to call. Required.""" + + +class ToolChoiceImageGeneration(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. `Learn more about + built-in tools `_. + + :ivar type: Required. IMAGE_GENERATION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.IMAGE_GENERATION + """ + + type: Required[Literal[ToolChoiceParamType.IMAGE_GENERATION]] + """Required. IMAGE_GENERATION.""" + + +class ToolChoiceMCP(TypedDict, total=False): + """MCP tool. + + :ivar type: For MCP tools, the type is always ``mcp``. Required. MCP. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.MCP + :ivar server_label: The label of the MCP server to use. Required. + :vartype server_label: str + :ivar name: + :vartype name: str + """ + + type: Required[Literal[ToolChoiceParamType.MCP]] + """For MCP tools, the type is always ``mcp``. Required. MCP.""" + server_label: Required[str] + """The label of the MCP server to use. Required.""" + name: Optional[str] + + +class ToolChoiceWebSearchPreview(TypedDict, total=False): + """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. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WEB_SEARCH_PREVIEW + """ + + type: Required[Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW]] + """Required. WEB_SEARCH_PREVIEW.""" + + +class ToolChoiceWebSearchPreview20250311(TypedDict, total=False): + """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.agentserver.responses.models.models.WEB_SEARCH_PREVIEW2025_03_11 + """ + + type: Required[Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW2025_03_11]] + """Required. WEB_SEARCH_PREVIEW2025_03_11.""" + + +class ToolProjectConnection(TypedDict, total=False): + """A project connection resource. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: A project connection in a ToolProjectConnectionList attached to + this tool. Required. + :vartype project_connection_id: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """A project connection in a ToolProjectConnectionList attached to this tool. Required.""" + + +class TopLogProb(TypedDict, total=False): + """Top log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: float + :ivar bytes: Required. + :vartype bytes: list[int] + """ + + token: Required[str] + """Required.""" + logprob: Required[float] + """Required.""" + bytes: Required[list[int]] + """Required.""" + + +class TypeParam(TypedDict, total=False): + """Type. + + :ivar type: Specifies the event type. For a type action, this property is always set to + ``type``. Required. TYPE. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.TYPE + :ivar text: The text to type. Required. + :vartype text: str + """ + + type: Required[Literal[ComputerActionType.TYPE]] + """Specifies the event type. For a type action, this property is always set to ``type``. Required. + TYPE.""" + text: Required[str] + """The text to type. Required.""" + + +class UrlCitationBody(TypedDict, total=False): + """URL citation. + + :ivar type: The type of the URL citation. Always ``url_citation``. Required. URL_CITATION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.URL_CITATION + :ivar url: The URL of the web resource. Required. + :vartype url: str + :ivar start_index: The index of the first character of the URL citation in the message. + Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the URL citation in the message. Required. + :vartype end_index: int + :ivar title: The title of the web resource. Required. + :vartype title: str + """ + + type: Required[Literal[AnnotationType.URL_CITATION]] + """The type of the URL citation. Always ``url_citation``. Required. URL_CITATION.""" + url: Required[str] + """The URL of the web resource. Required.""" + start_index: Required[int] + """The index of the first character of the URL citation in the message. Required.""" + end_index: Required[int] + """The index of the last character of the URL citation in the message. Required.""" + title: Required[str] + """The title of the web resource. Required.""" + + +class UserProfileMemoryItem(TypedDict, total=False): + """A memory item specifically containing user profile information extracted from conversations, + such as preferences, interests, and personal details. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: ~datetime.datetime + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. User profile information extracted from + conversations. + :vartype kind: str or ~azure.ai.agentserver.responses.models.models.USER_PROFILE + """ + + memory_id: Required[str] + """The unique ID of the memory item. Required.""" + updated_at: Required[int] + """The last update time of the memory item. Required.""" + scope: Required[str] + """The namespace that logically groups and isolates memories, such as a user ID. Required.""" + content: Required[str] + """The content of the memory. Required.""" + kind: Required[Literal[MemoryItemKind.USER_PROFILE]] + """The kind of the memory item. Required. User profile information extracted from conversations.""" + + +class VectorStoreFileAttributes(TypedDict, total=False): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters, booleans, or numbers. + + """ + + +class WaitParam(TypedDict, total=False): + """Wait. + + :ivar type: Specifies the event type. For a wait action, this property is always set to + ``wait``. Required. WAIT. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WAIT + """ + + type: Required[Literal[ComputerActionType.WAIT]] + """Specifies the event type. For a wait action, this property is always set to ``wait``. Required. + WAIT.""" + + +class WebSearchActionFind(TypedDict, total=False): + """Find action. + + :ivar type: The action type. Required. Default value is "find_in_page". + :vartype type: str + :ivar url: The URL of the page searched for the pattern. Required. + :vartype url: str + :ivar pattern: The pattern or text to search for within the page. Required. + :vartype pattern: str + """ + + type: Required[Literal["find_in_page"]] + """The action type. Required. Default value is \"find_in_page\".""" + url: Required[str] + """The URL of the page searched for the pattern. Required.""" + pattern: Required[str] + """The pattern or text to search for within the page. Required.""" + + +class WebSearchActionOpenPage(TypedDict, total=False): + """Open page action. + + :ivar type: The action type. Required. Default value is "open_page". + :vartype type: str + :ivar url: The URL opened by the model. + :vartype url: str + """ + + type: Required[Literal["open_page"]] + """The action type. Required. Default value is \"open_page\".""" + url: Optional[str] + """The URL opened by the model.""" + + +class WebSearchActionSearch(TypedDict, total=False): + """Search action. + + :ivar type: The action type. Required. Default value is "search". + :vartype type: str + :ivar query: [DEPRECATED] The search query. Required. + :vartype query: str + :ivar queries: Search queries. + :vartype queries: list[str] + :ivar sources: Web search sources. + :vartype sources: + list[~azure.ai.agentserver.responses.models.types.WebSearchActionSearchSources] + """ + + type: Required[Literal["search"]] + """The action type. Required. Default value is \"search\".""" + query: Required[str] + """[DEPRECATED] The search query. Required.""" + queries: list[str] + """Search queries.""" + sources: list["WebSearchActionSearchSources"] + """Web search sources.""" + + +class WebSearchActionSearchSources(TypedDict, total=False): + """WebSearchActionSearchSources. + + :ivar type: Required. Default value is "url". + :vartype type: str + :ivar url: Required. + :vartype url: str + """ + + type: Required[Literal["url"]] + """Required. Default value is \"url\".""" + url: Required[str] + """Required.""" + + +class WebSearchApproximateLocation(TypedDict, total=False): + """Web search approximate location. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: str + :ivar country: + :vartype country: str + :ivar region: + :vartype region: str + :ivar city: + :vartype city: str + :ivar timezone: + :vartype timezone: str + """ + + type: Required[Literal["approximate"]] + """The type of location approximation. Always ``approximate``. Required. Default value is + \"approximate\".""" + country: Optional[str] + region: Optional[str] + city: Optional[str] + timezone: Optional[str] + + +class WebSearchConfiguration(TypedDict, total=False): + """A web search configuration for bing custom search. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing custom search. + Required. + :vartype project_connection_id: str + :ivar instance_name: Name of the custom configuration instance given to config. Required. + :vartype instance_name: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """Project connection id for grounding with bing custom search. Required.""" + instance_name: Required[str] + """Name of the custom configuration instance given to config. Required.""" + + +class WebSearchPreviewTool(TypedDict, total=False): + """Web search preview. + + :ivar type: The type of the web search tool. One of ``web_search_preview`` or + ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WEB_SEARCH_PREVIEW + :ivar user_location: + :vartype user_location: ~azure.ai.agentserver.responses.models.types.ApproximateLocation + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Known + values are: "low", "medium", and "high". + :vartype search_context_size: str or + ~azure.ai.agentserver.responses.models.models.SearchContextSize + """ + + type: Required[Literal[ToolType.WEB_SEARCH_PREVIEW]] + """The type of the web search tool. One of ``web_search_preview`` or + ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW.""" + user_location: Optional["ApproximateLocation"] + search_context_size: SearchContextSize + """High level guidance for the amount of context window space to use for the search. One of + ``low``, ``medium``, or ``high``. ``medium`` is the default. Known values are: \"low\", + \"medium\", and \"high\".""" + + +class WebSearchTool(TypedDict, total=False): + """Web search. + + :ivar type: The type of the web search tool. One of ``web_search`` or + ``web_search_2025_08_26``. Required. WEB_SEARCH. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WEB_SEARCH + :ivar filters: + :vartype filters: ~azure.ai.agentserver.responses.models.types.WebSearchToolFilters + :ivar user_location: + :vartype user_location: + ~azure.ai.agentserver.responses.models.types.WebSearchApproximateLocation + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of + the following types: Literal["low"], Literal["medium"], Literal["high"] + :vartype search_context_size: str or str or str + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar custom_search_configuration: The project connections attached to this tool. There can be + a maximum of 1 connection resource attached to the tool. + :vartype custom_search_configuration: + ~azure.ai.agentserver.responses.models.types.WebSearchConfiguration + """ + + type: Required[Literal[ToolType.WEB_SEARCH]] + """The type of the web search tool. One of ``web_search`` or ``web_search_2025_08_26``. Required. + WEB_SEARCH.""" + filters: Optional["WebSearchToolFilters"] + user_location: Optional["WebSearchApproximateLocation"] + search_context_size: Literal["low", "medium", "high"] + """High level guidance for the amount of context window space to use for the search. One of + ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types: + Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + custom_search_configuration: "WebSearchConfiguration" + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + +class WebSearchToolFilters(TypedDict, total=False): + """WebSearchToolFilters. + + :ivar allowed_domains: + :vartype allowed_domains: list[str] + """ + + allowed_domains: Optional[list[str]] + + +class WorkflowActionOutputItem(TypedDict, total=False): + """WorkflowActionOutputItem. + + :ivar created_by: The information about the creator of the item. Is either a CreatedBy type or + a str type. + :vartype created_by: ~azure.ai.agentserver.responses.models.types.CreatedBy or str + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: ~azure.ai.agentserver.responses.models.types.AgentReference + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. WORKFLOW_ACTION. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WORKFLOW_ACTION + :ivar kind: The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required. + :vartype kind: str + :ivar action_id: Unique identifier for the action. Required. + :vartype action_id: str + :ivar parent_action_id: ID of the parent action if this is a nested action. + :vartype parent_action_id: str + :ivar previous_action_id: ID of the previous action if this action follows another. + :vartype previous_action_id: str + :ivar status: Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). + Required. Is one of the following types: Literal["completed"], Literal["failed"], + Literal["in_progress"], Literal["cancelled"] + :vartype status: str or str or str or str + :ivar id: Required. + :vartype id: str + """ + + created_by: Union["CreatedBy", str] + """The information about the creator of the item. Is either a CreatedBy type or a str type.""" + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal[OutputItemType.WORKFLOW_ACTION]] + """Required. WORKFLOW_ACTION.""" + kind: Required[str] + """The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required.""" + action_id: Required[str] + """Unique identifier for the action. Required.""" + parent_action_id: str + """ID of the parent action if this is a nested action.""" + previous_action_id: str + """ID of the previous action if this action follows another.""" + status: Required[Literal["completed", "failed", "in_progress", "cancelled"]] + """Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). Required. Is + one of the following types: Literal[\"completed\"], Literal[\"failed\"], + Literal[\"in_progress\"], Literal[\"cancelled\"]""" + id: Required[str] + """Required.""" + + +class WorkIQPreviewTool(TypedDict, total=False): + """A WorkIQ server-side tool. + + :ivar type: The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW. + :vartype type: str or ~azure.ai.agentserver.responses.models.models.WORK_IQ_PREVIEW + :ivar work_iq_preview: The WorkIQ tool parameters. Required. + :vartype work_iq_preview: + ~azure.ai.agentserver.responses.models.types.WorkIQPreviewToolParameters + """ + + type: Required[Literal[ToolType.WORK_IQ_PREVIEW]] + """The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW.""" + work_iq_preview: Required["WorkIQPreviewToolParameters"] + """The WorkIQ tool parameters. Required.""" + + +class WorkIQPreviewToolParameters(TypedDict, total=False): + """The WorkIQ tool parameters. + + :ivar project_connection_id: The ID of the WorkIQ project connection. Required. + :vartype project_connection_id: str + """ + + project_connection_id: Required[str] + """The ID of the WorkIQ project connection. Required.""" + + +Tool = Union[ + A2APreviewTool, + ApplyPatchToolParam, + AzureAISearchTool, + AzureFunctionTool, + BingCustomSearchPreviewTool, + BingGroundingTool, + BrowserAutomationPreviewTool, + CaptureStructuredOutputsTool, + CodeInterpreterTool, + ComputerUsePreviewTool, + CustomToolParam, + MicrosoftFabricPreviewTool, + FileSearchTool, + FunctionTool, + ImageGenTool, + LocalShellToolParam, + MCPTool, + MemorySearchTool, + MemorySearchPreviewTool, + OpenApiTool, + SharepointPreviewTool, + FunctionShellToolParam, + WebSearchTool, + WebSearchPreviewTool, + WorkIQPreviewTool, +] +OutputItem = Union[ + A2AToolCall, + A2AToolCallOutput, + OutputItemApplyPatchToolCall, + OutputItemApplyPatchToolCallOutput, + AzureAISearchToolCall, + AzureAISearchToolCallOutput, + AzureFunctionToolCall, + AzureFunctionToolCallOutput, + BingCustomSearchToolCall, + BingCustomSearchToolCallOutput, + BingGroundingToolCall, + BingGroundingToolCallOutput, + BrowserAutomationToolCall, + BrowserAutomationToolCallOutput, + OutputItemCodeInterpreterToolCall, + OutputItemCompactionBody, + OutputItemComputerToolCall, + OutputItemComputerToolCallOutputResource, + OutputItemCustomToolCall, + OutputItemCustomToolCallOutput, + FabricDataAgentToolCall, + FabricDataAgentToolCallOutput, + OutputItemFileSearchToolCall, + OutputItemFunctionToolCall, + FunctionToolCallOutputResource, + OutputItemImageGenToolCall, + OutputItemLocalShellToolCall, + OutputItemLocalShellToolCallOutput, + OutputItemMcpApprovalRequest, + OutputItemMcpApprovalResponseResource, + OutputItemMcpToolCall, + OutputItemMcpListTools, + MemorySearchToolCallItemResource, + OutputItemMessage, + OAuthConsentRequestOutputItem, + OpenApiToolCall, + OpenApiToolCallOutput, + OutputItemOutputMessage, + OutputItemReasoningItem, + SharepointGroundingToolCall, + SharepointGroundingToolCallOutput, + OutputItemFunctionShellCall, + OutputItemFunctionShellCallOutput, + StructuredOutputsOutputItem, + OutputItemWebSearchToolCall, + WorkflowActionOutputItem, +] +Annotation = Union[ContainerFileCitationBody, FileCitationBody, FilePath, UrlCitationBody] +ApplyPatchFileOperation = Union[ + ApplyPatchCreateFileOperation, ApplyPatchDeleteFileOperation, ApplyPatchUpdateFileOperation +] +ApplyPatchOperationParam = Union[ + ApplyPatchCreateFileOperationParam, ApplyPatchDeleteFileOperationParam, ApplyPatchUpdateFileOperationParam +] +Item = Union[ + ApplyPatchToolCallItemParam, + ApplyPatchToolCallOutputItemParam, + ItemCodeInterpreterToolCall, + CompactionSummaryItemParam, + ItemComputerToolCall, + ComputerCallOutputItemParam, + ItemCustomToolCall, + ItemCustomToolCallOutput, + ItemFileSearchToolCall, + ItemFunctionToolCall, + FunctionCallOutputItemParam, + ItemImageGenToolCall, + ItemReferenceParam, + ItemLocalShellToolCall, + ItemLocalShellToolCallOutput, + ItemMcpApprovalRequest, + MCPApprovalResponse, + ItemMcpToolCall, + ItemMcpListTools, + MemorySearchToolCallItemParam, + ItemMessage, + ItemOutputMessage, + ItemReasoningItem, + FunctionShellCallItemParam, + FunctionShellCallOutputItemParam, + ItemWebSearchToolCall, +] +MemoryItem = Union[ChatSummaryMemoryItem, UserProfileMemoryItem] +ComputerAction = Union[ + ClickParam, + DoubleClickAction, + DragParam, + KeyPressAction, + MoveParam, + ScreenshotParam, + ScrollParam, + TypeParam, + WaitParam, +] +MessageContent = Union[ + ComputerScreenshotContent, + MessageContentInputFileContent, + MessageContentInputImageContent, + MessageContentInputTextContent, + MessageContentOutputTextContent, + MessageContentReasoningTextContent, + MessageContentRefusalContent, + SummaryTextContent, + TextContent, +] +FunctionShellToolParamEnvironment = Union[ + ContainerAutoParam, + FunctionShellToolParamEnvironmentContainerReferenceParam, + FunctionShellToolParamEnvironmentLocalEnvironmentParam, +] +ContainerNetworkPolicyParam = Union[ContainerNetworkPolicyAllowlistParam, ContainerNetworkPolicyDisabledParam] +FunctionShellCallEnvironment = Union[ContainerReferenceResource, LocalEnvironmentResource] +ContainerSkill = Union[InlineSkillParam, SkillReferenceParam] +CustomToolParamFormat = Union[CustomGrammarFormatParam, CustomTextFormatParam] +FunctionAndCustomToolCallOutput = Union[ + FunctionAndCustomToolCallOutputInputFileContent, + FunctionAndCustomToolCallOutputInputImageContent, + FunctionAndCustomToolCallOutputInputTextContent, +] +FunctionShellCallItemParamEnvironment = Union[ + FunctionShellCallItemParamEnvironmentContainerReferenceParam, + FunctionShellCallItemParamEnvironmentLocalEnvironmentParam, +] +FunctionShellCallOutputOutcome = Union[FunctionShellCallOutputExitOutcome, FunctionShellCallOutputTimeoutOutcome] +FunctionShellCallOutputOutcomeParam = Union[ + FunctionShellCallOutputExitOutcomeParam, FunctionShellCallOutputTimeoutOutcomeParam +] +ItemField = Union[ + ItemFieldApplyPatchToolCall, + ItemFieldApplyPatchToolCallOutput, + ItemFieldCodeInterpreterToolCall, + ItemFieldCompactionBody, + ItemFieldComputerToolCall, + ItemFieldComputerToolCallOutputResource, + ItemFieldCustomToolCall, + ItemFieldCustomToolCallOutput, + ItemFieldFileSearchToolCall, + ItemFieldFunctionToolCall, + FunctionToolCallOutput, + ItemFieldImageGenToolCall, + ItemFieldLocalShellToolCall, + ItemFieldLocalShellToolCallOutput, + ItemFieldMcpApprovalRequest, + ItemFieldMcpApprovalResponseResource, + ItemFieldMcpToolCall, + ItemFieldMcpListTools, + ItemFieldMessage, + ItemFieldReasoningItem, + ItemFieldFunctionShellCall, + ItemFieldFunctionShellCallOutput, + ItemFieldWebSearchToolCall, +] +OpenApiAuthDetails = Union[OpenApiAnonymousAuthDetails, OpenApiManagedAuthDetails, OpenApiProjectConnectionAuthDetails] +OutputContent = Union[OutputContentOutputTextContent, OutputContentReasoningTextContent, OutputContentRefusalContent] +OutputMessageContent = Union[OutputMessageContentOutputTextContent, OutputMessageContentRefusalContent] +ResponseStreamEvent = Union[ + ResponseErrorEvent, + ResponseAudioDeltaEvent, + ResponseAudioDoneEvent, + ResponseAudioTranscriptDeltaEvent, + ResponseAudioTranscriptDoneEvent, + ResponseCodeInterpreterCallCompletedEvent, + ResponseCodeInterpreterCallInProgressEvent, + ResponseCodeInterpreterCallInterpretingEvent, + ResponseCodeInterpreterCallCodeDeltaEvent, + ResponseCodeInterpreterCallCodeDoneEvent, + ResponseCompletedEvent, + ResponseContentPartAddedEvent, + ResponseContentPartDoneEvent, + ResponseCreatedEvent, + ResponseCustomToolCallInputDeltaEvent, + ResponseCustomToolCallInputDoneEvent, + ResponseFailedEvent, + ResponseFileSearchCallCompletedEvent, + ResponseFileSearchCallInProgressEvent, + ResponseFileSearchCallSearchingEvent, + ResponseFunctionCallArgumentsDeltaEvent, + ResponseFunctionCallArgumentsDoneEvent, + ResponseImageGenCallCompletedEvent, + ResponseImageGenCallGeneratingEvent, + ResponseImageGenCallInProgressEvent, + ResponseImageGenCallPartialImageEvent, + ResponseInProgressEvent, + ResponseIncompleteEvent, + ResponseMCPCallCompletedEvent, + ResponseMCPCallFailedEvent, + ResponseMCPCallInProgressEvent, + ResponseMCPCallArgumentsDeltaEvent, + ResponseMCPCallArgumentsDoneEvent, + ResponseMCPListToolsCompletedEvent, + ResponseMCPListToolsFailedEvent, + ResponseMCPListToolsInProgressEvent, + ResponseOutputItemAddedEvent, + ResponseOutputItemDoneEvent, + ResponseOutputTextAnnotationAddedEvent, + ResponseTextDeltaEvent, + ResponseTextDoneEvent, + ResponseQueuedEvent, + ResponseReasoningSummaryPartAddedEvent, + ResponseReasoningSummaryPartDoneEvent, + ResponseReasoningSummaryTextDeltaEvent, + ResponseReasoningSummaryTextDoneEvent, + ResponseReasoningTextDeltaEvent, + ResponseReasoningTextDoneEvent, + ResponseRefusalDeltaEvent, + ResponseRefusalDoneEvent, + ResponseWebSearchCallCompletedEvent, + ResponseWebSearchCallInProgressEvent, + ResponseWebSearchCallSearchingEvent, +] +ToolChoiceParam = Union[ + ToolChoiceAllowed, + SpecificApplyPatchParam, + ToolChoiceCodeInterpreter, + ToolChoiceComputerUsePreview, + ToolChoiceCustom, + ToolChoiceFileSearch, + ToolChoiceFunction, + ToolChoiceImageGeneration, + ToolChoiceMCP, + SpecificFunctionShellParam, + ToolChoiceWebSearchPreview, + ToolChoiceWebSearchPreview20250311, +] +TextResponseFormatConfiguration = Union[ + TextResponseFormatConfigurationResponseFormatJsonObject, + TextResponseFormatJsonSchema, + TextResponseFormatConfigurationResponseFormatText, +]