diff --git a/sdk/ai/azure-ai-projects/CHANGELOG.md b/sdk/ai/azure-ai-projects/CHANGELOG.md index b8c248424a5b..4caa3c982e8d 100644 --- a/sdk/ai/azure-ai-projects/CHANGELOG.md +++ b/sdk/ai/azure-ai-projects/CHANGELOG.md @@ -1,16 +1,79 @@ # Release History -## 2.11.0 (2026-11-10) +## 2.11.0 (2026-11-11) ### Features Added +* Voice Agents are generally available without preview opt-in for Realtime sessions, stored Realtime conversations, agent generation, and Teams Phone Extensibility/Twilio telephony and call jobs. Use `.voice_agents.realtime`, `.voice_agents.conversations`, `.voice_agents.telephony`, and `.agents.create_from_prompt()`. GPT Live, inline subagent handoff, SIP, post-call delivery, and campaigns remain in preview. +* Added preview `.beta.voice_agents.live.connect()` and `VoiceAgentLiveDefinition` for GPT Live sessions, with typed session, client/server event, tool, decision, and usage models, session updates, text and audio input, and Responses backend function-tool support. +* Added Live delegation models for Responses backends, application-managed work, and same-project prompt agents: `VoiceAgentLiveResponsesDelegation`, `VoiceAgentLiveClientDelegation`, and `VoiceAgentLiveManagedAgentDelegation`. +* Added `.beta.voice_agents.live_conversations` for listing, retrieving, and deleting stored Live conversations, retrieving conversation items, and retrieving or downloading item-level and conversation-level audio. +* Added optional preview `VoiceAgentDefinition.post_call` with `VoiceAgentPostCallConfig`, `VoiceAgentEventGridPostCallDestination`, and `VoiceAgentRoutinePostCallDestination` for post-call transcript and optional audio delivery to Event Grid connections and routines. +* Added preview SIP telephony provider support through `TelephonyProvider.SIP`, `SipTelephonyBinding`, and `SipTelephonyBindingListItem`. Added optional `UpdateTelephonyBindingRequest.allowed_calling_numbers` for incoming caller restrictions. +* Added `.voice_agents.telephony.list_call_jobs()` for listing outbound call jobs with optional status and campaign filters, and `.voice_agents.telephony.delete_call_job()` for deleting a call job. +* Added preview outbound campaign management through `.beta.voice_agents.telephony`, including long-running creation, cancellation, and deletion, campaign retrieval and listing, validation errors, and operation status. Campaign mutations support ETag match conditions. +* Added campaign configuration, scheduling, and progress models, including `TelephonyCampaign`, `TelephonyRecipient`, `ImmediateSchedule`, `AtTimeSchedule`, `PerRecipientSchedule`, and `TelephonyCampaignProgress`. `TelephonyCampaignDatasetReference.version` optionally selects a dataset version; when omitted, the latest version is pinned during campaign preparation. Added optional read-only `TelephonyCallJob.campaign_name`. +* Added preview inline Voice Agent subagents and handoff configuration through `VoiceAgentInlineSubagentConfig`, `InlineVoiceSubagent`, and `VoiceAgentHandoffPolicy`, with handoff lifecycle events and optional `VoiceAgentSessionResponseConfig.handoff`. +* Added Voice Agent system tools `VoiceAgentTransferSystemTool`, `VoiceAgentSendDtmfSystemTool`, `VoiceAgentSendSmsSystemTool`, `VoiceAgentCollectDtmfSystemTool`, `VoiceAgentCollectSmsSystemTool`, `VoiceAgentDigitRecognitionSystemTool`, and `VoiceAgentLanguageDetectionSystemTool`. +* Added `VoiceAgentTransferTarget`, `VoiceAgentTransferDestination`, and `VoiceAgentTransferRouting` for configuring system-tool transfer targets and routing. +* Added optional `VoiceAgentSystemTool.timeout_seconds`, also available on `VoiceAgentEndConversationSystemTool`, for configuring execution timeouts. +* Added realtime system-tool intent items and argument-streaming and input-collection events through `VoiceAgentSystemToolItem`, `VoiceAgentServerEventSystemToolArgumentsDelta`, `VoiceAgentServerEventSystemToolArgumentsDone`, and `VoiceAgentServerEventInputCollectionStatus`. +* Added `VoiceAgentBaseDefinition`, `VoiceAgentVoiceConfig`, and `VoiceAgentSubProtocol` for shared voice configuration and Realtime/Live definition types. Added enums for tool types, greetings, interim responses, conversation engines, RTC call errors, and voice-specific event discriminators. +* Added optional error details `MisalignmentErrorDetailsResource.review_target` and `RealtimeResponseStatusDetailsError.message`. +* Expanded `ImageGenTool.model` known-value annotations to include the `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare` model families and their dated versions, and `ImageGenTool.quality` to include `xhigh` and `max`. +* Added explicit recursive typing for nested `CompoundFilter` instances in `CompoundFilter.filters`. + +### Breaking Changes + +All breaking changes affect previously preview APIs. + +Breaking changes in beta methods: + +* Moved `.beta.agents.create_from_prompt()` to `.agents.create_from_prompt()`, and `.beta.voice_agents.realtime`, `.beta.voice_agents.conversations`, and the existing `.beta.voice_agents.telephony` binding, call, transfer-target, and call-job methods to `.voice_agents`. GPT Live and campaign management remain under `.beta.voice_agents`. +* Argument `telephony_binding` renamed to `binding` on the promoted `.voice_agents.telephony.create_binding()` method; the typed body now accepts `TelephonyBinding` instead of `CreateTelephonyBindingRequest`. +* Argument `body` renamed to `job` on the promoted `.voice_agents.telephony.create_call_job()` method; the typed body now accepts `TelephonyCallJobCreate` instead of `CreateTelephonyCallJobRequest`. +* Removed the `status` filter from the promoted `.voice_agents.telephony.list_bindings()` method. + +Breaking changes in beta classes: + +* Removed `CreateTelephonyBindingRequest`, `CreateTeamsPhoneExtensibilityTelephonyBindingRequest`, and `CreateTwilioTelephonyBindingRequest`. Use `TelephonyBinding`, `TeamsPhoneExtensibilityTelephonyBinding`, and `TwilioTelephonyBinding`, respectively. +* Class `CreateTelephonyCallJobRequest` renamed to `TelephonyCallJobCreate`. +* Removed `TelephonyOutboundDestination` and `TelephonyOutboundDestinationType`; use `TelephonyAddress` and `TelephonyAddressType`. The `source` and `destination` properties on `TelephonyCallJobCreate` and `TelephonyCallJob` now use `TelephonyAddress`; `source` no longer accepts a plain string. +* Removed `TelephonyTransferDestination`, `PSTNTelephonyTransferDestination`, `SipTelephonyTransferDestination`, `TeamsTelephonyTransferDestination`, and `TelephonyTransferDestinationKind`. `TelephonyTransferTarget.destination` now uses `TelephonyAddress`, with `PhoneNumber`, `SipAddress`, and `TeamsAddress` variants and `TelephonyAddressType`. The discriminator is `type` instead of `kind`, and the PSTN value is `phone_number` instead of `pstn`. +* Class `TelephonyOutboundFixedIntervalRetryPolicy` renamed to `FixedIntervalRetryPolicy`. +* Removed `TelephonyBindingStatus` and the `status` property from `TelephonyBinding`, `TelephonyBindingListItem`, their existing provider-specific subclasses, and `UpdateTelephonyBindingRequest`. +* Properties `TelephonyBinding.id` and `TelephonyBinding.incoming_call_url` are now read-only, including inherited properties on provider-specific bindings. +* Removed `TelephonyCallJob.object`. Properties `id`, `agent_name`, `status`, `cancellation`, `attempt_count`, `next_attempt_at`, `terminal_reason`, `revision`, `created_at`, and `updated_at` are now read-only. +* `VoiceAgentSubagentConfig` is now a polymorphic base requiring `subagent_type` instead of `subagents`. Use `VoiceAgentDelegateSubagentConfig` for the previous referenced-agent configuration, or `VoiceAgentInlineSubagentConfig` for inline subagents. +* `VoiceAgentResponseCreateParams.input` now uses dedicated response-input models (`RealtimeResponseInputMessage`, `RealtimeResponseInputFunctionCall`, `RealtimeResponseInputFunctionCallOutput`, and `RealtimeResponseItemReference`) instead of `RealtimeConversationItem`. +* Constructor argument `timestamp_type` on `VoiceAgentServerEventResponseAudioTimestampDelta` is now required; use `VoiceAgentAudioTimestampType.WORD`. +* Constructor arguments `left` and `right` on `VoiceRecordingChannelLayout` are now required; use `VoiceAudioRole.USER` and `VoiceAudioRole.AGENT`, respectively. +* Renamed `VoiceAgentInputTranscriptionModel.GPT4_O_TRANSCRIBE`, `GPT4_O_MINI_TRANSCRIBE`, `GPT4_O_TRANSCRIBE_DIARIZE`, and `WHISPER1` to `GPT_4_O_TRANSCRIBE`, `GPT_4_O_MINI_TRANSCRIBE`, `GPT_4_O_TRANSCRIBE_DIARIZE`, and `WHISPER_1`, respectively. Wire values are unchanged. +* Renamed `ActivityProtocolAccessBoundary.READ1_ON1_*` and `WRITE1_ON1_*` members to `READ_1_ON1_*` and `WRITE_1_ON1_*`, respectively, for the `MANAGER`, `DEVELOPERS`, `ALLOWLISTED`, and `TENANT` boundaries. Wire values are unchanged. + +### Bugs Fixed + +### Sample updates + +* Updated Voice Agent samples to use the GA operation paths without `allow_preview=True`; GPT Live samples retain preview opt-in. +* Added GPT Live samples for session lifecycle and settings updates, text and audio conversations, local function tools, and same-project managed-agent delegation. +* Added `sample_voice_agent_live_read_conversation.py` demonstrating stored Live conversation, transcript, and audio retrieval, with an optional temporary greeting session. +* Added `sample_voice_agent_read_generated_audio.py` demonstrating retrieval of generated, unheard audio from an interrupted Realtime reply. +* Added a Realtime interruption sample demonstrating response cancellation and conversation-item truncation. +* Updated existing Voice Agent sample descriptions, configuration guidance, and cleanup instructions. +* Consolidated the Realtime text-conversation and function-tool examples into their asynchronous samples, and removed the separate asynchronous basic agent sample. +* Updated multi-agent workflow samples to read workflow action details from serialized streaming event items. + +### Features Added + +* Voice agents are generally available without preview opt-in for Realtime sessions, stored Realtime conversations, agent generation, and Teams Phone Extensibility/Twilio telephony and call jobs. Use `.voice_agents.realtime`, `.voice_agents.conversations`, `.voice_agents.telephony`, and `.agents.create_from_prompt()`. GPT Live, inline subagent handoff, SIP, post-call delivery, and campaigns remain in preview. * Added preview `.beta.voice_agents.live.connect()` and `VoiceAgentLiveDefinition` for synchronous and asynchronous GPT Live sessions, with typed client and server events, session updates, text and audio input, and Responses backend function-tool support. * Added Live delegation models for Responses backends, application-managed work, and same-project prompt agents: `VoiceAgentLiveResponsesDelegation`, `VoiceAgentLiveClientDelegation`, and `VoiceAgentLiveManagedAgentDelegation`. * Added `.beta.voice_agents.live_conversations` for listing, retrieving, and deleting stored Live conversations, retrieving conversation items, and retrieving or downloading item-level and conversation-level audio. -* Added optional `VoiceAgentDefinition.post_call` with `VoiceAgentPostCallConfig`, `VoiceAgentEventGridPostCallDestination`, and `VoiceAgentRoutinePostCallDestination` for post-call transcript delivery to Event Grid connections and routines. Audio delivery is not supported in this preview. +* Added optional preview `VoiceAgentDefinition.post_call` with `VoiceAgentPostCallConfig`, `VoiceAgentEventGridPostCallDestination`, and `VoiceAgentRoutinePostCallDestination` for post-call transcript and audio delivery to Event Grid connections and routines. * Added SIP telephony provider support through `TelephonyProvider.SIP`, `SipTelephonyBinding`, and `SipTelephonyBindingListItem`. Added optional `UpdateTelephonyBindingRequest.allowed_calling_numbers` for incoming caller restrictions. -* Added `.beta.voice_agents.telephony.list_call_jobs()` for listing outbound call jobs with optional status and campaign filters, and `.beta.voice_agents.telephony.delete_call_job()` for deleting a call job. -* Added `.beta.voice_agents.campaigns` for managing outbound campaigns, including long-running creation, cancellation, and deletion, campaign retrieval and listing, validation errors, and operation status. Campaign mutations support ETag match conditions. +* Added `.voice_agents.telephony.list_call_jobs()` for listing outbound call jobs with optional status and campaign filters, and `.voice_agents.telephony.delete_call_job()` for deleting a call job. +* Added `.beta.voice_agents.telephony` for managing outbound campaigns, including long-running creation, cancellation, and deletion, campaign retrieval and listing, validation errors, and operation status. Campaign mutations support ETag match conditions. * Added campaign configuration, scheduling, and progress models, including `TelephonyCampaign`, `TelephonyRecipient`, `ImmediateSchedule`, `AtTimeSchedule`, `PerRecipientSchedule`, and `TelephonyCampaignProgress`. `TelephonyCampaignDatasetReference` supports an optional version that pins the latest dataset version during campaign preparation when omitted. Added optional read-only `TelephonyCallJob.campaign_name`. * Added inline Voice Agent subagents and handoff configuration through `VoiceAgentInlineSubagentConfig`, `InlineVoiceSubagent`, and `VoiceAgentHandoffPolicy`, with handoff lifecycle events and optional `VoiceAgentSessionResponseConfig.handoff`. * Added Voice Agent system tools `VoiceAgentTransferSystemTool`, `VoiceAgentSendDtmfSystemTool`, `VoiceAgentSendSmsSystemTool`, `VoiceAgentCollectDtmfSystemTool`, `VoiceAgentCollectSmsSystemTool`, `VoiceAgentDigitRecognitionSystemTool`, and `VoiceAgentLanguageDetectionSystemTool`. @@ -27,6 +90,7 @@ All breaking changes affect preview APIs. Breaking changes in beta methods: +* Moved `.beta.agents.create_from_prompt()` to `.agents.create_from_prompt()`, and `.beta.voice_agents.realtime`, `.beta.voice_agents.conversations`, and `.beta.voice_agents.telephony` to `.voice_agents`. GPT Live and campaigns remain under `.beta.voice_agents`. * Argument `telephony_binding` in `.beta.voice_agents.telephony.create_binding()` renamed to `binding`; the typed body now accepts `TelephonyBinding` instead of `CreateTelephonyBindingRequest`. * Argument `body` in `.beta.voice_agents.telephony.create_call_job()` renamed to `job`; the typed body now accepts `TelephonyCallJobCreate` instead of `CreateTelephonyCallJobRequest`. * Removed the `status` filter from `.beta.voice_agents.telephony.list_bindings()`. @@ -48,8 +112,13 @@ Breaking changes in beta classes: ### Bugs Fixed +* Fixed synchronous and asynchronous client imports and campaign polling customizations after the generated campaign operation group moved to `.beta.voice_agents.telephony`. +* Corrected the package development-status classifier for the stable release. + ### Sample updates +* Corrected workflow streaming sample type narrowing and access to Foundry-specific action fields without changing the streamed output. +* Updated Voice Agent samples to use the GA operation paths without `allow_preview=True`; GPT Live samples retain preview opt-in. * Added Live voice-agent samples under `samples/agents/voice/` for session lifecycle, text and audio conversations, local function tools, and same-project managed-agent delegation. * Added `sample_voice_agent_live_read_conversation.py` demonstrating stored Live conversation, transcript, and audio retrieval, with an optional temporary greeting session. * Added `sample_voice_agent_read_generated_audio.py` demonstrating retrieval of generated, unheard audio from an interrupted Realtime reply. diff --git a/sdk/ai/azure-ai-projects/MANIFEST.in b/sdk/ai/azure-ai-projects/MANIFEST.in index 340d96122c79..fba50036b227 100644 --- a/sdk/ai/azure-ai-projects/MANIFEST.in +++ b/sdk/ai/azure-ai-projects/MANIFEST.in @@ -1,7 +1,7 @@ include *.md include LICENSE include azure/ai/projects/py.typed -recursive-include tests * -recursive-include samples * +recursive-include tests *.py +recursive-include samples *.py *.md include azure/__init__.py include azure/ai/__init__.py diff --git a/sdk/ai/azure-ai-projects/README.md b/sdk/ai/azure-ai-projects/README.md index c7dda7b377de..83b1dbc97123 100644 --- a/sdk/ai/azure-ai-projects/README.md +++ b/sdk/ai/azure-ai-projects/README.md @@ -4,7 +4,7 @@ The AI Projects client library is part of the Microsoft Foundry SDK, and provide resources in your [Microsoft Foundry](https://ai.azure.com/) Project. Use it to: * **Create and run Agents** using methods on the `.agents` client property. This includes **Hosted Agents**, which let you run your own containerized agent runtime while using Microsoft Foundry for managed hosting and scaling. -* **Build and run Voice Agents (preview)** for real-time, speech-to-speech conversational AI, reachable over a WebSocket (`.beta.voice_agents.realtime`) or telephony (`.beta.voice_agents.telephony`), with persisted conversation transcripts and audio through `.beta.voice_agents.conversations`. +* **Build and run Voice Agents** for real-time, speech-to-speech conversational AI, reachable over a WebSocket (`.voice_agents.realtime`) or telephony (`.voice_agents.telephony`), with persisted conversation transcripts and audio through `.voice_agents.conversations`. Generate agents from a prompt with `.agents.create_from_prompt()`. These generally available features do not require preview opt-in. * **Enhance Agents with specialized tools and toolbox tools** such as: * Agent-to-Agent (A2A) * Azure AI Search @@ -45,6 +45,8 @@ resources in your [Microsoft Foundry](https://ai.azure.com/) Project. Use it to: **Important:** This stable package includes Preview features. Preview features available through stable methods require setting `allow_preview=True` when constructing the client, while Preview features exposed via the .beta sub-clients do not. Preview features may change or be removed in future versions and are not recommended for production use. +GPT Live sessions and stored Live conversations remain under `.beta.voice_agents.live` and `.beta.voice_agents.live_conversations`; outbound campaigns are available under `.beta.voice_agents.telephony`. Campaign operations automatically include the required preview header, while GA telephony bindings and call jobs use `.voice_agents.telephony`. GPT Live definitions, inline subagent handoff, SIP telephony, and post-call delivery remain in preview. Set `allow_preview=True` when creating definitions or using these conditional preview features through `.voice_agents`. + The client library uses version `v1` of the Microsoft Foundry [data plane REST APIs](https://aka.ms/azsdk/azure-ai-projects-v2/api-reference-v1). [Microsoft Foundry](https://ai.azure.com/) @@ -195,17 +197,17 @@ The table below lists the operation groups supported by the client library, with | Sessions | [Manage hosted sessions](https://learn.microsoft.com/azure/foundry/agents/how-to/manage-hosted-sessions?pivots=python) | `samples/hosted_agents/` | | Skills (preview) | | `samples/skills/` | | Toolboxes | [Curate intent-based toolbox in Foundry](https://learn.microsoft.com/azure/foundry/agents/how-to/tools/toolbox?pivots=python) | `samples/hosted_agents/`, `samples/toolboxes/` | -| Voice agents (preview) | | `samples/agents/voice/` | +| Voice agents | | `samples/agents/voice/` | -### Voice Agent realtime transport (preview) +### Voice Agent realtime transport -Use `project_client.beta.voice_agents.realtime` for agents created with `VoiceAgentDefinition`. +Use `project_client.voice_agents.realtime` for agents created with `VoiceAgentDefinition`. Connections use WebSocket by default. You can also select the transport explicitly: ```python from azure.ai.projects.models import VoiceAgentTransport -with project_client.beta.voice_agents.realtime.connect( +with project_client.voice_agents.realtime.connect( agent_name="my-voice-agent", transport=VoiceAgentTransport.WEBSOCKET, ) as connection: @@ -215,7 +217,7 @@ with project_client.beta.voice_agents.realtime.connect( The asynchronous client uses the same keyword: ```python -async with async_project_client.beta.voice_agents.realtime.connect( +async with async_project_client.voice_agents.realtime.connect( agent_name="my-voice-agent", transport=VoiceAgentTransport.WEBSOCKET, ) as connection: diff --git a/sdk/ai/azure-ai-projects/api.md b/sdk/ai/azure-ai-projects/api.md index 235f3e562a6b..db4fb687497b 100644 --- a/sdk/ai/azure-ai-projects/api.md +++ b/sdk/ai/azure-ai-projects/api.md @@ -10,6 +10,7 @@ namespace azure.ai.projects evaluation_rules: EvaluationRulesOperations indexes: IndexesOperations toolboxes: ToolboxesOperations + voice_agents: VoiceAgentsOperations def __init__( self, @@ -52,6 +53,7 @@ namespace azure.ai.projects.aio evaluation_rules: EvaluationRulesOperations indexes: IndexesOperations toolboxes: ToolboxesOperations + voice_agents: VoiceAgentsOperations def __init__( self, @@ -130,6 +132,13 @@ namespace azure.ai.projects.aio.operations **kwargs: Any ) -> AgentOptimizationJob: ... + @distributed_trace_async + async def create_from_prompt( + self, + body: GenerateAgentRequest, + **kwargs: Any + ) -> AgentDetails: ... + @overload async def create_session( self, @@ -753,6 +762,7 @@ namespace azure.ai.projects.aio.operations *, agent_name: str, agent_session_id: Optional[str] = ..., + allow_preview: bool = False, api_version: str, connection_url: Optional[str] = ..., credential: AsyncTokenCredential, @@ -986,22 +996,6 @@ namespace azure.ai.projects.aio.operations ) -> AgentInsight: ... - class azure.ai.projects.aio.operations.BetaAgentsOperations(BetaAgentsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def create_from_prompt( - self, - body: GenerateAgentRequest, - **kwargs: Any - ) -> AgentDetails: ... - - class azure.ai.projects.aio.operations.BetaEvaluationTaxonomiesOperations: def __init__( @@ -1667,7 +1661,6 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaOperations(GeneratedBetaOperations): agent_insight_monitors: BetaAgentInsightMonitorsOperations - agents: BetaAgentsOperations evaluation_taxonomies: BetaEvaluationTaxonomiesOperations insights: BetaInsightsOperations memory_stores: BetaMemoryStoresOperations @@ -2086,7 +2079,110 @@ namespace azure.ai.projects.aio.operations ) -> SkillDetails: ... - class azure.ai.projects.aio.operations.BetaVoiceAgentsCampaignsOperations(GeneratedBetaVoiceAgentsCampaignsOperations): + class azure.ai.projects.aio.operations.BetaVoiceAgentsLiveConversationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def delete( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def download_audio( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def download_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def get( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> VoiceAgentLiveConversation: ... + + @distributed_trace_async + async def get_audio( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> VoiceRecording: ... + + @distributed_trace_async + async def get_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> VoiceAudioItem: ... + + @distributed_trace_async + async def get_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> VoiceAgentLiveConversationItem: ... + + @distributed_trace + def list( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[VoiceAgentLiveConversation]: ... + + @distributed_trace + def list_items( + self, + agent_name: str, + conversation_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[VoiceAgentLiveConversationItem]: ... + + + class azure.ai.projects.aio.operations.BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): + live: AsyncBetaLive + live_conversations: BetaVoiceAgentsLiveConversationsOperations + telephony: BetaVoiceAgentsTelephonyOperations + + def __init__( + self, + *args: Any, + **kwargs: Any + ) -> None: ... + + + class azure.ai.projects.aio.operations.BetaVoiceAgentsTelephonyOperations(GeneratedBetaVoiceAgentsTelephonyOperations): def __init__( self, @@ -2202,7 +2298,7 @@ namespace azure.ai.projects.aio.operations ) -> AsyncItemPaged[TelephonyCampaignValidationError]: ... - class azure.ai.projects.aio.operations.BetaVoiceAgentsConversationsOperations: + class azure.ai.projects.aio.operations.ConnectionsOperations(ConnectionsOperationsGenerated): def __init__( self, @@ -2211,247 +2307,227 @@ namespace azure.ai.projects.aio.operations ) -> None: ... @distributed_trace_async - async def delete( + async def get( self, - agent_name: str, - conversation_id: str, + name: str, + *, + include_credentials: Optional[bool] = False, **kwargs: Any - ) -> None: ... + ) -> Connection: ... @distributed_trace_async - async def download_audio( + async def get_default( self, - agent_name: str, - conversation_id: str, + connection_type: Union[str, ConnectionType], + *, + include_credentials: Optional[bool] = False, **kwargs: Any - ) -> AsyncIterator[bytes]: ... + ) -> Connection: ... - @distributed_trace_async - async def download_audio_item( + @distributed_trace + def list( self, - agent_name: str, - conversation_id: str, - item_id: str, + *, + connection_type: Optional[Union[str, ConnectionType]] = ..., + default_connection: Optional[bool] = ..., **kwargs: Any - ) -> AsyncIterator[bytes]: ... + ) -> AsyncItemPaged[Connection]: ... - @distributed_trace_async - async def download_generated_audio_item( - self, - agent_name: str, - conversation_id: str, - item_id: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: ... - @distributed_trace_async - async def get( + class azure.ai.projects.aio.operations.DatasetsOperations(_DatasetsOperationsWithGeneration): + + def __init__( self, - agent_name: str, - conversation_id: str, - **kwargs: Any - ) -> VoiceConversation: ... + *args, + **kwargs + ) -> None: ... - @distributed_trace_async - async def get_audio( + @overload + async def begin_create_generation_job( self, - agent_name: str, - conversation_id: str, + job: DataGenerationJobInputs, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., **kwargs: Any - ) -> VoiceRecording: ... + ) -> AsyncDatasetGenerationLROPoller: ... - @distributed_trace_async - async def get_audio_item( + @overload + async def begin_create_generation_job( self, - agent_name: str, - conversation_id: str, - item_id: str, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., **kwargs: Any - ) -> VoiceAudioItem: ... + ) -> AsyncDatasetGenerationLROPoller: ... - @distributed_trace_async - async def get_generated_audio_item( + @overload + async def begin_create_generation_job( self, - agent_name: str, - conversation_id: str, - item_id: str, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., **kwargs: Any - ) -> VoiceGeneratedAudioItem: ... + ) -> AsyncDatasetGenerationLROPoller: ... @distributed_trace_async - async def get_item( + async def cancel_generation_job( self, - agent_name: str, - conversation_id: str, - item_id: str, + job_id: str, **kwargs: Any - ) -> RealtimeConversationItem: ... + ) -> DataGenerationJob: ... - @distributed_trace_async - async def get_response( + @overload + async def create_or_update( self, - agent_name: str, - conversation_id: str, - response_id: str, + name: str, + version: str, + dataset_version: DatasetVersion, + *, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> VoiceResponse: ... + ) -> DatasetVersion: ... - @distributed_trace - def list( + @overload + async def create_or_update( self, - agent_name: str, + name: str, + version: str, + dataset_version: JSON, *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> AsyncItemPaged[VoiceConversation]: ... + ) -> DatasetVersion: ... - @distributed_trace - def list_items( + @overload + async def create_or_update( self, - agent_name: str, - conversation_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[RealtimeConversationItem]: ... - - @distributed_trace - def list_response_items( - self, - agent_name: str, - conversation_id: str, - response_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[RealtimeConversationItem]: ... - - @distributed_trace - def list_responses( - self, - agent_name: str, - conversation_id: str, + name: str, + version: str, + dataset_version: IO[bytes], *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> AsyncItemPaged[VoiceResponse]: ... - - - class azure.ai.projects.aio.operations.BetaVoiceAgentsLiveConversationsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... + ) -> DatasetVersion: ... @distributed_trace_async async def delete( self, - agent_name: str, - conversation_id: str, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace_async - async def download_audio( - self, - agent_name: str, - conversation_id: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: ... - - @distributed_trace_async - async def download_audio_item( + async def delete_generation_job( self, - agent_name: str, - conversation_id: str, - item_id: str, + job_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: ... + ) -> None: ... @distributed_trace_async async def get( self, - agent_name: str, - conversation_id: str, + name: str, + version: str, **kwargs: Any - ) -> VoiceAgentLiveConversation: ... + ) -> DatasetVersion: ... @distributed_trace_async - async def get_audio( + async def get_credentials( self, - agent_name: str, - conversation_id: str, + name: str, + version: str, **kwargs: Any - ) -> VoiceRecording: ... + ) -> DatasetCredential: ... @distributed_trace_async - async def get_audio_item( + async def get_generation_job( self, - agent_name: str, - conversation_id: str, - item_id: str, + job_id: str, **kwargs: Any - ) -> VoiceAudioItem: ... + ) -> DataGenerationJob: ... - @distributed_trace_async - async def get_item( - self, - agent_name: str, - conversation_id: str, - item_id: str, - **kwargs: Any - ) -> VoiceAgentLiveConversationItem: ... + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[DatasetVersion]: ... @distributed_trace - def list( + def list_generation_jobs( self, - agent_name: str, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> AsyncItemPaged[VoiceAgentLiveConversation]: ... + ) -> AsyncItemPaged[DataGenerationJob]: ... @distributed_trace - def list_items( + def list_versions( self, - agent_name: str, - conversation_id: str, + name: str, + **kwargs: Any + ) -> AsyncItemPaged[DatasetVersion]: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged[VoiceAgentLiveConversationItem]: ... + ) -> PendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... - class azure.ai.projects.aio.operations.BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): - campaigns: BetaVoiceAgentsCampaignsOperations - conversations: BetaVoiceAgentsConversationsOperations - live: AsyncBetaLive - live_conversations: BetaVoiceAgentsLiveConversationsOperations - realtime: AsyncBetaRealtime - telephony: BetaVoiceAgentsTelephonyOperations + @distributed_trace_async + async def upload_file( + self, + *, + connection_name: Optional[str] = ..., + file_path: str, + name: str, + version: str, + **kwargs: Any + ) -> FileDatasetVersion: ... - def __init__( + @distributed_trace_async + async def upload_folder( self, - *args: Any, + *, + connection_name: Optional[str] = ..., + file_pattern: Optional[Pattern] = ..., + folder: str, + name: str, + version: str, **kwargs: Any - ) -> None: ... + ) -> FolderDatasetVersion: ... - class azure.ai.projects.aio.operations.BetaVoiceAgentsTelephonyOperations: + class azure.ai.projects.aio.operations.DeploymentsOperations: def __init__( self, @@ -2460,323 +2536,87 @@ namespace azure.ai.projects.aio.operations ) -> None: ... @distributed_trace_async - async def cancel_call_job( + async def get( self, - agent_name: str, - call_job_id: str, - *, - etag: str, - match_condition: MatchConditions, + name: str, **kwargs: Any - ) -> TelephonyCallJob: ... + ) -> Deployment: ... - @overload - async def create_binding( + @distributed_trace + def list( self, - agent_name: str, - binding: TelephonyBinding, *, - content_type: str = "application/json", + deployment_type: Optional[Union[str, DeploymentType]] = ..., + model_name: Optional[str] = ..., + model_publisher: Optional[str] = ..., **kwargs: Any - ) -> TelephonyBinding: ... + ) -> AsyncItemPaged[Deployment]: ... - @overload - async def create_binding( - self, - agent_name: str, - binding: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyBinding: ... - @overload - async def create_binding( + class azure.ai.projects.aio.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): + + def __init__( self, - agent_name: str, - binding: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyBinding: ... + *args, + **kwargs + ) -> None: ... @overload - async def create_call_job( + async def create_or_update( self, - agent_name: str, - job: TelephonyCallJobCreate, + id: str, + evaluation_rule: EvaluationRule, *, content_type: str = "application/json", - idempotency_key: str, **kwargs: Any - ) -> TelephonyCallJob: ... + ) -> EvaluationRule: ... @overload - async def create_call_job( + async def create_or_update( self, - agent_name: str, - job: JSON, + id: str, + evaluation_rule: JSON, *, content_type: str = "application/json", - idempotency_key: str, **kwargs: Any - ) -> TelephonyCallJob: ... + ) -> EvaluationRule: ... @overload - async def create_call_job( + async def create_or_update( self, - agent_name: str, - job: IO[bytes], + id: str, + evaluation_rule: IO[bytes], *, content_type: str = "application/json", - idempotency_key: str, **kwargs: Any - ) -> TelephonyCallJob: ... + ) -> EvaluationRule: ... @distributed_trace_async - async def delete_binding( + async def delete( self, - agent_name: str, - binding_id: str, - *, - etag: str, - match_condition: MatchConditions, + id: str, **kwargs: Any ) -> None: ... @distributed_trace_async - async def delete_call_job( + async def get( self, - agent_name: str, - call_job_id: str, + id: str, **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def end_call( - self, - agent_name: str, - call_id: str, - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @distributed_trace_async - async def get_binding( - self, - agent_name: str, - binding_id: str, - **kwargs: Any - ) -> TelephonyBinding: ... - - @distributed_trace_async - async def get_call( - self, - agent_name: str, - call_id: str, - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @distributed_trace_async - async def get_call_job( - self, - agent_name: str, - call_job_id: str, - **kwargs: Any - ) -> TelephonyCallJob: ... - - @distributed_trace_async - async def get_transfer_targets( - self, - agent_name: str, - **kwargs: Any - ) -> TelephonyTransferTargets: ... - - @distributed_trace - def list_bindings( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - provider: Optional[Union[str, TelephonyProvider]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[TelephonyBindingListItem]: ... - - @distributed_trace - def list_call_jobs( - self, - agent_name: str, - *, - before: Optional[str] = ..., - campaign_name: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - status: Optional[Union[str, TelephonyCallJobStatus]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[TelephonyCallJob]: ... - - @distributed_trace - def list_calls( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - provider: Optional[Union[str, TelephonyProvider]] = ..., - started_after_time: Optional[datetime] = ..., - started_before_time: Optional[datetime] = ..., - status: Optional[Union[str, TelephonyCallStatus]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[TelephonyCallSummary]: ... - - @overload - async def replace_transfer_targets( - self, - agent_name: str, - *, - content_type: str = "application/json", - etag: str, - match_condition: MatchConditions, - transfer_targets: List[TelephonyTransferTarget], - **kwargs: Any - ) -> TelephonyTransferTargets: ... - - @overload - async def replace_transfer_targets( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> TelephonyTransferTargets: ... - - @overload - async def replace_transfer_targets( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> TelephonyTransferTargets: ... - - @overload - async def transfer_call( - self, - agent_name: str, - call_id: str, - *, - content_type: str = "application/json", - target: str, - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @overload - async def transfer_call( - self, - agent_name: str, - call_id: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @overload - async def transfer_call( - self, - agent_name: str, - call_id: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @overload - async def update_binding( - self, - agent_name: str, - binding_id: str, - body: UpdateTelephonyBindingRequest, - *, - content_type: str = "application/merge-patch+json", - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> TelephonyBinding: ... - - @overload - async def update_binding( - self, - agent_name: str, - binding_id: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> TelephonyBinding: ... - - @overload - async def update_binding( - self, - agent_name: str, - binding_id: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> TelephonyBinding: ... - - - class azure.ai.projects.aio.operations.ConnectionsOperations(ConnectionsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - *, - include_credentials: Optional[bool] = False, - **kwargs: Any - ) -> Connection: ... - - @distributed_trace_async - async def get_default( - self, - connection_type: Union[str, ConnectionType], - *, - include_credentials: Optional[bool] = False, - **kwargs: Any - ) -> Connection: ... + ) -> EvaluationRule: ... @distributed_trace def list( self, *, - connection_type: Optional[Union[str, ConnectionType]] = ..., - default_connection: Optional[bool] = ..., + action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., + agent_name: Optional[str] = ..., + enabled: Optional[bool] = ..., **kwargs: Any - ) -> AsyncItemPaged[Connection]: ... + ) -> AsyncItemPaged[EvaluationRule]: ... - class azure.ai.projects.aio.operations.DatasetsOperations(_DatasetsOperationsWithGeneration): + class azure.ai.projects.aio.operations.EvaluatorsOperations(EvaluatorsOperationsGenerated): def __init__( self, @@ -2787,12 +2627,12 @@ namespace azure.ai.projects.aio.operations @overload async def begin_create_generation_job( self, - job: DataGenerationJobInputs, + job: EvaluatorGenerationInputs, *, content_type: str = "application/json", operation_id: Optional[str] = ..., **kwargs: Any - ) -> AsyncDatasetGenerationLROPoller: ... + ) -> AsyncEvaluatorGenerationLROPoller: ... @overload async def begin_create_generation_job( @@ -2802,7 +2642,7 @@ namespace azure.ai.projects.aio.operations content_type: str = "application/json", operation_id: Optional[str] = ..., **kwargs: Any - ) -> AsyncDatasetGenerationLROPoller: ... + ) -> AsyncEvaluatorGenerationLROPoller: ... @overload async def begin_create_generation_job( @@ -2812,55 +2652,44 @@ namespace azure.ai.projects.aio.operations content_type: str = "application/json", operation_id: Optional[str] = ..., **kwargs: Any - ) -> AsyncDatasetGenerationLROPoller: ... + ) -> AsyncEvaluatorGenerationLROPoller: ... @distributed_trace_async async def cancel_generation_job( self, job_id: str, **kwargs: Any - ) -> DataGenerationJob: ... + ) -> EvaluatorGenerationJob: ... @overload - async def create_or_update( + async def create_version( self, name: str, - version: str, - dataset_version: DatasetVersion, + evaluator_version: EvaluatorVersion, *, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> DatasetVersion: ... + ) -> EvaluatorVersion: ... @overload - async def create_or_update( + async def create_version( self, name: str, - version: str, - dataset_version: JSON, + evaluator_version: JSON, *, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> DatasetVersion: ... + ) -> EvaluatorVersion: ... @overload - async def create_or_update( + async def create_version( self, name: str, - version: str, - dataset_version: IO[bytes], + evaluator_version: IO[bytes], *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @distributed_trace_async - async def delete( - self, - name: str, - version: str, + content_type: str = "application/json", **kwargs: Any - ) -> None: ... + ) -> EvaluatorVersion: ... @distributed_trace_async async def delete_generation_job( @@ -2870,30 +2699,36 @@ namespace azure.ai.projects.aio.operations ) -> None: ... @distributed_trace_async - async def get( + async def delete_version( self, name: str, version: str, **kwargs: Any - ) -> DatasetVersion: ... + ) -> None: ... @distributed_trace_async - async def get_credentials( + async def get_generation_job( self, - name: str, - version: str, + job_id: str, **kwargs: Any - ) -> DatasetCredential: ... + ) -> EvaluatorGenerationJob: ... @distributed_trace_async - async def get_generation_job( + async def get_version( self, - job_id: str, + name: str, + version: str, **kwargs: Any - ) -> DataGenerationJob: ... + ) -> EvaluatorVersion: ... @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged[DatasetVersion]: ... + def list( + self, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[EvaluatorVersion]: ... @distributed_trace def list_generation_jobs( @@ -2903,99 +2738,53 @@ namespace azure.ai.projects.aio.operations limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> AsyncItemPaged[DataGenerationJob]: ... + ) -> AsyncItemPaged[EvaluatorGenerationJob]: ... @distributed_trace def list_versions( self, name: str, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., **kwargs: Any - ) -> AsyncItemPaged[DatasetVersion]: ... + ) -> AsyncItemPaged[EvaluatorVersion]: ... @overload - async def pending_upload( + async def update_version( self, name: str, version: str, - pending_upload_request: PendingUploadRequest, + evaluator_version: EvaluatorVersion, *, content_type: str = "application/json", **kwargs: Any - ) -> PendingUploadResponse: ... + ) -> EvaluatorVersion: ... @overload - async def pending_upload( + async def update_version( self, name: str, version: str, - pending_upload_request: JSON, + evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> PendingUploadResponse: ... + ) -> EvaluatorVersion: ... @overload - async def pending_upload( + async def update_version( self, name: str, version: str, - pending_upload_request: IO[bytes], + evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> PendingUploadResponse: ... - - @distributed_trace_async - async def upload_file( - self, - *, - connection_name: Optional[str] = ..., - file_path: str, - name: str, - version: str, - **kwargs: Any - ) -> FileDatasetVersion: ... - - @distributed_trace_async - async def upload_folder( - self, - *, - connection_name: Optional[str] = ..., - file_pattern: Optional[Pattern] = ..., - folder: str, - name: str, - version: str, - **kwargs: Any - ) -> FolderDatasetVersion: ... - - - class azure.ai.projects.aio.operations.DeploymentsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> Deployment: ... - - @distributed_trace - def list( - self, - *, - deployment_type: Optional[Union[str, DeploymentType]] = ..., - model_name: Optional[str] = ..., - model_publisher: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[Deployment]: ... + ) -> EvaluatorVersion: ... - class azure.ai.projects.aio.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): + class azure.ai.projects.aio.operations.IndexesOperations: def __init__( self, @@ -3006,137 +2795,117 @@ namespace azure.ai.projects.aio.operations @overload async def create_or_update( self, - id: str, - evaluation_rule: EvaluationRule, + name: str, + version: str, + index: Index, *, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> EvaluationRule: ... + ) -> Index: ... @overload async def create_or_update( self, - id: str, - evaluation_rule: JSON, + name: str, + version: str, + index: JSON, *, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> EvaluationRule: ... + ) -> Index: ... @overload async def create_or_update( self, - id: str, - evaluation_rule: IO[bytes], + name: str, + version: str, + index: IO[bytes], *, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> EvaluationRule: ... + ) -> Index: ... @distributed_trace_async async def delete( self, - id: str, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( self, - id: str, + name: str, + version: str, **kwargs: Any - ) -> EvaluationRule: ... + ) -> Index: ... @distributed_trace - def list( + def list(self, **kwargs: Any) -> AsyncItemPaged[Index]: ... + + @distributed_trace + def list_versions( self, - *, - action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., - agent_name: Optional[str] = ..., - enabled: Optional[bool] = ..., + name: str, **kwargs: Any - ) -> AsyncItemPaged[EvaluationRule]: ... + ) -> AsyncItemPaged[Index]: ... - class azure.ai.projects.aio.operations.EvaluatorsOperations(EvaluatorsOperationsGenerated): + class azure.ai.projects.aio.operations.TelemetryOperations: - def __init__( - self, - *args, - **kwargs - ) -> None: ... + def __init__(self, outer_instance: AIProjectClient) -> None: ... - @overload - async def begin_create_generation_job( - self, - job: EvaluatorGenerationInputs, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> AsyncEvaluatorGenerationLROPoller: ... + @distributed_trace_async + async def get_application_insights_connection_string(self) -> str: ... - @overload - async def begin_create_generation_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> AsyncEvaluatorGenerationLROPoller: ... - @overload - async def begin_create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> AsyncEvaluatorGenerationLROPoller: ... + class azure.ai.projects.aio.operations.ToolboxesOperations: - @distributed_trace_async - async def cancel_generation_job( + def __init__( self, - job_id: str, - **kwargs: Any - ) -> EvaluatorGenerationJob: ... + *args, + **kwargs + ) -> None: ... @overload async def create_version( self, name: str, - evaluator_version: EvaluatorVersion, *, content_type: str = "application/json", + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + policies: Optional[ToolboxPolicies] = ..., + skills: Optional[List[ToolboxSkill]] = ..., + tools: List[ToolboxTool], **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @overload async def create_version( self, name: str, - evaluator_version: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @overload async def create_version( self, name: str, - evaluator_version: IO[bytes], + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @distributed_trace_async - async def delete_generation_job( + async def delete( self, - job_id: str, + name: str, **kwargs: Any ) -> None: ... @@ -3149,11 +2918,11 @@ namespace azure.ai.projects.aio.operations ) -> None: ... @distributed_trace_async - async def get_generation_job( + async def get( self, - job_id: str, + name: str, **kwargs: Any - ) -> EvaluatorGenerationJob: ... + ) -> ToolboxObject: ... @distributed_trace_async async def get_version( @@ -3161,72 +2930,69 @@ namespace azure.ai.projects.aio.operations name: str, version: str, **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... - @distributed_trace - def list( + @distributed_trace_async + async def invoke_latest_toolbox_mcp( self, - *, - limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + name: str, + request: dict[str, Any], **kwargs: Any - ) -> AsyncItemPaged[EvaluatorVersion]: ... + ) -> Any: ... @distributed_trace - def list_generation_jobs( + def list( self, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> AsyncItemPaged[EvaluatorGenerationJob]: ... + ) -> AsyncItemPaged[ToolboxObject]: ... @distributed_trace def list_versions( self, name: str, *, + before: Optional[str] = ..., limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> AsyncItemPaged[EvaluatorVersion]: ... + ) -> AsyncItemPaged[ToolboxVersionObject]: ... @overload - async def update_version( + async def update( self, name: str, - version: str, - evaluator_version: EvaluatorVersion, *, content_type: str = "application/json", + default_version: str, **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxObject: ... @overload - async def update_version( + async def update( self, name: str, - version: str, - evaluator_version: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxObject: ... @overload - async def update_version( + async def update( self, name: str, - version: str, - evaluator_version: IO[bytes], + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxObject: ... - class azure.ai.projects.aio.operations.IndexesOperations: + class azure.ai.projects.aio.operations.VoiceAgentsConversationsOperations: def __init__( self, @@ -3234,204 +3000,440 @@ namespace azure.ai.projects.aio.operations **kwargs ) -> None: ... - @overload - async def create_or_update( + @distributed_trace_async + async def delete( self, - name: str, - version: str, - index: Index, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def download_audio( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def download_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def download_generated_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def get( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> VoiceConversation: ... + + @distributed_trace_async + async def get_audio( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> VoiceRecording: ... + + @distributed_trace_async + async def get_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> VoiceAudioItem: ... + + @distributed_trace_async + async def get_generated_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> VoiceGeneratedAudioItem: ... + + @distributed_trace_async + async def get_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> RealtimeConversationItem: ... + + @distributed_trace_async + async def get_response( + self, + agent_name: str, + conversation_id: str, + response_id: str, + **kwargs: Any + ) -> VoiceResponse: ... + + @distributed_trace + def list( + self, + agent_name: str, *, - content_type: str = "application/merge-patch+json", + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> Index: ... + ) -> AsyncItemPaged[VoiceConversation]: ... - @overload - async def create_or_update( + @distributed_trace + def list_items( self, - name: str, - version: str, - index: JSON, + agent_name: str, + conversation_id: str, *, - content_type: str = "application/merge-patch+json", + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> Index: ... + ) -> AsyncItemPaged[RealtimeConversationItem]: ... - @overload - async def create_or_update( + @distributed_trace + def list_response_items( self, - name: str, - version: str, - index: IO[bytes], + agent_name: str, + conversation_id: str, + response_id: str, *, - content_type: str = "application/merge-patch+json", + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> Index: ... + ) -> AsyncItemPaged[RealtimeConversationItem]: ... - @distributed_trace_async - async def delete( + @distributed_trace + def list_responses( self, - name: str, - version: str, + agent_name: str, + conversation_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[VoiceResponse]: ... + + + class azure.ai.projects.aio.operations.VoiceAgentsOperations(GeneratedVoiceAgentsOperations): + conversations: VoiceAgentsConversationsOperations + realtime: AsyncBetaRealtime + telephony: VoiceAgentsTelephonyOperations + + def __init__( + self, + *args: Any, **kwargs: Any ) -> None: ... + + class azure.ai.projects.aio.operations.VoiceAgentsTelephonyOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + @distributed_trace_async - async def get( + async def cancel_call_job( self, - name: str, - version: str, + agent_name: str, + call_job_id: str, + *, + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyCallJob: ... + + @overload + async def create_binding( + self, + agent_name: str, + binding: TelephonyBinding, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Index: ... - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged[Index]: ... + ) -> TelephonyBinding: ... - @distributed_trace - def list_versions( + @overload + async def create_binding( self, - name: str, + agent_name: str, + binding: JSON, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged[Index]: ... - - - class azure.ai.projects.aio.operations.TelemetryOperations: - - def __init__(self, outer_instance: AIProjectClient) -> None: ... - - @distributed_trace_async - async def get_application_insights_connection_string(self) -> str: ... - - - class azure.ai.projects.aio.operations.ToolboxesOperations: + ) -> TelephonyBinding: ... - def __init__( + @overload + async def create_binding( self, - *args, - **kwargs - ) -> None: ... + agent_name: str, + binding: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TelephonyBinding: ... @overload - async def create_version( + async def create_call_job( self, - name: str, + agent_name: str, + job: TelephonyCallJobCreate, *, content_type: str = "application/json", - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - policies: Optional[ToolboxPolicies] = ..., - skills: Optional[List[ToolboxSkill]] = ..., - tools: List[ToolboxTool], + idempotency_key: str, **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyCallJob: ... @overload - async def create_version( + async def create_call_job( self, - name: str, - body: JSON, + agent_name: str, + job: JSON, *, content_type: str = "application/json", + idempotency_key: str, **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyCallJob: ... @overload - async def create_version( + async def create_call_job( self, - name: str, - body: IO[bytes], + agent_name: str, + job: IO[bytes], *, content_type: str = "application/json", + idempotency_key: str, **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyCallJob: ... @distributed_trace_async - async def delete( + async def delete_binding( self, - name: str, + agent_name: str, + binding_id: str, + *, + etag: str, + match_condition: MatchConditions, **kwargs: Any ) -> None: ... @distributed_trace_async - async def delete_version( + async def delete_call_job( self, - name: str, - version: str, + agent_name: str, + call_job_id: str, **kwargs: Any ) -> None: ... @distributed_trace_async - async def get( + async def end_call( self, - name: str, + agent_name: str, + call_id: str, **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyCallRecord: ... @distributed_trace_async - async def get_version( + async def get_binding( self, - name: str, - version: str, + agent_name: str, + binding_id: str, **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyBinding: ... @distributed_trace_async - async def invoke_latest_toolbox_mcp( + async def get_call( self, - name: str, - request: dict[str, Any], + agent_name: str, + call_id: str, **kwargs: Any - ) -> Any: ... + ) -> TelephonyCallRecord: ... + + @distributed_trace_async + async def get_call_job( + self, + agent_name: str, + call_job_id: str, + **kwargs: Any + ) -> TelephonyCallJob: ... + + @distributed_trace_async + async def get_transfer_targets( + self, + agent_name: str, + **kwargs: Any + ) -> TelephonyTransferTargets: ... @distributed_trace - def list( + def list_bindings( self, + agent_name: str, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., + provider: Optional[Union[str, TelephonyProvider]] = ..., **kwargs: Any - ) -> AsyncItemPaged[ToolboxObject]: ... + ) -> AsyncItemPaged[TelephonyBindingListItem]: ... @distributed_trace - def list_versions( + def list_call_jobs( self, - name: str, + agent_name: str, *, before: Optional[str] = ..., + campaign_name: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., + status: Optional[Union[str, TelephonyCallJobStatus]] = ..., **kwargs: Any - ) -> AsyncItemPaged[ToolboxVersionObject]: ... + ) -> AsyncItemPaged[TelephonyCallJob]: ... + + @distributed_trace + def list_calls( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + provider: Optional[Union[str, TelephonyProvider]] = ..., + started_after_time: Optional[datetime] = ..., + started_before_time: Optional[datetime] = ..., + status: Optional[Union[str, TelephonyCallStatus]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[TelephonyCallSummary]: ... @overload - async def update( + async def replace_transfer_targets( self, - name: str, + agent_name: str, *, content_type: str = "application/json", - default_version: str, + etag: str, + match_condition: MatchConditions, + transfer_targets: List[TelephonyTransferTarget], **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyTransferTargets: ... @overload - async def update( + async def replace_transfer_targets( self, - name: str, + agent_name: str, body: JSON, *, content_type: str = "application/json", + etag: str, + match_condition: MatchConditions, **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyTransferTargets: ... @overload - async def update( + async def replace_transfer_targets( self, - name: str, + agent_name: str, body: IO[bytes], *, content_type: str = "application/json", + etag: str, + match_condition: MatchConditions, **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyTransferTargets: ... + + @overload + async def transfer_call( + self, + agent_name: str, + call_id: str, + *, + content_type: str = "application/json", + target: str, + **kwargs: Any + ) -> TelephonyCallRecord: ... + + @overload + async def transfer_call( + self, + agent_name: str, + call_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TelephonyCallRecord: ... + + @overload + async def transfer_call( + self, + agent_name: str, + call_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TelephonyCallRecord: ... + + @overload + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: UpdateTelephonyBindingRequest, + *, + content_type: str = "application/merge-patch+json", + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyBinding: ... + + @overload + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyBinding: ... + + @overload + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyBinding: ... namespace azure.ai.projects.models @@ -3568,19 +3570,19 @@ namespace azure.ai.projects.models class azure.ai.projects.models.ActivityProtocolAccessBoundary(str, Enum, metaclass=CaseInsensitiveEnumMeta): - READ1_ON1_ALLOWLISTED = "read.1on1.allowlisted" - READ1_ON1_DEVELOPERS = "read.1on1.developers" - READ1_ON1_MANAGER = "read.1on1.manager" - READ1_ON1_TENANT = "read.1on1.tenant" + READ_1_ON1_ALLOWLISTED = "read.1on1.allowlisted" + READ_1_ON1_DEVELOPERS = "read.1on1.developers" + READ_1_ON1_MANAGER = "read.1on1.manager" + READ_1_ON1_TENANT = "read.1on1.tenant" READ_GROUP_ALLOWLISTED = "read.group.allowlisted" READ_GROUP_DEVELOPERS = "read.group.developers" READ_GROUP_MANAGER_INVITED = "read.group.manager-invited" READ_GROUP_MANAGER_PRESENT = "read.group.manager-present" READ_GROUP_TENANT = "read.group.tenant" - WRITE1_ON1_ALLOWLISTED = "write.1on1.allowlisted" - WRITE1_ON1_DEVELOPERS = "write.1on1.developers" - WRITE1_ON1_MANAGER = "write.1on1.manager" - WRITE1_ON1_TENANT = "write.1on1.tenant" + WRITE_1_ON1_ALLOWLISTED = "write.1on1.allowlisted" + WRITE_1_ON1_DEVELOPERS = "write.1on1.developers" + WRITE_1_ON1_MANAGER = "write.1on1.manager" + WRITE_1_ON1_TENANT = "write.1on1.tenant" WRITE_GROUP_ALLOWLISTED = "write.group.allowlisted" WRITE_GROUP_DEVELOPERS = "write.group.developers" WRITE_GROUP_MANAGER_INVITED = "write.group.manager-invited" @@ -12536,7 +12538,7 @@ namespace azure.ai.projects.models class azure.ai.projects.models.ModelIdsLive(str, Enum, metaclass=CaseInsensitiveEnumMeta): - GPT_LIVE1 = "gpt-live-1" + GPT_LIVE_1 = "gpt-live-1" class azure.ai.projects.models.ModelPendingUploadRequest(_Model): @@ -13669,7 +13671,7 @@ namespace azure.ai.projects.models response_id: Optional[str] role: Literal[RealtimeConversationItemMessageType.ASSISTANT] status: Optional[Literal["completed", "incomplete", "in_progress"]] - type: Union[str, azure.ai.projects.models.MESSAGE] + type: Union[str, RealtimeConversationItemType] @overload def __init__( @@ -13714,7 +13716,7 @@ namespace azure.ai.projects.models response_id: Optional[str] role: Literal[RealtimeConversationItemMessageType.SYSTEM] status: Optional[Literal["completed", "incomplete", "in_progress"]] - type: Union[str, azure.ai.projects.models.MESSAGE] + type: Union[str, RealtimeConversationItemType] @overload def __init__( @@ -13761,7 +13763,7 @@ namespace azure.ai.projects.models response_id: Optional[str] role: Literal[RealtimeConversationItemMessageType.USER] status: Optional[Literal["completed", "incomplete", "in_progress"]] - type: Union[str, azure.ai.projects.models.MESSAGE] + type: Union[str, RealtimeConversationItemType] @overload def __init__( @@ -19156,7 +19158,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.COLLECT_DTMF] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -19194,7 +19196,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.COLLECT_SMS] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -19238,7 +19240,7 @@ namespace azure.ai.projects.models include: Optional[list[Union[str, VoiceAgentSessionIncludeOption]]] instructions: str interim_response: Optional[VoiceAgentInterimResponseConfig] - kind: Union[str, azure.ai.projects.models.VOICE] + kind: Union[str, AgentKind] max_output_tokens: Optional[VoiceAgentMaxOutputTokens] model: Optional[str] model_type: Optional[Union[str, VoiceModelType]] @@ -19303,7 +19305,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.DIGIT_RECOGNITION] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -19397,7 +19399,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.END_CONVERSATION] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -19721,14 +19723,14 @@ namespace azure.ai.projects.models class azure.ai.projects.models.VoiceAgentInputTranscriptionModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_SPEECH = "azure-speech" AZURE_SPEECH_STREAMING = "azure-speech-streaming" - GPT4_O_MINI_TRANSCRIBE = "gpt-4o-mini-transcribe" - GPT4_O_TRANSCRIBE = "gpt-4o-transcribe" - GPT4_O_TRANSCRIBE_DIARIZE = "gpt-4o-transcribe-diarize" + GPT_4_O_MINI_TRANSCRIBE = "gpt-4o-mini-transcribe" + GPT_4_O_TRANSCRIBE = "gpt-4o-transcribe" + GPT_4_O_TRANSCRIBE_DIARIZE = "gpt-4o-transcribe-diarize" GPT_LIVE_TRANSCRIBE = "gpt-live-transcribe" GPT_REALTIME_WHISPER = "gpt-realtime-whisper" GPT_TRANSCRIBE = "gpt-transcribe" MAI_TRANSCRIBE = "mai-transcribe" - WHISPER1 = "whisper-1" + WHISPER_1 = "whisper-1" class azure.ai.projects.models.VoiceAgentInterimResponseConfig(_Model): @@ -19779,7 +19781,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.LANGUAGE_DETECTION] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -19815,7 +19817,7 @@ namespace azure.ai.projects.models response_id: str target: Literal[VoiceAgentLiveDelegationTarget.CLIENT] thinking: Optional[str] - type: Union[str, azure.ai.projects.models.DELEGATION] + type: Union[str, VoiceAgentLiveConversationItemType] @overload def __init__( @@ -19886,7 +19888,7 @@ namespace azure.ai.projects.models delegation: Optional[VoiceAgentLiveDelegation] greeting: Optional[VoiceAgentTemplateGreetingConfig] instructions: str - kind: Union[str, azure.ai.projects.models.VOICE] + kind: Union[str, AgentKind] model: str model_type: Literal[VoiceModelType.SELF_DEPLOYED] rai_config: RaiConfig @@ -20015,7 +20017,7 @@ namespace azure.ai.projects.models response_id: str status: Union[str, VoiceAgentLiveDelegationStatus] target: Literal[VoiceAgentLiveDelegationTarget.FOUNDRY_MANAGED_AGENT] - type: Union[str, azure.ai.projects.models.DELEGATION] + type: Union[str, VoiceAgentLiveConversationItemType] @overload def __init__( @@ -20115,7 +20117,7 @@ namespace azure.ai.projects.models output: Optional[str] response_id: str target: Literal[VoiceAgentLiveDelegationTarget.RESPONSES] - type: Union[str, azure.ai.projects.models.DELEGATION] + type: Union[str, VoiceAgentLiveConversationItemType] @overload def __init__( @@ -20443,7 +20445,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.SEND_DTMF] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -20461,7 +20463,7 @@ namespace azure.ai.projects.models description: str name: Literal[VoiceAgentSystemToolName.SEND_SMS] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -21610,7 +21612,7 @@ namespace azure.ai.projects.models require_handoff: Optional[bool] targets: list[VoiceAgentTransferTarget] timeout_seconds: timedelta - type: Union[str, azure.ai.projects.models.SYSTEM] + type: Union[str, VoiceAgentToolType] @overload def __init__( @@ -22280,9 +22282,16 @@ namespace azure.ai.projects.operations @distributed_trace def cancel_optimization_job( self, - job_id: str, + job_id: str, + **kwargs: Any + ) -> AgentOptimizationJob: ... + + @distributed_trace + def create_from_prompt( + self, + body: GenerateAgentRequest, **kwargs: Any - ) -> AgentOptimizationJob: ... + ) -> AgentDetails: ... @overload def create_session( @@ -23007,22 +23016,6 @@ namespace azure.ai.projects.operations ) -> AgentInsight: ... - class azure.ai.projects.operations.BetaAgentsOperations(BetaAgentsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def create_from_prompt( - self, - body: GenerateAgentRequest, - **kwargs: Any - ) -> AgentDetails: ... - - class azure.ai.projects.operations.BetaEvaluationTaxonomiesOperations: def __init__( @@ -23752,7 +23745,6 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaOperations(GeneratedBetaOperations): agent_insight_monitors: BetaAgentInsightMonitorsOperations - agents: BetaAgentsOperations evaluation_taxonomies: BetaEvaluationTaxonomiesOperations insights: BetaInsightsOperations memory_stores: BetaMemoryStoresOperations @@ -23826,6 +23818,7 @@ namespace azure.ai.projects.operations *, agent_name: str, agent_session_id: Optional[str] = ..., + allow_preview: bool = False, api_version: str, connection_url: Optional[str] = ..., credential: TokenCredential, @@ -23982,267 +23975,35 @@ namespace azure.ai.projects.operations @distributed_trace def get( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @distributed_trace - def list( - self, - *, - after: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[Routine]: ... - - @distributed_trace - def list_runs( - self, - routine_name: str, - *, - after: Optional[str] = ..., - filter: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[RoutineRun]: ... - - - class azure.ai.projects.operations.BetaSchedulesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_or_update( - self, - schedule_id: str, - schedule: Schedule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @overload - def create_or_update( - self, - schedule_id: str, - schedule: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @overload - def create_or_update( - self, - schedule_id: str, - schedule: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @distributed_trace - def delete( - self, - schedule_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - schedule_id: str, - **kwargs: Any - ) -> Schedule: ... - - @distributed_trace - def get_run( - self, - schedule_id: str, - run_id: str, - **kwargs: Any - ) -> ScheduleRun: ... - - @distributed_trace - def list( - self, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., - **kwargs: Any - ) -> ItemPaged[Schedule]: ... - - @distributed_trace - def list_runs( - self, - schedule_id: str, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., - **kwargs: Any - ) -> ItemPaged[ScheduleRun]: ... - - - class azure.ai.projects.operations.BetaSkillsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create( - self, - name: str, - *, - content_type: str = "application/json", - default: Optional[bool] = ..., - inline_content: Optional[SkillInlineContent] = ..., - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create_from_files( - self, - name: str, - content: CreateSkillVersionFromFilesBody, - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create_from_files( - self, - name: str, - content: JSON, - **kwargs: Any - ) -> SkillVersion: ... - - @distributed_trace - def delete( - self, - name: str, - **kwargs: Any - ) -> DeleteSkillResult: ... - - @distributed_trace - def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> DeleteSkillVersionResult: ... - - @distributed_trace - def download( - self, - name: str, - **kwargs: Any - ) -> Iterator[bytes]: ... - - @distributed_trace - def download_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> Iterator[bytes]: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> SkillDetails: ... - - @distributed_trace - def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> SkillVersion: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[SkillDetails]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[SkillVersion]: ... - - @overload - def update( - self, - name: str, - *, - content_type: str = "application/json", - default_version: str, + self, + routine_name: str, **kwargs: Any - ) -> SkillDetails: ... + ) -> Routine: ... - @overload - def update( + @distributed_trace + def list( self, - name: str, - body: JSON, *, - content_type: str = "application/json", + after: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> SkillDetails: ... + ) -> ItemPaged[Routine]: ... - @overload - def update( + @distributed_trace + def list_runs( self, - name: str, - body: IO[bytes], + routine_name: str, *, - content_type: str = "application/json", + after: Optional[str] = ..., + filter: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> SkillDetails: ... + ) -> ItemPaged[RoutineRun]: ... - class azure.ai.projects.operations.BetaVoiceAgentsCampaignsOperations(GeneratedBetaVoiceAgentsCampaignsOperations): + class azure.ai.projects.operations.BetaSchedulesOperations: def __init__( self, @@ -24250,115 +24011,79 @@ namespace azure.ai.projects.operations **kwargs ) -> None: ... - def begin_cancel( - self, - agent_name: str, - campaign_name: str, - *, - etag: str, - match_condition: MatchConditions, - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> LROPoller[TelephonyCampaign]: ... - @overload - def begin_create( + def create_or_update( self, - agent_name: str, - campaign_name: str, - campaign: TelephonyCampaign, + schedule_id: str, + schedule: Schedule, *, content_type: str = "application/json", - etag: Optional[str] = ..., - match_condition: Optional[MatchConditions] = ..., - operation_id: Optional[str] = ..., **kwargs: Any - ) -> LROPoller[TelephonyCampaign]: ... + ) -> Schedule: ... @overload - def begin_create( + def create_or_update( self, - agent_name: str, - campaign_name: str, - campaign: JSON, + schedule_id: str, + schedule: JSON, *, content_type: str = "application/json", - etag: Optional[str] = ..., - match_condition: Optional[MatchConditions] = ..., - operation_id: Optional[str] = ..., **kwargs: Any - ) -> LROPoller[TelephonyCampaign]: ... + ) -> Schedule: ... @overload - def begin_create( + def create_or_update( self, - agent_name: str, - campaign_name: str, - campaign: IO[bytes], + schedule_id: str, + schedule: IO[bytes], *, content_type: str = "application/json", - etag: Optional[str] = ..., - match_condition: Optional[MatchConditions] = ..., - operation_id: Optional[str] = ..., **kwargs: Any - ) -> LROPoller[TelephonyCampaign]: ... + ) -> Schedule: ... - def begin_delete( + @distributed_trace + def delete( self, - agent_name: str, - campaign_name: str, - *, - etag: str, - match_condition: MatchConditions, - operation_id: Optional[str] = ..., + schedule_id: str, **kwargs: Any - ) -> LROPoller[None]: ... + ) -> None: ... @distributed_trace def get( self, - agent_name: str, - campaign_name: str, - *, - operation_id: Optional[str] = ..., + schedule_id: str, **kwargs: Any - ) -> TelephonyCampaign: ... + ) -> Schedule: ... @distributed_trace - def get_operation( + def get_run( self, - agent_name: str, - campaign_name: str, - operation_id: str, + schedule_id: str, + run_id: str, **kwargs: Any - ) -> TelephonyCampaignOperation: ... + ) -> ScheduleRun: ... @distributed_trace def list( self, - agent_name: str, *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - status: Optional[Union[str, TelephonyCampaignStatus]] = ..., + enabled: Optional[bool] = ..., + type: Optional[Union[str, ScheduleTaskType]] = ..., **kwargs: Any - ) -> ItemPaged[TelephonyCampaign]: ... + ) -> ItemPaged[Schedule]: ... @distributed_trace - def list_validation_errors( + def list_runs( self, - agent_name: str, - campaign_name: str, + schedule_id: str, *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + enabled: Optional[bool] = ..., + type: Optional[Union[str, ScheduleTaskType]] = ..., **kwargs: Any - ) -> ItemPaged[TelephonyCampaignValidationError]: ... + ) -> ItemPaged[ScheduleRun]: ... - class azure.ai.projects.operations.BetaVoiceAgentsConversationsOperations: + class azure.ai.projects.operations.BetaSkillsOperations: def __init__( self, @@ -24366,139 +24091,148 @@ namespace azure.ai.projects.operations **kwargs ) -> None: ... - @distributed_trace - def delete( - self, - agent_name: str, - conversation_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def download_audio( + @overload + def create( self, - agent_name: str, - conversation_id: str, + name: str, + *, + content_type: str = "application/json", + default: Optional[bool] = ..., + inline_content: Optional[SkillInlineContent] = ..., **kwargs: Any - ) -> Iterator[bytes]: ... + ) -> SkillVersion: ... - @distributed_trace - def download_audio_item( + @overload + def create( self, - agent_name: str, - conversation_id: str, - item_id: str, + name: str, + body: JSON, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: ... + ) -> SkillVersion: ... - @distributed_trace - def download_generated_audio_item( + @overload + def create( self, - agent_name: str, - conversation_id: str, - item_id: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: ... + ) -> SkillVersion: ... - @distributed_trace - def get( + @overload + def create_from_files( self, - agent_name: str, - conversation_id: str, + name: str, + content: CreateSkillVersionFromFilesBody, **kwargs: Any - ) -> VoiceConversation: ... + ) -> SkillVersion: ... - @distributed_trace - def get_audio( + @overload + def create_from_files( self, - agent_name: str, - conversation_id: str, + name: str, + content: JSON, **kwargs: Any - ) -> VoiceRecording: ... + ) -> SkillVersion: ... @distributed_trace - def get_audio_item( + def delete( self, - agent_name: str, - conversation_id: str, - item_id: str, + name: str, **kwargs: Any - ) -> VoiceAudioItem: ... + ) -> DeleteSkillResult: ... @distributed_trace - def get_generated_audio_item( + def delete_version( self, - agent_name: str, - conversation_id: str, - item_id: str, + name: str, + version: str, **kwargs: Any - ) -> VoiceGeneratedAudioItem: ... + ) -> DeleteSkillVersionResult: ... @distributed_trace - def get_item( + def download( self, - agent_name: str, - conversation_id: str, - item_id: str, + name: str, **kwargs: Any - ) -> RealtimeConversationItem: ... + ) -> Iterator[bytes]: ... @distributed_trace - def get_response( + def download_version( self, - agent_name: str, - conversation_id: str, - response_id: str, + name: str, + version: str, **kwargs: Any - ) -> VoiceResponse: ... + ) -> Iterator[bytes]: ... @distributed_trace - def list( + def get( self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + name: str, **kwargs: Any - ) -> ItemPaged[VoiceConversation]: ... + ) -> SkillDetails: ... @distributed_trace - def list_items( + def get_version( self, - agent_name: str, - conversation_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + name: str, + version: str, **kwargs: Any - ) -> ItemPaged[RealtimeConversationItem]: ... + ) -> SkillVersion: ... @distributed_trace - def list_response_items( + def list( self, - agent_name: str, - conversation_id: str, - response_id: str, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> ItemPaged[RealtimeConversationItem]: ... + ) -> ItemPaged[SkillDetails]: ... @distributed_trace - def list_responses( + def list_versions( self, - agent_name: str, - conversation_id: str, + name: str, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> ItemPaged[VoiceResponse]: ... + ) -> ItemPaged[SkillVersion]: ... + + @overload + def update( + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, + **kwargs: Any + ) -> SkillDetails: ... + + @overload + def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillDetails: ... + + @overload + def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillDetails: ... class azure.ai.projects.operations.BetaVoiceAgentsLiveConversationsOperations: @@ -24593,11 +24327,8 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): - campaigns: BetaVoiceAgentsCampaignsOperations - conversations: BetaVoiceAgentsConversationsOperations live: BetaLive live_conversations: BetaVoiceAgentsLiveConversationsOperations - realtime: BetaRealtime telephony: BetaVoiceAgentsTelephonyOperations def __init__( @@ -24607,7 +24338,7 @@ namespace azure.ai.projects.operations ) -> None: ... - class azure.ai.projects.operations.BetaVoiceAgentsTelephonyOperations: + class azure.ai.projects.operations.BetaVoiceAgentsTelephonyOperations(GeneratedBetaVoiceAgentsTelephonyOperations): def __init__( self, @@ -24615,285 +24346,112 @@ namespace azure.ai.projects.operations **kwargs ) -> None: ... - @distributed_trace - def cancel_call_job( - self, - agent_name: str, - call_job_id: str, - *, - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> TelephonyCallJob: ... - - @overload - def create_binding( - self, - agent_name: str, - binding: TelephonyBinding, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyBinding: ... - - @overload - def create_binding( - self, - agent_name: str, - binding: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyBinding: ... - - @overload - def create_binding( - self, - agent_name: str, - binding: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> TelephonyBinding: ... - - @overload - def create_call_job( - self, - agent_name: str, - job: TelephonyCallJobCreate, - *, - content_type: str = "application/json", - idempotency_key: str, - **kwargs: Any - ) -> TelephonyCallJob: ... - - @overload - def create_call_job( - self, - agent_name: str, - job: JSON, - *, - content_type: str = "application/json", - idempotency_key: str, - **kwargs: Any - ) -> TelephonyCallJob: ... - - @overload - def create_call_job( - self, - agent_name: str, - job: IO[bytes], - *, - content_type: str = "application/json", - idempotency_key: str, - **kwargs: Any - ) -> TelephonyCallJob: ... - - @distributed_trace - def delete_binding( - self, - agent_name: str, - binding_id: str, - *, - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def delete_call_job( - self, - agent_name: str, - call_job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def end_call( - self, - agent_name: str, - call_id: str, - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @distributed_trace - def get_binding( - self, - agent_name: str, - binding_id: str, - **kwargs: Any - ) -> TelephonyBinding: ... - - @distributed_trace - def get_call( - self, - agent_name: str, - call_id: str, - **kwargs: Any - ) -> TelephonyCallRecord: ... - - @distributed_trace - def get_call_job( - self, - agent_name: str, - call_job_id: str, - **kwargs: Any - ) -> TelephonyCallJob: ... - - @distributed_trace - def get_transfer_targets( - self, - agent_name: str, - **kwargs: Any - ) -> TelephonyTransferTargets: ... - - @distributed_trace - def list_bindings( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - provider: Optional[Union[str, TelephonyProvider]] = ..., - **kwargs: Any - ) -> ItemPaged[TelephonyBindingListItem]: ... - - @distributed_trace - def list_call_jobs( - self, - agent_name: str, - *, - before: Optional[str] = ..., - campaign_name: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - status: Optional[Union[str, TelephonyCallJobStatus]] = ..., - **kwargs: Any - ) -> ItemPaged[TelephonyCallJob]: ... - - @distributed_trace - def list_calls( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - provider: Optional[Union[str, TelephonyProvider]] = ..., - started_after_time: Optional[datetime] = ..., - started_before_time: Optional[datetime] = ..., - status: Optional[Union[str, TelephonyCallStatus]] = ..., - **kwargs: Any - ) -> ItemPaged[TelephonyCallSummary]: ... - - @overload - def replace_transfer_targets( + def begin_cancel( self, agent_name: str, + campaign_name: str, *, - content_type: str = "application/json", etag: str, match_condition: MatchConditions, - transfer_targets: List[TelephonyTransferTarget], + operation_id: Optional[str] = ..., **kwargs: Any - ) -> TelephonyTransferTargets: ... + ) -> LROPoller[TelephonyCampaign]: ... @overload - def replace_transfer_targets( + def begin_create( self, agent_name: str, - body: JSON, + campaign_name: str, + campaign: TelephonyCampaign, *, content_type: str = "application/json", - etag: str, - match_condition: MatchConditions, + etag: Optional[str] = ..., + match_condition: Optional[MatchConditions] = ..., + operation_id: Optional[str] = ..., **kwargs: Any - ) -> TelephonyTransferTargets: ... + ) -> LROPoller[TelephonyCampaign]: ... @overload - def replace_transfer_targets( + def begin_create( self, agent_name: str, - body: IO[bytes], + campaign_name: str, + campaign: JSON, *, content_type: str = "application/json", - etag: str, - match_condition: MatchConditions, + etag: Optional[str] = ..., + match_condition: Optional[MatchConditions] = ..., + operation_id: Optional[str] = ..., **kwargs: Any - ) -> TelephonyTransferTargets: ... + ) -> LROPoller[TelephonyCampaign]: ... @overload - def transfer_call( + def begin_create( self, agent_name: str, - call_id: str, + campaign_name: str, + campaign: IO[bytes], *, content_type: str = "application/json", - target: str, + etag: Optional[str] = ..., + match_condition: Optional[MatchConditions] = ..., + operation_id: Optional[str] = ..., **kwargs: Any - ) -> TelephonyCallRecord: ... + ) -> LROPoller[TelephonyCampaign]: ... - @overload - def transfer_call( + def begin_delete( self, agent_name: str, - call_id: str, - body: JSON, + campaign_name: str, *, - content_type: str = "application/json", + etag: str, + match_condition: MatchConditions, + operation_id: Optional[str] = ..., **kwargs: Any - ) -> TelephonyCallRecord: ... + ) -> LROPoller[None]: ... - @overload - def transfer_call( + @distributed_trace + def get( self, agent_name: str, - call_id: str, - body: IO[bytes], + campaign_name: str, *, - content_type: str = "application/json", + operation_id: Optional[str] = ..., **kwargs: Any - ) -> TelephonyCallRecord: ... + ) -> TelephonyCampaign: ... - @overload - def update_binding( + @distributed_trace + def get_operation( self, agent_name: str, - binding_id: str, - body: UpdateTelephonyBindingRequest, - *, - content_type: str = "application/merge-patch+json", - etag: str, - match_condition: MatchConditions, + campaign_name: str, + operation_id: str, **kwargs: Any - ) -> TelephonyBinding: ... + ) -> TelephonyCampaignOperation: ... - @overload - def update_binding( + @distributed_trace + def list( self, agent_name: str, - binding_id: str, - body: JSON, *, - content_type: str = "application/merge-patch+json", - etag: str, - match_condition: MatchConditions, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + status: Optional[Union[str, TelephonyCampaignStatus]] = ..., **kwargs: Any - ) -> TelephonyBinding: ... + ) -> ItemPaged[TelephonyCampaign]: ... - @overload - def update_binding( + @distributed_trace + def list_validation_errors( self, agent_name: str, - binding_id: str, - body: IO[bytes], + campaign_name: str, *, - content_type: str = "application/merge-patch+json", - etag: str, - match_condition: MatchConditions, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> TelephonyBinding: ... + ) -> ItemPaged[TelephonyCampaignValidationError]: ... class azure.ai.projects.operations.ConnectionsOperations(ConnectionsOperationsGenerated): @@ -25240,59 +24798,270 @@ namespace azure.ai.projects.operations content_type: str = "application/json", operation_id: Optional[str] = ..., **kwargs: Any - ) -> EvaluatorGenerationLROPoller: ... + ) -> EvaluatorGenerationLROPoller: ... + + @overload + def begin_create_generation_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationLROPoller: ... + + @distributed_trace + def cancel_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + def create_version( + self, + name: str, + evaluator_version: EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def create_version( + self, + name: str, + evaluator_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def create_version( + self, + name: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @distributed_trace + def delete_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @distributed_trace + def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> EvaluatorVersion: ... + + @distributed_trace + def list( + self, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluatorVersion]: ... + + @distributed_trace + def list_generation_jobs( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluatorGenerationJob]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluatorVersion]: ... + + @overload + def update_version( + self, + name: str, + version: str, + evaluator_version: EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def update_version( + self, + name: str, + version: str, + evaluator_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def update_version( + self, + name: str, + version: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + + class azure.ai.projects.operations.IndexesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + index: Index, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + index: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + index: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @distributed_trace + def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... - @overload - def begin_create_generation_job( + @distributed_trace + def get( self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + name: str, + version: str, **kwargs: Any - ) -> EvaluatorGenerationLROPoller: ... + ) -> Index: ... @distributed_trace - def cancel_generation_job( + def list(self, **kwargs: Any) -> ItemPaged[Index]: ... + + @distributed_trace + def list_versions( self, - job_id: str, + name: str, **kwargs: Any - ) -> EvaluatorGenerationJob: ... + ) -> ItemPaged[Index]: ... + + + class azure.ai.projects.operations.TelemetryOperations: + + def __init__(self, outer_instance: AIProjectClient) -> None: ... + + @distributed_trace + def get_application_insights_connection_string(self) -> str: ... + + + class azure.ai.projects.operations.ToolboxesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... @overload def create_version( self, name: str, - evaluator_version: EvaluatorVersion, *, content_type: str = "application/json", + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + policies: Optional[ToolboxPolicies] = ..., + skills: Optional[List[ToolboxSkill]] = ..., + tools: List[ToolboxTool], **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @overload def create_version( self, name: str, - evaluator_version: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @overload def create_version( self, name: str, - evaluator_version: IO[bytes], + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @distributed_trace - def delete_generation_job( + def delete( self, - job_id: str, + name: str, **kwargs: Any ) -> None: ... @@ -25305,11 +25074,11 @@ namespace azure.ai.projects.operations ) -> None: ... @distributed_trace - def get_generation_job( + def get( self, - job_id: str, + name: str, **kwargs: Any - ) -> EvaluatorGenerationJob: ... + ) -> ToolboxObject: ... @distributed_trace def get_version( @@ -25317,72 +25086,69 @@ namespace azure.ai.projects.operations name: str, version: str, **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxVersionObject: ... @distributed_trace - def list( + def invoke_latest_toolbox_mcp( self, - *, - limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + name: str, + request: dict[str, Any], **kwargs: Any - ) -> ItemPaged[EvaluatorVersion]: ... + ) -> Any: ... @distributed_trace - def list_generation_jobs( + def list( self, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> ItemPaged[EvaluatorGenerationJob]: ... + ) -> ItemPaged[ToolboxObject]: ... @distributed_trace def list_versions( self, name: str, *, + before: Optional[str] = ..., limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + order: Optional[Union[str, PageOrder]] = ..., **kwargs: Any - ) -> ItemPaged[EvaluatorVersion]: ... + ) -> ItemPaged[ToolboxVersionObject]: ... @overload - def update_version( + def update( self, name: str, - version: str, - evaluator_version: EvaluatorVersion, *, content_type: str = "application/json", + default_version: str, **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxObject: ... @overload - def update_version( + def update( self, name: str, - version: str, - evaluator_version: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxObject: ... @overload - def update_version( + def update( self, name: str, - version: str, - evaluator_version: IO[bytes], + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> EvaluatorVersion: ... + ) -> ToolboxObject: ... - class azure.ai.projects.operations.IndexesOperations: + class azure.ai.projects.operations.VoiceAgentsConversationsOperations: def __init__( self, @@ -25390,75 +25156,154 @@ namespace azure.ai.projects.operations **kwargs ) -> None: ... - @overload - def create_or_update( + @distributed_trace + def delete( self, - name: str, - version: str, - index: Index, - *, - content_type: str = "application/merge-patch+json", + agent_name: str, + conversation_id: str, **kwargs: Any - ) -> Index: ... + ) -> None: ... - @overload - def create_or_update( + @distributed_trace + def download_audio( self, - name: str, - version: str, - index: JSON, - *, - content_type: str = "application/merge-patch+json", + agent_name: str, + conversation_id: str, **kwargs: Any - ) -> Index: ... + ) -> Iterator[bytes]: ... - @overload - def create_or_update( + @distributed_trace + def download_audio_item( self, - name: str, - version: str, - index: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + agent_name: str, + conversation_id: str, + item_id: str, **kwargs: Any - ) -> Index: ... + ) -> Iterator[bytes]: ... @distributed_trace - def delete( + def download_generated_audio_item( self, - name: str, - version: str, + agent_name: str, + conversation_id: str, + item_id: str, **kwargs: Any - ) -> None: ... + ) -> Iterator[bytes]: ... @distributed_trace def get( self, - name: str, - version: str, + agent_name: str, + conversation_id: str, **kwargs: Any - ) -> Index: ... + ) -> VoiceConversation: ... @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged[Index]: ... + def get_audio( + self, + agent_name: str, + conversation_id: str, + **kwargs: Any + ) -> VoiceRecording: ... @distributed_trace - def list_versions( + def get_audio_item( self, - name: str, + agent_name: str, + conversation_id: str, + item_id: str, **kwargs: Any - ) -> ItemPaged[Index]: ... + ) -> VoiceAudioItem: ... + @distributed_trace + def get_generated_audio_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> VoiceGeneratedAudioItem: ... - class azure.ai.projects.operations.TelemetryOperations: + @distributed_trace + def get_item( + self, + agent_name: str, + conversation_id: str, + item_id: str, + **kwargs: Any + ) -> RealtimeConversationItem: ... - def __init__(self, outer_instance: AIProjectClient) -> None: ... + @distributed_trace + def get_response( + self, + agent_name: str, + conversation_id: str, + response_id: str, + **kwargs: Any + ) -> VoiceResponse: ... @distributed_trace - def get_application_insights_connection_string(self) -> str: ... + def list( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[VoiceConversation]: ... + + @distributed_trace + def list_items( + self, + agent_name: str, + conversation_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[RealtimeConversationItem]: ... + + @distributed_trace + def list_response_items( + self, + agent_name: str, + conversation_id: str, + response_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[RealtimeConversationItem]: ... + + @distributed_trace + def list_responses( + self, + agent_name: str, + conversation_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[VoiceResponse]: ... + + + class azure.ai.projects.operations.VoiceAgentsOperations(GeneratedVoiceAgentsOperations): + conversations: VoiceAgentsConversationsOperations + realtime: BetaRealtime + telephony: VoiceAgentsTelephonyOperations + + def __init__( + self, + *args: Any, + **kwargs: Any + ) -> None: ... - class azure.ai.projects.operations.ToolboxesOperations: + class azure.ai.projects.operations.VoiceAgentsTelephonyOperations: def __init__( self, @@ -25466,128 +25311,285 @@ namespace azure.ai.projects.operations **kwargs ) -> None: ... + @distributed_trace + def cancel_call_job( + self, + agent_name: str, + call_job_id: str, + *, + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyCallJob: ... + @overload - def create_version( + def create_binding( self, - name: str, + agent_name: str, + binding: TelephonyBinding, *, content_type: str = "application/json", - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - policies: Optional[ToolboxPolicies] = ..., - skills: Optional[List[ToolboxSkill]] = ..., - tools: List[ToolboxTool], **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyBinding: ... @overload - def create_version( + def create_binding( self, - name: str, - body: JSON, + agent_name: str, + binding: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyBinding: ... @overload - def create_version( + def create_binding( self, - name: str, - body: IO[bytes], + agent_name: str, + binding: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyBinding: ... + + @overload + def create_call_job( + self, + agent_name: str, + job: TelephonyCallJobCreate, + *, + content_type: str = "application/json", + idempotency_key: str, + **kwargs: Any + ) -> TelephonyCallJob: ... + + @overload + def create_call_job( + self, + agent_name: str, + job: JSON, + *, + content_type: str = "application/json", + idempotency_key: str, + **kwargs: Any + ) -> TelephonyCallJob: ... + + @overload + def create_call_job( + self, + agent_name: str, + job: IO[bytes], + *, + content_type: str = "application/json", + idempotency_key: str, + **kwargs: Any + ) -> TelephonyCallJob: ... @distributed_trace - def delete( + def delete_binding( self, - name: str, + agent_name: str, + binding_id: str, + *, + etag: str, + match_condition: MatchConditions, **kwargs: Any ) -> None: ... @distributed_trace - def delete_version( + def delete_call_job( self, - name: str, - version: str, + agent_name: str, + call_job_id: str, **kwargs: Any ) -> None: ... @distributed_trace - def get( + def end_call( self, - name: str, + agent_name: str, + call_id: str, **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyCallRecord: ... @distributed_trace - def get_version( + def get_binding( self, - name: str, - version: str, + agent_name: str, + binding_id: str, **kwargs: Any - ) -> ToolboxVersionObject: ... + ) -> TelephonyBinding: ... @distributed_trace - def invoke_latest_toolbox_mcp( + def get_call( self, - name: str, - request: dict[str, Any], + agent_name: str, + call_id: str, **kwargs: Any - ) -> Any: ... + ) -> TelephonyCallRecord: ... @distributed_trace - def list( + def get_call_job( + self, + agent_name: str, + call_job_id: str, + **kwargs: Any + ) -> TelephonyCallJob: ... + + @distributed_trace + def get_transfer_targets( + self, + agent_name: str, + **kwargs: Any + ) -> TelephonyTransferTargets: ... + + @distributed_trace + def list_bindings( self, + agent_name: str, *, before: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., + provider: Optional[Union[str, TelephonyProvider]] = ..., **kwargs: Any - ) -> ItemPaged[ToolboxObject]: ... + ) -> ItemPaged[TelephonyBindingListItem]: ... @distributed_trace - def list_versions( + def list_call_jobs( self, - name: str, + agent_name: str, *, before: Optional[str] = ..., + campaign_name: Optional[str] = ..., limit: Optional[int] = ..., order: Optional[Union[str, PageOrder]] = ..., + status: Optional[Union[str, TelephonyCallJobStatus]] = ..., **kwargs: Any - ) -> ItemPaged[ToolboxVersionObject]: ... + ) -> ItemPaged[TelephonyCallJob]: ... + + @distributed_trace + def list_calls( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + provider: Optional[Union[str, TelephonyProvider]] = ..., + started_after_time: Optional[datetime] = ..., + started_before_time: Optional[datetime] = ..., + status: Optional[Union[str, TelephonyCallStatus]] = ..., + **kwargs: Any + ) -> ItemPaged[TelephonyCallSummary]: ... @overload - def update( + def replace_transfer_targets( self, - name: str, + agent_name: str, *, content_type: str = "application/json", - default_version: str, + etag: str, + match_condition: MatchConditions, + transfer_targets: List[TelephonyTransferTarget], **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyTransferTargets: ... @overload - def update( + def replace_transfer_targets( self, - name: str, + agent_name: str, body: JSON, *, content_type: str = "application/json", + etag: str, + match_condition: MatchConditions, **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyTransferTargets: ... @overload - def update( + def replace_transfer_targets( self, - name: str, + agent_name: str, body: IO[bytes], *, content_type: str = "application/json", + etag: str, + match_condition: MatchConditions, **kwargs: Any - ) -> ToolboxObject: ... + ) -> TelephonyTransferTargets: ... + + @overload + def transfer_call( + self, + agent_name: str, + call_id: str, + *, + content_type: str = "application/json", + target: str, + **kwargs: Any + ) -> TelephonyCallRecord: ... + + @overload + def transfer_call( + self, + agent_name: str, + call_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TelephonyCallRecord: ... + + @overload + def transfer_call( + self, + agent_name: str, + call_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TelephonyCallRecord: ... + + @overload + def update_binding( + self, + agent_name: str, + binding_id: str, + body: UpdateTelephonyBindingRequest, + *, + content_type: str = "application/merge-patch+json", + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyBinding: ... + + @overload + def update_binding( + self, + agent_name: str, + binding_id: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyBinding: ... + + @overload + def update_binding( + self, + agent_name: str, + binding_id: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> TelephonyBinding: ... namespace azure.ai.projects.telemetry diff --git a/sdk/ai/azure-ai-projects/api.metadata.yml b/sdk/ai/azure-ai-projects/api.metadata.yml index 8368e9dbfddf..7a111c30e466 100644 --- a/sdk/ai/azure-ai-projects/api.metadata.yml +++ b/sdk/ai/azure-ai-projects/api.metadata.yml @@ -1,4 +1,4 @@ -apiHash: 7dadb152e4753a2fe41a0e92a5e2574a3334d5f5193f88d37381fd4977217393 +apiHash: f557270f68d0f9a883da5cac027ef1aca98ebca39cf139b9549744867dc03353 packageVersion: 2.11.0 parserVersion: 0.3.31 pythonVersion: 3.12.4 diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index bcd5477c98c4..8422342b1a43 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -902,6 +902,73 @@ "azure.ai.projects.models.VoiceConversationStatus": "Azure.AI.Projects.VoiceConversationStatus", "azure.ai.projects.models.MisalignmentErrorType": "OpenAI._MisalignmentErrorType", "azure.ai.projects.models.PageOrder": "Azure.AI.Projects.PageOrder", + "azure.ai.projects.models.VoiceAgentLiveConversationItemType": "Azure.AI.Projects.VoiceAgentLiveConversationItemType", + "azure.ai.projects.models.VoiceAgentLiveDelegationTarget": "Azure.AI.Projects.VoiceAgentLiveDelegationTarget", + "azure.ai.projects.models.VoiceAgentLiveDelegationStatus": "Azure.AI.Projects.VoiceAgentLiveDelegationStatus", + "azure.ai.projects.models.VoiceAudioRole": "Azure.AI.Projects.VoiceAudioRole", + "azure.ai.projects.models.VoiceAudioContainerFormat": "Azure.AI.Projects.VoiceAudioContainerFormat", + "azure.ai.projects.models.VoiceAudioCodec": "Azure.AI.Projects.VoiceAudioCodec", + "azure.ai.projects.models.TelephonyAddressType": "Azure.AI.Projects.TelephonyAddressType", + "azure.ai.projects.models.TelephonyCampaignScheduleType": "Azure.AI.Projects.TelephonyCampaignScheduleType", + "azure.ai.projects.models.TelephonyOutboundRetryPolicyType": "Azure.AI.Projects.TelephonyOutboundRetryPolicyType", + "azure.ai.projects.models.TelephonyCampaignStatus": "Azure.AI.Projects.TelephonyCampaignStatus", + "azure.ai.projects.models.JobStatus": "Azure.AI.Projects.JobStatus", + "azure.ai.projects.models.TelephonyCampaignOperationKind": "Azure.AI.Projects.TelephonyCampaignOperationKind", + "azure.ai.projects.models.AgentInsightOverviewSource": "Azure.AI.Projects.AgentInsightOverviewSource", + "azure.ai.projects.models.AgentInsightRunTrigger": "Azure.AI.Projects.AgentInsightRunTrigger", + "azure.ai.projects.models.AgentInsightSeverity": "Azure.AI.Projects.AgentInsightSeverity", + "azure.ai.projects.models.AgentInsightStatus": "Azure.AI.Projects.AgentInsightStatus", + "azure.ai.projects.models.AgentInsightProposedFixKind": "Azure.AI.Projects.AgentInsightProposedFixKind", + "azure.ai.projects.models.AgentInsightPromptSurface": "Azure.AI.Projects.AgentInsightPromptSurface", + "azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", + "azure.ai.projects.models.ToolType": "OpenAI.ToolType", + "azure.ai.projects.models.A2AProtocolVersion": "Azure.AI.Projects.A2AProtocolVersion", + "azure.ai.projects.models.CallableToolAllowedCaller": "OpenAI.CallableToolAllowedCaller", + "azure.ai.projects.models.AzureAISearchQueryType": "Azure.AI.Projects.AzureAISearchQueryType", + "azure.ai.projects.models.ContainerMemoryLimit": "OpenAI.ContainerMemoryLimit", + "azure.ai.projects.models.ContainerNetworkPolicyParamType": "OpenAI.ContainerNetworkPolicyParamType", + "azure.ai.projects.models.ComputerEnvironment": "OpenAI.ComputerEnvironment", + "azure.ai.projects.models.CustomToolParamFormatType": "OpenAI.CustomToolParamFormatType", + "azure.ai.projects.models.GrammarSyntax1": "OpenAI.GrammarSyntax1", + "azure.ai.projects.models.RankerVersionType": "OpenAI.RankerVersionType", + "azure.ai.projects.models.GitHubCopilotBuiltInTool": "Azure.AI.Projects.GitHubCopilotBuiltInTool", + "azure.ai.projects.models.InputFidelity": "OpenAI.InputFidelity", + "azure.ai.projects.models.ImageGenAction": "OpenAI.ImageGenActionEnum", + "azure.ai.projects.models.MicrosoftCopilotBuiltInTool": "Azure.AI.Projects.MicrosoftCopilotBuiltInTool", + "azure.ai.projects.models.OpenApiAuthType": "Azure.AI.Projects.OpenApiAuthType", + "azure.ai.projects.models.FunctionShellToolParamEnvironmentType": "OpenAI.FunctionShellToolParamEnvironmentType", + "azure.ai.projects.models.ContainerSkillType": "OpenAI.ContainerSkillType", + "azure.ai.projects.models.ToolSearchExecutionType": "OpenAI.ToolSearchExecutionType", + "azure.ai.projects.models.SearchContextSize": "OpenAI.SearchContextSize", + "azure.ai.projects.models.SearchContentType": "OpenAI.SearchContentType", + "azure.ai.projects.models.RiskCategory": "Azure.AI.Projects.RiskCategory", + "azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType", + "azure.ai.projects.models.OperationState": "Azure.Core.Foundations.OperationState", + "azure.ai.projects.models.InsightType": "Azure.AI.Projects.InsightType", + "azure.ai.projects.models.SampleType": "Azure.AI.Projects.SampleType", + "azure.ai.projects.models.TreatmentEffectType": "Azure.AI.Projects.TreatmentEffectType", + "azure.ai.projects.models.MemoryStoreObjectType": "Azure.AI.Projects.MemoryStoreObjectType", + "azure.ai.projects.models.MemoryStoreKind": "Azure.AI.Projects.MemoryStoreKind", + "azure.ai.projects.models.MemoryItemKind": "Azure.AI.Projects.MemoryItemKind", + "azure.ai.projects.models.MemoryOperationKind": "Azure.AI.Projects.MemoryOperationKind", + "azure.ai.projects.models.FoundryModelWeightType": "Azure.AI.Projects.FoundryModelWeightType", + "azure.ai.projects.models.FoundryModelSourceType": "Azure.AI.Projects.FoundryModelSourceType", + "azure.ai.projects.models.FoundryModelArtifactProfileCategory": "Azure.AI.Projects.FoundryModelArtifactProfileCategory", + "azure.ai.projects.models.FoundryModelArtifactProfileSignal": "Azure.AI.Projects.FoundryModelArtifactProfileSignal", + "azure.ai.projects.models.FoundryModelWarningCode": "Azure.AI.Projects.FoundryModelWarningCode", + "azure.ai.projects.models.AttackStrategy": "Azure.AI.Projects.AttackStrategy", + "azure.ai.projects.models.RoutineTriggerType": "Azure.AI.Projects.RoutineTriggerType", + "azure.ai.projects.models.GitHubIssueEvent": "Azure.AI.Projects.GitHubIssueEvent", + "azure.ai.projects.models.RoutineActionType": "Azure.AI.Projects.RoutineActionType", + "azure.ai.projects.models.RoutineDispatchIdentity": "Azure.AI.Projects.RoutineDispatchIdentity", + "azure.ai.projects.models.RoutineRunPhase": "Azure.AI.Projects.RoutineRunPhase", + "azure.ai.projects.models.RoutineAttemptSource": "Azure.AI.Projects.RoutineAttemptSource", + "azure.ai.projects.models.RoutineDispatchPayloadType": "Azure.AI.Projects.RoutineDispatchPayloadType", + "azure.ai.projects.models.ScheduleProvisioningStatus": "Azure.AI.Projects.ScheduleProvisioningStatus", + "azure.ai.projects.models.TriggerType": "Azure.AI.Projects.TriggerType", + "azure.ai.projects.models.RecurrenceType": "Azure.AI.Projects.RecurrenceType", + "azure.ai.projects.models.DayOfWeek": "Azure.AI.Projects.DayOfWeek", + "azure.ai.projects.models.ScheduleTaskType": "Azure.AI.Projects.ScheduleTaskType", "azure.ai.projects.models.RealtimeConversationItemType": "OpenAI.RealtimeConversationItemType", "azure.ai.projects.models.RealtimeMcpErrorType": "OpenAI.RealtimeMcpErrorType", "azure.ai.projects.models.RealtimeConversationItemMessageType": "OpenAI.RealtimeConversationItemMessageType", @@ -910,12 +977,6 @@ "azure.ai.projects.models.VoiceAgentSystemToolName": "Azure.AI.Projects.VoiceAgentSystemToolName", "azure.ai.projects.models.VoiceType": "Azure.AI.Projects.VoiceType", "azure.ai.projects.models.RealtimeAudioFormatsType": "OpenAI.RealtimeAudioFormatsType", - "azure.ai.projects.models.VoiceAudioRole": "Azure.AI.Projects.VoiceAudioRole", - "azure.ai.projects.models.VoiceAudioContainerFormat": "Azure.AI.Projects.VoiceAudioContainerFormat", - "azure.ai.projects.models.VoiceAudioCodec": "Azure.AI.Projects.VoiceAudioCodec", - "azure.ai.projects.models.VoiceAgentLiveConversationItemType": "Azure.AI.Projects.VoiceAgentLiveConversationItemType", - "azure.ai.projects.models.VoiceAgentLiveDelegationTarget": "Azure.AI.Projects.VoiceAgentLiveDelegationTarget", - "azure.ai.projects.models.VoiceAgentLiveDelegationStatus": "Azure.AI.Projects.VoiceAgentLiveDelegationStatus", "azure.ai.projects.models.TelephonyProvider": "Azure.AI.Projects.TelephonyProvider", "azure.ai.projects.models.TelephonyCallStatus": "Azure.AI.Projects.TelephonyCallStatus", "azure.ai.projects.models.TelephonyCallPhase": "Azure.AI.Projects.TelephonyCallPhase", @@ -928,14 +989,8 @@ "azure.ai.projects.models.TelephonyCallLifecycleEventSource": "Azure.AI.Projects.TelephonyCallLifecycleEventSource", "azure.ai.projects.models.TelephonyCallLifecycleEventOutcome": "Azure.AI.Projects.TelephonyCallLifecycleEventOutcome", "azure.ai.projects.models.TelephonyCallLifecycleEventReason": "Azure.AI.Projects.TelephonyCallLifecycleEventReason", - "azure.ai.projects.models.TelephonyAddressType": "Azure.AI.Projects.TelephonyAddressType", "azure.ai.projects.models.TelephonyCallJobStatus": "Azure.AI.Projects.TelephonyCallJobStatus", - "azure.ai.projects.models.TelephonyOutboundRetryPolicyType": "Azure.AI.Projects.TelephonyOutboundRetryPolicyType", "azure.ai.projects.models.TelephonyCallJobTerminalReason": "Azure.AI.Projects.TelephonyCallJobTerminalReason", - "azure.ai.projects.models.TelephonyCampaignScheduleType": "Azure.AI.Projects.TelephonyCampaignScheduleType", - "azure.ai.projects.models.TelephonyCampaignStatus": "Azure.AI.Projects.TelephonyCampaignStatus", - "azure.ai.projects.models.JobStatus": "Azure.AI.Projects.JobStatus", - "azure.ai.projects.models.TelephonyCampaignOperationKind": "Azure.AI.Projects.TelephonyCampaignOperationKind", "azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType", "azure.ai.projects.models.AgentState": "Azure.AI.Projects.AgentState", "azure.ai.projects.models.AgentStateSource": "Azure.AI.Projects.AgentStateSource", @@ -950,26 +1005,6 @@ "azure.ai.projects.models.TelemetryTransportProtocol": "Azure.AI.Projects.TelemetryTransportProtocol", "azure.ai.projects.models.ReasoningModeEnum": "OpenAI.ReasoningModeEnum", "azure.ai.projects.models.ReasoningEffort": "OpenAI.ReasoningEffort", - "azure.ai.projects.models.ToolType": "OpenAI.ToolType", - "azure.ai.projects.models.A2AProtocolVersion": "Azure.AI.Projects.A2AProtocolVersion", - "azure.ai.projects.models.CallableToolAllowedCaller": "OpenAI.CallableToolAllowedCaller", - "azure.ai.projects.models.AzureAISearchQueryType": "Azure.AI.Projects.AzureAISearchQueryType", - "azure.ai.projects.models.ContainerMemoryLimit": "OpenAI.ContainerMemoryLimit", - "azure.ai.projects.models.ContainerNetworkPolicyParamType": "OpenAI.ContainerNetworkPolicyParamType", - "azure.ai.projects.models.ComputerEnvironment": "OpenAI.ComputerEnvironment", - "azure.ai.projects.models.CustomToolParamFormatType": "OpenAI.CustomToolParamFormatType", - "azure.ai.projects.models.GrammarSyntax1": "OpenAI.GrammarSyntax1", - "azure.ai.projects.models.RankerVersionType": "OpenAI.RankerVersionType", - "azure.ai.projects.models.GitHubCopilotBuiltInTool": "Azure.AI.Projects.GitHubCopilotBuiltInTool", - "azure.ai.projects.models.InputFidelity": "OpenAI.InputFidelity", - "azure.ai.projects.models.ImageGenAction": "OpenAI.ImageGenActionEnum", - "azure.ai.projects.models.MicrosoftCopilotBuiltInTool": "Azure.AI.Projects.MicrosoftCopilotBuiltInTool", - "azure.ai.projects.models.OpenApiAuthType": "Azure.AI.Projects.OpenApiAuthType", - "azure.ai.projects.models.FunctionShellToolParamEnvironmentType": "OpenAI.FunctionShellToolParamEnvironmentType", - "azure.ai.projects.models.ContainerSkillType": "OpenAI.ContainerSkillType", - "azure.ai.projects.models.ToolSearchExecutionType": "OpenAI.ToolSearchExecutionType", - "azure.ai.projects.models.SearchContextSize": "OpenAI.SearchContextSize", - "azure.ai.projects.models.SearchContentType": "OpenAI.SearchContentType", "azure.ai.projects.models.ToolChoiceParamType": "OpenAI.ToolChoiceParamType", "azure.ai.projects.models.TextResponseFormatConfigurationType": "OpenAI.TextResponseFormatConfigurationType", "azure.ai.projects.models.VoiceAgentSubProtocol": "Azure.AI.Projects.VoiceAgentSubProtocol", @@ -1017,41 +1052,6 @@ "azure.ai.projects.models.AgentEndpointAuthorizationSchemeType": "Azure.AI.Projects.AgentEndpointAuthorizationSchemeType", "azure.ai.projects.models.PublishApprovalStatus": "Azure.AI.Projects.PublishApprovalStatus", "azure.ai.projects.models.DigitalWorkerType": "Azure.AI.Projects.DigitalWorkerType", - "azure.ai.projects.models.AgentInsightOverviewSource": "Azure.AI.Projects.AgentInsightOverviewSource", - "azure.ai.projects.models.AgentInsightRunTrigger": "Azure.AI.Projects.AgentInsightRunTrigger", - "azure.ai.projects.models.AgentInsightSeverity": "Azure.AI.Projects.AgentInsightSeverity", - "azure.ai.projects.models.AgentInsightStatus": "Azure.AI.Projects.AgentInsightStatus", - "azure.ai.projects.models.AgentInsightProposedFixKind": "Azure.AI.Projects.AgentInsightProposedFixKind", - "azure.ai.projects.models.AgentInsightPromptSurface": "Azure.AI.Projects.AgentInsightPromptSurface", - "azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", - "azure.ai.projects.models.RiskCategory": "Azure.AI.Projects.RiskCategory", - "azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType", - "azure.ai.projects.models.OperationState": "Azure.Core.Foundations.OperationState", - "azure.ai.projects.models.InsightType": "Azure.AI.Projects.InsightType", - "azure.ai.projects.models.SampleType": "Azure.AI.Projects.SampleType", - "azure.ai.projects.models.TreatmentEffectType": "Azure.AI.Projects.TreatmentEffectType", - "azure.ai.projects.models.MemoryStoreObjectType": "Azure.AI.Projects.MemoryStoreObjectType", - "azure.ai.projects.models.MemoryStoreKind": "Azure.AI.Projects.MemoryStoreKind", - "azure.ai.projects.models.MemoryItemKind": "Azure.AI.Projects.MemoryItemKind", - "azure.ai.projects.models.MemoryOperationKind": "Azure.AI.Projects.MemoryOperationKind", - "azure.ai.projects.models.FoundryModelWeightType": "Azure.AI.Projects.FoundryModelWeightType", - "azure.ai.projects.models.FoundryModelSourceType": "Azure.AI.Projects.FoundryModelSourceType", - "azure.ai.projects.models.FoundryModelArtifactProfileCategory": "Azure.AI.Projects.FoundryModelArtifactProfileCategory", - "azure.ai.projects.models.FoundryModelArtifactProfileSignal": "Azure.AI.Projects.FoundryModelArtifactProfileSignal", - "azure.ai.projects.models.FoundryModelWarningCode": "Azure.AI.Projects.FoundryModelWarningCode", - "azure.ai.projects.models.AttackStrategy": "Azure.AI.Projects.AttackStrategy", - "azure.ai.projects.models.RoutineTriggerType": "Azure.AI.Projects.RoutineTriggerType", - "azure.ai.projects.models.GitHubIssueEvent": "Azure.AI.Projects.GitHubIssueEvent", - "azure.ai.projects.models.RoutineActionType": "Azure.AI.Projects.RoutineActionType", - "azure.ai.projects.models.RoutineDispatchIdentity": "Azure.AI.Projects.RoutineDispatchIdentity", - "azure.ai.projects.models.RoutineRunPhase": "Azure.AI.Projects.RoutineRunPhase", - "azure.ai.projects.models.RoutineAttemptSource": "Azure.AI.Projects.RoutineAttemptSource", - "azure.ai.projects.models.RoutineDispatchPayloadType": "Azure.AI.Projects.RoutineDispatchPayloadType", - "azure.ai.projects.models.ScheduleProvisioningStatus": "Azure.AI.Projects.ScheduleProvisioningStatus", - "azure.ai.projects.models.TriggerType": "Azure.AI.Projects.TriggerType", - "azure.ai.projects.models.RecurrenceType": "Azure.AI.Projects.RecurrenceType", - "azure.ai.projects.models.DayOfWeek": "Azure.AI.Projects.DayOfWeek", - "azure.ai.projects.models.ScheduleTaskType": "Azure.AI.Projects.ScheduleTaskType", "azure.ai.projects.models.VersionIndicatorType": "Azure.AI.Projects.VersionIndicatorType", "azure.ai.projects.models.AgentSessionStatus": "Azure.AI.Projects.AgentSessionStatus", "azure.ai.projects.models.SessionLogEventType": "Azure.AI.Projects.SessionLogEventType", @@ -1126,6 +1126,8 @@ "azure.ai.projects.models.VoiceAgentTransport": "Azure.AI.Projects.VoiceAgentTransport", "azure.ai.projects.operations.AgentsOperations.get": "Azure.AI.Projects.Agents.getAgent", "azure.ai.projects.aio.operations.AgentsOperations.get": "Azure.AI.Projects.Agents.getAgent", + "azure.ai.projects.operations.AgentsOperations.create_from_prompt": "Azure.AI.Projects.Agents.generateAgent", + "azure.ai.projects.aio.operations.AgentsOperations.create_from_prompt": "Azure.AI.Projects.Agents.generateAgent", "azure.ai.projects.operations.AgentsOperations.delete": "Azure.AI.Projects.Agents.deleteAgent", "azure.ai.projects.aio.operations.AgentsOperations.delete": "Azure.AI.Projects.Agents.deleteAgent", "azure.ai.projects.operations.AgentsOperations.list": "Azure.AI.Projects.Agents.listAgents", @@ -1281,5 +1283,5 @@ "azure.ai.projects.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion", "azure.ai.projects.aio.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion" }, - "CrossLanguageVersion": "3247452fbac8" + "CrossLanguageVersion": "597d7f8b3ba8" } \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/assets.json b/sdk/ai/azure-ai-projects/assets.json index 5f1a62040671..54bcdd2430a5 100644 --- a/sdk/ai/azure-ai-projects/assets.json +++ b/sdk/ai/azure-ai-projects/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/ai/azure-ai-projects", - "Tag": "python/ai/azure-ai-projects_b328dd1d0f" + "Tag": "python/ai/azure-ai-projects_c35176f857" } diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py index d8f873a816da..cff83e88525e 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py @@ -26,6 +26,7 @@ EvaluatorsOperations, IndexesOperations, ToolboxesOperations, + VoiceAgentsOperations, ) if sys.version_info >= (3, 11): @@ -42,6 +43,8 @@ class AIProjectClient: # pylint: disable=too-many-instance-attributes,docstring :ivar beta: BetaOperations operations :vartype beta: azure.ai.projects.operations.BetaOperations + :ivar voice_agents: VoiceAgentsOperations operations + :vartype voice_agents: azure.ai.projects.operations.VoiceAgentsOperations :ivar agents: AgentsOperations operations :vartype agents: azure.ai.projects.operations.AgentsOperations :ivar evaluation_rules: EvaluationRulesOperations operations @@ -108,6 +111,7 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False self.beta = BetaOperations(self._client, self._config, self._serialize, self._deserialize) + self.voice_agents = VoiceAgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.agents = AgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.evaluation_rules = EvaluationRulesOperations( self._client, self._config, self._serialize, self._deserialize diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_live.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_live.py index c422a984fccb..a5160d95b9d7 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_live.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_live.py @@ -189,6 +189,7 @@ class BetaLiveConnectionManager(_BaseWebSocketConnectionManager[BetaLiveConnecti _logger = _LOGGER _subprotocol = None _protocol_name = "Live" + _requires_preview = True def __init__( self, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py index 94863905f720..240ab41cfbfb 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py @@ -19,7 +19,7 @@ from azure.identity import get_bearer_token_provider from ._client import AIProjectClient as AIProjectClientGenerated from .operations import TelemetryOperations -from .models._patch import _BETA_OPERATION_FEATURE_HEADERS, _FOUNDRY_FEATURES_HEADER_NAME, _has_header_case_insensitive +from .models._patch import _AGENT_OPERATION_FEATURE_HEADERS, _FOUNDRY_FEATURES_HEADER_NAME, _has_header_case_insensitive _OPENAI_TRANSPORT_LOGGER_NAME = "azure.ai.projects.openai_transport" logger = logging.getLogger(__name__) @@ -82,7 +82,7 @@ def _resolve_openai_default_headers(agent_name: Optional[str], kwargs: dict) -> """ default_headers = dict[str, str](kwargs.pop("default_headers", None) or {}) if agent_name is not None and not _has_header_case_insensitive(default_headers, _FOUNDRY_FEATURES_HEADER_NAME): - default_headers[_FOUNDRY_FEATURES_HEADER_NAME] = _BETA_OPERATION_FEATURE_HEADERS["agents"] + default_headers[_FOUNDRY_FEATURES_HEADER_NAME] = _AGENT_OPERATION_FEATURE_HEADERS return default_headers @@ -159,6 +159,8 @@ class AIProjectClient(AIProjectClientGenerated): # pylint: disable=too-many-ins :ivar beta: BetaOperations operations :vartype beta: azure.ai.projects.operations.BetaOperations + :ivar voice_agents: VoiceAgentsOperations operations + :vartype voice_agents: azure.ai.projects.operations.VoiceAgentsOperations :ivar agents: AgentsOperations operations :vartype agents: azure.ai.projects.operations.AgentsOperations :ivar evaluation_rules: EvaluationRulesOperations operations diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_realtime.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_realtime.py index c56df2557880..753c360d4db5 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_realtime.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_realtime.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- """Synchronous Realtime voice-agent client. -Use ``client.beta.voice_agents.realtime.connect(...)`` as a context manager. +Use ``client.voice_agents.realtime.connect(...)`` as a context manager. Send text or audio through the connection and receive model events. Install ``azure-ai-projects[voice]`` for the optional WebSocket dependencies. """ @@ -45,7 +45,7 @@ _LOGGER = logging.getLogger("azure.ai.projects.realtime") -# Voice-agent WebSocket requests need the same preview header as REST requests. +# Preview voice features use the same opt-in for WebSocket and REST requests. _VOICE_AGENT_FEATURE_HEADER: str = _AgentDefinitionOptInKeys.VOICE_AGENTS_V1_PREVIEW.value # The WebSocket handshake does not use the HTTP pipeline, so identify the SDK explicitly. @@ -678,7 +678,7 @@ class BetaRealtimeConnection( Iterate to receive events. Use ``conversation``, ``response``, and the audio buffers to send messages and control replies:: - with client.beta.voice_agents.realtime.connect(agent_name="my-agent") as conn: + with client.voice_agents.realtime.connect(agent_name="my-agent") as conn: for event in conn: if event.type == RealtimeServerEventType.RESPONSE_DONE: break @@ -759,7 +759,7 @@ class _BaseWebSocketConnectionManager(Generic[_ConnectionT]): # pylint: disable """Context manager that opens a :class:`BetaRealtimeConnection`. Returned by :meth:`BetaRealtime.connect`; you normally use it as - ``with client.beta.voice_agents.realtime.connect(...) as conn:``. + ``with client.voice_agents.realtime.connect(...) as conn:``. :keyword str endpoint: The Foundry project endpoint. :keyword credential: The credential used for the WebSocket handshake. @@ -768,6 +768,7 @@ class _BaseWebSocketConnectionManager(Generic[_ConnectionT]): # pylint: disable :paramtype credential_scopes: list[str] :keyword str api_version: The API version for the handshake. :keyword str agent_name: The name of the voice agent. + :keyword bool allow_preview: Enable preview voice features. Default is False. :keyword agent_session_id: An optional session correlation identifier. :paramtype agent_session_id: str or None :keyword transport: The optional connection transport. The SDK encodes its wire value internally. @@ -790,6 +791,7 @@ def __init__( # pylint: disable=too-many-arguments credential_scopes: List[str], api_version: str, agent_name: str, + allow_preview: bool = False, agent_session_id: Optional[str] = None, transport: Optional[Union[str, "_models.VoiceAgentTransport"]] = None, structured_inputs: Optional[Mapping[str, Any]] = None, @@ -803,6 +805,7 @@ def __init__( # pylint: disable=too-many-arguments self._credential_scopes = credential_scopes self._api_version = api_version self._agent_name = agent_name + self._allow_preview = allow_preview self._agent_session_id = agent_session_id self._transport = _normalize_transport(transport) self._structured_inputs = structured_inputs @@ -815,6 +818,7 @@ def __init__( # pylint: disable=too-many-arguments _logger = _LOGGER _subprotocol: Optional[str] = "realtime" _protocol_name = "realtime" + _requires_preview = False def __enter__(self) -> _ConnectionT: return self.enter() @@ -862,9 +866,12 @@ def enter(self) -> _ConnectionT: # pylint: disable=too-many-locals token = self._credential.get_token(*self._credential_scopes) headers: Dict[str, str] = { "Authorization": "Bearer " + token.token, - _FOUNDRY_FEATURES_HEADER_NAME: _VOICE_AGENT_FEATURE_HEADER, } headers.update(self._extra_headers) + if (self._requires_preview or self._allow_preview) and not _has_header_case_insensitive( + headers, _FOUNDRY_FEATURES_HEADER_NAME + ): + headers[_FOUNDRY_FEATURES_HEADER_NAME] = _VOICE_AGENT_FEATURE_HEADER if not _has_header_case_insensitive(headers, "User-Agent"): headers["User-Agent"] = _USER_AGENT @@ -932,7 +939,7 @@ def _create_connection(self, connection: "ClientConnection") -> BetaRealtimeConn class BetaRealtime: # pylint: disable=too-few-public-methods - """Connect to a voice agent through ``client.beta.voice_agents.realtime``. + """Connect to a voice agent through ``client.voice_agents.realtime``. Open a connection with :meth:`connect`:: @@ -940,7 +947,7 @@ class BetaRealtime: # pylint: disable=too-few-public-methods from azure.identity import DefaultAzureCredential client = AIProjectClient(endpoint, DefaultAzureCredential()) - with client.beta.voice_agents.realtime.connect(agent_name="my-agent") as conn: + with client.voice_agents.realtime.connect(agent_name="my-agent") as conn: conn.input_audio_buffer.append(audio=chunk) conn.input_audio_buffer.commit() conn.response.create() @@ -949,7 +956,7 @@ class BetaRealtime: # pylint: disable=too-few-public-methods break :param client: The voice-agent client that supplies the project endpoint and credential. - :type client: ~azure.ai.projects.operations.BetaVoiceAgentsOperations + :type client: ~azure.ai.projects.operations.VoiceAgentsOperations """ def __init__(self, *args: Any, **kwargs: Any) -> None: @@ -994,9 +1001,9 @@ def connect( # pylint: disable=too-many-arguments :paramtype credential_scopes: list[str] or None :keyword extra_query: Additional query-string parameters for the handshake. :paramtype extra_query: Mapping[str, str] or None - :keyword extra_headers: Additional headers for the handshake. Pass - ``{"Foundry-Features": "..."}`` here to override the ``VoiceAgents=V1Preview`` value - this method always sends by default. + :keyword extra_headers: Additional headers for the handshake. Preview voice features + require ``allow_preview=True`` on the project client or an explicit + ``{"Foundry-Features": "VoiceAgents=V1Preview"}`` header. GA voice sessions need no opt-in. :paramtype extra_headers: Mapping[str, str] or None :return: A context manager yielding a :class:`BetaRealtimeConnection`. :rtype: ~azure.ai.projects.BetaRealtimeConnectionManager @@ -1008,6 +1015,7 @@ def connect( # pylint: disable=too-many-arguments credential_scopes=credential_scopes or self._config.credential_scopes, api_version=api_version or self._config.api_version, agent_name=agent_name, + allow_preview=bool(self._config.allow_preview), agent_session_id=agent_session_id, transport=transport, structured_inputs=structured_inputs, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py index 459fb4b4c6c8..00126f9de4a6 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py @@ -11,12 +11,12 @@ if TYPE_CHECKING: from . import models as _models Filters: TypeAlias = Union["_models.ComparisonFilter", "_models.CompoundFilter"] +RoutineRunStatus: TypeAlias = str VoiceAgentToolChoice: TypeAlias = Union[ Literal["none"], Literal["auto"], Literal["required"], "_models.ToolChoiceFunction", "_models.ToolChoiceMCP" ] VoiceAgentMaxOutputTokens: TypeAlias = Union[int, Literal["inf"]] VoiceAgentHandoffMaxOutputTokens: TypeAlias = Union[int, Literal["inf"]] -RoutineRunStatus: TypeAlias = str VoiceAgentSessionResponse: TypeAlias = "_models.VoiceAgentSessionResponseConfig" RealtimeResponseInputItem: TypeAlias = Union[ "_models.RealtimeResponseInputMessage", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py index 117a175f61a6..4ec96f3d69d0 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py @@ -26,6 +26,7 @@ EvaluatorsOperations, IndexesOperations, ToolboxesOperations, + VoiceAgentsOperations, ) if sys.version_info >= (3, 11): @@ -42,6 +43,8 @@ class AIProjectClient: # pylint: disable=too-many-instance-attributes,docstring :ivar beta: BetaOperations operations :vartype beta: azure.ai.projects.aio.operations.BetaOperations + :ivar voice_agents: VoiceAgentsOperations operations + :vartype voice_agents: azure.ai.projects.aio.operations.VoiceAgentsOperations :ivar agents: AgentsOperations operations :vartype agents: azure.ai.projects.aio.operations.AgentsOperations :ivar evaluation_rules: EvaluationRulesOperations operations @@ -108,6 +111,7 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False self.beta = BetaOperations(self._client, self._config, self._serialize, self._deserialize) + self.voice_agents = VoiceAgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.agents = AgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.evaluation_rules = EvaluationRulesOperations( self._client, self._config, self._serialize, self._deserialize diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_live.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_live.py index d32aa437af9b..85b4fd5909dd 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_live.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_live.py @@ -223,6 +223,7 @@ class AsyncBetaLiveConnectionManager(_BaseWebSocketConnectionManager[AsyncBetaLi _logger = _LOGGER _subprotocol = None _protocol_name = "Live" + _requires_preview = True def __init__( self, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py index 3441904edb28..b68ce7f4124e 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py @@ -39,6 +39,8 @@ class AIProjectClient(AIProjectClientGenerated): # pylint: disable=too-many-ins :ivar beta: BetaOperations operations :vartype beta: azure.ai.projects.aio.operations.BetaOperations + :ivar voice_agents: VoiceAgentsOperations operations + :vartype voice_agents: azure.ai.projects.aio.operations.VoiceAgentsOperations :ivar agents: AgentsOperations operations :vartype agents: azure.ai.projects.aio.operations.AgentsOperations :ivar evaluation_rules: EvaluationRulesOperations operations diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_realtime.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_realtime.py index 32cd43b7139a..30de012a803f 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_realtime.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_realtime.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- """Asynchronous Realtime voice-agent client. -Use ``async with client.beta.voice_agents.realtime.connect(...)`` to open a session. +Use ``async with client.voice_agents.realtime.connect(...)`` to open a session. Send text or audio through the connection and use ``async for`` to receive events. Known events use SDK models; unknown event types are returned as dictionaries. Install ``azure-ai-projects[voice]`` for the optional WebSocket dependencies. @@ -47,7 +47,7 @@ _LOGGER = logging.getLogger("azure.ai.projects.realtime") -# Voice-agent WebSocket requests need the same preview header as REST requests. +# Preview voice features use the same opt-in for WebSocket and REST requests. _VOICE_AGENT_FEATURE_HEADER: str = _AgentDefinitionOptInKeys.VOICE_AGENTS_V1_PREVIEW.value # The WebSocket handshake does not use the HTTP pipeline, so identify the SDK explicitly. @@ -720,7 +720,7 @@ class AsyncBetaRealtimeConnection( # pylint: disable=too-many-instance-attribut Iterate to receive events. Use ``conversation``, ``response``, and the audio buffers to send messages and control replies:: - async with client.beta.voice_agents.realtime.connect(agent_name="my-agent") as conn: + async with client.voice_agents.realtime.connect(agent_name="my-agent") as conn: await conn.input_audio_buffer.append(audio=chunk) await conn.input_audio_buffer.commit() await conn.response.create() @@ -801,6 +801,7 @@ class _BaseWebSocketConnectionManager(Generic[_ConnectionT]): # pylint: disable :paramtype credential_scopes: list[str] :keyword str api_version: The API version for the handshake. :keyword str agent_name: The name of the voice agent. + :keyword bool allow_preview: Enable preview voice features. Default is False. :keyword agent_session_id: An optional session correlation identifier. :paramtype agent_session_id: str or None :keyword transport: The optional Realtime connection transport. @@ -818,6 +819,7 @@ class _BaseWebSocketConnectionManager(Generic[_ConnectionT]): # pylint: disable _logger = _LOGGER _subprotocol: Optional[str] = "realtime" _protocol_name = "realtime" + _requires_preview = False def __init__( # pylint: disable=too-many-arguments self, @@ -827,6 +829,7 @@ def __init__( # pylint: disable=too-many-arguments credential_scopes: List[str], api_version: str, agent_name: str, + allow_preview: bool = False, agent_session_id: Optional[str] = None, transport: Optional[Union[str, "_models.VoiceAgentTransport"]] = None, structured_inputs: Optional[Mapping[str, Any]] = None, @@ -840,6 +843,7 @@ def __init__( # pylint: disable=too-many-arguments self._credential_scopes = credential_scopes self._api_version = api_version self._agent_name = agent_name + self._allow_preview = allow_preview self._agent_session_id = agent_session_id self._transport = _normalize_transport(transport) self._structured_inputs = structured_inputs @@ -892,9 +896,12 @@ async def enter(self) -> _ConnectionT: # pylint: disable=too-many-locals token = await self._credential.get_token(*self._credential_scopes) headers: Dict[str, str] = { "Authorization": "Bearer " + token.token, - _FOUNDRY_FEATURES_HEADER_NAME: _VOICE_AGENT_FEATURE_HEADER, } headers.update(self._extra_headers) + if (self._requires_preview or self._allow_preview) and not _has_header_case_insensitive( + headers, _FOUNDRY_FEATURES_HEADER_NAME + ): + headers[_FOUNDRY_FEATURES_HEADER_NAME] = _VOICE_AGENT_FEATURE_HEADER if not _has_header_case_insensitive(headers, "User-Agent"): # Header names are case-insensitive; preserve caller overrides in any casing. headers["User-Agent"] = _USER_AGENT @@ -955,7 +962,7 @@ class AsyncBetaRealtimeConnectionManager(_BaseWebSocketConnectionManager[AsyncBe """Async context manager that opens an :class:`AsyncBetaRealtimeConnection`. Returned by :meth:`AsyncBetaRealtime.connect`; you normally use it as - ``async with client.beta.voice_agents.realtime.connect(...) as conn:``. + ``async with client.voice_agents.realtime.connect(...) as conn:``. :keyword str endpoint: The Foundry project endpoint. :keyword credential: The credential used for the WebSocket handshake. @@ -1000,7 +1007,7 @@ def _create_connection( class AsyncBetaRealtime: # pylint: disable=too-few-public-methods - """Connect to a voice agent through ``client.beta.voice_agents.realtime``. + """Connect to a voice agent through ``client.voice_agents.realtime``. Open a connection with :meth:`connect`:: @@ -1008,7 +1015,7 @@ class AsyncBetaRealtime: # pylint: disable=too-few-public-methods from azure.identity.aio import DefaultAzureCredential client = AIProjectClient(endpoint, DefaultAzureCredential()) - async with client.beta.voice_agents.realtime.connect(agent_name="my-agent") as conn: + async with client.voice_agents.realtime.connect(agent_name="my-agent") as conn: await conn.input_audio_buffer.append(audio=chunk) await conn.input_audio_buffer.commit() await conn.response.create() @@ -1017,7 +1024,7 @@ class AsyncBetaRealtime: # pylint: disable=too-few-public-methods break :param client: The voice-agent client that supplies the project endpoint and credential. - :type client: ~azure.ai.projects.aio.operations.BetaVoiceAgentsOperations + :type client: ~azure.ai.projects.aio.operations.VoiceAgentsOperations """ def __init__(self, *args: Any, **kwargs: Any) -> None: @@ -1062,9 +1069,9 @@ def connect( # pylint: disable=too-many-arguments :paramtype credential_scopes: list[str] or None :keyword extra_query: Additional query-string parameters for the handshake. :paramtype extra_query: Mapping[str, str] or None - :keyword extra_headers: Additional headers for the handshake. Pass - ``{"Foundry-Features": "..."}`` here to override the ``VoiceAgents=V1Preview`` value - this method always sends by default. + :keyword extra_headers: Additional headers for the handshake. Preview voice features + require ``allow_preview=True`` on the project client or an explicit + ``{"Foundry-Features": "VoiceAgents=V1Preview"}`` header. GA voice sessions need no opt-in. :paramtype extra_headers: Mapping[str, str] or None :return: An async context manager yielding an :class:`AsyncBetaRealtimeConnection`. :rtype: ~azure.ai.projects.aio.AsyncBetaRealtimeConnectionManager @@ -1076,6 +1083,7 @@ def connect( # pylint: disable=too-many-arguments credential_scopes=credential_scopes or self._config.credential_scopes, api_version=api_version or self._config.api_version, agent_name=agent_name, + allow_preview=bool(self._config.allow_preview), agent_session_id=agent_session_id, transport=transport, structured_inputs=structured_inputs, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py index ae40253e5f4f..ae5464699212 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py @@ -13,6 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import BetaOperations # type: ignore +from ._operations import VoiceAgentsOperations # type: ignore from ._operations import AgentsOperations # type: ignore from ._operations import EvaluationRulesOperations # type: ignore from ._operations import DatasetsOperations # type: ignore @@ -28,6 +29,7 @@ __all__ = [ "BetaOperations", + "VoiceAgentsOperations", "AgentsOperations", "EvaluationRulesOperations", "DatasetsOperations", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 7d6532c59514..2639bf4cc4c8 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -40,6 +40,7 @@ from ..._utils.utils import prepare_multipart_form_data from ...operations._operations import ( build_agents_cancel_optimization_job_request, + build_agents_create_from_prompt_request, build_agents_create_optimization_job_request, build_agents_create_session_request, build_agents_create_version_from_code_request, @@ -87,7 +88,6 @@ build_beta_agent_insight_monitors_reset_request, build_beta_agent_insight_monitors_update_insight_request, build_beta_agent_insight_monitors_update_request, - build_beta_agents_create_from_prompt_request, build_beta_evaluation_taxonomies_create_request, build_beta_evaluation_taxonomies_delete_request, build_beta_evaluation_taxonomies_get_request, @@ -147,27 +147,6 @@ build_beta_skills_list_request, build_beta_skills_list_versions_request, build_beta_skills_update_request, - build_beta_voice_agents_campaigns_cancel_request, - build_beta_voice_agents_campaigns_create_request, - build_beta_voice_agents_campaigns_delete_request, - build_beta_voice_agents_campaigns_get_operation_request, - build_beta_voice_agents_campaigns_get_request, - build_beta_voice_agents_campaigns_list_request, - build_beta_voice_agents_campaigns_list_validation_errors_request, - build_beta_voice_agents_conversations_delete_request, - build_beta_voice_agents_conversations_download_audio_item_request, - build_beta_voice_agents_conversations_download_audio_request, - build_beta_voice_agents_conversations_download_generated_audio_item_request, - build_beta_voice_agents_conversations_get_audio_item_request, - build_beta_voice_agents_conversations_get_audio_request, - build_beta_voice_agents_conversations_get_generated_audio_item_request, - build_beta_voice_agents_conversations_get_item_request, - build_beta_voice_agents_conversations_get_request, - build_beta_voice_agents_conversations_get_response_request, - build_beta_voice_agents_conversations_list_items_request, - build_beta_voice_agents_conversations_list_request, - build_beta_voice_agents_conversations_list_response_items_request, - build_beta_voice_agents_conversations_list_responses_request, build_beta_voice_agents_live_conversations_delete_request, build_beta_voice_agents_live_conversations_download_audio_item_request, build_beta_voice_agents_live_conversations_download_audio_request, @@ -177,22 +156,13 @@ build_beta_voice_agents_live_conversations_get_request, build_beta_voice_agents_live_conversations_list_items_request, build_beta_voice_agents_live_conversations_list_request, - build_beta_voice_agents_telephony_cancel_call_job_request, - build_beta_voice_agents_telephony_create_binding_request, - build_beta_voice_agents_telephony_create_call_job_request, - build_beta_voice_agents_telephony_delete_binding_request, - build_beta_voice_agents_telephony_delete_call_job_request, - build_beta_voice_agents_telephony_end_call_request, - build_beta_voice_agents_telephony_get_binding_request, - build_beta_voice_agents_telephony_get_call_job_request, - build_beta_voice_agents_telephony_get_call_request, - build_beta_voice_agents_telephony_get_transfer_targets_request, - build_beta_voice_agents_telephony_list_bindings_request, - build_beta_voice_agents_telephony_list_call_jobs_request, - build_beta_voice_agents_telephony_list_calls_request, - build_beta_voice_agents_telephony_replace_transfer_targets_request, - build_beta_voice_agents_telephony_transfer_call_request, - build_beta_voice_agents_telephony_update_binding_request, + build_beta_voice_agents_telephony_cancel_request, + build_beta_voice_agents_telephony_create_request, + build_beta_voice_agents_telephony_delete_request, + build_beta_voice_agents_telephony_get_operation_request, + build_beta_voice_agents_telephony_get_request, + build_beta_voice_agents_telephony_list_request, + build_beta_voice_agents_telephony_list_validation_errors_request, build_connections_get_request, build_connections_get_with_credentials_request, build_connections_list_request, @@ -239,6 +209,36 @@ build_toolboxes_list_request, build_toolboxes_list_versions_request, build_toolboxes_update_request, + build_voice_agents_conversations_delete_request, + build_voice_agents_conversations_download_audio_item_request, + build_voice_agents_conversations_download_audio_request, + build_voice_agents_conversations_download_generated_audio_item_request, + build_voice_agents_conversations_get_audio_item_request, + build_voice_agents_conversations_get_audio_request, + build_voice_agents_conversations_get_generated_audio_item_request, + build_voice_agents_conversations_get_item_request, + build_voice_agents_conversations_get_request, + build_voice_agents_conversations_get_response_request, + build_voice_agents_conversations_list_items_request, + build_voice_agents_conversations_list_request, + build_voice_agents_conversations_list_response_items_request, + build_voice_agents_conversations_list_responses_request, + build_voice_agents_telephony_cancel_call_job_request, + build_voice_agents_telephony_create_binding_request, + build_voice_agents_telephony_create_call_job_request, + build_voice_agents_telephony_delete_binding_request, + build_voice_agents_telephony_delete_call_job_request, + build_voice_agents_telephony_end_call_request, + build_voice_agents_telephony_get_binding_request, + build_voice_agents_telephony_get_call_job_request, + build_voice_agents_telephony_get_call_request, + build_voice_agents_telephony_get_transfer_targets_request, + build_voice_agents_telephony_list_bindings_request, + build_voice_agents_telephony_list_call_jobs_request, + build_voice_agents_telephony_list_calls_request, + build_voice_agents_telephony_replace_transfer_targets_request, + build_voice_agents_telephony_transfer_call_request, + build_voice_agents_telephony_update_binding_request, ) from .._configuration import AIProjectClientConfiguration @@ -269,7 +269,6 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self.voice_agents = BetaVoiceAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.agent_insight_monitors = BetaAgentInsightMonitorsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -286,6 +285,29 @@ def __init__(self, *args, **kwargs) -> None: self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) +class VoiceAgentsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`voice_agents` 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: AIProjectClientConfiguration = 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") + + self.conversations = VoiceAgentsConversationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.telephony = VoiceAgentsTelephonyOperations(self._client, self._config, self._serialize, self._deserialize) + + class AgentsOperations: # pylint: disable=docstring-missing-param,too-many-public-methods """ .. warning:: @@ -370,6 +392,79 @@ async def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: return deserialized # type: ignore + @distributed_trace_async + async def create_from_prompt(self, body: "_unions.GenerateAgentRequest", **kwargs: Any) -> _models.AgentDetails: + """Generate an agent. + + Generates and creates an agent from kind-specific high-level inputs. The generated definition + remains fully editable through the standard agent versioning operations. + + :param body: The kind-specific inputs for generating and creating an agent. Is one of the + following types: GenerateVoiceAgentRequest Required. + :type body: ~azure.ai.projects.models.GenerateVoiceAgentRequest + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_create_from_prompt_request( + content_type=content_type, + api_version=self._config.api_version, + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace_async async def delete( self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any @@ -9001,109 +9096,12 @@ def __init__(self, *args, **kwargs) -> None: 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") - self.conversations = BetaVoiceAgentsConversationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.live_conversations = BetaVoiceAgentsLiveConversationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.telephony = BetaVoiceAgentsTelephonyOperations( self._client, self._config, self._serialize, self._deserialize ) - self.campaigns = BetaVoiceAgentsCampaignsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class BetaAgentsOperations: # pylint: disable=docstring-missing-param - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`agents` 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: AIProjectClientConfiguration = 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") - - @distributed_trace_async - async def create_from_prompt(self, body: "_unions.GenerateAgentRequest", **kwargs: Any) -> _models.AgentDetails: - """Generate an agent. - - Generates and creates an agent from kind-specific high-level inputs. The generated definition - remains fully editable through the standard agent versioning operations. - - :param body: The kind-specific inputs for generating and creating an agent. Is one of the - following types: GenerateVoiceAgentRequest Required. - :type body: ~azure.ai.projects.models.GenerateVoiceAgentRequest - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) - - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_agents_create_from_prompt_request( - content_type=content_type, - api_version=self._config.api_version, - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentDetails, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore class BetaAgentInsightMonitorsOperations: # pylint: disable=docstring-missing-param @@ -17250,7 +17248,7 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model return deserialized # type: ignore -class BetaVoiceAgentsConversationsOperations: # pylint: disable=docstring-missing-param +class VoiceAgentsConversationsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -17318,7 +17316,7 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_request( + _request = build_voice_agents_conversations_list_request( agent_name=agent_name, limit=limit, order=order, @@ -17393,7 +17391,7 @@ async def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo cls: ClsType[_models.VoiceConversation] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_request( + _request = build_voice_agents_conversations_get_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -17464,7 +17462,7 @@ async def delete(self, agent_name: str, conversation_id: str, **kwargs: Any) -> cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_delete_request( + _request = build_voice_agents_conversations_delete_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -17549,7 +17547,7 @@ def list_responses( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_responses_request( + _request = build_voice_agents_conversations_list_responses_request( agent_name=agent_name, conversation_id=conversation_id, limit=limit, @@ -17630,7 +17628,7 @@ async def get_response( cls: ClsType[_models.VoiceResponse] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_response_request( + _request = build_voice_agents_conversations_get_response_request( agent_name=agent_name, conversation_id=conversation_id, response_id=response_id, @@ -17733,7 +17731,7 @@ def list_response_items( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_response_items_request( + _request = build_voice_agents_conversations_list_response_items_request( agent_name=agent_name, conversation_id=conversation_id, response_id=response_id, @@ -17837,7 +17835,7 @@ def list_items( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_items_request( + _request = build_voice_agents_conversations_list_items_request( agent_name=agent_name, conversation_id=conversation_id, limit=limit, @@ -17921,7 +17919,7 @@ async def get_item( cls: ClsType[_models.RealtimeConversationItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_item_request( + _request = build_voice_agents_conversations_get_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -18002,7 +18000,7 @@ async def get_audio_item( cls: ClsType[_models.VoiceAudioItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_audio_item_request( + _request = build_voice_agents_conversations_get_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -18082,7 +18080,7 @@ async def download_audio_item( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_download_audio_item_request( + _request = build_voice_agents_conversations_download_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -18162,7 +18160,7 @@ async def get_generated_audio_item( cls: ClsType[_models.VoiceGeneratedAudioItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_generated_audio_item_request( + _request = build_voice_agents_conversations_get_generated_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -18243,7 +18241,7 @@ async def download_generated_audio_item( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_download_generated_audio_item_request( + _request = build_voice_agents_conversations_download_generated_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -18326,7 +18324,7 @@ async def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) cls: ClsType[_models.VoiceRecording] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_audio_request( + _request = build_voice_agents_conversations_get_audio_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -18406,7 +18404,7 @@ async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_download_audio_request( + _request = build_voice_agents_conversations_download_audio_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -18450,14 +18448,14 @@ async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: return deserialized # type: ignore -class BetaVoiceAgentsLiveConversationsOperations: # pylint: disable=docstring-missing-param,name-too-long +class VoiceAgentsTelephonyOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`live_conversations` attribute. + :attr:`telephony` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -18467,117 +18465,90 @@ def __init__(self, *args, **kwargs) -> None: 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") - @distributed_trace - def list( + @overload + async def create_binding( self, agent_name: str, + binding: _models.TelephonyBinding, *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.VoiceAgentLiveConversation"]: - """List Live voice agent conversations. + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - Lists stored Live conversations for this agent, including sessions stored via an override. + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: 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.projects.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 VoiceAgentLiveConversation - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversation] + :param binding: The provider-specific binding to create. Required. + :type binding: ~azure.ai.projects.models.TelephonyBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VoiceAgentLiveConversation]] = kwargs.pop("cls", None) + @overload + async def create_binding( + self, agent_name: str, binding: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - def prepare_request(_continuation_token=None): + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding: The provider-specific binding to create. Required. + :type binding: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ - _request = build_beta_voice_agents_live_conversations_list_request( - agent_name=agent_name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - 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 = _deserialize( - List[_models.VoiceAgentLiveConversation], - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + @overload + async def create_binding( + self, agent_name: str, binding: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - return pipeline_response + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - return AsyncItemPaged(get_next, extract_data) + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding: The provider-specific binding to create. Required. + :type binding: 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: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceAgentLiveConversation: - """Get a Live voice agent conversation. + async def create_binding( + self, agent_name: str, binding: Union[_models.TelephonyBinding, JSON, IO[bytes]], **kwargs: Any + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - Gets a stored Live conversation; fetch items separately. Returns 404 if absent or not stored. + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: VoiceAgentLiveConversation. The VoiceAgentLiveConversation is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversation + :param binding: The provider-specific binding to create. Is one of the following types: + TelephonyBinding, JSON, IO[bytes] Required. + :type binding: ~azure.ai.projects.models.TelephonyBinding or JSON or IO[bytes] + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18588,15 +18559,24 @@ async def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VoiceAgentLiveConversation] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(binding, (IOBase, bytes)): + _content = binding + else: + _content = json.dumps(binding, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_voice_agents_telephony_create_binding_request( agent_name=agent_name, - conversation_id=conversation_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -18613,7 +18593,7 @@ async def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -18626,95 +18606,39 @@ async def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.VoiceAgentLiveConversation, response.json()) + deserialized = _deserialize(_models.TelephonyBinding, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def delete(self, agent_name: str, conversation_id: str, **kwargs: Any) -> None: - """Delete a Live voice agent conversation. - - Deletes the stored conversation and its items/audio, without closing the Live session. - - :param agent_name: The name of the Live voice agent. Required. - :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[None] = kwargs.pop("cls", None) - - _request = build_beta_voice_agents_live_conversations_delete_request( - agent_name=agent_name, - conversation_id=conversation_id, - api_version=self._config.api_version, - 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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def list_items( + def list_bindings( self, agent_name: str, - conversation_id: str, *, + provider: Optional[Union[str, _models.TelephonyProvider]] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.VoiceAgentLiveConversationItem"]: - """List items in a Live voice agent conversation. + ) -> AsyncItemPaged["_models.TelephonyBindingListItem"]: + """List agent telephony bindings. - Lists stored speech and delegation items in order; cursors use item IDs. Returns 404 if the - conversation is absent or not stored. + Returns the telephony bindings owned by the voice agent named in the path. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent whose bindings are listed. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str + :keyword provider: Filters bindings by provider. Known values are: "teams_phone_extensibility", + "twilio", and "sip". Default value is None. + :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider :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. @@ -18729,15 +18653,15 @@ def list_items( 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 VoiceAgentLiveConversationItem + :return: An iterator like instance of TelephonyBindingListItem :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversationItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.TelephonyBindingListItem] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VoiceAgentLiveConversationItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TelephonyBindingListItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18749,9 +18673,9 @@ def list_items( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_live_conversations_list_items_request( + _request = build_voice_agents_telephony_list_bindings_request( agent_name=agent_name, - conversation_id=conversation_id, + provider=provider, limit=limit, order=order, after=_continuation_token, @@ -18769,7 +18693,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.VoiceAgentLiveConversationItem], + List[_models.TelephonyBindingListItem], deserialized.get("data", []), ) if cls: @@ -18798,23 +18722,17 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_item( - self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any - ) -> _models.VoiceAgentLiveConversationItem: - """Get a Live voice agent conversation item. + async def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _models.TelephonyBinding: + """Get an agent telephony binding. - Gets a stored item by ID. Returns 404 if the item or conversation is absent. + Retrieves a telephony binding owned by the voice agent named in the path. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :param item_id: The id returned on the persisted item. Required. - :type item_id: str - :return: VoiceAgentLiveConversationItem. The VoiceAgentLiveConversationItem is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversationItem + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18828,12 +18746,11 @@ async def get_item( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VoiceAgentLiveConversationItem] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_get_item_request( + _request = build_voice_agents_telephony_get_binding_request( agent_name=agent_name, - conversation_id=conversation_id, - item_id=item_id, + binding_id=binding_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -18864,111 +18781,153 @@ async def get_item( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.VoiceAgentLiveConversationItem, response.json()) + deserialized = _deserialize(_models.TelephonyBinding, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def get_audio_item( - self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any - ) -> _models.VoiceAudioItem: - """Get a Live conversation item's audio metadata. + @overload + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: _models.UpdateTelephonyBindingRequest, + *, + etag: str, + match_condition: MatchConditions, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - Gets captured speech-audio metadata. BYOS uses unsigned blob_uri. Returns 404 for missing - audio, conversations not stored, or delegation items. + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :param item_id: The id returned on the persisted item. Required. - :type item_id: str - :return: VoiceAudioItem. The VoiceAudioItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.VoiceAudioItem + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Required. + :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ - 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[_models.VoiceAudioItem] = kwargs.pop("cls", None) - - _request = build_beta_voice_agents_live_conversations_get_audio_item_request( - agent_name=agent_name, - conversation_id=conversation_id, - item_id=item_id, - api_version=self._config.api_version, - 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 - ) + @overload + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: JSON, + *, + etag: str, + match_condition: MatchConditions, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - response = pipeline_response.http_response + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Required. + :type body: JSON + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.VoiceAudioItem, response.json()) + @overload + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: IO[bytes], + *, + etag: str, + match_condition: MatchConditions, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - return deserialized # type: ignore + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Required. + :type body: IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def download_audio_item( - self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Stream a Live conversation item's audio. + async def update_binding( + self, + agent_name: str, + binding_id: str, + body: Union[_models.UpdateTelephonyBindingRequest, JSON, IO[bytes]], + *, + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - Streams captured speech as WAV. BYOS returns 409; use blob_uri. Returns 404 for missing audio, - conversations not stored, or delegation items. + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :param item_id: The id returned on the persisted item. Required. - :type item_id: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Is one of the following types: + UpdateTelephonyBindingRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18977,18 +18936,35 @@ async def download_audio_item( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_download_audio_item_request( + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_voice_agents_telephony_update_binding_request( agent_name=agent_name, - conversation_id=conversation_id, - item_id=item_id, + binding_id=binding_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -18998,7 +18974,7 @@ async def download_audio_item( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -19019,9 +18995,12 @@ async def download_audio_item( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyBinding, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -19029,20 +19008,24 @@ async def download_audio_item( return deserialized # type: ignore @distributed_trace_async - async def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceRecording: - """Get a Live conversation's merged recording metadata. + async def delete_binding( + self, agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any + ) -> None: + """Delete an agent telephony binding. - Gets merged stereo recording metadata (user left, assistant right). BYOS uses unsigned - blob_uri. Returns 404 for no audio, or 409 recording_not_ready/recording_unavailable for - pending/failed finalization; pending responses may include Retry-After. + Deletes a telephony binding owned by the voice agent named in the path. Deleting a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: VoiceRecording. The VoiceRecording is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.VoiceRecording + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19051,16 +19034,24 @@ async def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VoiceRecording] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_get_audio_request( + _request = build_voice_agents_telephony_delete_binding_request( agent_name=agent_name, - conversation_id=conversation_id, + binding_id=binding_id, + etag=etag, + match_condition=match_condition, api_version=self._config.api_version, headers=_headers, params=_params, @@ -19070,20 +19061,14 @@ async def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -19091,30 +19076,137 @@ async def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.VoiceRecording, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> AsyncIterator[bytes]: - """Stream a Live conversation's merged recording. + return cls(pipeline_response, None, {}) # type: ignore - Streams the merged stereo WAV. BYOS returns 409; use blob_uri. Returns 404 for no audio, or 409 - recording_not_ready/recording_unavailable for pending/failed finalization. + @distributed_trace + def list_calls( + self, + agent_name: str, + *, + provider: Optional[Union[str, _models.TelephonyProvider]] = None, + status: Optional[Union[str, _models.TelephonyCallStatus]] = None, + started_after_time: Optional[datetime.datetime] = None, + started_before_time: Optional[datetime.datetime] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.TelephonyCallSummary"]: + """List agent telephony calls. - :param agent_name: The name of the Live voice agent. Required. + Returns the durable inbound call history for the voice agent named in the path. + + :param agent_name: The name of the voice agent whose calls are listed. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :keyword provider: Filters calls by provider. Known values are: "teams_phone_extensibility", + "twilio", and "sip". Default value is None. + :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider + :keyword status: Filters calls by lifecycle status. Known values are: "in_progress", "success", + and "failed". Default value is None. + :paramtype status: str or ~azure.ai.projects.models.TelephonyCallStatus + :keyword started_after_time: Includes calls that started at or after this Unix timestamp in + seconds. Default value is None. + :paramtype started_after_time: ~datetime.datetime + :keyword started_before_time: Includes calls that started at or before this Unix timestamp in + seconds. Default value is None. + :paramtype started_before_time: ~datetime.datetime + :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.projects.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 TelephonyCallSummary + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.TelephonyCallSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TelephonyCallSummary]] = 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_voice_agents_telephony_list_calls_request( + agent_name=agent_name, + provider=provider, + status=status, + started_after_time=started_after_time, + started_before_time=started_before_time, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + 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 = _deserialize( + List[_models.TelephonyCallSummary], + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: + """Get an agent telephony call. + + Retrieves a durable inbound call record owned by the voice agent named in the path. + + :param agent_name: The name of the voice agent that owns the call record. Required. + :type agent_name: str + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19128,11 +19220,11 @@ async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_download_audio_request( + _request = build_voice_agents_telephony_get_call_request( agent_name=agent_name, - conversation_id=conversation_id, + call_id=call_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -19143,7 +19235,7 @@ async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -19163,114 +19255,110 @@ async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class BetaVoiceAgentsTelephonyOperations: # pylint: disable=docstring-missing-param - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`telephony` 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: AIProjectClientConfiguration = 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_binding( - self, - agent_name: str, - binding: _models.TelephonyBinding, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + async def transfer_call( + self, agent_name: str, call_id: str, *, target: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Required. - :type binding: ~azure.ai.projects.models.TelephonyBinding + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :keyword target: The name of a transfer target configured for the voice agent. Required. + :paramtype target: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_binding( - self, agent_name: str, binding: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + async def transfer_call( + self, agent_name: str, call_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Required. - :type binding: JSON + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :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: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_binding( - self, agent_name: str, binding: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + async def transfer_call( + self, agent_name: str, call_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Required. - :type binding: IO[bytes] + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :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: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_binding( - self, agent_name: str, binding: Union[_models.TelephonyBinding, JSON, IO[bytes]], **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + async def transfer_call( + self, + agent_name: str, + call_id: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + target: str = _Unset, + **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Is one of the following types: - TelephonyBinding, JSON, IO[bytes] Required. - :type binding: ~azure.ai.projects.models.TelephonyBinding or JSON or IO[bytes] - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword target: The name of a transfer target configured for the voice agent. Required. + :paramtype target: str + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19285,17 +19373,23 @@ async def create_binding( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) + if body is _Unset: + if target is _Unset: + raise TypeError("missing required argument: target") + body = {"target": target} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(binding, (IOBase, bytes)): - _content = binding + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(binding, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_voice_agents_telephony_create_binding_request( + _request = build_voice_agents_telephony_transfer_call_request( agent_name=agent_name, + call_id=call_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -19315,7 +19409,7 @@ async def create_binding( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -19328,63 +19422,31 @@ async def create_binding( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyBinding, response.json()) + deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_bindings( - self, - agent_name: str, - *, - provider: Optional[Union[str, _models.TelephonyProvider]] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.TelephonyBindingListItem"]: - """List agent telephony bindings. + @distributed_trace_async + async def end_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: + """End an active agent telephony call. - Returns the telephony bindings owned by the voice agent named in the path. + Ends an active inbound call owned by the voice agent named in the path. Ending a SIP call + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent whose bindings are listed. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :keyword provider: Filters bindings by provider. Known values are: "teams_phone_extensibility", - "twilio", and "sip". Default value is None. - :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider - :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.projects.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 TelephonyBindingListItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.TelephonyBindingListItem] + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TelephonyBindingListItem]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19393,68 +19455,65 @@ def list_bindings( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_beta_voice_agents_telephony_list_bindings_request( - agent_name=agent_name, - provider=provider, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - 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 + cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TelephonyBindingListItem], - 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) + _request = build_voice_agents_telephony_end_call_request( + agent_name=agent_name, + call_id=call_id, + api_version=self._config.api_version, + 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) - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + _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 + ) - _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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace_async - async def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _models.TelephonyBinding: - """Get an agent telephony binding. + async def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models.TelephonyTransferTargets: + """Get agent telephony transfer targets. - Retrieves a telephony binding owned by the voice agent named in the path. + Returns all transfer targets configured for the voice agent named in the path. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent whose transfer targets are retrieved. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19468,11 +19527,10 @@ async def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_binding_request( + _request = build_voice_agents_telephony_get_transfer_targets_request( agent_name=agent_name, - binding_id=binding_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -19509,7 +19567,7 @@ async def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyBinding, response.json()) + deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -19517,135 +19575,330 @@ async def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> return deserialized # type: ignore @overload - async def update_binding( + async def replace_transfer_targets( self, agent_name: str, - binding_id: str, - body: _models.UpdateTelephonyBindingRequest, *, + transfer_targets: List[_models.TelephonyTransferTarget], etag: str, match_condition: MatchConditions, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. - Updates a telephony binding owned by the voice agent named in the path. + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Required. - :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest + :keyword transfer_targets: The complete set of destinations to which the voice agent may + transfer calls. An empty array clears all targets when replacing the configuration. Required. + :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] :keyword etag: check if resource is changed. Set None to skip checking etag. Required. :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Required. :paramtype match_condition: ~azure.core.MatchConditions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update_binding( + async def replace_transfer_targets( self, agent_name: str, - binding_id: str, body: JSON, *, etag: str, match_condition: MatchConditions, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. - Updates a telephony binding owned by the voice agent named in the path. + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Required. + :param body: Required. :type body: JSON :keyword etag: check if resource is changed. Set None to skip checking etag. Required. :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Required. :paramtype match_condition: ~azure.core.MatchConditions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update_binding( + async def replace_transfer_targets( self, agent_name: str, - binding_id: str, body: IO[bytes], *, etag: str, match_condition: MatchConditions, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. + + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def replace_transfer_targets( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + transfer_targets: List[_models.TelephonyTransferTarget] = _Unset, + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. + + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword transfer_targets: The complete set of destinations to which the voice agent may + transfer calls. An empty array clears all targets when replacing the configuration. Required. + :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) + + if body is _Unset: + if transfer_targets is _Unset: + raise TypeError("missing required argument: transfer_targets") + body = {"transfer_targets": transfer_targets} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_voice_agents_telephony_replace_transfer_targets_request( + agent_name=agent_name, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_call_job( + self, + agent_name: str, + job: _models.TelephonyCallJobCreate, + *, + idempotency_key: str, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. + + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent that executes the call. Required. + :type agent_name: str + :param job: The direct outbound call to create. Required. + :type job: ~azure.ai.projects.models.TelephonyCallJobCreate + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_call_job( + self, agent_name: str, job: JSON, *, idempotency_key: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. + + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent that executes the call. Required. + :type agent_name: str + :param job: The direct outbound call to create. Required. + :type job: JSON + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_call_job( + self, + agent_name: str, + job: IO[bytes], + *, + idempotency_key: str, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. - Updates a telephony binding owned by the voice agent named in the path. + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that executes the call. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Required. - :type body: IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions + :param job: The direct outbound call to create. Required. + :type job: IO[bytes] + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update_binding( + async def create_call_job( self, agent_name: str, - binding_id: str, - body: Union[_models.UpdateTelephonyBindingRequest, JSON, IO[bytes]], + job: Union[_models.TelephonyCallJobCreate, JSON, IO[bytes]], *, - etag: str, - match_condition: MatchConditions, + idempotency_key: str, **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. - Updates a telephony binding owned by the voice agent named in the path. + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that executes the call. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Is one of the following types: - UpdateTelephonyBindingRequest, JSON, IO[bytes] Required. - :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :param job: The direct outbound call to create. Is one of the following types: + TelephonyCallJobCreate, JSON, IO[bytes] Required. + :type job: ~azure.ai.projects.models.TelephonyCallJobCreate or JSON or IO[bytes] + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19654,32 +19907,24 @@ async def update_binding( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError 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[_models.TelephonyBinding] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_voice_agents_telephony_update_binding_request( + _request = build_voice_agents_telephony_create_call_job_request( agent_name=agent_name, - binding_id=binding_id, - etag=etag, - match_condition=match_condition, + idempotency_key=idempotency_key, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -19699,7 +19944,7 @@ async def update_binding( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -19714,120 +19959,40 @@ async def update_binding( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("duration-seconds-int", response.headers.get("Retry-After")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyBinding, response.json()) + deserialized = _deserialize(_models.TelephonyCallJob, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def delete_binding( - self, agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any - ) -> None: - """Delete an agent telephony binding. - - Deletes a telephony binding owned by the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the binding. Required. - :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_voice_agents_telephony_delete_binding_request( - agent_name=agent_name, - binding_id=binding_id, - etag=etag, - match_condition=match_condition, - api_version=self._config.api_version, - 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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def list_calls( + def list_call_jobs( self, agent_name: str, *, - provider: Optional[Union[str, _models.TelephonyProvider]] = None, - status: Optional[Union[str, _models.TelephonyCallStatus]] = None, - started_after_time: Optional[datetime.datetime] = None, - started_before_time: Optional[datetime.datetime] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, + status: Optional[Union[str, _models.TelephonyCallJobStatus]] = None, + campaign_name: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.TelephonyCallSummary"]: - """List agent telephony calls. + ) -> AsyncItemPaged["_models.TelephonyCallJob"]: + """List outbound telephony call jobs. - Returns the durable inbound call history for the voice agent named in the path. + Lists current direct/Campaign jobs, excluding deleted or superseded rounds. Pages are live. + Campaign cursors survive boundary deletion/cancel, not replacement/name reuse (400 + invalid_cursor). - :param agent_name: The name of the voice agent whose calls are listed. Required. + :param agent_name: The owning voice agent. Authorization is applied before pagination. + Required. :type agent_name: str - :keyword provider: Filters calls by provider. Known values are: "teams_phone_extensibility", - "twilio", and "sip". Default value is None. - :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider - :keyword status: Filters calls by lifecycle status. Known values are: "in_progress", "success", - and "failed". Default value is None. - :paramtype status: str or ~azure.ai.projects.models.TelephonyCallStatus - :keyword started_after_time: Includes calls that started at or after this Unix timestamp in - seconds. Default value is None. - :paramtype started_after_time: ~datetime.datetime - :keyword started_before_time: Includes calls that started at or before this Unix timestamp in - seconds. Default value is None. - :paramtype started_before_time: ~datetime.datetime :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. @@ -19842,14 +20007,22 @@ def list_calls( 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 TelephonyCallSummary - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.TelephonyCallSummary] + :keyword status: Optional lifecycle filter. Known values are: "accepted", + "waiting_for_schedule", "queued", "dispatching", "in_progress", "waiting_for_retry", + "cancellation_requested", "completed", "blocked", "expired", "failed", and "cancelled". Default + value is None. + :paramtype status: str or ~azure.ai.projects.models.TelephonyCallJobStatus + :keyword campaign_name: Current Campaign round: 404 if absent, empty while deleting. Omit for + direct and Campaign jobs. Replacement/name reuse invalidates cursors. Default value is None. + :paramtype campaign_name: str + :return: An iterator like instance of TelephonyCallJob + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.TelephonyCallJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.TelephonyCallSummary]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TelephonyCallJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -19861,16 +20034,14 @@ def list_calls( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_telephony_list_calls_request( + _request = build_voice_agents_telephony_list_call_jobs_request( agent_name=agent_name, - provider=provider, - status=status, - started_after_time=started_after_time, - started_before_time=started_before_time, limit=limit, order=order, after=_continuation_token, before=before, + status=status, + campaign_name=campaign_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -19884,7 +20055,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.TelephonyCallSummary], + List[_models.TelephonyCallJob], deserialized.get("data", []), ) if cls: @@ -19910,20 +20081,79 @@ async def get_next(_continuation_token=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def delete_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> None: + """Delete an outbound telephony call job. + + Deletes a terminal, reconciled job (otherwise 409), without cancelling calls or removing + Campaign outcomes/call history. Later GET returns 404; repeated DELETE returns 204. Deleting a + SIP call job requires the ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The owning voice agent. Required. + :type agent_name: str + :param call_job_id: The call-job identifier. Required. + :type call_job_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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[None] = kwargs.pop("cls", None) + + _request = build_voice_agents_telephony_delete_call_job_request( + agent_name=agent_name, + call_job_id=call_job_id, + api_version=self._config.api_version, + 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) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: - """Get an agent telephony call. + async def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> _models.TelephonyCallJob: + """Get an outbound telephony call job. - Retrieves a durable inbound call record owned by the voice agent named in the path. + Retrieves a durable direct or campaign-created outbound call job. - :param agent_name: The name of the voice agent that owns the call record. Required. + :param agent_name: The name of the voice agent that owns the call job. Required. :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord + :param call_job_id: The service-generated identifier of the call job to retrieve. Required. + :type call_job_id: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19937,11 +20167,11 @@ async def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_call_request( + _request = build_voice_agents_telephony_get_call_job_request( agent_name=agent_name, - call_id=call_id, + call_job_id=call_job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -19972,106 +20202,39 @@ async def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _model ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) + deserialized = _deserialize(_models.TelephonyCallJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def transfer_call( - self, agent_name: str, call_id: str, *, target: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. - - Transfers an active inbound call to a configured target for the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the active call. Required. - :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :keyword target: The name of a transfer target configured for the voice agent. Required. - :paramtype target: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def transfer_call( - self, agent_name: str, call_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. - - Transfers an active inbound call to a configured target for the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the active call. Required. - :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :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: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def transfer_call( - self, agent_name: str, call_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. - - Transfers an active inbound call to a configured target for the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the active call. Required. - :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :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: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def transfer_call( - self, - agent_name: str, - call_id: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - target: str = _Unset, - **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. + async def cancel_call_job( + self, agent_name: str, call_job_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any + ) -> _models.TelephonyCallJob: + """Cancel an outbound telephony call job. - Transfers an active inbound call to a configured target for the voice agent named in the path. + Cancels future attempts using If-Match; completion may be asynchronous. New cancellation after + connection returns 409 and lets the active call finish. Cancelling a SIP call job requires the + ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the active call. Required. + :param agent_name: The name of the voice agent that owns the call job. Required. :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword target: The name of a transfer target configured for the voice agent. Required. - :paramtype target: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord + :param call_job_id: The service-generated identifier of the call job to cancel. Required. + :type call_job_id: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20080,32 +20243,25 @@ async def transfer_call( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) - - if body is _Unset: - if target is _Unset: - raise TypeError("missing required argument: target") - body = {"target": target} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_transfer_call_request( + _request = build_voice_agents_telephony_cancel_call_job_request( agent_name=agent_name, - call_id=call_id, - content_type=content_type, + call_job_id=call_job_id, + etag=etag, + match_condition=match_condition, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -20122,7 +20278,7 @@ async def transfer_call( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -20135,97 +20291,156 @@ async def transfer_call( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if response.status_code == 202: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize( + "duration-seconds-int", response.headers.get("Retry-After") + ) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) + deserialized = _deserialize(_models.TelephonyCallJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def end_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: - """End an active agent telephony call. - Ends an active inbound call owned by the voice agent named in the path. +class BetaVoiceAgentsLiveConversationsOperations: # pylint: disable=docstring-missing-param,name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. - :param agent_name: The name of the voice agent that owns the active call. Required. + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`live_conversations` 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: AIProjectClientConfiguration = 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") + + @distributed_trace + def list( + self, + agent_name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.VoiceAgentLiveConversation"]: + """List Live voice agent conversations. + + Lists stored Live conversations for this agent, including sessions stored via an override. + + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord + :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.projects.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 VoiceAgentLiveConversation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversation] :raises ~azure.core.exceptions.HttpResponseError: """ - 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[_models.TelephonyCallRecord] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VoiceAgentLiveConversation]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_end_call_request( - agent_name=agent_name, - call_id=call_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - _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 - ) + def prepare_request(_continuation_token=None): - response = pipeline_response.http_response + _request = build_beta_voice_agents_live_conversations_list_request( + agent_name=agent_name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + 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 - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.VoiceAgentLiveConversation], + deserialized.get("data", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models.TelephonyTransferTargets: - """Get agent telephony transfer targets. + async def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceAgentLiveConversation: + """Get a Live voice agent conversation. - Returns all transfer targets configured for the voice agent named in the path. + Gets a stored Live conversation; fetch items separately. Returns 404 if absent or not stored. - :param agent_name: The name of the voice agent whose transfer targets are retrieved. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: VoiceAgentLiveConversation. The VoiceAgentLiveConversation is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversation :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20239,10 +20454,11 @@ async def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) + cls: ClsType[_models.VoiceAgentLiveConversation] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_transfer_targets_request( + _request = build_beta_voice_agents_live_conversations_get_request( agent_name=agent_name, + conversation_id=conversation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20273,145 +20489,29 @@ async def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models. ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) + deserialized = _deserialize(_models.VoiceAgentLiveConversation, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def replace_transfer_targets( - self, - agent_name: str, - *, - transfer_targets: List[_models.TelephonyTransferTarget], - etag: str, - match_condition: MatchConditions, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. - - Replaces all transfer targets configured for the voice agent named in the path. - - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. - :type agent_name: str - :keyword transfer_targets: The complete set of destinations to which the voice agent may - transfer calls. An empty array clears all targets when replacing the configuration. Required. - :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def replace_transfer_targets( - self, - agent_name: str, - body: JSON, - *, - etag: str, - match_condition: MatchConditions, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. - - Replaces all transfer targets configured for the voice agent named in the path. - - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def replace_transfer_targets( - self, - agent_name: str, - body: IO[bytes], - *, - etag: str, - match_condition: MatchConditions, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. - - Replaces all transfer targets configured for the voice agent named in the path. - - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def replace_transfer_targets( - self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - transfer_targets: List[_models.TelephonyTransferTarget] = _Unset, - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. + async def delete(self, agent_name: str, conversation_id: str, **kwargs: Any) -> None: + """Delete a Live voice agent conversation. - Replaces all transfer targets configured for the voice agent named in the path. + Deletes the stored conversation and its items/audio, without closing the Live session. - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword transfer_targets: The complete set of destinations to which the voice agent may - transfer calls. An empty array clears all targets when replacing the configuration. Required. - :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20420,39 +20520,17 @@ async def replace_transfer_targets( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) - - if body is _Unset: - if transfer_targets is _Unset: - raise TypeError("missing required argument: transfer_targets") - body = {"transfer_targets": transfer_targets} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_replace_transfer_targets_request( + _request = build_beta_voice_agents_live_conversations_delete_request( agent_name=agent_name, - etag=etag, - match_condition=match_condition, - content_type=content_type, + conversation_id=conversation_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -20461,20 +20539,14 @@ async def replace_transfer_targets( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -20482,127 +20554,130 @@ async def replace_transfer_targets( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - @overload - async def create_call_job( + @distributed_trace + def list_items( self, agent_name: str, - job: _models.TelephonyCallJobCreate, + conversation_id: str, *, - idempotency_key: str, - content_type: str = "application/json", + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + ) -> AsyncItemPaged["_models.VoiceAgentLiveConversationItem"]: + """List items in a Live voice agent conversation. - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + Lists stored speech and delegation items in order; cursors use item IDs. Returns 404 if the + conversation is absent or not stored. - :param agent_name: The name of the voice agent that executes the call. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param job: The direct outbound call to create. Required. - :type job: ~azure.ai.projects.models.TelephonyCallJobCreate - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_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.projects.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 VoiceAgentLiveConversationItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversationItem] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def create_call_job( - self, agent_name: str, job: JSON, *, idempotency_key: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + cls: ClsType[List[_models.VoiceAgentLiveConversationItem]] = kwargs.pop("cls", None) - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param agent_name: The name of the voice agent that executes the call. Required. - :type agent_name: str - :param job: The direct outbound call to create. Required. - :type job: JSON - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(_continuation_token=None): - @overload - async def create_call_job( - self, - agent_name: str, - job: IO[bytes], - *, - idempotency_key: str, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + _request = build_beta_voice_agents_live_conversations_list_items_request( + agent_name=agent_name, + conversation_id=conversation_id, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + 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 - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.VoiceAgentLiveConversationItem], + 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) - :param agent_name: The name of the voice agent that executes the call. Required. - :type agent_name: str - :param job: The direct outbound call to create. Required. - :type job: IO[bytes] - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def create_call_job( - self, - agent_name: str, - job: Union[_models.TelephonyCallJobCreate, JSON, IO[bytes]], - *, - idempotency_key: str, - **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + async def get_item( + self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any + ) -> _models.VoiceAgentLiveConversationItem: + """Get a Live voice agent conversation item. - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + Gets a stored item by ID. Returns 404 if the item or conversation is absent. - :param agent_name: The name of the voice agent that executes the call. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param job: The direct outbound call to create. Is one of the following types: - TelephonyCallJobCreate, JSON, IO[bytes] Required. - :type job: ~azure.ai.projects.models.TelephonyCallJobCreate or JSON or IO[bytes] - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :param item_id: The id returned on the persisted item. Required. + :type item_id: str + :return: VoiceAgentLiveConversationItem. The VoiceAgentLiveConversationItem is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversationItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20613,25 +20688,16 @@ async def create_call_job( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(job, (IOBase, bytes)): - _content = job - else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.VoiceAgentLiveConversationItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_create_call_job_request( + _request = build_beta_voice_agents_live_conversations_get_item_request( agent_name=agent_name, - idempotency_key=idempotency_key, - content_type=content_type, + conversation_id=conversation_id, + item_id=item_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -20648,7 +20714,7 @@ async def create_call_job( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -20661,73 +20727,36 @@ async def create_call_job( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("duration-seconds-int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallJob, response.json()) + deserialized = _deserialize(_models.VoiceAgentLiveConversationItem, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_call_jobs( - self, - agent_name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - status: Optional[Union[str, _models.TelephonyCallJobStatus]] = None, - campaign_name: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.TelephonyCallJob"]: - """List outbound telephony call jobs. + @distributed_trace_async + async def get_audio_item( + self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any + ) -> _models.VoiceAudioItem: + """Get a Live conversation item's audio metadata. - Lists current direct/Campaign jobs, excluding deleted or superseded rounds. Pages are live. - Campaign cursors survive boundary deletion/cancel, not replacement/name reuse (400 - invalid_cursor). + Gets captured speech-audio metadata. BYOS uses unsigned blob_uri. Returns 404 for missing + audio, conversations not stored, or delegation items. - :param agent_name: The owning voice agent. Authorization is applied before pagination. - Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: 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.projects.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 status: Optional lifecycle filter. Known values are: "accepted", - "waiting_for_schedule", "queued", "dispatching", "in_progress", "waiting_for_retry", - "cancellation_requested", "completed", "blocked", "expired", "failed", and "cancelled". Default - value is None. - :paramtype status: str or ~azure.ai.projects.models.TelephonyCallJobStatus - :keyword campaign_name: Current Campaign round: 404 if absent, empty while deleting. Omit for - direct and Campaign jobs. Replacement/name reuse invalidates cursors. Default value is None. - :paramtype campaign_name: str - :return: An iterator like instance of TelephonyCallJob - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.TelephonyCallJob] + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :param item_id: The id returned on the persisted item. Required. + :type item_id: str + :return: VoiceAudioItem. The VoiceAudioItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.VoiceAudioItem :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TelephonyCallJob]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20736,70 +20765,73 @@ def list_call_jobs( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_beta_voice_agents_telephony_list_call_jobs_request( - agent_name=agent_name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - status=status, - campaign_name=campaign_name, - api_version=self._config.api_version, - 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 + cls: ClsType[_models.VoiceAudioItem] = kwargs.pop("cls", None) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TelephonyCallJob], - 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) + _request = build_beta_voice_agents_live_conversations_get_audio_item_request( + agent_name=agent_name, + conversation_id=conversation_id, + item_id=item_id, + api_version=self._config.api_version, + 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) - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + _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 + ) - _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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VoiceAudioItem, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace_async - async def delete_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> None: - """Delete an outbound telephony call job. + async def download_audio_item( + self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + """Stream a Live conversation item's audio. - Deletes a terminal, reconciled job (otherwise 409), without cancelling calls or removing - Campaign outcomes/call history. Later GET returns 404; repeated DELETE returns 204. + Streams captured speech as WAV. BYOS returns 409; use blob_uri. Returns 404 for missing audio, + conversations not stored, or delegation items. - :param agent_name: The owning voice agent. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_job_id: The call-job identifier. Required. - :type call_job_id: str - :return: None - :rtype: None + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :param item_id: The id returned on the persisted item. Required. + :type item_id: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20813,11 +20845,12 @@ async def delete_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_delete_call_job_request( + _request = build_beta_voice_agents_live_conversations_download_audio_item_request( agent_name=agent_name, - call_job_id=call_job_id, + conversation_id=conversation_id, + item_id=item_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20827,14 +20860,20 @@ async def delete_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) 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 [204]: + 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 = _failsafe_deserialize( _models.ApiErrorResponse, @@ -20842,21 +20881,31 @@ async def delete_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> _models.TelephonyCallJob: - """Get an outbound telephony call job. + async def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceRecording: + """Get a Live conversation's merged recording metadata. - Retrieves a durable direct or campaign-created outbound call job. + Gets merged stereo recording metadata (user left, assistant right). BYOS uses unsigned + blob_uri. Returns 404 for no audio, or 409 recording_not_ready/recording_unavailable for + pending/failed finalization; pending responses may include Retry-After. - :param agent_name: The name of the voice agent that owns the call job. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_job_id: The service-generated identifier of the call job to retrieve. Required. - :type call_job_id: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: VoiceRecording. The VoiceRecording is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.VoiceRecording :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20870,11 +20919,11 @@ async def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) + cls: ClsType[_models.VoiceRecording] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_call_job_request( + _request = build_beta_voice_agents_live_conversations_get_audio_request( agent_name=agent_name, - call_job_id=call_job_id, + conversation_id=conversation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20905,38 +20954,30 @@ async def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) - ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallJob, response.json()) + deserialized = _deserialize(_models.VoiceRecording, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def cancel_call_job( - self, agent_name: str, call_job_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any - ) -> _models.TelephonyCallJob: - """Cancel an outbound telephony call job. + async def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> AsyncIterator[bytes]: + """Stream a Live conversation's merged recording. - Cancels future attempts using If-Match; completion may be asynchronous. New cancellation after - connection returns 409 and lets the active call finish. + Streams the merged stereo WAV. BYOS returns 409; use blob_uri. Returns 404 for no audio, or 409 + recording_not_ready/recording_unavailable for pending/failed finalization. - :param agent_name: The name of the voice agent that owns the call job. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_job_id: The service-generated identifier of the call job to cancel. Required. - :type call_job_id: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20945,24 +20986,16 @@ async def cancel_call_job( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_cancel_call_job_request( + _request = build_beta_voice_agents_live_conversations_download_audio_request( agent_name=agent_name, - call_job_id=call_job_id, - etag=etag, - match_condition=match_condition, + conversation_id=conversation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -20973,14 +21006,14 @@ async def cancel_call_job( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) 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, 202]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -20994,20 +21027,9 @@ async def cancel_call_job( raise HttpResponseError(response=response, model=error) response_headers = {} - if response.status_code == 200: - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - - if response.status_code == 202: - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize( - "duration-seconds-int", response.headers.get("Retry-After") - ) + 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: - deserialized = _deserialize(_models.TelephonyCallJob, response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -21015,14 +21037,14 @@ async def cancel_call_job( return deserialized # type: ignore -class BetaVoiceAgentsCampaignsOperations: # pylint: disable=docstring-missing-param +class BetaVoiceAgentsTelephonyOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`campaigns` attribute. + :attr:`telephony` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -21070,7 +21092,7 @@ async def _create_initial( else: _content = json.dumps(campaign, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_voice_agents_campaigns_create_request( + _request = build_beta_voice_agents_telephony_create_request( agent_name=agent_name, campaign_name=campaign_name, operation_id=operation_id, @@ -21399,7 +21421,7 @@ async def get( cls: ClsType[_models.TelephonyCampaign] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_get_request( + _request = build_beta_voice_agents_telephony_get_request( agent_name=agent_name, campaign_name=campaign_name, operation_id=operation_id, @@ -21496,7 +21518,7 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_campaigns_list_request( + _request = build_beta_voice_agents_telephony_list_request( agent_name=agent_name, limit=limit, order=order, @@ -21573,7 +21595,7 @@ async def _cancel_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_cancel_request( + _request = build_beta_voice_agents_telephony_cancel_request( agent_name=agent_name, campaign_name=campaign_name, etag=etag, @@ -21744,7 +21766,7 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_delete_request( + _request = build_beta_voice_agents_telephony_delete_request( agent_name=agent_name, campaign_name=campaign_name, etag=etag, @@ -21928,7 +21950,7 @@ def list_validation_errors( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_campaigns_list_validation_errors_request( + _request = build_beta_voice_agents_telephony_list_validation_errors_request( agent_name=agent_name, campaign_name=campaign_name, limit=limit, @@ -22010,7 +22032,7 @@ async def get_operation( cls: ClsType[_models.TelephonyCampaignOperation] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_get_operation_request( + _request = build_beta_voice_agents_telephony_get_operation_request( agent_name=agent_name, campaign_name=campaign_name, operation_id=operation_id, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py index 3a9607548c11..28476dca0d07 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py @@ -9,7 +9,7 @@ """ from typing import Any, List -from ._patch_agents_async import AgentsOperations, BetaAgentsOperations +from ._patch_agents_async import AgentsOperations from ._patch_agent_insights_async import BetaAgentInsightMonitorsOperations from ._patch_datasets_async import DatasetsOperations from ._patch_evaluators_async import EvaluatorsOperations @@ -36,7 +36,7 @@ ) # Nested operation groups are re-exported here rather than in the generated package exports. -from ._patch_campaigns_async import BetaVoiceAgentsCampaignsOperations +from ._patch_campaigns_async import BetaVoiceAgentsTelephonyOperations from ._operations import ( BetaEvaluationTaxonomiesOperations, BetaInsightsOperations, @@ -45,13 +45,40 @@ BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaVoiceAgentsConversationsOperations, BetaVoiceAgentsLiveConversationsOperations, BetaVoiceAgentsOperations as GeneratedBetaVoiceAgentsOperations, - BetaVoiceAgentsTelephonyOperations, + VoiceAgentsConversationsOperations, + VoiceAgentsOperations as GeneratedVoiceAgentsOperations, + VoiceAgentsTelephonyOperations, ) +class VoiceAgentsOperations(GeneratedVoiceAgentsOperations): + """Generally available voice-agent operations. + + Access these operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s + ``voice_agents`` attribute. + """ + + conversations: VoiceAgentsConversationsOperations + """:class:`~azure.ai.projects.aio.operations.VoiceAgentsConversationsOperations` operations""" + telephony: VoiceAgentsTelephonyOperations + """:class:`~azure.ai.projects.aio.operations.VoiceAgentsTelephonyOperations` operations""" + realtime: AsyncBetaRealtime + """:class:`~azure.ai.projects.aio.operations.AsyncBetaRealtime` operations""" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + # WebSocket connections cannot be kept alive by the generated HTTP pipeline. + self.realtime = AsyncBetaRealtime(self) + if self._config.allow_preview: + setattr( + self, + "telephony", + _OperationMethodHeaderProxy(self.telephony, _BETA_OPERATION_FEATURE_HEADERS["voice_agents"]), + ) + + class BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): """ .. warning:: @@ -62,28 +89,18 @@ class BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): :attr:`~azure.ai.projects.aio.operations.BetaOperations.voice_agents` attribute. """ - campaigns: BetaVoiceAgentsCampaignsOperations - """:class:`~azure.ai.projects.aio.operations.BetaVoiceAgentsCampaignsOperations` operations""" - conversations: BetaVoiceAgentsConversationsOperations - """:class:`~azure.ai.projects.aio.operations.BetaVoiceAgentsConversationsOperations` operations""" - live_conversations: BetaVoiceAgentsLiveConversationsOperations - """:class:`~azure.ai.projects.aio.operations.BetaVoiceAgentsLiveConversationsOperations` operations""" telephony: BetaVoiceAgentsTelephonyOperations """:class:`~azure.ai.projects.aio.operations.BetaVoiceAgentsTelephonyOperations` operations""" - realtime: AsyncBetaRealtime - """:class:`~azure.ai.projects.aio.operations.AsyncBetaRealtime` operations""" + live_conversations: BetaVoiceAgentsLiveConversationsOperations + """:class:`~azure.ai.projects.aio.operations.BetaVoiceAgentsLiveConversationsOperations` operations""" live: AsyncBetaLive """:class:`~azure.ai.projects.aio.operations.AsyncBetaLive` operations""" def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.campaigns = BetaVoiceAgentsCampaignsOperations( + self.telephony = BetaVoiceAgentsTelephonyOperations( self._client, self._config, self._serialize, self._deserialize ) - # The generator does not emit realtime operations at all, since azure-core's HTTP - # pipeline has no way to keep a WebSocket upgrade's resulting socket alive. Add our - # hand-written client, which manages a real, long-lived connection, in its place. - self.realtime = AsyncBetaRealtime(self) self.live = AsyncBetaLive(self) @@ -97,8 +114,6 @@ class BetaOperations(GeneratedBetaOperations): :attr:`beta` attribute. """ - agents: BetaAgentsOperations - """:class:`~azure.ai.projects.aio.operations.BetaAgentsOperations` operations""" agent_insight_monitors: BetaAgentInsightMonitorsOperations """:class:`~azure.ai.projects.aio.operations.BetaAgentInsightMonitorsOperations` operations""" evaluation_taxonomies: BetaEvaluationTaxonomiesOperations @@ -122,8 +137,6 @@ class BetaOperations(GeneratedBetaOperations): def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - # Replace with patched class that returns AsyncAgentOptimizationLROPoller - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) # Replace with patched class that includes begin_update_memories self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) # Replace with patched class that includes create (3-step upload helper) @@ -154,7 +167,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "LiveClientEvent", "LiveServerEvent", "BetaAgentInsightMonitorsOperations", - "BetaAgentsOperations", "BetaEvaluationTaxonomiesOperations", "BetaInsightsOperations", "BetaMemoryStoresOperations", @@ -164,11 +176,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "BetaRoutinesOperations", "BetaSchedulesOperations", "BetaSkillsOperations", - "BetaVoiceAgentsCampaignsOperations", - "BetaVoiceAgentsConversationsOperations", + "BetaVoiceAgentsTelephonyOperations", "BetaVoiceAgentsLiveConversationsOperations", "BetaVoiceAgentsOperations", - "BetaVoiceAgentsTelephonyOperations", + "VoiceAgentsConversationsOperations", + "VoiceAgentsOperations", + "VoiceAgentsTelephonyOperations", "ClientEvent", "ConnectionsOperations", "ConversationItem", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 79544eb50730..35052f53c147 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -15,7 +15,6 @@ from azure.core.utils import case_insensitive_dict from ._operations import ( AgentsOperations as GeneratedAgentsOperations, - BetaAgentsOperations as BetaAgentsOperationsGenerated, JSON, _Unset, ) @@ -433,7 +432,3 @@ def get_long_running_output(pipeline_response): return AsyncAgentOptimizationLROPoller( # type: ignore self._client, raw_result, get_long_running_output, polling_method ) - - -class BetaAgentsOperations(BetaAgentsOperationsGenerated): - """Custom async operations for beta agents.""" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_campaigns_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_campaigns_async.py index fa2176bedb12..c2ec73a38979 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_campaigns_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_campaigns_async.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -"""Custom asynchronous Voice Agent campaign operations.""" +"""Async campaign LRO polling customizations for ``beta.voice_agents.telephony``.""" from collections.abc import MutableMapping from typing import Any, IO, Optional, Union, overload @@ -10,20 +10,20 @@ from azure.core import MatchConditions from azure.core.polling import AsyncLROPoller -from ._operations import BetaVoiceAgentsCampaignsOperations as GeneratedBetaVoiceAgentsCampaignsOperations +from ._operations import BetaVoiceAgentsTelephonyOperations as GeneratedBetaVoiceAgentsTelephonyOperations from ... import models as _models from ..._utils.campaign_polling import _configure_campaign_polling JSON = MutableMapping[str, Any] -class BetaVoiceAgentsCampaignsOperations(GeneratedBetaVoiceAgentsCampaignsOperations): +class BetaVoiceAgentsTelephonyOperations(GeneratedBetaVoiceAgentsTelephonyOperations): """ .. warning:: **DO NOT** instantiate this class directly. Instead, access these operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s ``beta.voice_agents.campaigns`` attribute. + :class:`~azure.ai.projects.aio.AIProjectClient`'s ``beta.voice_agents.telephony`` attribute. """ def _configure_polling(self, kwargs: dict[str, Any]) -> None: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py index 160e942193ca..b41679aac645 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py @@ -71,21 +71,21 @@ class A2AProtocolVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ActivityProtocolAccessBoundary(str, Enum, metaclass=CaseInsensitiveEnumMeta): """An access boundary for the activity protocol.""" - READ1_ON1_DEVELOPERS = "read.1on1.developers" + READ_1_ON1_DEVELOPERS = "read.1on1.developers" """Allows read access to one-on-one developer conversations.""" - READ1_ON1_MANAGER = "read.1on1.manager" + READ_1_ON1_MANAGER = "read.1on1.manager" """Allows read access to one-on-one manager conversations.""" - READ1_ON1_ALLOWLISTED = "read.1on1.allowlisted" + READ_1_ON1_ALLOWLISTED = "read.1on1.allowlisted" """Allows read access to allowlisted one-on-one conversations.""" - READ1_ON1_TENANT = "read.1on1.tenant" + READ_1_ON1_TENANT = "read.1on1.tenant" """Allows read access to tenant-wide one-on-one conversations.""" - WRITE1_ON1_DEVELOPERS = "write.1on1.developers" + WRITE_1_ON1_DEVELOPERS = "write.1on1.developers" """Allows write access to one-on-one developer conversations.""" - WRITE1_ON1_MANAGER = "write.1on1.manager" + WRITE_1_ON1_MANAGER = "write.1on1.manager" """Allows write access to one-on-one manager conversations.""" - WRITE1_ON1_ALLOWLISTED = "write.1on1.allowlisted" + WRITE_1_ON1_ALLOWLISTED = "write.1on1.allowlisted" """Allows write access to allowlisted one-on-one conversations.""" - WRITE1_ON1_TENANT = "write.1on1.tenant" + WRITE_1_ON1_TENANT = "write.1on1.tenant" """Allows write access to tenant-wide one-on-one conversations.""" READ_GROUP_DEVELOPERS = "read.group.developers" """Allows read access to developer group conversations.""" @@ -1418,8 +1418,8 @@ class ModelIdsLive(str, Enum, metaclass=CaseInsensitiveEnumMeta): URL query parameter. """ - GPT_LIVE1 = "gpt-live-1" - """GPT_LIVE1.""" + GPT_LIVE_1 = "gpt-live-1" + """GPT_LIVE_1.""" class OpenApiAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -2109,7 +2109,8 @@ class TelephonyAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A Microsoft Teams identity. Source addresses require a nonempty resource-account object GUID; transfer destinations also support 28:orgid:{guid}.""" SIP = "sip" - """A SIP or SIPS destination for transfer.""" + """A SIP or SIPS destination for transfer. SIP is in preview and requires the + ``VoiceAgents=V1Preview`` opt-in.""" class TelephonyCallDurationBasis(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -2541,7 +2542,8 @@ class TelephonyProvider(str, Enum, metaclass=CaseInsensitiveEnumMeta): TWILIO = "twilio" """Twilio Programmable Voice.""" SIP = "sip" - """Session Initiation Protocol.""" + """Session Initiation Protocol. SIP is in preview and requires the ``VoiceAgents=V1Preview`` + opt-in.""" class TextResponseFormatConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -2995,15 +2997,15 @@ class VoiceAgentInputTranscriptionModel(str, Enum, metaclass=CaseInsensitiveEnum added over time. """ - WHISPER1 = "whisper-1" + WHISPER_1 = "whisper-1" """OpenAI Whisper.""" GPT_REALTIME_WHISPER = "gpt-realtime-whisper" """OpenAI GPT Realtime Whisper.""" - GPT4_O_TRANSCRIBE = "gpt-4o-transcribe" + GPT_4_O_TRANSCRIBE = "gpt-4o-transcribe" """OpenAI GPT-4o transcribe.""" - GPT4_O_MINI_TRANSCRIBE = "gpt-4o-mini-transcribe" + GPT_4_O_MINI_TRANSCRIBE = "gpt-4o-mini-transcribe" """OpenAI GPT-4o mini transcribe.""" - GPT4_O_TRANSCRIBE_DIARIZE = "gpt-4o-transcribe-diarize" + GPT_4_O_TRANSCRIBE_DIARIZE = "gpt-4o-transcribe-diarize" """OpenAI GPT-4o transcribe with speaker diarization.""" GPT_TRANSCRIBE = "gpt-transcribe" """OpenAI GPT Transcribe.""" @@ -3126,8 +3128,7 @@ class VoiceAgentPostCallIncludeOption(str, Enum, metaclass=CaseInsensitiveEnumMe """Content that can be included in a post-call delivery.""" AUDIO = "audio" - """A URL to the merged call recording. Not supported in this preview: the service rejects - ``audio`` when the agent version is saved.""" + """A URL to the merged call recording.""" class VoiceAgentProfanityFilterMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -3332,7 +3333,7 @@ class VoiceAgentTransferDestinationType(str, Enum, metaclass=CaseInsensitiveEnum TEAMS = "teams" """A Microsoft Teams user or resource-account identifier.""" SIP = "sip" - """A SIP or SIPS URI.""" + """A SIP or SIPS URI. SIP is in preview and requires the ``VoiceAgents=V1Preview`` opt-in.""" class VoiceAgentTransferStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py index 83f8cee29332..4c1a1d9937fc 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py @@ -258,7 +258,7 @@ class A2APreviewTool(Tool, discriminator="a2a_preview"): # pylint: disable=docs """An agent implementing the A2A protocol. :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2A_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.A2A_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :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 @@ -390,7 +390,7 @@ class A2APreviewToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. A2A_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.A2A_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :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 @@ -455,7 +455,7 @@ class A2ATool(Tool, discriminator="a2a"): # pylint: disable=docstring-keyword-s """An agent implementing the A2A protocol. :ivar type: The type of the tool. Always ``"a2a"``. Required. A2_A. - :vartype type: str or ~azure.ai.projects.models.A2_A + :vartype type: str or ~azure.ai.projects.models.ToolType :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 @@ -528,7 +528,7 @@ class A2AToolboxTool(ToolboxTool, discriminator="a2a"): # pylint: disable=docst are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. A2_A. - :vartype type: str or ~azure.ai.projects.models.A2_A + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :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 @@ -787,7 +787,7 @@ class AgentClusterInsightRequest( """Insights on set of Agent Evaluation Results. :ivar type: The type of request. Required. Cluster Insight on an Agent. - :vartype type: str or ~azure.ai.projects.models.AGENT_CLUSTER_INSIGHT + :vartype type: str or ~azure.ai.projects.models.InsightType :ivar agent_name: Identifier for the agent. Required. :vartype agent_name: str :ivar model_configuration: Configuration of the model used in the insight generation. @@ -863,7 +863,7 @@ class AgentClusterInsightResult( """Insights from the agent cluster analysis. :ivar type: The type of insights result. Required. Cluster Insight on an Agent. - :vartype type: str or ~azure.ai.projects.models.AGENT_CLUSTER_INSIGHT + :vartype type: str or ~azure.ai.projects.models.InsightType :ivar cluster_insight: Required. :vartype cluster_insight: ~azure.ai.projects.models.ClusterInsightResult """ @@ -949,7 +949,7 @@ class AgentDataGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Agent. Required. Agent source — references an agent. - :vartype type: str or ~azure.ai.projects.models.AGENT + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobSourceType :ivar agent_name: The agent name to fetch instructions from. Required. :vartype agent_name: str :ivar agent_version: The agent version. If not specified, the latest version is used. @@ -1027,7 +1027,7 @@ class AgentDetails(_Model): # pylint: disable=docstring-keyword-should-match-ke """AgentDetails. :ivar object: The object type, which is always 'agent'. Required. AGENT. - :vartype object: str or ~azure.ai.projects.models.AGENT + :vartype object: str or ~azure.ai.projects.models.AgentObjectType :ivar id: The unique identifier of the agent. Required. :vartype id: str :ivar name: The name of the agent. Required. @@ -1263,7 +1263,7 @@ class AgentEvaluatorGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Agent. Required. Agent source — references an agent to fetch instructions and metadata from. - :vartype type: str or ~azure.ai.projects.models.AGENT + :vartype type: str or ~azure.ai.projects.models.EvaluatorGenerationJobSourceType :ivar agent_name: The agent name to fetch instructions from. Required. :vartype agent_name: str :ivar agent_version: The agent version. If not specified, the latest version is used. @@ -1373,7 +1373,7 @@ class AgenticIdentityPreviewCredentials(BaseCredentials, discriminator="AgenticI """Agentic identity credential definition. :ivar type: The credential type. Required. Agentic identity credential. - :vartype type: str or ~azure.ai.projects.models.AGENTIC_IDENTITY_PREVIEW + :vartype type: str or ~azure.ai.projects.models.CredentialType """ type: Literal[CredentialType.AGENTIC_IDENTITY_PREVIEW] = rest_discriminator(name="type", visibility=["read"]) # type: ignore @@ -2433,7 +2433,7 @@ class AgentOptimizationAgentCandidateOutput( """Candidate output produced by an agent-optimization job. :ivar type: Required. Comparative agent optimization. - :vartype type: str or ~azure.ai.projects.models.AGENT_OPTIMIZATION + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationConfigurationType :ivar mutations: Typed configuration mutations applied to the baseline. Omitted for the baseline candidate. LIST without ``expand=mutations`` returns mutation items with only ``type``; expanded LIST and candidate GET populate each mutation's ``value``. @@ -2790,7 +2790,7 @@ class AgentOptimizationConfiguration( """Configuration for optimizing an agent for measured quality. :ivar type: Optimization type discriminator. Required. Comparative agent optimization. - :vartype type: str or ~azure.ai.projects.models.AGENT_OPTIMIZATION + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationConfigurationType :ivar goal: Optimization goal. If omitted, the service defaults to improve_quality. "improve_quality" :vartype goal: str or ~azure.ai.projects.models.AgentOptimizationGoal @@ -3227,7 +3227,7 @@ class AgentOptimizationFoundryAgentTargetConfiguration( """Identifies the Foundry agent that owns the configuration being optimized. :ivar type: Foundry-agent target discriminator. Required. A registered Foundry agent. - :vartype type: str or ~azure.ai.projects.models.FOUNDRY_AGENT + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationTargetConfigurationType :ivar name: Registered Foundry agent name. Required. :vartype name: str :ivar version: Pinned agent version. Omitted to resolve and pin the latest version. @@ -3302,7 +3302,7 @@ class AgentOptimizationInstructionsMutation( """Instructions mutation. :ivar type: Required. Rewrites agent instructions. - :vartype type: str or ~azure.ai.projects.models.INSTRUCTIONS + :vartype type: str or ~azure.ai.projects.models.TargetAttribute :ivar value: Optimized agent instructions. Omitted on LIST unless ``expand=mutations`` is specified. :vartype value: str @@ -3637,7 +3637,7 @@ class AgentOptimizationModelMutation( :ivar type: Required. Model selection from optimization_configuration.agent_optimization_space.model_search_space. - :vartype type: str or ~azure.ai.projects.models.MODEL + :vartype type: str or ~azure.ai.projects.models.TargetAttribute :ivar value: Selected model name or deployment name. Omitted on LIST unless ``expand=mutations`` is specified. :vartype value: str @@ -3675,7 +3675,7 @@ class AgentOptimizationPromptCandidateOutput( """Candidate output produced by a prompt-optimization job. :ivar type: Required. One-shot prompt optimization. - :vartype type: str or ~azure.ai.projects.models.PROMPT_OPTIMIZATION + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationConfigurationType :ivar mutations: Typed configuration mutations applied to the baseline. Omitted for the baseline candidate. LIST without ``expand=mutations`` returns mutation items with only ``type``; expanded LIST and candidate GET populate each mutation's ``value``. @@ -3822,7 +3822,7 @@ class AgentOptimizationSkillsMutation( """Skill mutations. :ivar type: Required. Generates or modifies agent skill descriptions and bodies. - :vartype type: str or ~azure.ai.projects.models.SKILLS + :vartype type: str or ~azure.ai.projects.models.TargetAttribute :ivar value: Added or changed skills. Omitted on LIST unless ``expand=mutations`` is specified. :vartype value: list[~azure.ai.projects.models.AgentOptimizationSkill] """ @@ -3979,7 +3979,7 @@ class AgentOptimizationTargetCompletionDatasetReferenceDataSource( :ivar type: Registered dataset source discriminator. Required. An explicitly versioned registered Foundry dataset. - :vartype type: str or ~azure.ai.projects.models.DATASET_REFERENCE + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationDataSourceType :ivar name: Registered dataset name. Required. :vartype name: str :ivar version: Registered dataset version. Required. @@ -4021,7 +4021,7 @@ class AgentOptimizationTargetCompletionEvaluationSet( :ivar type: Target-completion set discriminator. Required. Independent single-turn queries evaluated against each candidate. - :vartype type: str or ~azure.ai.projects.models.TARGET_COMPLETION + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationEvaluationSetType :ivar source: Inline test cases or an explicitly versioned registered Foundry dataset. Required. :vartype source: ~azure.ai.projects.models.AgentOptimizationTargetCompletionDataSource @@ -4061,7 +4061,7 @@ class AgentOptimizationTargetCompletionInlineDataSource( :ivar type: Inline source discriminator. Required. Test cases supplied directly in the optimization request. - :vartype type: str or ~azure.ai.projects.models.INLINE + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationDataSourceType :ivar test_cases: Target-completion test cases. Required. :vartype test_cases: list[~azure.ai.projects.models.AgentOptimizationTargetCompletionTestCase] """ @@ -4134,7 +4134,7 @@ class AgentOptimizationToolsMutation( """Tool mutations. :ivar type: Required. Optimizes function tool descriptions and parameter descriptions. - :vartype type: str or ~azure.ai.projects.models.TOOLS + :vartype type: str or ~azure.ai.projects.models.TargetAttribute :ivar value: Added or changed function tools. Omitted on LIST unless ``expand=mutations`` is specified. :vartype value: list[~azure.ai.projects.models.ChatCompletionTool] @@ -4211,7 +4211,7 @@ class AgentOptimizationUserConversationSimulationDatasetReferenceDataSource( :ivar type: Registered dataset source discriminator. Required. An explicitly versioned registered Foundry dataset. - :vartype type: str or ~azure.ai.projects.models.DATASET_REFERENCE + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationDataSourceType :ivar name: Registered dataset name. Required. :vartype name: str :ivar version: Registered dataset version. Required. @@ -4253,7 +4253,7 @@ class AgentOptimizationUserConversationSimulationEvaluationSet( :ivar type: User-conversation-simulation set discriminator. Required. Scenarios used to simulate conversations against each candidate. - :vartype type: str or ~azure.ai.projects.models.USER_CONVERSATION_SIMULATION + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationEvaluationSetType :ivar source: Inline test cases or an explicitly versioned registered Foundry dataset. Required. :vartype source: @@ -4304,7 +4304,7 @@ class AgentOptimizationUserConversationSimulationInlineDataSource( :ivar type: Inline source discriminator. Required. Test cases supplied directly in the optimization request. - :vartype type: str or ~azure.ai.projects.models.INLINE + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationDataSourceType :ivar test_cases: Conversation test scenarios. Required. :vartype test_cases: list[~azure.ai.projects.models.UserConversationSimulationTestCase] """ @@ -4481,7 +4481,7 @@ class AgentTaxonomyInput( """Input configuration for the evaluation taxonomy when the input type is agent. :ivar type: Input type of the evaluation taxonomy. Required. Agent. - :vartype type: str or ~azure.ai.projects.models.AGENT + :vartype type: str or ~azure.ai.projects.models.EvaluationTaxonomyInputType :ivar target: Target configuration for the agent. Required. :vartype target: ~azure.ai.projects.models.EvaluationTarget :ivar risk_categories: List of risk categories to evaluate against. Required. @@ -4528,7 +4528,7 @@ class AgentVersionDetails(_Model): # pylint: disable=docstring-keyword-should-m with a maximum length of 512 characters. Required. :vartype metadata: dict[str, str] :ivar object: The object type, which is always 'agent.version'. Required. AGENT_VERSION. - :vartype object: str or ~azure.ai.projects.models.AGENT_VERSION + :vartype object: str or ~azure.ai.projects.models.AgentObjectType :ivar id: The unique identifier of the agent version. Required. :vartype id: str :ivar name: The name of the agent. Name can be used to retrieve/update/delete the agent. @@ -4730,7 +4730,7 @@ class AnswerResourceChoice( """AnswerResourceChoice. :ivar type: The type of the object. Always ``choice``. Required. CHOICE. - :vartype type: str or ~azure.ai.projects.models.CHOICE + :vartype type: str or ~azure.ai.projects.models.AnswerResourceType :ivar name: Required. :vartype name: str :ivar choice: Required. Is either a str type or a bool type. @@ -4782,7 +4782,7 @@ class AnswerResourcePredicate( """AnswerResourcePredicate. :ivar type: The type of the object. Always ``predicate``. Required. PREDICATE. - :vartype type: str or ~azure.ai.projects.models.PREDICATE + :vartype type: str or ~azure.ai.projects.models.AnswerResourceType :ivar name: Required. :vartype name: str :ivar probability: Required. @@ -4823,7 +4823,7 @@ class AnswerResourceRefusal( receive answers. :ivar type: The type of the object. Always ``refusal``. Required. REFUSAL. - :vartype type: str or ~azure.ai.projects.models.REFUSAL + :vartype type: str or ~azure.ai.projects.models.AnswerResourceType :ivar name: Required. :vartype name: str """ @@ -4858,7 +4858,7 @@ class AnswerResourceScore( """AnswerResourceScore. :ivar type: The type of the object. Always ``score``. Required. SCORE. - :vartype type: str or ~azure.ai.projects.models.SCORE + :vartype type: str or ~azure.ai.projects.models.AnswerResourceType :ivar name: Required. :vartype name: str :ivar score: Required. @@ -5002,7 +5002,7 @@ class ApiKeyCredentials(BaseCredentials, discriminator="ApiKey"): """API Key Credential definition. :ivar type: The credential type. Required. API Key credential. - :vartype type: str or ~azure.ai.projects.models.API_KEY + :vartype type: str or ~azure.ai.projects.models.CredentialType :ivar api_key: API Key. :vartype api_key: str """ @@ -5035,7 +5035,7 @@ class ApplyPatchToolParam( """Apply patch tool. :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. - :vartype type: str or ~azure.ai.projects.models.APPLY_PATCH + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar allowed_callers: :vartype allowed_callers: list[str or ~azure.ai.projects.models.CallableToolAllowedCaller] """ @@ -5204,7 +5204,7 @@ class AtTimeSchedule( :vartype expires_at: ~datetime.datetime :ivar type: Identifies scheduling with one common earliest dispatch time. Required. One common earliest dispatch time. - :vartype type: str or ~azure.ai.projects.models.SCHEDULED + :vartype type: str or ~azure.ai.projects.models.TelephonyCampaignScheduleType :ivar scheduled_at: Common earliest dispatch time; successful preparation is required. Required. :vartype scheduled_at: ~datetime.datetime @@ -5491,7 +5491,7 @@ class AzureAISearchIndex( :ivar tags: Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] :ivar type: Type of index. Required. Azure search. - :vartype type: str or ~azure.ai.projects.models.AZURE_SEARCH + :vartype type: str or ~azure.ai.projects.models.IndexType :ivar connection_name: Name of connection to Azure AI Search. Required. :vartype connection_name: str :ivar index_name: Name of index in Azure AI Search resource to attach. Required. @@ -5538,7 +5538,7 @@ class AzureAISearchTool( """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.projects.models.AZURE_AI_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: Deprecated. This property is deprecated and will be removed in a future version. :vartype name: str :ivar description: Deprecated. This property is deprecated and will be removed in a future @@ -5602,7 +5602,7 @@ class AzureAISearchToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. AZURE_AI_SEARCH. - :vartype type: str or ~azure.ai.projects.models.AZURE_AI_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar azure_ai_search: The azure ai search index resource. Required. :vartype azure_ai_search: ~azure.ai.projects.models.AzureAISearchToolResource """ @@ -5834,7 +5834,7 @@ class AzureFunctionTool( """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.projects.models.AZURE_FUNCTION + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar tool_configs: Deprecated. This property is deprecated and will be removed in a future version. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] @@ -6008,7 +6008,7 @@ class BingCustomSearchPreviewTool( :ivar type: The object type, which is always 'bing_custom_search_preview'. Required. BING_CUSTOM_SEARCH_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.BING_CUSTOM_SEARCH_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. :vartype bing_custom_search_preview: ~azure.ai.projects.models.BingCustomSearchToolParameters """ @@ -6162,7 +6162,7 @@ class BingGroundingTool( agent. :ivar type: The object type, which is always 'bing_grounding'. Required. BING_GROUNDING. - :vartype type: str or ~azure.ai.projects.models.BING_GROUNDING + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: Deprecated. This property is deprecated and will be removed in a future version. :vartype name: str :ivar description: Deprecated. This property is deprecated and will be removed in a future @@ -6279,7 +6279,7 @@ class BotServiceAuthorizationScheme(AgentEndpointAuthorizationScheme, discrimina """BotServiceAuthorizationScheme. :ivar type: Required. BOT_SERVICE. - :vartype type: str or ~azure.ai.projects.models.BOT_SERVICE + :vartype type: str or ~azure.ai.projects.models.AgentEndpointAuthorizationSchemeType """ type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -6306,7 +6306,7 @@ class BotServiceRbacAuthorizationScheme(AgentEndpointAuthorizationScheme, discri """BotServiceRbacAuthorizationScheme. :ivar type: Required. BOT_SERVICE_RBAC. - :vartype type: str or ~azure.ai.projects.models.BOT_SERVICE_RBAC + :vartype type: str or ~azure.ai.projects.models.AgentEndpointAuthorizationSchemeType """ type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE_RBAC] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -6333,7 +6333,7 @@ class BotServiceTenantAuthorizationScheme(AgentEndpointAuthorizationScheme, disc """BotServiceTenantAuthorizationScheme. :ivar type: Required. BOT_SERVICE_TENANT. - :vartype type: str or ~azure.ai.projects.models.BOT_SERVICE_TENANT + :vartype type: str or ~azure.ai.projects.models.AgentEndpointAuthorizationSchemeType """ type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE_TENANT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -6366,7 +6366,7 @@ class BrowserAutomationPreviewTool( :ivar type: The object type, which is always 'browser_automation_preview'. Required. BROWSER_AUTOMATION_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. :vartype browser_automation_preview: ~azure.ai.projects.models.BrowserAutomationToolParameters """ @@ -6414,7 +6414,7 @@ class BrowserAutomationPreviewToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. BROWSER_AUTOMATION_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. :vartype browser_automation_preview: ~azure.ai.projects.models.BrowserAutomationToolParameters """ @@ -6455,7 +6455,7 @@ class BrowserAutomationTool( :ivar type: The object type, which is always 'browser_automation'. Required. BROWSER_AUTOMATION. - :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar browser_automation: The Browser Automation Tool parameters. Required. :vartype browser_automation: ~azure.ai.projects.models.BrowserAutomationToolParameters """ @@ -6500,7 +6500,7 @@ class BrowserAutomationToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. BROWSER_AUTOMATION. - :vartype type: str or ~azure.ai.projects.models.BROWSER_AUTOMATION + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar browser_automation: The Browser Automation Tool parameters. Required. :vartype browser_automation: ~azure.ai.projects.models.BrowserAutomationToolParameters """ @@ -6603,7 +6603,7 @@ class CaptureStructuredOutputsTool( :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required. CAPTURE_STRUCTURED_OUTPUTS. - :vartype type: str or ~azure.ai.projects.models.CAPTURE_STRUCTURED_OUTPUTS + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: Deprecated. This property is deprecated and will be removed in a future version. :vartype name: str :ivar description: Deprecated. This property is deprecated and will be removed in a future @@ -6799,7 +6799,7 @@ class ChatSummaryMemoryItem( :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.projects.models.CHAT_SUMMARY + :vartype kind: str or ~azure.ai.projects.models.MemoryItemKind """ kind: Literal[MemoryItemKind.CHAT_SUMMARY] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -7051,7 +7051,7 @@ class CodeBasedEvaluatorDefinition( :ivar metrics: List of output metrics produced by this evaluator. :vartype metrics: dict[str, ~azure.ai.projects.models.EvaluatorMetric] :ivar type: Required. Code-based definition. - :vartype type: str or ~azure.ai.projects.models.CODE + :vartype type: str or ~azure.ai.projects.models.EvaluatorDefinitionType :ivar code_text: Inline code text for the evaluator. :vartype code_text: str :ivar entry_point: The entry point Python file name for the uploaded evaluator code (e.g. @@ -7164,7 +7164,7 @@ class CodeInterpreterTool( :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER. - :vartype type: str or ~azure.ai.projects.models.CODE_INTERPRETER + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar allowed_callers: :vartype allowed_callers: list[str or ~azure.ai.projects.models.CallableToolAllowedCaller] :ivar container: The code interpreter container. Can be a container ID or an object that @@ -7240,7 +7240,7 @@ class CodeInterpreterToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. CODE_INTERPRETER. - :vartype type: str or ~azure.ai.projects.models.CODE_INTERPRETER + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar allowed_callers: :vartype allowed_callers: list[str or ~azure.ai.projects.models.CallableToolAllowedCaller] :ivar container: The code interpreter container. Can be a container ID or an object that @@ -7397,7 +7397,7 @@ class ComputerTool(Tool, discriminator="computer"): """Computer. :ivar type: The type of the computer tool. Always ``computer``. Required. COMPUTER. - :vartype type: str or ~azure.ai.projects.models.COMPUTER + :vartype type: str or ~azure.ai.projects.models.ToolType """ type: Literal[ToolType.COMPUTER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -7427,7 +7427,7 @@ class ComputerUsePreviewTool( :ivar type: The type of the computer use tool. Always ``computer_use_preview``. Required. COMPUTER_USE_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.COMPUTER_USE_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :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.projects.models.ComputerEnvironment @@ -7550,7 +7550,7 @@ class ContainerAutoParam( """ContainerAutoParam. :ivar type: Automatically creates a container for this request. Required. CONTAINER_AUTO. - :vartype type: str or ~azure.ai.projects.models.CONTAINER_AUTO + :vartype type: str or ~azure.ai.projects.models.FunctionShellToolParamEnvironmentType :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". @@ -7681,7 +7681,7 @@ class ContainerNetworkPolicyAllowlistParam( :ivar type: Allow outbound network access only to specified domains. Always ``allowlist``. Required. ALLOWLIST. - :vartype type: str or ~azure.ai.projects.models.ALLOWLIST + :vartype type: str or ~azure.ai.projects.models.ContainerNetworkPolicyParamType :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. @@ -7723,7 +7723,7 @@ class ContainerNetworkPolicyDisabledParam(ContainerNetworkPolicyParam, discrimin """ContainerNetworkPolicyDisabledParam. :ivar type: Disable outbound network access. Always ``disabled``. Required. DISABLED. - :vartype type: str or ~azure.ai.projects.models.DISABLED + :vartype type: str or ~azure.ai.projects.models.ContainerNetworkPolicyParamType """ type: Literal[ContainerNetworkPolicyParamType.DISABLED] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -7856,7 +7856,7 @@ class ContinuousEvaluationRuleAction( """Evaluation rule action for continuous evaluation. :ivar type: Required. Continuous evaluation. - :vartype type: str or ~azure.ai.projects.models.CONTINUOUS_EVALUATION + :vartype type: str or ~azure.ai.projects.models.EvaluationRuleActionType :ivar eval_id: Eval Id to add continuous evaluation runs to. Required. :vartype eval_id: str :ivar max_hourly_runs: Maximum number of evaluation runs allowed per hour. @@ -7919,7 +7919,7 @@ class CosmosDBIndex( :ivar tags: Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] :ivar type: Type of index. Required. CosmosDB. - :vartype type: str or ~azure.ai.projects.models.COSMOS_DB + :vartype type: str or ~azure.ai.projects.models.IndexType :ivar connection_name: Name of connection to CosmosDB. Required. :vartype connection_name: str :ivar database_name: Name of the CosmosDB Database. Required. @@ -8116,7 +8116,7 @@ class CronTrigger(Trigger, discriminator="Cron"): # pylint: disable=docstring-k """Cron based trigger. :ivar type: Required. Cron based trigger. - :vartype type: str or ~azure.ai.projects.models.CRON + :vartype type: str or ~azure.ai.projects.models.TriggerType :ivar expression: Cron expression that defines the schedule frequency. Required. :vartype expression: str :ivar time_zone: Time zone for the cron schedule. Defaults to ``UTC``. @@ -8168,7 +8168,7 @@ class CustomCredential(BaseCredentials, discriminator="CustomKeys"): """Custom credential definition. :ivar type: The credential type. Required. Custom credential. - :vartype type: str or ~azure.ai.projects.models.CUSTOM + :vartype type: str or ~azure.ai.projects.models.CredentialType """ type: Literal[CredentialType.CUSTOM] = rest_discriminator(name="type", visibility=["read"]) # type: ignore @@ -8229,7 +8229,7 @@ class CustomGrammarFormatParam( """Grammar format. :ivar type: Grammar format. Always ``grammar``. Required. GRAMMAR. - :vartype type: str or ~azure.ai.projects.models.GRAMMAR + :vartype type: str or ~azure.ai.projects.models.CustomToolParamFormatType :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.projects.models.GrammarSyntax1 @@ -8307,7 +8307,7 @@ class CustomRoutineTrigger( """A custom event routine trigger. :ivar type: The trigger type. Required. A custom event trigger. - :vartype type: str or ~azure.ai.projects.models.CUSTOM + :vartype type: str or ~azure.ai.projects.models.RoutineTriggerType :ivar provider: The external provider that emits the custom event. Required. :vartype provider: str :ivar event_name: The provider-specific event name that fires the routine. @@ -8350,7 +8350,7 @@ class CustomTextFormatParam(CustomToolParamFormat, discriminator="text"): """Text format. :ivar type: Unconstrained text format. Always ``text``. Required. TEXT. - :vartype type: str or ~azure.ai.projects.models.TEXT + :vartype type: str or ~azure.ai.projects.models.CustomToolParamFormatType """ type: Literal[CustomToolParamFormatType.TEXT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -8377,7 +8377,7 @@ class CustomToolParam(Tool, discriminator="custom"): # pylint: disable=docstrin """Custom tool. :ivar type: The type of the custom tool. Always ``custom``. Required. CUSTOM. - :vartype type: str or ~azure.ai.projects.models.CUSTOM + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: The name of the custom tool, used to identify it in tool calls. Required. :vartype name: str :ivar async_property: Whether the tool response can be returned asynchronously versus @@ -8479,7 +8479,7 @@ class DailyRecurrenceSchedule( """Daily recurrence schedule. :ivar type: Daily recurrence type. Required. Daily recurrence pattern. - :vartype type: str or ~azure.ai.projects.models.DAILY + :vartype type: str or ~azure.ai.projects.models.RecurrenceType :ivar hours: Hours for the recurrence schedule. Required. :vartype hours: list[int] """ @@ -8857,7 +8857,7 @@ class DatasetDataGenerationJobOutput(DataGenerationJobOutput, discriminator="dat """Dataset output for a data generation job. :ivar type: Dataset output. Required. The generated data is a Dataset. - :vartype type: str or ~azure.ai.projects.models.DATASET + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobOutputType :ivar id: The id of the output dataset created. :vartype id: str :ivar name: The name of the output dataset. @@ -8911,7 +8911,7 @@ class DatasetEvaluatorGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Dataset. Required. Dataset source — reference to a dataset. - :vartype type: str or ~azure.ai.projects.models.DATASET + :vartype type: str or ~azure.ai.projects.models.EvaluatorGenerationJobSourceType :ivar name: The name of the dataset. Required. :vartype name: str :ivar version: The version of the dataset. If not specified, the latest version is used. @@ -9103,7 +9103,7 @@ class DeleteAgentResponse(_Model): # pylint: disable=docstring-keyword-should-m """A deleted agent Object. :ivar object: The object type. Always 'agent.deleted'. Required. AGENT_DELETED. - :vartype object: str or ~azure.ai.projects.models.AGENT_DELETED + :vartype object: str or ~azure.ai.projects.models.AgentObjectType :ivar name: The name of the agent. Required. :vartype name: str :ivar deleted: Whether the agent was successfully deleted. Required. @@ -9143,7 +9143,7 @@ class DeleteAgentVersionResponse(_Model): # pylint: disable=docstring-keyword-s """A deleted agent version Object. :ivar object: The object type. Always 'agent.version.deleted'. Required. AGENT_VERSION_DELETED. - :vartype object: str or ~azure.ai.projects.models.AGENT_VERSION_DELETED + :vartype object: str or ~azure.ai.projects.models.AgentObjectType :ivar name: The name of the agent. Required. :vartype name: str :ivar version: The version identifier of the agent. Required. @@ -9188,7 +9188,7 @@ class DeleteMemoryResult(_Model): # pylint: disable=docstring-keyword-should-ma """Response for deleting a memory item from a memory store. :ivar object: The object type. Always 'memory_store.item.deleted'. Required. MEMORY_DELETED. - :vartype object: str or ~azure.ai.projects.models.MEMORY_DELETED + :vartype object: str or ~azure.ai.projects.models.MemoryStoreObjectType :ivar memory_id: The unique ID of the deleted memory item. Required. :vartype memory_id: str :ivar deleted: Whether the memory item was successfully deleted. Required. @@ -9228,7 +9228,7 @@ class DeleteMemoryStoreResult(_Model): # pylint: disable=docstring-keyword-shou """DeleteMemoryStoreResult. :ivar object: The object type. Always 'memory_store.deleted'. Required. MEMORY_STORE_DELETED. - :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE_DELETED + :vartype object: str or ~azure.ai.projects.models.MemoryStoreObjectType :ivar name: The name of the memory store. Required. :vartype name: str :ivar deleted: Whether the memory store was successfully deleted. Required. @@ -9538,7 +9538,7 @@ class EndpointBasedEvaluatorDefinition( :vartype metrics: dict[str, ~azure.ai.projects.models.EvaluatorMetric] :ivar type: Required. Endpoint-based evaluator definition. References a customer-owned HTTP endpoint via a Project Connection. - :vartype type: str or ~azure.ai.projects.models.ENDPOINT + :vartype type: str or ~azure.ai.projects.models.EvaluatorDefinitionType :ivar connection_name: Name of the Project Connection that stores the endpoint URL and credentials. The connection must exist on the project and have a non-empty target URL. Supported auth types: ApiKey (sends ``api-key`` header) and AAD/Entra ID (acquires a bearer @@ -9581,7 +9581,7 @@ class EntraAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator=" """EntraAuthorizationScheme. :ivar type: Required. ENTRA. - :vartype type: str or ~azure.ai.projects.models.ENTRA + :vartype type: str or ~azure.ai.projects.models.AgentEndpointAuthorizationSchemeType """ type: Literal[AgentEndpointAuthorizationSchemeType.ENTRA] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -9608,7 +9608,7 @@ class EntraIDCredentials(BaseCredentials, discriminator="AAD"): """Entra ID credential definition. :ivar type: The credential type. Required. Entra ID credential (formerly known as AAD). - :vartype type: str or ~azure.ai.projects.models.ENTRA_ID + :vartype type: str or ~azure.ai.projects.models.CredentialType """ type: Literal[CredentialType.ENTRA_ID] = rest_discriminator(name="type", visibility=["read"]) # type: ignore @@ -9912,7 +9912,7 @@ class EvaluationComparisonInsightRequest( """Evaluation Comparison Request. :ivar type: The type of request. Required. Evaluation Comparison. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_COMPARISON + :vartype type: str or ~azure.ai.projects.models.InsightType :ivar eval_id: Identifier for the evaluation. Required. :vartype eval_id: str :ivar baseline_run_id: The baseline run ID for comparison. Required. @@ -9959,7 +9959,7 @@ class EvaluationComparisonInsightResult( """Insights from the evaluation comparison. :ivar type: The type of insights result. Required. Evaluation Comparison. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_COMPARISON + :vartype type: str or ~azure.ai.projects.models.InsightType :ivar comparisons: Comparison results for each treatment run against the baseline. Required. :vartype comparisons: list[~azure.ai.projects.models.EvalRunResultComparison] :ivar method: The statistical method used for comparison. Required. @@ -10024,7 +10024,7 @@ class EvaluationDataGenerationJob( :vartype finished_at: ~datetime.datetime :ivar scenario: The scenario of the data generation job, which is Evaluation for this model. Required. Evaluation scenario. - :vartype scenario: str or ~azure.ai.projects.models.EVALUATION + :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario :ivar output_configuration: Optional dataset output configuration for the generated evaluation data. :vartype output_configuration: @@ -10075,7 +10075,7 @@ class EvaluationDataGenerationJobInputs( :vartype generation_configuration: ~azure.ai.projects.models.DataGenerationJobConfiguration :ivar scenario: The scenario of the data generation job, which is Evaluation for this model. Required. Evaluation scenario. - :vartype scenario: str or ~azure.ai.projects.models.EVALUATION + :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario :ivar output_configuration: Optional dataset output configuration for the generated evaluation data. :vartype output_configuration: @@ -10272,7 +10272,7 @@ class EvaluationResultSample( :ivar correlation_info: Info about the correlation for the analysis sample. Required. :vartype correlation_info: dict[str, any] :ivar type: Evaluation Result Sample Type. Required. A sample from the evaluation result. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_RESULT_SAMPLE + :vartype type: str or ~azure.ai.projects.models.SampleType :ivar evaluation_result: Evaluation result for the analysis sample. Required. :vartype evaluation_result: ~azure.ai.projects.models.EvalResult """ @@ -10409,7 +10409,7 @@ class EvaluationRunClusterInsightRequest( """Insights on set of Evaluation Results. :ivar type: The type of insights request. Required. Insights on an Evaluation run result. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_RUN_CLUSTER_INSIGHT + :vartype type: str or ~azure.ai.projects.models.InsightType :ivar eval_id: Evaluation Id for the insights. Required. :vartype eval_id: str :ivar run_ids: List of evaluation run IDs for the insights. Required. @@ -10456,7 +10456,7 @@ class EvaluationRunClusterInsightResult( """Insights from the evaluation run cluster analysis. :ivar type: The type of insights result. Required. Insights on an Evaluation run result. - :vartype type: str or ~azure.ai.projects.models.EVALUATION_RUN_CLUSTER_INSIGHT + :vartype type: str or ~azure.ai.projects.models.InsightType :ivar cluster_insight: Required. :vartype cluster_insight: ~azure.ai.projects.models.ClusterInsightResult """ @@ -10532,7 +10532,7 @@ class EvaluationScheduleTask( :ivar configuration: Configuration for the task. :vartype configuration: dict[str, str] :ivar type: Required. Evaluation task. - :vartype type: str or ~azure.ai.projects.models.EVALUATION + :vartype type: str or ~azure.ai.projects.models.ScheduleTaskType :ivar eval_id: Identifier of the evaluation group. Required. :vartype eval_id: str :ivar eval_run: The evaluation run payload. Required. @@ -11161,7 +11161,7 @@ class ExternalAgentDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Required. EXTERNAL. - :vartype kind: str or ~azure.ai.projects.models.EXTERNAL + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar otel_agent_id: The OpenTelemetry agent identifier used to attribute customer-emitted spans to this Foundry agent. Spans must include the attribute ``gen_ai.agent.id = `` to appear under this registration. Defaults to the top-level agent name when @@ -11238,7 +11238,7 @@ class FabricIQPreviewTool( """A FabricIQ server-side tool. :ivar type: The object type, which is always 'fabric_iq_preview'. Required. FABRIC_IQ_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.FABRIC_IQ_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar project_connection_id: The ID of the FabricIQ project connection. Required. :vartype project_connection_id: str :ivar server_label: (Optional) The label of the FabricIQ MCP server to connect to. @@ -11302,7 +11302,7 @@ class FabricIQPreviewToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. FABRIC_IQ_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.FABRIC_IQ_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar project_connection_id: The ID of the FabricIQ project connection. Required. :vartype project_connection_id: str :ivar server_label: (Optional) The label of the FabricIQ MCP server to connect to. @@ -11412,7 +11412,7 @@ class FileDataGenerationJobOutput(DataGenerationJobOutput, discriminator="file") """Azure OpenAI file output for a data generation job. This is a preview feature. :ivar type: Azure OpenAI file output. Required. The generated data is an Azure OpenAI File. - :vartype type: str or ~azure.ai.projects.models.FILE + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobOutputType :ivar id: The id of the output Azure OpenAI file. Required. :vartype id: str :ivar filename: The filename of the output Azure OpenAI file. Required. @@ -11454,7 +11454,7 @@ class FileDataGenerationJobSource( :vartype description: str :ivar type: The source type for this job, which is File. Required. File source — Azure OpenAI file. - :vartype type: str or ~azure.ai.projects.models.FILE + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobSourceType :ivar id: Input Azure Open AI file id used for data generation. Required. :vartype id: str """ @@ -11510,7 +11510,7 @@ class FileDatasetVersion( :ivar tags: Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] :ivar type: Dataset type. Required. URI file. - :vartype type: str or ~azure.ai.projects.models.URI_FILE + :vartype type: str or ~azure.ai.projects.models.DatasetType """ type: Literal[DatasetType.URI_FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -11542,7 +11542,7 @@ class FileSearchTool(Tool, discriminator="file_search"): # pylint: disable=docs """File search. :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. - :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolType :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 @@ -11623,7 +11623,7 @@ class FileSearchToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. FILE_SEARCH. - :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :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 @@ -11726,7 +11726,7 @@ class FixedIntervalRetryPolicy( :vartype max_attempts: int :ivar type: The fixed-interval retry strategy. Required. Retry after a fixed interval between attempts. - :vartype type: str or ~azure.ai.projects.models.FIXED_INTERVAL + :vartype type: str or ~azure.ai.projects.models.TelephonyOutboundRetryPolicyType :ivar interval: The nonnegative delay between attempts, from 0 to 2147483647 seconds. Zero permits an immediate retry, subject to scheduling and capacity. Required. :vartype interval: ~datetime.timedelta @@ -11805,7 +11805,7 @@ class FixedRatioVersionSelectionRule( :ivar agent_version: The agent version to route traffic to. Required. :vartype agent_version: str :ivar type: Required. FIXED_RATIO. - :vartype type: str or ~azure.ai.projects.models.FIXED_RATIO + :vartype type: str or ~azure.ai.projects.models.VersionSelectorType :ivar traffic_percentage: The percentage of traffic to route to the version. Must be between 0 and 100. Required. :vartype traffic_percentage: int @@ -11862,7 +11862,7 @@ class FolderDatasetVersion( :ivar tags: Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] :ivar type: Dataset type. Required. URI folder. - :vartype type: str or ~azure.ai.projects.models.URI_FOLDER + :vartype type: str or ~azure.ai.projects.models.DatasetType """ type: Literal[DatasetType.URI_FOLDER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -11988,7 +11988,7 @@ class FunctionShellToolParam( """Shell tool. :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. - :vartype type: str or ~azure.ai.projects.models.SHELL + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar environment: :vartype environment: ~azure.ai.projects.models.FunctionShellToolParamEnvironment :ivar allowed_callers: @@ -12050,7 +12050,7 @@ class FunctionShellToolParamEnvironmentContainerReferenceParam( :ivar type: References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE. - :vartype type: str or ~azure.ai.projects.models.CONTAINER_REFERENCE + :vartype type: str or ~azure.ai.projects.models.FunctionShellToolParamEnvironmentType :ivar container_id: The ID of the referenced container. Required. :vartype container_id: str """ @@ -12085,7 +12085,7 @@ class FunctionShellToolParamEnvironmentLocalEnvironmentParam( """FunctionShellToolParamEnvironmentLocalEnvironmentParam. :ivar type: Use a local computer environment. Required. LOCAL. - :vartype type: str or ~azure.ai.projects.models.LOCAL + :vartype type: str or ~azure.ai.projects.models.FunctionShellToolParamEnvironmentType :ivar skills: An optional list of skills. :vartype skills: list[~azure.ai.projects.models.LocalSkillParam] """ @@ -12120,7 +12120,7 @@ class FunctionTool(Tool, discriminator="function"): # pylint: disable=docstring """Function. :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. - :vartype type: str or ~azure.ai.projects.models.FUNCTION + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: The name of the function to call. Required. :vartype name: str :ivar async_property: @@ -12263,7 +12263,7 @@ class GenerateVoiceAgentRequest(_Model): # pylint: disable=docstring-keyword-sh override any of them afterward via standard agent versioning. :ivar kind: The agent kind. Always ``voice``. Required. VOICE. - :vartype kind: str or ~azure.ai.projects.models.VOICE + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar name: The unique name for the agent to create. Must be a non-empty DNS-like agent name. Required. :vartype name: str @@ -12456,7 +12456,7 @@ class GitHubCopilotToolsetPreview( :ivar type: The legacy type of the toolset. Always ``github_copilot_toolset_preview``; use ``microsoft_copilot_toolset_preview`` for new integrations. Required. GITHUB_COPILOT_TOOLSET_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.GITHUB_COPILOT_TOOLSET_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar default_config: The default configuration for built-in tools. If omitted, built-in tools are enabled by default. :vartype default_config: ~azure.ai.projects.models.GitHubCopilotToolsetDefaultConfig @@ -12504,7 +12504,7 @@ class GitHubIssueRoutineTrigger( """A GitHub issue routine trigger. :ivar type: The trigger type. Required. A GitHub issue trigger. - :vartype type: str or ~azure.ai.projects.models.GITHUB_ISSUE + :vartype type: str or ~azure.ai.projects.models.RoutineTriggerType :ivar connection_id: The workspace connection identifier that resolves the GitHub configuration for the trigger. Required. :vartype connection_id: str @@ -12596,7 +12596,7 @@ class HeaderTelemetryEndpointAuth( :ivar type: The authentication type, always 'header' for header-based secret authentication. Required. Header-based secret authentication. - :vartype type: str or ~azure.ai.projects.models.HEADER + :vartype type: str or ~azure.ai.projects.models.TelemetryEndpointAuthType :ivar header_name: The name of the HTTP header to inject the secret value into. Required. :vartype header_name: str :ivar secret_id: The identifier of the secret store or connection. Required. @@ -12644,7 +12644,7 @@ class HostedAgentDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Required. HOSTED. - :vartype kind: str or ~azure.ai.projects.models.HOSTED + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar cpu: The CPU configuration for the hosted agent. Required. :vartype cpu: str :ivar memory: The memory configuration for the hosted agent. Required. @@ -12744,7 +12744,7 @@ class HourlyRecurrenceSchedule(RecurrenceSchedule, discriminator="Hourly"): """Hourly recurrence schedule. :ivar type: Required. Hourly recurrence pattern. - :vartype type: str or ~azure.ai.projects.models.HOURLY + :vartype type: str or ~azure.ai.projects.models.RecurrenceType """ type: Literal[RecurrenceType.HOURLY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -12773,7 +12773,7 @@ class HumanEvaluationPreviewRuleAction( """Evaluation rule action for human evaluation. :ivar type: Required. Human evaluation preview. - :vartype type: str or ~azure.ai.projects.models.HUMAN_EVALUATION_PREVIEW + :vartype type: str or ~azure.ai.projects.models.EvaluationRuleActionType :ivar template_id: Human evaluation template Id. Required. :vartype template_id: str """ @@ -12842,7 +12842,7 @@ class ImageGenTool( :ivar type: The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION. - :vartype type: str or ~azure.ai.projects.models.IMAGE_GENERATION + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar model: Is one of the following types: Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], Literal["gpt-image-2"], Literal["gpt-image-2-2026-04-21"], Literal["gpt-image-2.5-sunburst"], @@ -13080,7 +13080,7 @@ class ImmediateSchedule( :vartype expires_at: ~datetime.datetime :ivar type: Identifies immediate scheduling after successful preparation. Required. Eligible automatically after successful preparation. - :vartype type: str or ~azure.ai.projects.models.IMMEDIATE + :vartype type: str or ~azure.ai.projects.models.TelephonyCampaignScheduleType """ type: Literal[TelephonyCampaignScheduleType.IMMEDIATE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -13112,7 +13112,7 @@ class InlineSkillParam( """InlineSkillParam. :ivar type: Defines an inline skill for this request. Required. INLINE. - :vartype type: str or ~azure.ai.projects.models.INLINE + :vartype type: str or ~azure.ai.projects.models.ContainerSkillType :ivar name: The name of the skill. Required. :vartype name: str :ivar description: The description of the skill. Required. @@ -13554,7 +13554,7 @@ class InsightScheduleTask( :ivar configuration: Configuration for the task. :vartype configuration: dict[str, str] :ivar type: Required. Insight task. - :vartype type: str or ~azure.ai.projects.models.INSIGHT + :vartype type: str or ~azure.ai.projects.models.ScheduleTaskType :ivar insight: The insight payload. Required. :vartype insight: ~azure.ai.projects.models.Insight """ @@ -13722,7 +13722,7 @@ class InvokeAgentInvocationsApiDispatchPayload( :ivar type: The manual dispatch payload type. Required. A manual payload for an invocations API routine dispatch. - :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_INVOCATIONS_API + :vartype type: str or ~azure.ai.projects.models.RoutineDispatchPayloadType :ivar input: The JSON value sent as the complete downstream invocations input. The value is passed through as-is and can be an object, string, number, boolean, array, or null. Required. :vartype input: any @@ -13795,7 +13795,7 @@ class InvokeAgentInvocationsApiRoutineAction( agent_endpoint_id must be provided. :ivar type: The action type. Required. Dispatches through the raw invocations API. - :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_INVOCATIONS_API + :vartype type: str or ~azure.ai.projects.models.RoutineActionType :ivar agent_name: The project-scoped agent name for routine dispatch. :vartype agent_name: str :ivar agent_endpoint_id: Legacy endpoint-scoped agent identifier for routine dispatch. @@ -13850,7 +13850,7 @@ class InvokeAgentResponsesApiDispatchPayload( :ivar type: The manual dispatch payload type. Required. A manual payload for a responses API routine dispatch. - :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_RESPONSES_API + :vartype type: str or ~azure.ai.projects.models.RoutineDispatchPayloadType :ivar input: The JSON value sent as the complete downstream responses input. The value is passed through as-is and can be an object, string, number, boolean, array, or null. Required. :vartype input: any @@ -13889,7 +13889,7 @@ class InvokeAgentResponsesApiRoutineAction( must be provided. :ivar type: The action type. Required. Dispatches through the responses API. - :vartype type: str or ~azure.ai.projects.models.INVOKE_AGENT_RESPONSES_API + :vartype type: str or ~azure.ai.projects.models.RoutineActionType :ivar agent_name: The project-scoped agent name for routine dispatch. :vartype agent_name: str :ivar agent_endpoint_id: Legacy endpoint-scoped agent identifier for routine dispatch. @@ -14197,7 +14197,7 @@ class LiveClientEventLiveCommentaryAppendParam( :vartype event_id: str :ivar type: The Live client event type. Always ``session.commentary.append``. Required. SESSION_COMMENTARY_APPEND. - :vartype type: str or ~azure.ai.projects.models.SESSION_COMMENTARY_APPEND + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar delegation_id: Required. :vartype delegation_id: str :ivar content: Speakable context for the Live model, limited to 500 tokens. Use this for a @@ -14245,7 +14245,7 @@ class LiveClientEventLiveDecisionCreateParam( :ivar event_id: Required. :vartype event_id: str :ivar type: Required. DECISION_CREATE. - :vartype type: str or ~azure.ai.projects.models.DECISION_CREATE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -14281,7 +14281,7 @@ class LiveClientEventLiveDecisionItemCreateParam( :ivar event_id: :vartype event_id: str :ivar type: Required. DECISION_ITEM_CREATE. - :vartype type: str or ~azure.ai.projects.models.DECISION_ITEM_CREATE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar item: Required. :vartype item: ~azure.ai.projects.models.LiveDecisionInputItemParam """ @@ -14321,7 +14321,7 @@ class LiveClientEventLiveDecisionItemDeleteParam( :ivar event_id: :vartype event_id: str :ivar type: Required. DECISION_ITEM_DELETE. - :vartype type: str or ~azure.ai.projects.models.DECISION_ITEM_DELETE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar item_id: Required. :vartype item_id: str """ @@ -14362,7 +14362,7 @@ class LiveClientEventLiveInputAudioAppendEvent( :vartype event_id: str :ivar type: The Live client event type. Always ``session.input_audio.append``. Required. SESSION_INPUT_AUDIO_APPEND. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_AUDIO_APPEND + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar audio: Base64-encoded raw audio in the startup-selected format, without a WAV or other container header. Primary WebSocket only; media transports use their audio track. Audio appends have no acknowledgment. Reflected sideband server events reuse this event type and audio key, @@ -14410,7 +14410,7 @@ class LiveClientEventLiveInputAudioMuteParam( :vartype event_id: str :ivar type: The Live client event type. Always ``session.input_audio.mute``. Required. SESSION_INPUT_AUDIO_MUTE. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_AUDIO_MUTE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -14448,7 +14448,7 @@ class LiveClientEventLiveInputAudioUnmuteParam( :vartype event_id: str :ivar type: The Live client event type. Always ``session.input_audio.unmute``. Required. SESSION_INPUT_AUDIO_UNMUTE. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_AUDIO_UNMUTE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -14488,7 +14488,7 @@ class LiveClientEventLiveInstructionsAppendParam( :vartype event_id: str :ivar type: The Live client event type. Always ``session.instructions.append``. Required. SESSION_INSTRUCTIONS_APPEND. - :vartype type: str or ~azure.ai.projects.models.SESSION_INSTRUCTIONS_APPEND + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar delegation_id: Required. :vartype delegation_id: str :ivar content: Instruction text to append, limited to 500 tokens. This is a plain string, not @@ -14541,7 +14541,7 @@ class LiveClientEventLiveOutputAudioFixturePlayParam( :ivar event_id: :vartype event_id: str :ivar type: Required. SESSION_OUTPUT_AUDIO_FIXTURE_PLAY. - :vartype type: str or ~azure.ai.projects.models.SESSION_OUTPUT_AUDIO_FIXTURE_PLAY + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar audio: Base64-encoded raw mono PCM16 audio, little-endian, at 24 kHz. Do not include a WAV or other container header. Required. :vartype audio: str @@ -14583,7 +14583,7 @@ class LiveClientEventLiveResponseCreateParam( :ivar event_id: :vartype event_id: str :ivar type: The Live client event type. Always ``response.create``. Required. RESPONSE_CREATE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_CREATE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -14619,7 +14619,7 @@ class LiveClientEventLiveResponseItemCreateParam( :vartype event_id: str :ivar type: The Live client event type. Always ``response.item.create``. Required. RESPONSE_ITEM_CREATE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_ITEM_CREATE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar item: An input item to append to the Responses backend conversation, such as a user message or a function tool result. Required. :vartype item: dict[str, any] @@ -14661,7 +14661,7 @@ class LiveClientEventLiveSessionCloseParam( :ivar event_id: :vartype event_id: str :ivar type: The Live client event type. Always ``session.close``. Required. SESSION_CLOSE. - :vartype type: str or ~azure.ai.projects.models.SESSION_CLOSE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -14696,7 +14696,7 @@ class LiveClientEventLiveSessionUpdateParam( :ivar event_id: :vartype event_id: str :ivar type: The Live client event type. Always ``session.update``. Required. SESSION_UPDATE. - :vartype type: str or ~azure.ai.projects.models.SESSION_UPDATE + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar session: Sparse delegation and trigger updates. Omitted settings retain their values. The delegation type cannot change. Model, frontend instructions, audio, and startup input are immutable. Required. @@ -14741,7 +14741,7 @@ class LiveClientEventLiveThinkingAppendParam( :vartype event_id: str :ivar type: The Live client event type. Always ``session.thinking.append``. Required. SESSION_THINKING_APPEND. - :vartype type: str or ~azure.ai.projects.models.SESSION_THINKING_APPEND + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar delegation_id: Required. :vartype delegation_id: str :ivar content: Silent reasoning or progress context, limited to 500 tokens. It does not @@ -15057,7 +15057,7 @@ class LiveDecisionChoiceQuestionParam( """LiveDecisionChoiceQuestionParam. :ivar type: Required. CHOICE. - :vartype type: str or ~azure.ai.projects.models.CHOICE + :vartype type: str or ~azure.ai.projects.models.LiveDecisionQuestionType :ivar name: :vartype name: str :ivar instructions: Required. Is either a str type or a @@ -15203,7 +15203,7 @@ class LiveDecisionCustomToolCallOutputParam( :ivar status: Known values are: "in_progress", "completed", and "incomplete". :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: Required. CUSTOM_TOOL_CALL_OUTPUT. - :vartype type: str or ~azure.ai.projects.models.CUSTOM_TOOL_CALL_OUTPUT + :vartype type: str or ~azure.ai.projects.models.LiveDecisionInputItemParamType :ivar output: Required. Is either a str type or a [Union["_models.LiveDecisionInputTextParam", "_models.LiveDecisionInputImageParam"]] type. :vartype output: str or list[~azure.ai.projects.models.LiveDecisionInputTextParam or @@ -15259,7 +15259,7 @@ class LiveDecisionCustomToolCallParam( :ivar status: Known values are: "in_progress", "completed", and "incomplete". :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: The item type. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL. - :vartype type: str or ~azure.ai.projects.models.CUSTOM_TOOL_CALL + :vartype type: str or ~azure.ai.projects.models.LiveDecisionInputItemParamType :ivar name: The name of the custom tool to call. Required. :vartype name: str :ivar namespace: @@ -15320,7 +15320,7 @@ class LiveDecisionFunctionCallOutputParam( :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: The type of the function tool call output. Always ``function_call_output``. Required. FUNCTION_CALL_OUTPUT. - :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL_OUTPUT + :vartype type: str or ~azure.ai.projects.models.LiveDecisionInputItemParamType :ivar output: Required. Is either a str type or a [Union["_models.LiveDecisionInputTextParam", "_models.LiveDecisionInputImageParam"]] type. :vartype output: str or list[~azure.ai.projects.models.LiveDecisionInputTextParam or @@ -15377,7 +15377,7 @@ class LiveDecisionFunctionCallParam( :ivar status: Known values are: "in_progress", "completed", and "incomplete". :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: The item type. Always ``function_call``. Required. FUNCTION_CALL. - :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL + :vartype type: str or ~azure.ai.projects.models.LiveDecisionInputItemParamType :ivar name: Required. :vartype name: str :ivar namespace: @@ -15470,7 +15470,7 @@ class LiveDecisionInputItemParamMessage(LiveDecisionInputItemParam, discriminato """LiveDecisionInputItemParamMessage. :ivar type: Required. MESSAGE. - :vartype type: str or ~azure.ai.projects.models.MESSAGE + :vartype type: str or ~azure.ai.projects.models.LiveDecisionInputItemParamType """ type: Literal[LiveDecisionInputItemParamType.MESSAGE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -15573,7 +15573,7 @@ class LiveDecisionPredicateQuestionParam( """LiveDecisionPredicateQuestionParam. :ivar type: Required. PREDICATE. - :vartype type: str or ~azure.ai.projects.models.PREDICATE + :vartype type: str or ~azure.ai.projects.models.LiveDecisionQuestionType :ivar name: :vartype name: str :ivar instructions: Required. Is either a str type or a @@ -15697,7 +15697,7 @@ class LiveDecisionScoreQuestionParam( """LiveDecisionScoreQuestionParam. :ivar type: Required. SCORE. - :vartype type: str or ~azure.ai.projects.models.SCORE + :vartype type: str or ~azure.ai.projects.models.LiveDecisionQuestionType :ivar name: :vartype name: str :ivar instructions: Required. Is either a str type or a @@ -15807,7 +15807,7 @@ class LiveDecisionsDelegationUpdateParam( delegations. :vartype acknowledgement_delay_ms: int :ivar type: Required. DECISIONS. - :vartype type: str or ~azure.ai.projects.models.DECISIONS + :vartype type: str or ~azure.ai.projects.models.LiveSessionUpdateParamsDelegationType :ivar decisions: :vartype decisions: ~azure.ai.projects.models.LiveDecisionsSettingsUpdateParam """ @@ -15961,7 +15961,7 @@ class LiveDecisionStoredCustomToolCallOutputParam( :ivar status: Known values are: "in_progress", "completed", and "incomplete". :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: Required. CUSTOM_TOOL_CALL_OUTPUT. - :vartype type: str or ~azure.ai.projects.models.CUSTOM_TOOL_CALL_OUTPUT + :vartype type: str or ~azure.ai.projects.models.LiveDecisionStoredInputItemParamType :ivar output: Required. Is either a str type or a [Union["_models.LiveDecisionInputTextParam", "_models.LiveDecisionInputImageParam"]] type. :vartype output: str or list[~azure.ai.projects.models.LiveDecisionInputTextParam or @@ -16018,7 +16018,7 @@ class LiveDecisionStoredCustomToolCallParam( :ivar status: Known values are: "in_progress", "completed", and "incomplete". :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: The item type. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL. - :vartype type: str or ~azure.ai.projects.models.CUSTOM_TOOL_CALL + :vartype type: str or ~azure.ai.projects.models.LiveDecisionStoredInputItemParamType :ivar name: The name of the custom tool to call. Required. :vartype name: str :ivar namespace: @@ -16080,7 +16080,7 @@ class LiveDecisionStoredFunctionCallOutputParam( :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: The type of the function tool call output. Always ``function_call_output``. Required. FUNCTION_CALL_OUTPUT. - :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL_OUTPUT + :vartype type: str or ~azure.ai.projects.models.LiveDecisionStoredInputItemParamType :ivar output: Required. Is either a str type or a [Union["_models.LiveDecisionInputTextParam", "_models.LiveDecisionInputImageParam"]] type. :vartype output: str or list[~azure.ai.projects.models.LiveDecisionInputTextParam or @@ -16138,7 +16138,7 @@ class LiveDecisionStoredFunctionCallParam( :ivar status: Known values are: "in_progress", "completed", and "incomplete". :vartype status: str or ~azure.ai.projects.models.LiveFunctionCallItemStatus :ivar type: The item type. Always ``function_call``. Required. FUNCTION_CALL. - :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL + :vartype type: str or ~azure.ai.projects.models.LiveDecisionStoredInputItemParamType :ivar name: Required. :vartype name: str :ivar namespace: @@ -16191,7 +16191,7 @@ class LiveDecisionStoredInputItemParamMessage(LiveDecisionStoredInputItemParam, """LiveDecisionStoredInputItemParamMessage. :ivar type: Required. MESSAGE. - :vartype type: str or ~azure.ai.projects.models.MESSAGE + :vartype type: str or ~azure.ai.projects.models.LiveDecisionStoredInputItemParamType """ type: Literal[LiveDecisionStoredInputItemParamType.MESSAGE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -16630,7 +16630,7 @@ class LiveInitialAssistantMessageItemParam( :ivar status: Known values are: "incomplete" and "completed". :vartype status: str or ~azure.ai.projects.models.LiveInitialMessageStatus :ivar role: The author of this history message. Always ``assistant``. Required. ASSISTANT. - :vartype role: str or ~azure.ai.projects.models.ASSISTANT + :vartype role: str or ~azure.ai.projects.models.LiveInitialItemType :ivar content: The message content. Supply exactly one text part for the initial Live conversation history. Required. :vartype content: list[~azure.ai.projects.models.LiveInitialTextContentPartParam or @@ -16688,7 +16688,7 @@ class LiveInitialDeveloperMessageItemParam( :ivar status: Known values are: "incomplete" and "completed". :vartype status: str or ~azure.ai.projects.models.LiveInitialMessageStatus :ivar role: The author of this history message. Always ``developer``. Required. DEVELOPER. - :vartype role: str or ~azure.ai.projects.models.DEVELOPER + :vartype role: str or ~azure.ai.projects.models.LiveInitialItemType :ivar content: The message content. Supply exactly one text part for the initial Live conversation history. Required. :vartype content: list[~azure.ai.projects.models.LiveInitialInputTextContentPartParam] @@ -17004,7 +17004,7 @@ class LiveInitialUserMessageItemParam( :ivar status: Known values are: "incomplete" and "completed". :vartype status: str or ~azure.ai.projects.models.LiveInitialMessageStatus :ivar role: The author of this history message. Always ``user``. Required. USER. - :vartype role: str or ~azure.ai.projects.models.USER + :vartype role: str or ~azure.ai.projects.models.LiveInitialItemType :ivar content: The message content. Supply exactly one text part for the initial Live conversation history. Required. :vartype content: list[~azure.ai.projects.models.LiveInitialInputTextContentPartParam] @@ -17203,7 +17203,7 @@ class LiveInputAudioAppend( :ivar type: The event type, always ``session.input_audio.append``. Required. SESSION_INPUT_AUDIO_APPEND. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_AUDIO_APPEND + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar audio: Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, reflected to the sideband before model-input muting. This server event uses the same audio key as the client command, but is not an acknowledgment of it. Required. @@ -17436,7 +17436,7 @@ class LiveOutputAudioDelta( :ivar type: The event type, always ``session.output_audio.delta``. Required. SESSION_OUTPUT_AUDIO_DELTA. - :vartype type: str or ~azure.ai.projects.models.SESSION_OUTPUT_AUDIO_DELTA + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar delta: Base64-encoded raw audio. Primary WebSocket events use the session's configured format; reflected sideband events use mono PCM16LE at 24 kHz. Required. :vartype delta: str @@ -17882,7 +17882,7 @@ class LiveResponsesDelegationUpdateParam( :vartype acknowledgement_delay_ms: int :ivar type: The delegation owner. Always ``responses`` for tasks handled by the Responses API. Required. RESPONSES. - :vartype type: str or ~azure.ai.projects.models.RESPONSES + :vartype type: str or ~azure.ai.projects.models.LiveSessionUpdateParamsDelegationType :ivar responses: Responses backend settings to update. Omitted settings keep their existing values. :vartype responses: ~azure.ai.projects.models.LiveResponsesDelegationSettingsUpdateInputParam @@ -17942,7 +17942,7 @@ class LiveServerEventLiveCommentaryAppended( :vartype end_ms: int :ivar type: The event type, always ``session.commentary.appended``. Required. SESSION_COMMENTARY_APPENDED. - :vartype type: str or ~azure.ai.projects.models.SESSION_COMMENTARY_APPENDED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -17987,7 +17987,7 @@ class LiveServerEventLiveDecisionEvent( source_event_id identifies the transcript delta that caused this evaluation. :ivar type: Required. DECISION_EVENT. - :vartype type: str or ~azure.ai.projects.models.DECISION_EVENT + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar event_id: The unique ID of this Live server event. Required. :vartype event_id: str :ivar delegation_id: Required. @@ -18056,7 +18056,7 @@ class LiveServerEventLiveDecisionItemCreated( when supplied. :vartype client_event_id: str :ivar type: Required. DECISION_ITEM_CREATED. - :vartype type: str or ~azure.ai.projects.models.DECISION_ITEM_CREATED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar item: Required. :vartype item: ~azure.ai.projects.models.LiveDecisionStoredInputItemParam """ @@ -18104,7 +18104,7 @@ class LiveServerEventLiveDecisionItemDeleted( when supplied. :vartype client_event_id: str :ivar type: Required. DECISION_ITEM_DELETED. - :vartype type: str or ~azure.ai.projects.models.DECISION_ITEM_DELETED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar item_id: Required. :vartype item_id: str """ @@ -18153,7 +18153,7 @@ class LiveServerEventLiveDelegationCreated( :vartype client_event_id: str :ivar type: The event type, always ``session.delegation.created``. Required. SESSION_DELEGATION_CREATED. - :vartype type: str or ~azure.ai.projects.models.SESSION_DELEGATION_CREATED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar offset_ms: The position on the Live session timeline where the delegation was created, in milliseconds from the beginning of the session. Required. :vartype offset_ms: int @@ -18211,7 +18211,7 @@ class LiveServerEventLiveErrorEvent( when supplied. :vartype client_event_id: str :ivar type: The event type, always ``error``. Required. ERROR. - :vartype type: str or ~azure.ai.projects.models.ERROR + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar error: Details of the Live error and the client command that caused it, when known. Required. :vartype error: ~azure.ai.projects.models.LiveLiveError @@ -18259,7 +18259,7 @@ class LiveServerEventLiveInfoEvent( when supplied. :vartype client_event_id: str :ivar type: The event type, always ``info``. Required. INFO. - :vartype type: str or ~azure.ai.projects.models.INFO + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar code: A machine-readable code for the notice, such as ``data_channel_permissions``. Required. :vartype code: str @@ -18313,7 +18313,7 @@ class LiveServerEventLiveInputAudioMuted( :vartype client_event_id: str :ivar type: The event type, always ``session.input_audio.muted``. Required. SESSION_INPUT_AUDIO_MUTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_AUDIO_MUTED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18357,7 +18357,7 @@ class LiveServerEventLiveInputAudioUnmuted( :vartype client_event_id: str :ivar type: The event type, always ``session.input_audio.unmuted``. Required. SESSION_INPUT_AUDIO_UNMUTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_AUDIO_UNMUTED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18409,7 +18409,7 @@ class LiveServerEventLiveInputTranscriptDelta( :vartype delta: str :ivar type: The event type, always ``session.input_transcript.delta``. Required. SESSION_INPUT_TRANSCRIPT_DELTA. - :vartype type: str or ~azure.ai.projects.models.SESSION_INPUT_TRANSCRIPT_DELTA + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18471,7 +18471,7 @@ class LiveServerEventLiveInstructionsAppended( :vartype end_ms: int :ivar type: The event type, always ``session.instructions.appended``. Required. SESSION_INSTRUCTIONS_APPENDED. - :vartype type: str or ~azure.ai.projects.models.SESSION_INSTRUCTIONS_APPENDED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18524,7 +18524,7 @@ class LiveServerEventLiveOutputAudioFixturePlayed( when supplied. :vartype client_event_id: str :ivar type: Required. SESSION_OUTPUT_AUDIO_FIXTURE_PLAYED. - :vartype type: str or ~azure.ai.projects.models.SESSION_OUTPUT_AUDIO_FIXTURE_PLAYED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18567,7 +18567,7 @@ class LiveServerEventLiveOutputAudioFixturePlaying( when supplied. :vartype client_event_id: str :ivar type: Required. SESSION_OUTPUT_AUDIO_FIXTURE_PLAYING. - :vartype type: str or ~azure.ai.projects.models.SESSION_OUTPUT_AUDIO_FIXTURE_PLAYING + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18619,7 +18619,7 @@ class LiveServerEventLiveOutputTranscriptDelta( :vartype delta: str :ivar type: The event type, always ``session.output_transcript.delta``. Required. SESSION_OUTPUT_TRANSCRIPT_DELTA. - :vartype type: str or ~azure.ai.projects.models.SESSION_OUTPUT_TRANSCRIPT_DELTA + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -18674,7 +18674,7 @@ class LiveServerEventLiveResponseEvent( when supplied. :vartype client_event_id: str :ivar type: The event type, always ``response.event``. Required. RESPONSE_EVENT. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_EVENT + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar delegation_id: :vartype delegation_id: str :ivar event: The nested Responses streaming event. Dispatch on its type field. Response @@ -18730,7 +18730,7 @@ class LiveServerEventLiveSessionClosed( when supplied. :vartype client_event_id: str :ivar type: The event type, always ``session.closed``. Required. SESSION_CLOSED. - :vartype type: str or ~azure.ai.projects.models.SESSION_CLOSED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar reason: Why the Live session ended: ``close_requested`` for an application close or hangup request, ``expired`` for the session duration limit, ``content`` for a safety filter, ``remote_hangup`` for a graceful remote disconnect, or ``connection_lost`` for an unexpected @@ -18796,7 +18796,7 @@ class LiveServerEventLiveSessionStarted( including server defaults. :ivar type: The event type, always ``session.started``. Required. SESSION_STARTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_STARTED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar event_id: The unique ID of the Live server event. Required. :vartype event_id: str :ivar client_event_id: The event_id of the client command associated with this server event, @@ -18852,7 +18852,7 @@ class LiveServerEventLiveSessionUpdated( after the update. :ivar type: The event type, always ``session.updated``. Required. SESSION_UPDATED. - :vartype type: str or ~azure.ai.projects.models.SESSION_UPDATED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar event_id: The unique ID of the Live server event. Required. :vartype event_id: str :ivar client_event_id: The event_id of the client command associated with this server event, @@ -18906,7 +18906,7 @@ class LiveServerEventLiveSessionUsageUpdated( when supplied. :vartype client_event_id: str :ivar type: The event type, always ``session.usage.updated``. Required. SESSION_USAGE_UPDATED. - :vartype type: str or ~azure.ai.projects.models.SESSION_USAGE_UPDATED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar usage: The cumulative Live audio usage so far. Required. :vartype usage: ~azure.ai.projects.models.LiveSessionUsage :ivar context_window: The latest measured Live context-window usage. Omitted when the context @@ -18968,7 +18968,7 @@ class LiveServerEventLiveThinkingAppended( :vartype end_ms: int :ivar type: The event type, always ``session.thinking.appended``. Required. SESSION_THINKING_APPENDED. - :vartype type: str or ~azure.ai.projects.models.SESSION_THINKING_APPENDED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -19017,7 +19017,7 @@ class LiveServerEventLiveTransportAnswered( :ivar session_id: The canonical Live session ID. Required. :vartype session_id: str :ivar type: Required. TRANSPORT_ANSWERED. - :vartype type: str or ~azure.ai.projects.models.TRANSPORT_ANSWERED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -19053,7 +19053,7 @@ class LiveServerEventLiveTransportDtmfReceived( """A SIP DTMF keypress received from the caller. Delivered only to sideband observers. :ivar type: Required. TRANSPORT_DTMF_RECEIVED. - :vartype type: str or ~azure.ai.projects.models.TRANSPORT_DTMF_RECEIVED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar event_id: Required. :vartype event_id: str :ivar event: Required. @@ -19094,7 +19094,7 @@ class LiveServerEventLiveTransportDtmfSent( this is not a client command. :ivar type: Required. TRANSPORT_DTMF_SENT. - :vartype type: str or ~azure.ai.projects.models.TRANSPORT_DTMF_SENT + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar event_id: Required. :vartype event_id: str :ivar event: Required. @@ -19143,7 +19143,7 @@ class LiveServerEventLiveTransportFailed( :ivar session_id: The canonical Live session ID. Required. :vartype session_id: str :ivar type: Required. TRANSPORT_FAILED. - :vartype type: str or ~azure.ai.projects.models.TRANSPORT_FAILED + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType :ivar error: Required. :vartype error: ~azure.ai.projects.models.LiveTransportCallError """ @@ -19189,7 +19189,7 @@ class LiveServerEventLiveTransportRinging( :ivar session_id: The canonical Live session ID. Required. :vartype session_id: str :ivar type: Required. TRANSPORT_RINGING. - :vartype type: str or ~azure.ai.projects.models.TRANSPORT_RINGING + :vartype type: str or ~azure.ai.projects.models.LiveServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -19225,7 +19225,7 @@ class LiveSessionAudioFormatPCMAParam( """Raw, mono G.711 A-law audio for a Live WebSocket connection. :ivar type: The audio encoding. Always ``audio/pcma``. Required. AUDIO_PCMA. - :vartype type: str or ~azure.ai.projects.models.AUDIO_PCMA + :vartype type: str or ~azure.ai.projects.models.LiveAudioFormatType :ivar rate: Audio sample rate in hertz. G.711 audio uses 8000 Hz. Required. :vartype rate: int """ @@ -19260,7 +19260,7 @@ class LiveSessionAudioFormatPCMParam( """Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection. :ivar type: The audio encoding. Always ``audio/pcm``. Required. AUDIO_PCM. - :vartype type: str or ~azure.ai.projects.models.AUDIO_PCM + :vartype type: str or ~azure.ai.projects.models.LiveAudioFormatType :ivar rate: Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. Required. Is either a Literal[16000] type or a Literal[24000] type. :vartype rate: int or int @@ -19297,7 +19297,7 @@ class LiveSessionAudioFormatPCMUParam( """Raw, mono G.711 μ-law audio for a Live WebSocket connection. :ivar type: The audio encoding. Always ``audio/pcmu``. Required. AUDIO_PCMU. - :vartype type: str or ~azure.ai.projects.models.AUDIO_PCMU + :vartype type: str or ~azure.ai.projects.models.LiveAudioFormatType :ivar rate: Audio sample rate in hertz. G.711 audio uses 8000 Hz. Required. :vartype rate: int """ @@ -19462,7 +19462,7 @@ class LiveSessionCreateParamsDelegationLiveClientDelegationParam( :vartype acknowledgement_delay_ms: int :ivar type: The delegation owner. Always ``client`` for tasks handled by your application. Required. CLIENT. - :vartype type: str or ~azure.ai.projects.models.CLIENT + :vartype type: str or ~azure.ai.projects.models.LiveSessionCreateParamsDelegationType """ acknowledgement_delay_ms: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -19505,7 +19505,7 @@ class LiveSessionCreateParamsDelegationLiveDecisionsDelegationParam( other delegations. Defaults to 400. Updates apply to subsequent delegations. :vartype acknowledgement_delay_ms: int :ivar type: Required. DECISIONS. - :vartype type: str or ~azure.ai.projects.models.DECISIONS + :vartype type: str or ~azure.ai.projects.models.LiveSessionCreateParamsDelegationType :ivar decisions: Required. :vartype decisions: ~azure.ai.projects.models.LiveDecisionsSettingsInputParam """ @@ -19556,7 +19556,7 @@ class LiveSessionCreateParamsDelegationLiveResponsesDelegationParam( :vartype acknowledgement_delay_ms: int :ivar type: The delegation owner. Always ``responses`` for tasks handled by the Responses API. Required. RESPONSES. - :vartype type: str or ~azure.ai.projects.models.RESPONSES + :vartype type: str or ~azure.ai.projects.models.LiveSessionCreateParamsDelegationType :ivar responses: Backend model, prompt, and tools used when the Live session delegates a task to Responses. Required. :vartype responses: ~azure.ai.projects.models.LiveResponsesDelegationSettingsInputParam @@ -19606,7 +19606,7 @@ class LiveSessionStartEvent( :ivar event_id: :vartype event_id: str :ivar type: The Live client event type. Always ``session.start``. Required. SESSION_START. - :vartype type: str or ~azure.ai.projects.models.SESSION_START + :vartype type: str or ~azure.ai.projects.models.LiveClientEventType :ivar session: Initial configuration for a primary WebSocket. Send session.start first and wait for session.started before application commands. WebRTC creation already starts the session; do not send this event again on its data channel. Required. @@ -19696,7 +19696,7 @@ class LiveSessionUpdateParamsDelegationLiveClientDelegationParam( :vartype acknowledgement_delay_ms: int :ivar type: The delegation owner. Always ``client`` for tasks handled by your application. Required. CLIENT. - :vartype type: str or ~azure.ai.projects.models.CLIENT + :vartype type: str or ~azure.ai.projects.models.LiveSessionUpdateParamsDelegationType """ acknowledgement_delay_ms: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -20051,7 +20051,7 @@ class LocalShellToolParam( """Local shell tool. :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. - :vartype type: str or ~azure.ai.projects.models.LOCAL_SHELL + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: Deprecated. This property is deprecated and will be removed in a future version. :vartype name: str :ivar description: Deprecated. This property is deprecated and will be removed in a future @@ -20224,7 +20224,7 @@ class ManagedAgentIdentityBlueprintReference( """ManagedAgentIdentityBlueprintReference. :ivar type: Required. MANAGED_AGENT_IDENTITY_BLUEPRINT. - :vartype type: str or ~azure.ai.projects.models.MANAGED_AGENT_IDENTITY_BLUEPRINT + :vartype type: str or ~azure.ai.projects.models.AgentBlueprintReferenceType :ivar blueprint_id: The ID of the managed blueprint. Required. :vartype blueprint_id: str """ @@ -20269,7 +20269,7 @@ class ManagedAzureAISearchIndex( :ivar tags: Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] :ivar type: Type of index. Required. Managed Azure Search. - :vartype type: str or ~azure.ai.projects.models.MANAGED_AZURE_SEARCH + :vartype type: str or ~azure.ai.projects.models.IndexType :ivar vector_store_id: Vector store id of managed index. Required. :vartype vector_store_id: str """ @@ -20361,7 +20361,7 @@ class MCPTool(Tool, discriminator="mcp"): # pylint: disable=docstring-keyword-s """MCP tool. :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. - :vartype type: str or ~azure.ai.projects.models.MCP + :vartype type: str or ~azure.ai.projects.models.ToolType :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``, ``connector_id``, or @@ -20541,7 +20541,7 @@ class MCPToolboxTool(ToolboxTool, discriminator="mcp"): # pylint: disable=docst are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. MCP. - :vartype type: str or ~azure.ai.projects.models.MCP + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :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``, ``connector_id``, or @@ -20874,7 +20874,7 @@ class MemorySearchPreviewTool( :ivar type: The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.MEMORY_SEARCH_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :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 @@ -20963,7 +20963,7 @@ class MemoryStoreDefaultDefinition( """Default memory store implementation. :ivar kind: The kind of the memory store. Required. The default memory store implementation. - :vartype kind: str or ~azure.ai.projects.models.DEFAULT + :vartype kind: str or ~azure.ai.projects.models.MemoryStoreKind :ivar chat_model: The name or identifier of the chat completion model deployment used for memory processing. Required. :vartype chat_model: str @@ -21067,7 +21067,7 @@ class MemoryStoreDeleteScopeResult(_Model): # pylint: disable=docstring-keyword :ivar object: The object type. Always 'memory_store.scope.deleted'. Required. MEMORY_STORE_SCOPE_DELETED. - :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE_SCOPE_DELETED + :vartype object: str or ~azure.ai.projects.models.MemoryStoreObjectType :ivar name: The name of the memory store. Required. :vartype name: str :ivar scope: The scope from which memories were deleted. Required. @@ -21112,7 +21112,7 @@ class MemoryStoreDetails(_Model): # pylint: disable=docstring-keyword-should-ma """A memory store that can store and retrieve user memories. :ivar object: The object type, which is always 'memory_store'. Required. MEMORY_STORE. - :vartype object: str or ~azure.ai.projects.models.MEMORY_STORE + :vartype object: str or ~azure.ai.projects.models.MemoryStoreObjectType :ivar id: The unique identifier of the memory store. Required. :vartype id: str :ivar created_at: The Unix timestamp (seconds) when the memory store was created. Required. @@ -21679,7 +21679,7 @@ class MicrosoftCopilotToolsetPreview( :ivar type: The type of the toolset. Always ``microsoft_copilot_toolset_preview``. Required. MICROSOFT_COPILOT_TOOLSET_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.MICROSOFT_COPILOT_TOOLSET_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar default_config: The default configuration for built-in tools. If omitted, built-in tools are enabled by default. :vartype default_config: ~azure.ai.projects.models.MicrosoftCopilotToolsetDefaultConfig @@ -21727,7 +21727,7 @@ class MicrosoftFabricPreviewTool( :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. FABRIC_DATAAGENT_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.FABRIC_DATAAGENT_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. :vartype fabric_dataagent_preview: ~azure.ai.projects.models.FabricDataAgentToolParameters """ @@ -21871,7 +21871,7 @@ class ModelDeployment(Deployment, discriminator="ModelDeployment"): :ivar name: Name of the deployment. Required. :vartype name: str :ivar type: The type of the deployment. Required. Model deployment. - :vartype type: str or ~azure.ai.projects.models.MODEL_DEPLOYMENT + :vartype type: str or ~azure.ai.projects.models.DeploymentType :ivar model_name: Publisher-specific name of the deployed model. Required. :vartype model_name: str :ivar model_version: Publisher-specific version of the deployed model. Required. @@ -21976,7 +21976,7 @@ class ModelPendingUploadRequest(_Model): # pylint: disable=docstring-keyword-sh :vartype connection_name: str :ivar pending_upload_type: The type of pending upload. Only TemporaryBlobReference is supported for models. Required. Temporary blob reference. - :vartype pending_upload_type: str or ~azure.ai.projects.models.TEMPORARY_BLOB_REFERENCE + :vartype pending_upload_type: str or ~azure.ai.projects.models.PendingUploadType """ pending_upload_id: Optional[str] = rest_field( @@ -22025,7 +22025,7 @@ class ModelPendingUploadResponse(_Model): # pylint: disable=docstring-keyword-s :vartype version: str :ivar pending_upload_type: The type of pending upload. Only TemporaryBlobReference is supported for models. Required. Temporary blob reference. - :vartype pending_upload_type: str or ~azure.ai.projects.models.TEMPORARY_BLOB_REFERENCE + :vartype pending_upload_type: str or ~azure.ai.projects.models.PendingUploadType """ blob_reference: "_models.BlobReference" = rest_field( @@ -22236,7 +22236,7 @@ class MonthlyRecurrenceSchedule( """Monthly recurrence schedule. :ivar type: Monthly recurrence type. Required. Monthly recurrence pattern. - :vartype type: str or ~azure.ai.projects.models.MONTHLY + :vartype type: str or ~azure.ai.projects.models.RecurrenceType :ivar days_of_month: Days of the month for the recurrence schedule. Required. :vartype days_of_month: list[int] """ @@ -22273,7 +22273,7 @@ class NamespaceToolParam( """Namespace. :ivar type: The type of the tool. Always ``namespace``. Required. NAMESPACE. - :vartype type: str or ~azure.ai.projects.models.NAMESPACE + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar name: The namespace name used in tool calls (for example, ``crm``). Required. :vartype name: str :ivar description: A description of the namespace shown to the model. Required. @@ -22319,7 +22319,7 @@ class NoAuthenticationCredentials(BaseCredentials, discriminator="None"): """Credentials that do not require authentication. :ivar type: The credential type. Required. No credential. - :vartype type: str or ~azure.ai.projects.models.NONE + :vartype type: str or ~azure.ai.projects.models.CredentialType """ type: Literal[CredentialType.NONE] = rest_discriminator(name="type", visibility=["read"]) # type: ignore @@ -22346,7 +22346,7 @@ class OneTimeTrigger(Trigger, discriminator="OneTime"): # pylint: disable=docst """One-time trigger. :ivar type: Required. One-time trigger. - :vartype type: str or ~azure.ai.projects.models.ONE_TIME + :vartype type: str or ~azure.ai.projects.models.TriggerType :ivar trigger_at: Date and time for the one-time trigger in ISO 8601 format. Required. :vartype trigger_at: ~datetime.datetime :ivar time_zone: Time zone for the one-time trigger. Defaults to ``UTC``. @@ -22420,7 +22420,7 @@ class OpenApiAnonymousAuthDetails(OpenApiAuthDetails, discriminator="anonymous") """Security details for OpenApi anonymous authentication. :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. - :vartype type: str or ~azure.ai.projects.models.ANONYMOUS + :vartype type: str or ~azure.ai.projects.models.OpenApiAuthType """ type: Literal[OpenApiAuthType.ANONYMOUS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -22544,7 +22544,7 @@ class OpenApiManagedAuthDetails( """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.projects.models.MANAGED_IDENTITY + :vartype type: str or ~azure.ai.projects.models.OpenApiAuthType :ivar security_scheme: Connection auth security details. Required. :vartype security_scheme: ~azure.ai.projects.models.OpenApiManagedSecurityScheme """ @@ -22610,7 +22610,7 @@ class OpenApiProjectConnectionAuthDetails( :ivar type: The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION. - :vartype type: str or ~azure.ai.projects.models.PROJECT_CONNECTION + :vartype type: str or ~azure.ai.projects.models.OpenApiAuthType :ivar security_scheme: Project connection auth security details. Required. :vartype security_scheme: ~azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme """ @@ -22673,7 +22673,7 @@ class OpenApiTool(Tool, discriminator="openapi"): # pylint: disable=docstring-k """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.projects.models.OPENAPI + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar tool_configs: Deprecated. This property is deprecated and will be removed in a future version. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] @@ -22726,7 +22726,7 @@ class OpenApiToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. OPENAPI. - :vartype type: str or ~azure.ai.projects.models.OPENAPI + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar openapi: The openapi function definition. Required. :vartype openapi: ~azure.ai.projects.models.OpenApiFunctionDefinition """ @@ -22851,7 +22851,7 @@ class OtlpTelemetryEndpoint( :vartype auth: ~azure.ai.projects.models.TelemetryEndpointAuth :ivar kind: The endpoint kind, always 'OTLP' for OpenTelemetry Protocol endpoints. Required. OpenTelemetry Protocol (OTLP) endpoint. - :vartype kind: str or ~azure.ai.projects.models.OTLP + :vartype kind: str or ~azure.ai.projects.models.TelemetryEndpointKind :ivar endpoint: The OTLP collector endpoint URL. Required. :vartype endpoint: str :ivar protocol: The transport protocol for the OTLP endpoint. Required. Known values are: @@ -22930,7 +22930,7 @@ class PendingUploadRequest(_Model): # pylint: disable=docstring-keyword-should- :vartype connection_name: str :ivar pending_upload_type: The type of pending upload. Required. Deprecated: the service never read this value and silently ignored it. Use TemporaryBlobReference instead. - :vartype pending_upload_type: str or ~azure.ai.projects.models.BLOB_REFERENCE + :vartype pending_upload_type: str or ~azure.ai.projects.models.PendingUploadType """ pending_upload_id: Optional[str] = rest_field( @@ -22979,7 +22979,7 @@ class PendingUploadResponse(_Model): # pylint: disable=docstring-keyword-should :vartype version: str :ivar pending_upload_type: The type of pending upload. Required. Deprecated: the service never read this value and silently ignored it. Use TemporaryBlobReference instead. - :vartype pending_upload_type: str or ~azure.ai.projects.models.BLOB_REFERENCE + :vartype pending_upload_type: str or ~azure.ai.projects.models.PendingUploadType """ blob_reference: "_models.BlobReference" = rest_field( @@ -23030,7 +23030,7 @@ class PerRecipientSchedule( :vartype expires_at: ~datetime.datetime :ivar type: Identifies scheduling with a separate earliest dispatch time for each recipient. Required. A separate earliest dispatch time for each recipient. - :vartype type: str or ~azure.ai.projects.models.RECIPIENT + :vartype type: str or ~azure.ai.projects.models.TelephonyCampaignScheduleType """ type: Literal[TelephonyCampaignScheduleType.RECIPIENT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -23103,7 +23103,7 @@ class PhoneNumber( """Phone-number address used by supported source and destination roles. :ivar type: The phone-number address type. Required. An E.164 phone number. - :vartype type: str or ~azure.ai.projects.models.PHONE_NUMBER + :vartype type: str or ~azure.ai.projects.models.TelephonyAddressType :ivar value: E.164 phone number. Required. :vartype value: str """ @@ -23176,7 +23176,7 @@ class ProceduralMemoryItem( :vartype content: str :ivar kind: The kind of the memory item. Required. Routine procedures extracted from conversations. - :vartype kind: str or ~azure.ai.projects.models.PROCEDURAL + :vartype kind: str or ~azure.ai.projects.models.MemoryItemKind """ kind: Literal[MemoryItemKind.PROCEDURAL] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -23209,7 +23209,7 @@ class ProgrammaticToolCallingParam(Tool, discriminator="programmatic_tool_callin :ivar type: The type of the tool. Always ``programmatic_tool_calling``. Required. PROGRAMMATIC_TOOL_CALLING. - :vartype type: str or ~azure.ai.projects.models.PROGRAMMATIC_TOOL_CALLING + :vartype type: str or ~azure.ai.projects.models.ToolType """ type: Literal[ToolType.PROGRAMMATIC_TOOL_CALLING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -23241,7 +23241,7 @@ class PromptAgentDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Required. PROMPT. - :vartype kind: str or ~azure.ai.projects.models.PROMPT + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar harness: The managed runtime and agent loop used to execute this prompt agent. :vartype harness: ~azure.ai.projects.models.AgentHarness :ivar model: The model deployment to use for this agent. Required. @@ -23395,7 +23395,7 @@ class PromptBasedEvaluatorDefinition( :ivar metrics: List of output metrics produced by this evaluator. :vartype metrics: dict[str, ~azure.ai.projects.models.EvaluatorMetric] :ivar type: Required. Prompt-based definition. - :vartype type: str or ~azure.ai.projects.models.PROMPT + :vartype type: str or ~azure.ai.projects.models.EvaluatorDefinitionType :ivar prompt_text: The prompt text used for evaluation. Required. :vartype prompt_text: str """ @@ -23438,7 +23438,7 @@ class PromptDataGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Prompt. Required. Prompt source — inline text provided by the user. - :vartype type: str or ~azure.ai.projects.models.PROMPT + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobSourceType :ivar prompt: Inline prompt text (e.g., agent description, policy text, supplementary context). Required. :vartype prompt: str @@ -23481,7 +23481,7 @@ class PromptEvaluatorGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Prompt. Required. Prompt source — inline text provided by the user. - :vartype type: str or ~azure.ai.projects.models.PROMPT + :vartype type: str or ~azure.ai.projects.models.EvaluatorGenerationJobSourceType :ivar prompt: Inline prompt text (e.g., agent description, policy text, supplementary context). Required. :vartype prompt: str @@ -23522,7 +23522,7 @@ class PromptOptimizationConfiguration( """Configuration for a one-shot prompt transformation without comparative evaluation. :ivar type: Optimization type discriminator. Required. One-shot prompt optimization. - :vartype type: str or ~azure.ai.projects.models.PROMPT_OPTIMIZATION + :vartype type: str or ~azure.ai.projects.models.AgentOptimizationConfigurationType :ivar context: Context used to steer prompt optimization. Omitted when no context is supplied. :vartype context: list[~azure.ai.projects.models.OptimizationContext] """ @@ -23889,7 +23889,7 @@ class RealtimeAudioFormatsAudioPcm( """RealtimeAudioFormatsAudioPcm. :ivar type: Required. AUDIO_PCM. - :vartype type: str or ~azure.ai.projects.models.AUDIO_PCM + :vartype type: str or ~azure.ai.projects.models.RealtimeAudioFormatsType :ivar rate: Default value is 24000. :vartype rate: int """ @@ -23922,7 +23922,7 @@ class RealtimeAudioFormatsAudioPcma(RealtimeAudioFormats, discriminator="audio/p """RealtimeAudioFormatsAudioPcma. :ivar type: Required. AUDIO_PCMA. - :vartype type: str or ~azure.ai.projects.models.AUDIO_PCMA + :vartype type: str or ~azure.ai.projects.models.RealtimeAudioFormatsType """ type: Literal[RealtimeAudioFormatsType.AUDIO_PCMA] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -23949,7 +23949,7 @@ class RealtimeAudioFormatsAudioPcmu(RealtimeAudioFormats, discriminator="audio/p """RealtimeAudioFormatsAudioPcmu. :ivar type: Required. AUDIO_PCMU. - :vartype type: str or ~azure.ai.projects.models.AUDIO_PCMU + :vartype type: str or ~azure.ai.projects.models.RealtimeAudioFormatsType """ type: Literal[RealtimeAudioFormatsType.AUDIO_PCMU] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -24031,7 +24031,7 @@ class RealtimeClientEventConversationItemCreate( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.create``. Required. CONVERSATION_ITEM_CREATE. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_CREATE + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar previous_item_id: The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation. If set to ``root``, the new item will be added to the beginning of the conversation. If set to an existing ID, it @@ -24087,7 +24087,7 @@ class RealtimeClientEventConversationItemDelete( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.delete``. Required. CONVERSATION_ITEM_DELETE. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_DELETE + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar item_id: The ID of the item to delete. Required. :vartype item_id: str """ @@ -24132,7 +24132,7 @@ class RealtimeClientEventConversationItemRetrieve( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.retrieve``. Required. CONVERSATION_ITEM_RETRIEVE. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_RETRIEVE + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar item_id: The ID of the item to retrieve. Required. :vartype item_id: str """ @@ -24179,7 +24179,7 @@ class RealtimeClientEventConversationItemTruncate( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.truncate``. Required. CONVERSATION_ITEM_TRUNCATE. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_TRUNCATE + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar item_id: The ID of the assistant message item to truncate. Only assistant message items can be truncated. Required. :vartype item_id: str @@ -24244,7 +24244,7 @@ class RealtimeClientEventInputAudioBufferAppend( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.append``. Required. INPUT_AUDIO_BUFFER_APPEND. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_APPEND + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar audio: Base64-encoded audio bytes. This must be in the format specified by the ``input_audio_format`` field in the session configuration. Required. :vartype audio: str @@ -24288,7 +24288,7 @@ class RealtimeClientEventInputAudioBufferClear( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.clear``. Required. INPUT_AUDIO_BUFFER_CLEAR. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_CLEAR + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -24329,7 +24329,7 @@ class RealtimeClientEventInputAudioBufferCommit( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.commit``. Required. INPUT_AUDIO_BUFFER_COMMIT. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_COMMIT + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -24369,7 +24369,7 @@ class RealtimeClientEventOutputAudioBufferClear( :vartype event_id: str :ivar type: The event type, must be ``output_audio_buffer.clear``. Required. OUTPUT_AUDIO_BUFFER_CLEAR. - :vartype type: str or ~azure.ai.projects.models.OUTPUT_AUDIO_BUFFER_CLEAR + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType """ event_id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -24407,7 +24407,7 @@ class RealtimeClientEventResponseCancel( :ivar event_id: Optional client-generated ID used to identify this event. :vartype event_id: str :ivar type: The event type, must be ``response.cancel``. Required. RESPONSE_CANCEL. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_CANCEL + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar response_id: A specific response ID to cancel - if not provided, will cancel an in-progress response in the default conversation. :vartype response_id: str @@ -24463,7 +24463,7 @@ class RealtimeClientEventResponseCreate( :ivar event_id: Optional client-generated ID used to identify this event. :vartype event_id: str :ivar type: The event type, must be ``response.create``. Required. RESPONSE_CREATE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_CREATE + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar response: :vartype response: ~azure.ai.projects.models.VoiceAgentResponseCreateParams """ @@ -24545,7 +24545,7 @@ class RealtimeConversationItemFunctionCall( when creating a new item. Default value is "realtime.item". :vartype object: str :ivar type: The type of the item. Always ``function_call``. Required. FUNCTION_CALL. - :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :ivar status: The status of the item. Has no effect on the conversation. Is one of the following types: Literal["completed"], Literal["incomplete"], Literal["in_progress"] :vartype status: str or str or str @@ -24623,7 +24623,7 @@ class RealtimeConversationItemFunctionCallOutput( :vartype object: str :ivar type: The type of the item. Always ``function_call_output``. Required. FUNCTION_CALL_OUTPUT. - :vartype type: str or ~azure.ai.projects.models.FUNCTION_CALL_OUTPUT + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :ivar status: The status of the item. Has no effect on the conversation. Is one of the following types: Literal["completed"], Literal["incomplete"], Literal["in_progress"] :vartype status: str or str or str @@ -24702,7 +24702,7 @@ class RealtimeConversationItemMessage( :ivar role: Required. Known values are: "system", "user", and "assistant". :vartype role: str or ~azure.ai.projects.models.RealtimeConversationItemMessageType :ivar type: Required. MESSAGE. - :vartype type: str or ~azure.ai.projects.models.MESSAGE + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType """ __mapping__: dict[str, _Model] = {} @@ -24742,12 +24742,12 @@ class RealtimeConversationItemMessageAssistant( when creating a new item. Default value is "realtime.item". :vartype object: str :ivar type: The type of the item. Always ``message``. Required. MESSAGE. - :vartype type: str or ~azure.ai.projects.models.MESSAGE + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :ivar status: The status of the item. Has no effect on the conversation. Is one of the following types: Literal["completed"], Literal["incomplete"], Literal["in_progress"] :vartype status: str or str or str :ivar role: The role of the message sender. Always ``assistant``. Required. ASSISTANT. - :vartype role: str or ~azure.ai.projects.models.ASSISTANT + :vartype role: str or ~azure.ai.projects.models.RealtimeConversationItemMessageType :ivar content: The content of the message. Required. :vartype content: list[~azure.ai.projects.models.RealtimeConversationItemMessageAssistantContent] @@ -24857,12 +24857,12 @@ class RealtimeConversationItemMessageSystem( when creating a new item. Default value is "realtime.item". :vartype object: str :ivar type: The type of the item. Always ``message``. Required. MESSAGE. - :vartype type: str or ~azure.ai.projects.models.MESSAGE + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :ivar status: The status of the item. Has no effect on the conversation. Is one of the following types: Literal["completed"], Literal["incomplete"], Literal["in_progress"] :vartype status: str or str or str :ivar role: The role of the message sender. Always ``system``. Required. SYSTEM. - :vartype role: str or ~azure.ai.projects.models.SYSTEM + :vartype role: str or ~azure.ai.projects.models.RealtimeConversationItemMessageType :ivar content: The content of the message. Required. :vartype content: list[~azure.ai.projects.models.RealtimeConversationItemMessageSystemContent] :ivar created_at: The Unix timestamp (in seconds) for when the item was persisted. @@ -24961,12 +24961,12 @@ class RealtimeConversationItemMessageUser( when creating a new item. Default value is "realtime.item". :vartype object: str :ivar type: The type of the item. Always ``message``. Required. MESSAGE. - :vartype type: str or ~azure.ai.projects.models.MESSAGE + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :ivar status: The status of the item. Has no effect on the conversation. Is one of the following types: Literal["completed"], Literal["incomplete"], Literal["in_progress"] :vartype status: str or str or str :ivar role: The role of the message sender. Always ``user``. Required. USER. - :vartype role: str or ~azure.ai.projects.models.USER + :vartype role: str or ~azure.ai.projects.models.RealtimeConversationItemMessageType :ivar content: The content of the message. Required. :vartype content: list[~azure.ai.projects.models.RealtimeConversationItemMessageUserContent] :ivar created_at: The Unix timestamp (in seconds) for when the item was persisted. @@ -25134,7 +25134,7 @@ class RealtimeMCPApprovalRequest( :ivar type: The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST. - :vartype type: str or ~azure.ai.projects.models.MCP_APPROVAL_REQUEST + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :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. @@ -25193,7 +25193,7 @@ class RealtimeMCPApprovalResponse( :ivar type: The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE. - :vartype type: str or ~azure.ai.projects.models.MCP_APPROVAL_RESPONSE + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :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. @@ -25283,7 +25283,7 @@ class RealtimeMCPHTTPError( """Realtime MCP HTTP error. :ivar type: Required. HTTP_ERROR. - :vartype type: str or ~azure.ai.projects.models.HTTP_ERROR + :vartype type: str or ~azure.ai.projects.models.RealtimeMcpErrorType :ivar code: Required. :vartype code: int :ivar message: Required. @@ -25323,7 +25323,7 @@ class RealtimeMCPListTools( """Realtime MCP list tools. :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. - :vartype type: str or ~azure.ai.projects.models.MCP_LIST_TOOLS + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :ivar id: The unique ID of the list. :vartype id: str :ivar server_label: The label of the MCP server. Required. @@ -25376,7 +25376,7 @@ class RealtimeMCPProtocolError( """Realtime MCP protocol error. :ivar type: Required. PROTOCOL_ERROR. - :vartype type: str or ~azure.ai.projects.models.PROTOCOL_ERROR + :vartype type: str or ~azure.ai.projects.models.RealtimeMcpErrorType :ivar code: Required. :vartype code: int :ivar message: Required. @@ -25416,7 +25416,7 @@ class RealtimeMCPToolCall( """Realtime MCP tool call. :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. - :vartype type: str or ~azure.ai.projects.models.MCP_CALL + :vartype type: str or ~azure.ai.projects.models.RealtimeConversationItemType :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. @@ -25486,7 +25486,7 @@ class RealtimeMCPToolExecutionError( """Realtime MCP tool execution error. :ivar type: Required. TOOL_EXECUTION_ERROR. - :vartype type: str or ~azure.ai.projects.models.TOOL_EXECUTION_ERROR + :vartype type: str or ~azure.ai.projects.models.RealtimeMcpErrorType :ivar message: Required. :vartype message: str """ @@ -25772,7 +25772,7 @@ class RealtimeResponseInputMessageAssistant( Literal["completed"] type or a Literal["incomplete"] type. :vartype status: str or str :ivar role: Required. ASSISTANT. - :vartype role: str or ~azure.ai.projects.models.ASSISTANT + :vartype role: str or ~azure.ai.projects.models.RealtimeResponseInputMessageType :ivar content: Required. :vartype content: list[~azure.ai.projects.models.RealtimeResponseInputMessageAssistantContent] """ @@ -25863,7 +25863,7 @@ class RealtimeResponseInputMessageDeveloper( Literal["completed"] type or a Literal["incomplete"] type. :vartype status: str or str :ivar role: Required. DEVELOPER. - :vartype role: str or ~azure.ai.projects.models.DEVELOPER + :vartype role: str or ~azure.ai.projects.models.RealtimeResponseInputMessageType :ivar content: Required. :vartype content: list[~azure.ai.projects.models.RealtimeResponseInputText] """ @@ -25919,7 +25919,7 @@ class RealtimeResponseInputMessageSystem( Literal["completed"] type or a Literal["incomplete"] type. :vartype status: str or str :ivar role: Required. SYSTEM. - :vartype role: str or ~azure.ai.projects.models.SYSTEM + :vartype role: str or ~azure.ai.projects.models.RealtimeResponseInputMessageType :ivar content: Required. :vartype content: list[~azure.ai.projects.models.RealtimeResponseInputText] """ @@ -25975,7 +25975,7 @@ class RealtimeResponseInputMessageUser( Literal["completed"] type or a Literal["incomplete"] type. :vartype status: str or str :ivar role: Required. USER. - :vartype role: str or ~azure.ai.projects.models.USER + :vartype role: str or ~azure.ai.projects.models.RealtimeResponseInputMessageType :ivar content: Required. :vartype content: list[~azure.ai.projects.models.RealtimeResponseInputText or ~azure.ai.projects.models.RealtimeResponseInputAudio or @@ -26485,7 +26485,7 @@ class RealtimeServerEventConversationItemAdded( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.added``. Required. CONVERSATION_ITEM_ADDED. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_ADDED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar previous_item_id: :vartype previous_item_id: str :ivar item: Required. @@ -26537,7 +26537,7 @@ class RealtimeServerEventConversationItemCreated( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.created``. Required. CONVERSATION_ITEM_CREATED. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_CREATED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar previous_item_id: :vartype previous_item_id: str :ivar item: Required. @@ -26584,7 +26584,7 @@ class RealtimeServerEventConversationItemDeleted( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.deleted``. Required. CONVERSATION_ITEM_DELETED. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_DELETED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the item that was deleted. Required. :vartype item_id: str """ @@ -26627,7 +26627,7 @@ class RealtimeServerEventConversationItemDone( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.done``. Required. CONVERSATION_ITEM_DONE. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar previous_item_id: :vartype previous_item_id: str :ivar item: Required. @@ -26678,8 +26678,7 @@ class RealtimeServerEventConversationItemInputAudioTranscriptionCompleted( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.input_audio_transcription.completed``. Required. CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_COMPLETED. - :vartype type: str or - ~azure.ai.projects.models.CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_COMPLETED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the item containing the audio that is being transcribed. Required. :vartype item_id: str :ivar content_index: The index of the content part containing the audio. Required. @@ -26766,8 +26765,7 @@ class RealtimeServerEventConversationItemInputAudioTranscriptionDelta( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.input_audio_transcription.delta``. Required. CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_DELTA. - :vartype type: str or - ~azure.ai.projects.models.CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_DELTA + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the item containing the audio that is being transcribed. Required. :vartype item_id: str :ivar content_index: The index of the content part in the item's content array. @@ -26827,8 +26825,7 @@ class RealtimeServerEventConversationItemInputAudioTranscriptionFailed( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.input_audio_transcription.failed``. Required. CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_FAILED. - :vartype type: str or - ~azure.ai.projects.models.CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_FAILED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the user message item. Required. :vartype item_id: str :ivar content_index: The index of the content part containing the audio. Required. @@ -26924,8 +26921,7 @@ class RealtimeServerEventConversationItemInputAudioTranscriptionSegment( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.input_audio_transcription.segment``. Required. CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_SEGMENT. - :vartype type: str or - ~azure.ai.projects.models.CONVERSATION_ITEM_INPUT_AUDIO_TRANSCRIPTION_SEGMENT + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the item containing the input audio content. Required. :vartype item_id: str :ivar content_index: The index of the input audio content part within the item. Required. @@ -27000,7 +26996,7 @@ class RealtimeServerEventConversationItemRetrieved( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.retrieved``. Required. CONVERSATION_ITEM_RETRIEVED. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_RETRIEVED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item: Required. :vartype item: ~azure.ai.projects.models.RealtimeConversationItem """ @@ -27045,7 +27041,7 @@ class RealtimeServerEventConversationItemTruncated( :vartype event_id: str :ivar type: The event type, must be ``conversation.item.truncated``. Required. CONVERSATION_ITEM_TRUNCATED. - :vartype type: str or ~azure.ai.projects.models.CONVERSATION_ITEM_TRUNCATED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the assistant message item that was truncated. Required. :vartype item_id: str :ivar content_index: The index of the content part that was truncated. Required. @@ -27192,7 +27188,7 @@ class RealtimeServerEventInputAudioBufferCleared( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.cleared``. Required. INPUT_AUDIO_BUFFER_CLEARED. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_CLEARED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -27230,7 +27226,7 @@ class RealtimeServerEventInputAudioBufferCommitted( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.committed``. Required. INPUT_AUDIO_BUFFER_COMMITTED. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_COMMITTED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar previous_item_id: :vartype previous_item_id: str :ivar item_id: The ID of the user message item that will be created. Required. @@ -27283,7 +27279,7 @@ class RealtimeServerEventInputAudioBufferSpeechStarted( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.speech_started``. Required. INPUT_AUDIO_BUFFER_SPEECH_STARTED. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_SPEECH_STARTED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar audio_start_ms: Milliseconds from the start of all audio written to the buffer during the session when speech was first detected. This will correspond to the beginning of audio sent to the model, and thus includes the ``prefix_padding_ms`` configured in the Session. Required. @@ -27337,7 +27333,7 @@ class RealtimeServerEventInputAudioBufferSpeechStopped( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.speech_stopped``. Required. INPUT_AUDIO_BUFFER_SPEECH_STOPPED. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_SPEECH_STOPPED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar audio_end_ms: Milliseconds since the session started when speech stopped. This will correspond to the end of audio sent to the model, and thus includes the ``min_silence_duration_ms`` configured in the Session. Required. @@ -27398,7 +27394,7 @@ class RealtimeServerEventInputAudioBufferTimeoutTriggered( :vartype event_id: str :ivar type: The event type, must be ``input_audio_buffer.timeout_triggered``. Required. INPUT_AUDIO_BUFFER_TIMEOUT_TRIGGERED. - :vartype type: str or ~azure.ai.projects.models.INPUT_AUDIO_BUFFER_TIMEOUT_TRIGGERED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar audio_start_ms: Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response. Required. :vartype audio_start_ms: int @@ -27454,7 +27450,7 @@ class RealtimeServerEventMCPListToolsCompleted( :vartype event_id: str :ivar type: The event type, must be ``mcp_list_tools.completed``. Required. MCP_LIST_TOOLS_COMPLETED. - :vartype type: str or ~azure.ai.projects.models.MCP_LIST_TOOLS_COMPLETED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the MCP list tools item. Required. :vartype item_id: str """ @@ -27494,7 +27490,7 @@ class RealtimeServerEventMCPListToolsFailed( :ivar event_id: The unique ID of the server event. Required. :vartype event_id: str :ivar type: The event type, must be ``mcp_list_tools.failed``. Required. MCP_LIST_TOOLS_FAILED. - :vartype type: str or ~azure.ai.projects.models.MCP_LIST_TOOLS_FAILED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the MCP list tools item. Required. :vartype item_id: str """ @@ -27535,7 +27531,7 @@ class RealtimeServerEventMCPListToolsInProgress( :vartype event_id: str :ivar type: The event type, must be ``mcp_list_tools.in_progress``. Required. MCP_LIST_TOOLS_IN_PROGRESS. - :vartype type: str or ~azure.ai.projects.models.MCP_LIST_TOOLS_IN_PROGRESS + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar item_id: The ID of the MCP list tools item. Required. :vartype item_id: str """ @@ -27580,7 +27576,7 @@ class RealtimeServerEventOutputAudioBufferCleared( :vartype event_id: str :ivar type: The event type, must be ``output_audio_buffer.cleared``. Required. OUTPUT_AUDIO_BUFFER_CLEARED. - :vartype type: str or ~azure.ai.projects.models.OUTPUT_AUDIO_BUFFER_CLEARED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The unique ID of the response that produced the audio. Required. :vartype response_id: str """ @@ -27622,7 +27618,7 @@ class RealtimeServerEventRateLimitsUpdated( :ivar event_id: The unique ID of the server event. Required. :vartype event_id: str :ivar type: The event type, must be ``rate_limits.updated``. Required. RATE_LIMITS_UPDATED. - :vartype type: str or ~azure.ai.projects.models.RATE_LIMITS_UPDATED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar rate_limits: List of rate limit information. Required. :vartype rate_limits: list[~azure.ai.projects.models.RealtimeServerEventRateLimitsUpdatedRateLimits] @@ -27710,7 +27706,7 @@ class RealtimeServerEventResponseAudioDelta( :vartype event_id: str :ivar type: The event type, must be ``response.output_audio.delta``. Required. RESPONSE_OUTPUT_AUDIO_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_AUDIO_DELTA + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -27772,7 +27768,7 @@ class RealtimeServerEventResponseAudioDone( :vartype event_id: str :ivar type: The event type, must be ``response.output_audio.done``. Required. RESPONSE_OUTPUT_AUDIO_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_AUDIO_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -27828,7 +27824,7 @@ class RealtimeServerEventResponseAudioTranscriptDelta( :vartype event_id: str :ivar type: The event type, must be ``response.output_audio_transcript.delta``. Required. RESPONSE_OUTPUT_AUDIO_TRANSCRIPT_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_AUDIO_TRANSCRIPT_DELTA + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -27891,7 +27887,7 @@ class RealtimeServerEventResponseAudioTranscriptDone( :vartype event_id: str :ivar type: The event type, must be ``response.output_audio_transcript.done``. Required. RESPONSE_OUTPUT_AUDIO_TRANSCRIPT_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_AUDIO_TRANSCRIPT_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -27954,7 +27950,7 @@ class RealtimeServerEventResponseContentPartAdded( :vartype event_id: str :ivar type: The event type, must be ``response.content_part.added``. Required. RESPONSE_CONTENT_PART_ADDED. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_CONTENT_PART_ADDED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item to which the content part was added. Required. @@ -28060,7 +28056,7 @@ class RealtimeServerEventResponseContentPartDone( :vartype event_id: str :ivar type: The event type, must be ``response.content_part.done``. Required. RESPONSE_CONTENT_PART_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_CONTENT_PART_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -28172,7 +28168,7 @@ class RealtimeServerEventResponseCreated( :ivar event_id: The unique ID of the server event. Required. :vartype event_id: str :ivar type: The event type, must be ``response.created``. Required. RESPONSE_CREATED. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_CREATED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response: Required. :vartype response: ~azure.ai.projects.models.VoiceAgentRealtimeResponse """ @@ -28219,7 +28215,7 @@ class RealtimeServerEventResponseDone( :ivar event_id: The unique ID of the server event. Required. :vartype event_id: str :ivar type: The event type, must be ``response.done``. Required. RESPONSE_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response: Required. :vartype response: ~azure.ai.projects.models.VoiceAgentRealtimeResponse """ @@ -28262,7 +28258,7 @@ class RealtimeServerEventResponseFunctionCallArgumentsDelta( :vartype event_id: str :ivar type: The event type, must be ``response.function_call_arguments.delta``. Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the function call item. Required. @@ -28325,7 +28321,7 @@ class RealtimeServerEventResponseFunctionCallArgumentsDone( :vartype event_id: str :ivar type: The event type, must be ``response.function_call_arguments.done``. Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the function call item. Required. @@ -28392,7 +28388,7 @@ class RealtimeServerEventResponseMCPCallArgumentsDelta( :vartype event_id: str :ivar type: The event type, must be ``response.mcp_call_arguments.delta``. Required. RESPONSE_MCP_CALL_ARGUMENTS_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_MCP_CALL_ARGUMENTS_DELTA + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the MCP tool call item. Required. @@ -28453,7 +28449,7 @@ class RealtimeServerEventResponseMCPCallArgumentsDone( :vartype event_id: str :ivar type: The event type, must be ``response.mcp_call_arguments.done``. Required. RESPONSE_MCP_CALL_ARGUMENTS_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_MCP_CALL_ARGUMENTS_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the MCP tool call item. Required. @@ -28510,7 +28506,7 @@ class RealtimeServerEventResponseMCPCallCompleted( :vartype event_id: str :ivar type: The event type, must be ``response.mcp_call.completed``. Required. RESPONSE_MCP_CALL_COMPLETED. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_MCP_CALL_COMPLETED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar output_index: The index of the output item in the response. Required. :vartype output_index: int :ivar item_id: The ID of the MCP tool call item. Required. @@ -28556,7 +28552,7 @@ class RealtimeServerEventResponseMCPCallFailed( :vartype event_id: str :ivar type: The event type, must be ``response.mcp_call.failed``. Required. RESPONSE_MCP_CALL_FAILED. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_MCP_CALL_FAILED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar output_index: The index of the output item in the response. Required. :vartype output_index: int :ivar item_id: The ID of the MCP tool call item. Required. @@ -28602,7 +28598,7 @@ class RealtimeServerEventResponseMCPCallInProgress( :vartype event_id: str :ivar type: The event type, must be ``response.mcp_call.in_progress``. Required. RESPONSE_MCP_CALL_IN_PROGRESS. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_MCP_CALL_IN_PROGRESS + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar output_index: The index of the output item in the response. Required. :vartype output_index: int :ivar item_id: The ID of the MCP tool call item. Required. @@ -28649,7 +28645,7 @@ class RealtimeServerEventResponseOutputItemAdded( :vartype event_id: str :ivar type: The event type, must be ``response.output_item.added``. Required. RESPONSE_OUTPUT_ITEM_ADDED. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_ITEM_ADDED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the Response to which the item belongs. Required. :vartype response_id: str :ivar output_index: The index of the output item in the Response. Required. @@ -28701,7 +28697,7 @@ class RealtimeServerEventResponseOutputItemDone( :vartype event_id: str :ivar type: The event type, must be ``response.output_item.done``. Required. RESPONSE_OUTPUT_ITEM_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_ITEM_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the Response to which the item belongs. Required. :vartype response_id: str :ivar output_index: The index of the output item in the Response. Required. @@ -28752,7 +28748,7 @@ class RealtimeServerEventResponseTextDelta( :vartype event_id: str :ivar type: The event type, must be ``response.output_text.delta``. Required. RESPONSE_OUTPUT_TEXT_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_TEXT_DELTA + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -28814,7 +28810,7 @@ class RealtimeServerEventResponseTextDone( :vartype event_id: str :ivar type: The event type, must be ``response.output_text.done``. Required. RESPONSE_OUTPUT_TEXT_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_OUTPUT_TEXT_DONE + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar response_id: The ID of the response. Required. :vartype response_id: str :ivar item_id: The ID of the item. Required. @@ -28875,7 +28871,7 @@ class RealtimeServerEventSessionCreated( :ivar event_id: The unique ID of the server event. Required. :vartype event_id: str :ivar type: The event type, must be ``session.created``. Required. SESSION_CREATED. - :vartype type: str or ~azure.ai.projects.models.SESSION_CREATED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar session: The session configuration. Required. Is one of the following types: VoiceAgentSessionResponseConfig :vartype session: ~azure.ai.projects.models.VoiceAgentSessionResponseConfig @@ -28926,7 +28922,7 @@ class RealtimeServerEventSessionUpdated( :ivar event_id: The unique ID of the server event. Required. :vartype event_id: str :ivar type: The event type, must be ``session.updated``. Required. SESSION_UPDATED. - :vartype type: str or ~azure.ai.projects.models.SESSION_UPDATED + :vartype type: str or ~azure.ai.projects.models.RealtimeServerEventType :ivar session: The session configuration. Required. Is one of the following types: VoiceAgentSessionResponseConfig :vartype session: ~azure.ai.projects.models.VoiceAgentSessionResponseConfig @@ -29032,7 +29028,7 @@ class RecurrenceTrigger( """Recurrence based trigger. :ivar type: Type of the trigger. Required. Recurrence based trigger. - :vartype type: str or ~azure.ai.projects.models.RECURRENCE + :vartype type: str or ~azure.ai.projects.models.TriggerType :ivar start_time: Start time for the recurrence schedule in ISO 8601 format. :vartype start_time: ~datetime.datetime :ivar end_time: End time for the recurrence schedule in ISO 8601 format. @@ -29206,7 +29202,7 @@ class ReinforcementFineTuningDataGenerationJob( :vartype finished_at: ~datetime.datetime :ivar scenario: The scenario of the data generation job, which is Reinforcement Fine-tuning preview for this model. Required. Reinforcement Fine-tuning preview scenario. - :vartype scenario: str or ~azure.ai.projects.models.REINFORCEMENT_FINETUNING_PREVIEW + :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario :ivar output_configuration: Optional file output configuration for the generated reinforcement fine-tuning data. :vartype output_configuration: @@ -29258,7 +29254,7 @@ class ReinforcementFineTuningDataGenerationJobInputs( :vartype generation_configuration: ~azure.ai.projects.models.DataGenerationJobConfiguration :ivar scenario: The scenario of the data generation job, which is Reinforcement Fine-tuning preview for this model. Required. Reinforcement Fine-tuning preview scenario. - :vartype scenario: str or ~azure.ai.projects.models.REINFORCEMENT_FINETUNING_PREVIEW + :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario :ivar output_configuration: Optional file output configuration for the generated reinforcement fine-tuning data. :vartype output_configuration: @@ -29355,7 +29351,7 @@ class ReminderPreviewToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. REMINDER_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.REMINDER_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType """ type: Literal[ToolboxToolType.REMINDER_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -29783,7 +29779,7 @@ class RubricBasedEvaluatorDefinition( :ivar type: Required. Rubric-based evaluator definition. Stores dimensions (the scoring blueprint) for both quality and safety evaluators. Can be created via the generate API or manually via createVersion. - :vartype type: str or ~azure.ai.projects.models.RUBRIC + :vartype type: str or ~azure.ai.projects.models.EvaluatorDefinitionType :ivar dimensions: The set of dimensions — the scoring blueprint used by the LLM judge. Quality evaluators include a non-editable residual dimension with id 'general_quality' (always_applicable: true); safety evaluators include 'general_policy_compliance'. Both use the @@ -29909,7 +29905,7 @@ class SASCredentials(BaseCredentials, discriminator="SAS"): """Shared Access Signature (SAS) credential definition. :ivar type: The credential type. Required. Shared Access Signature (SAS) credential. - :vartype type: str or ~azure.ai.projects.models.SAS + :vartype type: str or ~azure.ai.projects.models.CredentialType :ivar sas_token: SAS token. :vartype sas_token: str """ @@ -30020,7 +30016,7 @@ class ScheduleRoutineTrigger( """A recurring cron-based routine trigger. :ivar type: The trigger type. Required. A recurring cron-based trigger. - :vartype type: str or ~azure.ai.projects.models.SCHEDULE + :vartype type: str or ~azure.ai.projects.models.RoutineTriggerType :ivar cron_expression: A 5-field cron expression. The service enforces a minimum interval of five minutes by default. Required. :vartype cron_expression: str @@ -30354,7 +30350,7 @@ class SharepointPreviewTool( :ivar type: The object type, which is always 'sharepoint_grounding_preview'. Required. SHAREPOINT_GROUNDING_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.SHAREPOINT_GROUNDING_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. :vartype sharepoint_grounding_preview: ~azure.ai.projects.models.SharepointGroundingToolParameters @@ -30402,7 +30398,7 @@ class ShellToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: The type of the tool. Always ``shell``. Required. SHELL. - :vartype type: str or ~azure.ai.projects.models.SHELL + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar allowed_callers: :vartype allowed_callers: list[str or ~azure.ai.projects.models.CallableToolAllowedCaller] :ivar environment: The environment in which shell commands are executed. Specify an @@ -30456,7 +30452,7 @@ class SimpleQnADataGenerationJobConfiguration( :vartype model_options: ~azure.ai.projects.models.DataGenerationModelOptions :ivar type: The data generation job type, which is SimpleQnA for this model. Required. Simple question and answers between user and agent. - :vartype type: str or ~azure.ai.projects.models.SIMPLE_QNA + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobType :ivar max_samples: Maximum number of samples to generate, up to service-defined limits. Required. :vartype max_samples: int @@ -30510,7 +30506,7 @@ class SimulationSeedDataGenerationJobConfiguration( :vartype model_options: ~azure.ai.projects.models.DataGenerationModelOptions :ivar type: The data generation job type, which is SimulationSeed for this model. Required. Simulation seed for evaluation scenarios. - :vartype type: str or ~azure.ai.projects.models.SIMULATION_SEED + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobType :ivar max_samples: Maximum number of samples to generate, up to service-defined limits. Required. :vartype max_samples: int @@ -30547,14 +30543,16 @@ class SipAddress(TelephonyAddress, discriminator="sip"): # pylint: disable=docs """SIP/SIPS transfer address, subject to provider validation. SIP outbound sources and recipients use phone_number, not SIP URIs. - :ivar type: The SIP address type. Required. A SIP or SIPS destination for transfer. - :vartype type: str or ~azure.ai.projects.models.SIP + :ivar type: The SIP address type. Required. A SIP or SIPS destination for transfer. SIP is in + preview and requires the ``VoiceAgents=V1Preview`` opt-in. + :vartype type: str or ~azure.ai.projects.models.TelephonyAddressType :ivar value: The SIP or SIPS URI to call. Required. :vartype value: str """ type: Literal[TelephonyAddressType.SIP] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The SIP address type. Required. A SIP or SIPS destination for transfer.""" + """The SIP address type. Required. A SIP or SIPS destination for transfer. SIP is in preview and + requires the ``VoiceAgents=V1Preview`` opt-in.""" @overload def __init__( @@ -30644,8 +30642,9 @@ class SipTelephonyBinding( :ivar incoming_call_url: The service-generated incoming address: an HTTPS webhook for webhook-based providers or a SIP/SIPS ingress URI for SIP. Required. :vartype incoming_call_url: str - :ivar provider: The SIP provider. Required. Session Initiation Protocol. - :vartype provider: str or ~azure.ai.projects.models.SIP + :ivar provider: The SIP provider. Required. Session Initiation Protocol. SIP is in preview and + requires the ``VoiceAgents=V1Preview`` opt-in. + :vartype provider: str or ~azure.ai.projects.models.TelephonyProvider :ivar phone_number: Optional display metadata, not a routing key or E.164-constrained destination. :vartype phone_number: str @@ -30655,7 +30654,8 @@ class SipTelephonyBinding( """ provider: Literal[TelephonyProvider.SIP] = rest_discriminator(name="provider", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The SIP provider. Required. Session Initiation Protocol.""" + """The SIP provider. Required. Session Initiation Protocol. SIP is in preview and requires the + ``VoiceAgents=V1Preview`` opt-in.""" phone_number: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional display metadata, not a routing key or E.164-constrained destination.""" allowed_calling_numbers: Optional[list[str]] = rest_field( @@ -30766,8 +30766,9 @@ class SipTelephonyBindingListItem( :ivar etag: The entity tag to send in the ``If-Match`` header when updating or deleting this binding. Required. :vartype etag: str - :ivar provider: The SIP provider. Required. Session Initiation Protocol. - :vartype provider: str or ~azure.ai.projects.models.SIP + :ivar provider: The SIP provider. Required. Session Initiation Protocol. SIP is in preview and + requires the ``VoiceAgents=V1Preview`` opt-in. + :vartype provider: str or ~azure.ai.projects.models.TelephonyProvider :ivar phone_number: Optional display phone metadata, not a routing key. :vartype phone_number: str :ivar allowed_calling_numbers: Current exact E.164 caller numbers or restricted fully anchored @@ -30776,7 +30777,8 @@ class SipTelephonyBindingListItem( """ provider: Literal[TelephonyProvider.SIP] = rest_discriminator(name="provider", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The SIP provider. Required. Session Initiation Protocol.""" + """The SIP provider. Required. Session Initiation Protocol. SIP is in preview and requires the + ``VoiceAgents=V1Preview`` opt-in.""" phone_number: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Optional display phone metadata, not a routing key.""" allowed_calling_numbers: Optional[list[str]] = rest_field( @@ -30962,7 +30964,7 @@ class SkillReferenceParam( """SkillReferenceParam. :ivar type: References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE. - :vartype type: str or ~azure.ai.projects.models.SKILL_REFERENCE + :vartype type: str or ~azure.ai.projects.models.ContainerSkillType :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. @@ -31098,7 +31100,7 @@ class SpecificApplyPatchParam(ToolChoiceParam, discriminator="apply_patch"): """Specific apply patch tool choice. :ivar type: The tool to call. Always ``apply_patch``. Required. APPLY_PATCH. - :vartype type: str or ~azure.ai.projects.models.APPLY_PATCH + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.APPLY_PATCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -31125,7 +31127,7 @@ class SpecificFunctionShellParam(ToolChoiceParam, discriminator="shell"): """Specific shell tool choice. :ivar type: The tool to call. Always ``shell``. Required. SHELL. - :vartype type: str or ~azure.ai.projects.models.SHELL + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.SHELL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -31153,7 +31155,7 @@ class SpecificProgrammaticToolCallingParam(ToolChoiceParam, discriminator="progr :ivar type: The tool to call. Always ``programmatic_tool_calling``. Required. PROGRAMMATIC_TOOL_CALLING. - :vartype type: str or ~azure.ai.projects.models.PROGRAMMATIC_TOOL_CALLING + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.PROGRAMMATIC_TOOL_CALLING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -31183,7 +31185,7 @@ class SteeringPromptOptimizationContext( :ivar type: Optimization context type discriminator. Required. Natural-language guidance that steers the desired optimization. - :vartype type: str or ~azure.ai.projects.models.STEERING_PROMPT + :vartype type: str or ~azure.ai.projects.models.OptimizationContextType :ivar prompt: Developer guidance describing the desired changes. Required. :vartype prompt: str """ @@ -31333,7 +31335,7 @@ class SupervisedFineTuningDataGenerationJob( :vartype finished_at: ~datetime.datetime :ivar scenario: The scenario of the data generation job, which is Supervised Fine-tuning preview for this model. Required. Supervised Fine-tuning preview scenario. - :vartype scenario: str or ~azure.ai.projects.models.SUPERVISED_FINETUNING_PREVIEW + :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario :ivar output_configuration: Optional file output configuration for the generated supervised fine-tuning data. :vartype output_configuration: @@ -31385,7 +31387,7 @@ class SupervisedFineTuningDataGenerationJobInputs( :vartype generation_configuration: ~azure.ai.projects.models.DataGenerationJobConfiguration :ivar scenario: The scenario of the data generation job, which is Supervised Fine-tuning preview for this model. Required. Supervised Fine-tuning preview scenario. - :vartype scenario: str or ~azure.ai.projects.models.SUPERVISED_FINETUNING_PREVIEW + :vartype scenario: str or ~azure.ai.projects.models.DataGenerationJobScenario :ivar output_configuration: Optional file output configuration for the generated supervised fine-tuning data. :vartype output_configuration: @@ -31588,7 +31590,7 @@ class TeamsAddress( :ivar type: The Microsoft Teams address type. Required. A Microsoft Teams identity. Source addresses require a nonempty resource-account object GUID; transfer destinations also support 28:orgid:{guid}. - :vartype type: str or ~azure.ai.projects.models.TEAMS + :vartype type: str or ~azure.ai.projects.models.TelephonyAddressType :ivar value: Source: nonempty resource-account GUID. Transfer: user/resource-account GUID or 28:orgid:{guid}. Required. :vartype value: str @@ -31634,7 +31636,7 @@ class TeamsPhoneExtensibilityTelephonyBinding( :vartype incoming_call_url: str :ivar provider: The Microsoft Teams Phone extensibility provider. Required. Microsoft Teams Phone extensibility. - :vartype provider: str or ~azure.ai.projects.models.TEAMS_PHONE_EXTENSIBILITY + :vartype provider: str or ~azure.ai.projects.models.TelephonyProvider :ivar phone_number: The optional display phone number for the Teams resource account. :vartype phone_number: str :ivar resource_account_object_id: The Microsoft Teams resource-account object identifier as a @@ -31691,7 +31693,7 @@ class TeamsPhoneExtensibilityTelephonyBindingListItem( :vartype etag: str :ivar provider: The Microsoft Teams Phone extensibility provider. Required. Microsoft Teams Phone extensibility. - :vartype provider: str or ~azure.ai.projects.models.TEAMS_PHONE_EXTENSIBILITY + :vartype provider: str or ~azure.ai.projects.models.TelephonyProvider :ivar phone_number: The optional display phone number for the Teams resource account. :vartype phone_number: str :ivar resource_account_object_id: The Microsoft Teams resource-account object identifier as a @@ -33186,7 +33188,7 @@ class TextResponseFormatJsonObject(TextResponseFormat, discriminator="json_objec :ivar type: The type of response format being defined. Always ``json_object``. Required. JSON_OBJECT. - :vartype type: str or ~azure.ai.projects.models.JSON_OBJECT + :vartype type: str or ~azure.ai.projects.models.TextResponseFormatConfigurationType """ type: Literal[TextResponseFormatConfigurationType.JSON_OBJECT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -33216,7 +33218,7 @@ class TextResponseFormatJsonSchema( :ivar type: The type of response format being defined. Always ``json_schema``. Required. JSON_SCHEMA. - :vartype type: str or ~azure.ai.projects.models.JSON_SCHEMA + :vartype type: str or ~azure.ai.projects.models.TextResponseFormatConfigurationType :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 @@ -33267,7 +33269,7 @@ class TextResponseFormatText(TextResponseFormat, discriminator="text"): """Text. :ivar type: The type of response format being defined. Always ``text``. Required. TEXT. - :vartype type: str or ~azure.ai.projects.models.TEXT + :vartype type: str or ~azure.ai.projects.models.TextResponseFormatConfigurationType """ type: Literal[TextResponseFormatConfigurationType.TEXT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -33296,7 +33298,7 @@ class TimerRoutineTrigger( """A one-shot timer routine trigger. :ivar type: The trigger type. Required. A one-shot timer trigger. - :vartype type: str or ~azure.ai.projects.models.TIMER + :vartype type: str or ~azure.ai.projects.models.RoutineTriggerType :ivar at: The UTC date and time at which the timer fires. :vartype at: ~datetime.datetime """ @@ -33424,7 +33426,7 @@ class ToolboxSearchPreviewToolboxTool( :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: The type of the tool. Always ``toolbox_search_preview``. Required. TOOLBOX_SEARCH_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.TOOLBOX_SEARCH_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType """ type: Literal[ToolboxToolType.TOOLBOX_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -33836,7 +33838,7 @@ class ToolChoiceAllowed( """Allowed tools. :ivar type: Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS. - :vartype type: str or ~azure.ai.projects.models.ALLOWED_TOOLS + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType :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 @@ -33899,7 +33901,7 @@ class ToolChoiceCodeInterpreter(ToolChoiceParam, discriminator="code_interpreter built-in tools `_. :ivar type: Required. CODE_INTERPRETER. - :vartype type: str or ~azure.ai.projects.models.CODE_INTERPRETER + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.CODE_INTERPRETER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -33927,7 +33929,7 @@ class ToolChoiceComputer(ToolChoiceParam, discriminator="computer"): built-in tools `_. :ivar type: Required. COMPUTER. - :vartype type: str or ~azure.ai.projects.models.COMPUTER + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.COMPUTER] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -33955,7 +33957,7 @@ class ToolChoiceComputerUse(ToolChoiceParam, discriminator="computer_use"): built-in tools `_. :ivar type: Required. COMPUTER_USE. - :vartype type: str or ~azure.ai.projects.models.COMPUTER_USE + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.COMPUTER_USE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -33983,7 +33985,7 @@ class ToolChoiceComputerUsePreview(ToolChoiceParam, discriminator="computer_use_ built-in tools `_. :ivar type: Required. COMPUTER_USE_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.COMPUTER_USE_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.COMPUTER_USE_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -34012,7 +34014,7 @@ class ToolChoiceCustom( """Custom tool. :ivar type: For custom tool calling, the type is always ``custom``. Required. CUSTOM. - :vartype type: str or ~azure.ai.projects.models.CUSTOM + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType :ivar name: The name of the custom tool to call. Required. :vartype name: str """ @@ -34046,7 +34048,7 @@ class ToolChoiceFileSearch(ToolChoiceParam, discriminator="file_search"): built-in tools `_. :ivar type: Required. FILE_SEARCH. - :vartype type: str or ~azure.ai.projects.models.FILE_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.FILE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -34075,7 +34077,7 @@ class ToolChoiceFunction( """Function tool. :ivar type: For function calling, the type is always ``function``. Required. FUNCTION. - :vartype type: str or ~azure.ai.projects.models.FUNCTION + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType :ivar name: The name of the function to call. Required. :vartype name: str """ @@ -34109,7 +34111,7 @@ class ToolChoiceImageGeneration(ToolChoiceParam, discriminator="image_generation built-in tools `_. :ivar type: Required. IMAGE_GENERATION. - :vartype type: str or ~azure.ai.projects.models.IMAGE_GENERATION + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.IMAGE_GENERATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -34138,7 +34140,7 @@ class ToolChoiceMCP( """MCP tool. :ivar type: For MCP tools, the type is always ``mcp``. Required. MCP. - :vartype type: str or ~azure.ai.projects.models.MCP + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType :ivar server_label: The label of the MCP server to use. Required. :vartype server_label: str :ivar name: @@ -34176,7 +34178,7 @@ class ToolChoiceWebSearchPreview(ToolChoiceParam, discriminator="web_search_prev built-in tools `_. :ivar type: Required. WEB_SEARCH_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -34204,7 +34206,7 @@ class ToolChoiceWebSearchPreview20250311(ToolChoiceParam, discriminator="web_sea built-in tools `_. :ivar type: Required. WEB_SEARCH_PREVIEW_2025_03_11. - :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH_PREVIEW_2025_03_11 + :vartype type: str or ~azure.ai.projects.models.ToolChoiceParamType """ type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -34342,7 +34344,7 @@ class ToolSearchToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: The type of the tool. Always ``toolbox_search``. Required. TOOLBOX_SEARCH. - :vartype type: str or ~azure.ai.projects.models.TOOLBOX_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType """ type: Literal[ToolboxToolType.TOOLBOX_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -34375,7 +34377,7 @@ class ToolSearchToolParam( """Tool search tool. :ivar type: The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH. - :vartype type: str or ~azure.ai.projects.models.TOOL_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar execution: Whether tool search is executed by the server or by the client. Known values are: "server" and "client". :vartype execution: str or ~azure.ai.projects.models.ToolSearchExecutionType @@ -34431,7 +34433,7 @@ class ToolUseFineTuningDataGenerationJobConfiguration( :vartype model_options: ~azure.ai.projects.models.DataGenerationModelOptions :ivar type: The data generation job type, which is ToolUse for this model. Required. Tool calling conversation between user and agent. - :vartype type: str or ~azure.ai.projects.models.TOOL_USE + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobType :ivar max_samples: Maximum number of samples to generate, up to service-defined limits. Required. :vartype max_samples: int @@ -34476,7 +34478,7 @@ class TracesDataGenerationJobConfiguration( :vartype model_options: ~azure.ai.projects.models.DataGenerationModelOptions :ivar type: The data generation job type, which is Traces for this model. Required. Single turn query and response from agent traces. - :vartype type: str or ~azure.ai.projects.models.TRACES + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobType :ivar max_samples: Maximum number of samples to generate, up to service-defined limits. If omitted, sampling is turned off. :vartype max_samples: int @@ -34528,7 +34530,7 @@ class TracesDataGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Traces. Required. Traces source — conversation traces from Application Insights. - :vartype type: str or ~azure.ai.projects.models.TRACES + :vartype type: str or ~azure.ai.projects.models.DataGenerationJobSourceType :ivar agent_id: The unique agent ID used to filter traces. Provide either ``agent_id`` or ``agent_name`` — at least one is required. :vartype agent_id: str @@ -34606,7 +34608,7 @@ class TracesEvaluatorGenerationJobSource( :vartype description: str :ivar type: The source type for this source, which is Traces. Required. Traces source — conversation traces from Application Insights. - :vartype type: str or ~azure.ai.projects.models.TRACES + :vartype type: str or ~azure.ai.projects.models.EvaluatorGenerationJobSourceType :ivar agent_id: The unique agent ID used to filter traces. Provide either ``agent_id`` or ``agent_name`` — at least one is required. :vartype agent_id: str @@ -34706,7 +34708,7 @@ class TranscriptTextUsageDuration( :ivar type: The type of the usage object. Always ``duration`` for this variant. Required. DURATION. - :vartype type: str or ~azure.ai.projects.models.DURATION + :vartype type: str or ~azure.ai.projects.models.CreateTranscriptionResponseJsonUsageType :ivar seconds: Duration of the input audio in seconds. Required. :vartype seconds: ~datetime.timedelta """ @@ -34743,7 +34745,7 @@ class TranscriptTextUsageTokens( """Token Usage. :ivar type: The type of the usage object. Always ``tokens`` for this variant. Required. TOKENS. - :vartype type: str or ~azure.ai.projects.models.TOKENS + :vartype type: str or ~azure.ai.projects.models.CreateTranscriptionResponseJsonUsageType :ivar input_tokens: Number of input tokens billed for this request. Required. :vartype input_tokens: int :ivar input_token_details: Details about the input tokens billed for this request. @@ -34838,7 +34840,7 @@ class TwilioTelephonyBinding( webhook-based providers or a SIP/SIPS ingress URI for SIP. Required. :vartype incoming_call_url: str :ivar provider: The Twilio provider. Required. Twilio Programmable Voice. - :vartype provider: str or ~azure.ai.projects.models.TWILIO + :vartype provider: str or ~azure.ai.projects.models.TelephonyProvider :ivar phone_number: The Twilio E.164 phone number. Required. :vartype phone_number: str """ @@ -34887,7 +34889,7 @@ class TwilioTelephonyBindingListItem( binding. Required. :vartype etag: str :ivar provider: The Twilio provider. Required. Twilio Programmable Voice. - :vartype provider: str or ~azure.ai.projects.models.TWILIO + :vartype provider: str or ~azure.ai.projects.models.TelephonyProvider :ivar phone_number: The Twilio E.164 phone number. Required. :vartype phone_number: str """ @@ -35307,7 +35309,7 @@ class UserProfileMemoryItem( :vartype content: str :ivar kind: The kind of the memory item. Required. User profile information extracted from conversations. - :vartype kind: str or ~azure.ai.projects.models.USER_PROFILE + :vartype kind: str or ~azure.ai.projects.models.MemoryItemKind """ kind: Literal[MemoryItemKind.USER_PROFILE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -35374,7 +35376,7 @@ class VersionRefIndicator( :ivar type: Discriminator value for version_ref. Required. Direct reference to a specific agent version. - :vartype type: str or ~azure.ai.projects.models.VERSION_REF + :vartype type: str or ~azure.ai.projects.models.VersionIndicatorType :ivar agent_version: The agent version identifier returned by the agent version APIs. Required. :vartype agent_version: str """ @@ -36156,7 +36158,7 @@ class VoiceAgentAzureSemanticVadEnTurnDetection( stops. :vartype auto_truncate: bool :ivar type: Required. English-optimized Azure semantic voice activity detection. - :vartype type: str or ~azure.ai.projects.models.AZURE_SEMANTIC_VAD_EN + :vartype type: str or ~azure.ai.projects.models.VoiceAgentTurnDetectionType :ivar threshold: Activation threshold for voice activity detection, from 0 to 1. :vartype threshold: float :ivar prefix_padding_ms: Audio to include before detected speech, in milliseconds. @@ -36248,7 +36250,7 @@ class VoiceAgentAzureSemanticVadMultilingualTurnDetection( stops. :vartype auto_truncate: bool :ivar type: Required. Multilingual Azure semantic voice activity detection. - :vartype type: str or ~azure.ai.projects.models.AZURE_SEMANTIC_VAD_MULTILINGUAL + :vartype type: str or ~azure.ai.projects.models.VoiceAgentTurnDetectionType :ivar threshold: Activation threshold for voice activity detection, from 0 to 1. :vartype threshold: float :ivar prefix_padding_ms: Audio to include before detected speech, in milliseconds. @@ -36345,7 +36347,7 @@ class VoiceAgentAzureSemanticVadTurnDetection( stops. :vartype auto_truncate: bool :ivar type: Required. Azure semantic voice activity detection. - :vartype type: str or ~azure.ai.projects.models.AZURE_SEMANTIC_VAD + :vartype type: str or ~azure.ai.projects.models.VoiceAgentTurnDetectionType :ivar threshold: Activation threshold for voice activity detection, from 0 to 1. :vartype threshold: float :ivar prefix_padding_ms: Audio to include before detected speech, in milliseconds. @@ -36446,7 +36448,7 @@ class VoiceAgentBaseDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Always voice. Required. VOICE. - :vartype kind: str or ~azure.ai.projects.models.VOICE + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar sub_protocol: The voice protocol for this agent version. Null and unknown values are invalid. Required. Known values are: "realtime" and "live". :vartype sub_protocol: str or ~azure.ai.projects.models.VoiceAgentSubProtocol @@ -36508,7 +36510,7 @@ class VoiceAgentClientEventRtcCallSdpCreate( """The ``rtc.call.sdp.create`` client event: begins WebRTC signaling with an SDP offer. :ivar type: The event type. Always ``rtc.call.sdp.create``. Required. RTC_CALL_SDP_CREATE. - :vartype type: str or ~azure.ai.projects.models.RTC_CALL_SDP_CREATE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentClientEventTypeExtension :ivar event_id: An optional client-generated event identifier. :vartype event_id: str :ivar sdp_offer: The client's SDP offer for the WebRTC connection. Required. @@ -36558,7 +36560,7 @@ class VoiceAgentClientEventSessionAvatarConnect( :ivar type: The event type. Always ``session.avatar.connect``. Required. SESSION_AVATAR_CONNECT. - :vartype type: str or ~azure.ai.projects.models.SESSION_AVATAR_CONNECT + :vartype type: str or ~azure.ai.projects.models.VoiceAgentClientEventTypeExtension :ivar event_id: An optional client-generated event identifier. :vartype event_id: str :ivar client_sdp: The client's SDP offer for avatar media negotiation. Required. @@ -36600,7 +36602,7 @@ class VoiceAgentClientEventSessionUpdate(_Model): # pylint: disable=docstring-k but the corresponding ``session.updated`` event will not include it. :vartype event_id: str :ivar type: The event type, must be ``session.update``. Required. SESSION_UPDATE. - :vartype type: str or ~azure.ai.projects.models.SESSION_UPDATE + :vartype type: str or ~azure.ai.projects.models.RealtimeClientEventType :ivar session: The voice-agent session settings to update. Required. Is one of the following types: VoiceAgentSessionUpdateConfig :vartype session: ~azure.ai.projects.models.VoiceAgentSessionUpdateConfig @@ -36752,7 +36754,7 @@ class VoiceAgentSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar name: The service-managed control action. Known values are stable; additional values may be added over time. Required. Known values are: "end_conversation", "language_detection", "digit_recognition", "transfer", "collect_sms", "collect_dtmf", "send_dtmf", and "send_sms". @@ -36808,7 +36810,7 @@ class VoiceAgentCollectDtmfSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -36816,7 +36818,7 @@ class VoiceAgentCollectDtmfSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``collect_dtmf``. Required. Collects keypad digits on the current call. - :vartype name: str or ~azure.ai.projects.models.COLLECT_DTMF + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -36947,7 +36949,7 @@ class VoiceAgentCollectSmsSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -36955,7 +36957,7 @@ class VoiceAgentCollectSmsSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``collect_sms``. Required. Collects one complete SMS from an explicitly selected sender. - :vartype name: str or ~azure.ai.projects.models.COLLECT_SMS + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -36994,7 +36996,7 @@ class VoiceAgentDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Always voice. Required. VOICE. - :vartype kind: str or ~azure.ai.projects.models.VOICE + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar instructions: Frontend instructions, templated with structured_inputs. Backend instructions belong in delegation.responses. :vartype instructions: str @@ -37004,7 +37006,7 @@ class VoiceAgentDefinition( Defaults to false. :vartype store: bool :ivar sub_protocol: Selects the Realtime protocol. Required. REALTIME. - :vartype sub_protocol: str or ~azure.ai.projects.models.REALTIME + :vartype sub_protocol: str or ~azure.ai.projects.models.VoiceAgentSubProtocol :ivar model_type: How the model backing this voice agent is served. Required with ``model`` for a model-backed voice agent and omitted when ``conversation_engine`` is provided. This is independent of the architecture (realtime or cascaded), which the service derives from the @@ -37065,7 +37067,8 @@ class VoiceAgentDefinition( for delegated background specialists or ``inline`` for inline voice subagents. :vartype subagent_config: ~azure.ai.projects.models.VoiceAgentSubagentConfig :ivar post_call: Optional post-call delivery configuration. After each session ends, the - service notifies the configured destinations. + service notifies the configured destinations. Post-call delivery is in preview and requires + ``VoiceAgents=V1Preview``. :vartype post_call: ~azure.ai.projects.models.VoiceAgentPostCallConfig """ @@ -37158,7 +37161,8 @@ class VoiceAgentDefinition( visibility=["read", "create", "update", "delete", "query"] ) """Optional post-call delivery configuration. After each session ends, the service notifies the - configured destinations.""" + configured destinations. Post-call delivery is in preview and requires + ``VoiceAgents=V1Preview``.""" @overload def __init__( @@ -37241,7 +37245,7 @@ class VoiceAgentDelegateSubagentConfig( :ivar subagent_type: The subagent mode for delegated background specialists. Required. Referenced Foundry agents invoked as delegated background specialists. - :vartype subagent_type: str or ~azure.ai.projects.models.DELEGATE + :vartype subagent_type: str or ~azure.ai.projects.models.VoiceAgentSubagentType :ivar subagents: The sibling Foundry text agents, in the same project, that this Voice Agent may consult. Required. :vartype subagents: list[~azure.ai.projects.models.VoiceAgentSubagent] @@ -37282,7 +37286,7 @@ class VoiceAgentDigitRecognitionSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -37290,7 +37294,7 @@ class VoiceAgentDigitRecognitionSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``digit_recognition``. Required. Retrieves the unchanged transcript of the last user audio turn. - :vartype name: str or ~azure.ai.projects.models.DIGIT_RECOGNITION + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -37494,7 +37498,7 @@ class VoiceAgentEndConversationSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -37502,7 +37506,7 @@ class VoiceAgentEndConversationSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``end_conversation``. Required. Ends the active conversation. - :vartype name: str or ~azure.ai.projects.models.END_CONVERSATION + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -37618,7 +37622,7 @@ class VoiceAgentEventGridPostCallDestination( """An Event Grid connection that receives post-call events. :ivar type: The destination type. Always ``event_grid``. Required. An Event Grid connection. - :vartype type: str or ~azure.ai.projects.models.EVENT_GRID + :vartype type: str or ~azure.ai.projects.models.VoiceAgentPostCallDestinationType :ivar connection_name: The name of the Event Grid connection. Required. :vartype connection_name: str """ @@ -37658,7 +37662,7 @@ class VoiceAgentFunctionTool( :ivar parameters: Parameters of the function in JSON Schema. :vartype parameters: ~azure.ai.projects.models.RealtimeFunctionToolParameters :ivar type: Required. A native function tool executed by the client. - :vartype type: str or ~azure.ai.projects.models.FUNCTION + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar name: The function name. Required. :vartype name: str """ @@ -38060,7 +38064,7 @@ class VoiceAgentInlineSubagentConfig( :ivar subagent_type: The subagent mode for inline voice subagents. Required. Inline voice behaviors that may become active through Handoff. - :vartype subagent_type: str or ~azure.ai.projects.models.INLINE + :vartype subagent_type: str or ~azure.ai.projects.models.VoiceAgentSubagentType :ivar subagents: Inline voice subagents owned and versioned with the parent Voice Agent. ``$entrypoint`` must be first, followed by at least one specialist and at most 31 additional subagents. Each subagent declares its outgoing ``handoff_conditions``; condition identifiers @@ -38332,7 +38336,7 @@ class VoiceAgentLanguageDetectionSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -38340,7 +38344,7 @@ class VoiceAgentLanguageDetectionSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``language_detection``. Required. Switches supported conversation language settings. - :vartype name: str or ~azure.ai.projects.models.LANGUAGE_DETECTION + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -38416,7 +38420,7 @@ class VoiceAgentLiveClientDelegation( delegations. :vartype acknowledgement_delay_ms: int :ivar type: Required. The application handles delegated work. - :vartype type: str or ~azure.ai.projects.models.CLIENT + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationType """ acknowledgement_delay_ms: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -38507,7 +38511,7 @@ class VoiceAgentLiveDelegationConversationItem( Omitted for client delegations. :vartype response_id: str :ivar type: Required. DELEGATION. - :vartype type: str or ~azure.ai.projects.models.DELEGATION + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveConversationItemType :ivar target: The configured delegation owner. Required. Known values are: "responses", "client", and "foundry_managed_agent". :vartype target: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationTarget @@ -38563,11 +38567,11 @@ class VoiceAgentLiveClientDelegationConversationItem( Omitted for client delegations. :vartype response_id: str :ivar type: Required. DELEGATION. - :vartype type: str or ~azure.ai.projects.models.DELEGATION + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveConversationItemType :ivar created_at: Observed delegation creation time, in Unix seconds. Required. :vartype created_at: ~datetime.datetime :ivar target: Required. CLIENT. - :vartype target: str or ~azure.ai.projects.models.CLIENT + :vartype target: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationTarget :ivar commentary: Guidance for Live to communicate to the user, when accepted. :vartype commentary: str :ivar thinking: Accepted background context, not private reasoning or a request to speak. @@ -38699,7 +38703,7 @@ class VoiceAgentLiveDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Always voice. Required. VOICE. - :vartype kind: str or ~azure.ai.projects.models.VOICE + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar instructions: Frontend instructions, templated with structured_inputs. Backend instructions belong in delegation.responses. :vartype instructions: str @@ -38709,10 +38713,10 @@ class VoiceAgentLiveDefinition( Defaults to false. :vartype store: bool :ivar sub_protocol: Selects the Live protocol. Required. LIVE. - :vartype sub_protocol: str or ~azure.ai.projects.models.LIVE + :vartype sub_protocol: str or ~azure.ai.projects.models.VoiceAgentSubProtocol :ivar model_type: Uses a Foundry model deployment. Required. The service uses the customer's own Foundry deployment named by ``model``. - :vartype model_type: str or ~azure.ai.projects.models.SELF_DEPLOYED + :vartype model_type: str or ~azure.ai.projects.models.VoiceModelType :ivar model: The GPT Live deployment name. Required. :vartype model: str :ivar greeting: Template-only startup greeting, rendered with session structured inputs. @@ -38877,11 +38881,11 @@ class VoiceAgentLiveFoundryManagedAgentDelegationItem( Omitted for client delegations. :vartype response_id: str :ivar type: Required. DELEGATION. - :vartype type: str or ~azure.ai.projects.models.DELEGATION + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveConversationItemType :ivar created_at: Observed delegation creation time, in Unix seconds. Required. :vartype created_at: ~datetime.datetime :ivar target: Required. FOUNDRY_MANAGED_AGENT. - :vartype target: str or ~azure.ai.projects.models.FOUNDRY_MANAGED_AGENT + :vartype target: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationTarget :ivar agent_name: Target agent name in the same project. Required. :vartype agent_name: str :ivar agent_version: Target version pinned at connection start. Required. @@ -38966,7 +38970,7 @@ class VoiceAgentLiveInputConversationItem( native value. Required. :vartype id: str :ivar type: Required. INPUT. - :vartype type: str or ~azure.ai.projects.models.INPUT + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveConversationItemType :ivar transcription: Captured user transcription, when available. :vartype transcription: str :ivar audio: Captured audio metadata; audio.item_id matches this item's id. @@ -39009,7 +39013,7 @@ class VoiceAgentLiveManagedAgentDelegation( :ivar type: Canonical delegation type; legacy managed_prompt_agent values are returned as foundry_managed_agent. Required. A prompt agent in the same project handles delegated work. - :vartype type: str or ~azure.ai.projects.models.FOUNDRY_MANAGED_AGENT + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationType :ivar agent_name: Name of a prompt agent in the same project. Required. :vartype agent_name: str :ivar agent_version: Agent version, pinned per connection. Omit to select the active version. @@ -39053,7 +39057,7 @@ class VoiceAgentLiveOutputConversationItem( native value. Required. :vartype id: str :ivar type: Required. OUTPUT. - :vartype type: str or ~azure.ai.projects.models.OUTPUT + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveConversationItemType :ivar transcription: Captured assistant transcription, not backend output or commentary guidance. :vartype transcription: str @@ -39105,7 +39109,7 @@ class VoiceAgentLiveResponsesDelegation( to Responses. Required. :vartype responses: ~azure.ai.projects.models.LiveResponsesDelegationSettingsInputParam :ivar type: Required. A Responses backend handles delegated work. - :vartype type: str or ~azure.ai.projects.models.RESPONSES + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationType """ acknowledgement_delay_ms: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -39154,11 +39158,11 @@ class VoiceAgentLiveResponsesDelegationConversationItem( Omitted for client delegations. :vartype response_id: str :ivar type: Required. DELEGATION. - :vartype type: str or ~azure.ai.projects.models.DELEGATION + :vartype type: str or ~azure.ai.projects.models.VoiceAgentLiveConversationItemType :ivar created_at: Observed delegation creation time, in Unix seconds. Required. :vartype created_at: ~datetime.datetime :ivar target: Required. RESPONSES. - :vartype target: str or ~azure.ai.projects.models.RESPONSES + :vartype target: str or ~azure.ai.projects.models.VoiceAgentLiveDelegationTarget :ivar output: Final backend text, omitted when unavailable; excludes raw tool output. :vartype output: str """ @@ -39307,7 +39311,7 @@ class VoiceAgentLlmGeneratedGreetingConfig( """A greeting authored by the session model from a scoped opening-turn prompt. :ivar type: Required. Generate the greeting with the session model from an opening-turn prompt. - :vartype type: str or ~azure.ai.projects.models.LLM_GENERATED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentGreetingMode :ivar prompt: The Handlebars prompt that guides the opening turn. Required. :vartype prompt: str :ivar tool_choice: The tool-selection policy for the opening response. Defaults to ``none``. Is @@ -39358,7 +39362,7 @@ class VoiceAgentLlmInterimResponseConfig( :ivar latency_threshold_ms: The latency threshold in milliseconds. :vartype latency_threshold_ms: ~datetime.timedelta :ivar type: Required. Generate an interim response with a language model. - :vartype type: str or ~azure.ai.projects.models.LLM_INTERIM_RESPONSE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentInterimResponseType :ivar model: The model used to generate interim responses. :vartype model: str :ivar instructions: Optional instructions for generating interim responses. @@ -39435,7 +39439,7 @@ class VoiceAgentMcpTool( version. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. A tool exposed by an MCP server. - :vartype type: str or ~azure.ai.projects.models.MCP + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar response_scheduling: When the MCP invocation creates a follow-up response. Defaults to ``when_idle``. Known values are: "silent", "when_idle", "interrupt", and "skip_if_busy". :vartype response_scheduling: str or ~azure.ai.projects.models.VoiceAgentToolResponseScheduling @@ -39565,8 +39569,7 @@ class VoiceAgentPostCallConfig(_Model): # pylint: disable=docstring-keyword-sho :ivar destinations: The destinations to notify. Required. :vartype destinations: list[~azure.ai.projects.models.VoiceAgentPostCallDestination] :ivar include: Additional content to include in each delivery. The transcript is always - delivered. ``audio`` is not supported in this preview; the service rejects it when the agent - version is saved. + delivered; add ``audio`` to also deliver a URL to the merged call recording. :vartype include: list[str or ~azure.ai.projects.models.VoiceAgentPostCallIncludeOption] """ @@ -39577,8 +39580,8 @@ class VoiceAgentPostCallConfig(_Model): # pylint: disable=docstring-keyword-sho include: Optional[list[Union[str, "_models.VoiceAgentPostCallIncludeOption"]]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Additional content to include in each delivery. The transcript is always delivered. ``audio`` - is not supported in this preview; the service rejects it when the agent version is saved.""" + """Additional content to include in each delivery. The transcript is always delivered; add + ``audio`` to also deliver a URL to the merged call recording.""" @overload def __init__( @@ -39881,7 +39884,7 @@ class VoiceAgentRoutinePostCallDestination( """A routine that is dispatched with the post-call event. :ivar type: The destination type. Always ``routine``. Required. A routine. - :vartype type: str or ~azure.ai.projects.models.ROUTINE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentPostCallDestinationType :ivar name: The name of the routine. Required. :vartype name: str """ @@ -39972,7 +39975,7 @@ class VoiceAgentSemanticVadTurnDetection( :ivar interrupt_response: :vartype interrupt_response: bool :ivar type: Required. Semantic voice activity detection. - :vartype type: str or ~azure.ai.projects.models.SEMANTIC_VAD + :vartype type: str or ~azure.ai.projects.models.VoiceAgentTurnDetectionType """ eagerness: Optional[Literal["low", "medium", "high", "auto"]] = rest_field( @@ -40014,7 +40017,7 @@ class VoiceAgentSendDtmfSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -40022,7 +40025,7 @@ class VoiceAgentSendDtmfSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``send_dtmf``. Required. Sends literal or templated keypad digits. - :vartype name: str or ~azure.ai.projects.models.SEND_DTMF + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -40057,7 +40060,7 @@ class VoiceAgentSendSmsSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -40065,7 +40068,7 @@ class VoiceAgentSendSmsSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``send_sms``. Required. Sends a text message from the Agent's SMS-capable number. - :vartype name: str or ~azure.ai.projects.models.SEND_SMS + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName """ __mapping__: dict[str, _Model] = {} @@ -40100,7 +40103,7 @@ class VoiceAgentServerEventInputCollectionStatus( :ivar type: The event type. Always ``input_collection.status``. Required. An asynchronous collection or telephony-operation outcome. - :vartype type: str or ~azure.ai.projects.models.INPUT_COLLECTION_STATUS + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: An optional event identifier. :vartype event_id: str :ivar call_id: The originating system-tool invocation. Required. @@ -40191,7 +40194,7 @@ class VoiceAgentServerEventResponseAnimationBlendshapesDelta( """The ``response.animation_blendshapes.delta`` server event. :ivar type: Required. RESPONSE_ANIMATION_BLENDSHAPES_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_ANIMATION_BLENDSHAPES_DELTA + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar response_id: Required. @@ -40256,7 +40259,7 @@ class VoiceAgentServerEventResponseAnimationBlendshapesDone( """The ``response.animation_blendshapes.done`` server event. :ivar type: Required. RESPONSE_ANIMATION_BLENDSHAPES_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_ANIMATION_BLENDSHAPES_DONE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar response_id: Required. @@ -40306,7 +40309,7 @@ class VoiceAgentServerEventResponseAnimationVisemeDelta( """The ``response.animation_viseme.delta`` server event. :ivar type: Required. RESPONSE_ANIMATION_VISEME_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_ANIMATION_VISEME_DELTA + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar response_id: Required. @@ -40373,7 +40376,7 @@ class VoiceAgentServerEventResponseAnimationVisemeDone( """The ``response.animation_viseme.done`` server event. :ivar type: Required. RESPONSE_ANIMATION_VISEME_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_ANIMATION_VISEME_DONE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar response_id: Required. @@ -40428,7 +40431,7 @@ class VoiceAgentServerEventResponseAudioTimestampDelta( """The ``response.audio_timestamp.delta`` server event. :ivar type: Required. RESPONSE_AUDIO_TIMESTAMP_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_AUDIO_TIMESTAMP_DELTA + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar response_id: Required. @@ -40446,7 +40449,7 @@ class VoiceAgentServerEventResponseAudioTimestampDelta( :ivar text: Required. :vartype text: str :ivar timestamp_type: Required. Word-level timestamps. - :vartype timestamp_type: str or ~azure.ai.projects.models.WORD + :vartype timestamp_type: str or ~azure.ai.projects.models.VoiceAgentAudioTimestampType """ type: Literal[VoiceAgentServerEventTypeExtension.RESPONSE_AUDIO_TIMESTAMP_DELTA] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -40509,7 +40512,7 @@ class VoiceAgentServerEventResponseAudioTimestampDone( """The ``response.audio_timestamp.done`` server event. :ivar type: Required. RESPONSE_AUDIO_TIMESTAMP_DONE. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_AUDIO_TIMESTAMP_DONE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar response_id: Required. @@ -40564,7 +40567,7 @@ class VoiceAgentServerEventResponseVideoDelta( """The ``response.video.delta`` server event. :ivar type: Required. RESPONSE_VIDEO_DELTA. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_VIDEO_DELTA + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar output_index: Required. @@ -40614,7 +40617,7 @@ class VoiceAgentServerEventRtcCallError( """The ``rtc.call.error`` server event: a WebRTC signaling failure. :ivar type: The event type. Always ``rtc.call.error``. Required. RTC_CALL_ERROR. - :vartype type: str or ~azure.ai.projects.models.RTC_CALL_ERROR + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: An optional server-generated event identifier. :vartype event_id: str :ivar operation: The signaling operation that failed, when known. @@ -40666,7 +40669,7 @@ class VoiceAgentServerEventRtcCallSdpCreated( """The ``rtc.call.sdp.created`` server event: the SDP answer that completes WebRTC negotiation. :ivar type: The event type. Always ``rtc.call.sdp.created``. Required. RTC_CALL_SDP_CREATED. - :vartype type: str or ~azure.ai.projects.models.RTC_CALL_SDP_CREATED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: The server-generated event identifier. Required. :vartype event_id: str :ivar rtc_call_id: The identifier of the established WebRTC call. Required. @@ -40711,7 +40714,7 @@ class VoiceAgentServerEventSessionAvatarConnecting( """The ``session.avatar.connecting`` server event. :ivar type: Required. SESSION_AVATAR_CONNECTING. - :vartype type: str or ~azure.ai.projects.models.SESSION_AVATAR_CONNECTING + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar server_sdp: The server's SDP answer for avatar media negotiation. Required. @@ -40751,7 +40754,7 @@ class VoiceAgentServerEventSessionAvatarSwitchToIdle( """The ``session.avatar.switch_to_idle`` server event. :ivar type: Required. SESSION_AVATAR_SWITCH_TO_IDLE. - :vartype type: str or ~azure.ai.projects.models.SESSION_AVATAR_SWITCH_TO_IDLE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar turn_id: @@ -40790,7 +40793,7 @@ class VoiceAgentServerEventSessionAvatarSwitchToSpeaking( """The ``session.avatar.switch_to_speaking`` server event. :ivar type: Required. SESSION_AVATAR_SWITCH_TO_SPEAKING. - :vartype type: str or ~azure.ai.projects.models.SESSION_AVATAR_SWITCH_TO_SPEAKING + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar turn_id: @@ -40854,7 +40857,7 @@ class VoiceAgentServerEventSessionHandoffAborted( :vartype error: ~azure.ai.projects.models.RealtimeServerEventErrorError :ivar type: The event type. Always ``session.handoff.aborted``. Required. SESSION_HANDOFF_ABORTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_HANDOFF_ABORTED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -40947,7 +40950,7 @@ class VoiceAgentServerEventSessionHandoffCompleted( :vartype duration_ms: ~datetime.timedelta :ivar type: The event type. Always ``session.handoff.completed``. Required. SESSION_HANDOFF_COMPLETED. - :vartype type: str or ~azure.ai.projects.models.SESSION_HANDOFF_COMPLETED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -41035,7 +41038,7 @@ class VoiceAgentServerEventSessionHandoffStarted( :vartype node_generation: int :ivar type: The event type. Always ``session.handoff.started``. Required. SESSION_HANDOFF_STARTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_HANDOFF_STARTED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension """ event_id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -41094,7 +41097,7 @@ class VoiceAgentServerEventSessionSubagentAborted( :ivar type: The event type. Always ``session.subagent.aborted``. Required. SESSION_SUBAGENT_ABORTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_SUBAGENT_ABORTED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: The server-generated event identifier. Required. :vartype event_id: str :ivar consultation_id: The identifier of the subagent consultation. Required. @@ -41154,7 +41157,7 @@ class VoiceAgentServerEventSessionSubagentCompleted( :ivar type: The event type. Always ``session.subagent.completed``. Required. SESSION_SUBAGENT_COMPLETED. - :vartype type: str or ~azure.ai.projects.models.SESSION_SUBAGENT_COMPLETED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: The server-generated event identifier. Required. :vartype event_id: str :ivar consultation_id: The identifier of the subagent consultation. Required. @@ -41205,7 +41208,7 @@ class VoiceAgentServerEventSessionSubagentStarted( :ivar type: The event type. Always ``session.subagent.started``. Required. SESSION_SUBAGENT_STARTED. - :vartype type: str or ~azure.ai.projects.models.SESSION_SUBAGENT_STARTED + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: The server-generated event identifier. Required. :vartype event_id: str :ivar consultation_id: The identifier of the subagent consultation. Required. @@ -41256,7 +41259,7 @@ class VoiceAgentServerEventSystemToolArgumentsDelta( :ivar type: The event type. Always ``response.system_tool_arguments.delta``. Required. An incremental fragment of model-generated system-tool arguments. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_SYSTEM_TOOL_ARGUMENTS_DELTA + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: The unique identifier of this server event. Required. :vartype event_id: str :ivar response_id: The response containing the tool invocation. Required. @@ -41324,7 +41327,7 @@ class VoiceAgentServerEventSystemToolArgumentsDone( :ivar type: The event type. Always ``response.system_tool_arguments.done``. Required. The complete model-generated system-tool arguments, not a provider outcome. - :vartype type: str or ~azure.ai.projects.models.RESPONSE_SYSTEM_TOOL_ARGUMENTS_DONE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: The unique identifier of this server event. Required. :vartype event_id: str :ivar response_id: The response containing the tool invocation. Required. @@ -41396,7 +41399,7 @@ class VoiceAgentServerEventWarning( """The ``warning`` server event. :ivar type: Required. WARNING. - :vartype type: str or ~azure.ai.projects.models.WARNING + :vartype type: str or ~azure.ai.projects.models.VoiceAgentServerEventTypeExtension :ivar event_id: Required. :vartype event_id: str :ivar warning: Required. @@ -41489,7 +41492,7 @@ class VoiceAgentServerVadTurnDetection( :ivar idle_timeout_ms: :vartype idle_timeout_ms: int :ivar type: Required. Server-side voice activity detection. - :vartype type: str or ~azure.ai.projects.models.SERVER_VAD + :vartype type: str or ~azure.ai.projects.models.VoiceAgentTurnDetectionType :ivar speech_duration_ms: Minimum speech duration required to trigger detection, in milliseconds. :vartype speech_duration_ms: ~datetime.timedelta @@ -42090,7 +42093,7 @@ class VoiceAgentStaticInterimResponseConfig( :ivar latency_threshold_ms: The latency threshold in milliseconds. :vartype latency_threshold_ms: ~datetime.timedelta :ivar type: Required. Select a static interim response from configured text. - :vartype type: str or ~azure.ai.projects.models.STATIC_INTERIM_RESPONSE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentInterimResponseType :ivar texts: Candidate text values for the interim response. :vartype texts: list[str] """ @@ -42259,7 +42262,7 @@ class VoiceAgentSystemToolItem( :ivar type: The output-item kind. Always ``system_tool``. Required. A service-managed system-tool intent, not a provider result. - :vartype type: str or ~azure.ai.projects.models.SYSTEM_TOOL + :vartype type: str or ~azure.ai.projects.models.VoiceAgentConversationItemTypeExtension :ivar id: The identifier of the generated item. :vartype id: str :ivar object: The realtime item marker. Default value is "realtime.item". @@ -42342,7 +42345,7 @@ class VoiceAgentTemplateGreetingConfig( without model-authored generation. :ivar type: Required. Speak a deterministic greeting rendered from a text template. - :vartype type: str or ~azure.ai.projects.models.TEMPLATE + :vartype type: str or ~azure.ai.projects.models.VoiceAgentGreetingMode :ivar text: The Handlebars text template spoken at session start. Required. :vartype text: str """ @@ -42379,7 +42382,7 @@ class VoiceAgentToolboxTool( :ivar type: The type of the tool. Always ``toolbox``. Required. A reference to a Foundry toolbox. - :vartype type: str or ~azure.ai.projects.models.TOOLBOX + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar toolbox_name: The name of the toolbox to attach. Required. :vartype toolbox_name: str :ivar toolbox_version: The immutable version of the toolbox to attach. Required. @@ -42615,7 +42618,7 @@ class VoiceAgentTransferSystemTool( :ivar type: The type of the tool. Always ``system``. Required. A service-managed control that acts on the active voice session. - :vartype type: str or ~azure.ai.projects.models.SYSTEM + :vartype type: str or ~azure.ai.projects.models.VoiceAgentToolType :ivar description: An optional description of the system tool. :vartype description: str :ivar timeout_seconds: Execution timeout, from 1 to 300 seconds. If omitted, the service @@ -42623,7 +42626,7 @@ class VoiceAgentTransferSystemTool( :vartype timeout_seconds: ~datetime.timedelta :ivar name: The service-managed control action. Always ``transfer``. Required. Requests a transfer to an explicitly configured logical target. - :vartype name: str or ~azure.ai.projects.models.TRANSFER + :vartype name: str or ~azure.ai.projects.models.VoiceAgentSystemToolName :ivar require_handoff: Require a non-blank handoff summary in each model-generated transfer call. Defaults to false; does not guarantee delivery to the recipient. :vartype require_handoff: bool @@ -43033,7 +43036,7 @@ class VoiceHostedAgentConversationEngine( :ivar type: Selects a hosted Foundry agent as the conversation engine. Required. Use a hosted Foundry agent to handle the conversation. - :vartype type: str or ~azure.ai.projects.models.HOSTED_AGENT + :vartype type: str or ~azure.ai.projects.models.VoiceConversationEngineType :ivar name: The non-empty DNS-like name of the target hosted text agent in the same project. Required. :vartype name: str @@ -43155,10 +43158,10 @@ class VoiceRecordingChannelLayout(_Model): # pylint: disable=docstring-keyword- :ivar left: The role carried on the left channel. Always ``user``. Required. Audio produced by the user. - :vartype left: str or ~azure.ai.projects.models.USER + :vartype left: str or ~azure.ai.projects.models.VoiceAudioRole :ivar right: The role carried on the right channel. Always ``agent``. Required. Audio produced by the agent. - :vartype right: str or ~azure.ai.projects.models.AGENT + :vartype right: str or ~azure.ai.projects.models.VoiceAudioRole """ left: Literal[VoiceAudioRole.USER] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -43417,7 +43420,7 @@ class WebIQPreviewTool( """A WebIQ server-side tool. :ivar type: The object type, which is always 'web_iq_preview'. Required. WEB_IQ_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.WEB_IQ_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar project_connection_id: The ID of the WebIQ project connection. Required. :vartype project_connection_id: str :ivar server_label: The label of the WebIQ MCP server to connect to. When omitted, the service @@ -43477,7 +43480,7 @@ class WebIQPreviewToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. WEB_IQ_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.WEB_IQ_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar project_connection_id: The ID of the WebIQ project connection. Required. :vartype project_connection_id: str :ivar server_label: The label of the WebIQ MCP server to connect to. When omitted, the service @@ -43613,7 +43616,7 @@ class WebSearchPreviewTool( :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.projects.models.WEB_SEARCH_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar user_location: :vartype user_location: ~azure.ai.projects.models.ApproximateLocation :ivar search_context_size: High level guidance for the amount of context window space to use @@ -43666,7 +43669,7 @@ class WebSearchTool(Tool, discriminator="web_search"): # pylint: disable=docstr :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.projects.models.WEB_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar external_web_access: Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content. @@ -43769,7 +43772,7 @@ class WebSearchToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. WEB_SEARCH. - :vartype type: str or ~azure.ai.projects.models.WEB_SEARCH + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar external_web_access: Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content. @@ -43874,7 +43877,7 @@ class WeeklyRecurrenceSchedule( """Weekly recurrence schedule. :ivar type: Weekly recurrence type. Required. Weekly recurrence pattern. - :vartype type: str or ~azure.ai.projects.models.WEEKLY + :vartype type: str or ~azure.ai.projects.models.RecurrenceType :ivar days_of_week: Days of the week for the recurrence schedule. Required. :vartype days_of_week: list[str or ~azure.ai.projects.models.DayOfWeek] """ @@ -43916,7 +43919,7 @@ class WorkflowAgentDefinition( :ivar rai_config: Configuration for Responsible AI (RAI) content filtering and safety features. :vartype rai_config: ~azure.ai.projects.models.RaiConfig :ivar kind: Required. WORKFLOW. - :vartype kind: str or ~azure.ai.projects.models.WORKFLOW + :vartype kind: str or ~azure.ai.projects.models.AgentKind :ivar workflow: The CSDL YAML definition of the workflow. :vartype workflow: str """ @@ -43952,7 +43955,7 @@ class WorkIQPreviewTool( """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.projects.models.WORK_IQ_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolType :ivar project_connection_id: The ID of the WorkIQ project connection. Required. :vartype project_connection_id: str """ @@ -43995,7 +43998,7 @@ class WorkIQPreviewToolboxTool( are silently ignored at runtime. :vartype tool_configs: dict[str, ~azure.ai.projects.models.ToolConfig] :ivar type: Required. WORK_IQ_PREVIEW. - :vartype type: str or ~azure.ai.projects.models.WORK_IQ_PREVIEW + :vartype type: str or ~azure.ai.projects.models.ToolboxToolType :ivar project_connection_id: The ID of the WorkIQ project connection. Required. :vartype project_connection_id: str """ diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py index ceec269ca869..efd6ef27b526 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py @@ -79,7 +79,6 @@ "schedules": _FoundryFeaturesOptInKeys.SCHEDULES_V1_PREVIEW.value, "skills": _FoundryFeaturesOptInKeys.SKILLS_V1_PREVIEW.value, "voice_agents": _AgentDefinitionOptInKeys.VOICE_AGENTS_V1_PREVIEW.value, - "agents": _AGENT_OPERATION_FEATURE_HEADERS, } """Foundry-Features header values keyed by beta sub-client property name.""" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py index ae40253e5f4f..ae5464699212 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py @@ -13,6 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import BetaOperations # type: ignore +from ._operations import VoiceAgentsOperations # type: ignore from ._operations import AgentsOperations # type: ignore from ._operations import EvaluationRulesOperations # type: ignore from ._operations import DatasetsOperations # type: ignore @@ -28,6 +29,7 @@ __all__ = [ "BetaOperations", + "VoiceAgentsOperations", "AgentsOperations", "EvaluationRulesOperations", "DatasetsOperations", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 8ea15a66086c..9bb25d66002b 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -76,6 +76,27 @@ def build_agents_get_request(agent_name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_agents_create_from_prompt_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: str = kwargs.pop("content_type") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/agents:generate" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_agents_delete_request(agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2226,27 +2247,6 @@ def build_toolboxes_delete_version_request(name: str, version: str, **kwargs: An return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_agents_create_from_prompt_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: str = kwargs.pop("content_type") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/agents:generate" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - def build_beta_agent_insight_monitors_list_request( # pylint: disable=name-too-long *, after: Optional[str] = None, @@ -4245,7 +4245,7 @@ def build_beta_skills_delete_version_request(name: str, version: str, **kwargs: return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_list_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_list_request( # pylint: disable=name-too-long agent_name: str, *, limit: Optional[int] = None, @@ -4285,7 +4285,7 @@ def build_beta_voice_agents_conversations_list_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_get_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_get_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4312,7 +4312,7 @@ def build_beta_voice_agents_conversations_get_request( # pylint: disable=name-t return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_delete_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_delete_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4333,7 +4333,7 @@ def build_beta_voice_agents_conversations_delete_request( # pylint: disable=nam return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_voice_agents_conversations_list_responses_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_list_responses_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, *, @@ -4375,7 +4375,7 @@ def build_beta_voice_agents_conversations_list_responses_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_get_response_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_get_response_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, response_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4403,7 +4403,7 @@ def build_beta_voice_agents_conversations_get_response_request( # pylint: disab return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_list_response_items_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_list_response_items_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, response_id: str, @@ -4447,7 +4447,7 @@ def build_beta_voice_agents_conversations_list_response_items_request( # pylint return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_list_items_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_list_items_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, *, @@ -4489,7 +4489,7 @@ def build_beta_voice_agents_conversations_list_items_request( # pylint: disable return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_get_item_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_get_item_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4517,7 +4517,7 @@ def build_beta_voice_agents_conversations_get_item_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_get_audio_item_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_get_audio_item_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4545,7 +4545,7 @@ def build_beta_voice_agents_conversations_get_audio_item_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_download_audio_item_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_download_audio_item_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4573,7 +4573,7 @@ def build_beta_voice_agents_conversations_download_audio_item_request( # pylint return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_get_generated_audio_item_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_get_generated_audio_item_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4603,7 +4603,7 @@ def build_beta_voice_agents_conversations_get_generated_audio_item_request( # p return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_download_generated_audio_item_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_download_generated_audio_item_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4631,7 +4631,7 @@ def build_beta_voice_agents_conversations_download_generated_audio_item_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_get_audio_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_get_audio_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4658,7 +4658,7 @@ def build_beta_voice_agents_conversations_get_audio_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_conversations_download_audio_request( # pylint: disable=name-too-long +def build_voice_agents_conversations_download_audio_request( # pylint: disable=name-too-long agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4685,9 +4685,45 @@ def build_beta_voice_agents_conversations_download_audio_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_list_request( # pylint: disable=name-too-long +def build_voice_agents_telephony_create_binding_request( # pylint: disable=name-too-long + agent_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/agents/{agent_name}/telephony/bindings" + path_format_arguments = { + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if "Repeatability-Request-ID" not in _headers: + _headers["Repeatability-Request-ID"] = str(uuid.uuid4()) + if "Repeatability-First-Sent" not in _headers: + _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( + datetime.datetime.now(datetime.timezone.utc), "rfc-1123" + ) + 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, params=_params, headers=_headers, **kwargs) + + +def build_voice_agents_telephony_list_bindings_request( # pylint: disable=name-too-long agent_name: str, *, + provider: Optional[Union[str, _models.TelephonyProvider]] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, @@ -4701,7 +4737,7 @@ def build_beta_voice_agents_live_conversations_list_request( # pylint: disable= accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations" + _url = "/agents/{agent_name}/telephony/bindings" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } @@ -4709,6 +4745,8 @@ def build_beta_voice_agents_live_conversations_list_request( # pylint: disable= _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if provider is not None: + _params["provider"] = _SERIALIZER.query("provider", provider, "str") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") if order is not None: @@ -4725,8 +4763,8 @@ def build_beta_voice_agents_live_conversations_list_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_get_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, **kwargs: Any +def build_voice_agents_telephony_get_binding_request( # pylint: disable=name-too-long + agent_name: str, binding_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4735,10 +4773,10 @@ def build_beta_voice_agents_live_conversations_get_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}" + _url = "/agents/{agent_name}/telephony/bindings/{binding_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), + "binding_id": _SERIALIZER.url("binding_id", binding_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4752,17 +4790,21 @@ def build_beta_voice_agents_live_conversations_get_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_delete_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, **kwargs: Any +def build_voice_agents_telephony_update_binding_request( # pylint: disable=name-too-long + agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}" + _url = "/agents/{agent_name}/telephony/bindings/{binding_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), + "binding_id": _SERIALIZER.url("binding_id", binding_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4770,13 +4812,57 @@ def build_beta_voice_agents_live_conversations_delete_request( # pylint: disabl # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # 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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_list_items_request( # pylint: disable=name-too-long +def build_voice_agents_telephony_delete_binding_request( # pylint: disable=name-too-long + agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/agents/{agent_name}/telephony/bindings/{binding_id}" + path_format_arguments = { + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "binding_id": _SERIALIZER.url("binding_id", binding_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_voice_agents_telephony_list_calls_request( # pylint: disable=name-too-long agent_name: str, - conversation_id: str, *, + provider: Optional[Union[str, _models.TelephonyProvider]] = None, + status: Optional[Union[str, _models.TelephonyCallStatus]] = None, + started_after_time: Optional[datetime.datetime] = None, + started_before_time: Optional[datetime.datetime] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, @@ -4790,15 +4876,22 @@ def build_beta_voice_agents_live_conversations_list_items_request( # pylint: di accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items" + _url = "/agents/{agent_name}/telephony/calls" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if provider is not None: + _params["provider"] = _SERIALIZER.query("provider", provider, "str") + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + if started_after_time is not None: + _params["started_after"] = _SERIALIZER.query("started_after_time", started_after_time, "unix-time") + if started_before_time is not None: + _params["started_before"] = _SERIALIZER.query("started_before_time", started_before_time, "unix-time") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") if order is not None: @@ -4815,8 +4908,8 @@ def build_beta_voice_agents_live_conversations_list_items_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_get_item_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, item_id: str, **kwargs: Any +def build_voice_agents_telephony_get_call_request( # pylint: disable=name-too-long + agent_name: str, call_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4825,11 +4918,10 @@ def build_beta_voice_agents_live_conversations_get_item_request( # pylint: disa accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items/{item_id}" + _url = "/agents/{agent_name}/telephony/calls/{call_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), - "item_id": _SERIALIZER.url("item_id", item_id, "str"), + "call_id": _SERIALIZER.url("call_id", call_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4843,21 +4935,21 @@ def build_beta_voice_agents_live_conversations_get_item_request( # pylint: disa return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_get_audio_item_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, item_id: str, **kwargs: Any +def build_voice_agents_telephony_transfer_call_request( # pylint: disable=name-too-long + agent_name: str, call_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items/{item_id}/audio" + _url = "/agents/{agent_name}/telephony/calls/{call_id}:transfer" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), - "item_id": _SERIALIZER.url("item_id", item_id, "str"), + "call_id": _SERIALIZER.url("call_id", call_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4866,26 +4958,27 @@ def build_beta_voice_agents_live_conversations_get_audio_item_request( # pylint _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_download_audio_item_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, item_id: str, **kwargs: Any +def build_voice_agents_telephony_end_call_request( # pylint: disable=name-too-long + agent_name: str, call_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "audio/wav") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items/{item_id}/audio/content" + _url = "/agents/{agent_name}/telephony/calls/{call_id}:end" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), - "item_id": _SERIALIZER.url("item_id", item_id, "str"), + "call_id": _SERIALIZER.url("call_id", call_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4896,11 +4989,11 @@ def build_beta_voice_agents_live_conversations_download_audio_item_request( # p # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_get_audio_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, **kwargs: Any +def build_voice_agents_telephony_get_transfer_targets_request( # pylint: disable=name-too-long + agent_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4909,10 +5002,9 @@ def build_beta_voice_agents_live_conversations_get_audio_request( # pylint: dis accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/audio" + _url = "/agents/{agent_name}/telephony/transfer_targets" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4926,20 +5018,20 @@ def build_beta_voice_agents_live_conversations_get_audio_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_live_conversations_download_audio_request( # pylint: disable=name-too-long - agent_name: str, conversation_id: str, **kwargs: Any +def build_voice_agents_telephony_replace_transfer_targets_request( # pylint: disable=name-too-long + agent_name: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "audio/wav") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/audio/content" + _url = "/agents/{agent_name}/telephony/transfer_targets" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4948,13 +5040,21 @@ def build_beta_voice_agents_live_conversations_download_audio_request( # pylint _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_create_binding_request( # pylint: disable=name-too-long - agent_name: str, **kwargs: Any +def build_voice_agents_telephony_create_call_job_request( # pylint: disable=name-too-long + agent_name: str, *, idempotency_key: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4964,7 +5064,7 @@ def build_beta_voice_agents_telephony_create_binding_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/bindings" + _url = "/agents/{agent_name}/telephony_call_jobs" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } @@ -4975,12 +5075,7 @@ def build_beta_voice_agents_telephony_create_binding_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if "Repeatability-Request-ID" not in _headers: - _headers["Repeatability-Request-ID"] = str(uuid.uuid4()) - if "Repeatability-First-Sent" not in _headers: - _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( - datetime.datetime.now(datetime.timezone.utc), "rfc-1123" - ) + _headers["Idempotency-Key"] = _SERIALIZER.header("idempotency_key", idempotency_key, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4988,14 +5083,15 @@ def build_beta_voice_agents_telephony_create_binding_request( # pylint: disable return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_list_bindings_request( # pylint: disable=name-too-long +def build_voice_agents_telephony_list_call_jobs_request( # pylint: disable=name-too-long agent_name: str, *, - provider: Optional[Union[str, _models.TelephonyProvider]] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, before: Optional[str] = None, + status: Optional[Union[str, _models.TelephonyCallJobStatus]] = None, + campaign_name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5005,7 +5101,7 @@ def build_beta_voice_agents_telephony_list_bindings_request( # pylint: disable= accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/bindings" + _url = "/agents/{agent_name}/telephony_call_jobs" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } @@ -5013,8 +5109,6 @@ def build_beta_voice_agents_telephony_list_bindings_request( # pylint: disable= _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if provider is not None: - _params["provider"] = _SERIALIZER.query("provider", provider, "str") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") if order is not None: @@ -5023,6 +5117,10 @@ def build_beta_voice_agents_telephony_list_bindings_request( # pylint: disable= _params["after"] = _SERIALIZER.query("after", after, "str") if before is not None: _params["before"] = _SERIALIZER.query("before", before, "str") + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + if campaign_name is not None: + _params["campaign_name"] = _SERIALIZER.query("campaign_name", campaign_name, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -5031,20 +5129,17 @@ def build_beta_voice_agents_telephony_list_bindings_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_get_binding_request( # pylint: disable=name-too-long - agent_name: str, binding_id: str, **kwargs: Any +def build_voice_agents_telephony_delete_call_job_request( # pylint: disable=name-too-long + agent_name: str, call_job_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/agents/{agent_name}/telephony/bindings/{binding_id}" + _url = "/agents/{agent_name}/telephony_call_jobs/{call_job_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "binding_id": _SERIALIZER.url("binding_id", binding_id, "str"), + "call_job_id": _SERIALIZER.url("call_job_id", call_job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5052,27 +5147,23 @@ def build_beta_voice_agents_telephony_get_binding_request( # pylint: disable=na # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_voice_agents_telephony_update_binding_request( # pylint: disable=name-too-long - agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any +def build_voice_agents_telephony_get_call_job_request( # pylint: disable=name-too-long + agent_name: str, call_job_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/bindings/{binding_id}" + _url = "/agents/{agent_name}/telephony_call_jobs/{call_job_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "binding_id": _SERIALIZER.url("binding_id", binding_id, "str"), + "call_job_id": _SERIALIZER.url("call_job_id", call_job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5081,31 +5172,25 @@ def build_beta_voice_agents_telephony_update_binding_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_delete_binding_request( # pylint: disable=name-too-long - agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any +def build_voice_agents_telephony_cancel_call_job_request( # pylint: disable=name-too-long + agent_name: str, call_job_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/agents/{agent_name}/telephony/bindings/{binding_id}" + _url = "/agents/{agent_name}/telephony_call_jobs/{call_job_id}:cancel" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "binding_id": _SERIALIZER.url("binding_id", binding_id, "str"), + "call_job_id": _SERIALIZER.url("call_job_id", call_job_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5114,6 +5199,7 @@ def build_beta_voice_agents_telephony_delete_binding_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -5121,16 +5207,12 @@ def build_beta_voice_agents_telephony_delete_binding_request( # pylint: disable if if_none_match is not None: _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_list_calls_request( # pylint: disable=name-too-long +def build_beta_voice_agents_live_conversations_list_request( # pylint: disable=name-too-long agent_name: str, *, - provider: Optional[Union[str, _models.TelephonyProvider]] = None, - status: Optional[Union[str, _models.TelephonyCallStatus]] = None, - started_after_time: Optional[datetime.datetime] = None, - started_before_time: Optional[datetime.datetime] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, @@ -5144,7 +5226,7 @@ def build_beta_voice_agents_telephony_list_calls_request( # pylint: disable=nam accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/calls" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } @@ -5152,14 +5234,6 @@ def build_beta_voice_agents_telephony_list_calls_request( # pylint: disable=nam _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if provider is not None: - _params["provider"] = _SERIALIZER.query("provider", provider, "str") - if status is not None: - _params["status"] = _SERIALIZER.query("status", status, "str") - if started_after_time is not None: - _params["started_after"] = _SERIALIZER.query("started_after_time", started_after_time, "unix-time") - if started_before_time is not None: - _params["started_before"] = _SERIALIZER.query("started_before_time", started_before_time, "unix-time") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") if order is not None: @@ -5176,8 +5250,8 @@ def build_beta_voice_agents_telephony_list_calls_request( # pylint: disable=nam return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_get_call_request( # pylint: disable=name-too-long - agent_name: str, call_id: str, **kwargs: Any +def build_beta_voice_agents_live_conversations_get_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5186,10 +5260,10 @@ def build_beta_voice_agents_telephony_get_call_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/calls/{call_id}" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "call_id": _SERIALIZER.url("call_id", call_id, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5203,50 +5277,17 @@ def build_beta_voice_agents_telephony_get_call_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_transfer_call_request( # pylint: disable=name-too-long - agent_name: str, call_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/agents/{agent_name}/telephony/calls/{call_id}:transfer" - path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "call_id": _SERIALIZER.url("call_id", call_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # 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, params=_params, headers=_headers, **kwargs) - - -def build_beta_voice_agents_telephony_end_call_request( # pylint: disable=name-too-long - agent_name: str, call_id: str, **kwargs: Any +def build_beta_voice_agents_live_conversations_delete_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/agents/{agent_name}/telephony/calls/{call_id}:end" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "call_id": _SERIALIZER.url("call_id", call_id, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5254,14 +5295,18 @@ def build_beta_voice_agents_telephony_end_call_request( # pylint: disable=name- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_voice_agents_telephony_get_transfer_targets_request( # pylint: disable=name-too-long - agent_name: str, **kwargs: Any +def build_beta_voice_agents_live_conversations_list_items_request( # pylint: disable=name-too-long + agent_name: str, + conversation_id: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.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 {}) @@ -5270,14 +5315,23 @@ def build_beta_voice_agents_telephony_get_transfer_targets_request( # pylint: d accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/transfer_targets" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_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") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -5286,20 +5340,21 @@ def build_beta_voice_agents_telephony_get_transfer_targets_request( # pylint: d return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_replace_transfer_targets_request( # pylint: disable=name-too-long - agent_name: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any +def build_beta_voice_agents_live_conversations_get_item_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony/transfer_targets" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items/{item_id}" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), + "item_id": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5308,33 +5363,26 @@ def build_beta_voice_agents_telephony_replace_transfer_targets_request( # pylin _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # 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") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_create_call_job_request( # pylint: disable=name-too-long - agent_name: str, *, idempotency_key: str, **kwargs: Any +def build_beta_voice_agents_live_conversations_get_audio_item_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony_call_jobs" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items/{item_id}/audio" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), + "item_id": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5343,52 +5391,31 @@ def build_beta_voice_agents_telephony_create_call_job_request( # pylint: disabl _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Idempotency-Key"] = _SERIALIZER.header("idempotency_key", idempotency_key, "str") - 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, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_list_call_jobs_request( # pylint: disable=name-too-long - agent_name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - status: Optional[Union[str, _models.TelephonyCallJobStatus]] = None, - campaign_name: Optional[str] = None, - **kwargs: Any +def build_beta_voice_agents_live_conversations_download_audio_item_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, item_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "audio/wav") # Construct URL - _url = "/agents/{agent_name}/telephony_call_jobs" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/items/{item_id}/audio/content" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), + "item_id": _SERIALIZER.url("item_id", item_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") - if status is not None: - _params["status"] = _SERIALIZER.query("status", status, "str") - if campaign_name is not None: - _params["campaign_name"] = _SERIALIZER.query("campaign_name", campaign_name, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -5397,29 +5424,8 @@ def build_beta_voice_agents_telephony_list_call_jobs_request( # pylint: disable return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_delete_call_job_request( # pylint: disable=name-too-long - agent_name: str, call_job_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - # Construct URL - _url = "/agents/{agent_name}/telephony_call_jobs/{call_job_id}" - path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "call_job_id": _SERIALIZER.url("call_job_id", call_job_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_beta_voice_agents_telephony_get_call_job_request( # pylint: disable=name-too-long - agent_name: str, call_job_id: str, **kwargs: Any +def build_beta_voice_agents_live_conversations_get_audio_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5428,10 +5434,10 @@ def build_beta_voice_agents_telephony_get_call_job_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/telephony_call_jobs/{call_job_id}" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/audio" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "call_job_id": _SERIALIZER.url("call_job_id", call_job_id, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5445,20 +5451,20 @@ def build_beta_voice_agents_telephony_get_call_job_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_telephony_cancel_call_job_request( # pylint: disable=name-too-long - agent_name: str, call_job_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any +def build_beta_voice_agents_live_conversations_download_audio_request( # pylint: disable=name-too-long + agent_name: str, conversation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "audio/wav") # Construct URL - _url = "/agents/{agent_name}/telephony_call_jobs/{call_job_id}:cancel" + _url = "/agents/{agent_name}/endpoint/protocols/voice/live/conversations/{conversation_id}/audio/content" path_format_arguments = { "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "call_job_id": _SERIALIZER.url("call_job_id", call_job_id, "str"), + "conversation_id": _SERIALIZER.url("conversation_id", conversation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5468,17 +5474,11 @@ def build_beta_voice_agents_telephony_cancel_call_job_request( # pylint: disabl # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["if-none-match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_create_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_create_request( # pylint: disable=name-too-long agent_name: str, campaign_name: str, *, @@ -5522,7 +5522,7 @@ def build_beta_voice_agents_campaigns_create_request( # pylint: disable=name-to return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_get_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_get_request( # pylint: disable=name-too-long agent_name: str, campaign_name: str, *, operation_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5551,7 +5551,7 @@ def build_beta_voice_agents_campaigns_get_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_list_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_list_request( # pylint: disable=name-too-long agent_name: str, *, limit: Optional[int] = None, @@ -5594,7 +5594,7 @@ def build_beta_voice_agents_campaigns_list_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_cancel_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_cancel_request( # pylint: disable=name-too-long agent_name: str, campaign_name: str, *, @@ -5635,7 +5635,7 @@ def build_beta_voice_agents_campaigns_cancel_request( # pylint: disable=name-to return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_delete_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_delete_request( # pylint: disable=name-too-long agent_name: str, campaign_name: str, *, @@ -5673,7 +5673,7 @@ def build_beta_voice_agents_campaigns_delete_request( # pylint: disable=name-to return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_list_validation_errors_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_list_validation_errors_request( # pylint: disable=name-too-long agent_name: str, campaign_name: str, *, @@ -5715,7 +5715,7 @@ def build_beta_voice_agents_campaigns_list_validation_errors_request( # pylint: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_voice_agents_campaigns_get_operation_request( # pylint: disable=name-too-long +def build_beta_voice_agents_telephony_get_operation_request( # pylint: disable=name-too-long agent_name: str, campaign_name: str, operation_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5761,7 +5761,6 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self.voice_agents = BetaVoiceAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.agent_insight_monitors = BetaAgentInsightMonitorsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -5778,6 +5777,29 @@ def __init__(self, *args, **kwargs) -> None: self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) +class VoiceAgentsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`voice_agents` 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: AIProjectClientConfiguration = 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") + + self.conversations = VoiceAgentsConversationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.telephony = VoiceAgentsTelephonyOperations(self._client, self._config, self._serialize, self._deserialize) + + class AgentsOperations: # pylint: disable=docstring-missing-param,too-many-public-methods """ .. warning:: @@ -5863,26 +5885,99 @@ def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: return deserialized # type: ignore @distributed_trace - def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> _models.DeleteAgentResponse: - """Delete an agent. + def create_from_prompt(self, body: "_unions.GenerateAgentRequest", **kwargs: Any) -> _models.AgentDetails: + """Generate an agent. - Deletes an agent. For hosted agents, if any version has active sessions, the request is - rejected with HTTP 409 unless ``force`` is set to true. When force is true, all associated - sessions are cascade-deleted along with the agent and its versions. + Generates and creates an agent from kind-specific high-level inputs. The generated definition + remains fully editable through the standard agent versioning operations. - :param agent_name: The name of the agent to delete. Required. - :type agent_name: str - :keyword force: For Hosted Agents, if ``true``, force-deletes the agent even if its versions - have active sessions, cascading deletion to all associated sessions. The service defaults to - ``false`` if a value is not specified by the caller. This value is not relevant for other Agent - types. Default value is None. - :paramtype force: bool - :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, + :param body: The kind-specific inputs for generating and creating an agent. Is one of the + following types: GenerateVoiceAgentRequest Required. + :type body: ~azure.ai.projects.models.GenerateVoiceAgentRequest + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_create_from_prompt_request( + content_type=content_type, + api_version=self._config.api_version, + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> _models.DeleteAgentResponse: + """Delete an agent. + + Deletes an agent. For hosted agents, if any version has active sessions, the request is + rejected with HTTP 409 unless ``force`` is set to true. When force is true, all associated + sessions are cascade-deleted along with the agent and its versions. + + :param agent_name: The name of the agent to delete. Required. + :type agent_name: str + :keyword force: For Hosted Agents, if ``true``, force-deletes the agent even if its versions + have active sessions, cascading deletion to all associated sessions. The service defaults to + ``false`` if a value is not specified by the caller. This value is not relevant for other Agent + types. Default value is None. + :paramtype force: bool + :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteAgentResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, @@ -14491,109 +14586,12 @@ def __init__(self, *args, **kwargs) -> None: 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") - self.conversations = BetaVoiceAgentsConversationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.live_conversations = BetaVoiceAgentsLiveConversationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.telephony = BetaVoiceAgentsTelephonyOperations( self._client, self._config, self._serialize, self._deserialize ) - self.campaigns = BetaVoiceAgentsCampaignsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class BetaAgentsOperations: # pylint: disable=docstring-missing-param - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`agents` 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: AIProjectClientConfiguration = 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") - - @distributed_trace - def create_from_prompt(self, body: "_unions.GenerateAgentRequest", **kwargs: Any) -> _models.AgentDetails: - """Generate an agent. - - Generates and creates an agent from kind-specific high-level inputs. The generated definition - remains fully editable through the standard agent versioning operations. - - :param body: The kind-specific inputs for generating and creating an agent. Is one of the - following types: GenerateVoiceAgentRequest Required. - :type body: ~azure.ai.projects.models.GenerateVoiceAgentRequest - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) - - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_agents_create_from_prompt_request( - content_type=content_type, - api_version=self._config.api_version, - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentDetails, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore class BetaAgentInsightMonitorsOperations: # pylint: disable=docstring-missing-param @@ -22729,7 +22727,7 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele return deserialized # type: ignore -class BetaVoiceAgentsConversationsOperations: # pylint: disable=docstring-missing-param +class VoiceAgentsConversationsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -22797,7 +22795,7 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_request( + _request = build_voice_agents_conversations_list_request( agent_name=agent_name, limit=limit, order=order, @@ -22872,7 +22870,7 @@ def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.V cls: ClsType[_models.VoiceConversation] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_request( + _request = build_voice_agents_conversations_get_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -22945,7 +22943,7 @@ def delete( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_delete_request( + _request = build_voice_agents_conversations_delete_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -23030,7 +23028,7 @@ def list_responses( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_responses_request( + _request = build_voice_agents_conversations_list_responses_request( agent_name=agent_name, conversation_id=conversation_id, limit=limit, @@ -23111,7 +23109,7 @@ def get_response( cls: ClsType[_models.VoiceResponse] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_response_request( + _request = build_voice_agents_conversations_get_response_request( agent_name=agent_name, conversation_id=conversation_id, response_id=response_id, @@ -23213,7 +23211,7 @@ def list_response_items( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_response_items_request( + _request = build_voice_agents_conversations_list_response_items_request( agent_name=agent_name, conversation_id=conversation_id, response_id=response_id, @@ -23316,7 +23314,7 @@ def list_items( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_conversations_list_items_request( + _request = build_voice_agents_conversations_list_items_request( agent_name=agent_name, conversation_id=conversation_id, limit=limit, @@ -23400,7 +23398,7 @@ def get_item( cls: ClsType[_models.RealtimeConversationItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_item_request( + _request = build_voice_agents_conversations_get_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -23481,7 +23479,7 @@ def get_audio_item( cls: ClsType[_models.VoiceAudioItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_audio_item_request( + _request = build_voice_agents_conversations_get_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -23561,7 +23559,7 @@ def download_audio_item( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_download_audio_item_request( + _request = build_voice_agents_conversations_download_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -23641,7 +23639,7 @@ def get_generated_audio_item( cls: ClsType[_models.VoiceGeneratedAudioItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_generated_audio_item_request( + _request = build_voice_agents_conversations_get_generated_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -23722,7 +23720,7 @@ def download_generated_audio_item( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_download_generated_audio_item_request( + _request = build_voice_agents_conversations_download_generated_audio_item_request( agent_name=agent_name, conversation_id=conversation_id, item_id=item_id, @@ -23805,7 +23803,7 @@ def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo cls: ClsType[_models.VoiceRecording] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_get_audio_request( + _request = build_voice_agents_conversations_get_audio_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -23885,7 +23883,7 @@ def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_conversations_download_audio_request( + _request = build_voice_agents_conversations_download_audio_request( agent_name=agent_name, conversation_id=conversation_id, api_version=self._config.api_version, @@ -23929,14 +23927,14 @@ def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) - return deserialized # type: ignore -class BetaVoiceAgentsLiveConversationsOperations: # pylint: disable=docstring-missing-param,name-too-long +class VoiceAgentsTelephonyOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`live_conversations` attribute. + :attr:`telephony` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -23946,116 +23944,90 @@ def __init__(self, *args, **kwargs) -> None: 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") - @distributed_trace - def list( + @overload + def create_binding( self, agent_name: str, + binding: _models.TelephonyBinding, *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.VoiceAgentLiveConversation"]: - """List Live voice agent conversations. + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - Lists stored Live conversations for this agent, including sessions stored via an override. + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: 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.projects.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 VoiceAgentLiveConversation - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversation] + :param binding: The provider-specific binding to create. Required. + :type binding: ~azure.ai.projects.models.TelephonyBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VoiceAgentLiveConversation]] = kwargs.pop("cls", None) + @overload + def create_binding( + self, agent_name: str, binding: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - def prepare_request(_continuation_token=None): + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding: The provider-specific binding to create. Required. + :type binding: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ - _request = build_beta_voice_agents_live_conversations_list_request( - agent_name=agent_name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - 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 = _deserialize( - List[_models.VoiceAgentLiveConversation], - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + @overload + def create_binding( + self, agent_name: str, binding: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - return pipeline_response + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - return ItemPaged(get_next, extract_data) + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding: The provider-specific binding to create. Required. + :type binding: 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: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceAgentLiveConversation: - """Get a Live voice agent conversation. + def create_binding( + self, agent_name: str, binding: Union[_models.TelephonyBinding, JSON, IO[bytes]], **kwargs: Any + ) -> _models.TelephonyBinding: + """Create an agent telephony binding. - Gets a stored Live conversation; fetch items separately. Returns 404 if absent or not stored. + Creates a telephony binding for the voice agent named in the path. Creating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: VoiceAgentLiveConversation. The VoiceAgentLiveConversation is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversation + :param binding: The provider-specific binding to create. Is one of the following types: + TelephonyBinding, JSON, IO[bytes] Required. + :type binding: ~azure.ai.projects.models.TelephonyBinding or JSON or IO[bytes] + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24066,15 +24038,24 @@ def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.V } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VoiceAgentLiveConversation] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(binding, (IOBase, bytes)): + _content = binding + else: + _content = json.dumps(binding, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_voice_agents_telephony_create_binding_request( agent_name=agent_name, - conversation_id=conversation_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -24091,7 +24072,7 @@ def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.V response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -24104,97 +24085,39 @@ def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.V ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.VoiceAgentLiveConversation, response.json()) + deserialized = _deserialize(_models.TelephonyBinding, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, agent_name: str, conversation_id: str, **kwargs: Any - ) -> None: - """Delete a Live voice agent conversation. - - Deletes the stored conversation and its items/audio, without closing the Live session. - - :param agent_name: The name of the Live voice agent. Required. - :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[None] = kwargs.pop("cls", None) - - _request = build_beta_voice_agents_live_conversations_delete_request( - agent_name=agent_name, - conversation_id=conversation_id, - api_version=self._config.api_version, - 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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_items( + def list_bindings( self, agent_name: str, - conversation_id: str, *, + provider: Optional[Union[str, _models.TelephonyProvider]] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.VoiceAgentLiveConversationItem"]: - """List items in a Live voice agent conversation. + ) -> ItemPaged["_models.TelephonyBindingListItem"]: + """List agent telephony bindings. - Lists stored speech and delegation items in order; cursors use item IDs. Returns 404 if the - conversation is absent or not stored. + Returns the telephony bindings owned by the voice agent named in the path. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent whose bindings are listed. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str + :keyword provider: Filters bindings by provider. Known values are: "teams_phone_extensibility", + "twilio", and "sip". Default value is None. + :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider :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. @@ -24209,14 +24132,14 @@ def list_items( 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 VoiceAgentLiveConversationItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversationItem] + :return: An iterator like instance of TelephonyBindingListItem + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.TelephonyBindingListItem] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.VoiceAgentLiveConversationItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TelephonyBindingListItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24228,9 +24151,9 @@ def list_items( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_live_conversations_list_items_request( + _request = build_voice_agents_telephony_list_bindings_request( agent_name=agent_name, - conversation_id=conversation_id, + provider=provider, limit=limit, order=order, after=_continuation_token, @@ -24248,7 +24171,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.VoiceAgentLiveConversationItem], + List[_models.TelephonyBindingListItem], deserialized.get("data", []), ) if cls: @@ -24277,23 +24200,17 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_item( - self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any - ) -> _models.VoiceAgentLiveConversationItem: - """Get a Live voice agent conversation item. + def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _models.TelephonyBinding: + """Get an agent telephony binding. - Gets a stored item by ID. Returns 404 if the item or conversation is absent. + Retrieves a telephony binding owned by the voice agent named in the path. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :param item_id: The id returned on the persisted item. Required. - :type item_id: str - :return: VoiceAgentLiveConversationItem. The VoiceAgentLiveConversationItem is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversationItem + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24307,12 +24224,11 @@ def get_item( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VoiceAgentLiveConversationItem] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_get_item_request( + _request = build_voice_agents_telephony_get_binding_request( agent_name=agent_name, - conversation_id=conversation_id, - item_id=item_id, + binding_id=binding_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24343,111 +24259,153 @@ def get_item( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.VoiceAgentLiveConversationItem, response.json()) + deserialized = _deserialize(_models.TelephonyBinding, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def get_audio_item( - self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any - ) -> _models.VoiceAudioItem: - """Get a Live conversation item's audio metadata. + @overload + def update_binding( + self, + agent_name: str, + binding_id: str, + body: _models.UpdateTelephonyBindingRequest, + *, + etag: str, + match_condition: MatchConditions, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - Gets captured speech-audio metadata. BYOS uses unsigned blob_uri. Returns 404 for missing - audio, conversations not stored, or delegation items. + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :param item_id: The id returned on the persisted item. Required. - :type item_id: str - :return: VoiceAudioItem. The VoiceAudioItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.VoiceAudioItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[_models.VoiceAudioItem] = kwargs.pop("cls", None) - - _request = build_beta_voice_agents_live_conversations_get_audio_item_request( - agent_name=agent_name, - conversation_id=conversation_id, - item_id=item_id, - api_version=self._config.api_version, - 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) + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Required. + :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ - _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 - ) + @overload + def update_binding( + self, + agent_name: str, + binding_id: str, + body: JSON, + *, + etag: str, + match_condition: MatchConditions, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - response = pipeline_response.http_response + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Required. + :type body: JSON + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.VoiceAudioItem, response.json()) + @overload + def update_binding( + self, + agent_name: str, + binding_id: str, + body: IO[bytes], + *, + etag: str, + match_condition: MatchConditions, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - return deserialized # type: ignore + :param agent_name: The name of the voice agent that owns the binding. Required. + :type agent_name: str + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Required. + :type body: IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def download_audio_item( - self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any - ) -> Iterator[bytes]: - """Stream a Live conversation item's audio. + def update_binding( + self, + agent_name: str, + binding_id: str, + body: Union[_models.UpdateTelephonyBindingRequest, JSON, IO[bytes]], + *, + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> _models.TelephonyBinding: + """Update an agent telephony binding. - Streams captured speech as WAV. BYOS returns 409; use blob_uri. Returns 404 for missing audio, - conversations not stored, or delegation items. + Updates a telephony binding owned by the voice agent named in the path. Updating a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :param item_id: The id returned on the persisted item. Required. - :type item_id: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :param body: The binding properties to update. Is one of the following types: + UpdateTelephonyBindingRequest, JSON, IO[bytes] Required. + :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest or JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyBinding :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24456,18 +24414,35 @@ def download_audio_item( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_download_audio_item_request( + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_voice_agents_telephony_update_binding_request( agent_name=agent_name, - conversation_id=conversation_id, - item_id=item_id, + binding_id=binding_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -24477,7 +24452,7 @@ def download_audio_item( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24498,9 +24473,12 @@ def download_audio_item( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyBinding, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -24508,20 +24486,24 @@ def download_audio_item( return deserialized # type: ignore @distributed_trace - def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceRecording: - """Get a Live conversation's merged recording metadata. + def delete_binding( # pylint: disable=inconsistent-return-statements + self, agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any + ) -> None: + """Delete an agent telephony binding. - Gets merged stereo recording metadata (user left, assistant right). BYOS uses unsigned - blob_uri. Returns 404 for no audio, or 409 recording_not_ready/recording_unavailable for - pending/failed finalization; pending responses may include Retry-After. + Deletes a telephony binding owned by the voice agent named in the path. Deleting a SIP binding + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the Live voice agent. Required. + :param agent_name: The name of the voice agent that owns the binding. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: VoiceRecording. The VoiceRecording is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.VoiceRecording + :param binding_id: The service-generated binding identifier. Required. + :type binding_id: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24530,16 +24512,24 @@ def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.VoiceRecording] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_get_audio_request( + _request = build_voice_agents_telephony_delete_binding_request( agent_name=agent_name, - conversation_id=conversation_id, + binding_id=binding_id, + etag=etag, + match_condition=match_condition, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24549,20 +24539,14 @@ def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -24570,30 +24554,137 @@ def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _mo ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.VoiceRecording, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> Iterator[bytes]: - """Stream a Live conversation's merged recording. - - Streams the merged stereo WAV. BYOS returns 409; use blob_uri. Returns 404 for no audio, or 409 - recording_not_ready/recording_unavailable for pending/failed finalization. - - :param agent_name: The name of the Live voice agent. Required. + def list_calls( + self, + agent_name: str, + *, + provider: Optional[Union[str, _models.TelephonyProvider]] = None, + status: Optional[Union[str, _models.TelephonyCallStatus]] = None, + started_after_time: Optional[datetime.datetime] = None, + started_before_time: Optional[datetime.datetime] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.TelephonyCallSummary"]: + """List agent telephony calls. + + Returns the durable inbound call history for the voice agent named in the path. + + :param agent_name: The name of the voice agent whose calls are listed. Required. :type agent_name: str - :param conversation_id: The Foundry conversation ID returned in - session.started.conversation_id. Required. - :type conversation_id: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :keyword provider: Filters calls by provider. Known values are: "teams_phone_extensibility", + "twilio", and "sip". Default value is None. + :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider + :keyword status: Filters calls by lifecycle status. Known values are: "in_progress", "success", + and "failed". Default value is None. + :paramtype status: str or ~azure.ai.projects.models.TelephonyCallStatus + :keyword started_after_time: Includes calls that started at or after this Unix timestamp in + seconds. Default value is None. + :paramtype started_after_time: ~datetime.datetime + :keyword started_before_time: Includes calls that started at or before this Unix timestamp in + seconds. Default value is None. + :paramtype started_before_time: ~datetime.datetime + :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.projects.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 TelephonyCallSummary + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.TelephonyCallSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TelephonyCallSummary]] = 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_voice_agents_telephony_list_calls_request( + agent_name=agent_name, + provider=provider, + status=status, + started_after_time=started_after_time, + started_before_time=started_before_time, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + 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 = _deserialize( + List[_models.TelephonyCallSummary], + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: + """Get an agent telephony call. + + Retrieves a durable inbound call record owned by the voice agent named in the path. + + :param agent_name: The name of the voice agent that owns the call record. Required. + :type agent_name: str + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24607,11 +24698,11 @@ def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_live_conversations_download_audio_request( + _request = build_voice_agents_telephony_get_call_request( agent_name=agent_name, - conversation_id=conversation_id, + call_id=call_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24622,7 +24713,7 @@ def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) - _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24642,114 +24733,110 @@ def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) - ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class BetaVoiceAgentsTelephonyOperations: # pylint: disable=docstring-missing-param - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`telephony` 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: AIProjectClientConfiguration = 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_binding( - self, - agent_name: str, - binding: _models.TelephonyBinding, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + def transfer_call( + self, agent_name: str, call_id: str, *, target: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Required. - :type binding: ~azure.ai.projects.models.TelephonyBinding + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :keyword target: The name of a transfer target configured for the voice agent. Required. + :paramtype target: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_binding( - self, agent_name: str, binding: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + def transfer_call( + self, agent_name: str, call_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Required. - :type binding: JSON + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :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: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_binding( - self, agent_name: str, binding: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + def transfer_call( + self, agent_name: str, call_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Required. - :type binding: IO[bytes] + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :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: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_binding( - self, agent_name: str, binding: Union[_models.TelephonyBinding, JSON, IO[bytes]], **kwargs: Any - ) -> _models.TelephonyBinding: - """Create an agent telephony binding. + def transfer_call( + self, + agent_name: str, + call_id: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + target: str = _Unset, + **kwargs: Any + ) -> _models.TelephonyCallRecord: + """Transfer an active agent telephony call. - Creates a telephony binding for the voice agent named in the path. + Transfers an active inbound call to a configured target for the voice agent named in the path. + Transferring a SIP call requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :param binding: The provider-specific binding to create. Is one of the following types: - TelephonyBinding, JSON, IO[bytes] Required. - :type binding: ~azure.ai.projects.models.TelephonyBinding or JSON or IO[bytes] - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword target: The name of a transfer target configured for the voice agent. Required. + :paramtype target: str + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24764,17 +24851,23 @@ def create_binding( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) + if body is _Unset: + if target is _Unset: + raise TypeError("missing required argument: target") + body = {"target": target} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(binding, (IOBase, bytes)): - _content = binding + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(binding, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_voice_agents_telephony_create_binding_request( + _request = build_voice_agents_telephony_transfer_call_request( agent_name=agent_name, + call_id=call_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -24794,7 +24887,7 @@ def create_binding( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -24807,62 +24900,31 @@ def create_binding( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyBinding, response.json()) + deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def list_bindings( - self, - agent_name: str, - *, - provider: Optional[Union[str, _models.TelephonyProvider]] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.TelephonyBindingListItem"]: - """List agent telephony bindings. + def end_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: + """End an active agent telephony call. - Returns the telephony bindings owned by the voice agent named in the path. + Ends an active inbound call owned by the voice agent named in the path. Ending a SIP call + requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent whose bindings are listed. Required. + :param agent_name: The name of the voice agent that owns the active call. Required. :type agent_name: str - :keyword provider: Filters bindings by provider. Known values are: "teams_phone_extensibility", - "twilio", and "sip". Default value is None. - :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider - :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.projects.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 TelephonyBindingListItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.TelephonyBindingListItem] + :param call_id: The service-generated call identifier. Required. + :type call_id: str + :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallRecord :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TelephonyBindingListItem]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24871,68 +24933,65 @@ def list_bindings( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_beta_voice_agents_telephony_list_bindings_request( - agent_name=agent_name, - provider=provider, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - 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 + cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TelephonyBindingListItem], - 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) + _request = build_voice_agents_telephony_end_call_request( + agent_name=agent_name, + call_id=call_id, + api_version=self._config.api_version, + 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) - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + _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 + ) - _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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _models.TelephonyBinding: - """Get an agent telephony binding. + def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models.TelephonyTransferTargets: + """Get agent telephony transfer targets. - Retrieves a telephony binding owned by the voice agent named in the path. + Returns all transfer targets configured for the voice agent named in the path. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent whose transfer targets are retrieved. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24946,11 +25005,10 @@ def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyBinding] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_binding_request( + _request = build_voice_agents_telephony_get_transfer_targets_request( agent_name=agent_name, - binding_id=binding_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24987,7 +25045,7 @@ def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _model if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyBinding, response.json()) + deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -24995,135 +25053,330 @@ def get_binding(self, agent_name: str, binding_id: str, **kwargs: Any) -> _model return deserialized # type: ignore @overload - def update_binding( + def replace_transfer_targets( self, agent_name: str, - binding_id: str, - body: _models.UpdateTelephonyBindingRequest, *, + transfer_targets: List[_models.TelephonyTransferTarget], etag: str, match_condition: MatchConditions, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. - Updates a telephony binding owned by the voice agent named in the path. + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Required. - :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest + :keyword transfer_targets: The complete set of destinations to which the voice agent may + transfer calls. An empty array clears all targets when replacing the configuration. Required. + :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] :keyword etag: check if resource is changed. Set None to skip checking etag. Required. :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Required. :paramtype match_condition: ~azure.core.MatchConditions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update_binding( + def replace_transfer_targets( self, agent_name: str, - binding_id: str, body: JSON, *, etag: str, match_condition: MatchConditions, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. - Updates a telephony binding owned by the voice agent named in the path. + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Required. + :param body: Required. :type body: JSON :keyword etag: check if resource is changed. Set None to skip checking etag. Required. :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Required. :paramtype match_condition: ~azure.core.MatchConditions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update_binding( + def replace_transfer_targets( self, agent_name: str, - binding_id: str, body: IO[bytes], *, etag: str, match_condition: MatchConditions, - content_type: str = "application/merge-patch+json", + content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. + + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_transfer_targets( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + transfer_targets: List[_models.TelephonyTransferTarget] = _Unset, + etag: str, + match_condition: MatchConditions, + **kwargs: Any + ) -> _models.TelephonyTransferTargets: + """Replace agent telephony transfer targets. + + Replaces all transfer targets configured for the voice agent named in the path. Configuring a + SIP destination requires the ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword transfer_targets: The complete set of destinations to which the voice agent may + transfer calls. An empty array clears all targets when replacing the configuration. Required. + :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + 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[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) + + if body is _Unset: + if transfer_targets is _Unset: + raise TypeError("missing required argument: transfer_targets") + body = {"transfer_targets": transfer_targets} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_voice_agents_telephony_replace_transfer_targets_request( + agent_name=agent_name, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def create_call_job( + self, + agent_name: str, + job: _models.TelephonyCallJobCreate, + *, + idempotency_key: str, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. + + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent that executes the call. Required. + :type agent_name: str + :param job: The direct outbound call to create. Required. + :type job: ~azure.ai.projects.models.TelephonyCallJobCreate + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_call_job( + self, agent_name: str, job: JSON, *, idempotency_key: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. + + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The name of the voice agent that executes the call. Required. + :type agent_name: str + :param job: The direct outbound call to create. Required. + :type job: JSON + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_call_job( + self, + agent_name: str, + job: IO[bytes], + *, + idempotency_key: str, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. - Updates a telephony binding owned by the voice agent named in the path. + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that executes the call. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Required. - :type body: IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions + :param job: The direct outbound call to create. Required. + :type job: IO[bytes] + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update_binding( + def create_call_job( self, agent_name: str, - binding_id: str, - body: Union[_models.UpdateTelephonyBindingRequest, JSON, IO[bytes]], + job: Union[_models.TelephonyCallJobCreate, JSON, IO[bytes]], *, - etag: str, - match_condition: MatchConditions, + idempotency_key: str, **kwargs: Any - ) -> _models.TelephonyBinding: - """Update an agent telephony binding. + ) -> _models.TelephonyCallJob: + """Create an outbound telephony call job. - Updates a telephony binding owned by the voice agent named in the path. + Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version + for validation and its voice session. A call job over a ``SipOutbound`` connection requires the + ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the binding. Required. + :param agent_name: The name of the voice agent that executes the call. Required. :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :param body: The binding properties to update. Is one of the following types: - UpdateTelephonyBindingRequest, JSON, IO[bytes] Required. - :type body: ~azure.ai.projects.models.UpdateTelephonyBindingRequest or JSON or IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: TelephonyBinding. The TelephonyBinding is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyBinding + :param job: The direct outbound call to create. Is one of the following types: + TelephonyCallJobCreate, JSON, IO[bytes] Required. + :type job: ~azure.ai.projects.models.TelephonyCallJobCreate or JSON or IO[bytes] + :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained + keys for deleted jobs return 409 call_job_deleted, never redial. Required. + :paramtype idempotency_key: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25132,32 +25385,24 @@ def update_binding( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError 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[_models.TelephonyBinding] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(job, (IOBase, bytes)): + _content = job else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_voice_agents_telephony_update_binding_request( + _request = build_voice_agents_telephony_create_call_job_request( agent_name=agent_name, - binding_id=binding_id, - etag=etag, - match_condition=match_condition, + idempotency_key=idempotency_key, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -25177,7 +25422,7 @@ def update_binding( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -25192,11 +25437,13 @@ def update_binding( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("duration-seconds-int", response.headers.get("Retry-After")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyBinding, response.json()) + deserialized = _deserialize(_models.TelephonyCallJob, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -25204,108 +25451,26 @@ def update_binding( return deserialized # type: ignore @distributed_trace - def delete_binding( # pylint: disable=inconsistent-return-statements - self, agent_name: str, binding_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any - ) -> None: - """Delete an agent telephony binding. - - Deletes a telephony binding owned by the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the binding. Required. - :type agent_name: str - :param binding_id: The service-generated binding identifier. Required. - :type binding_id: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_voice_agents_telephony_delete_binding_request( - agent_name=agent_name, - binding_id=binding_id, - etag=etag, - match_condition=match_condition, - api_version=self._config.api_version, - 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) - - _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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_calls( + def list_call_jobs( self, agent_name: str, *, - provider: Optional[Union[str, _models.TelephonyProvider]] = None, - status: Optional[Union[str, _models.TelephonyCallStatus]] = None, - started_after_time: Optional[datetime.datetime] = None, - started_before_time: Optional[datetime.datetime] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, + status: Optional[Union[str, _models.TelephonyCallJobStatus]] = None, + campaign_name: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.TelephonyCallSummary"]: - """List agent telephony calls. + ) -> ItemPaged["_models.TelephonyCallJob"]: + """List outbound telephony call jobs. - Returns the durable inbound call history for the voice agent named in the path. + Lists current direct/Campaign jobs, excluding deleted or superseded rounds. Pages are live. + Campaign cursors survive boundary deletion/cancel, not replacement/name reuse (400 + invalid_cursor). - :param agent_name: The name of the voice agent whose calls are listed. Required. + :param agent_name: The owning voice agent. Authorization is applied before pagination. + Required. :type agent_name: str - :keyword provider: Filters calls by provider. Known values are: "teams_phone_extensibility", - "twilio", and "sip". Default value is None. - :paramtype provider: str or ~azure.ai.projects.models.TelephonyProvider - :keyword status: Filters calls by lifecycle status. Known values are: "in_progress", "success", - and "failed". Default value is None. - :paramtype status: str or ~azure.ai.projects.models.TelephonyCallStatus - :keyword started_after_time: Includes calls that started at or after this Unix timestamp in - seconds. Default value is None. - :paramtype started_after_time: ~datetime.datetime - :keyword started_before_time: Includes calls that started at or before this Unix timestamp in - seconds. Default value is None. - :paramtype started_before_time: ~datetime.datetime :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. @@ -25320,14 +25485,22 @@ def list_calls( 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 TelephonyCallSummary - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.TelephonyCallSummary] + :keyword status: Optional lifecycle filter. Known values are: "accepted", + "waiting_for_schedule", "queued", "dispatching", "in_progress", "waiting_for_retry", + "cancellation_requested", "completed", "blocked", "expired", "failed", and "cancelled". Default + value is None. + :paramtype status: str or ~azure.ai.projects.models.TelephonyCallJobStatus + :keyword campaign_name: Current Campaign round: 404 if absent, empty while deleting. Omit for + direct and Campaign jobs. Replacement/name reuse invalidates cursors. Default value is None. + :paramtype campaign_name: str + :return: An iterator like instance of TelephonyCallJob + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.TelephonyCallJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.TelephonyCallSummary]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TelephonyCallJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25339,16 +25512,14 @@ def list_calls( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_telephony_list_calls_request( + _request = build_voice_agents_telephony_list_call_jobs_request( agent_name=agent_name, - provider=provider, - status=status, - started_after_time=started_after_time, - started_before_time=started_before_time, limit=limit, order=order, after=_continuation_token, before=before, + status=status, + campaign_name=campaign_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -25362,7 +25533,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.TelephonyCallSummary], + List[_models.TelephonyCallJob], deserialized.get("data", []), ) if cls: @@ -25388,20 +25559,81 @@ def get_next(_continuation_token=None): return pipeline_response - return ItemPaged(get_next, extract_data) + return ItemPaged(get_next, extract_data) + + @distributed_trace + def delete_call_job( # pylint: disable=inconsistent-return-statements + self, agent_name: str, call_job_id: str, **kwargs: Any + ) -> None: + """Delete an outbound telephony call job. + + Deletes a terminal, reconciled job (otherwise 409), without cancelling calls or removing + Campaign outcomes/call history. Later GET returns 404; repeated DELETE returns 204. Deleting a + SIP call job requires the ``VoiceAgents=V1Preview`` opt-in. + + :param agent_name: The owning voice agent. Required. + :type agent_name: str + :param call_job_id: The call-job identifier. Required. + :type call_job_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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[None] = kwargs.pop("cls", None) + + _request = build_voice_agents_telephony_delete_call_job_request( + agent_name=agent_name, + call_job_id=call_job_id, + api_version=self._config.api_version, + 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) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: - """Get an agent telephony call. + def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> _models.TelephonyCallJob: + """Get an outbound telephony call job. - Retrieves a durable inbound call record owned by the voice agent named in the path. + Retrieves a durable direct or campaign-created outbound call job. - :param agent_name: The name of the voice agent that owns the call record. Required. + :param agent_name: The name of the voice agent that owns the call job. Required. :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord + :param call_job_id: The service-generated identifier of the call job to retrieve. Required. + :type call_job_id: str + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25415,11 +25647,11 @@ def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.Tele _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) + cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_call_request( + _request = build_voice_agents_telephony_get_call_job_request( agent_name=agent_name, - call_id=call_id, + call_job_id=call_job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -25450,106 +25682,39 @@ def get_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.Tele ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) + deserialized = _deserialize(_models.TelephonyCallJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def transfer_call( - self, agent_name: str, call_id: str, *, target: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. - - Transfers an active inbound call to a configured target for the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the active call. Required. - :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :keyword target: The name of a transfer target configured for the voice agent. Required. - :paramtype target: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def transfer_call( - self, agent_name: str, call_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. - - Transfers an active inbound call to a configured target for the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the active call. Required. - :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :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: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def transfer_call( - self, agent_name: str, call_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. - - Transfers an active inbound call to a configured target for the voice agent named in the path. - - :param agent_name: The name of the voice agent that owns the active call. Required. - :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :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: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def transfer_call( - self, - agent_name: str, - call_id: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - target: str = _Unset, - **kwargs: Any - ) -> _models.TelephonyCallRecord: - """Transfer an active agent telephony call. + def cancel_call_job( + self, agent_name: str, call_job_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any + ) -> _models.TelephonyCallJob: + """Cancel an outbound telephony call job. - Transfers an active inbound call to a configured target for the voice agent named in the path. + Cancels future attempts using If-Match; completion may be asynchronous. New cancellation after + connection returns 409 and lets the active call finish. Cancelling a SIP call job requires the + ``VoiceAgents=V1Preview`` opt-in. - :param agent_name: The name of the voice agent that owns the active call. Required. + :param agent_name: The name of the voice agent that owns the call job. Required. :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword target: The name of a transfer target configured for the voice agent. Required. - :paramtype target: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord + :param call_job_id: The service-generated identifier of the call job to cancel. Required. + :type call_job_id: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Required. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Required. + :paramtype match_condition: ~azure.core.MatchConditions + :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.TelephonyCallJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25558,32 +25723,25 @@ def transfer_call( 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyCallRecord] = kwargs.pop("cls", None) - - if body is _Unset: - if target is _Unset: - raise TypeError("missing required argument: target") - body = {"target": target} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_transfer_call_request( + _request = build_voice_agents_telephony_cancel_call_job_request( agent_name=agent_name, - call_id=call_id, - content_type=content_type, + call_job_id=call_job_id, + etag=etag, + match_condition=match_condition, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -25600,7 +25758,7 @@ def transfer_call( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -25613,97 +25771,155 @@ def transfer_call( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if response.status_code == 202: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize( + "duration-seconds-int", response.headers.get("Retry-After") + ) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) + deserialized = _deserialize(_models.TelephonyCallJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + +class BetaVoiceAgentsLiveConversationsOperations: # pylint: disable=docstring-missing-param,name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`live_conversations` 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: AIProjectClientConfiguration = 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") + @distributed_trace - def end_call(self, agent_name: str, call_id: str, **kwargs: Any) -> _models.TelephonyCallRecord: - """End an active agent telephony call. + def list( + self, + agent_name: str, + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.VoiceAgentLiveConversation"]: + """List Live voice agent conversations. - Ends an active inbound call owned by the voice agent named in the path. + Lists stored Live conversations for this agent, including sessions stored via an override. - :param agent_name: The name of the voice agent that owns the active call. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_id: The service-generated call identifier. Required. - :type call_id: str - :return: TelephonyCallRecord. The TelephonyCallRecord is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallRecord + :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.projects.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 VoiceAgentLiveConversation + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversation] :raises ~azure.core.exceptions.HttpResponseError: """ - 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[_models.TelephonyCallRecord] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VoiceAgentLiveConversation]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_end_call_request( - agent_name=agent_name, - call_id=call_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - _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 - ) + def prepare_request(_continuation_token=None): - response = pipeline_response.http_response + _request = build_beta_voice_agents_live_conversations_list_request( + agent_name=agent_name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + 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 - 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 = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.VoiceAgentLiveConversation], + deserialized.get("data", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TelephonyCallRecord, response.json()) + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models.TelephonyTransferTargets: - """Get agent telephony transfer targets. + def get(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceAgentLiveConversation: + """Get a Live voice agent conversation. - Returns all transfer targets configured for the voice agent named in the path. + Gets a stored Live conversation; fetch items separately. Returns 404 if absent or not stored. - :param agent_name: The name of the voice agent whose transfer targets are retrieved. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: VoiceAgentLiveConversation. The VoiceAgentLiveConversation is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversation :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25717,10 +25933,11 @@ def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models.Teleph _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) + cls: ClsType[_models.VoiceAgentLiveConversation] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_transfer_targets_request( + _request = build_beta_voice_agents_live_conversations_get_request( agent_name=agent_name, + conversation_id=conversation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -25751,145 +25968,31 @@ def get_transfer_targets(self, agent_name: str, **kwargs: Any) -> _models.Teleph ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) + deserialized = _deserialize(_models.VoiceAgentLiveConversation, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def replace_transfer_targets( - self, - agent_name: str, - *, - transfer_targets: List[_models.TelephonyTransferTarget], - etag: str, - match_condition: MatchConditions, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. - - Replaces all transfer targets configured for the voice agent named in the path. - - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. - :type agent_name: str - :keyword transfer_targets: The complete set of destinations to which the voice agent may - transfer calls. An empty array clears all targets when replacing the configuration. Required. - :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_transfer_targets( - self, - agent_name: str, - body: JSON, - *, - etag: str, - match_condition: MatchConditions, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. - - Replaces all transfer targets configured for the voice agent named in the path. - - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_transfer_targets( - self, - agent_name: str, - body: IO[bytes], - *, - etag: str, - match_condition: MatchConditions, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. - - Replaces all transfer targets configured for the voice agent named in the path. - - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def replace_transfer_targets( - self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - transfer_targets: List[_models.TelephonyTransferTarget] = _Unset, - etag: str, - match_condition: MatchConditions, - **kwargs: Any - ) -> _models.TelephonyTransferTargets: - """Replace agent telephony transfer targets. + def delete( # pylint: disable=inconsistent-return-statements + self, agent_name: str, conversation_id: str, **kwargs: Any + ) -> None: + """Delete a Live voice agent conversation. - Replaces all transfer targets configured for the voice agent named in the path. + Deletes the stored conversation and its items/audio, without closing the Live session. - :param agent_name: The name of the voice agent whose transfer targets are replaced. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword transfer_targets: The complete set of destinations to which the voice agent may - transfer calls. An empty array clears all targets when replacing the configuration. Required. - :paramtype transfer_targets: list[~azure.ai.projects.models.TelephonyTransferTarget] - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: TelephonyTransferTargets. The TelephonyTransferTargets is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyTransferTargets + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25898,39 +26001,17 @@ def replace_transfer_targets( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyTransferTargets] = kwargs.pop("cls", None) - - if body is _Unset: - if transfer_targets is _Unset: - raise TypeError("missing required argument: transfer_targets") - body = {"transfer_targets": transfer_targets} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_replace_transfer_targets_request( + _request = build_beta_voice_agents_live_conversations_delete_request( agent_name=agent_name, - etag=etag, - match_condition=match_condition, - content_type=content_type, + conversation_id=conversation_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -25939,20 +26020,14 @@ def replace_transfer_targets( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -25960,127 +26035,129 @@ def replace_transfer_targets( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TelephonyTransferTargets, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - @overload - def create_call_job( + @distributed_trace + def list_items( self, agent_name: str, - job: _models.TelephonyCallJobCreate, + conversation_id: str, *, - idempotency_key: str, - content_type: str = "application/json", + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + ) -> ItemPaged["_models.VoiceAgentLiveConversationItem"]: + """List items in a Live voice agent conversation. - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + Lists stored speech and delegation items in order; cursors use item IDs. Returns 404 if the + conversation is absent or not stored. - :param agent_name: The name of the voice agent that executes the call. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param job: The direct outbound call to create. Required. - :type job: ~azure.ai.projects.models.TelephonyCallJobCreate - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_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.projects.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 VoiceAgentLiveConversationItem + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.VoiceAgentLiveConversationItem] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def create_call_job( - self, agent_name: str, job: JSON, *, idempotency_key: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + cls: ClsType[List[_models.VoiceAgentLiveConversationItem]] = kwargs.pop("cls", None) - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param agent_name: The name of the voice agent that executes the call. Required. - :type agent_name: str - :param job: The direct outbound call to create. Required. - :type job: JSON - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(_continuation_token=None): - @overload - def create_call_job( - self, - agent_name: str, - job: IO[bytes], - *, - idempotency_key: str, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + _request = build_beta_voice_agents_live_conversations_list_items_request( + agent_name=agent_name, + conversation_id=conversation_id, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + 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 - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.VoiceAgentLiveConversationItem], + 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) - :param agent_name: The name of the voice agent that executes the call. Required. - :type agent_name: str - :param job: The direct outbound call to create. Required. - :type job: IO[bytes] - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def create_call_job( - self, - agent_name: str, - job: Union[_models.TelephonyCallJobCreate, JSON, IO[bytes]], - *, - idempotency_key: str, - **kwargs: Any - ) -> _models.TelephonyCallJob: - """Create an outbound telephony call job. + def get_item( + self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any + ) -> _models.VoiceAgentLiveConversationItem: + """Get a Live voice agent conversation item. - Creates one durable outbound CallJob. Each attempt pins the Agent endpoint's execution version - for validation and its voice session. + Gets a stored item by ID. Returns 404 if the item or conversation is absent. - :param agent_name: The name of the voice agent that executes the call. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param job: The direct outbound call to create. Is one of the following types: - TelephonyCallJobCreate, JSON, IO[bytes] Required. - :type job: ~azure.ai.projects.models.TelephonyCallJobCreate or JSON or IO[bytes] - :keyword idempotency_key: Customer retry key. Equivalent requests return the same job; retained - keys for deleted jobs return 409 call_job_deleted, never redial. Required. - :paramtype idempotency_key: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :param item_id: The id returned on the persisted item. Required. + :type item_id: str + :return: VoiceAgentLiveConversationItem. The VoiceAgentLiveConversationItem is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.VoiceAgentLiveConversationItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26091,25 +26168,16 @@ def create_call_job( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(job, (IOBase, bytes)): - _content = job - else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.VoiceAgentLiveConversationItem] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_create_call_job_request( + _request = build_beta_voice_agents_live_conversations_get_item_request( agent_name=agent_name, - idempotency_key=idempotency_key, - content_type=content_type, + conversation_id=conversation_id, + item_id=item_id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -26126,7 +26194,7 @@ def create_call_job( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -26139,73 +26207,36 @@ def create_call_job( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("duration-seconds-int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallJob, response.json()) + deserialized = _deserialize(_models.VoiceAgentLiveConversationItem, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def list_call_jobs( - self, - agent_name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - status: Optional[Union[str, _models.TelephonyCallJobStatus]] = None, - campaign_name: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.TelephonyCallJob"]: - """List outbound telephony call jobs. + def get_audio_item( + self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any + ) -> _models.VoiceAudioItem: + """Get a Live conversation item's audio metadata. - Lists current direct/Campaign jobs, excluding deleted or superseded rounds. Pages are live. - Campaign cursors survive boundary deletion/cancel, not replacement/name reuse (400 - invalid_cursor). + Gets captured speech-audio metadata. BYOS uses unsigned blob_uri. Returns 404 for missing + audio, conversations not stored, or delegation items. - :param agent_name: The owning voice agent. Authorization is applied before pagination. - Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: 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.projects.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 status: Optional lifecycle filter. Known values are: "accepted", - "waiting_for_schedule", "queued", "dispatching", "in_progress", "waiting_for_retry", - "cancellation_requested", "completed", "blocked", "expired", "failed", and "cancelled". Default - value is None. - :paramtype status: str or ~azure.ai.projects.models.TelephonyCallJobStatus - :keyword campaign_name: Current Campaign round: 404 if absent, empty while deleting. Omit for - direct and Campaign jobs. Replacement/name reuse invalidates cursors. Default value is None. - :paramtype campaign_name: str - :return: An iterator like instance of TelephonyCallJob - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.TelephonyCallJob] + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :param item_id: The id returned on the persisted item. Required. + :type item_id: str + :return: VoiceAudioItem. The VoiceAudioItem is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.VoiceAudioItem :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TelephonyCallJob]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26214,72 +26245,73 @@ def list_call_jobs( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(_continuation_token=None): + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_beta_voice_agents_telephony_list_call_jobs_request( - agent_name=agent_name, - limit=limit, - order=order, - after=_continuation_token, - before=before, - status=status, - campaign_name=campaign_name, - api_version=self._config.api_version, - 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 + cls: ClsType[_models.VoiceAudioItem] = kwargs.pop("cls", None) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TelephonyCallJob], - 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) + _request = build_beta_voice_agents_live_conversations_get_audio_item_request( + agent_name=agent_name, + conversation_id=conversation_id, + item_id=item_id, + api_version=self._config.api_version, + 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) - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + _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 + ) - _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 = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.VoiceAudioItem, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def delete_call_job( # pylint: disable=inconsistent-return-statements - self, agent_name: str, call_job_id: str, **kwargs: Any - ) -> None: - """Delete an outbound telephony call job. + def download_audio_item( + self, agent_name: str, conversation_id: str, item_id: str, **kwargs: Any + ) -> Iterator[bytes]: + """Stream a Live conversation item's audio. - Deletes a terminal, reconciled job (otherwise 409), without cancelling calls or removing - Campaign outcomes/call history. Later GET returns 404; repeated DELETE returns 204. + Streams captured speech as WAV. BYOS returns 409; use blob_uri. Returns 404 for missing audio, + conversations not stored, or delegation items. - :param agent_name: The owning voice agent. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_job_id: The call-job identifier. Required. - :type call_job_id: str - :return: None - :rtype: None + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :param item_id: The id returned on the persisted item. Required. + :type item_id: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26293,11 +26325,12 @@ def delete_call_job( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_delete_call_job_request( + _request = build_beta_voice_agents_live_conversations_download_audio_item_request( agent_name=agent_name, - call_job_id=call_job_id, + conversation_id=conversation_id, + item_id=item_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26307,14 +26340,20 @@ def delete_call_job( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) 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 [204]: + 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 = _failsafe_deserialize( _models.ApiErrorResponse, @@ -26322,21 +26361,31 @@ def delete_call_job( # pylint: disable=inconsistent-return-statements ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> _models.TelephonyCallJob: - """Get an outbound telephony call job. + def get_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> _models.VoiceRecording: + """Get a Live conversation's merged recording metadata. - Retrieves a durable direct or campaign-created outbound call job. + Gets merged stereo recording metadata (user left, assistant right). BYOS uses unsigned + blob_uri. Returns 404 for no audio, or 409 recording_not_ready/recording_unavailable for + pending/failed finalization; pending responses may include Retry-After. - :param agent_name: The name of the voice agent that owns the call job. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_job_id: The service-generated identifier of the call job to retrieve. Required. - :type call_job_id: str - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: VoiceRecording. The VoiceRecording is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.VoiceRecording :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26350,11 +26399,11 @@ def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) + cls: ClsType[_models.VoiceRecording] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_get_call_job_request( + _request = build_beta_voice_agents_live_conversations_get_audio_request( agent_name=agent_name, - call_job_id=call_job_id, + conversation_id=conversation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26385,38 +26434,30 @@ def get_call_job(self, agent_name: str, call_job_id: str, **kwargs: Any) -> _mod ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TelephonyCallJob, response.json()) + deserialized = _deserialize(_models.VoiceRecording, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def cancel_call_job( - self, agent_name: str, call_job_id: str, *, etag: str, match_condition: MatchConditions, **kwargs: Any - ) -> _models.TelephonyCallJob: - """Cancel an outbound telephony call job. + def download_audio(self, agent_name: str, conversation_id: str, **kwargs: Any) -> Iterator[bytes]: + """Stream a Live conversation's merged recording. - Cancels future attempts using If-Match; completion may be asynchronous. New cancellation after - connection returns 409 and lets the active call finish. + Streams the merged stereo WAV. BYOS returns 409; use blob_uri. Returns 404 for no audio, or 409 + recording_not_ready/recording_unavailable for pending/failed finalization. - :param agent_name: The name of the voice agent that owns the call job. Required. + :param agent_name: The name of the Live voice agent. Required. :type agent_name: str - :param call_job_id: The service-generated identifier of the call job to cancel. Required. - :type call_job_id: str - :keyword etag: check if resource is changed. Set None to skip checking etag. Required. - :paramtype etag: str - :keyword match_condition: The match condition to use upon the etag. Required. - :paramtype match_condition: ~azure.core.MatchConditions - :return: TelephonyCallJob. The TelephonyCallJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.TelephonyCallJob + :param conversation_id: The Foundry conversation ID returned in + session.started.conversation_id. Required. + :type conversation_id: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26425,24 +26466,16 @@ def cancel_call_job( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - if match_condition == MatchConditions.IfNotModified: - error_map[412] = ResourceModifiedError - elif match_condition == MatchConditions.IfPresent: - error_map[412] = ResourceNotFoundError - elif match_condition == MatchConditions.IfMissing: - error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TelephonyCallJob] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_telephony_cancel_call_job_request( + _request = build_beta_voice_agents_live_conversations_download_audio_request( agent_name=agent_name, - call_job_id=call_job_id, - etag=etag, - match_condition=match_condition, + conversation_id=conversation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26453,14 +26486,14 @@ def cancel_call_job( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) 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, 202]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -26474,20 +26507,9 @@ def cancel_call_job( raise HttpResponseError(response=response, model=error) response_headers = {} - if response.status_code == 200: - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - - if response.status_code == 202: - response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize( - "duration-seconds-int", response.headers.get("Retry-After") - ) + 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: - deserialized = _deserialize(_models.TelephonyCallJob, response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -26495,14 +26517,14 @@ def cancel_call_job( return deserialized # type: ignore -class BetaVoiceAgentsCampaignsOperations: # pylint: disable=docstring-missing-param +class BetaVoiceAgentsTelephonyOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`campaigns` attribute. + :attr:`telephony` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -26550,7 +26572,7 @@ def _create_initial( else: _content = json.dumps(campaign, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_voice_agents_campaigns_create_request( + _request = build_beta_voice_agents_telephony_create_request( agent_name=agent_name, campaign_name=campaign_name, operation_id=operation_id, @@ -26878,7 +26900,7 @@ def get( cls: ClsType[_models.TelephonyCampaign] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_get_request( + _request = build_beta_voice_agents_telephony_get_request( agent_name=agent_name, campaign_name=campaign_name, operation_id=operation_id, @@ -26975,7 +26997,7 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_campaigns_list_request( + _request = build_beta_voice_agents_telephony_list_request( agent_name=agent_name, limit=limit, order=order, @@ -27052,7 +27074,7 @@ def _cancel_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_cancel_request( + _request = build_beta_voice_agents_telephony_cancel_request( agent_name=agent_name, campaign_name=campaign_name, etag=etag, @@ -27222,7 +27244,7 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_delete_request( + _request = build_beta_voice_agents_telephony_delete_request( agent_name=agent_name, campaign_name=campaign_name, etag=etag, @@ -27405,7 +27427,7 @@ def list_validation_errors( def prepare_request(_continuation_token=None): - _request = build_beta_voice_agents_campaigns_list_validation_errors_request( + _request = build_beta_voice_agents_telephony_list_validation_errors_request( agent_name=agent_name, campaign_name=campaign_name, limit=limit, @@ -27487,7 +27509,7 @@ def get_operation( cls: ClsType[_models.TelephonyCampaignOperation] = kwargs.pop("cls", None) - _request = build_beta_voice_agents_campaigns_get_operation_request( + _request = build_beta_voice_agents_telephony_get_operation_request( agent_name=agent_name, campaign_name=campaign_name, operation_id=operation_id, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py index 535c7257d534..1c47ed5fda61 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py @@ -21,7 +21,7 @@ ServerEvent, ) from .._live import BetaLive, BetaLiveConnection, BetaLiveConnectionManager, LiveClientEvent, LiveServerEvent -from ._patch_agents import AgentsOperations, BetaAgentsOperations +from ._patch_agents import AgentsOperations from ._patch_agent_insights import BetaAgentInsightMonitorsOperations from ._patch_datasets import DatasetsOperations from ._patch_evaluators import EvaluatorsOperations @@ -30,7 +30,7 @@ from ._patch_connections import ConnectionsOperations from ._patch_memories import BetaMemoryStoresOperations from ._patch_models import BetaModelsOperations -from ._patch_campaigns import BetaVoiceAgentsCampaignsOperations +from ._patch_campaigns import BetaVoiceAgentsTelephonyOperations # Nested operation groups are re-exported here rather than in the generated package exports. from ._operations import ( @@ -41,10 +41,11 @@ BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaVoiceAgentsConversationsOperations, BetaVoiceAgentsLiveConversationsOperations, BetaVoiceAgentsOperations as GeneratedBetaVoiceAgentsOperations, - BetaVoiceAgentsTelephonyOperations, + VoiceAgentsConversationsOperations, + VoiceAgentsOperations as GeneratedVoiceAgentsOperations, + VoiceAgentsTelephonyOperations, ) @@ -69,9 +70,9 @@ class _OperationMethodHeaderProxy: def __init__(self, operation: Any, foundry_features_value: str): """Wrap an operation and its nested operation groups with the same header value. - For example, ``.beta.voice_agents`` stores ``conversations`` and ``telephony`` as nested + For example, ``.beta.voice_agents`` stores ``live_conversations`` and ``telephony`` as nested operation groups. Wrapping them with the parent proxy ensures every call under - ``.beta.voice_agents.conversations`` and ``.beta.voice_agents.telephony`` receives the + ``.beta.voice_agents.live_conversations`` and ``.beta.voice_agents.telephony`` receives the ``Foundry-Features: VoiceAgents=V1Preview`` header. """ object.__setattr__(self, "_operation", operation) @@ -126,6 +127,32 @@ def __setattr__(self, name: str, value: Any) -> None: setattr(self._operation, name, value) +class VoiceAgentsOperations(GeneratedVoiceAgentsOperations): + """Generally available voice-agent operations. + + Access these operations through :class:`~azure.ai.projects.AIProjectClient`'s + ``voice_agents`` attribute. + """ + + conversations: VoiceAgentsConversationsOperations + """:class:`~azure.ai.projects.operations.VoiceAgentsConversationsOperations` operations""" + telephony: VoiceAgentsTelephonyOperations + """:class:`~azure.ai.projects.operations.VoiceAgentsTelephonyOperations` operations""" + realtime: BetaRealtime + """:class:`~azure.ai.projects.operations.BetaRealtime` operations""" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + # WebSocket connections cannot be kept alive by the generated HTTP pipeline. + self.realtime = BetaRealtime(self) + if self._config.allow_preview: + setattr( + self, + "telephony", + _OperationMethodHeaderProxy(self.telephony, _BETA_OPERATION_FEATURE_HEADERS["voice_agents"]), + ) + + class BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): """ .. warning:: @@ -136,28 +163,18 @@ class BetaVoiceAgentsOperations(GeneratedBetaVoiceAgentsOperations): :attr:`~azure.ai.projects.operations.BetaOperations.voice_agents` attribute. """ - campaigns: BetaVoiceAgentsCampaignsOperations - """:class:`~azure.ai.projects.operations.BetaVoiceAgentsCampaignsOperations` operations""" - conversations: BetaVoiceAgentsConversationsOperations - """:class:`~azure.ai.projects.operations.BetaVoiceAgentsConversationsOperations` operations""" - live_conversations: BetaVoiceAgentsLiveConversationsOperations - """:class:`~azure.ai.projects.operations.BetaVoiceAgentsLiveConversationsOperations` operations""" telephony: BetaVoiceAgentsTelephonyOperations """:class:`~azure.ai.projects.operations.BetaVoiceAgentsTelephonyOperations` operations""" - realtime: BetaRealtime - """:class:`~azure.ai.projects.operations.BetaRealtime` operations""" + live_conversations: BetaVoiceAgentsLiveConversationsOperations + """:class:`~azure.ai.projects.operations.BetaVoiceAgentsLiveConversationsOperations` operations""" live: BetaLive """:class:`~azure.ai.projects.operations.BetaLive` operations""" def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.campaigns = BetaVoiceAgentsCampaignsOperations( + self.telephony = BetaVoiceAgentsTelephonyOperations( self._client, self._config, self._serialize, self._deserialize ) - # The generator does not emit realtime operations at all, since azure-core's HTTP - # pipeline has no way to keep a WebSocket upgrade's resulting socket alive. Add our - # hand-written client, which manages a real, long-lived connection, in its place. - self.realtime = BetaRealtime(self) self.live = BetaLive(self) @@ -171,8 +188,6 @@ class BetaOperations(GeneratedBetaOperations): :attr:`beta` attribute. """ - agents: BetaAgentsOperations - """:class:`~azure.ai.projects.operations.BetaAgentsOperations` operations""" agent_insight_monitors: BetaAgentInsightMonitorsOperations """:class:`~azure.ai.projects.operations.BetaAgentInsightMonitorsOperations` operations""" evaluation_taxonomies: BetaEvaluationTaxonomiesOperations @@ -196,8 +211,6 @@ class BetaOperations(GeneratedBetaOperations): def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - # Replace with patched beta agents operations - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) # Replace with patched class that includes begin_update_memories self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) # Replace with patched class that includes create (3-step upload helper) @@ -220,7 +233,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: __all__: List[str] = [ "AgentsOperations", "BetaAgentInsightMonitorsOperations", - "BetaAgentsOperations", "BetaEvaluationTaxonomiesOperations", "BetaInsightsOperations", "BetaMemoryStoresOperations", @@ -230,11 +242,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "BetaRoutinesOperations", "BetaSchedulesOperations", "BetaSkillsOperations", - "BetaVoiceAgentsCampaignsOperations", - "BetaVoiceAgentsConversationsOperations", + "BetaVoiceAgentsTelephonyOperations", "BetaVoiceAgentsLiveConversationsOperations", "BetaVoiceAgentsOperations", - "BetaVoiceAgentsTelephonyOperations", + "VoiceAgentsConversationsOperations", + "VoiceAgentsOperations", + "VoiceAgentsTelephonyOperations", "ClientEvent", "ConnectionsOperations", "ConversationItem", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index 9c64d1588eeb..464f56e89dc0 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -17,7 +17,6 @@ from azure.core.utils import case_insensitive_dict from ._operations import ( AgentsOperations as GeneratedAgentsOperations, - BetaAgentsOperations as BetaAgentsOperationsGenerated, JSON, _Unset, ) @@ -465,7 +464,3 @@ def get_long_running_output(pipeline_response): ) assert raw_result is not None return AgentOptimizationLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class BetaAgentsOperations(BetaAgentsOperationsGenerated): - """Custom operations for beta agents.""" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_campaigns.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_campaigns.py index af7434e26d51..ffb671fe8710 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_campaigns.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_campaigns.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -"""Custom Voice Agent campaign operations.""" +"""Campaign LRO polling customizations for ``beta.voice_agents.telephony``.""" from collections.abc import MutableMapping from typing import Any, IO, Optional, Union, overload @@ -10,20 +10,20 @@ from azure.core import MatchConditions from azure.core.polling import LROPoller -from ._operations import BetaVoiceAgentsCampaignsOperations as GeneratedBetaVoiceAgentsCampaignsOperations +from ._operations import BetaVoiceAgentsTelephonyOperations as GeneratedBetaVoiceAgentsTelephonyOperations from .. import models as _models from .._utils.campaign_polling import _configure_campaign_polling JSON = MutableMapping[str, Any] -class BetaVoiceAgentsCampaignsOperations(GeneratedBetaVoiceAgentsCampaignsOperations): +class BetaVoiceAgentsTelephonyOperations(GeneratedBetaVoiceAgentsTelephonyOperations): """ .. warning:: **DO NOT** instantiate this class directly. Instead, access these operations through - :class:`~azure.ai.projects.AIProjectClient`'s ``beta.voice_agents.campaigns`` attribute. + :class:`~azure.ai.projects.AIProjectClient`'s ``beta.voice_agents.telephony`` attribute. """ def _configure_polling(self, kwargs: dict[str, Any]) -> None: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/telemetry/_voice_agents_instrumentor.py b/sdk/ai/azure-ai-projects/azure/ai/projects/telemetry/_voice_agents_instrumentor.py index 923e107c93e4..2c166748d2b7 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/telemetry/_voice_agents_instrumentor.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/telemetry/_voice_agents_instrumentor.py @@ -981,10 +981,10 @@ def instrument(self) -> None: operations = importlib.import_module(module) targets = [ ("AgentsOperations", "create_version", "create_agent", True), - ("BetaAgentsOperations", "create_from_prompt", "create_agent", False), - ("BetaVoiceAgentsConversationsOperations", "delete", "voice_agents.conversations.delete", False), + ("AgentsOperations", "create_from_prompt", "create_agent", False), + ("VoiceAgentsConversationsOperations", "delete", "voice_agents.conversations.delete", False), ] + [ - ("BetaVoiceAgentsTelephonyOperations", method, "voice_agents.telephony." + method, False) + ("VoiceAgentsTelephonyOperations", method, "voice_agents.telephony." + method, False) for method in mutations ] for class_name, method, operation, voice_only in targets: diff --git a/sdk/ai/azure-ai-projects/docs/public-methods.md b/sdk/ai/azure-ai-projects/docs/public-methods.md index 7b17fb38ea82..7fc578865fa7 100644 --- a/sdk/ai/azure-ai-projects/docs/public-methods.md +++ b/sdk/ai/azure-ai-projects/docs/public-methods.md @@ -9,14 +9,14 @@ This document lists all public methods available on `AIProjectClient` and its su There are a total of 211 unique public methods: - 5 stable methods on the client -- 84 stable methods on top-level sub-clients -- 122 beta methods on nested beta sub-clients +- 116 stable methods on top-level sub-clients +- 90 beta methods on nested beta sub-clients ### Top-level sub-clients (stable operations) | Subclient | Class Name | Methods Count | | --- | --- | --- | -| `agents` | AgentsOperations | 35 | +| `agents` | AgentsOperations | 36 | | `connections` | ConnectionsOperations | 3 | | `datasets` | DatasetsOperations | 14 | | `deployments` | DeploymentsOperations | 2 | @@ -25,13 +25,15 @@ There are a total of 211 unique public methods: | `indexes` | IndexesOperations | 5 | | `telemetry` | TelemetryOperations | 1 | | `toolboxes` | ToolboxesOperations | 9 | +| `voice_agents.conversations` | VoiceAgentsConversationsOperations | 14 | +| `voice_agents.realtime` | BetaRealtime | 1 | +| `voice_agents.telephony` | VoiceAgentsTelephonyOperations | 16 | ### Nested sub-clients (beta operations) | Subclient | Class Name | Methods Count | | --- | --- | --- | | `beta.agent_insight_monitors` | BetaAgentInsightMonitorsOperations | 13 | -| `beta.agents` | BetaAgentsOperations | 1 | | `beta.evaluation_taxonomies` | BetaEvaluationTaxonomiesOperations | 5 | | `beta.evaluators` | BetaEvaluatorsOperations | 2 | | `beta.insights` | BetaInsightsOperations | 3 | @@ -41,12 +43,9 @@ There are a total of 211 unique public methods: | `beta.routines` | BetaRoutinesOperations | 8 | | `beta.schedules` | BetaSchedulesOperations | 6 | | `beta.skills` | BetaSkillsOperations | 11 | -| `beta.voice_agents.campaigns` | BetaVoiceAgentsCampaignsOperations | 7 | -| `beta.voice_agents.conversations` | BetaVoiceAgentsConversationsOperations | 14 | | `beta.voice_agents.live` | BetaLive | 1 | | `beta.voice_agents.live_conversations` | BetaVoiceAgentsLiveConversationsOperations | 9 | -| `beta.voice_agents.realtime` | BetaRealtime | 1 | -| `beta.voice_agents.telephony` | BetaVoiceAgentsTelephonyOperations | 16 | +| `beta.voice_agents.telephony` | BetaVoiceAgentsTelephonyOperations | 7 | ## Stable methods on the client @@ -67,6 +66,7 @@ Alphabetically sorted. An asterisk at the end of the method name means it is a h ```text .agents.begin_create_optimization_job* .agents.cancel_optimization_job +.agents.create_from_prompt .agents.create_session .agents.create_version* .agents.create_version_from_code* @@ -157,6 +157,40 @@ Alphabetically sorted. An asterisk at the end of the method name means it is a h .toolboxes.list .toolboxes.list_versions .toolboxes.update + +.voice_agents.conversations.delete +.voice_agents.conversations.download_audio +.voice_agents.conversations.download_audio_item +.voice_agents.conversations.download_generated_audio_item +.voice_agents.conversations.get +.voice_agents.conversations.get_audio +.voice_agents.conversations.get_audio_item +.voice_agents.conversations.get_generated_audio_item +.voice_agents.conversations.get_item +.voice_agents.conversations.get_response +.voice_agents.conversations.list +.voice_agents.conversations.list_items +.voice_agents.conversations.list_response_items +.voice_agents.conversations.list_responses + +.voice_agents.realtime.connect* + +.voice_agents.telephony.cancel_call_job +.voice_agents.telephony.create_binding +.voice_agents.telephony.create_call_job +.voice_agents.telephony.delete_binding +.voice_agents.telephony.delete_call_job +.voice_agents.telephony.end_call +.voice_agents.telephony.get_binding +.voice_agents.telephony.get_call +.voice_agents.telephony.get_call_job +.voice_agents.telephony.get_transfer_targets +.voice_agents.telephony.list_bindings +.voice_agents.telephony.list_call_jobs +.voice_agents.telephony.list_calls +.voice_agents.telephony.replace_transfer_targets +.voice_agents.telephony.transfer_call +.voice_agents.telephony.update_binding ``` ## Beta methods on nested sub-clients @@ -178,8 +212,6 @@ Alphabetically sorted. An asterisk at the end of the method name means it is a h .beta.agent_insight_monitors.update .beta.agent_insight_monitors.update_insight -.beta.agents.create_from_prompt - .beta.evaluation_taxonomies.create .beta.evaluation_taxonomies.delete .beta.evaluation_taxonomies.get @@ -249,29 +281,6 @@ Alphabetically sorted. An asterisk at the end of the method name means it is a h .beta.skills.list_versions .beta.skills.update -.beta.voice_agents.campaigns.begin_cancel* -.beta.voice_agents.campaigns.begin_create* -.beta.voice_agents.campaigns.begin_delete* -.beta.voice_agents.campaigns.get -.beta.voice_agents.campaigns.get_operation -.beta.voice_agents.campaigns.list -.beta.voice_agents.campaigns.list_validation_errors - -.beta.voice_agents.conversations.delete -.beta.voice_agents.conversations.download_audio -.beta.voice_agents.conversations.download_audio_item -.beta.voice_agents.conversations.download_generated_audio_item -.beta.voice_agents.conversations.get -.beta.voice_agents.conversations.get_audio -.beta.voice_agents.conversations.get_audio_item -.beta.voice_agents.conversations.get_generated_audio_item -.beta.voice_agents.conversations.get_item -.beta.voice_agents.conversations.get_response -.beta.voice_agents.conversations.list -.beta.voice_agents.conversations.list_items -.beta.voice_agents.conversations.list_response_items -.beta.voice_agents.conversations.list_responses - .beta.voice_agents.live.connect* .beta.voice_agents.live_conversations.delete @@ -284,22 +293,11 @@ Alphabetically sorted. An asterisk at the end of the method name means it is a h .beta.voice_agents.live_conversations.list .beta.voice_agents.live_conversations.list_items -.beta.voice_agents.realtime.connect* - -.beta.voice_agents.telephony.cancel_call_job -.beta.voice_agents.telephony.create_binding -.beta.voice_agents.telephony.create_call_job -.beta.voice_agents.telephony.delete_binding -.beta.voice_agents.telephony.delete_call_job -.beta.voice_agents.telephony.end_call -.beta.voice_agents.telephony.get_binding -.beta.voice_agents.telephony.get_call -.beta.voice_agents.telephony.get_call_job -.beta.voice_agents.telephony.get_transfer_targets -.beta.voice_agents.telephony.list_bindings -.beta.voice_agents.telephony.list_call_jobs -.beta.voice_agents.telephony.list_calls -.beta.voice_agents.telephony.replace_transfer_targets -.beta.voice_agents.telephony.transfer_call -.beta.voice_agents.telephony.update_binding +.beta.voice_agents.telephony.begin_cancel* +.beta.voice_agents.telephony.begin_create* +.beta.voice_agents.telephony.begin_delete* +.beta.voice_agents.telephony.get +.beta.voice_agents.telephony.get_operation +.beta.voice_agents.telephony.list +.beta.voice_agents.telephony.list_validation_errors ``` diff --git a/sdk/ai/azure-ai-projects/pyproject.toml b/sdk/ai/azure-ai-projects/pyproject.toml index a59e849f31fb..4a08291396a2 100644 --- a/sdk/ai/azure-ai-projects/pyproject.toml +++ b/sdk/ai/azure-ai-projects/pyproject.toml @@ -14,7 +14,7 @@ name = "azure-ai-projects" authors = [ { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, ] -description = "Microsoft Corporation Azure AI Projects Client Library for Python" +description = "Microsoft Corporation Azure Ai Projects Client Library for Python" license = "MIT" classifiers = [ "Development Status :: 5 - Production/Stable", @@ -26,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", ] requires-python = ">=3.10" keywords = ["azure", "azure sdk"] @@ -44,12 +45,12 @@ dynamic = [ [project.optional-dependencies] voice = [ - "websockets>=13.0", - "aiohttp>=3.9.0,<4.0.0", + "websockets>=13.0", + "aiohttp>=3.9.0,<4.0.0", ] [project.urls] -repository = "https://aka.ms/azsdk/azure-ai-projects-v2/python/code" +repository = "https://github.com/Azure/azure-sdk-for-python" [tool.setuptools.dynamic] version = {attr = "azure.ai.projects._version.VERSION"} @@ -57,13 +58,13 @@ readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} [tool.setuptools.packages.find] exclude = [ - "azure.ai", - "azure", - "doc*", - "generated_samples*", + "tests*", "generated_tests*", "samples*", - "tests*", + "generated_samples*", + "doc*", + "azure", + "azure.ai", ] [tool.setuptools.package-data] @@ -72,10 +73,5 @@ pytyped = ["py.typed"] [tool.azure-sdk-build] verifytypes = false -[tool.mypy] -mypy_path = ["samples"] -exclude = '(^|.*[\\/])samples[\\/]hosted_agents[\\/]assets[\\/].*main\.py$|(^|.*[\\/])samples[\\/].+[\\/]utils?\.py$' - [tool.azure-sdk-conda] in_bundle = false - diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/realtime_interruption_utils.py b/sdk/ai/azure-ai-projects/samples/agents/voice/realtime_interruption_utils.py index 46aba6effb95..859d5849fc5b 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/realtime_interruption_utils.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/realtime_interruption_utils.py @@ -234,7 +234,7 @@ def wait_for_generated_audio( ) -> tuple[models.VoiceGeneratedAudioItem, bytes]: """Wait for durable interruption artifacts before reading them once in a test.""" deadline = time.monotonic() + RECORDING_TIMEOUT - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations while time.monotonic() < deadline: try: conversation = conversations.get(agent_name, turn.conversation_id) @@ -269,7 +269,7 @@ async def wait_for_generated_audio_async( ) -> tuple[models.VoiceGeneratedAudioItem, bytes]: """Wait asynchronously for durable generated audio; never treat a 404 as success.""" deadline = time.monotonic() + RECORDING_TIMEOUT - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations while time.monotonic() < deadline: try: conversation = await conversations.get(agent_name, turn.conversation_id) diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_basic.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_basic.py index bccc87c9260a..f7094b8ae397 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_basic.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_basic.py @@ -44,7 +44,7 @@ with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_versions = [] try: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_generate.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_generate.py index f34c39b7f1db..549e2b60f8ed 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_generate.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_generate.py @@ -45,11 +45,9 @@ def _safe_print(text: str) -> None: with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): - agent = project_client.beta.agents.create_from_prompt( - GenerateVoiceAgentRequest(kind=AgentKind.VOICE, name=agent_name) - ) + agent = project_client.agents.create_from_prompt(GenerateVoiceAgentRequest(kind=AgentKind.VOICE, name=agent_name)) print(f"Generated voice agent: {agent.name}") _safe_print(f"Instructions:\n{agent.versions.latest.definition.instructions}") # type: ignore[attr-defined] diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation.py index 478c72963766..e7521d8c3a0a 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation.py @@ -7,7 +7,7 @@ """ DESCRIPTION: Read a stored Realtime conversation, its model replies, and its transcript - through project_client.beta.voice_agents.conversations. + through project_client.voice_agents.conversations. With no conversation ID, send one text message to create a conversation. With no agent name, also create a temporary agent and delete its version @@ -59,9 +59,9 @@ with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): - conversations = project_client.beta.voice_agents.conversations + conversations = project_client.voice_agents.conversations created_version = None try: if not conversation_id: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation_audio.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation_audio.py index 40171cba2fec..e2e1241f4dc4 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation_audio.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_conversation_audio.py @@ -73,7 +73,7 @@ def read_merged_recording(conversations, agent_name, conversation_id) -> None: :param conversations: The conversation operations client. :param agent_name: The voice agent name. :param conversation_id: The persisted conversation id. - :type conversations: azure.ai.projects.operations.BetaVoiceAgentsConversationsOperations + :type conversations: azure.ai.projects.operations.VoiceAgentsConversationsOperations :type agent_name: str :type conversation_id: str """ @@ -108,7 +108,7 @@ def read_first_item_audio(conversations, agent_name, conversation_id) -> None: :param conversations: The conversation operations client. :param agent_name: The voice agent name. :param conversation_id: The persisted conversation id. - :type conversations: azure.ai.projects.operations.BetaVoiceAgentsConversationsOperations + :type conversations: azure.ai.projects.operations.VoiceAgentsConversationsOperations :type agent_name: str :type conversation_id: str """ @@ -149,9 +149,9 @@ def main() -> None: with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): - conversations = project_client.beta.voice_agents.conversations + conversations = project_client.voice_agents.conversations created_version = None try: if not conversation_id: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_generated_audio.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_generated_audio.py index 0366b4e97ade..6ab9632ef014 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_generated_audio.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_read_generated_audio.py @@ -48,9 +48,9 @@ def main() -> None: with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as client, + AIProjectClient(endpoint=endpoint, credential=credential) as client, ): - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations metadata = conversations.get_generated_audio_item(agent_name, conversation_id, item_id) print(f"Generated audio metadata: format={metadata.format}, duration={metadata.duration_ms}.") if metadata.blob_uri: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_audio_conversation_async.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_audio_conversation_async.py index bdbd43523faf..f38402af2044 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_audio_conversation_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_audio_conversation_async.py @@ -330,7 +330,7 @@ async def _run_audio_conversation(client: AIProjectClient, agent_name: str) -> O response_active = False # Open the realtime session on the voice agent's dedicated route. - async with client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + async with client.voice_agents.realtime.connect(agent_name=agent_name) as conn: # A voice agent owns its model, instructions, voice, turn detection, and # noise suppression server-side, so this client sends no ``session.update``. ap = _AudioProcessor(conn) @@ -417,7 +417,7 @@ async def _read_conversation(client: AIProjectClient, agent_name: str, conversat :type agent_name: str :type conversation_id: str """ - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations conversation = await conversations.get(agent_name, conversation_id) print(f"Conversation {conversation.id}: status={conversation.status}, created_at={conversation.created_at}") @@ -440,7 +440,7 @@ async def audio_conversation() -> None: async with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_version = None try: @@ -453,7 +453,9 @@ async def audio_conversation() -> None: audio=VoiceAgentAudioConfig( input=VoiceAgentAudioInputConfig( format=RealtimeAudioFormatsAudioPcm(rate=_SAMPLE_RATE), - transcription=VoiceAgentInputTranscription(model=VoiceAgentInputTranscriptionModel.WHISPER1), + transcription=VoiceAgentInputTranscription( + model=VoiceAgentInputTranscriptionModel("whisper-1") + ), ), output=VoiceAgentAudioOutputConfig(voice="en-US-AvaNeural", voice_type=VoiceType.AZURE_STANDARD), ), @@ -477,7 +479,7 @@ async def audio_conversation() -> None: except HttpResponseError as e: print(f"Could not read conversation: {e.status_code} {e.reason}") # To fetch this session's audio afterward, use - # `project_client.beta.voice_agents.conversations`: + # `project_client.voice_agents.conversations`: # - get_audio(agent_name, conversation_id) for the merged # whole-call stereo recording's metadata, then # download_audio(agent_name, conversation_id) to stream diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_function_tool_async.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_function_tool_async.py index 931c53a3a45c..8c29c6928e0f 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_function_tool_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_function_tool_async.py @@ -85,7 +85,7 @@ async def _run_turn_with_tool_support(client: AIProjectClient, agent_name: str, :type agent_name: str :type prompt: str """ - async with client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + async with client.voice_agents.realtime.connect(agent_name=agent_name) as conn: await conn.conversation.item.create( item=RealtimeConversationItemMessageUser( type=RealtimeConversationItemType.MESSAGE, @@ -166,7 +166,7 @@ async def main() -> None: async with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_version = None try: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_interruption_async.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_interruption_async.py index 5b0e06aedee7..842f3714b318 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_interruption_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_interruption_async.py @@ -47,14 +47,14 @@ async def main() -> None: async with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as client, + AIProjectClient(endpoint=endpoint, credential=credential) as client, ): created = None try: created = await client.agents.create_version( agent_name=agent_name, definition=interruption_definition(model) ) - async with client.beta.voice_agents.realtime.connect(agent_name=agent_name) as connection: + async with client.voice_agents.realtime.connect(agent_name=agent_name) as connection: await interrupt_reply_async(connection, turn) print( f"Confirmed response cancellation and item truncation. Received {turn.received_audio_bytes} PCM bytes." @@ -63,7 +63,7 @@ async def main() -> None: try: if turn.conversation_id: try: - await client.beta.voice_agents.conversations.delete(agent_name, turn.conversation_id) + await client.voice_agents.conversations.delete(agent_name, turn.conversation_id) except ResourceNotFoundError: print("Conversation cleanup returned 404; no persisted conversation was found.") finally: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_text_conversation_async.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_text_conversation_async.py index 3de73c8add8e..a36b1bb9fced 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_text_conversation_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_realtime_text_conversation_async.py @@ -228,7 +228,7 @@ async def _run_text_conversation( # pylint: disable=too-many-statements try: # Open the realtime session on the voice agent's dedicated route. - async with client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + async with client.voice_agents.realtime.connect(agent_name=agent_name) as conn: async def pump() -> None: nonlocal conversation_id, audio_delta_count, active_response_id @@ -340,7 +340,7 @@ async def _read_conversation(client: AIProjectClient, agent_name: str, conversat :type agent_name: str :type conversation_id: str """ - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations conversation = await conversations.get(agent_name, conversation_id) print(f"Conversation {conversation.id}: status={conversation.status}, created_at={conversation.created_at}") @@ -363,7 +363,7 @@ async def text_conversation() -> None: async with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_version = None try: @@ -397,7 +397,7 @@ async def text_conversation() -> None: except HttpResponseError as e: print(f"Could not read conversation: {e.status_code} {e.reason}") # To fetch this session's audio afterward, use - # `project_client.beta.voice_agents.conversations`: + # `project_client.voice_agents.conversations`: # - get_audio(agent_name, conversation_id) for the merged # whole-call stereo recording's metadata, then # download_audio(agent_name, conversation_id) to stream diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_versions.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_versions.py index 0e0a83bccfa4..70a70efa40dc 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_versions.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_versions.py @@ -43,7 +43,7 @@ def make_definition(instructions: str) -> VoiceAgentDefinition: with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_versions = [] try: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_with_tools.py b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_with_tools.py index 779605fa8fe0..da8c7e91494a 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_with_tools.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/sample_voice_agent_with_tools.py @@ -107,7 +107,7 @@ prefix_padding_ms=300, silence_duration_ms=500, ), - transcription=VoiceAgentInputTranscription(model=VoiceAgentInputTranscriptionModel.WHISPER1), + transcription=VoiceAgentInputTranscription(model=VoiceAgentInputTranscriptionModel("whisper-1")), ), # Output (agent speech) side: the voice the agent speaks with. output=VoiceAgentAudioOutputConfig(voice="en-US-AvaNeural", voice_type=VoiceType.AZURE_STANDARD), @@ -121,7 +121,7 @@ with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_version = None try: diff --git a/sdk/ai/azure-ai-projects/samples/agents/voice/voice_sample_util.py b/sdk/ai/azure-ai-projects/samples/agents/voice/voice_sample_util.py index f3a28cb71b12..92de9500dbcc 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/voice/voice_sample_util.py +++ b/sdk/ai/azure-ai-projects/samples/agents/voice/voice_sample_util.py @@ -47,7 +47,7 @@ def hold_sample_conversation( reports a session error, or the conversation does not finish finalizing in time. """ conversation_id = None - with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: conn.conversation.item.create( item=RealtimeConversationItemMessageUser( type=RealtimeConversationItemType.MESSAGE, @@ -72,7 +72,7 @@ def hold_sample_conversation( ) # A reply can finish before its transcript is stored; wait for storage to finish too. - conversations = project_client.beta.voice_agents.conversations + conversations = project_client.voice_agents.conversations for _ in range(_FINALIZE_POLL_ATTEMPTS): conversation = conversations.get(agent_name, conversation_id) if conversation.status != VoiceConversationStatus.IN_PROGRESS: diff --git a/sdk/ai/azure-ai-projects/samples/logs/sample_log_from_voice_agent.py b/sdk/ai/azure-ai-projects/samples/logs/sample_log_from_voice_agent.py index e2b387a59c89..16b9bac6cb73 100644 --- a/sdk/ai/azure-ai-projects/samples/logs/sample_log_from_voice_agent.py +++ b/sdk/ai/azure-ai-projects/samples/logs/sample_log_from_voice_agent.py @@ -61,7 +61,7 @@ def _run_conversation(project_client: AIProjectClient, agent_name: str) -> None: :param agent_name: The sample's voice agent name. :type agent_name: str """ - with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as connection: + with project_client.voice_agents.realtime.connect(agent_name=agent_name) as connection: connection.conversation.item.create( item=RealtimeConversationItemMessageUser( type=RealtimeConversationItemType.MESSAGE, @@ -99,7 +99,7 @@ def main() -> None: try: with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): created_version = None try: diff --git a/sdk/ai/azure-ai-projects/tests/agents/realtime_interruption_test_base.py b/sdk/ai/azure-ai-projects/tests/agents/realtime_interruption_test_base.py index fd03ff28ae7c..2bbd119a45b0 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/realtime_interruption_test_base.py +++ b/sdk/ai/azure-ai-projects/tests/agents/realtime_interruption_test_base.py @@ -58,7 +58,7 @@ async def _delete_fixture(client: AIProjectClient, fixture: RealtimeInterruption async def delete_conversation() -> None: if fixture.conversation_id: try: - await client.beta.voice_agents.conversations.delete(fixture.agent_name, fixture.conversation_id) + await client.voice_agents.conversations.delete(fixture.agent_name, fixture.conversation_id) except ResourceNotFoundError: _LOGGER.info("Owned interrupted conversation was not persisted or was already deleted.") @@ -97,7 +97,7 @@ async def _create_fixture(self, agent_name: str, model: str) -> RealtimeInterrup credential = self.test_class_instance.get_credential(AIProjectClient, is_async=True) async with ( credential, - AIProjectClient(endpoint=self.endpoint, credential=credential, allow_preview=True) as client, + AIProjectClient(endpoint=self.endpoint, credential=credential) as client, ): agent = None completed = False @@ -105,10 +105,10 @@ async def _create_fixture(self, agent_name: str, model: str) -> RealtimeInterrup agent = await client.agents.create_version( agent_name=agent_name, definition=helpers["interruption_definition"](model) ) - async with client.beta.voice_agents.realtime.connect(agent_name=agent_name) as connection: + async with client.voice_agents.realtime.connect(agent_name=agent_name) as connection: await helpers["interrupt_reply_async"](connection, turn) deadline = time.monotonic() + helpers["RECORDING_TIMEOUT"] - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations while not turn.stored_item_id: try: conversation = await conversations.get(agent_name, turn.conversation_id) @@ -151,7 +151,7 @@ async def _cleanup_fixture(self) -> None: fixture, endpoint = self.fixture, self.endpoint assert fixture is not None and endpoint credential = self.test_class_instance.get_credential(AIProjectClient, is_async=True) - async with credential, AIProjectClient(endpoint=endpoint, credential=credential, allow_preview=True) as client: + async with credential, AIProjectClient(endpoint=endpoint, credential=credential) as client: await _delete_fixture(client, fixture) @@ -171,7 +171,7 @@ def verify(response): path = urlsplit(response.http_request.url).path assert "/protocols/voice/conversations/" in path assert "/audio/generated" in path - assert response.http_request.headers["Foundry-Features"] == "VoiceAgents=V1Preview" + assert "Foundry-Features" not in response.http_request.headers return verify @@ -179,7 +179,7 @@ def verify(response): def assert_conversation_deleted(response) -> None: assert response.http_response.status_code == 204 assert "/protocols/voice/conversations/" in urlsplit(response.http_request.url).path - assert response.http_request.headers["Foundry-Features"] == "VoiceAgents=V1Preview" + assert "Foundry-Features" not in response.http_request.headers def assert_generated_metadata(metadata, fixture: RealtimeInterruptionFixture) -> None: diff --git a/sdk/ai/azure-ai-projects/tests/agents/telemetry/test_voice_agents_instrumentor.py b/sdk/ai/azure-ai-projects/tests/agents/telemetry/test_voice_agents_instrumentor.py index 0d02753e8620..304cc96b68bf 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/telemetry/test_voice_agents_instrumentor.py +++ b/sdk/ai/azure-ai-projects/tests/agents/telemetry/test_voice_agents_instrumentor.py @@ -342,7 +342,7 @@ def test_voice_creation_reuses_foundry_span_without_duplicates(telemetry): def test_rest_delete_error_status_has_no_raw_service_error(telemetry): with _rest_client({"error": {"code": "not_found", "message": _SECRET}}, status=404) as client: with pytest.raises(ResourceNotFoundError): - client.beta.voice_agents.conversations.delete("agent-test", "conversation-test") + client.voice_agents.conversations.delete("agent-test", "conversation-test") (span,) = _spans(telemetry, "voice_agents.conversations.delete") assert span.status.status_code is StatusCode.ERROR assert span.attributes["http.response.status_code"] == 404 @@ -352,9 +352,7 @@ def test_rest_delete_error_status_has_no_raw_service_error(telemetry): def test_opt_out_per_rest_call_and_experimental_gate(telemetry): with _rest_client({}, status=204) as client: - client.beta.voice_agents.conversations.delete( - "agent-test", "conversation-test", tracing_options={"enabled": False} - ) + client.voice_agents.conversations.delete("agent-test", "conversation-test", tracing_options={"enabled": False}) assert not _spans(telemetry, "voice_agents.conversations.delete") telemetry.instrumentor.uninstrument() telemetry.monkeypatch.setenv("AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING", "false") @@ -578,7 +576,7 @@ async def test_async_generation_rest_uses_same_span_and_no_new_public_api(teleme telemetry.monkeypatch.setattr( client._client._pipeline, "run", AsyncMock(return_value=SimpleNamespace(http_response=response)) ) - result = await client.beta.agents.create_from_prompt( + result = await client.agents.create_from_prompt( models.GenerateVoiceAgentRequest(kind=models.AgentKind.VOICE, name="agent-test") ) assert result.name == "agent-test" @@ -669,11 +667,11 @@ async def test_telephony_mutations_names_and_safe_errors(telemetry, is_async, me client._client._pipeline, "run", AsyncMock(return_value=SimpleNamespace(http_response=response)) ) with pytest.raises(ResourceNotFoundError): - await getattr(client.beta.voice_agents.telephony, method)(*args, **kwargs) + await getattr(client.voice_agents.telephony, method)(*args, **kwargs) else: with _rest_client({"error": {"code": "not_found", "message": _SECRET}}, status=404) as client: with pytest.raises(ResourceNotFoundError): - getattr(client.beta.voice_agents.telephony, method)(*args, **kwargs) + getattr(client.voice_agents.telephony, method)(*args, **kwargs) (span,) = _spans(telemetry, "voice_agents.telephony." + method) assert span.attributes[_PREFIX + "operation"] == method assert span.attributes["http.response.status_code"] == 404 @@ -684,9 +682,7 @@ async def test_telephony_mutations_names_and_safe_errors(telemetry, is_async, me def test_explicit_rest_enable_overrides_global_disable(telemetry): settings.tracing_enabled = False with _rest_client({}, status=204) as client: - client.beta.voice_agents.conversations.delete( - "agent-test", "conversation-test", tracing_options={"enabled": True} - ) + client.voice_agents.conversations.delete("agent-test", "conversation-test", tracing_options={"enabled": True}) assert len(_spans(telemetry, "voice_agents.conversations.delete")) == 1 diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_live_client.py b/sdk/ai/azure-ai-projects/tests/agents/test_live_client.py index 375462ba9fbb..b734ae11be12 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_live_client.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_live_client.py @@ -186,7 +186,8 @@ def headers(self): def manager(self, *, protocol="live", **options): options.setdefault("agent_name", _AGENT) - return getattr(self.client.beta.voice_agents, protocol).connect(**options) + voice_agents = self.client.beta.voice_agents if protocol == "live" else self.client.voice_agents + return getattr(voice_agents, protocol).connect(**options) async def call(self, method, *args, **kwargs): result = method(*args, **kwargs) @@ -234,7 +235,7 @@ async def test_live_is_public_and_connect_is_lazy(live): prefix = "Async" if live.is_async else "" assert isinstance(live.live, getattr(public_operations, f"{prefix}BetaLive")) assert live.live is live.client.beta.voice_agents.live - assert live.live is not live.client.beta.voice_agents.realtime + assert live.live is not live.client.voice_agents.realtime assert tuple(inspect.signature(type(live.live).__init__).parameters) == ("self", "args", "kwargs") manager = live.manager() diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client.py b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client.py index 62b0ef3001a4..6ac69ac2ea64 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client.py @@ -166,7 +166,18 @@ def test_enter_builds_bearer_auth_and_query(self): assert called_url.startswith("wss://my-account.services.ai.azure.com") assert "api-version=v1" in called_url assert kwargs["additional_headers"]["Authorization"] == "Bearer fake-token" - assert kwargs["additional_headers"]["Foundry-Features"] == "VoiceAgents=V1Preview" + assert "Foundry-Features" not in kwargs["additional_headers"] + assert "foundry_features" not in parse_qs(urlparse(called_url).query) + + @pytest.mark.parametrize("extra_headers", [{}, {"foundry-features": "Custom=V1Preview"}]) + def test_enter_preserves_preview_opt_in(self, extra_headers): + with patch("websockets.sync.client.connect", return_value=MagicMock()) as mock_connect: + with _make_manager(allow_preview=True, extra_headers=extra_headers): + pass + + headers = mock_connect.call_args.kwargs["additional_headers"] + feature_headers = {key.lower(): value for key, value in headers.items() if key.lower() == "foundry-features"} + assert feature_headers == {"foundry-features": extra_headers.get("foundry-features", "VoiceAgents=V1Preview")} def test_enter_identifies_sdk_via_user_agent_and_query(self): # The generated HTTP surface gets SDK identification for free from the core pipeline's diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client_async.py b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client_async.py index b79470444772..ac493fa7f389 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client_async.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_client_async.py @@ -127,10 +127,22 @@ async def test_enter_builds_bearer_auth_and_query(self): assert _args[0].startswith("wss://my-account.services.ai.azure.com") assert kwargs["params"]["api-version"] == "v1" assert kwargs["headers"]["Authorization"] == "Bearer fake-token" - assert kwargs["headers"]["Foundry-Features"] == "VoiceAgents=V1Preview" + assert "Foundry-Features" not in kwargs["headers"] + assert "foundry_features" not in kwargs["params"] assert "Sec-WebSocket-Protocol" not in kwargs["headers"] assert kwargs["protocols"] == ("realtime",) + @pytest.mark.parametrize("extra_headers", [{}, {"foundry-features": "Custom=V1Preview"}]) + async def test_enter_preserves_preview_opt_in(self, extra_headers): + patcher, fake_session = _patch_client_session(_make_fake_ws()) + with patcher: + async with _make_manager(allow_preview=True, extra_headers=extra_headers): + pass + + headers = fake_session.ws_connect.call_args.kwargs["headers"] + feature_headers = {key.lower(): value for key, value in headers.items() if key.lower() == "foundry-features"} + assert feature_headers == {"foundry-features": extra_headers.get("foundry-features", "VoiceAgents=V1Preview")} + async def test_enter_identifies_sdk_via_user_agent_and_query(self): # The generated HTTP surface gets SDK identification for free from the core pipeline's # UserAgentPolicy; this hand-written client builds its own request and must opt in diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_interruption_helpers.py b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_interruption_helpers.py index ce6ddddcdfbc..97d10093e87f 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_interruption_helpers.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_interruption_helpers.py @@ -14,6 +14,7 @@ from azure.ai.projects import models from azure.core.exceptions import ResourceNotFoundError +from azure.core.rest import HttpRequest import realtime_interruption_test_base as recording_helpers @@ -221,7 +222,7 @@ def test_playback_never_creates_resources_or_loads_websocket_setup(monkeypatch): @pytest.mark.asyncio async def test_recording_cleanup_still_deletes_owned_agent_after_conversation_failure(): client = MagicMock() - client.beta.voice_agents.conversations.delete = AsyncMock(side_effect=RuntimeError("cleanup failed")) + client.voice_agents.conversations.delete = AsyncMock(side_effect=RuntimeError("cleanup failed")) client.agents.delete = AsyncMock() fixture = recording_helpers.RealtimeInterruptionFixture("owned-agent", "conversation-test", "item-test") with pytest.raises(RuntimeError, match="cleanup failed"): @@ -248,7 +249,7 @@ async def test_failed_recording_creation_does_not_delete_an_unacknowledged_name( await preparer._create_fixture("owned-agent", "realtime-deployment-test") client.agents.delete.assert_not_called() - client.beta.voice_agents.conversations.delete.assert_not_called() + client.voice_agents.conversations.delete.assert_not_called() def test_interruption_sanitizers_preserve_cross_request_references(monkeypatch): @@ -263,6 +264,33 @@ def test_interruption_sanitizers_preserve_cross_request_references(monkeypatch): ] +@pytest.mark.parametrize("deleted", [False, True]) +@pytest.mark.parametrize("header_name", [None, "Foundry-Features", "foundry-features"]) +def test_ga_audio_response_hooks_reject_preview_headers(deleted, header_name): + path = "/agents/owned-agent/protocols/voice/conversations/conversation-test" + if not deleted: + path += "/items/item-test/audio/generated" + response = SimpleNamespace( + http_response=SimpleNamespace(status_code=204 if deleted else 200), + http_request=HttpRequest( + "DELETE" if deleted else "GET", + f"https://example.invalid{path}", + headers={header_name: "VoiceAgents=V1Preview"} if header_name else {}, + ), + ) + verify = ( + recording_helpers.assert_conversation_deleted + if deleted + else recording_helpers.assert_generated_status((200, 404)) + ) + + if header_name: + with pytest.raises(AssertionError): + verify(response) + else: + verify(response) + + def test_stored_item_lookup_uses_response_correlation_not_websocket_item_id(helpers): stored = [ {"type": "message", "role": "user", "id": "stored-user"}, diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_transport.py b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_transport.py index 58a8f3b16783..b9876843dfa9 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_realtime_transport.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_realtime_transport.py @@ -27,7 +27,9 @@ ] -def _make_realtime(is_async: bool) -> tuple[Union[BetaRealtime, AsyncBetaRealtime], MagicMock]: +def _make_realtime( + is_async: bool, *, allow_preview: bool = False +) -> tuple[Union[BetaRealtime, AsyncBetaRealtime], MagicMock]: credential = MagicMock() token = AccessToken("fake-token", 9_999_999_999) credential.get_token = AsyncMock(return_value=token) if is_async else MagicMock(return_value=token) @@ -37,6 +39,7 @@ def _make_realtime(is_async: bool) -> tuple[Union[BetaRealtime, AsyncBetaRealtim credential=credential, credential_scopes=["https://ai.azure.com/.default"], api_version="v1", + allow_preview=allow_preview, ) ) return (AsyncBetaRealtime(client) if is_async else BetaRealtime(client)), credential @@ -184,6 +187,21 @@ async def test_transport_selection_is_connection_scoped(is_async: bool) -> None: assert "transport" not in _handshake_query(second_url, second_kwargs) +@pytest.mark.asyncio +@pytest.mark.parametrize("is_async", [False, True], ids=["sync", "async"]) +@pytest.mark.parametrize("allow_preview", [False, True]) +async def test_transport_handshake_respects_preview_opt_in(is_async: bool, allow_preview: bool) -> None: + realtime, _ = _make_realtime(is_async, allow_preview=allow_preview) + manager = realtime.connect(agent_name="agent-test", transport=VoiceAgentTransport.WEBSOCKET) + _, kwargs = await _capture_handshake(manager) + + headers = kwargs["headers" if is_async else "additional_headers"] + if allow_preview: + assert headers["Foundry-Features"] == "VoiceAgents=V1Preview" + else: + assert "Foundry-Features" not in headers + + @pytest.mark.asyncio @pytest.mark.parametrize("is_async", [False, True], ids=["sync", "async"]) async def test_public_project_client_exposes_typed_transport_selection(is_async: bool) -> None: @@ -191,13 +209,13 @@ async def test_public_project_client_exposes_typed_transport_selection(is_async: manager: Union[BetaRealtimeConnectionManager, AsyncBetaRealtimeConnectionManager] if is_async: async with AsyncAIProjectClient(endpoint=_ENDPOINT, credential=credential, allow_preview=True) as async_client: - manager = async_client.beta.voice_agents.realtime.connect( + manager = async_client.voice_agents.realtime.connect( agent_name="agent-test", transport=VoiceAgentTransport.WEBRTC ) url, kwargs = await _capture_handshake(manager) else: with AIProjectClient(endpoint=_ENDPOINT, credential=credential, allow_preview=True) as client: - manager = client.beta.voice_agents.realtime.connect( + manager = client.voice_agents.realtime.connect( agent_name="agent-test", transport=VoiceAgentTransport.WEBRTC ) url, kwargs = await _capture_handshake(manager) diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_telephony_match_conditions.py b/sdk/ai/azure-ai-projects/tests/agents/test_telephony_match_conditions.py index 76c01500dcc1..4eef4d00b92b 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_telephony_match_conditions.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_telephony_match_conditions.py @@ -10,13 +10,13 @@ TelephonyTransferTargets, UpdateTelephonyBindingRequest, ) -from azure.ai.projects.aio.operations._operations import BetaVoiceAgentsTelephonyOperations as AsyncTelephonyOperations +from azure.ai.projects.aio.operations._operations import VoiceAgentsTelephonyOperations as AsyncTelephonyOperations from azure.ai.projects.operations._operations import ( - BetaVoiceAgentsTelephonyOperations as TelephonyOperations, - build_beta_voice_agents_telephony_cancel_call_job_request, - build_beta_voice_agents_telephony_delete_binding_request, - build_beta_voice_agents_telephony_replace_transfer_targets_request, - build_beta_voice_agents_telephony_update_binding_request, + VoiceAgentsTelephonyOperations as TelephonyOperations, + build_voice_agents_telephony_cancel_call_job_request, + build_voice_agents_telephony_delete_binding_request, + build_voice_agents_telephony_replace_transfer_targets_request, + build_voice_agents_telephony_update_binding_request, ) @@ -49,10 +49,10 @@ def test_prep_if_none_match(etag, match_condition, expected): @pytest.mark.parametrize( "build_request", [ - lambda **kwargs: build_beta_voice_agents_telephony_update_binding_request("agent", "binding", **kwargs), - lambda **kwargs: build_beta_voice_agents_telephony_delete_binding_request("agent", "binding", **kwargs), - lambda **kwargs: build_beta_voice_agents_telephony_replace_transfer_targets_request("agent", **kwargs), - lambda **kwargs: build_beta_voice_agents_telephony_cancel_call_job_request("agent", "job", **kwargs), + lambda **kwargs: build_voice_agents_telephony_update_binding_request("agent", "binding", **kwargs), + lambda **kwargs: build_voice_agents_telephony_delete_binding_request("agent", "binding", **kwargs), + lambda **kwargs: build_voice_agents_telephony_replace_transfer_targets_request("agent", **kwargs), + lambda **kwargs: build_voice_agents_telephony_cancel_call_job_request("agent", "job", **kwargs), ], ) def test_telephony_builders_apply_match_condition(build_request): diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_campaigns_lro.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_campaigns_lro.py index 9ee661b52b87..dc351edf8a91 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_campaigns_lro.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_campaigns_lro.py @@ -22,9 +22,9 @@ from azure.ai.projects import AIProjectClient from azure.ai.projects.aio import AIProjectClient as AsyncAIProjectClient -from azure.ai.projects.aio.operations import BetaVoiceAgentsCampaignsOperations as AsyncCampaignsOperations +from azure.ai.projects.aio.operations import BetaVoiceAgentsTelephonyOperations as AsyncCampaignsOperations from azure.ai.projects.models import TelephonyCampaign -from azure.ai.projects.operations import BetaVoiceAgentsCampaignsOperations as CampaignsOperations +from azure.ai.projects.operations import BetaVoiceAgentsTelephonyOperations as CampaignsOperations from azure.ai.projects.operations._patch import _OperationMethodHeaderProxy from azure.ai.projects._utils.campaign_polling import _configure_campaign_polling @@ -352,11 +352,12 @@ async def test_campaign_lro_keeps_encoded_names_and_overrides_stale_guard(asynch @pytest.mark.parametrize("asynchronous", [False, True]) -async def test_campaign_operations_are_wired_to_public_clients(asynchronous): +@pytest.mark.parametrize("allow_preview", [False, True]) +async def test_campaign_operations_are_wired_to_public_clients(asynchronous, allow_preview): client_type = AsyncAIProjectClient if asynchronous else AIProjectClient - client = client_type(endpoint=_ENDPOINT, credential=MagicMock(), allow_preview=True) + client = client_type(endpoint=_ENDPOINT, credential=MagicMock(), allow_preview=allow_preview) try: - campaigns = client.beta.voice_agents.campaigns._operation + campaigns = client.beta.voice_agents.telephony._operation assert isinstance(campaigns, AsyncCampaignsOperations if asynchronous else CampaignsOperations) finally: result = client.close() diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations.py index c20741a54e11..1713000022f0 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations.py @@ -7,7 +7,7 @@ """ Recorded tests covering the read-only voice-agent conversation REST API surface exposed through -``project_client.beta.voice_agents.conversations``. +``project_client.voice_agents.conversations``. Conversations, their responses/items, and audio are written by the realtime WebSocket subsystem during a live session (see ``test_voice_agent_realtime_live.py``) and can only be *read* here -- @@ -93,7 +93,7 @@ def _create_live_conversation(project_client, model: str) -> str: ) conversation_id: Optional[str] = None - with project_client.beta.voice_agents.realtime.connect(agent_name=_AGENT_NAME) as conn: + with project_client.voice_agents.realtime.connect(agent_name=_AGENT_NAME) as conn: session_created = conn.recv(timeout=30) assert isinstance(session_created, RealtimeServerEventSessionCreated) conversation_id = session_created.conversation_id @@ -120,10 +120,10 @@ def _create_live_conversation(project_client, model: str) -> str: class TestVoiceAgentConversations(TestBase): """ Recorded tests covering the read-only voice-agent conversation REST API surface exposed - through ``project_client.beta.voice_agents.conversations`` (conversation envelope, + through ``project_client.voice_agents.conversations`` (conversation envelope, responses, items, and audio). - NOTE: The ``beta.voice_agents.conversations.get_generated_audio_item*`` + NOTE: The ``voice_agents.conversations.get_generated_audio_item*`` methods are intentionally NOT covered here: they return the played-back-interrupted subordinate "generated" audio, which requires deliberately barging in mid-reply during a live session to produce -- not exercised by the simple single-turn conversation created @@ -144,22 +144,22 @@ def test_read_conversation(self, **kwargs): # pylint: disable=too-many-locals Action REST API Route Client Method ------+-------------------------------------------------------------------------------+----------------------------------------------------------- - GET /agents/{agent_name}/endpoint/protocols/voice/conversations beta.voice_agents.conversations.list() - GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{id} beta.voice_agents.conversations.get() - GET .../conversations/{id}/responses beta.voice_agents.conversations.list_responses() - GET .../conversations/{id}/responses/{response_id} beta.voice_agents.conversations.get_response() - GET .../conversations/{id}/responses/{response_id}/items beta.voice_agents.conversations.list_response_items() - GET .../conversations/{id}/items beta.voice_agents.conversations.list_items() - GET .../conversations/{id}/items/{item_id} beta.voice_agents.conversations.get_item() - GET .../conversations/{id}/audio beta.voice_agents.conversations.get_audio() - GET .../conversations/{id}/audio/content beta.voice_agents.conversations.download_audio() - GET .../conversations/{id}/items/{item_id}/audio beta.voice_agents.conversations.get_audio_item() - GET .../conversations/{id}/items/{item_id}/audio/content beta.voice_agents.conversations.download_audio_item() - DELETE .../conversations/{id} beta.voice_agents.conversations.delete() + GET /agents/{agent_name}/endpoint/protocols/voice/conversations voice_agents.conversations.list() + GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{id} voice_agents.conversations.get() + GET .../conversations/{id}/responses voice_agents.conversations.list_responses() + GET .../conversations/{id}/responses/{response_id} voice_agents.conversations.get_response() + GET .../conversations/{id}/responses/{response_id}/items voice_agents.conversations.list_response_items() + GET .../conversations/{id}/items voice_agents.conversations.list_items() + GET .../conversations/{id}/items/{item_id} voice_agents.conversations.get_item() + GET .../conversations/{id}/audio voice_agents.conversations.get_audio() + GET .../conversations/{id}/audio/content voice_agents.conversations.download_audio() + GET .../conversations/{id}/items/{item_id}/audio voice_agents.conversations.get_audio_item() + GET .../conversations/{id}/items/{item_id}/audio/content voice_agents.conversations.download_audio_item() + DELETE .../conversations/{id} voice_agents.conversations.delete() """ print("\n") project_client = self.create_client(operation_group="agents", allow_preview=True, **kwargs) - conversations = project_client.beta.voice_agents.conversations + conversations = project_client.voice_agents.conversations if is_live(): model = kwargs.get("foundry_voice_model_name") diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations_async.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations_async.py index a9b62024f442..8f9890220180 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations_async.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_conversations_async.py @@ -7,7 +7,7 @@ """ Recorded tests covering the read-only voice-agent conversation REST API surface exposed through -``project_client.beta.voice_agents.conversations`` (async client). +``project_client.voice_agents.conversations`` (async client). Async counterpart of ``test_voice_agent_conversations.py``. See that module's docstring for the overall rationale (live-only setup to obtain a real conversation id, sanitized to a fixed @@ -82,7 +82,7 @@ async def _create_live_conversation(project_client, model: str) -> str: ) conversation_id: Optional[str] = None - async with project_client.beta.voice_agents.realtime.connect(agent_name=_AGENT_NAME) as conn: + async with project_client.voice_agents.realtime.connect(agent_name=_AGENT_NAME) as conn: session_created = await asyncio.wait_for(conn.recv(), timeout=30) assert isinstance(session_created, RealtimeServerEventSessionCreated) conversation_id = session_created.conversation_id @@ -111,10 +111,10 @@ async def _create_live_conversation(project_client, model: str) -> str: class TestVoiceAgentConversationsAsync(TestBase): """ Recorded tests covering the read-only voice-agent conversation REST API surface exposed - through ``project_client.beta.voice_agents.conversations`` (conversation envelope, + through ``project_client.voice_agents.conversations`` (conversation envelope, responses, items, and audio), using the async client. - NOTE: The ``beta.voice_agents.conversations.get_generated_audio_item*`` + NOTE: The ``voice_agents.conversations.get_generated_audio_item*`` methods are intentionally NOT covered here: they return the played-back-interrupted subordinate "generated" audio, which requires deliberately barging in mid-reply during a live session to produce -- not exercised by the simple single-turn conversation created @@ -136,7 +136,7 @@ async def test_read_conversation_async(self, **kwargs): # pylint: disable=too-m """ print("\n") project_client = self.create_async_client(operation_group="agents", allow_preview=True, **kwargs) - conversations = project_client.beta.voice_agents.conversations + conversations = project_client.voice_agents.conversations async with project_client: if is_live(): diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud.py index 9768b543c28c..da4c78440c6f 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud.py @@ -32,7 +32,7 @@ class TestVoiceAgentCrud(TestBase): NOTE: Some voice-agent REST APIs are intentionally NOT covered here because they are currently blocked by known service-side bugs (see this package's engineering notes): - - Reading back a conversation (`project_client.beta.voice_agents.conversations.*`) using a + - Reading back a conversation (`project_client.voice_agents.conversations.*`) using a `conversation_id` produced by a live realtime WebSocket session - the service's REST conversation-ID validator rejects the ID format generated by the realtime WS subsystem. This is also not practical to cover with HTTP-only recorded tests since it requires an @@ -193,20 +193,20 @@ def test_voice_agent_disable_enable(self, **kwargs): @recorded_by_proxy() def test_generate_agent(self, **kwargs): """ - Test guided authoring for a voice Agent via `beta.agents.create_from_prompt()`. + Test guided authoring for a voice Agent via `agents.create_from_prompt()`. Routes used in this test: Action REST API Route Client Method ------+----------------------------+----------------------------------- - POST /agents:generate project_client.beta.agents.create_from_prompt() + POST /agents:generate project_client.agents.create_from_prompt() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") project_client = self.create_client(operation_group="agents", allow_preview=True, **kwargs) agent_name = "VoiceAgentGenerateTest" - agent: AgentDetails = project_client.beta.agents.create_from_prompt( + agent: AgentDetails = project_client.agents.create_from_prompt( GenerateVoiceAgentRequest(kind=AgentKind.VOICE, name=agent_name) ) self._validate_agent(agent, expected_name=agent_name) diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud_async.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud_async.py index a98704e41d44..7d5f7bcaeb19 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud_async.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_crud_async.py @@ -33,7 +33,7 @@ class TestVoiceAgentCrudAsync(TestBase): NOTE: Some voice-agent REST APIs are intentionally NOT covered here because they are currently blocked by known service-side bugs (see this package's engineering notes): - - Reading back a conversation (`project_client.beta.voice_agents.conversations.*`) using a + - Reading back a conversation (`project_client.voice_agents.conversations.*`) using a `conversation_id` produced by a live realtime WebSocket session - the service's REST conversation-ID validator rejects the ID format generated by the realtime WS subsystem. This is also not practical to cover with HTTP-only recorded tests since it requires an @@ -194,13 +194,13 @@ async def test_voice_agent_disable_enable_async(self, **kwargs): @recorded_by_proxy_async() async def test_generate_agent_async(self, **kwargs): """ - Test guided authoring for a voice Agent via `beta.agents.create_from_prompt()`. + Test guided authoring for a voice Agent via `agents.create_from_prompt()`. Routes used in this test: Action REST API Route Client Method ------+----------------------------+----------------------------------- - POST /agents:generate project_client.beta.agents.create_from_prompt() + POST /agents:generate project_client.agents.create_from_prompt() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -208,7 +208,7 @@ async def test_generate_agent_async(self, **kwargs): agent_name = "VoiceAgentGenerateTestAsync" async with project_client: - agent: AgentDetails = await project_client.beta.agents.create_from_prompt( + agent: AgentDetails = await project_client.agents.create_from_prompt( GenerateVoiceAgentRequest(kind=AgentKind.VOICE, name=agent_name) ) self._validate_agent(agent, expected_name=agent_name) diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_generated_audio.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_generated_audio.py index e105256f9ef0..3e3ac91dd7d2 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_generated_audio.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_generated_audio.py @@ -28,8 +28,8 @@ def test_interrupted_generated_audio(self, interrupted_audio_fixture, **kwargs): fixture = interrupted_audio_fixture if is_live(): add_interruption_sanitizers(fixture) - with self.create_client(allow_preview=True, **kwargs) as client: - conversations = client.beta.voice_agents.conversations + with self.create_client(**kwargs) as client: + conversations = client.voice_agents.conversations try: metadata = conversations.get_generated_audio_item( fixture.agent_name, diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_operation_exports.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_operation_exports.py index ffa316fa8183..cf3275908799 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_operation_exports.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_operation_exports.py @@ -26,3 +26,66 @@ def test_live_conversations_operation_export(namespace): voice_agents = operations.BetaVoiceAgentsOperations(MagicMock(), MagicMock(), MagicMock(), MagicMock()) assert isinstance(voice_agents.live_conversations, operation_type) assert inspect.iscoroutinefunction(operation_type.get) == (".aio." in namespace) + + +@pytest.mark.parametrize("namespace", ["azure.ai.projects.operations", "azure.ai.projects.aio.operations"]) +@pytest.mark.parametrize("property_name", ["conversations", "telephony"]) +def test_ga_voice_operation_exports(namespace, property_name): + operations = import_module(namespace) + generated = import_module(f"{namespace}._operations") + operation_name = f"VoiceAgents{property_name.title()}Operations" + operation_type = getattr(operations, operation_name) + + assert operation_name in operations.__all__ + assert operation_type is getattr(generated, operation_name) + assert get_type_hints(operations.VoiceAgentsOperations)[property_name] is operation_type + + config = MagicMock(allow_preview=False) + voice_agents = operations.VoiceAgentsOperations(MagicMock(), config, MagicMock(), MagicMock()) + assert isinstance(getattr(voice_agents, property_name), operation_type) + assert not hasattr(voice_agents, "live_conversations") + assert not hasattr(voice_agents, "campaigns") + + +@pytest.mark.parametrize("namespace", ["azure.ai.projects", "azure.ai.projects.aio"]) +@pytest.mark.parametrize("allow_preview", [False, True]) +def test_ga_voice_client_surface(namespace, allow_preview): + client_type = import_module(namespace).AIProjectClient + client = client_type("https://example.test", MagicMock(), allow_preview=allow_preview) + + assert callable(client.agents.create_from_prompt) + assert not hasattr(client.beta, "agents") + assert not hasattr(client.beta.voice_agents, "conversations") + assert not hasattr(client.beta.voice_agents, "campaigns") + assert not hasattr(client.beta.voice_agents, "realtime") + assert client.beta.voice_agents.live is not None + assert client.beta.voice_agents.live_conversations is not None + assert client.beta.voice_agents.telephony is not None + manager = client.voice_agents.realtime.connect(agent_name="voice-agent") + assert manager._allow_preview is allow_preview + + +@pytest.mark.parametrize("namespace", ["azure.ai.projects.operations", "azure.ai.projects.aio.operations"]) +def test_beta_telephony_operation_export(namespace): + operations = import_module(namespace) + generated = import_module(f"{namespace}._operations") + operation_name = "BetaVoiceAgentsTelephonyOperations" + operation_type = getattr(operations, operation_name) + + assert operation_name in operations.__all__ + assert "BetaVoiceAgentsCampaignsOperations" not in operations.__all__ + assert issubclass(operation_type, getattr(generated, operation_name)) + assert get_type_hints(operations.BetaVoiceAgentsOperations)["telephony"] is operation_type + + voice_agents = operations.BetaVoiceAgentsOperations(MagicMock(), MagicMock(), MagicMock(), MagicMock()) + assert isinstance(voice_agents.telephony, operation_type) + assert not hasattr(voice_agents, "campaigns") + assert {name for name, method in inspect.getmembers(operation_type, callable) if not name.startswith("_")} == { + "begin_create", + "get", + "list", + "begin_cancel", + "begin_delete", + "list_validation_errors", + "get_operation", + } diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live.py index 6ba42809a87b..b98892f0a057 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live.py @@ -6,7 +6,7 @@ # cSpell:disable """ -Live-only tests for the hand-written sync ``client.beta.voice_agents.realtime`` WebSocket streaming client. +Live-only tests for the hand-written sync ``client.voice_agents.realtime`` WebSocket streaming client. Unlike ``tests/agents/test_realtime_client.py`` (which mocks the transport to unit-test URL construction, auth, and error paths without a live service), these tests open a REAL WebSocket @@ -17,7 +17,7 @@ exact audio bytes (the model's actual audio/text output is not deterministic). These tests do not use ``store=True`` / read back a persisted conversation -- that surface -(``project_client.beta.voice_agents.conversations.*``) is covered by the separate recorded +(``project_client.voice_agents.conversations.*``) is covered by the separate recorded tests in ``test_voice_agent_conversations.py``, which need a real conversation id but replay against a recorded cassette rather than opening a live WebSocket connection on every run. """ @@ -74,7 +74,7 @@ def _get_weather(city: str) -> str: ) class TestVoiceAgentRealtimeLive(TestBase): """ - Live tests covering ``client.beta.voice_agents.realtime.connect()`` (the hand-written sync WebSocket streaming + Live tests covering ``client.voice_agents.realtime.connect()`` (the hand-written sync WebSocket streaming client) against a real voice agent and a real service connection. """ @@ -112,7 +112,7 @@ def test_realtime_session_lifecycle(self, **kwargs): try: self._create_basic_agent(project_client, agent_name, model) - with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: event = conn.recv(timeout=_EVENT_TIMEOUT) assert isinstance(event, RealtimeServerEventSessionCreated) assert event.type == "session.created" @@ -143,7 +143,7 @@ def test_realtime_text_turn_produces_audio_and_transcript(self, **kwargs): try: self._create_basic_agent(project_client, agent_name, model) - with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: session_created = conn.recv(timeout=_EVENT_TIMEOUT) assert isinstance(session_created, RealtimeServerEventSessionCreated) @@ -232,7 +232,7 @@ def test_realtime_function_tool_call(self, **kwargs): ), ) - with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: session_created = conn.recv(timeout=_EVENT_TIMEOUT) assert isinstance(session_created, RealtimeServerEventSessionCreated) diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live_async.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live_async.py index 2eac89d8fc63..638d80a6dc57 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live_async.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_realtime_live_async.py @@ -6,7 +6,7 @@ # cSpell:disable """ -Live-only tests for the hand-written async ``async_client.beta.voice_agents.realtime`` WebSocket streaming client. +Live-only tests for the hand-written async ``async_client.voice_agents.realtime`` WebSocket streaming client. Async counterpart of ``test_voice_agent_realtime_live.py``. See that module's docstring for the overall rationale (modeled on the ``azure-ai-voicelive`` package's live realtime test pattern: @@ -67,7 +67,7 @@ def _get_weather(city: str) -> str: ) class TestVoiceAgentRealtimeLiveAsync(TestBase): """ - Live tests covering ``async_client.beta.voice_agents.realtime.connect()`` (the hand-written async WebSocket + Live tests covering ``async_client.voice_agents.realtime.connect()`` (the hand-written async WebSocket streaming client) against a real voice agent and a real service connection. """ @@ -105,7 +105,7 @@ async def test_realtime_session_lifecycle_async(self, **kwargs): try: await self._create_basic_agent(project_client, agent_name, model) - async with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + async with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: event = await asyncio.wait_for(conn.recv(), timeout=_EVENT_TIMEOUT) assert isinstance(event, RealtimeServerEventSessionCreated) assert event.type == "session.created" @@ -137,7 +137,7 @@ async def test_realtime_text_turn_produces_audio_and_transcript_async(self, **kw try: await self._create_basic_agent(project_client, agent_name, model) - async with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + async with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: session_created = await asyncio.wait_for(conn.recv(), timeout=_EVENT_TIMEOUT) assert isinstance(session_created, RealtimeServerEventSessionCreated) @@ -228,7 +228,7 @@ async def test_realtime_function_tool_call_async(self, **kwargs): ), ) - async with project_client.beta.voice_agents.realtime.connect(agent_name=agent_name) as conn: + async with project_client.voice_agents.realtime.connect(agent_name=agent_name) as conn: session_created = await asyncio.wait_for(conn.recv(), timeout=_EVENT_TIMEOUT) assert isinstance(session_created, RealtimeServerEventSessionCreated) diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony.py index 52bf81f5872c..91124d43d9ce 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony.py @@ -26,8 +26,8 @@ class TestVoiceAgentTelephony(TestBase): """ Recorded tests covering the voice-agent telephony REST API surface exposed through - `project_client.beta.voice_agents.telephony.*` (bindings, calls, and transfer targets), and the - top-level `project_client.beta.voice_agents.conversations.*` generated-audio reads. + `project_client.voice_agents.telephony.*` (bindings, calls, and transfer targets), and the + top-level `project_client.voice_agents.conversations.*` generated-audio reads. NOTE: All tests in this file are currently marked `skip`: - The telephony routes (`/agents/{agent_name}/telephony_bindings`, `/telephony_calls`, @@ -37,10 +37,10 @@ class TestVoiceAgentTelephony(TestBase): confirmed by comparing against a known-working route's fully-populated JSON error body). Un-skip `test_telephony_bindings_and_transfer_targets`/`test_telephony_calls_not_found` once the service deploys these routes. - - `beta.voice_agents.conversations.get_generated_audio_item*` with a + - `voice_agents.conversations.get_generated_audio_item*` with a made-up conversation/item ID hits the service's conversation-ID format validator and returns an unhandled `500 server_error` instead of a clean `404` - the exact same - pre-existing behavior as the already-documented `beta.voice_agents.conversations` + pre-existing behavior as the already-documented `voice_agents.conversations` limitation below. Testing the success path needs a live realtime session whose playback was interrupted; testing the not-found path needs a validly-formatted but nonexistent ID (the format isn't publicly documented). `test_generated_audio_not_found` is left in as a @@ -54,7 +54,7 @@ class TestVoiceAgentTelephony(TestBase): `tests/foundry_features_header/`. - `list_calls`/`get_call`/`transfer_call`/`end_call` against an actual in-progress or historical call (needs a real inbound telephony call). - - Reading back a conversation (`project_client.beta.voice_agents.conversations.*`) using a + - Reading back a conversation (`project_client.voice_agents.conversations.*`) using a `conversation_id` produced by a live realtime WebSocket session - the service's REST conversation-ID validator rejects the ID format generated by the realtime WS subsystem. This is also not practical to cover with HTTP-only recorded tests since it requires an @@ -91,12 +91,12 @@ def test_telephony_bindings_and_transfer_targets(self, **kwargs): Action REST API Route Client Method ------+-------------------------------------------------------------+----------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/telephony/bindings project_client.beta.voice_agents.telephony.list_bindings() - GET /agents/{agent_name}/telephony/transfer_targets project_client.beta.voice_agents.telephony.get_transfer_targets() - PUT /agents/{agent_name}/telephony/transfer_targets project_client.beta.voice_agents.telephony.replace_transfer_targets() - GET /agents/{agent_name}/telephony/bindings/{binding_id} project_client.beta.voice_agents.telephony.get_binding() - PATCH /agents/{agent_name}/telephony/bindings/{binding_id} project_client.beta.voice_agents.telephony.update_binding() - DELETE /agents/{agent_name}/telephony/bindings/{binding_id} project_client.beta.voice_agents.telephony.delete_binding() + GET /agents/{agent_name}/telephony/bindings project_client.voice_agents.telephony.list_bindings() + GET /agents/{agent_name}/telephony/transfer_targets project_client.voice_agents.telephony.get_transfer_targets() + PUT /agents/{agent_name}/telephony/transfer_targets project_client.voice_agents.telephony.replace_transfer_targets() + GET /agents/{agent_name}/telephony/bindings/{binding_id} project_client.voice_agents.telephony.get_binding() + PATCH /agents/{agent_name}/telephony/bindings/{binding_id} project_client.voice_agents.telephony.update_binding() + DELETE /agents/{agent_name}/telephony/bindings/{binding_id} project_client.voice_agents.telephony.delete_binding() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -119,11 +119,11 @@ def test_telephony_bindings_and_transfer_targets(self, **kwargs): self._validate_agent_version(agent_version, expected_name=agent_name) # A freshly created agent has no telephony bindings. - bindings = list(project_client.beta.voice_agents.telephony.list_bindings(agent_name=agent_name)) + bindings = list(project_client.voice_agents.telephony.list_bindings(agent_name=agent_name)) assert len(bindings) == 0 # A freshly created agent has no telephony transfer targets configured. - targets: TelephonyTransferTargets = project_client.beta.voice_agents.telephony.get_transfer_targets( + targets: TelephonyTransferTargets = project_client.voice_agents.telephony.get_transfer_targets( agent_name=agent_name ) assert targets is not None @@ -135,13 +135,11 @@ def test_telephony_bindings_and_transfer_targets(self, **kwargs): description="Transfers to the sales desk for pricing questions.", destination=PhoneNumber(value="+14255550123"), ) - replaced_targets: TelephonyTransferTargets = ( - project_client.beta.voice_agents.telephony.replace_transfer_targets( - agent_name=agent_name, - transfer_targets=[new_target], - etag=None, - match_condition=MatchConditions.IfPresent, - ) + replaced_targets: TelephonyTransferTargets = project_client.voice_agents.telephony.replace_transfer_targets( + agent_name=agent_name, + transfer_targets=[new_target], + etag=None, + match_condition=MatchConditions.IfPresent, ) assert len(replaced_targets.transfer_targets) == 1 assert replaced_targets.transfer_targets[0].name == "sales_desk" @@ -150,14 +148,14 @@ def test_telephony_bindings_and_transfer_targets(self, **kwargs): assert replaced_targets.transfer_targets[0].destination.value == "+14255550123" # Confirm the change persisted. - confirmed_targets: TelephonyTransferTargets = project_client.beta.voice_agents.telephony.get_transfer_targets( + confirmed_targets: TelephonyTransferTargets = project_client.voice_agents.telephony.get_transfer_targets( agent_name=agent_name ) assert len(confirmed_targets.transfer_targets) == 1 assert confirmed_targets.transfer_targets[0].name == "sales_desk" # Clear the transfer targets (empty array clears all targets). - cleared_targets: TelephonyTransferTargets = project_client.beta.voice_agents.telephony.replace_transfer_targets( + cleared_targets: TelephonyTransferTargets = project_client.voice_agents.telephony.replace_transfer_targets( agent_name=agent_name, transfer_targets=[], etag=None, @@ -168,9 +166,9 @@ def test_telephony_bindings_and_transfer_targets(self, **kwargs): # A nonexistent telephony binding returns 404 on get/update/delete. fake_binding_id = "twilio:+10000000000" with pytest.raises(ResourceNotFoundError): - project_client.beta.voice_agents.telephony.get_binding(agent_name=agent_name, binding_id=fake_binding_id) + project_client.voice_agents.telephony.get_binding(agent_name=agent_name, binding_id=fake_binding_id) with pytest.raises(ResourceNotFoundError): - project_client.beta.voice_agents.telephony.update_binding( + project_client.voice_agents.telephony.update_binding( agent_name=agent_name, binding_id=fake_binding_id, body=UpdateTelephonyBindingRequest(label="Updated test binding"), @@ -178,7 +176,7 @@ def test_telephony_bindings_and_transfer_targets(self, **kwargs): match_condition=MatchConditions.IfPresent, ) with pytest.raises(ResourceNotFoundError): - project_client.beta.voice_agents.telephony.delete_binding( + project_client.voice_agents.telephony.delete_binding( agent_name=agent_name, binding_id=fake_binding_id, etag=None, @@ -207,10 +205,10 @@ def test_telephony_calls_not_found(self, **kwargs): Action REST API Route Client Method ------+-------------------------------------------------------------+----------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/telephony/calls project_client.beta.voice_agents.telephony.list_calls() - GET /agents/{agent_name}/telephony/calls/{call_id} project_client.beta.voice_agents.telephony.get_call() - POST /agents/{agent_name}/telephony/calls/{call_id}:transfer project_client.beta.voice_agents.telephony.transfer_call() - POST /agents/{agent_name}/telephony/calls/{call_id}:end project_client.beta.voice_agents.telephony.end_call() + GET /agents/{agent_name}/telephony/calls project_client.voice_agents.telephony.list_calls() + GET /agents/{agent_name}/telephony/calls/{call_id} project_client.voice_agents.telephony.get_call() + POST /agents/{agent_name}/telephony/calls/{call_id}:transfer project_client.voice_agents.telephony.transfer_call() + POST /agents/{agent_name}/telephony/calls/{call_id}:end project_client.voice_agents.telephony.end_call() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -232,19 +230,19 @@ def test_telephony_calls_not_found(self, **kwargs): self._validate_agent_version(agent_version, expected_name=agent_name) # A freshly created agent has no telephony call history. - calls = list(project_client.beta.voice_agents.telephony.list_calls(agent_name=agent_name)) + calls = list(project_client.voice_agents.telephony.list_calls(agent_name=agent_name)) assert len(calls) == 0 fake_call_id = "nonexistent-call-id" with pytest.raises(ResourceNotFoundError): - project_client.beta.voice_agents.telephony.get_call(agent_name=agent_name, call_id=fake_call_id) + project_client.voice_agents.telephony.get_call(agent_name=agent_name, call_id=fake_call_id) with pytest.raises(HttpResponseError) as transfer_exc_info: - project_client.beta.voice_agents.telephony.transfer_call( + project_client.voice_agents.telephony.transfer_call( agent_name=agent_name, call_id=fake_call_id, target="nonexistent-target" ) assert transfer_exc_info.value.status_code == 404 with pytest.raises(HttpResponseError) as end_exc_info: - project_client.beta.voice_agents.telephony.end_call(agent_name=agent_name, call_id=fake_call_id) + project_client.voice_agents.telephony.end_call(agent_name=agent_name, call_id=fake_call_id) assert end_exc_info.value.status_code == 404 # Delete the voice agent. @@ -256,14 +254,14 @@ def test_telephony_calls_not_found(self, **kwargs): @pytest.mark.skip( reason="A made-up conversation/item ID hits the service's conversation-ID format validator " "and returns an unhandled 500 instead of a clean 404 (same pre-existing behavior as " - "beta.voice_agents.conversations). Needs a validly-formatted but nonexistent ID, or a real " + "voice_agents.conversations). Needs a validly-formatted but nonexistent ID, or a real " "realtime session, to test properly." ) @servicePreparer() @recorded_by_proxy() def test_generated_audio_not_found(self, **kwargs): """ - Test the `beta.voice_agents.conversations.get_generated_audio_item`/ + Test the `voice_agents.conversations.get_generated_audio_item`/ `download_generated_audio_item` methods against a nonexistent conversation item, which return 404. @@ -272,8 +270,8 @@ def test_generated_audio_not_found(self, **kwargs): Action REST API Route Client Method ------+-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated project_client.beta.voice_agents.conversations.get_generated_audio_item() - GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated/content project_client.beta.voice_agents.conversations.download_generated_audio_item() + GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated project_client.voice_agents.conversations.get_generated_audio_item() + GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated/content project_client.voice_agents.conversations.download_generated_audio_item() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -297,12 +295,12 @@ def test_generated_audio_not_found(self, **kwargs): fake_conversation_id = "nonexistent-conversation-id" fake_item_id = "nonexistent-item-id" with pytest.raises(ResourceNotFoundError): - project_client.beta.voice_agents.conversations.get_generated_audio_item( + project_client.voice_agents.conversations.get_generated_audio_item( agent_name=agent_name, conversation_id=fake_conversation_id, item_id=fake_item_id ) with pytest.raises(HttpResponseError) as content_exc_info: list( - project_client.beta.voice_agents.conversations.download_generated_audio_item( + project_client.voice_agents.conversations.download_generated_audio_item( agent_name=agent_name, conversation_id=fake_conversation_id, item_id=fake_item_id ) ) diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_async.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_async.py index 449004578529..49abe3c4a1e2 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_async.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_async.py @@ -26,8 +26,8 @@ class TestVoiceAgentTelephonyAsync(TestBase): """ Recorded tests covering the voice-agent telephony REST API surface exposed through - `project_client.beta.voice_agents.telephony.*` (bindings, calls, and transfer targets), and the - top-level `project_client.beta.voice_agents.conversations.*` generated-audio reads. + `project_client.voice_agents.telephony.*` (bindings, calls, and transfer targets), and the + top-level `project_client.voice_agents.conversations.*` generated-audio reads. NOTE: All tests in this file are currently marked `skip`: - The telephony routes (`/agents/{agent_name}/telephony_bindings`, `/telephony_calls`, @@ -37,10 +37,10 @@ class TestVoiceAgentTelephonyAsync(TestBase): confirmed by comparing against a known-working route's fully-populated JSON error body). Un-skip `test_telephony_bindings_and_transfer_targets`/`test_telephony_calls_not_found` once the service deploys these routes. - - `beta.voice_agents.conversations.get_generated_audio_item*` with a + - `voice_agents.conversations.get_generated_audio_item*` with a made-up conversation/item ID hits the service's conversation-ID format validator and returns an unhandled `500 server_error` instead of a clean `404` - the exact same - pre-existing behavior as the already-documented `beta.voice_agents.conversations` + pre-existing behavior as the already-documented `voice_agents.conversations` limitation below. Testing the success path needs a live realtime session whose playback was interrupted; testing the not-found path needs a validly-formatted but nonexistent ID (the format isn't publicly documented). `test_generated_audio_not_found` is left in as a @@ -54,7 +54,7 @@ class TestVoiceAgentTelephonyAsync(TestBase): `tests/foundry_features_header/`. - `list_calls`/`get_call`/`transfer_call`/`end_call` against an actual in-progress or historical call (needs a real inbound telephony call). - - Reading back a conversation (`project_client.beta.voice_agents.conversations.*`) using a + - Reading back a conversation (`project_client.voice_agents.conversations.*`) using a `conversation_id` produced by a live realtime WebSocket session - the service's REST conversation-ID validator rejects the ID format generated by the realtime WS subsystem. This is also not practical to cover with HTTP-only recorded tests since it requires an @@ -91,12 +91,12 @@ async def test_telephony_bindings_and_transfer_targets(self, **kwargs): Action REST API Route Client Method ------+-------------------------------------------------------------+----------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/telephony/bindings project_client.beta.voice_agents.telephony.list_bindings() - GET /agents/{agent_name}/telephony/transfer_targets project_client.beta.voice_agents.telephony.get_transfer_targets() - PUT /agents/{agent_name}/telephony/transfer_targets project_client.beta.voice_agents.telephony.replace_transfer_targets() - GET /agents/{agent_name}/telephony/bindings/{binding_id} project_client.beta.voice_agents.telephony.get_binding() - PATCH /agents/{agent_name}/telephony/bindings/{binding_id} project_client.beta.voice_agents.telephony.update_binding() - DELETE /agents/{agent_name}/telephony/bindings/{binding_id} project_client.beta.voice_agents.telephony.delete_binding() + GET /agents/{agent_name}/telephony/bindings project_client.voice_agents.telephony.list_bindings() + GET /agents/{agent_name}/telephony/transfer_targets project_client.voice_agents.telephony.get_transfer_targets() + PUT /agents/{agent_name}/telephony/transfer_targets project_client.voice_agents.telephony.replace_transfer_targets() + GET /agents/{agent_name}/telephony/bindings/{binding_id} project_client.voice_agents.telephony.get_binding() + PATCH /agents/{agent_name}/telephony/bindings/{binding_id} project_client.voice_agents.telephony.update_binding() + DELETE /agents/{agent_name}/telephony/bindings/{binding_id} project_client.voice_agents.telephony.delete_binding() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -119,11 +119,11 @@ async def test_telephony_bindings_and_transfer_targets(self, **kwargs): self._validate_agent_version(agent_version, expected_name=agent_name) # A freshly created agent has no telephony bindings. - bindings = [b async for b in project_client.beta.voice_agents.telephony.list_bindings(agent_name=agent_name)] + bindings = [b async for b in project_client.voice_agents.telephony.list_bindings(agent_name=agent_name)] assert len(bindings) == 0 # A freshly created agent has no telephony transfer targets configured. - targets: TelephonyTransferTargets = await project_client.beta.voice_agents.telephony.get_transfer_targets( + targets: TelephonyTransferTargets = await project_client.voice_agents.telephony.get_transfer_targets( agent_name=agent_name ) assert targets is not None @@ -136,7 +136,7 @@ async def test_telephony_bindings_and_transfer_targets(self, **kwargs): destination=PhoneNumber(value="+14255550123"), ) replaced_targets: TelephonyTransferTargets = ( - await project_client.beta.voice_agents.telephony.replace_transfer_targets( + await project_client.voice_agents.telephony.replace_transfer_targets( agent_name=agent_name, transfer_targets=[new_target], etag=None, @@ -150,15 +150,15 @@ async def test_telephony_bindings_and_transfer_targets(self, **kwargs): assert replaced_targets.transfer_targets[0].destination.value == "+14255550123" # Confirm the change persisted. - confirmed_targets: TelephonyTransferTargets = ( - await project_client.beta.voice_agents.telephony.get_transfer_targets(agent_name=agent_name) + confirmed_targets: TelephonyTransferTargets = await project_client.voice_agents.telephony.get_transfer_targets( + agent_name=agent_name ) assert len(confirmed_targets.transfer_targets) == 1 assert confirmed_targets.transfer_targets[0].name == "sales_desk" # Clear the transfer targets (empty array clears all targets). cleared_targets: TelephonyTransferTargets = ( - await project_client.beta.voice_agents.telephony.replace_transfer_targets( + await project_client.voice_agents.telephony.replace_transfer_targets( agent_name=agent_name, transfer_targets=[], etag=None, @@ -170,11 +170,9 @@ async def test_telephony_bindings_and_transfer_targets(self, **kwargs): # A nonexistent telephony binding returns 404 on get/update/delete. fake_binding_id = "twilio:+10000000000" with pytest.raises(ResourceNotFoundError): - await project_client.beta.voice_agents.telephony.get_binding( - agent_name=agent_name, binding_id=fake_binding_id - ) + await project_client.voice_agents.telephony.get_binding(agent_name=agent_name, binding_id=fake_binding_id) with pytest.raises(ResourceNotFoundError): - await project_client.beta.voice_agents.telephony.update_binding( + await project_client.voice_agents.telephony.update_binding( agent_name=agent_name, binding_id=fake_binding_id, body=UpdateTelephonyBindingRequest(label="Updated test binding"), @@ -182,7 +180,7 @@ async def test_telephony_bindings_and_transfer_targets(self, **kwargs): match_condition=MatchConditions.IfPresent, ) with pytest.raises(ResourceNotFoundError): - await project_client.beta.voice_agents.telephony.delete_binding( + await project_client.voice_agents.telephony.delete_binding( agent_name=agent_name, binding_id=fake_binding_id, etag=None, @@ -211,10 +209,10 @@ async def test_telephony_calls_not_found(self, **kwargs): Action REST API Route Client Method ------+-------------------------------------------------------------+----------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/telephony/calls project_client.beta.voice_agents.telephony.list_calls() - GET /agents/{agent_name}/telephony/calls/{call_id} project_client.beta.voice_agents.telephony.get_call() - POST /agents/{agent_name}/telephony/calls/{call_id}:transfer project_client.beta.voice_agents.telephony.transfer_call() - POST /agents/{agent_name}/telephony/calls/{call_id}:end project_client.beta.voice_agents.telephony.end_call() + GET /agents/{agent_name}/telephony/calls project_client.voice_agents.telephony.list_calls() + GET /agents/{agent_name}/telephony/calls/{call_id} project_client.voice_agents.telephony.get_call() + POST /agents/{agent_name}/telephony/calls/{call_id}:transfer project_client.voice_agents.telephony.transfer_call() + POST /agents/{agent_name}/telephony/calls/{call_id}:end project_client.voice_agents.telephony.end_call() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -236,19 +234,19 @@ async def test_telephony_calls_not_found(self, **kwargs): self._validate_agent_version(agent_version, expected_name=agent_name) # A freshly created agent has no telephony call history. - calls = [c async for c in project_client.beta.voice_agents.telephony.list_calls(agent_name=agent_name)] + calls = [c async for c in project_client.voice_agents.telephony.list_calls(agent_name=agent_name)] assert len(calls) == 0 fake_call_id = "nonexistent-call-id" with pytest.raises(ResourceNotFoundError): - await project_client.beta.voice_agents.telephony.get_call(agent_name=agent_name, call_id=fake_call_id) + await project_client.voice_agents.telephony.get_call(agent_name=agent_name, call_id=fake_call_id) with pytest.raises(HttpResponseError) as transfer_exc_info: - await project_client.beta.voice_agents.telephony.transfer_call( + await project_client.voice_agents.telephony.transfer_call( agent_name=agent_name, call_id=fake_call_id, target="nonexistent-target" ) assert transfer_exc_info.value.status_code == 404 with pytest.raises(HttpResponseError) as end_exc_info: - await project_client.beta.voice_agents.telephony.end_call(agent_name=agent_name, call_id=fake_call_id) + await project_client.voice_agents.telephony.end_call(agent_name=agent_name, call_id=fake_call_id) assert end_exc_info.value.status_code == 404 # Delete the voice agent. @@ -260,14 +258,14 @@ async def test_telephony_calls_not_found(self, **kwargs): @pytest.mark.skip( reason="A made-up conversation/item ID hits the service's conversation-ID format validator " "and returns an unhandled 500 instead of a clean 404 (same pre-existing behavior as " - "beta.voice_agents.conversations). Needs a validly-formatted but nonexistent ID, or a real " + "voice_agents.conversations). Needs a validly-formatted but nonexistent ID, or a real " "realtime session, to test properly." ) @servicePreparer() @recorded_by_proxy_async() async def test_generated_audio_not_found(self, **kwargs): """ - Test the `beta.voice_agents.conversations.get_generated_audio_item`/ + Test the `voice_agents.conversations.get_generated_audio_item`/ `download_generated_audio_item` methods against a nonexistent conversation item, which return 404. @@ -276,8 +274,8 @@ async def test_generated_audio_not_found(self, **kwargs): Action REST API Route Client Method ------+-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated project_client.beta.voice_agents.conversations.get_generated_audio_item() - GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated/content project_client.beta.voice_agents.conversations.download_generated_audio_item() + GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated project_client.voice_agents.conversations.get_generated_audio_item() + GET /agents/{agent_name}/endpoint/protocols/voice/conversations/{conversation_id}/items/{item_id}/audio/generated/content project_client.voice_agents.conversations.download_generated_audio_item() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -301,13 +299,13 @@ async def test_generated_audio_not_found(self, **kwargs): fake_conversation_id = "nonexistent-conversation-id" fake_item_id = "nonexistent-item-id" with pytest.raises(ResourceNotFoundError): - await project_client.beta.voice_agents.conversations.get_generated_audio_item( + await project_client.voice_agents.conversations.get_generated_audio_item( agent_name=agent_name, conversation_id=fake_conversation_id, item_id=fake_item_id ) with pytest.raises(HttpResponseError) as content_exc_info: [ chunk - async for chunk in await project_client.beta.voice_agents.conversations.download_generated_audio_item( + async for chunk in await project_client.voice_agents.conversations.download_generated_audio_item( agent_name=agent_name, conversation_id=fake_conversation_id, item_id=fake_item_id ) ] diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job.py index b9c17454edb8..9c77d6a83aa0 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job.py @@ -21,7 +21,7 @@ class TestVoiceAgentTelephonyCallJob(TestBase): """ Recorded tests covering the outbound telephony call-job REST API surface exposed through the - top-level `project_client.beta.voice_agents.telephony.*` operation group (added in the + top-level `project_client.voice_agents.telephony.*` operation group (added in the "batch 2" Voice Agents TypeSpec, distinct from the existing `project_client.agents.*` telephony binding/call methods). @@ -80,8 +80,8 @@ def test_telephony_call_job_not_found(self, **kwargs): Action REST API Route Client Method ------+-------------------------------------------------------------+----------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/telephony/call_jobs/{call_job_id} project_client.beta.voice_agents.telephony.get_call_job() - POST /agents/{agent_name}/telephony/call_jobs/{call_job_id}:cancel project_client.beta.voice_agents.telephony.cancel_call_job() + GET /agents/{agent_name}/telephony/call_jobs/{call_job_id} project_client.voice_agents.telephony.get_call_job() + POST /agents/{agent_name}/telephony/call_jobs/{call_job_id}:cancel project_client.voice_agents.telephony.cancel_call_job() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -105,13 +105,13 @@ def test_telephony_call_job_not_found(self, **kwargs): fake_call_job_id = "nonexistent-call-job-id" with pytest.raises(ResourceNotFoundError): - project_client.beta.voice_agents.telephony.get_call_job(agent_name=agent_name, call_job_id=fake_call_job_id) + project_client.voice_agents.telephony.get_call_job(agent_name=agent_name, call_job_id=fake_call_job_id) with pytest.raises(ResourceNotFoundError): # cancel_call_job's "etag" is a numeric call-job revision, not an opaque ETag - the # service rejects an "If-Match: *" unconditional match for this endpoint, so a # well-formed (if make-believe) revision is passed here instead, using the default # match_condition (MatchConditions.IfNotModified). - project_client.beta.voice_agents.telephony.cancel_call_job( + project_client.voice_agents.telephony.cancel_call_job( agent_name=agent_name, call_job_id=fake_call_job_id, etag="0", diff --git a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job_async.py b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job_async.py index f3c84a8f36a7..0a6877c16407 100644 --- a/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job_async.py +++ b/sdk/ai/azure-ai-projects/tests/agents/test_voice_agent_telephony_call_job_async.py @@ -21,7 +21,7 @@ class TestVoiceAgentTelephonyCallJobAsync(TestBase): """ Recorded tests covering the outbound telephony call-job REST API surface exposed through the - top-level `project_client.beta.voice_agents.telephony.*` operation group (added in the + top-level `project_client.voice_agents.telephony.*` operation group (added in the "batch 2" Voice Agents TypeSpec, distinct from the existing `project_client.agents.*` telephony binding/call methods). @@ -80,8 +80,8 @@ async def test_telephony_call_job_not_found(self, **kwargs): Action REST API Route Client Method ------+-------------------------------------------------------------+----------------------------------------------- POST /agents/{agent_name}/versions project_client.agents.create_version() - GET /agents/{agent_name}/telephony/call_jobs/{call_job_id} project_client.beta.voice_agents.telephony.get_call_job() - POST /agents/{agent_name}/telephony/call_jobs/{call_job_id}:cancel project_client.beta.voice_agents.telephony.cancel_call_job() + GET /agents/{agent_name}/telephony/call_jobs/{call_job_id} project_client.voice_agents.telephony.get_call_job() + POST /agents/{agent_name}/telephony/call_jobs/{call_job_id}:cancel project_client.voice_agents.telephony.cancel_call_job() DELETE /agents/{agent_name} project_client.agents.delete() """ print("\n") @@ -105,7 +105,7 @@ async def test_telephony_call_job_not_found(self, **kwargs): fake_call_job_id = "nonexistent-call-job-id" with pytest.raises(ResourceNotFoundError): - await project_client.beta.voice_agents.telephony.get_call_job( + await project_client.voice_agents.telephony.get_call_job( agent_name=agent_name, call_job_id=fake_call_job_id ) with pytest.raises(ResourceNotFoundError): @@ -113,7 +113,7 @@ async def test_telephony_call_job_not_found(self, **kwargs): # service rejects an "If-Match: *" unconditional match for this endpoint, so a # well-formed (if make-believe) revision is passed here instead, using the default # match_condition (MatchConditions.IfNotModified). - await project_client.beta.voice_agents.telephony.cancel_call_job( + await project_client.voice_agents.telephony.cancel_call_job( agent_name=agent_name, call_job_id=fake_call_job_id, etag="0", diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py index 884e69e74542..6b1322682c39 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py @@ -47,7 +47,6 @@ "skills": "Skills=V1Preview", "voice_agents": "VoiceAgents=V1Preview", "datasets": "DataGenerationJobs=V1Preview", - "agents": "WorkflowAgents=V1Preview,ExternalAgents=V1Preview,DraftAgents=V1Preview,VoiceAgents=V1Preview,DigitalWorker=V1Preview,GitHubCopilot=V1Preview,Skills=V1Preview,MicrosoftCopilot=V1Preview,ModelRouterControls=V1Preview", } # Methods on .beta sub-clients that are NOT simple one-HTTP-call wrappers and diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol.py index 9f7393a719d7..14e5472309bb 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol.py @@ -54,7 +54,6 @@ def client() -> Iterator[AIProjectClient]: with AIProjectClient( endpoint=FAKE_ENDPOINT, credential=FakeCredential(), # type: ignore[arg-type] - allow_preview=True, transport=CapturingTransport(), ) as c: yield c @@ -97,9 +96,37 @@ def test_agent_telephony_request_protocol( expected_http_method: str, expected_path: str, ) -> None: - method = getattr(client.beta.voice_agents.telephony, method_name) + method = getattr(client.voice_agents.telephony, method_name) request = self._capture(self._make_fake_call(method)) assert ( request.method == expected_http_method ), f"{method_name}: expected HTTP method {expected_http_method!r}, got {request.method!r}" assert expected_path in request.url, f"{method_name}: expected path {expected_path!r} in URL {request.url!r}" + assert "Foundry-Features" not in request.headers + + @pytest.mark.parametrize("allow_preview", [False, True]) + @pytest.mark.parametrize("headers", [{}, {"foundry-features": "Custom=V1Preview", "x-test": "preserved"}]) + def test_conditional_preview_headers(self, allow_preview: bool, headers: dict) -> None: + with AIProjectClient( + endpoint=FAKE_ENDPOINT, + credential=FakeCredential(), + allow_preview=allow_preview, + transport=CapturingTransport(), + ) as client: + request = self._capture( + lambda: client.voice_agents.telephony.create_call_job( + "agent", {}, idempotency_key="test-key", headers=headers.copy() + ) + ) + expected = headers.get("foundry-features", "VoiceAgents=V1Preview" if allow_preview else None) + assert request.headers.get("Foundry-Features") == expected + if headers: + assert request.headers["x-test"] == "preserved" + + @pytest.mark.parametrize("operation_path", ["agents.create_from_prompt", "voice_agents.conversations.get"]) + def test_ga_voice_requests_without_preview(self, client: AIProjectClient, operation_path: str) -> None: + operation = client + for attribute in operation_path.split("."): + operation = getattr(operation, attribute) + request = self._capture(self._make_fake_call(operation)) + assert "Foundry-Features" not in request.headers diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol_async.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol_async.py index 325a4a34c512..5b54758c56a2 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol_async.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_agent_telephony_protocol_async.py @@ -46,7 +46,6 @@ def async_client() -> Iterator[AsyncAIProjectClient]: yield AsyncAIProjectClient( endpoint=FAKE_ENDPOINT, credential=AsyncFakeCredential(), # type: ignore[arg-type] - allow_preview=True, transport=CapturingAsyncTransport(), ) @@ -93,9 +92,39 @@ async def test_agent_telephony_request_protocol_async( expected_http_method: str, expected_path: str, ) -> None: - method = getattr(async_client.beta.voice_agents.telephony, method_name) + method = getattr(async_client.voice_agents.telephony, method_name) request = await self._capture(self._make_fake_call(method)) assert ( request.method == expected_http_method ), f"{method_name}: expected HTTP method {expected_http_method!r}, got {request.method!r}" assert expected_path in request.url, f"{method_name}: expected path {expected_path!r} in URL {request.url!r}" + assert "Foundry-Features" not in request.headers + + @pytest.mark.parametrize("allow_preview", [False, True]) + @pytest.mark.parametrize("headers", [{}, {"foundry-features": "Custom=V1Preview", "x-test": "preserved"}]) + async def test_conditional_preview_headers(self, allow_preview: bool, headers: dict) -> None: + async with AsyncAIProjectClient( + endpoint=FAKE_ENDPOINT, + credential=AsyncFakeCredential(), + allow_preview=allow_preview, + transport=CapturingAsyncTransport(), + ) as client: + request = await self._capture( + lambda: client.voice_agents.telephony.create_call_job( + "agent", {}, idempotency_key="test-key", headers=headers.copy() + ) + ) + expected = headers.get("foundry-features", "VoiceAgents=V1Preview" if allow_preview else None) + assert request.headers.get("Foundry-Features") == expected + if headers: + assert request.headers["x-test"] == "preserved" + + @pytest.mark.parametrize("operation_path", ["agents.create_from_prompt", "voice_agents.conversations.get"]) + async def test_ga_voice_requests_without_preview( + self, async_client: AsyncAIProjectClient, operation_path: str + ) -> None: + operation = async_client + for attribute in operation_path.split("."): + operation = getattr(operation, attribute) + request = await self._capture(self._make_fake_call(operation)) + assert "Foundry-Features" not in request.headers diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py index 60fb13a95280..eb2e5820bc40 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py @@ -225,7 +225,7 @@ def test_foundry_features_header_on_beta_operations( extra_kwargs: dict[str, Any] = {} self._assert_header(label, self._make_fake_call(method, extra_kwargs=extra_kwargs), expected_header_value) - @pytest.mark.parametrize("subclient_name", ["conversations", "telephony"]) + @pytest.mark.parametrize("subclient_name", ["live_conversations", "telephony"]) def test_foundry_features_header_on_voice_agent_subclients( self, client: AIProjectClient, subclient_name: str ) -> None: diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py index ec8e8b7a8ae3..1468617c903d 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py @@ -247,7 +247,7 @@ async def test_foundry_features_header_on_beta_operations_async( label, self._make_fake_call(method, extra_kwargs=extra_kwargs), expected_header_value ) - @pytest.mark.parametrize("subclient_name", ["conversations", "telephony"]) + @pytest.mark.parametrize("subclient_name", ["live_conversations", "telephony"]) @pytest.mark.asyncio async def test_foundry_features_header_on_voice_agent_subclients_async( self, async_client: AsyncAIProjectClient, subclient_name: str diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_live_async_samples.py b/sdk/ai/azure-ai-projects/tests/samples/test_live_async_samples.py index 7f0be5dc9664..21b2cdbc2a87 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_live_async_samples.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_live_async_samples.py @@ -58,7 +58,7 @@ def _assert_owned_cleanup(sample, environment): connection.session.close.assert_awaited_once_with() connection.session.start.assert_not_called() connection.response.cancel.assert_not_called() - client.beta.voice_agents.realtime.connect.assert_not_called() + client.voice_agents.realtime.connect.assert_not_called() client.beta.voice_agents.live.connect.return_value.__aexit__.assert_awaited_once() client.__aexit__.assert_awaited_once() credential = sample.DefaultAzureCredential.return_value diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_live_managed_agent_samples.py b/sdk/ai/azure-ai-projects/tests/samples/test_live_managed_agent_samples.py index 979183b9ba39..acc2333f27ec 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_live_managed_agent_samples.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_live_managed_agent_samples.py @@ -293,7 +293,7 @@ def _assert_no_client_delegation(environment): connection.session.start.assert_not_called() connection.session.update.assert_not_called() connection.send.assert_not_called() - environment.client.beta.voice_agents.realtime.connect.assert_not_called() + environment.client.voice_agents.realtime.connect.assert_not_called() @pytest.mark.asyncio diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_live_samples.py b/sdk/ai/azure-ai-projects/tests/samples/test_live_samples.py index 33cbd31635fe..f490a7783b53 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_live_samples.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_live_samples.py @@ -153,7 +153,7 @@ async def test_async_samples_delete_only_the_owned_version_on_failure(monkeypatc connection.session.close.assert_awaited_once() connection.session.start.assert_not_called() connection.response.cancel.assert_not_called() - client.beta.voice_agents.realtime.connect.assert_not_called() + client.voice_agents.realtime.connect.assert_not_called() client.beta.voice_agents.live.connect.return_value.__aexit__.assert_awaited_once() @@ -1140,7 +1140,7 @@ def test_live_rest_sample_downloads_to_user_temp_without_modifying_resources( operations.delete.assert_not_called() assert not rest_sample.client.agents.mock_calls rest_sample.client.beta.voice_agents.live.connect.assert_not_called() - rest_sample.client.beta.voice_agents.conversations.get.assert_not_called() + rest_sample.client.voice_agents.conversations.get.assert_not_called() rest_sample.output_factory.assert_called_once_with(prefix="voice-agent-live-") output_directory = rest_sample.directories[0] assert output_directory.parent == tmp_path @@ -1179,7 +1179,7 @@ def test_live_rest_sample_surfaces_service_failures_without_fallback_or_deletion assert caught.value is failure rest_sample.operations.delete.assert_not_called() - assert not rest_sample.client.beta.voice_agents.conversations.mock_calls + assert not rest_sample.client.voice_agents.conversations.mock_calls assert f"HTTP {status}" in capsys.readouterr().out rest_sample.output_factory.assert_not_called() rest_sample.client.__exit__.assert_called_once() @@ -1341,7 +1341,7 @@ async def test_microphone_mode_does_not_require_a_wav_and_preserves_live_lifecyc setup.client.agents.delete_version.assert_awaited_once() setup.connection.session.start.assert_not_called() setup.connection.response.cancel.assert_not_called() - setup.client.beta.voice_agents.realtime.connect.assert_not_called() + setup.client.voice_agents.realtime.connect.assert_not_called() assert "Speak now" in capsys.readouterr().out diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_realtime_samples.py b/sdk/ai/azure-ai-projects/tests/samples/test_realtime_samples.py index 573eb8e85965..442283c61d98 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_realtime_samples.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_realtime_samples.py @@ -179,7 +179,7 @@ def __init__(self, monkeypatch, filename): self.client = MagicMock() self.credential = MagicMock() self.connection = MagicMock() - self.manager = self.client.beta.voice_agents.realtime.connect.return_value + self.manager = self.client.voice_agents.realtime.connect.return_value mock_type = AsyncMock if self.is_async else MagicMock for resource in (self.client, self.credential): @@ -197,7 +197,7 @@ def __init__(self, monkeypatch, filename): if self.is_async: self.connection.__aiter__.side_effect = self._iterate - self.conversations = self.client.beta.voice_agents.conversations + self.conversations = self.client.voice_agents.conversations self.conversations.get = mock_type( return_value=SimpleNamespace(id=_CONVERSATION_ID, status="completed", created_at=0) ) @@ -322,7 +322,7 @@ def assert_cleanup(self, *, created=True, connected=True): ): assert operation.await_count == operation.call_count self.credential_factory.assert_called_once_with() - self.client_factory.assert_called_once_with(endpoint=_ENDPOINT, credential=self.credential, allow_preview=True) + self.client_factory.assert_called_once_with(endpoint=_ENDPOINT, credential=self.credential) @pytest.fixture(params=_TEXT_SAMPLES, ids=["async-text"]) @@ -391,7 +391,7 @@ async def test_text_entrypoint_drains_greeting_and_reuses_one_persisted_conversa assert actions.index(("item", items[1])) < actions.index(("receive", second_done)) assert connection.response.create.call_args_list == [call(), call()] connection.response.cancel.assert_not_called() - text_sample.client.beta.voice_agents.realtime.connect.assert_called_once_with(agent_name=_AGENT_NAME) + text_sample.client.voice_agents.realtime.connect.assert_called_once_with(agent_name=_AGENT_NAME) text_sample.assert_call(text_sample.conversations.get, _AGENT_NAME, _CONVERSATION_ID) text_sample.conversations.list_items.assert_called_once_with(_AGENT_NAME, _CONVERSATION_ID) definition = text_sample.client.agents.create_version.call_args.kwargs["definition"] @@ -489,7 +489,7 @@ async def test_entrypoint_failures_clean_up_only_resources_the_sample_owns(entry await harness.run() if phase == "create": - harness.client.beta.voice_agents.realtime.connect.assert_not_called() + harness.client.voice_agents.realtime.connect.assert_not_called() assert not harness.players harness.conversations.get.assert_not_called() harness.assert_cleanup(created=phase != "create", connected=phase == "receive") diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_voice_audio_sample.py b/sdk/ai/azure-ai-projects/tests/samples/test_voice_audio_sample.py index b31884239113..43161fd6b087 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_voice_audio_sample.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_voice_audio_sample.py @@ -107,7 +107,7 @@ async def test_audio_conversation_handles_output_events_and_barge_in_without_har client = MagicMock() connection = MagicMock() connection.response.cancel = AsyncMock() - manager = client.beta.voice_agents.realtime.connect.return_value + manager = client.voice_agents.realtime.connect.return_value manager.__aenter__.return_value = connection manager.__aexit__.return_value = False processor = sample["_AudioProcessor"](connection) @@ -163,7 +163,7 @@ async def test_audio_conversation_handles_output_events_and_barge_in_without_har conversation_id = await run_conversation(client, "agent-offline") assert conversation_id == "conversation-offline" - client.beta.voice_agents.realtime.connect.assert_called_once_with(agent_name="agent-offline") + client.voice_agents.realtime.connect.assert_called_once_with(agent_name="agent-offline") client.beta.voice_agents.live.connect.assert_not_called() connection.response.cancel.assert_awaited_once_with() processor.start_playback.assert_called_once_with() @@ -210,7 +210,7 @@ def test_read_conversation_handles_optional_response_id(monkeypatch, capsys, res monkeypatch.setattr("azure.identity.DefaultAzureCredential", MagicMock()) client = MagicMock() monkeypatch.setattr("azure.ai.projects.AIProjectClient", MagicMock(return_value=client)) - conversations = client.__enter__.return_value.beta.voice_agents.conversations + conversations = client.__enter__.return_value.voice_agents.conversations conversations.list_responses.return_value = [VoiceResponse(id=response_id, status="completed")] helper = ModuleType("voice_sample_util") setattr(helper, "hold_sample_conversation", MagicMock()) diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_voice_new_protocol_samples.py b/sdk/ai/azure-ai-projects/tests/samples/test_voice_new_protocol_samples.py index 6e2192128cf5..b569c90b2e08 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_voice_new_protocol_samples.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_voice_new_protocol_samples.py @@ -40,7 +40,7 @@ def websocket_sample(monkeypatch): client.__aexit__ = AsyncMock(return_value=False) client.agents.create_version = AsyncMock(return_value=SimpleNamespace(version="owned-version")) client.agents.delete_version = AsyncMock() - client.beta.voice_agents.conversations.delete = AsyncMock() + client.voice_agents.conversations.delete = AsyncMock() connection = MagicMock() connection.recv = AsyncMock( side_effect=[ @@ -60,7 +60,7 @@ def websocket_sample(monkeypatch): connection.response.cancel = AsyncMock() connection.conversation.item.create = AsyncMock() connection.conversation.item.truncate = AsyncMock() - manager = client.beta.voice_agents.realtime.connect.return_value + manager = client.voice_agents.realtime.connect.return_value manager.__aenter__ = AsyncMock(return_value=connection) manager.__aexit__ = AsyncMock(return_value=False) monkeypatch.setattr("azure.identity.aio.DefaultAzureCredential", MagicMock(return_value=credential)) @@ -78,9 +78,9 @@ async def test_async_interruption_confirms_control_events_and_cleans_owned_resou env.connection.conversation.item.truncate.assert_awaited_once_with( item_id="item-test", content_index=0, audio_end_ms=0 ) - env.client.beta.voice_agents.conversations.delete.assert_awaited_once_with(name, "conversation-test") + env.client.voice_agents.conversations.delete.assert_awaited_once_with(name, "conversation-test") env.client.agents.delete_version.assert_awaited_once_with(agent_name=name, agent_version="owned-version") - env.client.beta.voice_agents.conversations.download_generated_audio_item.assert_not_called() + env.client.voice_agents.conversations.download_generated_audio_item.assert_not_called() @pytest.mark.asyncio @@ -90,7 +90,7 @@ async def test_async_interruption_create_failure_cannot_delete_existing_resource with pytest.raises(RuntimeError, match="create failed"): await env.sample["main"]() env.client.agents.delete_version.assert_not_called() - env.client.beta.voice_agents.conversations.delete.assert_not_called() + env.client.voice_agents.conversations.delete.assert_not_called() @pytest.mark.asyncio @@ -103,7 +103,7 @@ async def test_async_interruption_stream_failure_still_cleans_its_owned_resource with pytest.raises(RuntimeError, match="synthetic failure"): await env.sample["main"]() name = env.client.agents.create_version.call_args.kwargs["agent_name"] - env.client.beta.voice_agents.conversations.delete.assert_awaited_once_with(name, "conversation-test") + env.client.voice_agents.conversations.delete.assert_awaited_once_with(name, "conversation-test") env.client.agents.delete_version.assert_awaited_once_with(agent_name=name, agent_version="owned-version") @@ -117,7 +117,7 @@ def rest_sample(monkeypatch): credential.__enter__.return_value = credential client = MagicMock() client.__enter__.return_value = client - conversations = client.beta.voice_agents.conversations + conversations = client.voice_agents.conversations conversations.get_generated_audio_item.return_value = models.VoiceGeneratedAudioItem( conversation_id="conversation-test", item_id="stored-item-test", format="wav" ) @@ -143,7 +143,7 @@ def test_sync_rest_sample_only_reads_existing_resources(rest_sample): ) env.client.agents.create_version.assert_not_called() env.conversations.delete.assert_not_called() - env.client.beta.voice_agents.realtime.connect.assert_not_called() + env.client.voice_agents.realtime.connect.assert_not_called() env.client.beta.voice_agents.live.connect.assert_not_called() diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml index 31db3982e069..620c46b1a457 100644 --- a/sdk/ai/azure-ai-projects/tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/ai-foundry/data-plane/Foundry/src/sdk-python-js-azure-ai-projects -commit: 3e2177ff982e0e0af47a19f1bed59187f9084929 +commit: 56d0a40aac679a336fce7fd8ba7dafbbac751374 repo: Azure/azure-rest-api-specs additionalDirectories: - specification/ai-foundry/data-plane/Foundry/src/agents