[Node.js API] Improve JSDocs of stream() and generate() methods. Fix autocompletion of LLMPipeline#3673
Open
almilosz wants to merge 11 commits intoopenvinotoolkit:masterfrom
Open
[Node.js API] Improve JSDocs of stream() and generate() methods. Fix autocompletion of LLMPipeline#3673almilosz wants to merge 11 commits intoopenvinotoolkit:masterfrom
almilosz wants to merge 11 commits intoopenvinotoolkit:masterfrom
Conversation
almilosz
commented
Apr 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the developer experience of the Node.js GenAI pipelines by refining JSDoc for stream() / generate() methods and tightening TypeScript typings for the LLMPipeline factory to restore proper TS autocompletion.
Changes:
- Expanded/clarified JSDoc for
stream()andgenerate()across LLM/VLM/Whisper pipelines, including usage examples and guidance on when to use each API. - Updated
PipelineFactory.LLMPipelineoverload return types fromPromise<any>toPromise<LLM>to improve TypeScript autocompletion.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/js/lib/pipelines/whisperPipeline.ts |
Improves JSDoc for ASR streaming and generation APIs. |
src/js/lib/pipelines/vlmPipeline.ts |
Improves JSDoc for VLM streaming vs. generate usage and option fields. |
src/js/lib/pipelines/llmPipeline.ts |
Improves JSDoc for LLM stream()/generate() including examples and clarified behavior. |
src/js/lib/index.ts |
Tightens TS overload return types for LLMPipeline factory to return Promise<LLM>. |
Comments suppressed due to low confidence (1)
src/js/lib/pipelines/whisperPipeline.ts:73
- stream() accepts
options?: WhisperGenerateOptions, butWhisperGenerateOptionsincludesstreamer, which is ignored by stream() (stream() always uses its own internal streamer). Either omitstreamerfrom the stream() options type (e.g., use Omit<WhisperGenerateOptions, 'streamer'>) or explicitly document thatoptions.streameris not supported/has no effect for stream().
stream(
rawSpeech: RawSpeechInput,
options?: WhisperGenerateOptions,
): AsyncIterableIterator<string> {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/js/lib/pipelines/whisperPipeline.ts:72
stream()takesoptions?: WhisperGenerateOptions, butWhisperGenerateOptionsincludes astreamercallback thatstream()ignores. This is confusing for users (the type suggestsstreameris supported here). Consider narrowing thestream()options type to onlygenerationConfig(or explicitly document thatoptions.streameris ignored andgenerate()should be used for custom streaming control).
* Stream speech recognition results as an async iterator.
*
* For custom streaming control, use {@link generate} with a streamer callback instead.
*
* @param rawSpeech - Audio samples as Float32Array or number[], normalized to ~[-1, 1], 16 kHz.
* @param options - Optional generation config (e.g. language, task, return_timestamps).
* @returns Async iterator that yields decoded text chunks as strings.
*/
stream(
rawSpeech: RawSpeechInput,
options?: WhisperGenerateOptions,
Contributor
Retribution98
left a comment
There was a problem hiding this comment.
It looks good! Could we align example section in JSDocs for these pipelines?
Retribution98
approved these changes
Apr 15, 2026
yatarkan
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
streamandgeneratemethods in LLMPipeline, VLMPipeline and WhisperPipelineLLMPipelinefactory method fromPromise<any>toPromise<LLM>- autocompletion in TS was not available.CVS-182434
Checklist: