UNPKG

openvino-genai-node

Version:

OpenVINO™ GenAI pipelines for using from Node.js environment

73 lines (72 loc) 3.39 kB
import { Tensor } from "openvino-node"; import { PerfMetrics, VLMPerfMetrics, WhisperPerfMetrics, Text2SpeechPerfMetrics } from "./perfMetrics.js"; import { GenerationFinishReason } from "./utils.js"; /** * Structure to store resulting batched text outputs and scores for each batch. * @note The first num_return_sequences elements correspond to the first batch element. */ export declare class DecodedResults { /** * @param {string[]} texts - Vector of resulting sequences. * @param {number[]} scores - Scores for each sequence. * @param {PerfMetrics} perfMetrics - Performance metrics (tpot, ttft, etc.). * @param {Record<string, unknown>[]} parsed - The results of parsers processing for each sequence. * @param {GenerationFinishReason[]} finishReasons - Finish reasons for each sequence. */ constructor(texts: string[], scores: number[], perfMetrics: PerfMetrics, parsed: Record<string, unknown>[], finishReasons?: GenerationFinishReason[]); toString(): string; texts: string[]; scores: number[]; perfMetrics: PerfMetrics; parsed: Record<string, unknown>[]; finishReasons: GenerationFinishReason[]; } /** * Structure to store VLM resulting batched text outputs and scores for each batch. * @note The first num_return_sequences elements correspond to the first batch element. */ export declare class VLMDecodedResults extends DecodedResults { /** * @param {string[]} texts - Vector of resulting sequences. * @param {number[]} scores - Scores for each sequence. * @param {VLMPerfMetrics} perfMetrics - VLM-specific performance metrics. * @param {Record<string, unknown>[]} parsed - The results of parsers processing for each sequence. * @param {GenerationFinishReason[]} finishReasons - Finish reasons for each sequence. */ constructor(texts: string[], scores: number[], perfMetrics: VLMPerfMetrics, parsed: Record<string, unknown>[], finishReasons?: GenerationFinishReason[]); /** VLM specific performance metrics. */ perfMetrics: VLMPerfMetrics; } /** Whisper decoded result chunk (when return_timestamps or word_timestamps is enabled). */ export type WhisperDecodedResultChunk = { text: string; startTs: number; endTs: number; }; /** Word-level timing (when word_timestamps is enabled). */ export type WhisperWordTiming = { word: string; startTs: number; endTs: number; /** Word token identifiers as `BigInt64Array`. */ tokenIds?: BigInt64Array; }; /** * Result of WhisperPipeline.generate() with texts, scores, perf metrics, and optional timestamps. */ export declare class WhisperDecodedResults extends DecodedResults { chunks?: WhisperDecodedResultChunk[] | undefined; words?: WhisperWordTiming[] | undefined; constructor(texts: string[], scores: number[], perfMetrics: WhisperPerfMetrics, chunks?: WhisperDecodedResultChunk[] | undefined, words?: WhisperWordTiming[] | undefined); /** Whisper-specific performance metrics. */ perfMetrics: WhisperPerfMetrics; } /** * Result of Text2SpeechPipeline.generate() with audio tensors and perf metrics. * Each element in `speeches` is an audio waveform tensor sampled at 16 kHz. */ export declare class Text2SpeechDecodedResults { constructor(speeches: Tensor[], perfMetrics: Text2SpeechPerfMetrics); speeches: Tensor[]; perfMetrics: Text2SpeechPerfMetrics; }