@trymirai/uzu 0.2.20 → 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.
Files changed (166) hide show
  1. package/README.md +6 -4
  2. package/bridging/classificationLabel.d.mts +12 -0
  3. package/bridging/classificationLabel.d.mts.map +1 -0
  4. package/bridging/classificationLabel.d.ts +12 -0
  5. package/bridging/classificationLabel.d.ts.map +1 -0
  6. package/bridging/classificationLabel.js +26 -0
  7. package/bridging/classificationLabel.js.map +1 -0
  8. package/bridging/classificationLabel.mjs +22 -0
  9. package/bridging/classificationLabel.mjs.map +1 -0
  10. package/bridging/classificationOutput.d.mts +10 -0
  11. package/bridging/classificationOutput.d.mts.map +1 -0
  12. package/bridging/classificationOutput.d.ts +10 -0
  13. package/bridging/classificationOutput.d.ts.map +1 -0
  14. package/bridging/classificationOutput.js +16 -0
  15. package/bridging/classificationOutput.js.map +1 -0
  16. package/bridging/classificationOutput.mjs +12 -0
  17. package/bridging/classificationOutput.mjs.map +1 -0
  18. package/bridging/classificationSession.d.mts +9 -0
  19. package/bridging/classificationSession.d.mts.map +1 -0
  20. package/bridging/classificationSession.d.ts +9 -0
  21. package/bridging/classificationSession.d.ts.map +1 -0
  22. package/bridging/classificationSession.js +16 -0
  23. package/bridging/classificationSession.js.map +1 -0
  24. package/bridging/classificationSession.mjs +12 -0
  25. package/bridging/classificationSession.mjs.map +1 -0
  26. package/bridging/classificationStats.d.mts +14 -0
  27. package/bridging/classificationStats.d.mts.map +1 -0
  28. package/bridging/classificationStats.d.ts +14 -0
  29. package/bridging/classificationStats.d.ts.map +1 -0
  30. package/bridging/classificationStats.js +20 -0
  31. package/bridging/classificationStats.js.map +1 -0
  32. package/bridging/classificationStats.mjs +16 -0
  33. package/bridging/classificationStats.mjs.map +1 -0
  34. package/bridging/engine.d.mts +14 -6
  35. package/bridging/engine.d.mts.map +1 -1
  36. package/bridging/engine.d.ts +14 -6
  37. package/bridging/engine.d.ts.map +1 -1
  38. package/bridging/engine.js +53 -23
  39. package/bridging/engine.js.map +1 -1
  40. package/bridging/engine.mjs +53 -23
  41. package/bridging/engine.mjs.map +1 -1
  42. package/bridging/model.d.mts +19 -0
  43. package/bridging/model.d.mts.map +1 -0
  44. package/bridging/model.d.ts +19 -0
  45. package/bridging/model.d.ts.map +1 -0
  46. package/bridging/model.js +39 -0
  47. package/bridging/model.js.map +1 -0
  48. package/bridging/model.mjs +35 -0
  49. package/bridging/model.mjs.map +1 -0
  50. package/bridging/modelKind.d.mts +8 -0
  51. package/bridging/modelKind.d.mts.map +1 -0
  52. package/bridging/modelKind.d.ts +8 -0
  53. package/bridging/modelKind.d.ts.map +1 -0
  54. package/bridging/modelKind.js +30 -0
  55. package/bridging/modelKind.js.map +1 -0
  56. package/bridging/modelKind.mjs +25 -0
  57. package/bridging/modelKind.mjs.map +1 -0
  58. package/bridging/modelType.d.mts +3 -2
  59. package/bridging/modelType.d.mts.map +1 -1
  60. package/bridging/modelType.d.ts +3 -2
  61. package/bridging/modelType.d.ts.map +1 -1
  62. package/bridging/modelType.js +11 -6
  63. package/bridging/modelType.js.map +1 -1
  64. package/bridging/modelType.mjs +11 -6
  65. package/bridging/modelType.mjs.map +1 -1
  66. package/bridging/samplingMethod.d.mts +2 -1
  67. package/bridging/samplingMethod.d.mts.map +1 -1
  68. package/bridging/samplingMethod.d.ts +2 -1
  69. package/bridging/samplingMethod.d.ts.map +1 -1
  70. package/bridging/samplingMethod.js +3 -1
  71. package/bridging/samplingMethod.js.map +1 -1
  72. package/bridging/samplingMethod.mjs +3 -1
  73. package/bridging/samplingMethod.mjs.map +1 -1
  74. package/bridging/samplingProcessingOrder.d.mts +8 -0
  75. package/bridging/samplingProcessingOrder.d.mts.map +1 -0
  76. package/bridging/samplingProcessingOrder.d.ts +8 -0
  77. package/bridging/samplingProcessingOrder.d.ts.map +1 -0
  78. package/bridging/samplingProcessingOrder.js +30 -0
  79. package/bridging/samplingProcessingOrder.js.map +1 -0
  80. package/bridging/samplingProcessingOrder.mjs +25 -0
  81. package/bridging/samplingProcessingOrder.mjs.map +1 -0
  82. package/bridging/textToSpeechSession.d.mts +8 -0
  83. package/bridging/textToSpeechSession.d.mts.map +1 -0
  84. package/bridging/textToSpeechSession.d.ts +8 -0
  85. package/bridging/textToSpeechSession.d.ts.map +1 -0
  86. package/bridging/textToSpeechSession.js +14 -0
  87. package/bridging/textToSpeechSession.js.map +1 -0
  88. package/bridging/textToSpeechSession.mjs +10 -0
  89. package/bridging/textToSpeechSession.mjs.map +1 -0
  90. package/error.d.mts +2 -0
  91. package/error.d.mts.map +1 -1
  92. package/error.d.ts +2 -0
  93. package/error.d.ts.map +1 -1
  94. package/error.js +4 -0
  95. package/error.js.map +1 -1
  96. package/error.mjs +4 -0
  97. package/error.mjs.map +1 -1
  98. package/index.d.mts +8 -1
  99. package/index.d.mts.map +1 -1
  100. package/index.d.ts +8 -1
  101. package/index.d.ts.map +1 -1
  102. package/index.js +17 -3
  103. package/index.js.map +1 -1
  104. package/index.mjs +8 -1
  105. package/index.mjs.map +1 -1
  106. package/interactors/chatModelInteractor.d.mts +5 -5
  107. package/interactors/chatModelInteractor.d.mts.map +1 -1
  108. package/interactors/chatModelInteractor.d.ts +5 -5
  109. package/interactors/chatModelInteractor.d.ts.map +1 -1
  110. package/interactors/chatModelInteractor.js +2 -2
  111. package/interactors/chatModelInteractor.js.map +1 -1
  112. package/interactors/chatModelInteractor.mjs +2 -2
  113. package/interactors/chatModelInteractor.mjs.map +1 -1
  114. package/interactors/chatModelsInteractor.d.mts +5 -5
  115. package/interactors/chatModelsInteractor.d.mts.map +1 -1
  116. package/interactors/chatModelsInteractor.d.ts +5 -5
  117. package/interactors/chatModelsInteractor.d.ts.map +1 -1
  118. package/interactors/chatModelsInteractor.js.map +1 -1
  119. package/interactors/chatModelsInteractor.mjs.map +1 -1
  120. package/interactors/engineInteractor.d.mts +4 -4
  121. package/interactors/engineInteractor.d.ts +4 -4
  122. package/interactors/engineInteractor.js +5 -5
  123. package/interactors/engineInteractor.mjs +5 -5
  124. package/napi/uzu.d.ts +67 -15
  125. package/napi/uzu.js +16 -2
  126. package/napi/uzu.mjs +8 -1
  127. package/napi/uzu.node +0 -0
  128. package/package.json +1 -1
  129. package/src/bridging/classificationLabel.ts +43 -0
  130. package/src/bridging/classificationOutput.ts +22 -0
  131. package/src/bridging/classificationSession.ts +17 -0
  132. package/src/bridging/classificationStats.ts +45 -0
  133. package/src/bridging/engine.ts +62 -26
  134. package/src/bridging/model.ts +68 -0
  135. package/src/bridging/modelKind.ts +27 -0
  136. package/src/bridging/modelType.ts +11 -6
  137. package/src/bridging/samplingMethod.ts +6 -0
  138. package/src/bridging/samplingProcessingOrder.ts +31 -0
  139. package/src/bridging/textToSpeechSession.ts +15 -0
  140. package/src/error.ts +4 -0
  141. package/src/index.ts +8 -1
  142. package/src/interactors/chatModelInteractor.ts +7 -7
  143. package/src/interactors/chatModelsInteractor.ts +5 -5
  144. package/src/interactors/engineInteractor.ts +7 -7
  145. package/src/napi/uzu.d.ts +67 -15
  146. package/src/napi/uzu.js +16 -2
  147. package/src/napi/uzu.mjs +8 -1
  148. package/src/napi/uzu.node +0 -0
  149. package/src/version.ts +1 -1
  150. package/version.d.mts +1 -1
  151. package/version.d.mts.map +1 -1
  152. package/version.d.ts +1 -1
  153. package/version.d.ts.map +1 -1
  154. package/version.js +1 -1
  155. package/version.js.map +1 -1
  156. package/version.mjs +1 -1
  157. package/version.mjs.map +1 -1
  158. package/bridging/chatModel.d.mts +0 -15
  159. package/bridging/chatModel.d.mts.map +0 -1
  160. package/bridging/chatModel.d.ts +0 -15
  161. package/bridging/chatModel.d.ts.map +0 -1
  162. package/bridging/chatModel.js +0 -33
  163. package/bridging/chatModel.js.map +0 -1
  164. package/bridging/chatModel.mjs +0 -29
  165. package/bridging/chatModel.mjs.map +0 -1
  166. package/src/bridging/chatModel.ts +0 -54
@@ -1,12 +1,12 @@
1
- import { ChatModel } from "../bridging/chatModel.js";
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<ChatModel[]> {
5
+ export declare class ChatModelsInteractor implements Interactor<Model[]> {
6
6
  readonly engineInteractor: EngineInteractor;
7
- readonly entity: InteractorEntity<ChatModel[]>;
8
- constructor(engineInteractor: EngineInteractor, models: InteractorEntity<ChatModel[]>);
9
- finalize(): Promise<ChatModel[]>;
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":"OAAO,EAAE,SAAS,EAAE;OAGb,EAAE,mBAAmB,EAAE;OACvB,EAAE,gBAAgB,EAAE;OACpB,EAAE,UAAU,EAAE,gBAAgB,EAAE;AAEvC,qBAAa,oBAAqB,YAAW,UAAU,CAAC,SAAS,EAAE,CAAC;IAChE,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC;gBAEnC,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,CAAC,SAAS,EAAE,CAAC;IAK/E,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAItC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;CAQ3C"}
1
+ {"version":3,"file":"chatModelsInteractor.d.ts","sourceRoot":"","sources":["../src/interactors/chatModelsInteractor.ts"],"names":[],"mappings":"OACO,EAAE,KAAK,EAAE;OAET,EAAE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,EAAE,YAAY,EAAE,eAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;CACJ;AArBD,oDAqBC"}
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":"OACO,EAAE,MAAM,EAAE;OACV,EAAE,eAAe,EAAE,aAAa,EAAE;OAClC,EAAE,mBAAmB,EAAE;AAI9B,MAAM,OAAO,oBAAoB;IAI7B,YAAY,gBAAkC,EAAE,MAAqC;QACjF,IAAI,CAAC,gBAAgB,GAAG,gBAA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,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 { ModelType } from "../bridging/modelType.mjs";
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 modelTypeFilter: ModelType[] | null;
9
- constructor(engine: InteractorEntity<Engine>, modelTypeFilter?: ModelType[] | null);
8
+ readonly modelKindFilter: ModelKind[] | null;
9
+ constructor(engine: InteractorEntity<Engine>, modelKindFilter?: ModelKind[] | null);
10
10
  finalize(): Promise<Engine>;
11
- filterTypes(types: ModelType[] | null): EngineInteractor;
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 { ModelType } from "../bridging/modelType.js";
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 modelTypeFilter: ModelType[] | null;
9
- constructor(engine: InteractorEntity<Engine>, modelTypeFilter?: ModelType[] | null);
8
+ readonly modelKindFilter: ModelKind[] | null;
9
+ constructor(engine: InteractorEntity<Engine>, modelKindFilter?: ModelKind[] | null);
10
10
  finalize(): Promise<Engine>;
11
- filterTypes(types: ModelType[] | null): EngineInteractor;
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, modelTypeFilter = null) {
6
+ constructor(engine, modelKindFilter = null) {
7
7
  this.entity = engine;
8
- this.modelTypeFilter = modelTypeFilter;
8
+ this.modelKindFilter = modelKindFilter;
9
9
  }
10
10
  async finalize() {
11
11
  return await this.entity;
12
12
  }
13
13
  /* Models */
14
- filterTypes(types) {
15
- return new EngineInteractor(this.entity, types);
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.modelTypeFilter);
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, modelTypeFilter = null) {
3
+ constructor(engine, modelKindFilter = null) {
4
4
  this.entity = engine;
5
- this.modelTypeFilter = modelTypeFilter;
5
+ this.modelKindFilter = modelKindFilter;
6
6
  }
7
7
  async finalize() {
8
8
  return await this.entity;
9
9
  }
10
10
  /* Models */
11
- filterTypes(types) {
12
- return new EngineInteractor(this.entity, types);
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.modelTypeFilter);
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(types: Array<ModelType>): Promise<Array<ChatModel>>
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: ChatModel, config: Config): ChatSession
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
- registerChatModelsHandler(callback?: ((arg: Array<ChatModel>) => void) | undefined | null): void
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
- Local = 0,
183
- Cloud = 1
226
+ Chat = 0,
227
+ Classification = 1,
228
+ TTS = 2
184
229
  }
185
230
 
186
231
  export interface Output {
@@ -226,12 +271,17 @@ export interface RunStats {
226
271
 
227
272
  export type SamplingMethod =
228
273
  | { type: 'Greedy' }
229
- | { type: 'Stochastic', temperature?: number, topK?: number, topP?: number, minP?: number }
274
+ | { type: 'Stochastic', temperature?: number, topK?: number, topP?: number, minP?: number, processingOrder: SamplingProcessingOrder }
230
275
 
231
276
  export type SamplingPolicy =
232
277
  | { type: 'Default' }
233
278
  | { type: 'Custom', value: SamplingMethod }
234
279
 
280
+ export declare const enum SamplingProcessingOrder {
281
+ TemperatureThenFilters = 0,
282
+ FiltersThenTemperature = 1
283
+ }
284
+
235
285
  export type SamplingSeed =
236
286
  | { type: 'Default' }
237
287
  | { type: 'Custom', seed: number }
@@ -250,6 +300,8 @@ export interface StepStats {
250
300
  processedTokensPerSecond: number
251
301
  modelRun: RunStats
252
302
  run?: RunStats
303
+ speculatorProposed: bigint
304
+ speculatorAccepted: bigint
253
305
  }
254
306
 
255
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
@@ -101,5 +101,5 @@
101
101
  },
102
102
  "type": "commonjs",
103
103
  "types": "./index.d.ts",
104
- "version": "0.2.20"
104
+ "version": "0.3.0"
105
105
  }
@@ -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
+ }
@@ -2,14 +2,16 @@ import { EngineError, EngineErrorCode, unwrapOrThrow } from '../error';
2
2
  import { EngineInteractor } from '../interactors/engineInteractor';
3
3
  import { Engine as NapiEngine } from '../napi/uzu';
4
4
  import { readEnv } from '../utilities/env';
5
- import { ChatModel } from './chatModel';
6
5
  import { ChatSession } from './chatSession';
6
+ import { ClassificationSession } from './classificationSession';
7
7
  import { Config } from './config';
8
8
  import { DownloadHandle } from './downloadHandle';
9
9
  import { DownloadProgressUpdate } from './downloadProgressUpdate';
10
10
  import { DownloadPhase, DownloadState } from './downloadState';
11
11
  import { LicenseStatus, licenseStatusFromNapiLicenseStatus } from './licenseStatus';
12
- import { ModelType, modelTypeToNapiModelType } from './modelType';
12
+ import { Model } from './model';
13
+ import { ModelKind, modelKindToNapiModelKind } from './modelKind';
14
+ import { TextToSpeechSession } from './textToSpeechSession';
13
15
 
14
16
  export class Engine {
15
17
  private readonly napiEngine: NapiEngine;
@@ -55,32 +57,18 @@ export class Engine {
55
57
  return new DownloadHandle(this.napiEngine.createModelDownloadHandle(repoId));
56
58
  }
57
59
 
58
- async chatModels(types: ModelType[] | null = null): Promise<ChatModel[]> {
59
- let typesToFilter: ModelType[] = types ?? [ModelType.Local, ModelType.Cloud];
60
- let napiModelTypes = typesToFilter.map(modelTypeToNapiModelType);
61
- let napiChatModels = await this.napiEngine.getChatModels(napiModelTypes);
62
- let results: ChatModel[] = napiChatModels.map(ChatModel.fromNapiChatModel);
63
- return results;
64
- }
65
-
66
- async chatModel(repoId: string, types: ModelType[] | null = null): Promise<ChatModel> {
67
- const chatModels = await this.chatModels(types);
68
- const chatModel = chatModels.find((model) => model.repoId === repoId);
69
- return unwrapOrThrow(chatModel, EngineErrorCode.ModelNotFound);
70
- }
71
-
72
- async downloadChatModel(
73
- chatModel: ChatModel,
60
+ async downloadModel(
61
+ model: Model,
74
62
  progress: (progressUpdate: DownloadProgressUpdate) => void = () => {},
75
63
  ): Promise<DownloadState> {
76
- switch (chatModel.type) {
77
- case ModelType.Local:
64
+ switch (model.kind) {
65
+ case ModelKind.Local:
78
66
  break;
79
- case ModelType.Cloud:
80
- throw new EngineError(EngineErrorCode.UnexpectedModelType);
67
+ case ModelKind.Cloud:
68
+ throw new EngineError(EngineErrorCode.UnexpectedModelKind);
81
69
  }
82
70
 
83
- const downloadHandle = this.downloadHandle(chatModel.repoId);
71
+ const downloadHandle = this.downloadHandle(model.repoId);
84
72
  const state = await downloadHandle.state();
85
73
  switch (state.phase) {
86
74
  case DownloadPhase.Downloaded:
@@ -97,9 +85,57 @@ export class Engine {
97
85
  return finalState;
98
86
  }
99
87
 
100
- chatSession(chatModel: ChatModel, config: Config = Config.default()): ChatSession {
101
- const napiChatModel = chatModel.toNapi();
88
+ async chatModels(kinds: ModelKind[] | null = null): Promise<Model[]> {
89
+ let kindsToFilter: ModelKind[] = kinds ?? [ModelKind.Local, ModelKind.Cloud];
90
+ let napiModelKinds = kindsToFilter.map(modelKindToNapiModelKind);
91
+ let napiChatModels = await this.napiEngine.getChatModels(napiModelKinds);
92
+ let results: Model[] = napiChatModels.map(Model.fromNapiModel);
93
+ return results;
94
+ }
95
+
96
+ async chatModel(repoId: string, kinds: ModelKind[] | null = null): Promise<Model> {
97
+ const chatModels = await this.chatModels(kinds);
98
+ const chatModel = chatModels.find((model) => model.repoId === repoId);
99
+ return unwrapOrThrow(chatModel, EngineErrorCode.ModelNotFound);
100
+ }
101
+
102
+ chatSession(model: Model, config: Config = Config.default()): ChatSession {
103
+ const napiModel = model.toNapi();
102
104
  const napiConfig = config.toNapi();
103
- return new ChatSession(this.napiEngine.createChatSession(napiChatModel, napiConfig));
105
+ return new ChatSession(this.napiEngine.createChatSession(napiModel, napiConfig));
106
+ }
107
+
108
+ async classificationModels(): Promise<Model[]> {
109
+ const napiClassificationModels = await this.napiEngine.getClassificationModels();
110
+ const results: Model[] = napiClassificationModels.map(Model.fromNapiModel);
111
+ return results;
112
+ }
113
+
114
+ async classificationModel(repoId: string): Promise<Model> {
115
+ const classificationModels = await this.classificationModels();
116
+ const classificationModel = classificationModels.find((model) => model.repoId === repoId);
117
+ return unwrapOrThrow(classificationModel, EngineErrorCode.ModelNotFound);
118
+ }
119
+
120
+ classificationSession(model: Model): ClassificationSession {
121
+ const napiModel = model.toNapi();
122
+ return new ClassificationSession(this.napiEngine.createClassificationSession(napiModel));
123
+ }
124
+
125
+ async textToSpeechModels(): Promise<Model[]> {
126
+ const napiTextToSpeechModels = await this.napiEngine.getTextToSpeechModels();
127
+ const results: Model[] = napiTextToSpeechModels.map(Model.fromNapiModel);
128
+ return results;
129
+ }
130
+
131
+ async textToSpeechModel(repoId: string): Promise<Model> {
132
+ const textToSpeechModels = await this.textToSpeechModels();
133
+ const textToSpeechModel = textToSpeechModels.find((model) => model.repoId === repoId);
134
+ return unwrapOrThrow(textToSpeechModel, EngineErrorCode.ModelNotFound);
135
+ }
136
+
137
+ textToSpeechSession(model: Model): TextToSpeechSession {
138
+ const napiModel = model.toNapi();
139
+ return new TextToSpeechSession(this.napiEngine.createTextToSpeechSession(napiModel));
104
140
  }
105
141
  }