diff --git a/sdk/voicelive/azure-ai-voicelive/CHANGELOG.md b/sdk/voicelive/azure-ai-voicelive/CHANGELOG.md
index 4bc0a844d528..c84ddb474ffc 100644
--- a/sdk/voicelive/azure-ai-voicelive/CHANGELOG.md
+++ b/sdk/voicelive/azure-ai-voicelive/CHANGELOG.md
@@ -1,9 +1,38 @@
# Release History
-## 1.0.0 (Unreleased)
+## 1.0.0 (2026-05-25)
This is the first General Availability (GA) release of the Azure VoiceLive client library for Java.
+### Breaking Changes
+
+- Narrowed `VoiceLiveAsyncClient` session startup to three overloads:
+ - `startSession()`
+ - `startSession(String, VoiceLiveRequestOptions)`
+ - `startSession(AgentSessionConfig, VoiceLiveRequestOptions)`
+- Renamed token-count accessors on token statistic models (JSON wire format unchanged):
+ - `CachedTokenDetails.getTextTokens()` / `getAudioTokens()` / `getImageTokens()` → `getTextTokenCount()` / `getAudioTokenCount()` / `getImageTokenCount()`
+ - `InputTokenDetails.getCachedTokens()` / `getTextTokens()` / `getAudioTokens()` / `getImageTokens()` → `getCachedTokenCount()` / `getTextTokenCount()` / `getAudioTokenCount()` / `getImageTokenCount()`
+ - `OutputTokenDetails.getTextTokens()` / `getAudioTokens()` / `getReasoningTokens()` → `getTextTokenCount()` / `getAudioTokenCount()` / `getReasoningTokenCount()`
+ - `ResponseTokenStatistics.getTotalTokens()` / `getInputTokens()` / `getOutputTokens()` → `getTotalTokenCount()` / `getInputTokenCount()` / `getOutputTokenCount()`
+- `RequestImageContentPart` URL accessor renamed and JSON field changed:
+ - `getUrl()` / `setUrl(String)` → `getImageUrl()` / `setImageUrl(String)`
+ - JSON property `url` → `image_url`
+- Renamed base event types for client↔server symmetry:
+ - `ClientEvent` (base for outbound events) → `SessionClientEvent`
+ - `SessionUpdate` (base for inbound events) → `SessionServerEvent`
+ - `VoiceLiveSessionAsyncClient.receiveEvents()` now returns `Flux This method configures the session to connect directly to an Azure AI Foundry agent,
- * combining the agent configuration with additional custom options.
- * Users can obtain a VoiceLiveSessionAsyncClient instance from {@link VoiceLiveAsyncClient#startSession(String)} and work directly with it for optimal performance. + * Users can obtain a VoiceLiveSessionAsyncClient instance from {@link VoiceLiveAsyncClient#startSession()}, + * {@link VoiceLiveAsyncClient#startSession(String, com.azure.ai.voicelive.models.VoiceLiveRequestOptions)}, or + * {@link VoiceLiveAsyncClient#startSession(com.azure.ai.voicelive.models.AgentSessionConfig, + * com.azure.ai.voicelive.models.VoiceLiveRequestOptions)} and work directly with it for optimal performance. * Alternatively, users can use the convenience methods on {@link VoiceLiveAsyncClient} which delegate to * the internal session. *
@@ -110,7 +114,7 @@ public final class VoiceLiveSessionAsyncClient implements AsyncCloseable, AutoCl private final Sinks.Many* This method provides a higher-level alternative to {@link #receive()} by automatically - * parsing the raw BinaryData into the appropriate SessionUpdate subclass based on the + * parsing the raw BinaryData into the appropriate SessionServerEvent subclass based on the * event type. This enables type-safe event handling and better developer experience. *
*
@@ -418,11 +422,11 @@ public Mono
* The generated code now uses JsonReaderHelper to avoid bufferObject() issues. - * This method simply delegates to SessionUpdate.fromJson() for polymorphic deserialization. + * This method simply delegates to SessionServerEvent.fromJson() for polymorphic deserialization. *
* * @param data The raw binary data from the service. - * @return A Mono containing the parsed SessionUpdate, or empty if parsing fails. + * @return A Mono containing the parsed SessionServerEvent, or empty if parsing fails. */ - private Mono+ * To append a raw byte array, wrap it with {@link BinaryData#fromBytes(byte[])}. + *
* * @param turnId The ID of the turn this audio is part of. * @param audio The audio data to append. * @return A Mono that completes when the audio is appended. * @throws IllegalArgumentException if turnId is null or empty, or audio is null. */ - public Mono+ * This method only sends the retrieval request; the requested item is delivered + * asynchronously by the service as a server event on the {@link #receiveEvents()} stream. + * Subscribe to {@link #receiveEvents()} to observe the response. + *
* * @param itemId The ID of the item to retrieve. * @return A Mono that completes when the retrieval request is sent. @@ -734,18 +725,26 @@ public MonoReactor pattern used by this sample:
*{@code
- * client.startSession(model)
+ * client.startSession(model, null)
* .flatMap(session -> session.sendEvent(sessionUpdate).thenReturn(session))
* .flatMap(session -> session.sendEvent(conversationItemCreate).thenReturn(session))
* .flatMap(session -> session.sendEvent(responseCreate).thenReturn(session))
@@ -117,7 +117,8 @@ public static void main(String[] args) {
final CountDownLatch completionLatch = new CountDownLatch(1);
// Open a WebSocket session against the realtime model.
- client.startSession("gpt-realtime")
+ // Pass null when no VoiceLiveRequestOptions value is needed.
+ client.startSession("gpt-realtime", null)
// Configure the session (text-only modality, instructions).
.flatMap(session -> {
ClientEventSessionUpdate updateEvent = new ClientEventSessionUpdate(sessionOptions);
@@ -160,7 +161,7 @@ public static void main(String[] args) {
* Handle incoming server events: print text deltas as they stream, and release the latch when
* the response is complete or an error occurs.
*/
- private static void handleEvent(SessionUpdate event, CountDownLatch completionLatch) {
+ private static void handleEvent(SessionServerEvent event, CountDownLatch completionLatch) {
ServerEventType eventType = event.getType();
if (eventType == ServerEventType.SESSION_CREATED) {
diff --git a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/FunctionCallingSample.java b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/FunctionCallingSample.java
index 67c23b671cc5..4d02fb4c4125 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/FunctionCallingSample.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/FunctionCallingSample.java
@@ -16,15 +16,14 @@
import com.azure.ai.voicelive.models.InputAudioFormat;
import com.azure.ai.voicelive.models.InteractionModality;
import com.azure.ai.voicelive.models.ItemType;
-import com.azure.ai.voicelive.models.OpenAIVoice;
-import com.azure.ai.voicelive.models.OpenAIVoiceName;
import com.azure.ai.voicelive.models.OutputAudioFormat;
import com.azure.ai.voicelive.models.ResponseFunctionCallItem;
+import com.azure.ai.voicelive.models.AzureStandardVoice;
import com.azure.ai.voicelive.models.SessionUpdateConversationItemCreated;
import com.azure.ai.voicelive.models.SessionUpdateResponseFunctionCallArgumentsDone;
import com.azure.ai.voicelive.models.ServerEventType;
import com.azure.ai.voicelive.models.ServerVadTurnDetection;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import com.azure.ai.voicelive.models.SessionUpdateResponseAudioDelta;
import com.azure.ai.voicelive.models.SessionUpdateSessionUpdated;
import com.azure.ai.voicelive.models.VoiceLiveSessionOptions;
@@ -165,7 +164,7 @@ private static void runFunctionCallingSession(VoiceLiveAsyncClient client) throw
// Start session. Session lifetime is local to this reactive chain — the session is
// captured by the lambda passed to flatMapMany and then threaded into per-event handling
// via flatMap, so no instance field or shared holder is needed.
- client.startSession(DEFAULT_MODEL)
+ client.startSession(DEFAULT_MODEL, null)
.flatMapMany(session -> {
System.out.println("✓ Session started successfully");
audioProcessorRef.set(new AudioProcessor(session));
@@ -231,7 +230,7 @@ private static ClientEventSessionUpdate createSessionConfigWithFunctions() {
+ "When asked about weather, use the get_current_weather function. "
+ "Acknowledge when you're calling a function and present the results naturally in your response."
)
- .setVoice(BinaryData.fromObject(new OpenAIVoice(OpenAIVoiceName.ALLOY)))
+ .setVoice(BinaryData.fromObject(new AzureStandardVoice("en-US-AvaNeural")))
.setModalities(Arrays.asList(InteractionModality.TEXT, InteractionModality.AUDIO))
.setInputAudioFormat(InputAudioFormat.PCM16)
.setOutputAudioFormat(OutputAudioFormat.PCM16)
@@ -247,7 +246,7 @@ private static ClientEventSessionUpdate createSessionConfigWithFunctions() {
.setCreateResponse(true))
.setTools(functionTools)
.setInputAudioTranscription(
- new AudioInputTranscriptionOptions(AudioInputTranscriptionOptionsModel.WHISPER_1)
+ new AudioInputTranscriptionOptions(AudioInputTranscriptionOptionsModel.WHISPER_1).setLanguage("en")
);
return new ClientEventSessionUpdate(sessionOptions);
@@ -302,7 +301,7 @@ private static VoiceLiveFunctionDefinition createGetCurrentWeatherFunction() {
*/
private static Mono handleServerEvent(
VoiceLiveSessionAsyncClient session,
- SessionUpdate event,
+ SessionServerEvent event,
AudioProcessor audioProcessor,
Map pendingFunctionCalls
) {
@@ -503,11 +502,15 @@ void startCapture() {
int bytesRead = microphone.read(buffer, 0, buffer.length);
if (bytesRead > 0) {
byte[] audioData = Arrays.copyOf(buffer, bytesRead);
- session.sendInputAudio(BinaryData.fromBytes(audioData))
- .subscribe(
- noValueEmitted -> { /* sendInputAudio returns Mono; no onNext values are ever emitted */ },
- error -> System.err.println("Error sending audio: " + error.getMessage())
- );
+ // Block on this capture thread so sends are serialized; fire-and-forget
+ // subscribes can flood the WebSocket send sink and trigger FAIL_OVERFLOW.
+ try {
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block();
+ } catch (Exception sendError) {
+ if (isCapturing.get()) {
+ System.err.println("Error sending audio: " + sendError.getMessage());
+ }
+ }
}
} catch (Exception e) {
if (isCapturing.get()) {
diff --git a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MCPSample.java b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/McpSample.java
similarity index 91%
rename from sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MCPSample.java
rename to sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/McpSample.java
index 8d47ddff21f9..d628045c5b51 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MCPSample.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/McpSample.java
@@ -8,13 +8,12 @@
import com.azure.ai.voicelive.models.ClientEventSessionUpdate;
import com.azure.ai.voicelive.models.InteractionModality;
import com.azure.ai.voicelive.models.ItemType;
-import com.azure.ai.voicelive.models.MCPApprovalResponseRequestItem;
-import com.azure.ai.voicelive.models.MCPApprovalType;
-import com.azure.ai.voicelive.models.MCPServer;
-import com.azure.ai.voicelive.models.OpenAIVoice;
-import com.azure.ai.voicelive.models.OpenAIVoiceName;
-import com.azure.ai.voicelive.models.ResponseMCPApprovalRequestItem;
-import com.azure.ai.voicelive.models.ResponseMCPCallItem;
+import com.azure.ai.voicelive.models.McpApprovalResponseRequestItem;
+import com.azure.ai.voicelive.models.McpApprovalType;
+import com.azure.ai.voicelive.models.McpServer;
+import com.azure.ai.voicelive.models.AzureStandardVoice;
+import com.azure.ai.voicelive.models.ResponseMcpApprovalRequestItem;
+import com.azure.ai.voicelive.models.ResponseMcpCallItem;
import com.azure.ai.voicelive.models.ServerEventResponseMcpCallArgumentsDone;
import com.azure.ai.voicelive.models.ServerEventResponseMcpCallCompleted;
import com.azure.ai.voicelive.models.SessionUpdateConversationItemCreated;
@@ -22,7 +21,7 @@
import com.azure.ai.voicelive.models.SessionUpdateResponseOutputItemDone;
import com.azure.ai.voicelive.models.ServerEventType;
import com.azure.ai.voicelive.models.SessionResponseItem;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import com.azure.ai.voicelive.models.SessionUpdateSessionUpdated;
import com.azure.ai.voicelive.models.VoiceLiveSessionOptions;
import com.azure.ai.voicelive.models.VoiceLiveToolDefinition;
@@ -80,7 +79,7 @@
*
* How to Run:
* {@code
- * mvn exec:java -Dexec.mainClass="com.azure.ai.voicelive.MCPSample" -Dexec.classpathScope=test
+ * mvn exec:java -Dexec.mainClass="com.azure.ai.voicelive.McpSample" -Dexec.classpathScope=test
* }
*
* Try asking:
@@ -89,7 +88,7 @@
* "Can you summarize Azure docs about VoiceLive?"
*
*/
-public final class MCPSample {
+public final class McpSample {
// Service configuration
private static final String DEFAULT_MODEL = "gpt-realtime";
@@ -101,7 +100,7 @@ public final class MCPSample {
private static final int SAMPLE_SIZE_BITS = 16;
private static final int CHUNK_SIZE = 1200;
- private MCPSample() {
+ private McpSample() {
}
/**
@@ -120,7 +119,7 @@ public static void main(String[] args) {
}
try {
- runMCPSample(endpoint);
+ runMcpSample(endpoint);
} catch (Exception e) {
System.err.println("❌ Error: " + e.getMessage());
e.printStackTrace();
@@ -131,7 +130,7 @@ public static void main(String[] args) {
/**
* Run the MCP sample.
*/
- private static void runMCPSample(String endpoint) {
+ private static void runMcpSample(String endpoint) {
System.out.println("🔌 Connecting to VoiceLive API with MCP support...");
System.out.println("📡 Endpoint: " + endpoint);
System.out.println("🤖 Model: " + DEFAULT_MODEL);
@@ -146,14 +145,14 @@ private static void runMCPSample(String endpoint) {
// Create the VoiceLive client using DefaultAzureCredential (Entra ID).
VoiceLiveAsyncClient client = new VoiceLiveClientBuilder()
.endpoint(endpoint)
- .serviceVersion(VoiceLiveServiceVersion.V2026_01_01_PREVIEW)
+ .serviceVersion(VoiceLiveServiceVersion.V2026_04_10)
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
// Start the session. Session lifetime is local to this reactive chain — the session is
// captured by the lambda passed to flatMapMany and then threaded into per-event handling
// via flatMap, so no instance field or shared holder is needed.
- client.startSession(DEFAULT_MODEL)
+ client.startSession(DEFAULT_MODEL, null)
.flatMapMany(session -> {
System.out.println("✓ Session started successfully");
audioProcessorRef.set(new AudioProcessor(session));
@@ -208,13 +207,13 @@ private static ClientEventSessionUpdate createSessionConfigWithMCPTools() {
// Define MCP servers as tools
List mcpTools = Arrays.asList(
// DeepWiki MCP server - no approval required
- new MCPServer("deepwiki", "https://mcp.deepwiki.com/mcp")
+ new McpServer("deepwiki", "https://mcp.deepwiki.com/mcp")
.setAllowedTools(Arrays.asList("read_wiki_structure", "ask_question"))
- .setRequireApproval(BinaryData.fromObject(MCPApprovalType.NEVER)),
+ .setRequireApproval(BinaryData.fromObject(McpApprovalType.NEVER)),
// Azure documentation MCP server - approval always required
- new MCPServer("azure_doc", "https://learn.microsoft.com/api/mcp")
- .setRequireApproval(BinaryData.fromObject(MCPApprovalType.ALWAYS))
+ new McpServer("azure_doc", "https://learn.microsoft.com/api/mcp")
+ .setRequireApproval(BinaryData.fromObject(McpApprovalType.ALWAYS))
);
// Create session options
@@ -224,7 +223,7 @@ private static ClientEventSessionUpdate createSessionConfigWithMCPTools() {
+ "You can use MCP tools to search for information when needed. "
+ "When calling MCP tools, explain what you're doing and present the results naturally."
)
- .setVoice(BinaryData.fromObject(new OpenAIVoice(OpenAIVoiceName.ALLOY)))
+ .setVoice(BinaryData.fromObject(new AzureStandardVoice("en-US-AvaNeural")))
.setModalities(Arrays.asList(InteractionModality.TEXT, InteractionModality.AUDIO))
.setInputAudioFormat(InputAudioFormat.PCM16)
.setOutputAudioFormat(OutputAudioFormat.PCM16)
@@ -239,7 +238,7 @@ private static ClientEventSessionUpdate createSessionConfigWithMCPTools() {
.setCreateResponse(true))
.setTools(mcpTools)
.setInputAudioTranscription(
- new AudioInputTranscriptionOptions(AudioInputTranscriptionOptionsModel.WHISPER_1)
+ new AudioInputTranscriptionOptions(AudioInputTranscriptionOptionsModel.WHISPER_1).setLanguage("en")
);
return new ClientEventSessionUpdate(sessionOptions);
@@ -252,7 +251,7 @@ private static ClientEventSessionUpdate createSessionConfigWithMCPTools() {
*/
private static Mono handleServerEvent(
VoiceLiveSessionAsyncClient session,
- SessionUpdate event,
+ SessionServerEvent event,
AtomicReference activeMCPCallId,
AudioProcessor audioProcessor
) {
@@ -326,7 +325,7 @@ private static Mono handleServerEvent(
private static void handleOutputItemDone(SessionUpdateResponseOutputItemDone event) {
SessionResponseItem item = event.getItem();
if (item != null && item.getType() == ItemType.MCP_CALL) {
- ResponseMCPCallItem mcpCallItem = (ResponseMCPCallItem) item;
+ ResponseMcpCallItem mcpCallItem = (ResponseMcpCallItem) item;
String output = mcpCallItem.getOutput();
if (output != null && !output.isEmpty()) {
@@ -364,7 +363,7 @@ private static Mono handleConversationItemCreated(
System.out.println("📋 MCP list tools requested: id=" + itemCreated.getItem().getId());
} else if (itemType == ItemType.MCP_CALL) {
- ResponseMCPCallItem mcpCallItem = (ResponseMCPCallItem) itemCreated.getItem();
+ ResponseMcpCallItem mcpCallItem = (ResponseMcpCallItem) itemCreated.getItem();
String callId = mcpCallItem.getId();
activeMCPCallId.set(callId);
@@ -374,7 +373,7 @@ private static Mono handleConversationItemCreated(
System.out.println(" Call ID: " + callId);
} else if (itemType == ItemType.MCP_APPROVAL_REQUEST) {
- return handleMCPApprovalRequest(session, (ResponseMCPApprovalRequestItem) itemCreated.getItem());
+ return handleMCPApprovalRequest(session, (ResponseMcpApprovalRequestItem) itemCreated.getItem());
}
return Mono.empty();
@@ -385,7 +384,7 @@ private static Mono handleConversationItemCreated(
*/
private static Mono handleMCPApprovalRequest(
VoiceLiveSessionAsyncClient session,
- ResponseMCPApprovalRequestItem approvalItem
+ ResponseMcpApprovalRequestItem approvalItem
) {
String approvalId = approvalItem.getId();
String serverLabel = approvalItem.getServerLabel();
@@ -402,8 +401,8 @@ private static Mono handleMCPApprovalRequest(
// Get user approval
boolean approved = getUserApproval();
- MCPApprovalResponseRequestItem approvalResponse =
- new MCPApprovalResponseRequestItem(approvalId, approved);
+ McpApprovalResponseRequestItem approvalResponse =
+ new McpApprovalResponseRequestItem(approvalId, approved);
return session.sendEvent(new ClientEventConversationItemCreate().setItem(approvalResponse));
}
@@ -506,13 +505,16 @@ void startCapture() {
int bytesRead = microphone.read(buffer, 0, buffer.length);
if (bytesRead > 0) {
byte[] audioData = Arrays.copyOf(buffer, bytesRead);
- // sendInputAudio returns a cold Mono - it must be subscribed
- // for the audio to actually be sent over the WebSocket.
- session.sendInputAudio(BinaryData.fromBytes(audioData))
- .subscribe(
- noValueEmitted -> { /* sendInputAudio returns Mono; no onNext values are ever emitted */ },
- error -> System.err.println("Error sending audio: " + error.getMessage())
- );
+ // sendInputAudio returns a cold Mono. Block on this capture thread so
+ // sends are serialized; otherwise fire-and-forget subscribes can flood
+ // the WebSocket send sink and trigger FAIL_OVERFLOW.
+ try {
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block();
+ } catch (Exception sendError) {
+ if (isCapturing.get()) {
+ System.err.println("Error sending audio: " + sendError.getMessage());
+ }
+ }
}
} catch (Exception e) {
if (isCapturing.get()) {
diff --git a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MicrophoneInputSample.java b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MicrophoneInputSample.java
index e383783b08bf..8d57511c2279 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MicrophoneInputSample.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MicrophoneInputSample.java
@@ -12,7 +12,7 @@
import com.azure.ai.voicelive.models.ResponseTextContentPart;
import com.azure.ai.voicelive.models.ServerEventType;
import com.azure.ai.voicelive.models.SessionResponseMessageItem;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import com.azure.ai.voicelive.models.SessionUpdateResponseDone;
import com.azure.ai.voicelive.models.VoiceLiveSessionOptions;
import com.azure.core.util.BinaryData;
@@ -125,7 +125,7 @@ public static void main(String[] args) {
// Start session. Session lifetime is local to this reactive chain; the session
// instance is captured only inside the flatMapMany lambda.
- client.startSession("gpt-realtime")
+ client.startSession("gpt-realtime", null)
.flatMapMany(session -> {
System.out.println("✓ Session started");
AudioProcessor audioProcessor = new AudioProcessor(session);
@@ -187,7 +187,7 @@ private static boolean checkMicrophoneAvailable() {
*
* @param event The server event
*/
- private static void handleEvent(SessionUpdate event) {
+ private static void handleEvent(SessionServerEvent event) {
ServerEventType eventType = event.getType();
if (eventType == ServerEventType.SESSION_CREATED) {
diff --git a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/ReadmeSamples.java b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/ReadmeSamples.java
index 9664b857b379..44bee3a9fbad 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/ReadmeSamples.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/ReadmeSamples.java
@@ -14,11 +14,11 @@
import com.azure.ai.voicelive.models.ClientEventResponseCreate;
import com.azure.ai.voicelive.models.FunctionCallOutputItem;
import com.azure.ai.voicelive.models.ItemType;
-import com.azure.ai.voicelive.models.MCPApprovalResponseRequestItem;
-import com.azure.ai.voicelive.models.MCPApprovalType;
-import com.azure.ai.voicelive.models.MCPServer;
+import com.azure.ai.voicelive.models.McpApprovalResponseRequestItem;
+import com.azure.ai.voicelive.models.McpApprovalType;
+import com.azure.ai.voicelive.models.McpServer;
import com.azure.ai.voicelive.models.ResponseFunctionCallItem;
-import com.azure.ai.voicelive.models.ResponseMCPApprovalRequestItem;
+import com.azure.ai.voicelive.models.ResponseMcpApprovalRequestItem;
import com.azure.ai.voicelive.models.SessionResponseItem;
import com.azure.ai.voicelive.models.SessionUpdateConversationItemCreated;
import com.azure.ai.voicelive.models.VoiceLiveFunctionDefinition;
@@ -33,7 +33,7 @@
import com.azure.ai.voicelive.models.PersonalVoiceModels;
import com.azure.ai.voicelive.models.ServerEventType;
import com.azure.ai.voicelive.models.ServerVadTurnDetection;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import com.azure.ai.voicelive.models.SessionUpdateError;
import com.azure.ai.voicelive.models.SessionUpdateResponseAudioDelta;
import com.azure.ai.voicelive.models.SessionUpdateResponseOutputItemDone;
@@ -99,8 +99,8 @@ public void readmeSamples() {
.setInputAudioTranscription(transcriptionOptions)
.setTurnDetection(turnDetection);
- // Start session and handle events
- client.startSession("gpt-realtime")
+ // Start session (null VoiceLiveRequestOptions), then handle events
+ client.startSession("gpt-realtime", null)
.flatMap(session -> {
// Send session configuration, then listen for events.
ClientEventSessionUpdate updateEvent = new ClientEventSessionUpdate(sessionOptions);
@@ -162,8 +162,8 @@ public void simpleSession() {
.buildAsyncClient();
// BEGIN: com.azure.ai.voicelive.simple.session
- // Start session with default options
- client.startSession("gpt-realtime")
+ // Start session with a specific model; pass null when no VoiceLiveRequestOptions value is needed
+ client.startSession("gpt-realtime", null)
.flatMap(session -> {
System.out.println("Session started");
@@ -213,8 +213,8 @@ public void configureSessionOptions() {
.setInputAudioTranscription(transcription)
.setTurnDetection(turnDetection);
- // Start session with options
- client.startSession("gpt-realtime")
+ // Start session and then send session configuration
+ client.startSession("gpt-realtime", null)
.flatMap(session -> {
// Send session configuration
ClientEventSessionUpdate updateEvent = new ClientEventSessionUpdate(options);
@@ -236,7 +236,7 @@ public void sendAudioInput() throws IOException {
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
- VoiceLiveSessionAsyncClient session = client.startSession("gpt-realtime").block();
+ VoiceLiveSessionAsyncClient session = client.startSession("gpt-realtime", null).block();
// BEGIN: com.azure.ai.voicelive.send.audioinput
// Send audio chunk
@@ -265,7 +265,7 @@ public void handleEventTypes() {
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
- VoiceLiveSessionAsyncClient session = client.startSession("gpt-realtime").block();
+ VoiceLiveSessionAsyncClient session = client.startSession("gpt-realtime", null).block();
// BEGIN: com.azure.ai.voicelive.handle.eventtypes
session.receiveEvents()
@@ -362,7 +362,7 @@ public void functionCalling() {
.setInstructions("You have access to weather information. Use get_current_weather when asked about weather.");
// 3. Handle function call events
- client.startSession("gpt-realtime")
+ client.startSession("gpt-realtime", null)
.flatMap(session -> {
return session.receiveEvents()
.doOnNext(event -> {
@@ -424,12 +424,12 @@ public void mcpToolIntegration() {
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
- VoiceLiveSessionAsyncClient session = client.startSession("gpt-realtime").block();
+ VoiceLiveSessionAsyncClient session = client.startSession("gpt-realtime", null).block();
// BEGIN: com.azure.ai.voicelive.mcp
// Configure MCP servers as tools
- MCPServer mcpServer = new MCPServer("deepwiki", "https://mcp.deepwiki.com/mcp")
- .setRequireApproval(BinaryData.fromObject(MCPApprovalType.ALWAYS));
+ McpServer mcpServer = new McpServer("deepwiki", "https://mcp.deepwiki.com/mcp")
+ .setRequireApproval(BinaryData.fromObject(McpApprovalType.ALWAYS));
VoiceLiveSessionOptions options = new VoiceLiveSessionOptions()
.setTools(Arrays.asList(mcpServer))
@@ -442,10 +442,10 @@ public void mcpToolIntegration() {
SessionUpdateResponseOutputItemDone itemDone = (SessionUpdateResponseOutputItemDone) event;
SessionResponseItem item = itemDone.getItem();
- if (item instanceof ResponseMCPApprovalRequestItem) {
+ if (item instanceof ResponseMcpApprovalRequestItem) {
// Approve the tool call
- ResponseMCPApprovalRequestItem approvalRequest = (ResponseMCPApprovalRequestItem) item;
- MCPApprovalResponseRequestItem approval = new MCPApprovalResponseRequestItem(
+ ResponseMcpApprovalRequestItem approvalRequest = (ResponseMcpApprovalRequestItem) item;
+ McpApprovalResponseRequestItem approval = new McpApprovalResponseRequestItem(
approvalRequest.getId(), true);
ClientEventConversationItemCreate createItem = new ClientEventConversationItemCreate()
.setItem(approval);
@@ -469,13 +469,13 @@ public void agentSession() {
AgentSessionConfig agentConfig = new AgentSessionConfig("my-agent", "my-project")
.setAgentVersion("1.0");
- // Start session with agent config (uses DefaultAzureCredential)
+ // Start session with agent config; pass null when no VoiceLiveRequestOptions value is needed
VoiceLiveAsyncClient client = new VoiceLiveClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
- client.startSession(agentConfig)
+ client.startSession(agentConfig, null)
.flatMap(session -> {
return session.receiveEvents()
.doOnNext(event -> handleEvent(event))
@@ -504,7 +504,7 @@ private void playAudioChunk(byte[] delta) {
// Implementation for playing audio
}
- private void handleEvent(SessionUpdate event) {
+ private void handleEvent(SessionServerEvent event) {
// Implementation for handling events
}
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/VoiceAssistantSample.java b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/VoiceAssistantSample.java
index a9fb90803d8d..315df9ca0668 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/VoiceAssistantSample.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/VoiceAssistantSample.java
@@ -8,15 +8,14 @@
import com.azure.ai.voicelive.models.AudioInputTranscriptionOptionsModel;
import com.azure.ai.voicelive.models.AudioNoiseReduction;
import com.azure.ai.voicelive.models.AudioNoiseReductionType;
+import com.azure.ai.voicelive.models.AzureStandardVoice;
import com.azure.ai.voicelive.models.ClientEventSessionUpdate;
import com.azure.ai.voicelive.models.InputAudioFormat;
import com.azure.ai.voicelive.models.InteractionModality;
-import com.azure.ai.voicelive.models.OpenAIVoice;
-import com.azure.ai.voicelive.models.OpenAIVoiceName;
import com.azure.ai.voicelive.models.OutputAudioFormat;
import com.azure.ai.voicelive.models.ServerEventType;
import com.azure.ai.voicelive.models.ServerVadTurnDetection;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import com.azure.ai.voicelive.models.SessionUpdateError;
import com.azure.ai.voicelive.models.SessionUpdateResponseAudioDelta;
import com.azure.ai.voicelive.models.SessionUpdateSessionUpdated;
@@ -247,17 +246,16 @@ private void captureAudioLoop() {
// Send audio to VoiceLive service
byte[] audioChunk = Arrays.copyOf(buffer, bytesRead);
- // Send audio asynchronously using the session's audio buffer append
- session.sendInputAudio(BinaryData.fromBytes(audioChunk))
- .subscribe(
- noValueEmitted -> { /* sendInputAudio returns Mono; no onNext values are ever emitted */ }, // onNext
- error -> {
- // Only log non-interruption errors
- if (!error.getMessage().contains("cancelled")) {
- System.err.println("❌ Error sending audio: " + error.getMessage());
- }
- }
- );
+ // Block on this capture thread so sends are serialized; fire-and-forget
+ // subscribes can flood the WebSocket send sink and trigger FAIL_OVERFLOW.
+ try {
+ session.sendInputAudio(BinaryData.fromBytes(audioChunk)).block();
+ } catch (Exception sendError) {
+ String msg = sendError.getMessage();
+ if (isCapturing.get() && (msg == null || !msg.contains("cancelled"))) {
+ System.err.println("❌ Error sending audio: " + msg);
+ }
+ }
}
} catch (Exception e) {
if (isCapturing.get()) {
@@ -464,7 +462,7 @@ private static void runVoiceAssistantWithClient(VoiceLiveAsyncClient client) {
// Start session. Session lifetime is local to this reactive chain — the session is
// captured by the lambda passed to flatMapMany and then threaded into per-event handling
// via flatMap, so no instance field or shared holder is needed.
- client.startSession(DEFAULT_MODEL)
+ client.startSession(DEFAULT_MODEL, null)
.flatMapMany(session -> {
System.out.println("✓ Session started successfully");
audioProcessorRef.set(new AudioProcessor(session));
@@ -527,12 +525,12 @@ private static VoiceLiveSessionOptions createVoiceSessionOptions() {
.setCreateResponse(true);
// Create audio input transcription configuration
- AudioInputTranscriptionOptions transcriptionOptions = new AudioInputTranscriptionOptions(AudioInputTranscriptionOptionsModel.WHISPER_1);
+ AudioInputTranscriptionOptions transcriptionOptions = new AudioInputTranscriptionOptions(AudioInputTranscriptionOptionsModel.WHISPER_1).setLanguage("en");
VoiceLiveSessionOptions options = new VoiceLiveSessionOptions()
.setInstructions("You are a helpful AI voice assistant. Respond naturally and conversationally. Keep your responses concise but engaging. Speak as if having a real conversation.")
// Voice: OpenAIVoice (OpenAIVoiceName enum) or AzureStandardVoice/AzureCustomVoice/AzurePersonalVoice
- .setVoice(BinaryData.fromObject(new OpenAIVoice(OpenAIVoiceName.ALLOY)))
+ .setVoice(BinaryData.fromObject(new AzureStandardVoice("en-US-AvaNeural")))
.setModalities(Arrays.asList(InteractionModality.TEXT, InteractionModality.AUDIO))
.setInputAudioFormat(InputAudioFormat.PCM16)
.setOutputAudioFormat(OutputAudioFormat.PCM16)
@@ -552,7 +550,7 @@ private static VoiceLiveSessionOptions createVoiceSessionOptions() {
* inside the reactive chain (no nested subscribe). The voice assistant doesn't send any
* follow-up events, so handlers always return {@link Mono#empty()}.
*/
- private static Mono handleServerEvent(SessionUpdate event, AudioProcessor audioProcessor) {
+ private static Mono handleServerEvent(SessionServerEvent event, AudioProcessor audioProcessor) {
ServerEventType eventType = event.getType();
try {
diff --git a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/telemetry/GlobalTracingSample.java b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/telemetry/GlobalTracingSample.java
index 998ecb4136ce..333a1f85f7e4 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/telemetry/GlobalTracingSample.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/telemetry/GlobalTracingSample.java
@@ -109,7 +109,7 @@ public static void main(String[] args) throws InterruptedException {
// Session lifetime is local to this reactive chain; the session is captured by the
// lambda passed to flatMapMany and then threaded into per-event handling via flatMap,
// so no instance field or shared holder is needed.
- client.startSession("gpt-realtime")
+ client.startSession("gpt-realtime", null)
.flatMapMany(session -> configureSession(session, sessionOptions, prompts)
.thenMany(session.receiveEvents())
.flatMap(GlobalTracingSample::handleServerEvent))
@@ -152,12 +152,12 @@ private static Mono configureSession(
* inside the reactive chain (no nested subscribe). This sample doesn't send any follow-up
* events from inside the handler.
*/
- private static Mono handleServerEvent(com.azure.ai.voicelive.models.SessionUpdate serverEvent) {
+ private static Mono handleServerEvent(com.azure.ai.voicelive.models.SessionServerEvent serverEvent) {
System.out.println("Event: " + serverEvent.getType());
if (serverEvent instanceof SessionUpdateResponseDone) {
SessionResponse response = ((SessionUpdateResponseDone) serverEvent).getResponse();
if (response.getUsage() != null) {
- System.out.println(" Total tokens: " + response.getUsage().getTotalTokens());
+ System.out.println(" Total tokens: " + response.getUsage().getTotalTokenCount());
}
}
return Mono.empty();
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveAsyncClientTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveAsyncClientTest.java
index 41788c563209..285ce1c6322e 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveAsyncClientTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveAsyncClientTest.java
@@ -13,8 +13,11 @@
import reactor.core.publisher.Mono;
import java.net.URI;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -64,14 +67,23 @@ void testStartSessionWithValidOptions() {
// Note: This test might need to be adjusted based on actual implementation
// For now, we're testing that the method exists and can be called
assertDoesNotThrow(() -> {
- client.startSession(sessionOptions.getModel());
+ client.startSession(sessionOptions.getModel(), null);
});
}
@Test
void testStartSessionWithNullOptions() {
// Act & Assert
- assertThrows(NullPointerException.class, () -> client.startSession((String) null));
+ assertThrows(NullPointerException.class, () -> client.startSession((String) null, null));
+ }
+
+ @Test
+ void testStartSessionWithoutModel() {
+ // Act & Assert
+ assertDoesNotThrow(() -> {
+ Mono result = client.startSession();
+ assertNotNull(result);
+ });
}
@Test
@@ -81,14 +93,25 @@ void testStartSessionWithModelString() {
// Act & Assert
assertDoesNotThrow(() -> {
- client.startSession(model);
+ client.startSession(model, null);
});
}
@Test
void testStartSessionWithNullModel() {
// Act & Assert
- assertThrows(NullPointerException.class, () -> client.startSession((String) null));
+ assertThrows(NullPointerException.class, () -> client.startSession((String) null, null));
+ }
+
+ @Test
+ void testStartSessionWithModelAndRequestOptions() {
+ String model = "gpt-4o-realtime-preview";
+ VoiceLiveRequestOptions requestOptions = new VoiceLiveRequestOptions();
+
+ assertDoesNotThrow(() -> {
+ Mono sessionMono = client.startSession(model, requestOptions);
+ assertNotNull(sessionMono);
+ });
}
@Test
@@ -116,20 +139,19 @@ void testOptimizedConnectMethods() {
// Test startSession with model string
assertDoesNotThrow(() -> {
- Mono result = client.startSession("gpt-4o-realtime-preview");
+ Mono result = client.startSession("gpt-4o-realtime-preview", null);
assertNotNull(result);
});
// Test startSession with session options
VoiceLiveSessionOptions sessionOptions = new VoiceLiveSessionOptions().setModel("gpt-4o-realtime-preview");
assertDoesNotThrow(() -> {
- Mono result = client.startSession(sessionOptions.getModel());
+ Mono result = client.startSession(sessionOptions.getModel(), null);
assertNotNull(result);
});
// Test null parameter validation for startSession methods
- assertThrows(NullPointerException.class, () -> client.startSession((String) null));
- assertThrows(NullPointerException.class, () -> client.startSession((VoiceLiveRequestOptions) null));
+ assertThrows(NullPointerException.class, () -> client.startSession((String) null, null));
}
@Test
@@ -138,28 +160,19 @@ void testReturnTypeOptimization() {
String model = "gpt-4o-realtime-preview";
assertDoesNotThrow(() -> {
- Mono sessionMono = client.startSession(model);
+ Mono sessionMono = client.startSession(model, null);
assertNotNull(sessionMono);
// The returned Mono should contain a VoiceLiveSessionAsyncClient when subscribed
});
VoiceLiveSessionOptions options = new VoiceLiveSessionOptions().setModel(model);
assertDoesNotThrow(() -> {
- Mono sessionMono = client.startSession(options.getModel());
+ Mono sessionMono = client.startSession(options.getModel(), null);
assertNotNull(sessionMono);
// The returned Mono should contain a VoiceLiveSessionAsyncClient when subscribed
});
}
- @Test
- void testStartSessionWithoutModel() {
- // Test that startSession() without parameters works
- assertDoesNotThrow(() -> {
- Mono sessionMono = client.startSession();
- assertNotNull(sessionMono);
- });
- }
-
@Test
void testStartSessionWithAgentConfig() {
// Arrange
@@ -167,7 +180,7 @@ void testStartSessionWithAgentConfig() {
// Act & Assert
assertDoesNotThrow(() -> {
- Mono sessionMono = client.startSession(agentConfig);
+ Mono sessionMono = client.startSession(agentConfig, null);
assertNotNull(sessionMono);
});
}
@@ -181,7 +194,7 @@ void testStartSessionWithAgentConfigAllOptions() {
// Act & Assert
assertDoesNotThrow(() -> {
- Mono sessionMono = client.startSession(agentConfig);
+ Mono sessionMono = client.startSession(agentConfig, null);
assertNotNull(sessionMono);
});
}
@@ -189,7 +202,7 @@ void testStartSessionWithAgentConfigAllOptions() {
@Test
void testStartSessionWithNullAgentConfig() {
// Act & Assert
- assertThrows(NullPointerException.class, () -> client.startSession((AgentSessionConfig) null));
+ assertThrows(NullPointerException.class, () -> client.startSession((AgentSessionConfig) null, null));
}
@Test
@@ -212,7 +225,10 @@ void testStartSessionWithAgentConfigAndNullRequestOptions() {
AgentSessionConfig agentConfig = new AgentSessionConfig("test-agent", "test-project");
// Act & Assert
- assertThrows(NullPointerException.class, () -> client.startSession(agentConfig, null));
+ assertDoesNotThrow(() -> {
+ Mono sessionMono = client.startSession(agentConfig, null);
+ assertNotNull(sessionMono);
+ });
}
@Test
@@ -224,4 +240,45 @@ void testStartSessionWithNullAgentConfigAndValidRequestOptions() {
assertThrows(NullPointerException.class, () -> client.startSession((AgentSessionConfig) null, requestOptions));
}
+ @Test
+ void testToQueryParametersWithRequiredOnly() {
+ AgentSessionConfig config = new AgentSessionConfig("my-agent", "my-project");
+
+ Map params = VoiceLiveAsyncClient.toQueryParameters(config);
+
+ assertEquals(2, params.size());
+ assertEquals("my-agent", params.get("agent-name"));
+ assertEquals("my-project", params.get("agent-project-name"));
+ }
+
+ @Test
+ void testToQueryParametersWithAllOptions() {
+ AgentSessionConfig config = new AgentSessionConfig("my-agent", "my-project").setAgentVersion("2.0")
+ .setConversationId("conversation-xyz")
+ .setAuthenticationIdentityClientId("auth-client-id")
+ .setFoundryResourceOverride("override-resource");
+
+ Map params = VoiceLiveAsyncClient.toQueryParameters(config);
+
+ assertEquals(6, params.size());
+ assertEquals("my-agent", params.get("agent-name"));
+ assertEquals("my-project", params.get("agent-project-name"));
+ assertEquals("2.0", params.get("agent-version"));
+ assertEquals("conversation-xyz", params.get("conversation-id"));
+ assertEquals("auth-client-id", params.get("agent-authentication-identity-client-id"));
+ assertEquals("override-resource", params.get("foundry-resource-override"));
+ }
+
+ @Test
+ void testToQueryParametersExcludesEmptyOptionalValues() {
+ AgentSessionConfig config
+ = new AgentSessionConfig("my-agent", "my-project").setAgentVersion("").setConversationId("");
+
+ Map params = VoiceLiveAsyncClient.toQueryParameters(config);
+
+ assertEquals(2, params.size());
+ assertFalse(params.containsKey("agent-version"));
+ assertFalse(params.containsKey("conversation-id"));
+ }
+
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveClientBuilderTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveClientBuilderTest.java
index c87ed6a42aff..463305c74f12 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveClientBuilderTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/VoiceLiveClientBuilderTest.java
@@ -173,7 +173,7 @@ void testBuilderWithServiceVersion() {
assertDoesNotThrow(() -> {
VoiceLiveAsyncClient client = clientBuilder.endpoint(endpoint)
.credential(mockKeyCredential)
- .serviceVersion(VoiceLiveServiceVersion.V2026_01_01_PREVIEW)
+ .serviceVersion(VoiceLiveServiceVersion.V2026_04_10)
.buildAsyncClient();
assertNotNull(client);
@@ -189,7 +189,7 @@ void testBuilderChaining() {
assertDoesNotThrow(() -> {
VoiceLiveAsyncClient client = clientBuilder.endpoint(endpoint)
.credential(mockKeyCredential)
- .serviceVersion(VoiceLiveServiceVersion.V2026_01_01_PREVIEW)
+ .serviceVersion(VoiceLiveServiceVersion.V2026_04_10)
.buildAsyncClient();
assertNotNull(client);
@@ -201,7 +201,7 @@ void testBuilderReturnsBuilder() {
// Test that all methods return the builder for chaining
assertSame(clientBuilder, clientBuilder.endpoint("https://test.cognitiveservices.azure.com"));
assertSame(clientBuilder, clientBuilder.credential(mockKeyCredential));
- assertSame(clientBuilder, clientBuilder.serviceVersion(VoiceLiveServiceVersion.V2026_01_01_PREVIEW));
+ assertSame(clientBuilder, clientBuilder.serviceVersion(VoiceLiveServiceVersion.V2026_04_10));
}
@Test
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/implementation/VoiceLiveTracerTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/implementation/VoiceLiveTracerTest.java
index f2447d0b09bd..20d510aa904a 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/implementation/VoiceLiveTracerTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/implementation/VoiceLiveTracerTest.java
@@ -11,7 +11,7 @@
import com.azure.ai.voicelive.models.ClientEventResponseCancel;
import com.azure.ai.voicelive.models.ClientEventResponseCreate;
import com.azure.ai.voicelive.models.FunctionCallOutputItem;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import io.opentelemetry.api.metrics.Meter;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.StatusCode;
@@ -115,7 +115,7 @@ void testRecvSpanCreated() throws Exception {
String json = "{\"type\":\"session.created\",\"event_id\":\"event1\","
+ "\"session\":{\"id\":\"session123\",\"model\":\"gpt-4o\"}}";
- SessionUpdate update = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(json));
+ SessionServerEvent update = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(json));
voiceLiveTracer.traceRecv(update, json);
voiceLiveTracer.endConnectSpan(null);
@@ -176,7 +176,8 @@ void testResponseCreateTracksLatency() throws Exception {
Thread.sleep(10);
String audioJson = "{\"type\":\"response.audio.delta\",\"response_id\":\"r1\","
+ "\"item_id\":\"i1\",\"output_index\":0,\"content_index\":0,\"delta\":\"AQID\"}";
- SessionUpdate audioDelta = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(audioJson));
+ SessionServerEvent audioDelta
+ = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(audioJson));
voiceLiveTracer.traceRecv(audioDelta, audioJson);
voiceLiveTracer.endConnectSpan(null);
@@ -199,7 +200,8 @@ void testAudioBytesTracking() throws Exception {
// Receive audio delta (base64 "AQIDBA==" = 4 bytes)
String audioJson = "{\"type\":\"response.audio.delta\",\"response_id\":\"r1\","
+ "\"item_id\":\"i1\",\"output_index\":0,\"content_index\":0,\"delta\":\"AQIDBA==\"}";
- SessionUpdate audioDelta = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(audioJson));
+ SessionServerEvent audioDelta
+ = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(audioJson));
voiceLiveTracer.traceRecv(audioDelta, audioJson);
voiceLiveTracer.endConnectSpan(null);
@@ -217,7 +219,8 @@ void testTurnCountTracking() throws Exception {
String doneJson = "{\"type\":\"response.done\",\"event_id\":\"event1\","
+ "\"response\":{\"id\":\"response1\",\"status\":\"completed\",\"output\":[]}}";
- SessionUpdate responseDone = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(doneJson));
+ SessionServerEvent responseDone
+ = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(doneJson));
voiceLiveTracer.traceRecv(responseDone, doneJson);
voiceLiveTracer.endConnectSpan(null);
@@ -236,7 +239,8 @@ void testTokenUsageOnResponseDone() throws Exception {
+ "\"usage\":{\"total_tokens\":150,\"input_tokens\":100,\"output_tokens\":50,"
+ "\"input_token_details\":{\"cached_tokens\":0,\"text_tokens\":50,\"audio_tokens\":50},"
+ "\"output_token_details\":{\"text_tokens\":25,\"audio_tokens\":25}}}}";
- SessionUpdate responseDone = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(doneJson));
+ SessionServerEvent responseDone
+ = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(doneJson));
voiceLiveTracer.traceRecv(responseDone, doneJson);
voiceLiveTracer.endConnectSpan(null);
@@ -254,7 +258,8 @@ void testErrorEventTracking() throws Exception {
String errorJson = "{\"type\":\"error\",\"event_id\":\"event1\","
+ "\"error\":{\"type\":\"server_error\",\"code\":\"500\",\"message\":\"Internal error\"}}";
- SessionUpdate errorUpdate = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(errorJson));
+ SessionServerEvent errorUpdate
+ = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(errorJson));
voiceLiveTracer.traceRecv(errorUpdate, errorJson);
voiceLiveTracer.endConnectSpan(null);
@@ -294,7 +299,7 @@ void testSessionIdFromSessionCreated() throws Exception {
String json = "{\"type\":\"session.created\",\"event_id\":\"event1\","
+ "\"session\":{\"id\":\"session456\",\"model\":\"gpt-4o\"}}";
- SessionUpdate update = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(json));
+ SessionServerEvent update = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(json));
voiceLiveTracer.traceRecv(update, json);
voiceLiveTracer.endConnectSpan(null);
@@ -329,7 +334,7 @@ void testParentChildSpanHierarchy() throws Exception {
// Recv
String json = "{\"type\":\"session.created\",\"event_id\":\"event1\","
+ "\"session\":{\"id\":\"session123\",\"model\":\"gpt-4o\"}}";
- SessionUpdate update = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(json));
+ SessionServerEvent update = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(json));
voiceLiveTracer.traceRecv(update, json);
// Close
@@ -390,7 +395,8 @@ void testResponseDoneTracksConversationAndFinishReason() throws Exception {
String doneJson = "{\"type\":\"response.done\",\"event_id\":\"event1\","
+ "\"response\":{\"id\":\"response1\",\"conversation_id\":\"conversation1\","
+ "\"status\":\"completed\",\"output\":[]}}";
- SessionUpdate responseDone = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(doneJson));
+ SessionServerEvent responseDone
+ = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(doneJson));
voiceLiveTracer.traceRecv(responseDone, doneJson);
voiceLiveTracer.endConnectSpan(null);
@@ -456,7 +462,7 @@ void testSessionCreatedTracksAgentAttributes() throws Exception {
String json = "{\"type\":\"session.created\",\"event_id\":\"event1\",\"session\":{"
+ "\"id\":\"session123\",\"input_audio_sampling_rate\":24000,"
+ "\"agent\":{\"agent_id\":\"agent123\",\"thread_id\":\"thread456\"}}}";
- SessionUpdate update = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(json));
+ SessionServerEvent update = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(json));
voiceLiveTracer.traceRecv(update, json);
voiceLiveTracer.endConnectSpan(null);
@@ -493,7 +499,7 @@ void testSessionCreatedTracksInputAudioSamplingRate() throws Exception {
String json = "{\"type\":\"session.created\",\"event_id\":\"event1\","
+ "\"session\":{\"id\":\"session789\",\"model\":\"gpt-4o\"," + "\"input_audio_sampling_rate\":24000}}";
- SessionUpdate update = SessionUpdate.fromJson(com.azure.json.JsonProviders.createReader(json));
+ SessionServerEvent update = SessionServerEvent.fromJson(com.azure.json.JsonProviders.createReader(json));
voiceLiveTracer.traceRecv(update, json);
voiceLiveTracer.endConnectSpan(null);
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioFormatTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioFormatTests.java
index 388a676647c2..f4bd80064633 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioFormatTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioFormatTests.java
@@ -46,7 +46,7 @@ public class VoiceLiveAudioFormatTests extends VoiceLiveTestBase {
static Stream modelAndSamplingRateProvider() {
return withApiVersions(Stream.of(Arguments.of("gpt-realtime", 16000), Arguments.of("gpt-realtime", 44100),
Arguments.of("gpt-realtime", 8000), Arguments.of("gpt-4o", 16000), Arguments.of("gpt-4o", 44100),
- Arguments.of("gpt-4.1", 8000)), API_VERSION_GA, API_VERSION_PREVIEW);
+ Arguments.of("gpt-4.1", 8000)));
}
static Stream modelAndInputAudioFormatProvider() {
@@ -101,7 +101,7 @@ public void testRealtimeServiceWithInputAudioFormat(String model, String audioFo
.setTurnDetection(turnDetection)
.setInputAudioTranscription(getSpeechRecognitionSetting(model));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -155,8 +155,8 @@ public void testRealtimeServiceWithInputAudioFormat(String model, String audioFo
}
}
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes(8000, 2.0)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes(8000, 2.0))).block(SEND_TIMEOUT);
boolean received = responseLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -199,11 +199,11 @@ public void testRealtimeServiceWithInputAudioSamplingRate(String model, int samp
.setInputAudioTranscription(getSpeechRecognitionSetting(model))
.setInstructions(
"You are a helpful assistant. Please respond briefly to the user's question about lakes.")
- .setTurnDetection(API_VERSION_PREVIEW.equals(apiVersion)
+ .setTurnDetection(API_VERSIONS[1].equals(apiVersion)
? new ServerVadTurnDetection().setSilenceDurationMs(200)
: new ServerVadTurnDetection());
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -263,8 +263,9 @@ public void testRealtimeServiceWithInputAudioSamplingRate(String model, int samp
"Expected sampling rate " + samplingRate + ", got " + actualSamplingRate);
}
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes(samplingRate, 2.0)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes(samplingRate, 2.0)))
+ .block(SEND_TIMEOUT);
boolean speechStarted = speechStartedLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(speechStarted, "Should receive speech started event");
@@ -318,7 +319,7 @@ public void testOutputFormatsWithAzureVoice(String model, String outputFormat, S
.setTurnDetection(
new ServerVadTurnDetection().setThreshold(0.5).setPrefixPaddingMs(300).setSilenceDurationMs(200));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -351,8 +352,8 @@ public void testOutputFormatsWithAzureVoice(String model, String outputFormat, S
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean received = responseLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -394,7 +395,7 @@ public void testOutputFormatsWithOpenAIVoice(String model, String outputFormat,
.setTurnDetection(
new ServerVadTurnDetection().setThreshold(0.5).setPrefixPaddingMs(300).setSilenceDurationMs(200));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -427,8 +428,8 @@ public void testOutputFormatsWithOpenAIVoice(String model, String outputFormat,
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean received = responseLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioTests.java
index 2b697d5a0f73..394eb2056206 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioTests.java
@@ -15,6 +15,7 @@
import com.azure.ai.voicelive.models.SessionUpdateResponseAudioDelta;
import com.azure.ai.voicelive.models.VoiceLiveSessionOptions;
import com.azure.core.test.annotation.LiveOnly;
+import com.azure.core.util.BinaryData;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@@ -36,8 +37,7 @@
public class VoiceLiveAudioTests extends VoiceLiveTestBase {
static Stream audioParams() {
- return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" }, API_VERSIONS);
}
@ParameterizedTest
@@ -59,7 +59,7 @@ public void testRealtimeServiceWithAudio(String model, String apiVersion) throws
.setModalities(Arrays.asList(InteractionModality.TEXT, InteractionModality.AUDIO))
.setInputAudioFormat(InputAudioFormat.PCM16);
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -91,7 +91,7 @@ public void testRealtimeServiceWithAudio(String model, String apiVersion) throws
Thread.sleep(SETUP_DELAY_MS);
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
boolean received = audioResponseLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -108,8 +108,7 @@ public void testRealtimeServiceWithAudio(String model, String apiVersion) throws
}
static Stream audioEnhancementsParams() {
- return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" }, API_VERSIONS);
}
@ParameterizedTest
@@ -133,7 +132,7 @@ public void testRealtimeServiceWithAudioEnhancements(String model, String apiVer
new AudioNoiseReduction(AudioNoiseReductionType.AZURE_DEEP_NOISE_SUPPRESSION))
.setInputAudioEchoCancellation(new AudioEchoCancellation());
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -166,7 +165,7 @@ public void testRealtimeServiceWithAudioEnhancements(String model, String apiVer
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
// Wait for events to be collected
Thread.sleep(EVENT_TIMEOUT_SECONDS * 1000);
@@ -183,7 +182,6 @@ public void testRealtimeServiceWithAudioEnhancements(String model, String apiVer
}
static Stream echoCancellationParams() {
- return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" }, API_VERSIONS);
}
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveConversationTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveConversationTests.java
index a756f9b604d9..6b73600a3480 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveConversationTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveConversationTests.java
@@ -26,6 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import java.io.IOException;
+import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -37,7 +38,7 @@
public class VoiceLiveConversationTests extends VoiceLiveTestBase {
static Stream retrieveItemParams() {
- return crossProduct(new String[] { "gpt-realtime" }, new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime" }, API_VERSIONS);
}
@ParameterizedTest
@@ -61,7 +62,7 @@ public void testRealtimeServiceRetrieveItem(String model, String apiVersion)
= new VoiceLiveSessionOptions().setInstructions("You are a helpful assistant.")
.setVoice(BinaryData.fromObject(new OpenAIVoice(OpenAIVoiceName.ALLOY)));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -101,8 +102,8 @@ public void testRealtimeServiceRetrieveItem(String model, String apiVersion)
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean outputReceived = outputItemLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(outputReceived, "Should receive output item done event");
@@ -132,7 +133,7 @@ public void testRealtimeServiceRetrieveItem(String model, String apiVersion)
}
static Stream truncateItemParams() {
- return crossProduct(new String[] { "gpt-realtime" }, new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime" }, API_VERSIONS);
}
@ParameterizedTest
@@ -155,7 +156,7 @@ public void testRealtimeServiceTruncateItem(String model, String apiVersion)
VoiceLiveSessionOptions sessionOptions
= new VoiceLiveSessionOptions().setInstructions("You are a helpful assistant.");
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -193,15 +194,15 @@ public void testRealtimeServiceTruncateItem(String model, String apiVersion)
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean outputReceived = outputItemLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(outputReceived, "Should receive output item done event");
Assertions.assertNotNull(outputItemId.get(), "Output item ID should not be null");
// Truncate the conversation item at 1000ms
- session.truncateConversation(outputItemId.get(), 0, 1000).block(SEND_TIMEOUT);
+ session.truncateConversation(outputItemId.get(), 0, Duration.ofMillis(1000)).block(SEND_TIMEOUT);
boolean truncated = truncateLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(truncated, "Should receive conversation item truncated event");
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveSessionTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveSessionTests.java
index 9c95d4f136ef..04f67cc1342c 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveSessionTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveSessionTests.java
@@ -31,7 +31,7 @@
public class VoiceLiveSessionTests extends VoiceLiveTestBase {
static Stream apiVersionParams() {
- return Stream.of(Arguments.of(API_VERSION_GA), Arguments.of(API_VERSION_PREVIEW));
+ return Arrays.stream(API_VERSIONS).map(Arguments::of);
}
@ParameterizedTest
@@ -52,7 +52,7 @@ public void testSessionUpdateEventIsReceived(String apiVersion) throws Interrupt
.setModalities(Arrays.asList(InteractionModality.TEXT, InteractionModality.AUDIO))
.setInputAudioFormat(InputAudioFormat.PCM16);
- session = client.startSession(TEST_MODEL).block(SESSION_TIMEOUT);
+ session = client.startSession(TEST_MODEL, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
Assertions.assertTrue(session.isConnected(), "Session should be connected");
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTestBase.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTestBase.java
index 89d6d9096fc7..94810f134660 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTestBase.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTestBase.java
@@ -11,7 +11,7 @@
import com.azure.ai.voicelive.models.AudioInputTranscriptionOptionsModel;
import com.azure.ai.voicelive.models.InputAudioFormat;
import com.azure.ai.voicelive.models.OutputAudioFormat;
-import com.azure.ai.voicelive.models.SessionUpdate;
+import com.azure.ai.voicelive.models.SessionServerEvent;
import com.azure.ai.voicelive.models.SessionUpdateError;
import com.azure.core.credential.KeyCredential;
import com.azure.core.test.TestProxyTestBase;
@@ -65,9 +65,8 @@ public abstract class VoiceLiveTestBase extends TestProxyTestBase {
protected static final int DEFAULT_SAMPLE_RATE = 24000;
protected static final double DEFAULT_SILENCE_DURATION = 2.0;
- // API version constants
- protected static final String API_VERSION_GA = "2025-10-01";
- protected static final String API_VERSION_PREVIEW = "2026-01-01-preview";
+ // API versions exercised by parameterized live tests.
+ protected static final String[] API_VERSIONS = { "2025-10-01", "2026-04-10" };
protected String getEndpoint() {
String endpoint = Configuration.getGlobalConfiguration().get("AI_SERVICES_ENDPOINT");
@@ -112,7 +111,7 @@ protected static Stream crossProduct(String[] models, String[] apiVer
}
protected static Stream withApiVersions(Stream base) {
- return withApiVersions(base, API_VERSION_GA, API_VERSION_PREVIEW);
+ return withApiVersions(base, API_VERSIONS);
}
protected static Stream withApiVersions(Stream base, String... apiVersions) {
@@ -164,7 +163,7 @@ protected byte[] getTrailingSilenceBytes() {
return getTrailingSilenceBytes(DEFAULT_SAMPLE_RATE, DEFAULT_SILENCE_DURATION);
}
- protected void handleError(SessionUpdate event) {
+ protected void handleError(SessionServerEvent event) {
if (event instanceof SessionUpdateError) {
SessionUpdateError errorEvent = (SessionUpdateError) event;
System.err.println(
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveToolCallTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveToolCallTests.java
index 755ab6db1b57..a974bc577061 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveToolCallTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveToolCallTests.java
@@ -49,13 +49,12 @@ public class VoiceLiveToolCallTests extends VoiceLiveTestBase {
private static final String API_VERSION_2025_05_01_PREVIEW = "2025-05-01-preview";
// ===== test_realtime_service_tool_call =====
- // Python: models=[gpt-realtime, gpt-4o], api_versions=[2025-10-01, 2026-01-01-preview]
+ // Python: models=[gpt-realtime, gpt-4o], api_versions=[2025-10-01, 2026-04-10]
// Uses _get_speech_recognition_setting(model), audio=4-1.wav, tool=assess_pronunciation
// Voice: AzureStandardVoice("en-US-AriaNeural")
static Stream toolCallParams() {
- return crossProduct(new String[] { MODEL_GPT_REALTIME, MODEL_GPT_4O },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { MODEL_GPT_REALTIME, MODEL_GPT_4O }, API_VERSIONS);
}
@ParameterizedTest
@@ -113,7 +112,7 @@ private void doTestRealtimeServiceToolCall(String model, String apiVersion)
.setTools(Arrays.asList(assessTool))
.setToolChoice(BinaryData.fromObject("auto"));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
subscription = session.receiveEvents().subscribe(event -> {
@@ -138,7 +137,7 @@ private void doTestRealtimeServiceToolCall(String model, String apiVersion)
// Send audio and response.create() in tight succession to beat server VAD.
// With gpt-realtime, the default server VAD detects speech, auto-commits the
// buffer and triggers its own response before a delayed response.create() arrives.
- session.sendInputAudio(audioData)
+ session.sendInputAudio(BinaryData.fromBytes(audioData))
.then(session.sendEvent(new ClientEventResponseCreate()))
.block(SEND_TIMEOUT);
@@ -166,14 +165,13 @@ private void doTestRealtimeServiceToolCall(String model, String apiVersion)
// ===== test_realtime_service_tool_choice =====
// Python: models=[gpt-realtime, gpt-4o, gpt-5-chat], skip if "realtime" in model
// -> effective models: [gpt-4o, gpt-5-chat]
- // api_versions=[2025-10-01, 2026-01-01-preview]
+ // api_versions=[2025-10-01, 2026-04-10]
// Uses azure-speech + ServerVad, audio=ask_weather.wav
// Tools: get_weather, get_time. ToolChoice: get_time
// Assert: function_done.name == "get_time", arguments contains Beijing
static Stream toolChoiceParams() {
- return crossProduct(new String[] { MODEL_GPT_4O, MODEL_GPT_5_CHAT },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { MODEL_GPT_4O, MODEL_GPT_5_CHAT }, API_VERSIONS);
}
@ParameterizedTest
@@ -210,7 +208,7 @@ public void testRealtimeServiceToolChoice(String model, String apiVersion)
.setTools(Arrays.asList(weatherTool, timeTool))
.setToolChoice(BinaryData.fromObject(new ToolChoiceFunctionSelection("get_time")));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
subscription = session.receiveEvents().subscribe(event -> {
@@ -233,8 +231,8 @@ public void testRealtimeServiceToolChoice(String model, String apiVersion)
session.sendEvent(new ClientEventSessionUpdate(sessionOptions)).block(SEND_TIMEOUT);
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean done = responseDoneLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(done, "Should receive response done event");
@@ -260,14 +258,13 @@ public void testRealtimeServiceToolChoice(String model, String apiVersion)
// ===== test_realtime_service_tool_call_parameter =====
// Python: models=[gpt-realtime, gpt-4.1, gpt-5, gpt-5.1, gpt-5.2, phi4-mm-realtime],
// skip if "realtime" in model -> effective models: [gpt-4.1, gpt-5]
- // api_versions=[2025-10-01, 2026-01-01-preview]
+ // api_versions=[2025-10-01, 2026-04-10]
// Uses azure-speech + ServerVad, audio=ask_weather.wav
// Tool: get_weather. Full tool call flow: get function call -> send tool output -> get transcript
// Assert: transcript contains "sunny" or chinese equivalent, and "25"
static Stream toolCallParameterParams() {
- return crossProduct(new String[] { MODEL_GPT_41, MODEL_GPT_5 },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { MODEL_GPT_41, MODEL_GPT_5 }, API_VERSIONS);
}
@ParameterizedTest
@@ -311,7 +308,7 @@ public void testRealtimeServiceToolCallParameter(String model, String apiVersion
.setTools(Arrays.asList(weatherTool))
.setToolChoice(BinaryData.fromObject("auto"));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
subscription = session.receiveEvents().subscribe(event -> {
@@ -351,8 +348,8 @@ public void testRealtimeServiceToolCallParameter(String model, String apiVersion
waitForSetup();
// Send audio + trailing silence
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
// Wait for RESPONSE_DONE that contains the function call.
// This ensures all interleaved audio_transcript events from the same response
@@ -399,7 +396,7 @@ public void testRealtimeServiceToolCallParameter(String model, String apiVersion
}
// ===== test_realtime_service_live_session_update =====
- // Python: model=[gpt-realtime], api_versions=[2025-05-01-preview, 2026-01-01-preview]
+ // Python: model=[gpt-realtime], api_versions=[2025-05-01-preview, 2026-04-10]
// Two-phase test:
// Phase 1: Session without tools -> send audio -> expect no function call in response
// Phase 2: New session with tools -> send audio -> expect function call
@@ -407,7 +404,7 @@ public void testRealtimeServiceToolCallParameter(String model, String apiVersion
static Stream liveSessionUpdateParams() {
return crossProduct(new String[] { MODEL_GPT_REALTIME },
- new String[] { API_VERSION_2025_05_01_PREVIEW, API_VERSION_PREVIEW });
+ new String[] { API_VERSION_2025_05_01_PREVIEW, API_VERSIONS[1] });
}
@ParameterizedTest
@@ -428,7 +425,7 @@ public void testRealtimeServiceLiveSessionUpdate(String model, String apiVersion
VoiceLiveSessionAsyncClient session = null;
Disposable subscription = null;
try {
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
// Phase tracking: 1 = no tools, 2 = with tools, 3 = post-response.create
@@ -499,8 +496,8 @@ public void testRealtimeServiceLiveSessionUpdate(String model, String apiVersion
session.sendEvent(new ClientEventSessionUpdate(sessionOptionsNoTools)).block(SEND_TIMEOUT);
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean phase1Done = phase1Latch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(phase1Done, "Phase 1: Should receive audio transcript done event");
@@ -527,8 +524,8 @@ public void testRealtimeServiceLiveSessionUpdate(String model, String apiVersion
session.sendEvent(new ClientEventSessionUpdate(sessionOptionsWithTools)).block(SEND_TIMEOUT);
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean phase2Done = phase2Latch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
Assertions.assertTrue(phase2Done, "Phase 2: Should receive function call after adding tools");
@@ -569,6 +566,6 @@ public void testRealtimeServiceLiveSessionUpdate(String model, String apiVersion
// Python: @pytest.mark.skip() - skipped in Python tests
static Stream toolCallNoAudioOverlapParams() {
- return crossProduct(new String[] { MODEL_GPT_REALTIME }, new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { MODEL_GPT_REALTIME }, API_VERSIONS);
}
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTranscriptionTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTranscriptionTests.java
index 6b81c311e1b3..f4a00c8ad369 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTranscriptionTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTranscriptionTests.java
@@ -13,6 +13,7 @@
import com.azure.ai.voicelive.models.ServerEventType;
import com.azure.ai.voicelive.models.SessionUpdateConversationItemInputAudioTranscriptionCompleted;
import com.azure.ai.voicelive.models.VoiceLiveSessionOptions;
+import com.azure.core.util.BinaryData;
import com.azure.core.test.annotation.LiveOnly;
import org.junit.jupiter.api.Assertions;
import reactor.core.Disposable;
@@ -34,8 +35,7 @@
public class VoiceLiveTranscriptionTests extends VoiceLiveTestBase {
static Stream whisperTranscriptionParams() {
- return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" }, API_VERSIONS);
}
@ParameterizedTest
@@ -59,7 +59,7 @@ public void testInputAudioTranscriptionWithWhisper(String model, String apiVersi
.setInputAudioFormat(InputAudioFormat.PCM16)
.setInputAudioTranscription(getSpeechRecognitionSetting(model));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -92,8 +92,8 @@ public void testInputAudioTranscriptionWithWhisper(String model, String apiVersi
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean received = transcriptionLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -108,8 +108,7 @@ public void testInputAudioTranscriptionWithWhisper(String model, String apiVersi
}
static Stream gpt4oTranscribeParams() {
- return crossProduct(new String[] { "gpt-4o-transcribe", "gpt-4o-mini-transcribe" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-4o-transcribe", "gpt-4o-mini-transcribe" }, API_VERSIONS);
}
@ParameterizedTest
@@ -135,7 +134,7 @@ public void testInputAudioTranscriptionWithGpt4oTranscribe(String transcriptionM
VoiceLiveSessionOptions sessionOptions = new VoiceLiveSessionOptions().setInputAudioTranscription(
new AudioInputTranscriptionOptions(transcriptionOptionsModel).setLanguage("en-US"));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -168,8 +167,8 @@ public void testInputAudioTranscriptionWithGpt4oTranscribe(String transcriptionM
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean received = transcriptionLatch.await(EVENT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTurnDetectionTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTurnDetectionTests.java
index 5cb735b4fdb5..782ebd9fb469 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTurnDetectionTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTurnDetectionTests.java
@@ -16,6 +16,7 @@
import com.azure.ai.voicelive.models.TurnDetection;
import com.azure.ai.voicelive.models.VoiceLiveSessionOptions;
import com.azure.core.test.annotation.LiveOnly;
+import com.azure.core.util.BinaryData;
import org.junit.jupiter.api.Assertions;
import reactor.core.Disposable;
import org.junit.jupiter.params.ParameterizedTest;
@@ -38,14 +39,13 @@
public class VoiceLiveTurnDetectionTests extends VoiceLiveTestBase {
// ===== test_realtime_service_with_turn_detection_long_tts_vad_duration =====
- // Python: models=[gpt-realtime, gpt-4o], api_versions=[2025-10-01, 2026-01-01-preview]
+ // Python: models=[gpt-realtime, gpt-4o], api_versions=[2025-10-01, 2026-04-10]
// turn_detection: {"type": "azure_semantic_vad", "speech_duration_assistant_speaking_ms": 800}
// Note: speechDurationAssistantSpeakingMs not available in Java SDK;
// using speechDurationMs(800) as the closest available parameter.
static Stream longTtsVadDurationParams() {
- return crossProduct(new String[] { MODEL_GPT_REALTIME, MODEL_GPT_4O },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { MODEL_GPT_REALTIME, MODEL_GPT_4O }, API_VERSIONS);
}
@ParameterizedTest
@@ -86,7 +86,7 @@ private void doTestLongTtsVadDuration(String model, String apiVersion) throws In
VoiceLiveSessionAsyncClient session = null;
Disposable subscription = null;
try {
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
subscription = session.receiveEvents().subscribe(event -> {
@@ -111,7 +111,7 @@ private void doTestLongTtsVadDuration(String model, String apiVersion) throws In
session.sendEvent(new ClientEventSessionUpdate(sessionOptions)).block(SEND_TIMEOUT);
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
// Python: _wait_for_event(conn, {RESPONSE_AUDIO_DELTA}, 30)
boolean received = audioDeltaLatch.await(30, TimeUnit.SECONDS);
@@ -130,7 +130,7 @@ private void doTestLongTtsVadDuration(String model, String apiVersion) throws In
}
// ===== test_realtime_service_with_turn_detection_multilingual =====
- // Python: models × semanticVadParams, api_versions=[2025-10-01, 2026-01-01-preview]
+ // Python: models × semanticVadParams, api_versions=[2025-10-01, 2026-04-10]
// Uses AzureSemanticVadMultilingual(**semantic_vad_params)
static Stream multilingualParams() {
@@ -179,7 +179,7 @@ private void doTestMultilingual(String description, String model, TurnDetection
VoiceLiveSessionAsyncClient session = null;
Disposable subscription = null;
try {
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
subscription = session.receiveEvents().subscribe(event -> {
@@ -209,8 +209,8 @@ private void doTestMultilingual(String description, String model, TurnDetection
session.sendEvent(new ClientEventSessionUpdate(sessionOptions)).block(SEND_TIMEOUT);
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
// Python uses _collect_event which collects events over a timeout period
Thread.sleep(EVENT_TIMEOUT_SECONDS * 1000);
@@ -231,7 +231,7 @@ private void doTestMultilingual(String description, String model, TurnDetection
// ===== test_realtime_service_with_eou =====
// Python: model=gpt-4o, turn_detection_cls × end_of_detection combinations
// 6 combos: ServerVad/AzureSemanticVad/AzureSemanticVadMultilingual × AzureSemanticDetection/AzureSemanticDetectionEn
- // api_versions=[2025-10-01, 2026-01-01-preview]
+ // api_versions=[2025-10-01, 2026-04-10]
static Stream eouParams() {
return withApiVersions(Stream.of(
@@ -296,7 +296,7 @@ private void doTestEou(String description, TurnDetection turnDetection, String a
VoiceLiveSessionAsyncClient session = null;
Disposable subscription = null;
try {
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
subscription = session.receiveEvents().subscribe(event -> {
@@ -329,9 +329,10 @@ private void doTestEou(String description, TurnDetection turnDetection, String a
session.sendEvent(new ClientEventSessionUpdate(sessionOptions)).block(SEND_TIMEOUT);
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
// Python: _get_trailing_silence_bytes(duration_s=0.5)
- session.sendInputAudio(getTrailingSilenceBytes(DEFAULT_SAMPLE_RATE, 0.5)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes(DEFAULT_SAMPLE_RATE, 0.5)))
+ .block(SEND_TIMEOUT);
// Python: _collect_event(conn, event_type=ServerEventType.RESPONSE_DONE)
Thread.sleep(EVENT_TIMEOUT_SECONDS * 1000);
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveVoicePropertiesTests.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveVoicePropertiesTests.java
index 90044e045f4c..d439b256d9d8 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveVoicePropertiesTests.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveVoicePropertiesTests.java
@@ -33,8 +33,7 @@
public class VoiceLiveVoicePropertiesTests extends VoiceLiveTestBase {
static Stream voicePropertiesParams() {
- return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" }, API_VERSIONS);
}
@ParameterizedTest
@@ -61,7 +60,7 @@ public void testRealtimeServiceWithVoiceProperties(String model, String apiVersi
= new VoiceLiveSessionOptions().setVoice(BinaryData.fromObject(voice))
.setInputAudioTranscription(getSpeechRecognitionSetting(model));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -94,8 +93,8 @@ public void testRealtimeServiceWithVoiceProperties(String model, String apiVersi
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
- session.sendInputAudio(getTrailingSilenceBytes()).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(getTrailingSilenceBytes())).block(SEND_TIMEOUT);
boolean received = responseLatch.await(EVENT_TIMEOUT_SECONDS, java.util.concurrent.TimeUnit.SECONDS);
@@ -110,8 +109,7 @@ public void testRealtimeServiceWithVoiceProperties(String model, String apiVersi
}
static Stream audioTimestampAndVisemeParams() {
- return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" },
- new String[] { API_VERSION_GA, API_VERSION_PREVIEW });
+ return crossProduct(new String[] { "gpt-realtime", "gpt-4.1" }, API_VERSIONS);
}
@ParameterizedTest
@@ -133,10 +131,11 @@ public void testRealtimeServiceWithAudioTimestampAndViseme(String model, String
try {
VoiceLiveSessionOptions sessionOptions = new VoiceLiveSessionOptions()
.setVoice(BinaryData.fromObject(new AzureStandardVoice("en-US-NancyNeural")))
- .setAnimation(new AnimationOptions().setOutputs(Arrays.asList(AnimationOutputType.VISEME_ID)))
+ .setAnimationOptions(
+ new AnimationOptions().setOutputTypes(Arrays.asList(AnimationOutputType.VISEME_ID)))
.setOutputAudioTimestampTypes(Arrays.asList(AudioTimestampType.WORD));
- session = client.startSession(model).block(SESSION_TIMEOUT);
+ session = client.startSession(model, null).block(SESSION_TIMEOUT);
Assertions.assertNotNull(session, "Session should be created successfully");
@@ -171,7 +170,7 @@ public void testRealtimeServiceWithAudioTimestampAndViseme(String model, String
waitForSetup();
- session.sendInputAudio(audioData).block(SEND_TIMEOUT);
+ session.sendInputAudio(BinaryData.fromBytes(audioData)).block(SEND_TIMEOUT);
Thread.sleep(10000);
collectingEvents.set(false);
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AgentSessionConfigTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AgentSessionConfigTest.java
index 7beb7d875e0f..49c14e3c2993 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AgentSessionConfigTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AgentSessionConfigTest.java
@@ -5,14 +5,9 @@
import org.junit.jupiter.api.Test;
-import java.util.Map;
-
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit tests for {@link AgentSessionConfig}.
@@ -83,78 +78,4 @@ void testOptionalPropertiesDefaultToNull() {
assertNull(config.getAuthenticationIdentityClientId());
assertNull(config.getFoundryResourceOverride());
}
-
- @Test
- void testToQueryParametersWithRequiredOnly() {
- // Arrange
- AgentSessionConfig config = new AgentSessionConfig("my-agent", "my-project");
-
- // Act
- Map params = config.toQueryParameters();
-
- // Assert
- assertNotNull(params);
- assertEquals(2, params.size());
- assertEquals("my-agent", params.get("agent-name"));
- assertEquals("my-project", params.get("agent-project-name"));
- }
-
- @Test
- void testToQueryParametersWithAllOptions() {
- // Arrange
- AgentSessionConfig config = new AgentSessionConfig("my-agent", "my-project").setAgentVersion("2.0")
- .setConversationId("conversation-xyz")
- .setAuthenticationIdentityClientId("auth-client-id")
- .setFoundryResourceOverride("override-resource");
-
- // Act
- Map params = config.toQueryParameters();
-
- // Assert
- assertNotNull(params);
- assertEquals(6, params.size());
- assertEquals("my-agent", params.get("agent-name"));
- assertEquals("my-project", params.get("agent-project-name"));
- assertEquals("2.0", params.get("agent-version"));
- assertEquals("conversation-xyz", params.get("conversation-id"));
- assertEquals("auth-client-id", params.get("agent-authentication-identity-client-id"));
- assertEquals("override-resource", params.get("foundry-resource-override"));
- }
-
- @Test
- void testToQueryParametersExcludesEmptyStrings() {
- // Arrange
- AgentSessionConfig config
- = new AgentSessionConfig("my-agent", "my-project").setAgentVersion("").setConversationId("");
-
- // Act
- Map params = config.toQueryParameters();
-
- // Assert
- assertNotNull(params);
- assertEquals(2, params.size());
- assertTrue(params.containsKey("agent-name"));
- assertTrue(params.containsKey("agent-project-name"));
- assertFalse(params.containsKey("agent-version"));
- assertFalse(params.containsKey("conversation-id"));
- }
-
- @Test
- void testToQueryParametersWithSomeOptionalParams() {
- // Arrange
- AgentSessionConfig config = new AgentSessionConfig("supervisor", "ai-project").setAgentVersion("1.5");
-
- // Act
- Map params = config.toQueryParameters();
-
- // Assert
- assertNotNull(params);
- assertEquals(3, params.size());
- assertEquals("supervisor", params.get("agent-name"));
- assertEquals("ai-project", params.get("agent-project-name"));
- assertEquals("1.5", params.get("agent-version"));
- assertFalse(params.containsKey("conversation-id"));
- assertFalse(params.containsKey("agent-authentication-identity-client-id"));
- assertFalse(params.containsKey("foundry-resource-override"));
- }
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AvatarAndAudioBufferEventsTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AvatarAndAudioBufferEventsTest.java
index dc0a1c127a64..fd5f4f415742 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AvatarAndAudioBufferEventsTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/AvatarAndAudioBufferEventsTest.java
@@ -60,7 +60,7 @@ void testAvatarSwitchToIdleDeserialization() {
void testAvatarSwitchToSpeakingPolymorphicViaSessionUpdate() {
String json = "{\"type\":\"session.avatar.switch_to_speaking\",\"event_id\":\"e3\",\"turn_id\":\"t3\"}";
- SessionUpdate update = BinaryData.fromString(json).toObject(SessionUpdate.class);
+ SessionServerEvent update = BinaryData.fromString(json).toObject(SessionServerEvent.class);
assertTrue(update instanceof ServerEventSessionAvatarSwitchToSpeaking,
"Expected ServerEventSessionAvatarSwitchToSpeaking, got " + update.getClass());
@@ -112,7 +112,7 @@ void testServerEventOutputAudioBufferClearedDeserialization() {
void testServerEventOutputAudioBufferClearedPolymorphicViaSessionUpdate() {
String json = "{\"type\":\"output_audio_buffer.cleared\",\"event_id\":\"e7\"}";
- SessionUpdate update = BinaryData.fromString(json).toObject(SessionUpdate.class);
+ SessionServerEvent update = BinaryData.fromString(json).toObject(SessionServerEvent.class);
assertTrue(update instanceof ServerEventOutputAudioBufferCleared,
"Expected ServerEventOutputAudioBufferCleared, got " + update.getClass());
@@ -155,7 +155,7 @@ void testClientEventOutputAudioBufferClearRoundTrip() {
void testClientEventOutputAudioBufferClearPolymorphicViaClientEvent() {
ClientEventOutputAudioBufferClear original = new ClientEventOutputAudioBufferClear().setEventId("clear-3");
- ClientEvent deserialized = BinaryData.fromObject(original).toObject(ClientEvent.class);
+ SessionClientEvent deserialized = BinaryData.fromObject(original).toObject(SessionClientEvent.class);
assertTrue(deserialized instanceof ClientEventOutputAudioBufferClear,
"Expected ClientEventOutputAudioBufferClear, got " + deserialized.getClass());
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPApprovalTypeTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpApprovalTypeTest.java
similarity index 58%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPApprovalTypeTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpApprovalTypeTest.java
index be50ec40bc89..c7bf75fca87b 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPApprovalTypeTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpApprovalTypeTest.java
@@ -12,39 +12,39 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
- * Unit tests for {@link MCPApprovalType}.
+ * Unit tests for {@link McpApprovalType}.
*/
-class MCPApprovalTypeTest {
+class McpApprovalTypeTest {
@Test
void testNeverApprovalType() {
// Assert
- assertNotNull(MCPApprovalType.NEVER);
- assertEquals("never", MCPApprovalType.NEVER.toString());
+ assertNotNull(McpApprovalType.NEVER);
+ assertEquals("never", McpApprovalType.NEVER.toString());
}
@Test
void testAlwaysApprovalType() {
// Assert
- assertNotNull(MCPApprovalType.ALWAYS);
- assertEquals("always", MCPApprovalType.ALWAYS.toString());
+ assertNotNull(McpApprovalType.ALWAYS);
+ assertEquals("always", McpApprovalType.ALWAYS.toString());
}
@Test
void testFromString() {
// Act
- MCPApprovalType never = MCPApprovalType.fromString("never");
- MCPApprovalType always = MCPApprovalType.fromString("always");
+ McpApprovalType never = McpApprovalType.fromString("never");
+ McpApprovalType always = McpApprovalType.fromString("always");
// Assert
- assertEquals(MCPApprovalType.NEVER, never);
- assertEquals(MCPApprovalType.ALWAYS, always);
+ assertEquals(McpApprovalType.NEVER, never);
+ assertEquals(McpApprovalType.ALWAYS, always);
}
@Test
void testFromStringWithCustomValue() {
// Act
- MCPApprovalType custom = MCPApprovalType.fromString("custom-approval-type");
+ McpApprovalType custom = McpApprovalType.fromString("custom-approval-type");
// Assert
assertNotNull(custom);
@@ -54,20 +54,20 @@ void testFromStringWithCustomValue() {
@Test
void testValues() {
// Act
- Collection values = MCPApprovalType.values();
+ Collection values = McpApprovalType.values();
// Assert
assertNotNull(values);
assertTrue(values.size() >= 2); // At least NEVER and ALWAYS
- assertTrue(values.contains(MCPApprovalType.NEVER));
- assertTrue(values.contains(MCPApprovalType.ALWAYS));
+ assertTrue(values.contains(McpApprovalType.NEVER));
+ assertTrue(values.contains(McpApprovalType.ALWAYS));
}
@Test
void testEquality() {
// Arrange
- MCPApprovalType never1 = MCPApprovalType.fromString("never");
- MCPApprovalType never2 = MCPApprovalType.NEVER;
+ McpApprovalType never1 = McpApprovalType.fromString("never");
+ McpApprovalType never2 = McpApprovalType.NEVER;
// Assert
assertEquals(never1, never2);
@@ -77,9 +77,9 @@ void testEquality() {
@Test
void testCaseInsensitivity() {
// Act
- MCPApprovalType lowercase = MCPApprovalType.fromString("never");
- MCPApprovalType uppercase = MCPApprovalType.fromString("NEVER");
- MCPApprovalType mixedCase = MCPApprovalType.fromString("Never");
+ McpApprovalType lowercase = McpApprovalType.fromString("never");
+ McpApprovalType uppercase = McpApprovalType.fromString("NEVER");
+ McpApprovalType mixedCase = McpApprovalType.fromString("Never");
// Assert - ExpandableStringEnum is typically case-sensitive for string matching
// but creates new instances for different cases
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPServerEventTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpServerEventTest.java
similarity index 99%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPServerEventTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpServerEventTest.java
index b7a04394c10d..d196418dcb14 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPServerEventTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpServerEventTest.java
@@ -12,7 +12,7 @@
/**
* Unit tests for MCP server event classes.
*/
-class MCPServerEventTest {
+class McpServerEventTest {
@Test
void testServerEventMcpListToolsInProgress() {
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPServerTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpServerTest.java
similarity index 88%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPServerTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpServerTest.java
index 40bc9ec6ccfa..3d0bc720338d 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/MCPServerTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/McpServerTest.java
@@ -20,17 +20,17 @@
import static org.junit.jupiter.api.Assertions.assertSame;
/**
- * Unit tests for {@link MCPServer}.
+ * Unit tests for {@link McpServer}.
*/
-class MCPServerTest {
+class McpServerTest {
private static final String TEST_SERVER_LABEL = "test-server";
private static final String TEST_SERVER_URL = "http://localhost:8080";
- private MCPServer mcpServer;
+ private McpServer mcpServer;
@BeforeEach
void setUp() {
- mcpServer = new MCPServer(TEST_SERVER_LABEL, TEST_SERVER_URL);
+ mcpServer = new McpServer(TEST_SERVER_LABEL, TEST_SERVER_URL);
}
@Test
@@ -46,7 +46,7 @@ void testConstructorWithValidParameters() {
void testConstructorWithNullServerLabel() {
// Act & Assert
assertDoesNotThrow(() -> {
- MCPServer server = new MCPServer(null, TEST_SERVER_URL);
+ McpServer server = new McpServer(null, TEST_SERVER_URL);
assertNull(server.getServerLabel());
});
}
@@ -55,7 +55,7 @@ void testConstructorWithNullServerLabel() {
void testConstructorWithNullServerUrl() {
// Act & Assert
assertDoesNotThrow(() -> {
- MCPServer server = new MCPServer(TEST_SERVER_LABEL, null);
+ McpServer server = new McpServer(TEST_SERVER_LABEL, null);
assertNull(server.getServerUrl());
});
}
@@ -66,7 +66,7 @@ void testSetAndGetAuthorization() {
String authorization = "Bearer test-token";
// Act
- MCPServer result = mcpServer.setAuthorization(authorization);
+ McpServer result = mcpServer.setAuthorization(authorization);
// Assert
assertEquals(authorization, mcpServer.getAuthorization());
@@ -90,7 +90,7 @@ void testSetAndGetHeaders() {
headers.put("X-Custom-Header", "test-value");
// Act
- MCPServer result = mcpServer.setHeaders(headers);
+ McpServer result = mcpServer.setHeaders(headers);
// Assert
assertEquals(headers, mcpServer.getHeaders());
@@ -127,7 +127,7 @@ void testSetAndGetAllowedTools() {
List allowedTools = Arrays.asList("tool1", "tool2", "tool3");
// Act
- MCPServer result = mcpServer.setAllowedTools(allowedTools);
+ McpServer result = mcpServer.setAllowedTools(allowedTools);
// Assert
assertEquals(allowedTools, mcpServer.getAllowedTools());
@@ -160,10 +160,10 @@ void testSetAllowedToolsWithNull() {
@Test
void testSetAndGetRequireApproval() {
// Arrange
- BinaryData requireApproval = BinaryData.fromObject(MCPApprovalType.ALWAYS);
+ BinaryData requireApproval = BinaryData.fromObject(McpApprovalType.ALWAYS);
// Act
- MCPServer result = mcpServer.setRequireApproval(requireApproval);
+ McpServer result = mcpServer.setRequireApproval(requireApproval);
// Assert
assertEquals(requireApproval, mcpServer.getRequireApproval());
@@ -185,7 +185,7 @@ void testTypeIsAlwaysMCP() {
assertEquals(ToolType.MCP, mcpServer.getType());
// Create another instance to verify consistency
- MCPServer anotherServer = new MCPServer("another-server", "http://localhost:9090");
+ McpServer anotherServer = new McpServer("another-server", "http://localhost:9090");
assertEquals(ToolType.MCP, anotherServer.getType());
}
@@ -196,10 +196,10 @@ void testFluentConfiguration() {
Map headers = new HashMap<>();
headers.put("X-API-Key", "secret");
List allowedTools = Arrays.asList("tool1", "tool2");
- BinaryData requireApproval = BinaryData.fromObject(MCPApprovalType.NEVER);
+ BinaryData requireApproval = BinaryData.fromObject(McpApprovalType.NEVER);
// Act - Test fluent method chaining
- MCPServer result = mcpServer.setAuthorization(authorization)
+ McpServer result = mcpServer.setAuthorization(authorization)
.setHeaders(headers)
.setAllowedTools(allowedTools)
.setRequireApproval(requireApproval);
@@ -244,8 +244,8 @@ void testJsonSerializationRoundtrip() {
@Test
void testMultipleInstancesAreIndependent() {
// Arrange
- MCPServer server1 = new MCPServer("server1", "http://server1.com");
- MCPServer server2 = new MCPServer("server2", "http://server2.com");
+ McpServer server1 = new McpServer("server1", "http://server1.com");
+ McpServer server2 = new McpServer("server2", "http://server2.com");
server1.setAuthorization("token1");
server2.setAuthorization("token2");
@@ -259,13 +259,13 @@ void testMultipleInstancesAreIndependent() {
@Test
void testComplexRequireApprovalConfiguration() {
- // Test with MCPApprovalType.ALWAYS
- BinaryData alwaysApproval = BinaryData.fromObject(MCPApprovalType.ALWAYS);
+ // Test with McpApprovalType.ALWAYS
+ BinaryData alwaysApproval = BinaryData.fromObject(McpApprovalType.ALWAYS);
mcpServer.setRequireApproval(alwaysApproval);
assertEquals(alwaysApproval, mcpServer.getRequireApproval());
- // Test with MCPApprovalType.NEVER
- BinaryData neverApproval = BinaryData.fromObject(MCPApprovalType.NEVER);
+ // Test with McpApprovalType.NEVER
+ BinaryData neverApproval = BinaryData.fromObject(McpApprovalType.NEVER);
mcpServer.setRequireApproval(neverApproval);
assertEquals(neverApproval, mcpServer.getRequireApproval());
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/RequestImageContentPartTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/RequestImageContentPartTest.java
index 11757ce01d11..997d1339e434 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/RequestImageContentPartTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/RequestImageContentPartTest.java
@@ -32,10 +32,10 @@ void testSetAndGetUrl() {
String imageUrl = "https://example.com/image.jpg";
// Act
- RequestImageContentPart result = imagePart.setUrl(imageUrl);
+ RequestImageContentPart result = imagePart.setImageUrl(imageUrl);
// Assert
- assertEquals(imageUrl, imagePart.getUrl());
+ assertEquals(imageUrl, imagePart.getImageUrl());
assertEquals(imagePart, result); // Fluent API
}
@@ -55,7 +55,7 @@ void testSetAndGetDetail() {
@Test
void testFromJsonWithUrl() {
// Arrange
- String json = "{\"type\":\"input_image\",\"url\":\"https://example.com/test.png\"}";
+ String json = "{\"type\":\"input_image\",\"image_url\":\"https://example.com/test.png\"}";
BinaryData data = BinaryData.fromString(json);
// Act
@@ -64,14 +64,14 @@ void testFromJsonWithUrl() {
// Assert
assertNotNull(imagePart);
assertEquals(ContentPartType.INPUT_IMAGE, imagePart.getType());
- assertEquals("https://example.com/test.png", imagePart.getUrl());
+ assertEquals("https://example.com/test.png", imagePart.getImageUrl());
assertNull(imagePart.getDetail());
}
@Test
void testFromJsonWithAllFields() {
// Arrange
- String json = "{\"type\":\"input_image\",\"url\":\"https://example.com/image.jpg\",\"detail\":\"high\"}";
+ String json = "{\"type\":\"input_image\",\"image_url\":\"https://example.com/image.jpg\",\"detail\":\"high\"}";
BinaryData data = BinaryData.fromString(json);
// Act
@@ -80,14 +80,14 @@ void testFromJsonWithAllFields() {
// Assert
assertNotNull(imagePart);
assertEquals(ContentPartType.INPUT_IMAGE, imagePart.getType());
- assertEquals("https://example.com/image.jpg", imagePart.getUrl());
+ assertEquals("https://example.com/image.jpg", imagePart.getImageUrl());
assertEquals(RequestImageContentPartDetail.HIGH, imagePart.getDetail());
}
@Test
void testJsonRoundTrip() {
// Arrange
- RequestImageContentPart original = new RequestImageContentPart().setUrl("https://example.com/photo.png")
+ RequestImageContentPart original = new RequestImageContentPart().setImageUrl("https://example.com/photo.png")
.setDetail(RequestImageContentPartDetail.AUTO);
// Act
@@ -97,14 +97,14 @@ void testJsonRoundTrip() {
// Assert
assertNotNull(deserialized);
assertEquals(original.getType(), deserialized.getType());
- assertEquals(original.getUrl(), deserialized.getUrl());
+ assertEquals(original.getImageUrl(), deserialized.getImageUrl());
assertEquals(original.getDetail(), deserialized.getDetail());
}
@Test
void testWithLowDetail() {
// Arrange
- String json = "{\"type\":\"input_image\",\"url\":\"https://example.com/low-res.jpg\",\"detail\":\"low\"}";
+ String json = "{\"type\":\"input_image\",\"image_url\":\"https://example.com/low-res.jpg\",\"detail\":\"low\"}";
BinaryData data = BinaryData.fromString(json);
// Act
@@ -117,7 +117,7 @@ void testWithLowDetail() {
@Test
void testWithAutoDetail() {
// Arrange
- String json = "{\"type\":\"input_image\",\"url\":\"https://example.com/auto.jpg\",\"detail\":\"auto\"}";
+ String json = "{\"type\":\"input_image\",\"image_url\":\"https://example.com/auto.jpg\",\"detail\":\"auto\"}";
BinaryData data = BinaryData.fromString(json);
// Act
@@ -130,12 +130,12 @@ void testWithAutoDetail() {
@Test
void testFluentApi() {
// Act
- RequestImageContentPart imagePart = new RequestImageContentPart().setUrl("https://example.com/fluent.png")
+ RequestImageContentPart imagePart = new RequestImageContentPart().setImageUrl("https://example.com/fluent.png")
.setDetail(RequestImageContentPartDetail.HIGH);
// Assert
assertNotNull(imagePart);
- assertEquals("https://example.com/fluent.png", imagePart.getUrl());
+ assertEquals("https://example.com/fluent.png", imagePart.getImageUrl());
assertEquals(RequestImageContentPartDetail.HIGH, imagePart.getDetail());
}
}
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPApprovalRequestItemTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpApprovalRequestItemTest.java
similarity index 83%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPApprovalRequestItemTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpApprovalRequestItemTest.java
index 083ccd097a78..2be0335a5e96 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPApprovalRequestItemTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpApprovalRequestItemTest.java
@@ -11,9 +11,9 @@
import static org.junit.jupiter.api.Assertions.assertNull;
/**
- * Unit tests for {@link ResponseMCPApprovalRequestItem}.
+ * Unit tests for {@link ResponseMcpApprovalRequestItem}.
*/
-class ResponseMCPApprovalRequestItemTest {
+class ResponseMcpApprovalRequestItemTest {
@Test
void testFromJsonWithRequiredFields() {
@@ -23,8 +23,8 @@ void testFromJsonWithRequiredFields() {
+ "\"name\":\"sensitive-tool\"," + "\"server_label\":\"production-server\"" + "}";
// Act
- ResponseMCPApprovalRequestItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalRequestItem.class);
// Assert
assertNotNull(item);
@@ -42,8 +42,8 @@ void testFromJsonWithArguments() {
+ "\"arguments\":\"{\\\"resource_id\\\":\\\"res-123\\\"}\"" + "}";
// Act
- ResponseMCPApprovalRequestItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalRequestItem.class);
// Assert
assertNotNull(item);
@@ -60,8 +60,8 @@ void testTypeIsAlwaysMcpApprovalRequest() {
+ "\"type\":\"mcp_approval_request\"," + "\"name\":\"tool\"," + "\"server_label\":\"server\"" + "}";
// Act
- ResponseMCPApprovalRequestItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalRequestItem.class);
// Assert
assertEquals(ItemType.MCP_APPROVAL_REQUEST, item.getType());
@@ -75,8 +75,8 @@ void testWithNullArguments() {
+ "\"name\":\"no-arg-tool\"," + "\"server_label\":\"test-server\"" + "}";
// Act
- ResponseMCPApprovalRequestItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalRequestItem.class);
// Assert
assertNotNull(item);
@@ -91,14 +91,14 @@ void testJsonRoundTrip() {
+ "\"arguments\":\"{\\\"backup_type\\\":\\\"full\\\"}\"" + "}";
// Act
- ResponseMCPApprovalRequestItem item
- = BinaryData.fromString(originalJson).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem item
+ = BinaryData.fromString(originalJson).toObject(ResponseMcpApprovalRequestItem.class);
String serializedJson = BinaryData.fromObject(item).toString();
// Assert
assertNotNull(serializedJson);
- ResponseMCPApprovalRequestItem deserializedItem
- = BinaryData.fromString(serializedJson).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem deserializedItem
+ = BinaryData.fromString(serializedJson).toObject(ResponseMcpApprovalRequestItem.class);
assertEquals(item.getId(), deserializedItem.getId());
assertEquals(item.getName(), deserializedItem.getName());
assertEquals(item.getServerLabel(), deserializedItem.getServerLabel());
@@ -114,8 +114,8 @@ void testComplexToolArguments() {
+ "\"arguments\":\"" + complexArgs.replace("\"", "\\\"") + "\"" + "}";
// Act
- ResponseMCPApprovalRequestItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalRequestItem.class);
+ ResponseMcpApprovalRequestItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalRequestItem.class);
// Assert
assertNotNull(item.getArguments());
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPApprovalResponseItemTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpApprovalResponseItemTest.java
similarity index 83%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPApprovalResponseItemTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpApprovalResponseItemTest.java
index e388f4907bcd..b14b1fc628f3 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPApprovalResponseItemTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpApprovalResponseItemTest.java
@@ -13,9 +13,9 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
- * Unit tests for {@link ResponseMCPApprovalResponseItem}.
+ * Unit tests for {@link ResponseMcpApprovalResponseItem}.
*/
-class ResponseMCPApprovalResponseItemTest {
+class ResponseMcpApprovalResponseItemTest {
@Test
void testFromJsonWithApprove() {
@@ -24,8 +24,8 @@ void testFromJsonWithApprove() {
+ "\"type\":\"mcp_approval_response\"," + "\"approval_request_id\":\"req-123\"," + "\"approve\":true" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertNotNull(item);
@@ -43,8 +43,8 @@ void testFromJsonWithDeny() {
+ "\"approval_request_id\":\"req-456\"," + "\"approve\":false" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertNotNull(item);
@@ -61,8 +61,8 @@ void testFromJsonWithReason() {
+ "\"reason\":\"Security policy violation\"" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertNotNull(item);
@@ -77,8 +77,8 @@ void testTypeIsAlwaysMcpApprovalResponse() {
+ "\"type\":\"mcp_approval_response\"," + "\"approval_request_id\":\"req-999\"," + "\"approve\":true" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertEquals(ItemType.MCP_APPROVAL_RESPONSE, item.getType());
@@ -91,8 +91,8 @@ void testWithNullReason() {
+ "\"type\":\"mcp_approval_response\"," + "\"approval_request_id\":\"req-111\"," + "\"approve\":true" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertNotNull(item);
@@ -107,14 +107,14 @@ void testJsonRoundTrip() {
+ "\"reason\":\"User denied the action\"" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(originalJson).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(originalJson).toObject(ResponseMcpApprovalResponseItem.class);
String serializedJson = BinaryData.fromObject(item).toString();
// Assert
assertNotNull(serializedJson);
- ResponseMCPApprovalResponseItem deserializedItem
- = BinaryData.fromString(serializedJson).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem deserializedItem
+ = BinaryData.fromString(serializedJson).toObject(ResponseMcpApprovalResponseItem.class);
assertEquals(item.getId(), deserializedItem.getId());
assertEquals(item.getApprovalRequestId(), deserializedItem.getApprovalRequestId());
assertEquals(item.isApprove(), deserializedItem.isApprove());
@@ -130,8 +130,8 @@ void testApprovalWithDetailedReason() {
+ "\"reason\":\"" + detailedReason + "\"" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertNotNull(item);
@@ -147,8 +147,8 @@ void testApprovalApprovedWithReason() {
+ "\"reason\":\"User explicitly confirmed the action\"" + "}";
// Act
- ResponseMCPApprovalResponseItem item
- = BinaryData.fromString(json).toObject(ResponseMCPApprovalResponseItem.class);
+ ResponseMcpApprovalResponseItem item
+ = BinaryData.fromString(json).toObject(ResponseMcpApprovalResponseItem.class);
// Assert
assertTrue(item.isApprove());
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPCallItemTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpCallItemTest.java
similarity index 85%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPCallItemTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpCallItemTest.java
index a089e75bbe84..75bc0e94dfc8 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPCallItemTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpCallItemTest.java
@@ -11,9 +11,9 @@
import static org.junit.jupiter.api.Assertions.assertNull;
/**
- * Unit tests for {@link ResponseMCPCallItem}.
+ * Unit tests for {@link ResponseMcpCallItem}.
*/
-class ResponseMCPCallItemTest {
+class ResponseMcpCallItemTest {
@Test
void testFromJsonWithRequiredFields() {
@@ -23,7 +23,7 @@ void testFromJsonWithRequiredFields() {
+ "\"name\":\"test-tool\"" + "}";
// Act
- ResponseMCPCallItem item = BinaryData.fromString(json).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem item = BinaryData.fromString(json).toObject(ResponseMcpCallItem.class);
// Assert
assertNotNull(item);
@@ -43,7 +43,7 @@ void testFromJsonWithAllFields() {
+ "\"error\":{\"message\":\"error occurred\"}" + "}";
// Act
- ResponseMCPCallItem item = BinaryData.fromString(json).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem item = BinaryData.fromString(json).toObject(ResponseMcpCallItem.class);
// Assert
assertNotNull(item);
@@ -63,7 +63,7 @@ void testTypeIsAlwaysMcpCall() {
+ "\"arguments\":\"{}\"," + "\"server_label\":\"server\"," + "\"name\":\"tool\"" + "}";
// Act
- ResponseMCPCallItem item = BinaryData.fromString(json).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem item = BinaryData.fromString(json).toObject(ResponseMcpCallItem.class);
// Assert
assertEquals(ItemType.MCP_CALL, item.getType());
@@ -76,7 +76,7 @@ void testWithNullOptionalFields() {
+ "\"arguments\":\"{\\\"test\\\":true}\"," + "\"server_label\":\"label\"," + "\"name\":\"toolname\"" + "}";
// Act
- ResponseMCPCallItem item = BinaryData.fromString(json).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem item = BinaryData.fromString(json).toObject(ResponseMcpCallItem.class);
// Assert
assertNotNull(item);
@@ -93,14 +93,14 @@ void testJsonRoundTrip() {
+ "\"name\":\"test-tool\"," + "\"output\":\"result\"" + "}";
// Act
- ResponseMCPCallItem item = BinaryData.fromString(originalJson).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem item = BinaryData.fromString(originalJson).toObject(ResponseMcpCallItem.class);
String serializedJson = BinaryData.fromObject(item).toString();
// Assert
assertNotNull(serializedJson);
// Deserialize again to verify round-trip
- ResponseMCPCallItem deserializedItem
- = BinaryData.fromString(serializedJson).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem deserializedItem
+ = BinaryData.fromString(serializedJson).toObject(ResponseMcpCallItem.class);
assertEquals(item.getId(), deserializedItem.getId());
assertEquals(item.getArguments(), deserializedItem.getArguments());
assertEquals(item.getServerLabel(), deserializedItem.getServerLabel());
@@ -116,7 +116,7 @@ void testComplexArgumentsJson() {
+ "\"name\":\"complex-tool\"" + "}";
// Act
- ResponseMCPCallItem item = BinaryData.fromString(json).toObject(ResponseMCPCallItem.class);
+ ResponseMcpCallItem item = BinaryData.fromString(json).toObject(ResponseMcpCallItem.class);
// Assert
assertNotNull(item.getArguments());
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPListToolItemTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpListToolItemTest.java
similarity index 85%
rename from sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPListToolItemTest.java
rename to sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpListToolItemTest.java
index 8f433cae6786..31d58c0129d1 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMCPListToolItemTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/ResponseMcpListToolItemTest.java
@@ -13,9 +13,9 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
- * Unit tests for {@link ResponseMCPListToolItem}.
+ * Unit tests for {@link ResponseMcpListToolItem}.
*/
-class ResponseMCPListToolItemTest {
+class ResponseMcpListToolItemTest {
@Test
void testFromJsonWithEmptyTools() {
@@ -24,7 +24,7 @@ void testFromJsonWithEmptyTools() {
+ "\"tools\":[]," + "\"server_label\":\"test-server\"" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(json).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(json).toObject(ResponseMcpListToolItem.class);
// Assert
assertNotNull(item);
@@ -45,7 +45,7 @@ void testFromJsonWithMultipleTools() {
+ " \"input_schema\":{\"type\":\"object\"}" + " }" + "]" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(json).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(json).toObject(ResponseMcpListToolItem.class);
// Assert
assertNotNull(item);
@@ -54,7 +54,7 @@ void testFromJsonWithMultipleTools() {
assertNotNull(item.getTools());
assertEquals(2, item.getTools().size());
- List tools = item.getTools();
+ List tools = item.getTools();
assertEquals("get_weather", tools.get(0).getName());
assertEquals("Get weather information", tools.get(0).getDescription());
assertEquals("send_email", tools.get(1).getName());
@@ -68,7 +68,7 @@ void testTypeIsAlwaysMcpListTools() {
+ "\"tools\":[]," + "\"server_label\":\"test\"" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(json).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(json).toObject(ResponseMcpListToolItem.class);
// Assert
assertEquals(ItemType.MCP_LIST_TOOLS, item.getType());
@@ -84,13 +84,13 @@ void testJsonRoundTrip() {
+ "]" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(originalJson).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(originalJson).toObject(ResponseMcpListToolItem.class);
String serializedJson = BinaryData.fromObject(item).toString();
// Assert
assertNotNull(serializedJson);
- ResponseMCPListToolItem deserializedItem
- = BinaryData.fromString(serializedJson).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem deserializedItem
+ = BinaryData.fromString(serializedJson).toObject(ResponseMcpListToolItem.class);
assertEquals(item.getId(), deserializedItem.getId());
assertEquals(item.getServerLabel(), deserializedItem.getServerLabel());
assertEquals(item.getTools().size(), deserializedItem.getTools().size());
@@ -108,12 +108,12 @@ void testToolsWithComplexSchema() {
+ " \"required\":[\"query\"]" + " }" + " }" + "]" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(json).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(json).toObject(ResponseMcpListToolItem.class);
// Assert
assertNotNull(item);
assertEquals(1, item.getTools().size());
- MCPTool tool = item.getTools().get(0);
+ McpTool tool = item.getTools().get(0);
assertEquals("search", tool.getName());
assertEquals("Search for items", tool.getDescription());
assertNotNull(tool.getInputSchema());
@@ -129,12 +129,12 @@ void testToolsWithAnnotations() {
+ " \"annotations\":{\"version\":\"1.0\",\"author\":\"test\"}" + " }" + "]" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(json).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(json).toObject(ResponseMcpListToolItem.class);
// Assert
assertNotNull(item);
assertEquals(1, item.getTools().size());
- MCPTool tool = item.getTools().get(0);
+ McpTool tool = item.getTools().get(0);
assertEquals("annotated_tool", tool.getName());
assertNotNull(tool.getAnnotations());
}
@@ -151,7 +151,7 @@ void testMultipleToolsFromSameServer() {
+ " {\"name\":\"tool5\",\"input_schema\":{\"type\":\"object\"}}" + "]" + "}";
// Act
- ResponseMCPListToolItem item = BinaryData.fromString(json).toObject(ResponseMCPListToolItem.class);
+ ResponseMcpListToolItem item = BinaryData.fromString(json).toObject(ResponseMcpListToolItem.class);
// Assert
assertEquals(5, item.getTools().size());
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/TranscriptionAndIncludeOptionsTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/TranscriptionAndIncludeOptionsTest.java
index 9be1614a3c0e..056ecb8412d4 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/TranscriptionAndIncludeOptionsTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/TranscriptionAndIncludeOptionsTest.java
@@ -104,16 +104,16 @@ void testTranscriptionCompletedWithLogprobsAndPhrases() {
assertEquals(0, event.getContentIndex());
assertEquals("hello world", event.getTranscript());
- List logprobs = event.getLogprobs();
+ List logprobs = event.getLogProbs();
assertNotNull(logprobs);
assertEquals(2, logprobs.size());
assertEquals("hello", logprobs.get(0).getToken());
- assertEquals(-0.12, logprobs.get(0).getLogprob());
+ assertEquals(-0.12, logprobs.get(0).getLogProb());
assertNotNull(logprobs.get(0).getBytes());
assertEquals(5, logprobs.get(0).getBytes().size());
assertEquals(Integer.valueOf(104), logprobs.get(0).getBytes().get(0));
assertEquals(" world", logprobs.get(1).getToken());
- assertEquals(-0.34, logprobs.get(1).getLogprob());
+ assertEquals(-0.34, logprobs.get(1).getLogProb());
List phrases = event.getPhrases();
assertNotNull(phrases);
@@ -141,7 +141,7 @@ void testTranscriptionCompletedWithoutLogprobsOrPhrases() {
assertEquals("hi", event.getTranscript());
assertEquals(3, event.getContentIndex());
- assertNull(event.getLogprobs());
+ assertNull(event.getLogProbs());
assertNull(event.getPhrases());
}
@@ -158,11 +158,11 @@ void testTranscriptionCompletedJsonRoundTripPreservesArrays() {
SessionUpdateConversationItemInputAudioTranscriptionCompleted roundTripped = BinaryData.fromObject(original)
.toObject(SessionUpdateConversationItemInputAudioTranscriptionCompleted.class);
- assertNotNull(roundTripped.getLogprobs());
- assertEquals(1, roundTripped.getLogprobs().size());
- assertEquals("hi", roundTripped.getLogprobs().get(0).getToken());
- assertEquals(-0.5, roundTripped.getLogprobs().get(0).getLogprob());
- assertEquals(Arrays.asList(104, 105), roundTripped.getLogprobs().get(0).getBytes());
+ assertNotNull(roundTripped.getLogProbs());
+ assertEquals(1, roundTripped.getLogProbs().size());
+ assertEquals("hi", roundTripped.getLogProbs().get(0).getToken());
+ assertEquals(-0.5, roundTripped.getLogProbs().get(0).getLogProb());
+ assertEquals(Arrays.asList(104, 105), roundTripped.getLogProbs().get(0).getBytes());
assertNotNull(roundTripped.getPhrases());
assertEquals(1, roundTripped.getPhrases().size());
@@ -178,14 +178,14 @@ void testTranscriptionCompletedPolymorphicViaSessionUpdate() {
+ "\"logprobs\":[{\"token\":\"yo\",\"logprob\":-0.1,\"bytes\":[121,111]}],"
+ "\"phrases\":[{\"offset_milliseconds\":0,\"duration_milliseconds\":50,\"text\":\"yo\"}]}";
- SessionUpdate update = BinaryData.fromString(json).toObject(SessionUpdate.class);
+ SessionServerEvent update = BinaryData.fromString(json).toObject(SessionServerEvent.class);
assertTrue(update instanceof SessionUpdateConversationItemInputAudioTranscriptionCompleted,
"Expected SessionUpdateConversationItemInputAudioTranscriptionCompleted, got " + update.getClass());
SessionUpdateConversationItemInputAudioTranscriptionCompleted typed
= (SessionUpdateConversationItemInputAudioTranscriptionCompleted) update;
- assertNotNull(typed.getLogprobs());
- assertEquals(1, typed.getLogprobs().size());
+ assertNotNull(typed.getLogProbs());
+ assertEquals(1, typed.getLogProbs().size());
assertNotNull(typed.getPhrases());
assertEquals(1, typed.getPhrases().size());
}
@@ -286,9 +286,9 @@ void testOutputTokenDetailsReasoningTokens() {
OutputTokenDetails details = BinaryData.fromString(json).toObject(OutputTokenDetails.class);
- assertEquals(10, details.getTextTokens());
- assertEquals(20, details.getAudioTokens());
- assertEquals(Integer.valueOf(7), details.getReasoningTokens());
+ assertEquals(10, details.getTextTokenCount());
+ assertEquals(20, details.getAudioTokenCount());
+ assertEquals(Integer.valueOf(7), details.getReasoningTokenCount());
}
@Test
@@ -297,7 +297,7 @@ void testOutputTokenDetailsReasoningTokensNullable() {
OutputTokenDetails details = BinaryData.fromString(json).toObject(OutputTokenDetails.class);
- assertNull(details.getReasoningTokens());
+ assertNull(details.getReasoningTokenCount());
}
// -------- ResponseAudioTranscriptAnnotationAdded --------
diff --git a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/WebAndFileSearchTest.java b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/WebAndFileSearchTest.java
index 68c7a6d35024..fbcf546b1b92 100644
--- a/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/WebAndFileSearchTest.java
+++ b/sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/models/WebAndFileSearchTest.java
@@ -231,7 +231,7 @@ void testWebSearchCallCompletedPolymorphicViaSessionUpdate() {
String json = "{\"type\":\"response.web_search_call.completed\",\"event_id\":\"e4\","
+ "\"response_id\":\"r4\",\"item_id\":\"i4\",\"output_index\":2,\"sequence_number\":7}";
- SessionUpdate update = BinaryData.fromString(json).toObject(SessionUpdate.class);
+ SessionServerEvent update = BinaryData.fromString(json).toObject(SessionServerEvent.class);
assertTrue(update instanceof ServerEventResponseWebSearchCallCompleted,
"Expected ServerEventResponseWebSearchCallCompleted, got " + update.getClass());
diff --git a/sdk/voicelive/azure-ai-voicelive/tsp-location.yaml b/sdk/voicelive/azure-ai-voicelive/tsp-location.yaml
index 5dca041d3058..e0aa3c5e6d9c 100644
--- a/sdk/voicelive/azure-ai-voicelive/tsp-location.yaml
+++ b/sdk/voicelive/azure-ai-voicelive/tsp-location.yaml
@@ -1,4 +1,4 @@
directory: specification/ai/data-plane/VoiceLive
-commit: 1336b57a1c46df56e5190738f06504b65fad5ca9
+commit: eca370c584051b74254a685f9b7f60c9683a9c26
repo: Azure/azure-rest-api-specs
additionalDirectories: