Skip to content

EagerLLMController

Manages the eager/speculative LLM pipeline.

Defined in: src/core/collaborators/EagerLLMController.ts:30

Manages the eager/speculative LLM pipeline.

Remarks

When the STT provider emits a preflight signal (e.g., DeepgramFlux’s early end-of-turn detection), this controller manages the lifecycle of speculative LLM generation: starting it, reconciling it with the confirmed speech_final text, and cancelling it when needed.

Constructors

Constructor

new EagerLLMController(config?, logger?): EagerLLMController;

Defined in: src/core/collaborators/EagerLLMController.ts:34

Parameters

ParameterType
config?EagerLLMConfig
logger?Logger

Returns

EagerLLMController

Accessors

currentPreflightText

Get Signature

get currentPreflightText(): string | null;

Defined in: src/core/collaborators/EagerLLMController.ts:50

The preflight text used for the current speculative generation.

Returns

string | null


enabled

Get Signature

get enabled(): boolean;

Defined in: src/core/collaborators/EagerLLMController.ts:40

Whether the eager LLM pipeline is enabled in configuration.

Returns

boolean


isActive

Get Signature

get isActive(): boolean;

Defined in: src/core/collaborators/EagerLLMController.ts:45

Whether a speculative generation is currently in flight.

Returns

boolean

Methods

cancel()

cancel(): void;

Defined in: src/core/collaborators/EagerLLMController.ts:145

Cancel any in-flight speculative generation.

Returns

void


reconcile()

reconcile(confirmedText): ReconcileResult;

Defined in: src/core/collaborators/EagerLLMController.ts:100

Reconcile a preflight generation with confirmed speech_final text.

Parameters

ParameterTypeDescription
confirmedTextstringThe confirmed final transcript text.

Returns

ReconcileResult

The reconciliation action to take.

Remarks

Compares the preflight text against the confirmed text using word-overlap similarity:

  • 'keep': similarity is at or above threshold; let the speculative generation complete.
  • 'restart': similarity is below threshold and cancelOnTextChange is true; the caller should abort and restart with the confirmed text.
  • 'accept-anyway': similarity is below threshold but cancelOnTextChange is false; accept the speculative result despite text difference.

After reconciliation, the eager state is always cleared.


reset()

reset(): void;

Defined in: src/core/collaborators/EagerLLMController.ts:159

Reset all eager state without aborting.

Returns

void

Remarks

Used when the eager generation completes naturally or is superseded by a confirmed result.


startSpeculative()

startSpeculative(text): AbortSignal;

Defined in: src/core/collaborators/EagerLLMController.ts:65

Start a speculative LLM generation based on preflight text.

Parameters

ParameterTypeDescription
textstringThe provisional transcript text from the preflight event.

Returns

AbortSignal

The AbortSignal for the new speculative generation.

Remarks

If a previous speculative generation is already running, it is aborted first. Returns an AbortSignal that can be passed to the LLM generation call so it can be cancelled.

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency