Skip to content

[Node.js API] Improve JSDocs of stream() and generate() methods. Fix autocompletion of LLMPipeline#3673

Open
almilosz wants to merge 11 commits intoopenvinotoolkit:masterfrom
almilosz:almilosz/llm-stream
Open

[Node.js API] Improve JSDocs of stream() and generate() methods. Fix autocompletion of LLMPipeline#3673
almilosz wants to merge 11 commits intoopenvinotoolkit:masterfrom
almilosz:almilosz/llm-stream

Conversation

@almilosz
Copy link
Copy Markdown
Contributor

@almilosz almilosz commented Apr 9, 2026

  • Expanded JSDoc comments for the stream and generate methods in LLMPipeline, VLMPipeline and WhisperPipeline
  • changed the return type of the static LLMPipeline factory method from Promise<any> to Promise<LLM> - autocompletion in TS was not available.

CVS-182434

Checklist:

  • This PR follows GenAI Contributing guidelines.
  • Tests have been updated or added to cover the new code. - only JSDoc/type-only update
  • This PR fully addresses the ticket.
  • I have made corresponding changes to the documentation. JSDoc/type-only update

Copilot AI review requested due to automatic review settings April 9, 2026 11:22
@github-actions github-actions Bot added the category: JS API GenAI JS API label Apr 9, 2026
Comment thread src/js/lib/pipelines/whisperPipeline.ts
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 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() and generate() across LLM/VLM/Whisper pipelines, including usage examples and guidance on when to use each API.
  • Updated PipelineFactory.LLMPipeline overload return types from Promise<any> to Promise<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, but WhisperGenerateOptions includes streamer, which is ignored by stream() (stream() always uses its own internal streamer). Either omit streamer from the stream() options type (e.g., use Omit<WhisperGenerateOptions, 'streamer'>) or explicitly document that options.streamer is not supported/has no effect for stream().
  stream(
    rawSpeech: RawSpeechInput,
    options?: WhisperGenerateOptions,
  ): AsyncIterableIterator<string> {

Comment thread src/js/lib/pipelines/whisperPipeline.ts Outdated
Comment thread src/js/lib/pipelines/llmPipeline.ts Outdated
Comment thread src/js/lib/pipelines/vlmPipeline.ts Outdated
Comment thread src/js/lib/index.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 9, 2026 13:18
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

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

Comment thread src/js/lib/pipelines/whisperPipeline.ts
Comment thread src/js/lib/pipelines/whisperPipeline.ts
Copilot AI review requested due to automatic review settings April 9, 2026 13:34
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

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

Comment thread src/js/lib/pipelines/llmPipeline.ts Outdated
Comment thread src/js/lib/pipelines/llmPipeline.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 9, 2026 13:40
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

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() takes options?: WhisperGenerateOptions, but WhisperGenerateOptions includes a streamer callback that stream() ignores. This is confusing for users (the type suggests streamer is supported here). Consider narrowing the stream() options type to only generationConfig (or explicitly document that options.streamer is ignored and generate() 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,

Comment thread src/js/lib/pipelines/llmPipeline.ts Outdated
Comment thread src/js/lib/pipelines/vlmPipeline.ts Outdated
Copy link
Copy Markdown
Contributor

@Retribution98 Retribution98 left a comment

Choose a reason for hiding this comment

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

It looks good! Could we align example section in JSDocs for these pipelines?

Comment thread src/js/lib/pipelines/llmPipeline.ts Outdated
Comment thread src/js/lib/pipelines/llmPipeline.ts
Comment thread src/js/lib/pipelines/vlmPipeline.ts Outdated
Comment thread src/js/lib/pipelines/whisperPipeline.ts
Comment thread src/js/lib/pipelines/whisperPipeline.ts Outdated
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

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

Comment thread src/js/lib/pipelines/llmPipeline.ts Outdated
Comment thread src/js/lib/pipelines/vlmPipeline.ts
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

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

Comment thread src/js/lib/pipelines/llmPipeline.ts
Comment thread src/js/lib/pipelines/whisperPipeline.ts
@yatarkan yatarkan added this pull request to the merge queue Apr 17, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Apr 17, 2026
@as-suvorov as-suvorov added this pull request to the merge queue Apr 20, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: JS API GenAI JS API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants