Skip to content

feat(java): add streaming ASR SDK - #1120

Open
Mason Chen (jiec-msft) wants to merge 19 commits into
mainfrom
java/sdk-preview
Open

Mason Chen (jiec-msft) wants to merge 19 commits into
mainfrom
java/sdk-preview

Conversation

@jiec-msft

Copy link
Copy Markdown
Member

Adds a Java 17 SDK for Foundry Local streaming ASR through JNA.

  • Streaming API - Supports reusable model and session ownership, PCM and WAV input, cancellation, final results, timing data, and deterministic cleanup.
  • Packaging - Produces standard Maven binary and sources JARs while keeping native runtimes and model weights external.
  • Validation - Adds focused lifecycle, native-contract, audio-validation, and opt-in real-model integration tests.
  • CI - Adds a five-platform Azure matrix, resolves Java 17 for each target architecture, and bootstraps pinned Maven 3.9.9 on self-hosted agents.

The existing preview release remains unchanged.

Earlier PRs: #1094 and #1100.

Supersedes #1113 to run from a branch in this repository.

Add a Java 17 JNA binding for reusable-model PCM transcription, final results, cancellation, and deterministic cleanup. Package a normal Maven SDK and sources JAR while keeping native runtimes and model weights external.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build and test the Java 17 SDK from the team preview branch, derive a fixed version from the source tag, reject shaded JNA or Gson classes, and upload the exact first-party JAR with checksum evidence.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move checkout, Java setup, and artifact upload to their current Node 24-based major versions so preview builds do not rely on deprecated action runtimes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 19, 2026 04:02
@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foundry-local Ready Ready Preview Sep 19, 2026 5:42am UTC

Request Review

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.

Copilot review overview

🔵 Needs a closer look

The new cross-platform JNA ABI and concurrent native-resource lifecycle warrant final human validation despite extensive test coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds a Java 17 streaming-ASR SDK backed by JNA, with deterministic native ownership, validation, packaging, tests, and cross-platform CI.

Changes:

  • Adds Java APIs for model management, PCM/WAV streaming, cancellation, results, and timing.
  • Adds Maven packaging plus unit and native integration tests.
  • Adds five-platform Azure validation and shared build-script integration.
File Description
sdk_v2/​java/​THIRD_PARTY_NOTICES.md Documents JNA and external asset licensing.
sdk_v2/​java/​src/​test/​java/​com/​microsoft/​foundry/​local/​TranscriptionStateTest.java Tests transcription lifecycle races.
sdk_v2/​java/​src/​test/​java/​com/​microsoft/​foundry/​local/​NativeContractTest.java Validates ABI and native contracts.
sdk_v2/​java/​src/​test/​java/​com/​microsoft/​foundry/​local/​NativeAsrTest.java Adds opt-in native ASR integration coverage.
sdk_v2/​java/​src/​test/​java/​com/​microsoft/​foundry/​local/​AudioValidationTest.java Tests PCM, WAV, and configuration validation.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​WavAudio.java Implements bounded WAV parsing.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​TranscriptionTiming.java Defines transcription timing data.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​TranscriptionResult.java Defines final transcription results.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​Transcription.java Implements streaming request lifecycle.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​SpeechEvent.java Defines streaming speech events.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​PcmFormat.java Validates supported PCM input.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​NativeApi.java Provides the JNA C-ABI binding.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​ModelNotFoundException.java Adds exact-model lookup errors.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​ModelInfo.java Exposes immutable model metadata.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​Model.java Implements model operations and sessions.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​FoundryLocalManager.java Owns native manager resources.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​FoundryLocalException.java Exposes native error codes.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​Configuration.java Defines explicit runtime paths.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​Catalog.java Implements catalog queries.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​CancellationToken.java Adds download cancellation.
sdk_v2/​java/​src/​main/​java/​com/​microsoft/​foundry/​local/​AudioSession.java Manages sequential ASR requests.
sdk_v2/​java/​README.md Documents setup and usage.
sdk_v2/​java/​pom.xml Configures Maven build and packaging.
sdk_v2/​java/​build.ps1 Adds reproducible Java builds.
sdk_v2/​java/​.gitignore Excludes Java build outputs.
sdk_v2/​DEVELOPMENT.md Adds Java prerequisites and workflow.
sdk_v2/​build_and_test_all.ps1 Integrates Java verification.
.pipelines/​templates/​steps-resolve-java.yml Resolves JDK 17 by architecture.
.pipelines/​templates/​steps-build-java.yml Builds and native-tests Java.
.pipelines/​templates/​steps-bootstrap-maven.yml Bootstraps pinned Maven.
.pipelines/​templates/​stages-sdk-v2.yml Adds the Java pipeline stage.
.pipelines/​templates/​stages-java.yml Defines five-platform Java CI.
.pipelines/​templates/​fetch-models-from-artifacts-feed.yml Supports targeted ASR model fetching.

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

The 1ES Guardian integration reports gdn.unknownFormatResult for the generated SpotBugs report instead of actionable findings. Disable that scanner with the required justification so Java bundle packaging can complete.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants