Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.ai.agents;

import com.azure.ai.agents.implementation.AgentEndpointConversationsImpl;
import com.azure.ai.agents.models.VoiceGeneratedItemAudioResponse;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
import com.azure.core.util.FluxUtil;
import reactor.core.publisher.Mono;

/**
* Initializes a new instance of the asynchronous AgentsClient type.
*/
@ServiceClient(builder = AgentsClientBuilder.class, isAsync = true)
public final class AgentEndpointConversationsAsyncClient {
@Generated
private final AgentEndpointConversationsImpl serviceClient;

/**
* Initializes an instance of AgentEndpointConversationsAsyncClient class.
*
* @param serviceClient the service client implementation.
*/
@Generated
AgentEndpointConversationsAsyncClient(AgentEndpointConversationsImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* Get a voice agent conversation item's generated audio metadata
*
* Returns metadata for a conversation item's generated audio. This subordinate artifact is separate from the
* canonical heard-audio segment and exists only when playback was interrupted and the service rendered more audio
* than the listener heard, including when the response ends as cancelled. Returns `404` when the conversation or
* item was not persisted, or when no generated audio exists beyond the heard segment.
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* {
* conversation_id: String (Required)
* item_id: String (Required)
* role: String(user/agent) (Optional)
* format: String(wav) (Optional)
* codec: String(pcm16/pcmu/pcma) (Optional)
* sample_rate: Integer (Optional)
* channels: Integer (Optional)
* start_offset_ms: Long (Optional)
* duration_ms: Long (Optional)
* blob_uri: String (Optional)
* }
* }
* </pre>
*
* @param agentName The name of the agent.
* @param conversationId The id of the conversation that contains the item.
* @param itemId The id of the conversation item whose generated audio metadata is retrieved.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return a voice agent conversation item's generated audio metadata
*
* Returns metadata for a conversation item's generated audio along with {@link Response} on successful completion
* of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> getAgentConversationItemGeneratedAudioWithResponse(String agentName,
String conversationId, String itemId, RequestOptions requestOptions) {
return this.serviceClient.getAgentConversationItemGeneratedAudioWithResponseAsync(agentName, conversationId,
itemId, requestOptions);
}

/**
* Stream a voice agent conversation item's generated audio
*
* Streams a conversation item's generated audio as a WAV (`audio/wav`) byte stream through the service. This
* subordinate artifact exists only when playback was interrupted and the service rendered more audio than the
* listener heard, including when the response ends as cancelled. This route serves Foundry-managed storage only.
* For bring-your-own-storage (BYOS) recordings the bytes are not proxied, so this route returns `409 Conflict`.
* Returns `404` when the conversation or item was not persisted, or when no generated audio exists beyond the
* heard segment.
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* BinaryData
* }
* </pre>
*
* @param agentName The name of the agent.
* @param conversationId The id of the conversation that contains the item.
* @param itemId The id of the conversation item whose generated audio is streamed.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> getAgentConversationItemGeneratedAudioContentWithResponse(String agentName,
String conversationId, String itemId, RequestOptions requestOptions) {
return this.serviceClient.getAgentConversationItemGeneratedAudioContentWithResponseAsync(agentName,
conversationId, itemId, requestOptions);
}

/**
* Get a voice agent conversation item's generated audio metadata
*
* Returns metadata for a conversation item's generated audio. This subordinate artifact is separate from the
* canonical heard-audio segment and exists only when playback was interrupted and the service rendered more audio
* than the listener heard, including when the response ends as cancelled. Returns `404` when the conversation or
* item was not persisted, or when no generated audio exists beyond the heard segment.
*
* @param agentName The name of the agent.
* @param conversationId The id of the conversation that contains the item.
* @param itemId The id of the conversation item whose generated audio metadata is retrieved.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a voice agent conversation item's generated audio metadata
*
* Returns metadata for a conversation item's generated audio on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VoiceGeneratedItemAudioResponse> getAgentConversationItemGeneratedAudio(String agentName,
String conversationId, String itemId) {
// Generated convenience method for getAgentConversationItemGeneratedAudioWithResponse
RequestOptions requestOptions = new RequestOptions();
return getAgentConversationItemGeneratedAudioWithResponse(agentName, conversationId, itemId, requestOptions)
.flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(VoiceGeneratedItemAudioResponse.class));
}

/**
* Stream a voice agent conversation item's generated audio
*
* Streams a conversation item's generated audio as a WAV (`audio/wav`) byte stream through the service. This
* subordinate artifact exists only when playback was interrupted and the service rendered more audio than the
* listener heard, including when the response ends as cancelled. This route serves Foundry-managed storage only.
* For bring-your-own-storage (BYOS) recordings the bytes are not proxied, so this route returns `409 Conflict`.
* Returns `404` when the conversation or item was not persisted, or when no generated audio exists beyond the
* heard segment.
*
* @param agentName The name of the agent.
* @param conversationId The id of the conversation that contains the item.
* @param itemId The id of the conversation item whose generated audio is streamed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<BinaryData> getAgentConversationItemGeneratedAudioContent(String agentName, String conversationId,
String itemId) {
// Generated convenience method for getAgentConversationItemGeneratedAudioContentWithResponse
RequestOptions requestOptions = new RequestOptions();
return getAgentConversationItemGeneratedAudioContentWithResponse(agentName, conversationId, itemId,
requestOptions).flatMap(FluxUtil::toMono);
}
}
Loading