@coasys/ad4m 0.10.1-rc7 → 0.10.1-rc9-dev

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/lib/index.cjs CHANGED
@@ -14032,8 +14032,13 @@ class AIClient {
14032
14032
  }
14033
14033
  local {
14034
14034
  fileName
14035
- tokenizerSource
14036
- modelParameters
14035
+ tokenizerSource {
14036
+ repo
14037
+ revision
14038
+ fileName
14039
+ }
14040
+ huggingfaceRepo
14041
+ revision
14037
14042
  }
14038
14043
  modelType
14039
14044
  }
@@ -14101,8 +14106,13 @@ class AIClient {
14101
14106
  }
14102
14107
  local {
14103
14108
  fileName
14104
- tokenizerSource
14105
- modelParameters
14109
+ tokenizerSource {
14110
+ repo
14111
+ revision
14112
+ fileName
14113
+ }
14114
+ huggingfaceRepo
14115
+ revision
14106
14116
  }
14107
14117
  modelType
14108
14118
  }
@@ -14265,15 +14275,16 @@ class AIClient {
14265
14275
  const decompressed = JSON.parse(pako.inflate(compressed, { to: 'string' }));
14266
14276
  return decompressed;
14267
14277
  }
14268
- async openTranscriptionStream(modelId, streamCallback) {
14278
+ async openTranscriptionStream(modelId, streamCallback, params) {
14269
14279
  const { aiOpenTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14270
14280
  mutation: gql `
14271
- mutation AiOpenTranscriptionStream($modelId: String!) {
14272
- aiOpenTranscriptionStream(modelId: $modelId)
14281
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
14282
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
14273
14283
  }
14274
14284
  `,
14275
14285
  variables: {
14276
- modelId
14286
+ modelId,
14287
+ params
14277
14288
  }
14278
14289
  }));
14279
14290
  const subscription = __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").subscribe({
@@ -15466,14 +15477,16 @@ input LinkQuery {
15466
15477
 
15467
15478
  type LocalModel {
15468
15479
  fileName: String!
15469
- modelParameters: String!
15470
- tokenizerSource: String!
15480
+ huggingfaceRepo: String
15481
+ revision: String
15482
+ tokenizerSource: TokenizerSource
15471
15483
  }
15472
15484
 
15473
15485
  input LocalModelInput {
15474
15486
  fileName: String!
15475
- modelParameters: String!
15476
- tokenizerSource: String!
15487
+ huggingfaceRepo: String
15488
+ revision: String
15489
+ tokenizerSource: TokenizerSourceInput
15477
15490
  }
15478
15491
 
15479
15492
  type Model {
@@ -15527,7 +15540,7 @@ type Mutation {
15527
15540
  aiCloseTranscriptionStream(streamId: String!): String!
15528
15541
  aiEmbed(modelId: String!, text: String!): String!
15529
15542
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
15530
- aiOpenTranscriptionStream(modelId: String!): String!
15543
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
15531
15544
  aiPrompt(prompt: String!, taskId: String!): String!
15532
15545
  aiRemoveModel(modelId: String!): Boolean!
15533
15546
  aiRemoveTask(taskId: String!): AITask!
@@ -15725,11 +15738,31 @@ type Subscription {
15725
15738
  runtimeNotificationTriggered: TriggeredNotification
15726
15739
  }
15727
15740
 
15741
+ type TokenizerSource {
15742
+ fileName: String!
15743
+ repo: String!
15744
+ revision: String!
15745
+ }
15746
+
15747
+ input TokenizerSourceInput {
15748
+ fileName: String!
15749
+ repo: String!
15750
+ revision: String!
15751
+ }
15752
+
15728
15753
  type TriggeredNotification {
15729
15754
  notification: Notification!
15730
15755
  perspectiveId: String!
15731
15756
  triggerMatch: String!
15732
15757
  }
15758
+
15759
+ input VoiceActivityParamsInput {
15760
+ endThreshold: Float
15761
+ endWindow: Float
15762
+ startThreshold: Float
15763
+ startWindow: Float
15764
+ timeBeforeSpeech: Float
15765
+ }
15733
15766
  `;
15734
15767
 
15735
15768
  function formatList(list) {
package/lib/index.js CHANGED
@@ -14028,8 +14028,13 @@ class AIClient {
14028
14028
  }
14029
14029
  local {
14030
14030
  fileName
14031
- tokenizerSource
14032
- modelParameters
14031
+ tokenizerSource {
14032
+ repo
14033
+ revision
14034
+ fileName
14035
+ }
14036
+ huggingfaceRepo
14037
+ revision
14033
14038
  }
14034
14039
  modelType
14035
14040
  }
@@ -14097,8 +14102,13 @@ class AIClient {
14097
14102
  }
14098
14103
  local {
14099
14104
  fileName
14100
- tokenizerSource
14101
- modelParameters
14105
+ tokenizerSource {
14106
+ repo
14107
+ revision
14108
+ fileName
14109
+ }
14110
+ huggingfaceRepo
14111
+ revision
14102
14112
  }
14103
14113
  modelType
14104
14114
  }
@@ -14261,15 +14271,16 @@ class AIClient {
14261
14271
  const decompressed = JSON.parse(pako.inflate(compressed, { to: 'string' }));
14262
14272
  return decompressed;
14263
14273
  }
14264
- async openTranscriptionStream(modelId, streamCallback) {
14274
+ async openTranscriptionStream(modelId, streamCallback, params) {
14265
14275
  const { aiOpenTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14266
14276
  mutation: gql `
14267
- mutation AiOpenTranscriptionStream($modelId: String!) {
14268
- aiOpenTranscriptionStream(modelId: $modelId)
14277
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
14278
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
14269
14279
  }
14270
14280
  `,
14271
14281
  variables: {
14272
- modelId
14282
+ modelId,
14283
+ params
14273
14284
  }
14274
14285
  }));
14275
14286
  const subscription = __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").subscribe({
@@ -15462,14 +15473,16 @@ input LinkQuery {
15462
15473
 
15463
15474
  type LocalModel {
15464
15475
  fileName: String!
15465
- modelParameters: String!
15466
- tokenizerSource: String!
15476
+ huggingfaceRepo: String
15477
+ revision: String
15478
+ tokenizerSource: TokenizerSource
15467
15479
  }
15468
15480
 
15469
15481
  input LocalModelInput {
15470
15482
  fileName: String!
15471
- modelParameters: String!
15472
- tokenizerSource: String!
15483
+ huggingfaceRepo: String
15484
+ revision: String
15485
+ tokenizerSource: TokenizerSourceInput
15473
15486
  }
15474
15487
 
15475
15488
  type Model {
@@ -15523,7 +15536,7 @@ type Mutation {
15523
15536
  aiCloseTranscriptionStream(streamId: String!): String!
15524
15537
  aiEmbed(modelId: String!, text: String!): String!
15525
15538
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
15526
- aiOpenTranscriptionStream(modelId: String!): String!
15539
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
15527
15540
  aiPrompt(prompt: String!, taskId: String!): String!
15528
15541
  aiRemoveModel(modelId: String!): Boolean!
15529
15542
  aiRemoveTask(taskId: String!): AITask!
@@ -15721,11 +15734,31 @@ type Subscription {
15721
15734
  runtimeNotificationTriggered: TriggeredNotification
15722
15735
  }
15723
15736
 
15737
+ type TokenizerSource {
15738
+ fileName: String!
15739
+ repo: String!
15740
+ revision: String!
15741
+ }
15742
+
15743
+ input TokenizerSourceInput {
15744
+ fileName: String!
15745
+ repo: String!
15746
+ revision: String!
15747
+ }
15748
+
15724
15749
  type TriggeredNotification {
15725
15750
  notification: Notification!
15726
15751
  perspectiveId: String!
15727
15752
  triggerMatch: String!
15728
15753
  }
15754
+
15755
+ input VoiceActivityParamsInput {
15756
+ endThreshold: Float
15757
+ endWindow: Float
15758
+ startThreshold: Float
15759
+ startWindow: Float
15760
+ timeBeforeSpeech: Float
15761
+ }
15729
15762
  `;
15730
15763
 
15731
15764
  function formatList(list) {
@@ -20,7 +20,13 @@ export declare class AIClient {
20
20
  modelLoadingStatus(model: string): Promise<AIModelLoadingStatus>;
21
21
  prompt(taskId: string, prompt: string): Promise<string>;
22
22
  embed(modelId: string, text: string): Promise<Array<number>>;
23
- openTranscriptionStream(modelId: string, streamCallback: (text: string) => void): Promise<string>;
23
+ openTranscriptionStream(modelId: string, streamCallback: (text: string) => void, params?: {
24
+ startThreshold?: number;
25
+ startWindow?: number;
26
+ endThreshold?: number;
27
+ endWindow?: number;
28
+ timeBeforeSpeech?: number;
29
+ }): Promise<string>;
24
30
  closeTranscriptionStream(streamId: string): Promise<void>;
25
31
  feedTranscriptionStream(streamId: string, audio: Float32Array): Promise<void>;
26
32
  }
@@ -36,8 +36,13 @@ export class AIClient {
36
36
  }
37
37
  local {
38
38
  fileName
39
- tokenizerSource
40
- modelParameters
39
+ tokenizerSource {
40
+ repo
41
+ revision
42
+ fileName
43
+ }
44
+ huggingfaceRepo
45
+ revision
41
46
  }
42
47
  modelType
43
48
  }
@@ -105,8 +110,13 @@ export class AIClient {
105
110
  }
106
111
  local {
107
112
  fileName
108
- tokenizerSource
109
- modelParameters
113
+ tokenizerSource {
114
+ repo
115
+ revision
116
+ fileName
117
+ }
118
+ huggingfaceRepo
119
+ revision
110
120
  }
111
121
  modelType
112
122
  }
@@ -269,15 +279,16 @@ export class AIClient {
269
279
  const decompressed = JSON.parse(pako.inflate(compressed, { to: 'string' }));
270
280
  return decompressed;
271
281
  }
272
- async openTranscriptionStream(modelId, streamCallback) {
282
+ async openTranscriptionStream(modelId, streamCallback, params) {
273
283
  const { aiOpenTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
274
284
  mutation: gql `
275
- mutation AiOpenTranscriptionStream($modelId: String!) {
276
- aiOpenTranscriptionStream(modelId: $modelId)
285
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
286
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
277
287
  }
278
288
  `,
279
289
  variables: {
280
- modelId
290
+ modelId,
291
+ params
281
292
  }
282
293
  }));
283
294
  const subscription = __classPrivateFieldGet(this, _AIClient_apolloClient, "f").subscribe({
@@ -5,10 +5,16 @@ export declare class ModelApi {
5
5
  model: string;
6
6
  apiType: String;
7
7
  }
8
+ export declare class TokenizerSource {
9
+ repo: string;
10
+ revision: string;
11
+ fileName: string;
12
+ }
8
13
  export declare class LocalModel {
9
14
  fileName: string;
10
- tokenizerSource: string;
11
- modelParameters: string;
15
+ tokenizerSource?: TokenizerSource;
16
+ huggingfaceRepo?: string;
17
+ revision?: string;
12
18
  }
13
19
  export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
14
20
  export declare class Model {
@@ -24,10 +30,16 @@ export declare class ModelApiInput {
24
30
  model: string;
25
31
  apiType: string;
26
32
  }
33
+ export declare class TokenizerSourceInput {
34
+ repo: string;
35
+ revision: string;
36
+ fileName: string;
37
+ }
27
38
  export declare class LocalModelInput {
28
39
  fileName: string;
29
- tokenizerSource: string;
30
- modelParameters: string;
40
+ tokenizerSource?: TokenizerSourceInput;
41
+ huggingfaceRepo?: string;
42
+ revision?: string;
31
43
  }
32
44
  export declare class ModelInput {
33
45
  name: string;
@@ -35,6 +47,13 @@ export declare class ModelInput {
35
47
  local?: LocalModelInput;
36
48
  modelType: ModelType;
37
49
  }
50
+ export declare class VoiceActivityParamsInput {
51
+ startThreshold?: number;
52
+ startWindow?: number;
53
+ endThreshold?: number;
54
+ endWindow?: number;
55
+ timeBeforeSpeech?: number;
56
+ }
38
57
  export default class AIResolver {
39
58
  aiGetModels(): Model[];
40
59
  aiAddModel(model: ModelInput): string;
@@ -49,7 +68,7 @@ export default class AIResolver {
49
68
  aiModelLoadingStatus(model: string): AIModelLoadingStatus;
50
69
  aiPrompt(taskId: string, input: string): string;
51
70
  aiEmbed(modelId: string, text: string): string;
52
- aiOpenTranscriptionStream(modelId: string): string;
71
+ aiOpenTranscriptionStream(modelId: string, params?: VoiceActivityParamsInput): string;
53
72
  aiCloseTranscriptionStream(streamId: string): boolean;
54
73
  aiFeedTranscriptionStream(streamId: string, audio: number[], pubSub: any): boolean;
55
74
  aiTranscriptionText(streamId: string): string;
@@ -39,20 +39,42 @@ ModelApi = __decorate([
39
39
  ObjectType()
40
40
  ], ModelApi);
41
41
  export { ModelApi };
42
- let LocalModel = class LocalModel {
42
+ let TokenizerSource = class TokenizerSource {
43
43
  };
44
44
  __decorate([
45
45
  Field(),
46
46
  __metadata("design:type", String)
47
- ], LocalModel.prototype, "fileName", void 0);
47
+ ], TokenizerSource.prototype, "repo", void 0);
48
48
  __decorate([
49
49
  Field(),
50
50
  __metadata("design:type", String)
51
- ], LocalModel.prototype, "tokenizerSource", void 0);
51
+ ], TokenizerSource.prototype, "revision", void 0);
52
52
  __decorate([
53
53
  Field(),
54
54
  __metadata("design:type", String)
55
- ], LocalModel.prototype, "modelParameters", void 0);
55
+ ], TokenizerSource.prototype, "fileName", void 0);
56
+ TokenizerSource = __decorate([
57
+ ObjectType()
58
+ ], TokenizerSource);
59
+ export { TokenizerSource };
60
+ let LocalModel = class LocalModel {
61
+ };
62
+ __decorate([
63
+ Field(),
64
+ __metadata("design:type", String)
65
+ ], LocalModel.prototype, "fileName", void 0);
66
+ __decorate([
67
+ Field({ nullable: true }),
68
+ __metadata("design:type", TokenizerSource)
69
+ ], LocalModel.prototype, "tokenizerSource", void 0);
70
+ __decorate([
71
+ Field({ nullable: true }),
72
+ __metadata("design:type", String)
73
+ ], LocalModel.prototype, "huggingfaceRepo", void 0);
74
+ __decorate([
75
+ Field({ nullable: true }),
76
+ __metadata("design:type", String)
77
+ ], LocalModel.prototype, "revision", void 0);
56
78
  LocalModel = __decorate([
57
79
  ObjectType()
58
80
  ], LocalModel);
@@ -105,20 +127,42 @@ ModelApiInput = __decorate([
105
127
  InputType()
106
128
  ], ModelApiInput);
107
129
  export { ModelApiInput };
108
- let LocalModelInput = class LocalModelInput {
130
+ let TokenizerSourceInput = class TokenizerSourceInput {
109
131
  };
110
132
  __decorate([
111
133
  Field(),
112
134
  __metadata("design:type", String)
113
- ], LocalModelInput.prototype, "fileName", void 0);
135
+ ], TokenizerSourceInput.prototype, "repo", void 0);
114
136
  __decorate([
115
137
  Field(),
116
138
  __metadata("design:type", String)
117
- ], LocalModelInput.prototype, "tokenizerSource", void 0);
139
+ ], TokenizerSourceInput.prototype, "revision", void 0);
118
140
  __decorate([
119
141
  Field(),
120
142
  __metadata("design:type", String)
121
- ], LocalModelInput.prototype, "modelParameters", void 0);
143
+ ], TokenizerSourceInput.prototype, "fileName", void 0);
144
+ TokenizerSourceInput = __decorate([
145
+ InputType()
146
+ ], TokenizerSourceInput);
147
+ export { TokenizerSourceInput };
148
+ let LocalModelInput = class LocalModelInput {
149
+ };
150
+ __decorate([
151
+ Field(),
152
+ __metadata("design:type", String)
153
+ ], LocalModelInput.prototype, "fileName", void 0);
154
+ __decorate([
155
+ Field({ nullable: true }),
156
+ __metadata("design:type", TokenizerSourceInput)
157
+ ], LocalModelInput.prototype, "tokenizerSource", void 0);
158
+ __decorate([
159
+ Field({ nullable: true }),
160
+ __metadata("design:type", String)
161
+ ], LocalModelInput.prototype, "huggingfaceRepo", void 0);
162
+ __decorate([
163
+ Field({ nullable: true }),
164
+ __metadata("design:type", String)
165
+ ], LocalModelInput.prototype, "revision", void 0);
122
166
  LocalModelInput = __decorate([
123
167
  InputType()
124
168
  ], LocalModelInput);
@@ -145,6 +189,32 @@ ModelInput = __decorate([
145
189
  InputType()
146
190
  ], ModelInput);
147
191
  export { ModelInput };
192
+ let VoiceActivityParamsInput = class VoiceActivityParamsInput {
193
+ };
194
+ __decorate([
195
+ Field(() => Float, { nullable: true }),
196
+ __metadata("design:type", Number)
197
+ ], VoiceActivityParamsInput.prototype, "startThreshold", void 0);
198
+ __decorate([
199
+ Field(() => Float, { nullable: true }),
200
+ __metadata("design:type", Number)
201
+ ], VoiceActivityParamsInput.prototype, "startWindow", void 0);
202
+ __decorate([
203
+ Field(() => Float, { nullable: true }),
204
+ __metadata("design:type", Number)
205
+ ], VoiceActivityParamsInput.prototype, "endThreshold", void 0);
206
+ __decorate([
207
+ Field(() => Float, { nullable: true }),
208
+ __metadata("design:type", Number)
209
+ ], VoiceActivityParamsInput.prototype, "endWindow", void 0);
210
+ __decorate([
211
+ Field(() => Float, { nullable: true }),
212
+ __metadata("design:type", Number)
213
+ ], VoiceActivityParamsInput.prototype, "timeBeforeSpeech", void 0);
214
+ VoiceActivityParamsInput = __decorate([
215
+ InputType()
216
+ ], VoiceActivityParamsInput);
217
+ export { VoiceActivityParamsInput };
148
218
  let AIResolver = class AIResolver {
149
219
  aiGetModels() {
150
220
  return [
@@ -159,8 +229,13 @@ let AIResolver = class AIResolver {
159
229
  },
160
230
  local: {
161
231
  fileName: "test-model.bin",
162
- tokenizerSource: "test-tokenizer",
163
- modelParameters: "{}"
232
+ tokenizerSource: {
233
+ repo: "test-repo",
234
+ revision: "main",
235
+ fileName: "tokenizer.json"
236
+ },
237
+ huggingfaceRepo: "test-repo",
238
+ revision: "main"
164
239
  },
165
240
  modelType: "LLM"
166
241
  }
@@ -195,8 +270,13 @@ let AIResolver = class AIResolver {
195
270
  },
196
271
  local: {
197
272
  fileName: "test-model.bin",
198
- tokenizerSource: "test-tokenizer",
199
- modelParameters: "{}"
273
+ tokenizerSource: {
274
+ repo: "test-repo",
275
+ revision: "main",
276
+ fileName: "tokenizer.json"
277
+ },
278
+ huggingfaceRepo: "test-repo",
279
+ revision: "main"
200
280
  },
201
281
  modelType: modelType
202
282
  };
@@ -227,7 +307,7 @@ let AIResolver = class AIResolver {
227
307
  const compressedString = base64js.fromByteArray(compressed);
228
308
  return compressedString;
229
309
  }
230
- aiOpenTranscriptionStream(modelId) {
310
+ aiOpenTranscriptionStream(modelId, params) {
231
311
  return "streamId";
232
312
  }
233
313
  aiCloseTranscriptionStream(streamId) {
@@ -338,8 +418,9 @@ __decorate([
338
418
  __decorate([
339
419
  Mutation(() => String),
340
420
  __param(0, Arg("modelId")),
421
+ __param(1, Arg("params", () => VoiceActivityParamsInput, { nullable: true })),
341
422
  __metadata("design:type", Function),
342
- __metadata("design:paramtypes", [String]),
423
+ __metadata("design:paramtypes", [String, VoiceActivityParamsInput]),
343
424
  __metadata("design:returntype", String)
344
425
  ], AIResolver.prototype, "aiOpenTranscriptionStream", null);
345
426
  __decorate([
@@ -251,14 +251,16 @@ input LinkQuery {
251
251
 
252
252
  type LocalModel {
253
253
  fileName: String!
254
- modelParameters: String!
255
- tokenizerSource: String!
254
+ huggingfaceRepo: String
255
+ revision: String
256
+ tokenizerSource: TokenizerSource
256
257
  }
257
258
 
258
259
  input LocalModelInput {
259
260
  fileName: String!
260
- modelParameters: String!
261
- tokenizerSource: String!
261
+ huggingfaceRepo: String
262
+ revision: String
263
+ tokenizerSource: TokenizerSourceInput
262
264
  }
263
265
 
264
266
  type Model {
@@ -312,7 +314,7 @@ type Mutation {
312
314
  aiCloseTranscriptionStream(streamId: String!): String!
313
315
  aiEmbed(modelId: String!, text: String!): String!
314
316
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
315
- aiOpenTranscriptionStream(modelId: String!): String!
317
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
316
318
  aiPrompt(prompt: String!, taskId: String!): String!
317
319
  aiRemoveModel(modelId: String!): Boolean!
318
320
  aiRemoveTask(taskId: String!): AITask!
@@ -510,8 +512,28 @@ type Subscription {
510
512
  runtimeNotificationTriggered: TriggeredNotification
511
513
  }
512
514
 
515
+ type TokenizerSource {
516
+ fileName: String!
517
+ repo: String!
518
+ revision: String!
519
+ }
520
+
521
+ input TokenizerSourceInput {
522
+ fileName: String!
523
+ repo: String!
524
+ revision: String!
525
+ }
526
+
513
527
  type TriggeredNotification {
514
528
  notification: Notification!
515
529
  perspectiveId: String!
516
530
  triggerMatch: String!
517
531
  }
532
+
533
+ input VoiceActivityParamsInput {
534
+ endThreshold: Float
535
+ endWindow: Float
536
+ startThreshold: Float
537
+ startWindow: Float
538
+ timeBeforeSpeech: Float
539
+ }
@@ -247,14 +247,16 @@ input LinkQuery {
247
247
 
248
248
  type LocalModel {
249
249
  fileName: String!
250
- modelParameters: String!
251
- tokenizerSource: String!
250
+ huggingfaceRepo: String
251
+ revision: String
252
+ tokenizerSource: TokenizerSource
252
253
  }
253
254
 
254
255
  input LocalModelInput {
255
256
  fileName: String!
256
- modelParameters: String!
257
- tokenizerSource: String!
257
+ huggingfaceRepo: String
258
+ revision: String
259
+ tokenizerSource: TokenizerSourceInput
258
260
  }
259
261
 
260
262
  type Model {
@@ -308,7 +310,7 @@ type Mutation {
308
310
  aiCloseTranscriptionStream(streamId: String!): String!
309
311
  aiEmbed(modelId: String!, text: String!): String!
310
312
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
311
- aiOpenTranscriptionStream(modelId: String!): String!
313
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
312
314
  aiPrompt(prompt: String!, taskId: String!): String!
313
315
  aiRemoveModel(modelId: String!): Boolean!
314
316
  aiRemoveTask(taskId: String!): AITask!
@@ -506,9 +508,29 @@ type Subscription {
506
508
  runtimeNotificationTriggered: TriggeredNotification
507
509
  }
508
510
 
511
+ type TokenizerSource {
512
+ fileName: String!
513
+ repo: String!
514
+ revision: String!
515
+ }
516
+
517
+ input TokenizerSourceInput {
518
+ fileName: String!
519
+ repo: String!
520
+ revision: String!
521
+ }
522
+
509
523
  type TriggeredNotification {
510
524
  notification: Notification!
511
525
  perspectiveId: String!
512
526
  triggerMatch: String!
513
527
  }
528
+
529
+ input VoiceActivityParamsInput {
530
+ endThreshold: Float
531
+ endWindow: Float
532
+ startThreshold: Float
533
+ startWindow: Float
534
+ timeBeforeSpeech: Float
535
+ }
514
536
  `
package/package.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/src/index.d.ts",
7
7
  "type": "module",
8
- "private": false,
9
8
  "scripts": {
10
9
  "build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
11
10
  "buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
@@ -69,5 +68,5 @@
69
68
  "graphql@15.7.2": "patches/graphql@15.7.2.patch"
70
69
  }
71
70
  },
72
- "version": "0.10.1-rc7"
71
+ "version": "0.10.1-rc9-dev"
73
72
  }
@@ -1158,9 +1158,26 @@ describe('Ad4mClient', () => {
1158
1158
  expect(models).toBeDefined();
1159
1159
  expect(Array.isArray(models)).toBe(true);
1160
1160
  if (models.length > 0) {
1161
- expect(models[0]).toHaveProperty('name');
1162
- expect(models[0]).toHaveProperty('api');
1163
- expect(models[0]).toHaveProperty('local');
1161
+ const model = models[0];
1162
+ expect(model).toHaveProperty('name');
1163
+ expect(model).toHaveProperty('id');
1164
+ expect(model).toHaveProperty('modelType');
1165
+ if (model.api) {
1166
+ expect(model.api).toHaveProperty('baseUrl');
1167
+ expect(model.api).toHaveProperty('apiKey');
1168
+ expect(model.api).toHaveProperty('model');
1169
+ expect(model.api).toHaveProperty('apiType');
1170
+ }
1171
+ if (model.local) {
1172
+ expect(model.local).toHaveProperty('fileName');
1173
+ if (model.local.tokenizerSource) {
1174
+ expect(model.local.tokenizerSource).toHaveProperty('repo');
1175
+ expect(model.local.tokenizerSource).toHaveProperty('revision');
1176
+ expect(model.local.tokenizerSource).toHaveProperty('fileName');
1177
+ }
1178
+ expect(model.local).toHaveProperty('huggingfaceRepo');
1179
+ expect(model.local).toHaveProperty('revision');
1180
+ }
1164
1181
  }
1165
1182
  })
1166
1183
 
@@ -1175,8 +1192,13 @@ describe('Ad4mClient', () => {
1175
1192
  },
1176
1193
  local: {
1177
1194
  fileName: "new-test-model.bin",
1178
- tokenizerSource: "new-test-tokenizer",
1179
- modelParameters: "{}"
1195
+ tokenizerSource: {
1196
+ repo: "test-repo",
1197
+ revision: "main",
1198
+ fileName: "tokenizer.json"
1199
+ },
1200
+ huggingfaceRepo: "test-repo",
1201
+ revision: "main"
1180
1202
  },
1181
1203
  modelType: "LLM"
1182
1204
  };
@@ -1196,8 +1218,13 @@ describe('Ad4mClient', () => {
1196
1218
  },
1197
1219
  local: {
1198
1220
  fileName: "updated-test-model.bin",
1199
- tokenizerSource: "updated-test-tokenizer",
1200
- modelParameters: "{}"
1221
+ tokenizerSource: {
1222
+ repo: "test-repo",
1223
+ revision: "main",
1224
+ fileName: "tokenizer.json"
1225
+ },
1226
+ huggingfaceRepo: "test-repo",
1227
+ revision: "main"
1201
1228
  },
1202
1229
  modelType: "LLM"
1203
1230
  };
@@ -1222,18 +1249,23 @@ describe('Ad4mClient', () => {
1222
1249
  const setResult = await ad4mClient.ai.setDefaultModel(modelType, modelName);
1223
1250
  expect(setResult).toBe(true);
1224
1251
 
1225
- const model = await ad4mClient.ai.getDefaultModel(modelType);
1226
- expect(model).toBeDefined();
1227
- expect(model.name).toBe("Default Test Model");
1228
- expect(model.api).toBeDefined();
1229
- expect(model.api.baseUrl).toBe("https://api.example.com");
1230
- expect(model.api.apiKey).toBe("test-api-key");
1231
- expect(model.api.apiType).toBe("OpenAi");
1232
- expect(model.local).toBeDefined();
1233
- expect(model.local.fileName).toBe("test-model.bin");
1234
- expect(model.local.tokenizerSource).toBe("test-tokenizer");
1235
- expect(model.local.modelParameters).toBe("{}");
1236
- expect(model.modelType).toBe(modelType);
1252
+ const defaultModel = await ad4mClient.ai.getDefaultModel(modelType);
1253
+ expect(defaultModel).toBeDefined();
1254
+ expect(defaultModel.name).toBe("Default Test Model");
1255
+ expect(defaultModel.api).toBeDefined();
1256
+ expect(defaultModel.api.baseUrl).toBe("https://api.example.com");
1257
+ expect(defaultModel.api.apiKey).toBe("test-api-key");
1258
+ expect(defaultModel.api.apiType).toBe("OpenAi");
1259
+ expect(defaultModel.local).toBeDefined();
1260
+ expect(defaultModel.local.fileName).toBe("test-model.bin");
1261
+ if (defaultModel.local.tokenizerSource) {
1262
+ expect(defaultModel.local.tokenizerSource.repo).toBe("test-repo");
1263
+ expect(defaultModel.local.tokenizerSource.revision).toBe("main");
1264
+ expect(defaultModel.local.tokenizerSource.fileName).toBe("tokenizer.json");
1265
+ }
1266
+ expect(defaultModel.local.huggingfaceRepo).toBe("test-repo");
1267
+ expect(defaultModel.local.revision).toBe("main");
1268
+ expect(defaultModel.modelType).toBe(modelType);
1237
1269
  })
1238
1270
 
1239
1271
  it('embed()', async () => {
@@ -28,8 +28,13 @@ export class AIClient {
28
28
  }
29
29
  local {
30
30
  fileName
31
- tokenizerSource
32
- modelParameters
31
+ tokenizerSource {
32
+ repo
33
+ revision
34
+ fileName
35
+ }
36
+ huggingfaceRepo
37
+ revision
33
38
  }
34
39
  modelType
35
40
  }
@@ -102,8 +107,13 @@ export class AIClient {
102
107
  }
103
108
  local {
104
109
  fileName
105
- tokenizerSource
106
- modelParameters
110
+ tokenizerSource {
111
+ repo
112
+ revision
113
+ fileName
114
+ }
115
+ huggingfaceRepo
116
+ revision
107
117
  }
108
118
  modelType
109
119
  }
@@ -283,15 +293,26 @@ export class AIClient {
283
293
  return decompressed;
284
294
  }
285
295
 
286
- async openTranscriptionStream(modelId: string, streamCallback: (text: string) => void): Promise<string> {
296
+ async openTranscriptionStream(
297
+ modelId: string,
298
+ streamCallback: (text: string) => void,
299
+ params?: {
300
+ startThreshold?: number;
301
+ startWindow?: number;
302
+ endThreshold?: number;
303
+ endWindow?: number;
304
+ timeBeforeSpeech?: number;
305
+ }
306
+ ): Promise<string> {
287
307
  const { aiOpenTranscriptionStream } = unwrapApolloResult(await this.#apolloClient.mutate({
288
308
  mutation: gql`
289
- mutation AiOpenTranscriptionStream($modelId: String!) {
290
- aiOpenTranscriptionStream(modelId: $modelId)
309
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
310
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
291
311
  }
292
312
  `,
293
313
  variables: {
294
- modelId
314
+ modelId,
315
+ params
295
316
  }
296
317
  }));
297
318
 
@@ -24,15 +24,30 @@ export class ModelApi {
24
24
  }
25
25
 
26
26
  @ObjectType()
27
- export class LocalModel {
27
+ export class TokenizerSource {
28
28
  @Field()
29
- fileName: string;
29
+ repo: string;
30
30
 
31
31
  @Field()
32
- tokenizerSource: string;
32
+ revision: string;
33
33
 
34
34
  @Field()
35
- modelParameters: string;
35
+ fileName: string;
36
+ }
37
+
38
+ @ObjectType()
39
+ export class LocalModel {
40
+ @Field()
41
+ fileName: string;
42
+
43
+ @Field({ nullable: true })
44
+ tokenizerSource?: TokenizerSource;
45
+
46
+ @Field({ nullable: true })
47
+ huggingfaceRepo?: string;
48
+
49
+ @Field({ nullable: true })
50
+ revision?: string;
36
51
  }
37
52
 
38
53
  export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
@@ -71,15 +86,30 @@ export class ModelApiInput {
71
86
  }
72
87
 
73
88
  @InputType()
74
- export class LocalModelInput {
89
+ export class TokenizerSourceInput {
75
90
  @Field()
76
- fileName: string;
91
+ repo: string;
77
92
 
78
93
  @Field()
79
- tokenizerSource: string;
94
+ revision: string;
80
95
 
81
96
  @Field()
82
- modelParameters: string;
97
+ fileName: string;
98
+ }
99
+
100
+ @InputType()
101
+ export class LocalModelInput {
102
+ @Field()
103
+ fileName: string;
104
+
105
+ @Field({ nullable: true })
106
+ tokenizerSource?: TokenizerSourceInput;
107
+
108
+ @Field({ nullable: true })
109
+ huggingfaceRepo?: string;
110
+
111
+ @Field({ nullable: true })
112
+ revision?: string;
83
113
  }
84
114
 
85
115
  @InputType()
@@ -97,6 +127,24 @@ export class ModelInput {
97
127
  modelType: ModelType;
98
128
  }
99
129
 
130
+ @InputType()
131
+ export class VoiceActivityParamsInput {
132
+ @Field(() => Float, { nullable: true })
133
+ startThreshold?: number;
134
+
135
+ @Field(() => Float, { nullable: true })
136
+ startWindow?: number;
137
+
138
+ @Field(() => Float, { nullable: true })
139
+ endThreshold?: number;
140
+
141
+ @Field(() => Float, { nullable: true })
142
+ endWindow?: number;
143
+
144
+ @Field(() => Float, { nullable: true })
145
+ timeBeforeSpeech?: number;
146
+ }
147
+
100
148
  @Resolver()
101
149
  export default class AIResolver {
102
150
  @Query(returns => [Model])
@@ -113,8 +161,13 @@ export default class AIResolver {
113
161
  },
114
162
  local: {
115
163
  fileName: "test-model.bin",
116
- tokenizerSource: "test-tokenizer",
117
- modelParameters: "{}"
164
+ tokenizerSource: {
165
+ repo: "test-repo",
166
+ revision: "main",
167
+ fileName: "tokenizer.json"
168
+ },
169
+ huggingfaceRepo: "test-repo",
170
+ revision: "main"
118
171
  },
119
172
  modelType: "LLM"
120
173
  }
@@ -165,8 +218,13 @@ export default class AIResolver {
165
218
  },
166
219
  local: {
167
220
  fileName: "test-model.bin",
168
- tokenizerSource: "test-tokenizer",
169
- modelParameters: "{}"
221
+ tokenizerSource: {
222
+ repo: "test-repo",
223
+ revision: "main",
224
+ fileName: "tokenizer.json"
225
+ },
226
+ huggingfaceRepo: "test-repo",
227
+ revision: "main"
170
228
  },
171
229
  modelType: modelType
172
230
  }
@@ -279,7 +337,8 @@ export default class AIResolver {
279
337
 
280
338
  @Mutation(() => String)
281
339
  aiOpenTranscriptionStream(
282
- @Arg("modelId") modelId: string
340
+ @Arg("modelId") modelId: string,
341
+ @Arg("params", () => VoiceActivityParamsInput, { nullable: true }) params?: VoiceActivityParamsInput
283
342
  ): string {
284
343
  return "streamId"
285
344
  }
package/yarn-error.log ADDED
@@ -0,0 +1,90 @@
1
+ Arguments:
2
+ /Users/nicolasluck/.nvm/versions/node/v18.16.1/bin/node /Users/nicolasluck/.nvm/versions/node/v18.16.1/bin/yarn install
3
+
4
+ PATH:
5
+ /Users/nicolasluck/Library/pnpm:/Users/nicolasluck/.nvm/versions/node/v18.16.1/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Users/nicolasluck/.cargo/bin
6
+
7
+ Yarn version:
8
+ 1.22.19
9
+
10
+ Node version:
11
+ 18.16.1
12
+
13
+ Platform:
14
+ darwin arm64
15
+
16
+ Trace:
17
+ Error: ENOENT: no such file or directory, copyfile '/Users/nicolasluck/Library/Caches/Yarn/v6/npm-has-flag-3.0.0-b5d454dc2199ae225699f3467e5a07f3b955bafd-integrity/node_modules/has-flag/index.js' -> '/Users/nicolasluck/Coasys/code/ad4m/node_modules/@changesets/cli/node_modules/has-flag/index.js'
18
+
19
+ npm manifest:
20
+ {
21
+ "name": "@coasys/ad4m",
22
+ "description": "*The Agent-Centric Distributed Application Meta-ontology* or just: *Agent-Centric DApp Meta-ontology* * A new meta-ontology for interoperable, decentralized application design * A spanning-layer to enable seamless integration between Holochain DNAs, blockchains, linked-data structures/ontologies and centralized back-ends * The basis for turning distinct, monolithic and siloed apps into a global, open and interoperable sense-making network",
23
+ "main": "lib/index.cjs",
24
+ "module": "lib/index.js",
25
+ "types": "lib/src/index.d.ts",
26
+ "type": "module",
27
+ "private": true,
28
+ "scripts": {
29
+ "build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
30
+ "buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
31
+ "bundle": "rollup -c rollup.config.js",
32
+ "test": "jest --forceExit"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/perspect3vism/ad4m.git"
37
+ },
38
+ "author": {
39
+ "name": "Nicolas Luck",
40
+ "email": "nicolas@lucksus.eu"
41
+ },
42
+ "contributors": [
43
+ {
44
+ "name": "Joshua Parkin",
45
+ "email": "joshuadparkin@gmail.com"
46
+ }
47
+ ],
48
+ "license": "CAL-1.0",
49
+ "bugs": {
50
+ "url": "https://github.com/perspect3vism/ad4m/issues"
51
+ },
52
+ "homepage": "https://ad4m.dev",
53
+ "dependencies": {
54
+ "@apollo/client": "3.7.10",
55
+ "@holochain/client": "0.16.0",
56
+ "@types/jest": "^26.0.14",
57
+ "class-validator": "^0.13.1",
58
+ "express": "4.18.2",
59
+ "graphql": "15.7.2",
60
+ "reflect-metadata": "^0.1.13",
61
+ "type-graphql": "1.1.1"
62
+ },
63
+ "devDependencies": {
64
+ "@apollo/server": "^4.9.4",
65
+ "@rollup/plugin-alias": "^3.1.5",
66
+ "@rollup/plugin-commonjs": "^20.0.0",
67
+ "@rollup/plugin-node-resolve": "^13.0.4",
68
+ "concat-md": "^0.5.0",
69
+ "cross-fetch": "^3.1.4",
70
+ "graphql-ws": "5.12.0",
71
+ "honkit": "^4.0.0",
72
+ "jest": "^26.6.0",
73
+ "patch-package": "^8.0.0",
74
+ "rollup": "^2.56.3",
75
+ "ts-jest": "^26.5.6",
76
+ "typescript": "^4.6.2",
77
+ "ws": "8.13.0",
78
+ "@types/node": "*",
79
+ "@types/yargs": "*"
80
+ },
81
+ "patchedDependencies": {},
82
+ "version": "0.9.1-prerelease"
83
+
84
+ }
85
+
86
+ yarn manifest:
87
+ No manifest
88
+
89
+ Lockfile:
90
+ No lockfile