Skip to content

Add Voice Live SDK identification - #50324

Open
Mike Guo (guotuofeng) wants to merge 1 commit into
mainfrom
myguo/voice-live-id
Open

Add Voice Live SDK identification#50324
Mike Guo (guotuofeng) wants to merge 1 commit into
mainfrom
myguo/voice-live-id

Conversation

@guotuofeng

Copy link
Copy Markdown
Member

Description

Add the standard Azure SDK identifier to Voice Live WebSocket connections through the User-Agent header and the x-ms-client-sdk query parameter. Preserve client and request-level overrides and existing endpoint query parameters.

Ports Azure/azure-sdk-for-python#48848 to the Java SDK.

Testing

  • mvn -f sdk/voicelive/azure-ai-voicelive/pom.xml -Dtest="com.azure.ai.voicelive.unit.**" test (346 tests passed)
  • git diff --check

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
35 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Current raw-query decoding uses URLDecoder, which will treat + as space and can mutate existing endpoint query parameter values when converting to the WebSocket URI.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds standard Azure SDK identification metadata to Voice Live WebSocket connections by ensuring a consistent SDK User-Agent and by adding an x-ms-client-sdk query parameter (while preserving existing endpoint query params and allowing overrides).

Changes:

  • Build a standard Azure SDK user-agent string in VoiceLiveClientBuilder and propagate it to VoiceLiveAsyncClient.
  • Add x-ms-client-sdk to the WebSocket URI and switch query handling to raw-query parsing + explicit encoding/decoding.
  • Expand unit tests to cover SDK identification, query-parameter preservation, and header override precedence.
File summaries
File Description
sdk/voicelive/azure-ai-voicelive/src/main/java/com/azure/ai/voicelive/VoiceLiveClientBuilder.java Constructs the SDK user-agent and sets up default/overridable headers for the client.
sdk/voicelive/azure-ai-voicelive/src/main/java/com/azure/ai/voicelive/VoiceLiveAsyncClient.java Adds SDK identification via x-ms-client-sdk and rewrites query parsing/encoding for WebSocket URI creation.
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/unit/VoiceLiveRequestOptionsClientTest.java Adds tests for x-ms-client-sdk, query preservation, and request header overrides.
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/unit/VoiceLiveClientBuilderTest.java Adds tests validating default telemetry user-agent behavior and custom User-Agent override behavior.
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/unit/VoiceLiveAsyncClientTest.java Updates reflective construction to match the new async client constructor signature.
sdk/voicelive/azure-ai-voicelive/CHANGELOG.md Documents the addition of SDK identification in WebSocket connections.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +304 to +310
private static String decodeQueryParameter(String value) {
try {
return URLDecoder.decode(value, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding is not supported", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants