@coasys/ad4m 0.10.1-rc7 → 0.10.1-rc8
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 +32 -8
- package/lib/index.js +32 -8
- package/lib/src/ai/AIClient.js +14 -4
- package/lib/src/ai/AIResolver.d.ts +16 -4
- package/lib/src/ai/AIResolver.js +66 -12
- package/lib/src/schema.gql +18 -4
- package/lib/src/typeDefs.js +18 -4
- package/package.json +1 -1
- package/src/Ad4mClient.test.ts +51 -19
- package/src/ai/AIClient.ts +14 -4
- package/src/ai/AIResolver.ts +52 -12
package/lib/index.cjs
CHANGED
|
@@ -14032,8 +14032,13 @@ class AIClient {
|
|
|
14032
14032
|
}
|
|
14033
14033
|
local {
|
|
14034
14034
|
fileName
|
|
14035
|
-
tokenizerSource
|
|
14036
|
-
|
|
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
|
-
|
|
14109
|
+
tokenizerSource {
|
|
14110
|
+
repo
|
|
14111
|
+
revision
|
|
14112
|
+
fileName
|
|
14113
|
+
}
|
|
14114
|
+
huggingfaceRepo
|
|
14115
|
+
revision
|
|
14106
14116
|
}
|
|
14107
14117
|
modelType
|
|
14108
14118
|
}
|
|
@@ -15466,14 +15476,16 @@ input LinkQuery {
|
|
|
15466
15476
|
|
|
15467
15477
|
type LocalModel {
|
|
15468
15478
|
fileName: String!
|
|
15469
|
-
|
|
15470
|
-
|
|
15479
|
+
huggingfaceRepo: String
|
|
15480
|
+
revision: String
|
|
15481
|
+
tokenizerSource: TokenizerSource
|
|
15471
15482
|
}
|
|
15472
15483
|
|
|
15473
15484
|
input LocalModelInput {
|
|
15474
15485
|
fileName: String!
|
|
15475
|
-
|
|
15476
|
-
|
|
15486
|
+
huggingfaceRepo: String
|
|
15487
|
+
revision: String
|
|
15488
|
+
tokenizerSource: TokenizerSourceInput
|
|
15477
15489
|
}
|
|
15478
15490
|
|
|
15479
15491
|
type Model {
|
|
@@ -15725,6 +15737,18 @@ type Subscription {
|
|
|
15725
15737
|
runtimeNotificationTriggered: TriggeredNotification
|
|
15726
15738
|
}
|
|
15727
15739
|
|
|
15740
|
+
type TokenizerSource {
|
|
15741
|
+
fileName: String!
|
|
15742
|
+
repo: String!
|
|
15743
|
+
revision: String!
|
|
15744
|
+
}
|
|
15745
|
+
|
|
15746
|
+
input TokenizerSourceInput {
|
|
15747
|
+
fileName: String!
|
|
15748
|
+
repo: String!
|
|
15749
|
+
revision: String!
|
|
15750
|
+
}
|
|
15751
|
+
|
|
15728
15752
|
type TriggeredNotification {
|
|
15729
15753
|
notification: Notification!
|
|
15730
15754
|
perspectiveId: String!
|
package/lib/index.js
CHANGED
|
@@ -14028,8 +14028,13 @@ class AIClient {
|
|
|
14028
14028
|
}
|
|
14029
14029
|
local {
|
|
14030
14030
|
fileName
|
|
14031
|
-
tokenizerSource
|
|
14032
|
-
|
|
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
|
-
|
|
14105
|
+
tokenizerSource {
|
|
14106
|
+
repo
|
|
14107
|
+
revision
|
|
14108
|
+
fileName
|
|
14109
|
+
}
|
|
14110
|
+
huggingfaceRepo
|
|
14111
|
+
revision
|
|
14102
14112
|
}
|
|
14103
14113
|
modelType
|
|
14104
14114
|
}
|
|
@@ -15462,14 +15472,16 @@ input LinkQuery {
|
|
|
15462
15472
|
|
|
15463
15473
|
type LocalModel {
|
|
15464
15474
|
fileName: String!
|
|
15465
|
-
|
|
15466
|
-
|
|
15475
|
+
huggingfaceRepo: String
|
|
15476
|
+
revision: String
|
|
15477
|
+
tokenizerSource: TokenizerSource
|
|
15467
15478
|
}
|
|
15468
15479
|
|
|
15469
15480
|
input LocalModelInput {
|
|
15470
15481
|
fileName: String!
|
|
15471
|
-
|
|
15472
|
-
|
|
15482
|
+
huggingfaceRepo: String
|
|
15483
|
+
revision: String
|
|
15484
|
+
tokenizerSource: TokenizerSourceInput
|
|
15473
15485
|
}
|
|
15474
15486
|
|
|
15475
15487
|
type Model {
|
|
@@ -15721,6 +15733,18 @@ type Subscription {
|
|
|
15721
15733
|
runtimeNotificationTriggered: TriggeredNotification
|
|
15722
15734
|
}
|
|
15723
15735
|
|
|
15736
|
+
type TokenizerSource {
|
|
15737
|
+
fileName: String!
|
|
15738
|
+
repo: String!
|
|
15739
|
+
revision: String!
|
|
15740
|
+
}
|
|
15741
|
+
|
|
15742
|
+
input TokenizerSourceInput {
|
|
15743
|
+
fileName: String!
|
|
15744
|
+
repo: String!
|
|
15745
|
+
revision: String!
|
|
15746
|
+
}
|
|
15747
|
+
|
|
15724
15748
|
type TriggeredNotification {
|
|
15725
15749
|
notification: Notification!
|
|
15726
15750
|
perspectiveId: String!
|
package/lib/src/ai/AIClient.js
CHANGED
|
@@ -36,8 +36,13 @@ export class AIClient {
|
|
|
36
36
|
}
|
|
37
37
|
local {
|
|
38
38
|
fileName
|
|
39
|
-
tokenizerSource
|
|
40
|
-
|
|
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
|
-
|
|
113
|
+
tokenizerSource {
|
|
114
|
+
repo
|
|
115
|
+
revision
|
|
116
|
+
fileName
|
|
117
|
+
}
|
|
118
|
+
huggingfaceRepo
|
|
119
|
+
revision
|
|
110
120
|
}
|
|
111
121
|
modelType
|
|
112
122
|
}
|
|
@@ -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
|
|
11
|
-
|
|
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
|
|
30
|
-
|
|
40
|
+
tokenizerSource?: TokenizerSourceInput;
|
|
41
|
+
huggingfaceRepo?: string;
|
|
42
|
+
revision?: string;
|
|
31
43
|
}
|
|
32
44
|
export declare class ModelInput {
|
|
33
45
|
name: string;
|
package/lib/src/ai/AIResolver.js
CHANGED
|
@@ -39,20 +39,42 @@ ModelApi = __decorate([
|
|
|
39
39
|
ObjectType()
|
|
40
40
|
], ModelApi);
|
|
41
41
|
export { ModelApi };
|
|
42
|
-
let
|
|
42
|
+
let TokenizerSource = class TokenizerSource {
|
|
43
43
|
};
|
|
44
44
|
__decorate([
|
|
45
45
|
Field(),
|
|
46
46
|
__metadata("design:type", String)
|
|
47
|
-
],
|
|
47
|
+
], TokenizerSource.prototype, "repo", void 0);
|
|
48
48
|
__decorate([
|
|
49
49
|
Field(),
|
|
50
50
|
__metadata("design:type", String)
|
|
51
|
-
],
|
|
51
|
+
], TokenizerSource.prototype, "revision", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
Field(),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], TokenizerSource.prototype, "fileName", void 0);
|
|
56
|
+
TokenizerSource = __decorate([
|
|
57
|
+
ObjectType()
|
|
58
|
+
], TokenizerSource);
|
|
59
|
+
export { TokenizerSource };
|
|
60
|
+
let LocalModel = class LocalModel {
|
|
61
|
+
};
|
|
52
62
|
__decorate([
|
|
53
63
|
Field(),
|
|
54
64
|
__metadata("design:type", String)
|
|
55
|
-
], LocalModel.prototype, "
|
|
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
|
|
130
|
+
let TokenizerSourceInput = class TokenizerSourceInput {
|
|
109
131
|
};
|
|
110
132
|
__decorate([
|
|
111
133
|
Field(),
|
|
112
134
|
__metadata("design:type", String)
|
|
113
|
-
],
|
|
135
|
+
], TokenizerSourceInput.prototype, "repo", void 0);
|
|
114
136
|
__decorate([
|
|
115
137
|
Field(),
|
|
116
138
|
__metadata("design:type", String)
|
|
117
|
-
],
|
|
139
|
+
], TokenizerSourceInput.prototype, "revision", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
Field(),
|
|
142
|
+
__metadata("design:type", String)
|
|
143
|
+
], TokenizerSourceInput.prototype, "fileName", void 0);
|
|
144
|
+
TokenizerSourceInput = __decorate([
|
|
145
|
+
InputType()
|
|
146
|
+
], TokenizerSourceInput);
|
|
147
|
+
export { TokenizerSourceInput };
|
|
148
|
+
let LocalModelInput = class LocalModelInput {
|
|
149
|
+
};
|
|
118
150
|
__decorate([
|
|
119
151
|
Field(),
|
|
120
152
|
__metadata("design:type", String)
|
|
121
|
-
], LocalModelInput.prototype, "
|
|
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);
|
|
@@ -159,8 +203,13 @@ let AIResolver = class AIResolver {
|
|
|
159
203
|
},
|
|
160
204
|
local: {
|
|
161
205
|
fileName: "test-model.bin",
|
|
162
|
-
tokenizerSource:
|
|
163
|
-
|
|
206
|
+
tokenizerSource: {
|
|
207
|
+
repo: "test-repo",
|
|
208
|
+
revision: "main",
|
|
209
|
+
fileName: "tokenizer.json"
|
|
210
|
+
},
|
|
211
|
+
huggingfaceRepo: "test-repo",
|
|
212
|
+
revision: "main"
|
|
164
213
|
},
|
|
165
214
|
modelType: "LLM"
|
|
166
215
|
}
|
|
@@ -195,8 +244,13 @@ let AIResolver = class AIResolver {
|
|
|
195
244
|
},
|
|
196
245
|
local: {
|
|
197
246
|
fileName: "test-model.bin",
|
|
198
|
-
tokenizerSource:
|
|
199
|
-
|
|
247
|
+
tokenizerSource: {
|
|
248
|
+
repo: "test-repo",
|
|
249
|
+
revision: "main",
|
|
250
|
+
fileName: "tokenizer.json"
|
|
251
|
+
},
|
|
252
|
+
huggingfaceRepo: "test-repo",
|
|
253
|
+
revision: "main"
|
|
200
254
|
},
|
|
201
255
|
modelType: modelType
|
|
202
256
|
};
|
package/lib/src/schema.gql
CHANGED
|
@@ -251,14 +251,16 @@ input LinkQuery {
|
|
|
251
251
|
|
|
252
252
|
type LocalModel {
|
|
253
253
|
fileName: String!
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
huggingfaceRepo: String
|
|
255
|
+
revision: String
|
|
256
|
+
tokenizerSource: TokenizerSource
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
input LocalModelInput {
|
|
259
260
|
fileName: String!
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
huggingfaceRepo: String
|
|
262
|
+
revision: String
|
|
263
|
+
tokenizerSource: TokenizerSourceInput
|
|
262
264
|
}
|
|
263
265
|
|
|
264
266
|
type Model {
|
|
@@ -510,6 +512,18 @@ 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!
|
package/lib/src/typeDefs.js
CHANGED
|
@@ -247,14 +247,16 @@ input LinkQuery {
|
|
|
247
247
|
|
|
248
248
|
type LocalModel {
|
|
249
249
|
fileName: String!
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
huggingfaceRepo: String
|
|
251
|
+
revision: String
|
|
252
|
+
tokenizerSource: TokenizerSource
|
|
252
253
|
}
|
|
253
254
|
|
|
254
255
|
input LocalModelInput {
|
|
255
256
|
fileName: String!
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
huggingfaceRepo: String
|
|
258
|
+
revision: String
|
|
259
|
+
tokenizerSource: TokenizerSourceInput
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
type Model {
|
|
@@ -506,6 +508,18 @@ 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!
|
package/package.json
CHANGED
package/src/Ad4mClient.test.ts
CHANGED
|
@@ -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
|
-
|
|
1162
|
-
expect(
|
|
1163
|
-
expect(
|
|
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:
|
|
1179
|
-
|
|
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:
|
|
1200
|
-
|
|
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
|
|
1226
|
-
expect(
|
|
1227
|
-
expect(
|
|
1228
|
-
expect(
|
|
1229
|
-
expect(
|
|
1230
|
-
expect(
|
|
1231
|
-
expect(
|
|
1232
|
-
expect(
|
|
1233
|
-
expect(
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
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 () => {
|
package/src/ai/AIClient.ts
CHANGED
|
@@ -28,8 +28,13 @@ export class AIClient {
|
|
|
28
28
|
}
|
|
29
29
|
local {
|
|
30
30
|
fileName
|
|
31
|
-
tokenizerSource
|
|
32
|
-
|
|
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
|
-
|
|
110
|
+
tokenizerSource {
|
|
111
|
+
repo
|
|
112
|
+
revision
|
|
113
|
+
fileName
|
|
114
|
+
}
|
|
115
|
+
huggingfaceRepo
|
|
116
|
+
revision
|
|
107
117
|
}
|
|
108
118
|
modelType
|
|
109
119
|
}
|
package/src/ai/AIResolver.ts
CHANGED
|
@@ -24,15 +24,30 @@ export class ModelApi {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@ObjectType()
|
|
27
|
-
export class
|
|
27
|
+
export class TokenizerSource {
|
|
28
28
|
@Field()
|
|
29
|
-
|
|
29
|
+
repo: string;
|
|
30
30
|
|
|
31
31
|
@Field()
|
|
32
|
-
|
|
32
|
+
revision: string;
|
|
33
33
|
|
|
34
34
|
@Field()
|
|
35
|
-
|
|
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
|
|
89
|
+
export class TokenizerSourceInput {
|
|
75
90
|
@Field()
|
|
76
|
-
|
|
91
|
+
repo: string;
|
|
92
|
+
|
|
93
|
+
@Field()
|
|
94
|
+
revision: string;
|
|
77
95
|
|
|
78
96
|
@Field()
|
|
79
|
-
|
|
97
|
+
fileName: string;
|
|
98
|
+
}
|
|
80
99
|
|
|
100
|
+
@InputType()
|
|
101
|
+
export class LocalModelInput {
|
|
81
102
|
@Field()
|
|
82
|
-
|
|
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()
|
|
@@ -113,8 +143,13 @@ export default class AIResolver {
|
|
|
113
143
|
},
|
|
114
144
|
local: {
|
|
115
145
|
fileName: "test-model.bin",
|
|
116
|
-
tokenizerSource:
|
|
117
|
-
|
|
146
|
+
tokenizerSource: {
|
|
147
|
+
repo: "test-repo",
|
|
148
|
+
revision: "main",
|
|
149
|
+
fileName: "tokenizer.json"
|
|
150
|
+
},
|
|
151
|
+
huggingfaceRepo: "test-repo",
|
|
152
|
+
revision: "main"
|
|
118
153
|
},
|
|
119
154
|
modelType: "LLM"
|
|
120
155
|
}
|
|
@@ -165,8 +200,13 @@ export default class AIResolver {
|
|
|
165
200
|
},
|
|
166
201
|
local: {
|
|
167
202
|
fileName: "test-model.bin",
|
|
168
|
-
tokenizerSource:
|
|
169
|
-
|
|
203
|
+
tokenizerSource: {
|
|
204
|
+
repo: "test-repo",
|
|
205
|
+
revision: "main",
|
|
206
|
+
fileName: "tokenizer.json"
|
|
207
|
+
},
|
|
208
|
+
huggingfaceRepo: "test-repo",
|
|
209
|
+
revision: "main"
|
|
170
210
|
},
|
|
171
211
|
modelType: modelType
|
|
172
212
|
}
|