@trymirai/uzu 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -6
- package/bridging/classificationLabel.d.mts +12 -0
- package/bridging/classificationLabel.d.mts.map +1 -0
- package/bridging/classificationLabel.d.ts +12 -0
- package/bridging/classificationLabel.d.ts.map +1 -0
- package/bridging/classificationLabel.js +26 -0
- package/bridging/classificationLabel.js.map +1 -0
- package/bridging/classificationLabel.mjs +22 -0
- package/bridging/classificationLabel.mjs.map +1 -0
- package/bridging/classificationOutput.d.mts +10 -0
- package/bridging/classificationOutput.d.mts.map +1 -0
- package/bridging/classificationOutput.d.ts +10 -0
- package/bridging/classificationOutput.d.ts.map +1 -0
- package/bridging/classificationOutput.js +16 -0
- package/bridging/classificationOutput.js.map +1 -0
- package/bridging/classificationOutput.mjs +12 -0
- package/bridging/classificationOutput.mjs.map +1 -0
- package/bridging/classificationSession.d.mts +9 -0
- package/bridging/classificationSession.d.mts.map +1 -0
- package/bridging/classificationSession.d.ts +9 -0
- package/bridging/classificationSession.d.ts.map +1 -0
- package/bridging/classificationSession.js +16 -0
- package/bridging/classificationSession.js.map +1 -0
- package/bridging/classificationSession.mjs +12 -0
- package/bridging/classificationSession.mjs.map +1 -0
- package/bridging/classificationStats.d.mts +14 -0
- package/bridging/classificationStats.d.mts.map +1 -0
- package/bridging/classificationStats.d.ts +14 -0
- package/bridging/classificationStats.d.ts.map +1 -0
- package/bridging/classificationStats.js +20 -0
- package/bridging/classificationStats.js.map +1 -0
- package/bridging/classificationStats.mjs +16 -0
- package/bridging/classificationStats.mjs.map +1 -0
- package/bridging/engine.d.mts +14 -6
- package/bridging/engine.d.mts.map +1 -1
- package/bridging/engine.d.ts +14 -6
- package/bridging/engine.d.ts.map +1 -1
- package/bridging/engine.js +53 -23
- package/bridging/engine.js.map +1 -1
- package/bridging/engine.mjs +53 -23
- package/bridging/engine.mjs.map +1 -1
- package/bridging/model.d.mts +19 -0
- package/bridging/model.d.mts.map +1 -0
- package/bridging/model.d.ts +19 -0
- package/bridging/model.d.ts.map +1 -0
- package/bridging/model.js +39 -0
- package/bridging/model.js.map +1 -0
- package/bridging/model.mjs +35 -0
- package/bridging/model.mjs.map +1 -0
- package/bridging/modelKind.d.mts +8 -0
- package/bridging/modelKind.d.mts.map +1 -0
- package/bridging/modelKind.d.ts +8 -0
- package/bridging/modelKind.d.ts.map +1 -0
- package/bridging/modelKind.js +30 -0
- package/bridging/modelKind.js.map +1 -0
- package/bridging/modelKind.mjs +25 -0
- package/bridging/modelKind.mjs.map +1 -0
- package/bridging/modelType.d.mts +3 -2
- package/bridging/modelType.d.mts.map +1 -1
- package/bridging/modelType.d.ts +3 -2
- package/bridging/modelType.d.ts.map +1 -1
- package/bridging/modelType.js +11 -6
- package/bridging/modelType.js.map +1 -1
- package/bridging/modelType.mjs +11 -6
- package/bridging/modelType.mjs.map +1 -1
- package/bridging/preset.d.mts +2 -0
- package/bridging/preset.d.mts.map +1 -1
- package/bridging/preset.d.ts +2 -0
- package/bridging/preset.d.ts.map +1 -1
- package/bridging/preset.js +12 -0
- package/bridging/preset.js.map +1 -1
- package/bridging/preset.mjs +12 -0
- package/bridging/preset.mjs.map +1 -1
- package/bridging/samplingMethod.d.mts +2 -1
- package/bridging/samplingMethod.d.mts.map +1 -1
- package/bridging/samplingMethod.d.ts +2 -1
- package/bridging/samplingMethod.d.ts.map +1 -1
- package/bridging/samplingMethod.js +3 -1
- package/bridging/samplingMethod.js.map +1 -1
- package/bridging/samplingMethod.mjs +3 -1
- package/bridging/samplingMethod.mjs.map +1 -1
- package/bridging/samplingProcessingOrder.d.mts +8 -0
- package/bridging/samplingProcessingOrder.d.mts.map +1 -0
- package/bridging/samplingProcessingOrder.d.ts +8 -0
- package/bridging/samplingProcessingOrder.d.ts.map +1 -0
- package/bridging/samplingProcessingOrder.js +30 -0
- package/bridging/samplingProcessingOrder.js.map +1 -0
- package/bridging/samplingProcessingOrder.mjs +25 -0
- package/bridging/samplingProcessingOrder.mjs.map +1 -0
- package/bridging/textToSpeechSession.d.mts +8 -0
- package/bridging/textToSpeechSession.d.mts.map +1 -0
- package/bridging/textToSpeechSession.d.ts +8 -0
- package/bridging/textToSpeechSession.d.ts.map +1 -0
- package/bridging/textToSpeechSession.js +14 -0
- package/bridging/textToSpeechSession.js.map +1 -0
- package/bridging/textToSpeechSession.mjs +10 -0
- package/bridging/textToSpeechSession.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -1
- package/error.js +4 -0
- package/error.js.map +1 -1
- package/error.mjs +4 -0
- package/error.mjs.map +1 -1
- package/index.d.mts +8 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +8 -1
- package/index.d.ts.map +1 -1
- package/index.js +17 -3
- package/index.js.map +1 -1
- package/index.mjs +8 -1
- package/index.mjs.map +1 -1
- package/interactors/chatModelInteractor.d.mts +5 -5
- package/interactors/chatModelInteractor.d.mts.map +1 -1
- package/interactors/chatModelInteractor.d.ts +5 -5
- package/interactors/chatModelInteractor.d.ts.map +1 -1
- package/interactors/chatModelInteractor.js +2 -2
- package/interactors/chatModelInteractor.js.map +1 -1
- package/interactors/chatModelInteractor.mjs +2 -2
- package/interactors/chatModelInteractor.mjs.map +1 -1
- package/interactors/chatModelsInteractor.d.mts +5 -5
- package/interactors/chatModelsInteractor.d.mts.map +1 -1
- package/interactors/chatModelsInteractor.d.ts +5 -5
- package/interactors/chatModelsInteractor.d.ts.map +1 -1
- package/interactors/chatModelsInteractor.js.map +1 -1
- package/interactors/chatModelsInteractor.mjs.map +1 -1
- package/interactors/engineInteractor.d.mts +4 -4
- package/interactors/engineInteractor.d.ts +4 -4
- package/interactors/engineInteractor.js +5 -5
- package/interactors/engineInteractor.mjs +5 -5
- package/napi/uzu.d.ts +69 -15
- package/napi/uzu.js +16 -2
- package/napi/uzu.mjs +8 -1
- package/napi/uzu.node +0 -0
- package/package.json +1 -1
- package/src/bridging/classificationLabel.ts +43 -0
- package/src/bridging/classificationOutput.ts +22 -0
- package/src/bridging/classificationSession.ts +17 -0
- package/src/bridging/classificationStats.ts +45 -0
- package/src/bridging/engine.ts +62 -26
- package/src/bridging/model.ts +68 -0
- package/src/bridging/modelKind.ts +27 -0
- package/src/bridging/modelType.ts +11 -6
- package/src/bridging/preset.ts +14 -0
- package/src/bridging/samplingMethod.ts +6 -0
- package/src/bridging/samplingProcessingOrder.ts +31 -0
- package/src/bridging/textToSpeechSession.ts +15 -0
- package/src/error.ts +4 -0
- package/src/index.ts +8 -1
- package/src/interactors/chatModelInteractor.ts +7 -7
- package/src/interactors/chatModelsInteractor.ts +5 -5
- package/src/interactors/engineInteractor.ts +7 -7
- package/src/napi/uzu.d.ts +69 -15
- package/src/napi/uzu.js +16 -2
- package/src/napi/uzu.mjs +8 -1
- package/src/napi/uzu.node +0 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/bridging/chatModel.d.mts +0 -15
- package/bridging/chatModel.d.mts.map +0 -1
- package/bridging/chatModel.d.ts +0 -15
- package/bridging/chatModel.d.ts.map +0 -1
- package/bridging/chatModel.js +0 -33
- package/bridging/chatModel.js.map +0 -1
- package/bridging/chatModel.mjs +0 -29
- package/bridging/chatModel.mjs.map +0 -1
- package/src/bridging/chatModel.ts +0 -54
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChatModelInteractor = void 0;
|
|
4
4
|
const downloadState_1 = require("../bridging/downloadState.js");
|
|
5
|
-
const
|
|
5
|
+
const modelKind_1 = require("../bridging/modelKind.js");
|
|
6
6
|
const runConfig_1 = require("../bridging/runConfig.js");
|
|
7
7
|
const chatSessionInteractor_1 = require("./chatSessionInteractor.js");
|
|
8
8
|
const downloadInteractor_1 = require("./downloadInteractor.js");
|
|
@@ -74,7 +74,7 @@ class ChatModelInteractor {
|
|
|
74
74
|
const sessionPromise = (async () => {
|
|
75
75
|
const engine = await this.modelsInteractor.engineInteractor.finalize();
|
|
76
76
|
let model = await this.finalize();
|
|
77
|
-
if (model.
|
|
77
|
+
if (model.kind === modelKind_1.ModelKind.Local) {
|
|
78
78
|
model = await this.download().finalize();
|
|
79
79
|
}
|
|
80
80
|
const session = engine.chatSession(model, this.config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelInteractor.js","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"chatModelInteractor.js","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":";;;AAKA,gEAA0D;AAG1D,wDAAkD;AAIlD,wDAAkD;AAGlD,sEAAgE;AAChE,gEAA0D;AAG1D,MAAa,mBAAmB;IAK5B,YAAY,gBAAsC,EAAE,KAA8B,EAAE,MAAc;QAC9F,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,iBAAiB;IAEjB,WAAW;QACP,MAAM,aAAa,GAAG,CAAC,KAAK,IAAI,EAAE;YAC9B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACvE,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnD,O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M,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC7C,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,IAAI,6CAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,qBAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,WAA+C,GAAG,EAAE,CAAC,IAAI;QAC/E,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,eAAe,CACjB,QAAmB,EACnB,WAA+C,GAAG,EAAE,CAAC,IAAI;QAEzD,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;CACJ;AA1GD,kDA0GC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DownloadPhase } from "../bridging/downloadState.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { ModelKind } from "../bridging/modelKind.mjs";
|
|
3
3
|
import { RunConfig } from "../bridging/runConfig.mjs";
|
|
4
4
|
import { ChatSessionInteractor } from "./chatSessionInteractor.mjs";
|
|
5
5
|
import { DownloadInteractor } from "./downloadInteractor.mjs";
|
|
@@ -71,7 +71,7 @@ export class ChatModelInteractor {
|
|
|
71
71
|
const sessionPromise = (async () => {
|
|
72
72
|
const engine = await this.modelsInteractor.engineInteractor.finalize();
|
|
73
73
|
let model = await this.finalize();
|
|
74
|
-
if (model.
|
|
74
|
+
if (model.kind === ModelKind.Local) {
|
|
75
75
|
model = await this.download().finalize();
|
|
76
76
|
}
|
|
77
77
|
const session = engine.chatSession(model, this.config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelInteractor.mjs","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatModelInteractor.mjs","sourceRoot":"","sources":["../src/interactors/chatModelInteractor.ts"],"names":[],"mappings":"OAKO,EAAE,aAAa,EAAE;OAGjB,EAAE,SAAS,EAAE;OAIb,EAAE,SAAS,EAAE;OAGb,EAAE,qBAAqB,EAAE;OACzB,EAAE,kBAAkB,EAAE;AAG7B,MAAM,OAAO,mBAAmB;IAK5B,YAAY,gBAAsC,EAAE,KAA8B,EAAE,MAAc;QAC9F,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,iBAAiB;IAEjB,WAAW;QACP,MAAM,aAAa,GAAG,CAAC,KAAK,IAAI,EAAE;YAC9B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACvE,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ,CAAC,QAA2D;QAChE,MAAM,YAAY,GAAG,CAAC,KAAK,IAAI,EAAE;YAC7B,MAAM,kBAAkB,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9C,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAA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AC;IAChF,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,WAA+C,GAAG,EAAE,CAAC,IAAI;QAC/E,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,eAAe,CACjB,QAAmB,EACnB,WAA+C,GAAG,EAAE,CAAC,IAAI;QAEzD,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;CACJ"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Model } from "../bridging/model.mjs";
|
|
2
2
|
import { ChatModelInteractor } from "./chatModelInteractor.mjs";
|
|
3
3
|
import { EngineInteractor } from "./engineInteractor.mjs";
|
|
4
4
|
import { Interactor, InteractorEntity } from "./interactor.mjs";
|
|
5
|
-
export declare class ChatModelsInteractor implements Interactor<
|
|
5
|
+
export declare class ChatModelsInteractor implements Interactor<Model[]> {
|
|
6
6
|
readonly engineInteractor: EngineInteractor;
|
|
7
|
-
readonly entity: InteractorEntity<
|
|
8
|
-
constructor(engineInteractor: EngineInteractor, models: InteractorEntity<
|
|
9
|
-
finalize(): Promise<
|
|
7
|
+
readonly entity: InteractorEntity<Model[]>;
|
|
8
|
+
constructor(engineInteractor: EngineInteractor, models: InteractorEntity<Model[]>);
|
|
9
|
+
finalize(): Promise<Model[]>;
|
|
10
10
|
get(repoId: string): ChatModelInteractor;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=chatModelsInteractor.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelsInteractor.d.mts","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatModelsInteractor.d.mts","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"OACO,EAAE,KAAK,EAAE;OAET,EAAE,mBAAmB,EAAE;OACvB,EAAE,gBAAgB,EAAE;OACpB,EAAE,UAAU,EAAE,gBAAgB,EAAE;AAEvC,qBAAa,oBAAqB,YAAW,UAAU,CAAC,KAAK,EAAE,CAAC;IAC5D,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC;gBAE/B,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAK3E,QAAQ,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAIlC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;CAQ3C"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Model } from "../bridging/model.js";
|
|
2
2
|
import { ChatModelInteractor } from "./chatModelInteractor.js";
|
|
3
3
|
import { EngineInteractor } from "./engineInteractor.js";
|
|
4
4
|
import { Interactor, InteractorEntity } from "./interactor.js";
|
|
5
|
-
export declare class ChatModelsInteractor implements Interactor<
|
|
5
|
+
export declare class ChatModelsInteractor implements Interactor<Model[]> {
|
|
6
6
|
readonly engineInteractor: EngineInteractor;
|
|
7
|
-
readonly entity: InteractorEntity<
|
|
8
|
-
constructor(engineInteractor: EngineInteractor, models: InteractorEntity<
|
|
9
|
-
finalize(): Promise<
|
|
7
|
+
readonly entity: InteractorEntity<Model[]>;
|
|
8
|
+
constructor(engineInteractor: EngineInteractor, models: InteractorEntity<Model[]>);
|
|
9
|
+
finalize(): Promise<Model[]>;
|
|
10
10
|
get(repoId: string): ChatModelInteractor;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=chatModelsInteractor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelsInteractor.d.ts","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatModelsInteractor.d.ts","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"OACO,EAAE,KAAK,EAAE;OAET,EAAE,mBAAmB,EAAE;OACvB,EAAE,gBAAgB,EAAE;OACpB,EAAE,UAAU,EAAE,gBAAgB,EAAE;AAEvC,qBAAa,oBAAqB,YAAW,UAAU,CAAC,KAAK,EAAE,CAAC;IAC5D,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC;gBAE/B,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAK3E,QAAQ,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAIlC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;CAQ3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelsInteractor.js","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"chatModelsInteractor.js","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":";;;AAAA,kDAA4C;AAE5C,uCAA0D;AAC1D,kEAA4D;AAI5D,MAAa,oBAAoB;IAI7B,YAAY,gBAAkC,EAAE,MAAiC;QAC7E,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,MAAc;QACd,MAAM,YAAY,GAAG,CAAC,KAAK,IAAI,EAAE;YAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;YAC9D,OAAO,IAAA,qBAAa,EAAC,KAAK,EAAE,uBAAe,CAAC,aAAa,CAAC,CAAC;QAC/D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,IAAI,yCAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,eAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;CACJ;AArBD,oDAqBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatModelsInteractor.mjs","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatModelsInteractor.mjs","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,EAAE;OAEV,EAAE,eAAe,EAAE,aAAa,EAAE;OAClC,EAAE,mBAAmB,EAAE;AAI9B,MAAM,OAAO,oBAAoB;IAI7B,YAAY,gBAAkC,EAAE,MAAiC;QAC7E,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,MAAc;QACd,MAAM,YAAY,GAAG,CAAC,KAAK,IAAI,EAAE;YAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;YAC9D,OAAO,aAAa,CAAC,KAAK,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC/D,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;CACJ"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Engine } from "../bridging/engine.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { ModelKind } from "../bridging/modelKind.mjs";
|
|
3
3
|
import { ChatModelInteractor } from "./chatModelInteractor.mjs";
|
|
4
4
|
import { ChatModelsInteractor } from "./chatModelsInteractor.mjs";
|
|
5
5
|
import { Interactor, InteractorEntity } from "./interactor.mjs";
|
|
6
6
|
export declare class EngineInteractor implements Interactor<Engine> {
|
|
7
7
|
readonly entity: InteractorEntity<Engine>;
|
|
8
|
-
readonly
|
|
9
|
-
constructor(engine: InteractorEntity<Engine>,
|
|
8
|
+
readonly modelKindFilter: ModelKind[] | null;
|
|
9
|
+
constructor(engine: InteractorEntity<Engine>, modelKindFilter?: ModelKind[] | null);
|
|
10
10
|
finalize(): Promise<Engine>;
|
|
11
|
-
|
|
11
|
+
filterKinds(kinds: ModelKind[] | null): EngineInteractor;
|
|
12
12
|
chatModels(): ChatModelsInteractor;
|
|
13
13
|
chatModel(repoId: string): ChatModelInteractor;
|
|
14
14
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Engine } from "../bridging/engine.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ModelKind } from "../bridging/modelKind.js";
|
|
3
3
|
import { ChatModelInteractor } from "./chatModelInteractor.js";
|
|
4
4
|
import { ChatModelsInteractor } from "./chatModelsInteractor.js";
|
|
5
5
|
import { Interactor, InteractorEntity } from "./interactor.js";
|
|
6
6
|
export declare class EngineInteractor implements Interactor<Engine> {
|
|
7
7
|
readonly entity: InteractorEntity<Engine>;
|
|
8
|
-
readonly
|
|
9
|
-
constructor(engine: InteractorEntity<Engine>,
|
|
8
|
+
readonly modelKindFilter: ModelKind[] | null;
|
|
9
|
+
constructor(engine: InteractorEntity<Engine>, modelKindFilter?: ModelKind[] | null);
|
|
10
10
|
finalize(): Promise<Engine>;
|
|
11
|
-
|
|
11
|
+
filterKinds(kinds: ModelKind[] | null): EngineInteractor;
|
|
12
12
|
chatModels(): ChatModelsInteractor;
|
|
13
13
|
chatModel(repoId: string): ChatModelInteractor;
|
|
14
14
|
}
|
|
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EngineInteractor = void 0;
|
|
4
4
|
const chatModelsInteractor_1 = require("./chatModelsInteractor.js");
|
|
5
5
|
class EngineInteractor {
|
|
6
|
-
constructor(engine,
|
|
6
|
+
constructor(engine, modelKindFilter = null) {
|
|
7
7
|
this.entity = engine;
|
|
8
|
-
this.
|
|
8
|
+
this.modelKindFilter = modelKindFilter;
|
|
9
9
|
}
|
|
10
10
|
async finalize() {
|
|
11
11
|
return await this.entity;
|
|
12
12
|
}
|
|
13
13
|
/* Models */
|
|
14
|
-
|
|
15
|
-
return new EngineInteractor(this.entity,
|
|
14
|
+
filterKinds(kinds) {
|
|
15
|
+
return new EngineInteractor(this.entity, kinds);
|
|
16
16
|
}
|
|
17
17
|
chatModels() {
|
|
18
18
|
const modelsPromise = (async () => {
|
|
19
19
|
const engine = await this.finalize();
|
|
20
|
-
return await engine.chatModels(this.
|
|
20
|
+
return await engine.chatModels(this.modelKindFilter);
|
|
21
21
|
})();
|
|
22
22
|
return new chatModelsInteractor_1.ChatModelsInteractor(this, modelsPromise);
|
|
23
23
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ChatModelsInteractor } from "./chatModelsInteractor.mjs";
|
|
2
2
|
export class EngineInteractor {
|
|
3
|
-
constructor(engine,
|
|
3
|
+
constructor(engine, modelKindFilter = null) {
|
|
4
4
|
this.entity = engine;
|
|
5
|
-
this.
|
|
5
|
+
this.modelKindFilter = modelKindFilter;
|
|
6
6
|
}
|
|
7
7
|
async finalize() {
|
|
8
8
|
return await this.entity;
|
|
9
9
|
}
|
|
10
10
|
/* Models */
|
|
11
|
-
|
|
12
|
-
return new EngineInteractor(this.entity,
|
|
11
|
+
filterKinds(kinds) {
|
|
12
|
+
return new EngineInteractor(this.entity, kinds);
|
|
13
13
|
}
|
|
14
14
|
chatModels() {
|
|
15
15
|
const modelsPromise = (async () => {
|
|
16
16
|
const engine = await this.finalize();
|
|
17
|
-
return await engine.chatModels(this.
|
|
17
|
+
return await engine.chatModels(this.modelKindFilter);
|
|
18
18
|
})();
|
|
19
19
|
return new ChatModelsInteractor(this, modelsPromise);
|
|
20
20
|
}
|
package/napi/uzu.d.ts
CHANGED
|
@@ -5,17 +5,25 @@ export declare class ChatSession {
|
|
|
5
5
|
reset(): void
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export declare class ClassificationSession {
|
|
9
|
+
run(input: Input): ClassificationOutput
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export declare class Engine {
|
|
9
13
|
activate(apiKey: string): Promise<LicenseStatus>
|
|
10
|
-
getChatModels(
|
|
14
|
+
getChatModels(kinds: Array<ModelKind>): Promise<Array<Model>>
|
|
15
|
+
getTextToSpeechModels(): Promise<Array<Model>>
|
|
16
|
+
getClassificationModels(): Promise<Array<Model>>
|
|
11
17
|
getModelDownloadState(repoId: string): ModelDownloadState
|
|
12
18
|
createModelDownloadHandle(repoId: string): ModelDownloadHandle
|
|
13
19
|
benchmark(task: BenchmarksTask, prefillStepSize?: number | undefined | null): Promise<Array<BenchmarksResult>>
|
|
14
20
|
constructor()
|
|
15
|
-
createChatSession(model:
|
|
21
|
+
createChatSession(model: Model, config: Config): ChatSession
|
|
22
|
+
createTextToSpeechSession(model: Model): TextToSpeechSession
|
|
23
|
+
createClassificationSession(model: Model): ClassificationSession
|
|
16
24
|
registerLicenseStatusHandler(callback?: ((arg: LicenseStatus) => void) | undefined | null): void
|
|
17
25
|
registerModelDownloadStateHandler(callback?: ((arg0: string, arg1: ModelDownloadState) => void) | undefined | null): void
|
|
18
|
-
|
|
26
|
+
registerModelsHandler(callback?: ((arg: Array<Model>) => void) | undefined | null): void
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
export declare class ModelDownloadHandle {
|
|
@@ -40,6 +48,10 @@ export declare class ProgressUpdate {
|
|
|
40
48
|
progress: number
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
export declare class TextToSpeechSession {
|
|
52
|
+
run(input: Input, outputPath: string): void
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
export type AsyncBatchSize =
|
|
44
56
|
| { type: 'Default' }
|
|
45
57
|
| { type: 'Custom', size: number }
|
|
@@ -74,20 +86,36 @@ export interface BenchmarksTask {
|
|
|
74
86
|
greedy: boolean
|
|
75
87
|
}
|
|
76
88
|
|
|
77
|
-
export interface ChatModel {
|
|
78
|
-
readonly repoId: string
|
|
79
|
-
readonly type: ModelType
|
|
80
|
-
readonly name: string
|
|
81
|
-
readonly vendor: string
|
|
82
|
-
readonly quantization?: string
|
|
83
|
-
readonly outputParserRegex?: string
|
|
84
|
-
}
|
|
85
|
-
|
|
86
89
|
export interface ClassificationFeature {
|
|
87
90
|
name: string
|
|
88
91
|
values: Array<string>
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
export interface ClassificationLabel {
|
|
95
|
+
index: number
|
|
96
|
+
label: string
|
|
97
|
+
title: string
|
|
98
|
+
description: string
|
|
99
|
+
recommendedThreshold: number
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ClassificationOutput {
|
|
103
|
+
logits: Array<number>
|
|
104
|
+
probabilities: Record<string, number>
|
|
105
|
+
stats: ClassificationStats
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ClassificationStats {
|
|
109
|
+
preprocessingDuration: number
|
|
110
|
+
forwardPassDuration: number
|
|
111
|
+
postprocessingDuration: number
|
|
112
|
+
totalDuration: number
|
|
113
|
+
tokensCount: number
|
|
114
|
+
tokensPerSecond: number
|
|
115
|
+
predictedLabel: string
|
|
116
|
+
confidence: number
|
|
117
|
+
}
|
|
118
|
+
|
|
91
119
|
export interface Config {
|
|
92
120
|
preset: Preset
|
|
93
121
|
contextMode: ContextMode
|
|
@@ -148,6 +176,17 @@ export interface Message {
|
|
|
148
176
|
reasoningContent?: string
|
|
149
177
|
}
|
|
150
178
|
|
|
179
|
+
export interface Model {
|
|
180
|
+
readonly repoId: string
|
|
181
|
+
readonly type: ModelType
|
|
182
|
+
readonly kind: ModelKind
|
|
183
|
+
readonly name: string
|
|
184
|
+
readonly vendor: string
|
|
185
|
+
readonly quantization?: string
|
|
186
|
+
readonly outputParserRegex?: string
|
|
187
|
+
readonly classificationLabels: Array<ClassificationLabel>
|
|
188
|
+
}
|
|
189
|
+
|
|
151
190
|
export declare const enum ModelDownloadPhase {
|
|
152
191
|
NotDownloaded = 0,
|
|
153
192
|
Downloading = 1,
|
|
@@ -168,6 +207,11 @@ export interface ModelDownloadState {
|
|
|
168
207
|
readonly error?: string
|
|
169
208
|
}
|
|
170
209
|
|
|
210
|
+
export declare const enum ModelKind {
|
|
211
|
+
Local = 0,
|
|
212
|
+
Cloud = 1
|
|
213
|
+
}
|
|
214
|
+
|
|
171
215
|
export type ModelStorageError =
|
|
172
216
|
| { type: 'Io', message: string }
|
|
173
217
|
| { type: 'Network', message: string }
|
|
@@ -179,8 +223,9 @@ export type ModelStorageError =
|
|
|
179
223
|
| { type: 'Paused' }
|
|
180
224
|
|
|
181
225
|
export declare const enum ModelType {
|
|
182
|
-
|
|
183
|
-
|
|
226
|
+
Chat = 0,
|
|
227
|
+
Classification = 1,
|
|
228
|
+
TTS = 2
|
|
184
229
|
}
|
|
185
230
|
|
|
186
231
|
export interface Output {
|
|
@@ -203,6 +248,8 @@ export type Preset =
|
|
|
203
248
|
| { type: 'General' }
|
|
204
249
|
| { type: 'Classification', feature: ClassificationFeature }
|
|
205
250
|
| { type: 'Summarization' }
|
|
251
|
+
| { type: 'NGramSpeculator', useCase: string, numberOfSpeculatedTokens: number }
|
|
252
|
+
| { type: 'Chat' }
|
|
206
253
|
|
|
207
254
|
export declare const enum Role {
|
|
208
255
|
System = 0,
|
|
@@ -224,12 +271,17 @@ export interface RunStats {
|
|
|
224
271
|
|
|
225
272
|
export type SamplingMethod =
|
|
226
273
|
| { type: 'Greedy' }
|
|
227
|
-
| { type: 'Stochastic', temperature?: number, topK?: number, topP?: number, minP?: number }
|
|
274
|
+
| { type: 'Stochastic', temperature?: number, topK?: number, topP?: number, minP?: number, processingOrder: SamplingProcessingOrder }
|
|
228
275
|
|
|
229
276
|
export type SamplingPolicy =
|
|
230
277
|
| { type: 'Default' }
|
|
231
278
|
| { type: 'Custom', value: SamplingMethod }
|
|
232
279
|
|
|
280
|
+
export declare const enum SamplingProcessingOrder {
|
|
281
|
+
TemperatureThenFilters = 0,
|
|
282
|
+
FiltersThenTemperature = 1
|
|
283
|
+
}
|
|
284
|
+
|
|
233
285
|
export type SamplingSeed =
|
|
234
286
|
| { type: 'Default' }
|
|
235
287
|
| { type: 'Custom', seed: number }
|
|
@@ -248,6 +300,8 @@ export interface StepStats {
|
|
|
248
300
|
processedTokensPerSecond: number
|
|
249
301
|
modelRun: RunStats
|
|
250
302
|
run?: RunStats
|
|
303
|
+
speculatorProposed: bigint
|
|
304
|
+
speculatorAccepted: bigint
|
|
251
305
|
}
|
|
252
306
|
|
|
253
307
|
export type StorageError =
|
package/napi/uzu.js
CHANGED
|
@@ -22,23 +22,30 @@ try {
|
|
|
22
22
|
// Re-export all runtime exports
|
|
23
23
|
const {
|
|
24
24
|
ChatSession,
|
|
25
|
+
ClassificationSession,
|
|
25
26
|
Engine,
|
|
26
27
|
ModelDownloadHandle,
|
|
27
28
|
ProgressStream,
|
|
28
29
|
ProgressUpdate,
|
|
30
|
+
TextToSpeechSession,
|
|
29
31
|
DataType,
|
|
30
32
|
FinishReason,
|
|
31
33
|
ModelDownloadPhase,
|
|
34
|
+
ModelKind,
|
|
32
35
|
ModelType,
|
|
33
36
|
Role,
|
|
37
|
+
SamplingProcessingOrder,
|
|
34
38
|
version,
|
|
35
39
|
BenchmarksDevice,
|
|
36
40
|
BenchmarksResult,
|
|
37
41
|
BenchmarksTask,
|
|
38
|
-
ChatModel,
|
|
39
42
|
ClassificationFeature,
|
|
43
|
+
ClassificationLabel,
|
|
44
|
+
ClassificationOutput,
|
|
45
|
+
ClassificationStats,
|
|
40
46
|
Config,
|
|
41
47
|
Message,
|
|
48
|
+
Model,
|
|
42
49
|
ModelDownloadState,
|
|
43
50
|
Output,
|
|
44
51
|
ParsedText,
|
|
@@ -65,23 +72,30 @@ const {
|
|
|
65
72
|
|
|
66
73
|
module.exports = {
|
|
67
74
|
ChatSession,
|
|
75
|
+
ClassificationSession,
|
|
68
76
|
Engine,
|
|
69
77
|
ModelDownloadHandle,
|
|
70
78
|
ProgressStream,
|
|
71
79
|
ProgressUpdate,
|
|
80
|
+
TextToSpeechSession,
|
|
72
81
|
DataType,
|
|
73
82
|
FinishReason,
|
|
74
83
|
ModelDownloadPhase,
|
|
84
|
+
ModelKind,
|
|
75
85
|
ModelType,
|
|
76
86
|
Role,
|
|
87
|
+
SamplingProcessingOrder,
|
|
77
88
|
version,
|
|
78
89
|
BenchmarksDevice,
|
|
79
90
|
BenchmarksResult,
|
|
80
91
|
BenchmarksTask,
|
|
81
|
-
ChatModel,
|
|
82
92
|
ClassificationFeature,
|
|
93
|
+
ClassificationLabel,
|
|
94
|
+
ClassificationOutput,
|
|
95
|
+
ClassificationStats,
|
|
83
96
|
Config,
|
|
84
97
|
Message,
|
|
98
|
+
Model,
|
|
85
99
|
ModelDownloadState,
|
|
86
100
|
Output,
|
|
87
101
|
ParsedText,
|
package/napi/uzu.mjs
CHANGED
|
@@ -22,23 +22,30 @@ try {
|
|
|
22
22
|
// Re-export all runtime exports as named exports
|
|
23
23
|
export const {
|
|
24
24
|
ChatSession,
|
|
25
|
+
ClassificationSession,
|
|
25
26
|
Engine,
|
|
26
27
|
ModelDownloadHandle,
|
|
27
28
|
ProgressStream,
|
|
28
29
|
ProgressUpdate,
|
|
30
|
+
TextToSpeechSession,
|
|
29
31
|
DataType,
|
|
30
32
|
FinishReason,
|
|
31
33
|
ModelDownloadPhase,
|
|
34
|
+
ModelKind,
|
|
32
35
|
ModelType,
|
|
33
36
|
Role,
|
|
37
|
+
SamplingProcessingOrder,
|
|
34
38
|
version,
|
|
35
39
|
BenchmarksDevice,
|
|
36
40
|
BenchmarksResult,
|
|
37
41
|
BenchmarksTask,
|
|
38
|
-
ChatModel,
|
|
39
42
|
ClassificationFeature,
|
|
43
|
+
ClassificationLabel,
|
|
44
|
+
ClassificationOutput,
|
|
45
|
+
ClassificationStats,
|
|
40
46
|
Config,
|
|
41
47
|
Message,
|
|
48
|
+
Model,
|
|
42
49
|
ModelDownloadState,
|
|
43
50
|
Output,
|
|
44
51
|
ParsedText,
|
package/napi/uzu.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ClassificationLabel as NapiClassificationLabel } from '../napi/uzu';
|
|
2
|
+
|
|
3
|
+
export class ClassificationLabel {
|
|
4
|
+
readonly index: number;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly recommendedThreshold: number;
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
index: number,
|
|
12
|
+
label: string,
|
|
13
|
+
title: string,
|
|
14
|
+
description: string,
|
|
15
|
+
recommendedThreshold: number,
|
|
16
|
+
) {
|
|
17
|
+
this.index = index;
|
|
18
|
+
this.label = label;
|
|
19
|
+
this.title = title;
|
|
20
|
+
this.description = description;
|
|
21
|
+
this.recommendedThreshold = recommendedThreshold;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static fromNapi(napiEntity: NapiClassificationLabel): ClassificationLabel {
|
|
25
|
+
return new ClassificationLabel(
|
|
26
|
+
napiEntity.index,
|
|
27
|
+
napiEntity.label,
|
|
28
|
+
napiEntity.title,
|
|
29
|
+
napiEntity.description,
|
|
30
|
+
napiEntity.recommendedThreshold,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
toNapi(): NapiClassificationLabel {
|
|
35
|
+
return {
|
|
36
|
+
index: this.index,
|
|
37
|
+
label: this.label,
|
|
38
|
+
title: this.title,
|
|
39
|
+
description: this.description,
|
|
40
|
+
recommendedThreshold: this.recommendedThreshold,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ClassificationOutput as NapiClassificationOutput } from '../napi/uzu';
|
|
2
|
+
import { ClassificationStats } from './classificationStats';
|
|
3
|
+
|
|
4
|
+
export class ClassificationOutput {
|
|
5
|
+
readonly logits: number[];
|
|
6
|
+
readonly probabilities: Record<string, number>;
|
|
7
|
+
readonly stats: ClassificationStats;
|
|
8
|
+
|
|
9
|
+
constructor(logits: number[], probabilities: Record<string, number>, stats: ClassificationStats) {
|
|
10
|
+
this.logits = logits;
|
|
11
|
+
this.probabilities = probabilities;
|
|
12
|
+
this.stats = stats;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static fromNapi(napiEntity: NapiClassificationOutput): ClassificationOutput {
|
|
16
|
+
return new ClassificationOutput(
|
|
17
|
+
napiEntity.logits,
|
|
18
|
+
napiEntity.probabilities,
|
|
19
|
+
ClassificationStats.fromNapi(napiEntity.stats),
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClassificationSession as NapiClassificationSession } from '../napi/uzu';
|
|
2
|
+
import { ClassificationOutput } from './classificationOutput';
|
|
3
|
+
import { Input } from './input';
|
|
4
|
+
|
|
5
|
+
export class ClassificationSession {
|
|
6
|
+
private readonly napiClassificationSession: NapiClassificationSession;
|
|
7
|
+
|
|
8
|
+
constructor(napiClassificationSession: NapiClassificationSession) {
|
|
9
|
+
this.napiClassificationSession = napiClassificationSession;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
run(input: Input): ClassificationOutput {
|
|
13
|
+
const napiInput = input.toNapi();
|
|
14
|
+
const napiOutput = this.napiClassificationSession.run(napiInput);
|
|
15
|
+
return ClassificationOutput.fromNapi(napiOutput);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ClassificationStats as NapiClassificationStats } from '../napi/uzu';
|
|
2
|
+
|
|
3
|
+
export class ClassificationStats {
|
|
4
|
+
readonly preprocessingDuration: number;
|
|
5
|
+
readonly forwardPassDuration: number;
|
|
6
|
+
readonly postprocessingDuration: number;
|
|
7
|
+
readonly totalDuration: number;
|
|
8
|
+
readonly tokensCount: number;
|
|
9
|
+
readonly tokensPerSecond: number;
|
|
10
|
+
readonly predictedLabel: string;
|
|
11
|
+
readonly confidence: number;
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
preprocessingDuration: number,
|
|
15
|
+
forwardPassDuration: number,
|
|
16
|
+
postprocessingDuration: number,
|
|
17
|
+
totalDuration: number,
|
|
18
|
+
tokensCount: number,
|
|
19
|
+
tokensPerSecond: number,
|
|
20
|
+
predictedLabel: string,
|
|
21
|
+
confidence: number,
|
|
22
|
+
) {
|
|
23
|
+
this.preprocessingDuration = preprocessingDuration;
|
|
24
|
+
this.forwardPassDuration = forwardPassDuration;
|
|
25
|
+
this.postprocessingDuration = postprocessingDuration;
|
|
26
|
+
this.totalDuration = totalDuration;
|
|
27
|
+
this.tokensCount = tokensCount;
|
|
28
|
+
this.tokensPerSecond = tokensPerSecond;
|
|
29
|
+
this.predictedLabel = predictedLabel;
|
|
30
|
+
this.confidence = confidence;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static fromNapi(napiEntity: NapiClassificationStats): ClassificationStats {
|
|
34
|
+
return new ClassificationStats(
|
|
35
|
+
napiEntity.preprocessingDuration,
|
|
36
|
+
napiEntity.forwardPassDuration,
|
|
37
|
+
napiEntity.postprocessingDuration,
|
|
38
|
+
napiEntity.totalDuration,
|
|
39
|
+
napiEntity.tokensCount,
|
|
40
|
+
napiEntity.tokensPerSecond,
|
|
41
|
+
napiEntity.predictedLabel,
|
|
42
|
+
napiEntity.confidence,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|