Skip to content

Feature/js sdk responses api#504

Open
MaanavD wants to merge 2 commits intomainfrom
feature/js-sdk-responses-api
Open

Feature/js sdk responses api#504
MaanavD wants to merge 2 commits intomainfrom
feature/js-sdk-responses-api

Conversation

@MaanavD
Copy link
Copy Markdown
Collaborator

@MaanavD MaanavD commented Mar 10, 2026

This pull request introduces comprehensive support for audio transcription (speech-to-text) using Whisper models in the Foundry Local SDK, alongside unified chat and audio capabilities. It adds new documentation, sample apps, and code examples demonstrating how to use both chat and audio features through a single SDK, highlighting automatic hardware acceleration and simplified integration. The updates make it easier for developers to build applications that combine text generation and speech-to-text without needing separate runtimes or hardware detection code.

Documentation and SDK feature updates:

  • Updated README.md and docs/README.md to clarify that Foundry Local now supports both chat (text generation) and audio transcription (speech-to-text) in a single runtime, with automatic hardware acceleration and unified APIs. Added tables listing supported tasks, model aliases, and API usage. [1] [2]
  • Expanded sample listings in documentation to include new JavaScript samples for chat, audio transcription, tool calling, and combined chat+audio apps. [1] [2]

New sample applications and examples:

  • Added samples/js/audio-transcription-foundry-local sample, including a detailed README, package.json, and implementation in src/app.js, showing how to load Whisper models and transcribe audio files (standard and streaming modes). [1] [2] [3]
  • Added samples/js/chat-and-audio-foundry-local sample, with README, package.json, and implementation in src/app.js, demonstrating unified management of chat and audio models, transcribing audio, and analyzing the transcription with a chat model. [1] [2] [3]

SDK example enhancements:

  • Introduced a new TypeScript example audio-transcription.ts in sdk_v2/js/examples, showcasing programmatic use of Whisper models for audio transcription, including model discovery, download, loading, and both standard and streaming transcription.
  • Added responses.ts example to sdk_v2/js/examples, demonstrating the Responses API for text generation, streaming, multi-turn conversations, tool calling, and response management.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 10, 2026

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

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Mar 27, 2026 9:16pm

Request Review

…and SDK examples

- Update README.md to prominently feature audio transcription (STT) alongside
  chat completions, including a Supported Tasks table, JS code examples for
  audio transcription and unified chat+audio, and updated Features section
- Add samples/js/audio-transcription-foundry-local: standalone Whisper STT sample
- Add samples/js/chat-and-audio-foundry-local: unified chat + audio sample
  demonstrating single FoundryLocalManager managing both model types
- Add sdk_v2/js/examples/audio-transcription.ts: TypeScript audio example
- Update docs/README.md with capabilities table and sample links

Addresses the discoverability gap where LLMs and developers do not know
Foundry Local supports audio transcription via Whisper models.
@MaanavD MaanavD force-pushed the feature/js-sdk-responses-api branch from 5c043bb to 16f4488 Compare March 27, 2026 20:56
Copilot AI review requested due to automatic review settings March 27, 2026 20:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the Foundry Local JavaScript developer experience by adding a new audio transcription (Whisper) sample and updating top-level documentation to show unified chat + audio usage via the JS SDK.

Changes:

  • Added a JS sample app demonstrating Whisper model download/load and transcription.
  • Added sample-scoped documentation and npm manifest for running the new sample.
  • Updated the root README with richer JS examples for chat, audio transcription, and combined workflows.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
samples/js/audio-transcription-foundry-local/src/app.js New sample implementation for standard + streaming audio transcription.
samples/js/audio-transcription-foundry-local/package.json Adds a runnable npm package manifest for the sample.
samples/js/audio-transcription-foundry-local/README.md Adds setup/run instructions and explains what the sample demonstrates.
README.md Updates documentation examples for chat, audio transcription, and combined usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +22
Install the Foundry Local SDK:

```bash
npm install foundry-local-sdk
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This sample has a package.json with foundry-local-sdk already listed as a dependency, but the README instructs npm install foundry-local-sdk. That can leave users without the locked dependency tree for the sample; prefer npm install (then npm start / node src/app.js) from the sample directory.

Suggested change
Install the Foundry Local SDK:
```bash
npm install foundry-local-sdk
From this sample's directory, install dependencies:
```bash
npm install

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +56
await audioClient.transcribeStreaming(audioFilePath, (chunk) => {
process.stdout.write(chunk.text);
});
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

AudioClient.transcribeStreaming in the JS SDK returns an AsyncIterable and does not take a callback parameter. Calling it as await audioClient.transcribeStreaming(audioFilePath, (chunk) => ...) will throw/compile-fail; update the sample to iterate the returned stream (e.g., with for await ... of) and write each chunk.

Suggested change
await audioClient.transcribeStreaming(audioFilePath, (chunk) => {
process.stdout.write(chunk.text);
});
const stream = await audioClient.transcribeStreaming(audioFilePath);
for await (const chunk of stream) {
process.stdout.write(chunk.text);
}

Copilot uses AI. Check for mistakes.
"start": "node src/app.js"
},
"dependencies": {
"foundry-local-sdk": "latest"
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Using the "latest" npm dist-tag makes this sample non-reproducible and can break unexpectedly when a new major version is published. Prefer a semver range (e.g. ^<current version>) or a workspace/file reference so the sample remains stable over time.

Suggested change
"foundry-local-sdk": "latest"
"foundry-local-sdk": "^1.0.0"

Copilot uses AI. Check for mistakes.
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