Interface TranscribePiecesOptions

How the job runs.

interface TranscribePiecesOptions {
    sentences: ((text) => readonly {
        start: number;
        end: number;
    }[]);
    attempts?: number;
    inFlight?: number;
    previousText?: string;
    signal?: AbortSignal;
    onPiece?: ((outcome) => void | Promise<void>);
}

Properties

sentences: ((text) => readonly {
    start: number;
    end: number;
}[])

The sentence spans of a text; the prompt is the last of them.

Type declaration

    • (text): readonly {
          start: number;
          end: number;
      }[]
    • Parameters

      • text: string

      Returns readonly {
          start: number;
          end: number;
      }[]

attempts?: number

Tries a piece gets in all. A fraction is rounded down; a non-finite value takes the default.

Default

3
inFlight?: number

Pieces sent at once, 1 to 4. A fraction is rounded down; a non-finite value takes the default.

Default

1
previousText?: string

The text before the first piece given, when a run starts again from a piece.

signal?: AbortSignal

Ends the job: no further try is made, and the job rejects with the signal's reason. Every transcribe call is given it.

onPiece?: ((outcome) => void | Promise<void>)

Called serially with each piece, in order, as it and every piece before it finish, even during a source read.

Type declaration

    • (outcome): void | Promise<void>
    • Parameters

      Returns void | Promise<void>