From 1664413661902311eb56ddbab213ef565a53f609 Mon Sep 17 00:00:00 2001 From: Ramaz Tskhadadze Date: Wed, 15 Apr 2026 17:40:08 +0400 Subject: [PATCH 1/3] feat[api]: export RuntimeStats interface in NMT addon index.d.ts Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/qvac-lib-infer-nmtcpp/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/qvac-lib-infer-nmtcpp/index.d.ts b/packages/qvac-lib-infer-nmtcpp/index.d.ts index e8f3a3557c..9c64f29875 100644 --- a/packages/qvac-lib-infer-nmtcpp/index.d.ts +++ b/packages/qvac-lib-infer-nmtcpp/index.d.ts @@ -41,6 +41,15 @@ export interface InferenceClientState { destroyed: boolean } +export interface RuntimeStats { + totalTokens: number + totalTime: number + decodeTime: number + TPS: number + encodeTime?: number + TTFT?: number +} + export default class TranslationNmtcpp { static readonly ModelTypes: TranslationNmtcppModelTypes constructor(args: TranslationNmtcppArgs) From e7c87b8039e22833ae8711c6b269b822f07da0dd Mon Sep 17 00:00:00 2001 From: Ramaz Tskhadadze Date: Wed, 15 Apr 2026 22:38:14 +0400 Subject: [PATCH 2/3] chore: bump @qvac/translation-nmtcpp to 2.0.2 and update changelog Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/qvac-lib-infer-nmtcpp/CHANGELOG.md | 6 ++++++ packages/qvac-lib-infer-nmtcpp/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/qvac-lib-infer-nmtcpp/CHANGELOG.md b/packages/qvac-lib-infer-nmtcpp/CHANGELOG.md index 1bd617ca1b..4f87dd6621 100644 --- a/packages/qvac-lib-infer-nmtcpp/CHANGELOG.md +++ b/packages/qvac-lib-infer-nmtcpp/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.2] - 2026-04-15 + +### Added + +- Exported `RuntimeStats` interface in `index.d.ts` with fields: `totalTokens`, `totalTime`, `decodeTime`, `TPS` (required), `encodeTime`, `TTFT` (optional — GGML backend only). Matches C++ backend output for SDK type-safety. + ## [2.0.1] - 2026-04-13 ### Changed diff --git a/packages/qvac-lib-infer-nmtcpp/package.json b/packages/qvac-lib-infer-nmtcpp/package.json index e879d61f2d..28028440bc 100644 --- a/packages/qvac-lib-infer-nmtcpp/package.json +++ b/packages/qvac-lib-infer-nmtcpp/package.json @@ -1,6 +1,6 @@ { "name": "@qvac/translation-nmtcpp", - "version": "2.0.1", + "version": "2.0.2", "description": "translation addon for qvac", "addon": true, "engines": { From 27cd392e1ef6f75817d644459bc365c1abe8853a Mon Sep 17 00:00:00 2001 From: Ramaz Tskhadadze Date: Mon, 4 May 2026 13:33:31 +0400 Subject: [PATCH 3/3] =?UTF-8?q?doc:=20document=20RuntimeStats=20units=20an?= =?UTF-8?q?d=20per-backend=20fields;=20fix=20README=20ms=E2=86=92s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address review on PR #1613: - Add JSDoc to `RuntimeStats` clarifying that `totalTime`/`encodeTime`/ `decodeTime` are seconds while `TTFT` is milliseconds, and listing which fields each backend emits (Bergamot omits `encodeTime`/`TTFT`). Note that pivot translations use prefixed keys. - Fix README quickstart that printed `totalTime` with a `'ms'` label even though the C++ producer emits seconds. --- packages/qvac-lib-infer-nmtcpp/README.md | 2 +- packages/qvac-lib-infer-nmtcpp/index.d.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/qvac-lib-infer-nmtcpp/README.md b/packages/qvac-lib-infer-nmtcpp/README.md index c4b439f53d..0d6367be19 100644 --- a/packages/qvac-lib-infer-nmtcpp/README.md +++ b/packages/qvac-lib-infer-nmtcpp/README.md @@ -368,7 +368,7 @@ try { // Access performance statistics (if enabled with opts.stats) if (response.stats) { - console.log('Translation completed in:', response.stats.totalTime, 'ms') + console.log('Translation completed in:', response.stats.totalTime, 's') } } catch (error) { console.error('Translation failed:', error) diff --git a/packages/qvac-lib-infer-nmtcpp/index.d.ts b/packages/qvac-lib-infer-nmtcpp/index.d.ts index 6392a29972..41e996a67b 100644 --- a/packages/qvac-lib-infer-nmtcpp/index.d.ts +++ b/packages/qvac-lib-infer-nmtcpp/index.d.ts @@ -93,6 +93,22 @@ export interface InferenceClientState { destroyed: boolean } +/** + * Stats returned via `response.stats` when the addon is constructed with + * `opts.stats = true`. Field set differs by backend: + * + * - Bergamot emits: `totalTokens`, `totalTime`, `decodeTime`, `TPS`. + * - GGML/IndicTrans emits the above plus `encodeTime` and `TTFT`. + * + * Units: + * - `totalTime`, `encodeTime`, `decodeTime` — seconds (double). + * - `TTFT` (Time-To-First-Token) — milliseconds (double). + * - `TPS` (Tokens-Per-Second) — tokens / second (double). + * - `totalTokens` — integer count. + * + * Note: pivot translations may emit keys prefixed with the model name + * (e.g. `"BERGAMOT : ->TPS"`). This interface models the non-pivot shape. + */ export interface RuntimeStats { totalTokens: number totalTime: number