weave-typescript 0.20.0 → 0.22.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.
@@ -0,0 +1,1001 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc unknown
6
+ // source: weaveapi/model/v1/model.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.CatalogProvider = exports.ModelParam = exports.AdditionalUnitPrice = exports.ImageGenerationPrice = exports.ModelPricing = exports.Model = exports.ModelCapability = exports.ModelPrimaryType = exports.protobufPackage = void 0;
9
+ exports.modelPrimaryTypeFromJSON = modelPrimaryTypeFromJSON;
10
+ exports.modelPrimaryTypeToJSON = modelPrimaryTypeToJSON;
11
+ exports.modelCapabilityFromJSON = modelCapabilityFromJSON;
12
+ exports.modelCapabilityToJSON = modelCapabilityToJSON;
13
+ /* eslint-disable */
14
+ const wire_1 = require("@bufbuild/protobuf/wire");
15
+ const struct_pb_1 = require("../../../google/protobuf/struct.pb");
16
+ const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
17
+ const provider_pb_1 = require("../../provider/v1/provider.pb");
18
+ exports.protobufPackage = "weaveapi.model.v1";
19
+ /** ModelPrimaryType identifies the primary output modality for a model. */
20
+ var ModelPrimaryType;
21
+ (function (ModelPrimaryType) {
22
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_UNSPECIFIED"] = 0] = "MODEL_PRIMARY_TYPE_UNSPECIFIED";
23
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_CHAT"] = 1] = "MODEL_PRIMARY_TYPE_CHAT";
24
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_IMAGE_GENERATION"] = 2] = "MODEL_PRIMARY_TYPE_IMAGE_GENERATION";
25
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_EMBEDDING"] = 3] = "MODEL_PRIMARY_TYPE_EMBEDDING";
26
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_AUDIO"] = 4] = "MODEL_PRIMARY_TYPE_AUDIO";
27
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_VIDEO"] = 5] = "MODEL_PRIMARY_TYPE_VIDEO";
28
+ ModelPrimaryType[ModelPrimaryType["MODEL_PRIMARY_TYPE_TEXT"] = 6] = "MODEL_PRIMARY_TYPE_TEXT";
29
+ ModelPrimaryType[ModelPrimaryType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
30
+ })(ModelPrimaryType || (exports.ModelPrimaryType = ModelPrimaryType = {}));
31
+ function modelPrimaryTypeFromJSON(object) {
32
+ switch (object) {
33
+ case 0:
34
+ case "MODEL_PRIMARY_TYPE_UNSPECIFIED":
35
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_UNSPECIFIED;
36
+ case 1:
37
+ case "MODEL_PRIMARY_TYPE_CHAT":
38
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_CHAT;
39
+ case 2:
40
+ case "MODEL_PRIMARY_TYPE_IMAGE_GENERATION":
41
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_IMAGE_GENERATION;
42
+ case 3:
43
+ case "MODEL_PRIMARY_TYPE_EMBEDDING":
44
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_EMBEDDING;
45
+ case 4:
46
+ case "MODEL_PRIMARY_TYPE_AUDIO":
47
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_AUDIO;
48
+ case 5:
49
+ case "MODEL_PRIMARY_TYPE_VIDEO":
50
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_VIDEO;
51
+ case 6:
52
+ case "MODEL_PRIMARY_TYPE_TEXT":
53
+ return ModelPrimaryType.MODEL_PRIMARY_TYPE_TEXT;
54
+ case -1:
55
+ case "UNRECOGNIZED":
56
+ default:
57
+ return ModelPrimaryType.UNRECOGNIZED;
58
+ }
59
+ }
60
+ function modelPrimaryTypeToJSON(object) {
61
+ switch (object) {
62
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_UNSPECIFIED:
63
+ return "MODEL_PRIMARY_TYPE_UNSPECIFIED";
64
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_CHAT:
65
+ return "MODEL_PRIMARY_TYPE_CHAT";
66
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_IMAGE_GENERATION:
67
+ return "MODEL_PRIMARY_TYPE_IMAGE_GENERATION";
68
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_EMBEDDING:
69
+ return "MODEL_PRIMARY_TYPE_EMBEDDING";
70
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_AUDIO:
71
+ return "MODEL_PRIMARY_TYPE_AUDIO";
72
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_VIDEO:
73
+ return "MODEL_PRIMARY_TYPE_VIDEO";
74
+ case ModelPrimaryType.MODEL_PRIMARY_TYPE_TEXT:
75
+ return "MODEL_PRIMARY_TYPE_TEXT";
76
+ case ModelPrimaryType.UNRECOGNIZED:
77
+ default:
78
+ return "UNRECOGNIZED";
79
+ }
80
+ }
81
+ /** ModelCapability describes one normalized capability or input mode. */
82
+ var ModelCapability;
83
+ (function (ModelCapability) {
84
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_UNSPECIFIED"] = 0] = "MODEL_CAPABILITY_UNSPECIFIED";
85
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_TOOLS"] = 1] = "MODEL_CAPABILITY_TOOLS";
86
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_IMAGE_INPUT"] = 2] = "MODEL_CAPABILITY_IMAGE_INPUT";
87
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_PDF_INPUT"] = 3] = "MODEL_CAPABILITY_PDF_INPUT";
88
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_DOC_INPUT"] = 4] = "MODEL_CAPABILITY_DOC_INPUT";
89
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_CACHE_CONTROL"] = 5] = "MODEL_CAPABILITY_CACHE_CONTROL";
90
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_THINKING"] = 6] = "MODEL_CAPABILITY_THINKING";
91
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_STREAMING"] = 7] = "MODEL_CAPABILITY_STREAMING";
92
+ ModelCapability[ModelCapability["MODEL_CAPABILITY_MIME_TYPE"] = 8] = "MODEL_CAPABILITY_MIME_TYPE";
93
+ ModelCapability[ModelCapability["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
94
+ })(ModelCapability || (exports.ModelCapability = ModelCapability = {}));
95
+ function modelCapabilityFromJSON(object) {
96
+ switch (object) {
97
+ case 0:
98
+ case "MODEL_CAPABILITY_UNSPECIFIED":
99
+ return ModelCapability.MODEL_CAPABILITY_UNSPECIFIED;
100
+ case 1:
101
+ case "MODEL_CAPABILITY_TOOLS":
102
+ return ModelCapability.MODEL_CAPABILITY_TOOLS;
103
+ case 2:
104
+ case "MODEL_CAPABILITY_IMAGE_INPUT":
105
+ return ModelCapability.MODEL_CAPABILITY_IMAGE_INPUT;
106
+ case 3:
107
+ case "MODEL_CAPABILITY_PDF_INPUT":
108
+ return ModelCapability.MODEL_CAPABILITY_PDF_INPUT;
109
+ case 4:
110
+ case "MODEL_CAPABILITY_DOC_INPUT":
111
+ return ModelCapability.MODEL_CAPABILITY_DOC_INPUT;
112
+ case 5:
113
+ case "MODEL_CAPABILITY_CACHE_CONTROL":
114
+ return ModelCapability.MODEL_CAPABILITY_CACHE_CONTROL;
115
+ case 6:
116
+ case "MODEL_CAPABILITY_THINKING":
117
+ return ModelCapability.MODEL_CAPABILITY_THINKING;
118
+ case 7:
119
+ case "MODEL_CAPABILITY_STREAMING":
120
+ return ModelCapability.MODEL_CAPABILITY_STREAMING;
121
+ case 8:
122
+ case "MODEL_CAPABILITY_MIME_TYPE":
123
+ return ModelCapability.MODEL_CAPABILITY_MIME_TYPE;
124
+ case -1:
125
+ case "UNRECOGNIZED":
126
+ default:
127
+ return ModelCapability.UNRECOGNIZED;
128
+ }
129
+ }
130
+ function modelCapabilityToJSON(object) {
131
+ switch (object) {
132
+ case ModelCapability.MODEL_CAPABILITY_UNSPECIFIED:
133
+ return "MODEL_CAPABILITY_UNSPECIFIED";
134
+ case ModelCapability.MODEL_CAPABILITY_TOOLS:
135
+ return "MODEL_CAPABILITY_TOOLS";
136
+ case ModelCapability.MODEL_CAPABILITY_IMAGE_INPUT:
137
+ return "MODEL_CAPABILITY_IMAGE_INPUT";
138
+ case ModelCapability.MODEL_CAPABILITY_PDF_INPUT:
139
+ return "MODEL_CAPABILITY_PDF_INPUT";
140
+ case ModelCapability.MODEL_CAPABILITY_DOC_INPUT:
141
+ return "MODEL_CAPABILITY_DOC_INPUT";
142
+ case ModelCapability.MODEL_CAPABILITY_CACHE_CONTROL:
143
+ return "MODEL_CAPABILITY_CACHE_CONTROL";
144
+ case ModelCapability.MODEL_CAPABILITY_THINKING:
145
+ return "MODEL_CAPABILITY_THINKING";
146
+ case ModelCapability.MODEL_CAPABILITY_STREAMING:
147
+ return "MODEL_CAPABILITY_STREAMING";
148
+ case ModelCapability.MODEL_CAPABILITY_MIME_TYPE:
149
+ return "MODEL_CAPABILITY_MIME_TYPE";
150
+ case ModelCapability.UNRECOGNIZED:
151
+ default:
152
+ return "UNRECOGNIZED";
153
+ }
154
+ }
155
+ function createBaseModel() {
156
+ return {
157
+ modelId: "",
158
+ displayName: "",
159
+ providerKind: 0,
160
+ primaryType: 0,
161
+ capabilities: [],
162
+ maxInputTokens: 0,
163
+ maxOutputTokens: 0,
164
+ pricing: undefined,
165
+ params: [],
166
+ catalogUpdatedAt: undefined,
167
+ };
168
+ }
169
+ exports.Model = {
170
+ encode(message, writer = new wire_1.BinaryWriter()) {
171
+ if (message.modelId !== "") {
172
+ writer.uint32(10).string(message.modelId);
173
+ }
174
+ if (message.displayName !== "") {
175
+ writer.uint32(18).string(message.displayName);
176
+ }
177
+ if (message.providerKind !== 0) {
178
+ writer.uint32(24).int32(message.providerKind);
179
+ }
180
+ if (message.primaryType !== 0) {
181
+ writer.uint32(32).int32(message.primaryType);
182
+ }
183
+ writer.uint32(42).fork();
184
+ for (const v of message.capabilities) {
185
+ writer.int32(v);
186
+ }
187
+ writer.join();
188
+ if (message.maxInputTokens !== 0) {
189
+ writer.uint32(48).int64(message.maxInputTokens);
190
+ }
191
+ if (message.maxOutputTokens !== 0) {
192
+ writer.uint32(56).int64(message.maxOutputTokens);
193
+ }
194
+ if (message.pricing !== undefined) {
195
+ exports.ModelPricing.encode(message.pricing, writer.uint32(66).fork()).join();
196
+ }
197
+ for (const v of message.params) {
198
+ exports.ModelParam.encode(v, writer.uint32(74).fork()).join();
199
+ }
200
+ if (message.catalogUpdatedAt !== undefined) {
201
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.catalogUpdatedAt), writer.uint32(82).fork()).join();
202
+ }
203
+ return writer;
204
+ },
205
+ decode(input, length) {
206
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
207
+ const end = length === undefined ? reader.len : reader.pos + length;
208
+ const message = createBaseModel();
209
+ while (reader.pos < end) {
210
+ const tag = reader.uint32();
211
+ switch (tag >>> 3) {
212
+ case 1: {
213
+ if (tag !== 10) {
214
+ break;
215
+ }
216
+ message.modelId = reader.string();
217
+ continue;
218
+ }
219
+ case 2: {
220
+ if (tag !== 18) {
221
+ break;
222
+ }
223
+ message.displayName = reader.string();
224
+ continue;
225
+ }
226
+ case 3: {
227
+ if (tag !== 24) {
228
+ break;
229
+ }
230
+ message.providerKind = reader.int32();
231
+ continue;
232
+ }
233
+ case 4: {
234
+ if (tag !== 32) {
235
+ break;
236
+ }
237
+ message.primaryType = reader.int32();
238
+ continue;
239
+ }
240
+ case 5: {
241
+ if (tag === 40) {
242
+ message.capabilities.push(reader.int32());
243
+ continue;
244
+ }
245
+ if (tag === 42) {
246
+ const end2 = reader.uint32() + reader.pos;
247
+ while (reader.pos < end2) {
248
+ message.capabilities.push(reader.int32());
249
+ }
250
+ continue;
251
+ }
252
+ break;
253
+ }
254
+ case 6: {
255
+ if (tag !== 48) {
256
+ break;
257
+ }
258
+ message.maxInputTokens = longToNumber(reader.int64());
259
+ continue;
260
+ }
261
+ case 7: {
262
+ if (tag !== 56) {
263
+ break;
264
+ }
265
+ message.maxOutputTokens = longToNumber(reader.int64());
266
+ continue;
267
+ }
268
+ case 8: {
269
+ if (tag !== 66) {
270
+ break;
271
+ }
272
+ message.pricing = exports.ModelPricing.decode(reader, reader.uint32());
273
+ continue;
274
+ }
275
+ case 9: {
276
+ if (tag !== 74) {
277
+ break;
278
+ }
279
+ message.params.push(exports.ModelParam.decode(reader, reader.uint32()));
280
+ continue;
281
+ }
282
+ case 10: {
283
+ if (tag !== 82) {
284
+ break;
285
+ }
286
+ message.catalogUpdatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
287
+ continue;
288
+ }
289
+ }
290
+ if ((tag & 7) === 4 || tag === 0) {
291
+ break;
292
+ }
293
+ reader.skip(tag & 7);
294
+ }
295
+ return message;
296
+ },
297
+ fromJSON(object) {
298
+ return {
299
+ modelId: isSet(object.modelId)
300
+ ? globalThis.String(object.modelId)
301
+ : isSet(object.model_id)
302
+ ? globalThis.String(object.model_id)
303
+ : "",
304
+ displayName: isSet(object.displayName)
305
+ ? globalThis.String(object.displayName)
306
+ : isSet(object.display_name)
307
+ ? globalThis.String(object.display_name)
308
+ : "",
309
+ providerKind: isSet(object.providerKind)
310
+ ? (0, provider_pb_1.providerKindFromJSON)(object.providerKind)
311
+ : isSet(object.provider_kind)
312
+ ? (0, provider_pb_1.providerKindFromJSON)(object.provider_kind)
313
+ : 0,
314
+ primaryType: isSet(object.primaryType)
315
+ ? modelPrimaryTypeFromJSON(object.primaryType)
316
+ : isSet(object.primary_type)
317
+ ? modelPrimaryTypeFromJSON(object.primary_type)
318
+ : 0,
319
+ capabilities: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.capabilities)
320
+ ? object.capabilities.map((e) => modelCapabilityFromJSON(e))
321
+ : [],
322
+ maxInputTokens: isSet(object.maxInputTokens)
323
+ ? globalThis.Number(object.maxInputTokens)
324
+ : isSet(object.max_input_tokens)
325
+ ? globalThis.Number(object.max_input_tokens)
326
+ : 0,
327
+ maxOutputTokens: isSet(object.maxOutputTokens)
328
+ ? globalThis.Number(object.maxOutputTokens)
329
+ : isSet(object.max_output_tokens)
330
+ ? globalThis.Number(object.max_output_tokens)
331
+ : 0,
332
+ pricing: isSet(object.pricing) ? exports.ModelPricing.fromJSON(object.pricing) : undefined,
333
+ params: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.params)
334
+ ? object.params.map((e) => exports.ModelParam.fromJSON(e))
335
+ : [],
336
+ catalogUpdatedAt: isSet(object.catalogUpdatedAt)
337
+ ? fromJsonTimestamp(object.catalogUpdatedAt)
338
+ : isSet(object.catalog_updated_at)
339
+ ? fromJsonTimestamp(object.catalog_updated_at)
340
+ : undefined,
341
+ };
342
+ },
343
+ toJSON(message) {
344
+ var _a, _b;
345
+ const obj = {};
346
+ if (message.modelId !== "") {
347
+ obj.modelId = message.modelId;
348
+ }
349
+ if (message.displayName !== "") {
350
+ obj.displayName = message.displayName;
351
+ }
352
+ if (message.providerKind !== 0) {
353
+ obj.providerKind = (0, provider_pb_1.providerKindToJSON)(message.providerKind);
354
+ }
355
+ if (message.primaryType !== 0) {
356
+ obj.primaryType = modelPrimaryTypeToJSON(message.primaryType);
357
+ }
358
+ if ((_a = message.capabilities) === null || _a === void 0 ? void 0 : _a.length) {
359
+ obj.capabilities = message.capabilities.map((e) => modelCapabilityToJSON(e));
360
+ }
361
+ if (message.maxInputTokens !== 0) {
362
+ obj.maxInputTokens = Math.round(message.maxInputTokens);
363
+ }
364
+ if (message.maxOutputTokens !== 0) {
365
+ obj.maxOutputTokens = Math.round(message.maxOutputTokens);
366
+ }
367
+ if (message.pricing !== undefined) {
368
+ obj.pricing = exports.ModelPricing.toJSON(message.pricing);
369
+ }
370
+ if ((_b = message.params) === null || _b === void 0 ? void 0 : _b.length) {
371
+ obj.params = message.params.map((e) => exports.ModelParam.toJSON(e));
372
+ }
373
+ if (message.catalogUpdatedAt !== undefined) {
374
+ obj.catalogUpdatedAt = message.catalogUpdatedAt.toISOString();
375
+ }
376
+ return obj;
377
+ },
378
+ create(base) {
379
+ return exports.Model.fromPartial(base !== null && base !== void 0 ? base : {});
380
+ },
381
+ fromPartial(object) {
382
+ var _a, _b;
383
+ var _c, _d, _e, _f, _g, _h, _j;
384
+ const message = createBaseModel();
385
+ message.modelId = (_c = object.modelId) !== null && _c !== void 0 ? _c : "";
386
+ message.displayName = (_d = object.displayName) !== null && _d !== void 0 ? _d : "";
387
+ message.providerKind = (_e = object.providerKind) !== null && _e !== void 0 ? _e : 0;
388
+ message.primaryType = (_f = object.primaryType) !== null && _f !== void 0 ? _f : 0;
389
+ message.capabilities = ((_a = object.capabilities) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
390
+ message.maxInputTokens = (_g = object.maxInputTokens) !== null && _g !== void 0 ? _g : 0;
391
+ message.maxOutputTokens = (_h = object.maxOutputTokens) !== null && _h !== void 0 ? _h : 0;
392
+ message.pricing = (object.pricing !== undefined && object.pricing !== null)
393
+ ? exports.ModelPricing.fromPartial(object.pricing)
394
+ : undefined;
395
+ message.params = ((_b = object.params) === null || _b === void 0 ? void 0 : _b.map((e) => exports.ModelParam.fromPartial(e))) || [];
396
+ message.catalogUpdatedAt = (_j = object.catalogUpdatedAt) !== null && _j !== void 0 ? _j : undefined;
397
+ return message;
398
+ },
399
+ };
400
+ function createBaseModelPricing() {
401
+ return {
402
+ inputTokenPricePerMillion: 0,
403
+ outputTokenPricePerMillion: 0,
404
+ cacheReadInputTokenPricePerMillion: 0,
405
+ cacheWriteInputTokenPricePerMillion: 0,
406
+ batchInputTokenPricePerMillion: 0,
407
+ batchOutputTokenPricePerMillion: 0,
408
+ imageGenerationPrices: [],
409
+ additionalUnitPrices: [],
410
+ currency: "",
411
+ };
412
+ }
413
+ exports.ModelPricing = {
414
+ encode(message, writer = new wire_1.BinaryWriter()) {
415
+ if (message.inputTokenPricePerMillion !== 0) {
416
+ writer.uint32(9).double(message.inputTokenPricePerMillion);
417
+ }
418
+ if (message.outputTokenPricePerMillion !== 0) {
419
+ writer.uint32(17).double(message.outputTokenPricePerMillion);
420
+ }
421
+ if (message.cacheReadInputTokenPricePerMillion !== 0) {
422
+ writer.uint32(25).double(message.cacheReadInputTokenPricePerMillion);
423
+ }
424
+ if (message.cacheWriteInputTokenPricePerMillion !== 0) {
425
+ writer.uint32(33).double(message.cacheWriteInputTokenPricePerMillion);
426
+ }
427
+ if (message.batchInputTokenPricePerMillion !== 0) {
428
+ writer.uint32(41).double(message.batchInputTokenPricePerMillion);
429
+ }
430
+ if (message.batchOutputTokenPricePerMillion !== 0) {
431
+ writer.uint32(49).double(message.batchOutputTokenPricePerMillion);
432
+ }
433
+ for (const v of message.imageGenerationPrices) {
434
+ exports.ImageGenerationPrice.encode(v, writer.uint32(58).fork()).join();
435
+ }
436
+ for (const v of message.additionalUnitPrices) {
437
+ exports.AdditionalUnitPrice.encode(v, writer.uint32(66).fork()).join();
438
+ }
439
+ if (message.currency !== "") {
440
+ writer.uint32(74).string(message.currency);
441
+ }
442
+ return writer;
443
+ },
444
+ decode(input, length) {
445
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
446
+ const end = length === undefined ? reader.len : reader.pos + length;
447
+ const message = createBaseModelPricing();
448
+ while (reader.pos < end) {
449
+ const tag = reader.uint32();
450
+ switch (tag >>> 3) {
451
+ case 1: {
452
+ if (tag !== 9) {
453
+ break;
454
+ }
455
+ message.inputTokenPricePerMillion = reader.double();
456
+ continue;
457
+ }
458
+ case 2: {
459
+ if (tag !== 17) {
460
+ break;
461
+ }
462
+ message.outputTokenPricePerMillion = reader.double();
463
+ continue;
464
+ }
465
+ case 3: {
466
+ if (tag !== 25) {
467
+ break;
468
+ }
469
+ message.cacheReadInputTokenPricePerMillion = reader.double();
470
+ continue;
471
+ }
472
+ case 4: {
473
+ if (tag !== 33) {
474
+ break;
475
+ }
476
+ message.cacheWriteInputTokenPricePerMillion = reader.double();
477
+ continue;
478
+ }
479
+ case 5: {
480
+ if (tag !== 41) {
481
+ break;
482
+ }
483
+ message.batchInputTokenPricePerMillion = reader.double();
484
+ continue;
485
+ }
486
+ case 6: {
487
+ if (tag !== 49) {
488
+ break;
489
+ }
490
+ message.batchOutputTokenPricePerMillion = reader.double();
491
+ continue;
492
+ }
493
+ case 7: {
494
+ if (tag !== 58) {
495
+ break;
496
+ }
497
+ message.imageGenerationPrices.push(exports.ImageGenerationPrice.decode(reader, reader.uint32()));
498
+ continue;
499
+ }
500
+ case 8: {
501
+ if (tag !== 66) {
502
+ break;
503
+ }
504
+ message.additionalUnitPrices.push(exports.AdditionalUnitPrice.decode(reader, reader.uint32()));
505
+ continue;
506
+ }
507
+ case 9: {
508
+ if (tag !== 74) {
509
+ break;
510
+ }
511
+ message.currency = reader.string();
512
+ continue;
513
+ }
514
+ }
515
+ if ((tag & 7) === 4 || tag === 0) {
516
+ break;
517
+ }
518
+ reader.skip(tag & 7);
519
+ }
520
+ return message;
521
+ },
522
+ fromJSON(object) {
523
+ return {
524
+ inputTokenPricePerMillion: isSet(object.inputTokenPricePerMillion)
525
+ ? globalThis.Number(object.inputTokenPricePerMillion)
526
+ : isSet(object.input_token_price_per_million)
527
+ ? globalThis.Number(object.input_token_price_per_million)
528
+ : 0,
529
+ outputTokenPricePerMillion: isSet(object.outputTokenPricePerMillion)
530
+ ? globalThis.Number(object.outputTokenPricePerMillion)
531
+ : isSet(object.output_token_price_per_million)
532
+ ? globalThis.Number(object.output_token_price_per_million)
533
+ : 0,
534
+ cacheReadInputTokenPricePerMillion: isSet(object.cacheReadInputTokenPricePerMillion)
535
+ ? globalThis.Number(object.cacheReadInputTokenPricePerMillion)
536
+ : isSet(object.cache_read_input_token_price_per_million)
537
+ ? globalThis.Number(object.cache_read_input_token_price_per_million)
538
+ : 0,
539
+ cacheWriteInputTokenPricePerMillion: isSet(object.cacheWriteInputTokenPricePerMillion)
540
+ ? globalThis.Number(object.cacheWriteInputTokenPricePerMillion)
541
+ : isSet(object.cache_write_input_token_price_per_million)
542
+ ? globalThis.Number(object.cache_write_input_token_price_per_million)
543
+ : 0,
544
+ batchInputTokenPricePerMillion: isSet(object.batchInputTokenPricePerMillion)
545
+ ? globalThis.Number(object.batchInputTokenPricePerMillion)
546
+ : isSet(object.batch_input_token_price_per_million)
547
+ ? globalThis.Number(object.batch_input_token_price_per_million)
548
+ : 0,
549
+ batchOutputTokenPricePerMillion: isSet(object.batchOutputTokenPricePerMillion)
550
+ ? globalThis.Number(object.batchOutputTokenPricePerMillion)
551
+ : isSet(object.batch_output_token_price_per_million)
552
+ ? globalThis.Number(object.batch_output_token_price_per_million)
553
+ : 0,
554
+ imageGenerationPrices: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.imageGenerationPrices)
555
+ ? object.imageGenerationPrices.map((e) => exports.ImageGenerationPrice.fromJSON(e))
556
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.image_generation_prices)
557
+ ? object.image_generation_prices.map((e) => exports.ImageGenerationPrice.fromJSON(e))
558
+ : [],
559
+ additionalUnitPrices: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.additionalUnitPrices)
560
+ ? object.additionalUnitPrices.map((e) => exports.AdditionalUnitPrice.fromJSON(e))
561
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.additional_unit_prices)
562
+ ? object.additional_unit_prices.map((e) => exports.AdditionalUnitPrice.fromJSON(e))
563
+ : [],
564
+ currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
565
+ };
566
+ },
567
+ toJSON(message) {
568
+ var _a, _b;
569
+ const obj = {};
570
+ if (message.inputTokenPricePerMillion !== 0) {
571
+ obj.inputTokenPricePerMillion = message.inputTokenPricePerMillion;
572
+ }
573
+ if (message.outputTokenPricePerMillion !== 0) {
574
+ obj.outputTokenPricePerMillion = message.outputTokenPricePerMillion;
575
+ }
576
+ if (message.cacheReadInputTokenPricePerMillion !== 0) {
577
+ obj.cacheReadInputTokenPricePerMillion = message.cacheReadInputTokenPricePerMillion;
578
+ }
579
+ if (message.cacheWriteInputTokenPricePerMillion !== 0) {
580
+ obj.cacheWriteInputTokenPricePerMillion = message.cacheWriteInputTokenPricePerMillion;
581
+ }
582
+ if (message.batchInputTokenPricePerMillion !== 0) {
583
+ obj.batchInputTokenPricePerMillion = message.batchInputTokenPricePerMillion;
584
+ }
585
+ if (message.batchOutputTokenPricePerMillion !== 0) {
586
+ obj.batchOutputTokenPricePerMillion = message.batchOutputTokenPricePerMillion;
587
+ }
588
+ if ((_a = message.imageGenerationPrices) === null || _a === void 0 ? void 0 : _a.length) {
589
+ obj.imageGenerationPrices = message.imageGenerationPrices.map((e) => exports.ImageGenerationPrice.toJSON(e));
590
+ }
591
+ if ((_b = message.additionalUnitPrices) === null || _b === void 0 ? void 0 : _b.length) {
592
+ obj.additionalUnitPrices = message.additionalUnitPrices.map((e) => exports.AdditionalUnitPrice.toJSON(e));
593
+ }
594
+ if (message.currency !== "") {
595
+ obj.currency = message.currency;
596
+ }
597
+ return obj;
598
+ },
599
+ create(base) {
600
+ return exports.ModelPricing.fromPartial(base !== null && base !== void 0 ? base : {});
601
+ },
602
+ fromPartial(object) {
603
+ var _a, _b;
604
+ var _c, _d, _e, _f, _g, _h, _j;
605
+ const message = createBaseModelPricing();
606
+ message.inputTokenPricePerMillion = (_c = object.inputTokenPricePerMillion) !== null && _c !== void 0 ? _c : 0;
607
+ message.outputTokenPricePerMillion = (_d = object.outputTokenPricePerMillion) !== null && _d !== void 0 ? _d : 0;
608
+ message.cacheReadInputTokenPricePerMillion = (_e = object.cacheReadInputTokenPricePerMillion) !== null && _e !== void 0 ? _e : 0;
609
+ message.cacheWriteInputTokenPricePerMillion = (_f = object.cacheWriteInputTokenPricePerMillion) !== null && _f !== void 0 ? _f : 0;
610
+ message.batchInputTokenPricePerMillion = (_g = object.batchInputTokenPricePerMillion) !== null && _g !== void 0 ? _g : 0;
611
+ message.batchOutputTokenPricePerMillion = (_h = object.batchOutputTokenPricePerMillion) !== null && _h !== void 0 ? _h : 0;
612
+ message.imageGenerationPrices = ((_a = object.imageGenerationPrices) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ImageGenerationPrice.fromPartial(e))) || [];
613
+ message.additionalUnitPrices = ((_b = object.additionalUnitPrices) === null || _b === void 0 ? void 0 : _b.map((e) => exports.AdditionalUnitPrice.fromPartial(e))) || [];
614
+ message.currency = (_j = object.currency) !== null && _j !== void 0 ? _j : "";
615
+ return message;
616
+ },
617
+ };
618
+ function createBaseImageGenerationPrice() {
619
+ return { quality: "", size: "", price: 0 };
620
+ }
621
+ exports.ImageGenerationPrice = {
622
+ encode(message, writer = new wire_1.BinaryWriter()) {
623
+ if (message.quality !== "") {
624
+ writer.uint32(10).string(message.quality);
625
+ }
626
+ if (message.size !== "") {
627
+ writer.uint32(18).string(message.size);
628
+ }
629
+ if (message.price !== 0) {
630
+ writer.uint32(25).double(message.price);
631
+ }
632
+ return writer;
633
+ },
634
+ decode(input, length) {
635
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
636
+ const end = length === undefined ? reader.len : reader.pos + length;
637
+ const message = createBaseImageGenerationPrice();
638
+ while (reader.pos < end) {
639
+ const tag = reader.uint32();
640
+ switch (tag >>> 3) {
641
+ case 1: {
642
+ if (tag !== 10) {
643
+ break;
644
+ }
645
+ message.quality = reader.string();
646
+ continue;
647
+ }
648
+ case 2: {
649
+ if (tag !== 18) {
650
+ break;
651
+ }
652
+ message.size = reader.string();
653
+ continue;
654
+ }
655
+ case 3: {
656
+ if (tag !== 25) {
657
+ break;
658
+ }
659
+ message.price = reader.double();
660
+ continue;
661
+ }
662
+ }
663
+ if ((tag & 7) === 4 || tag === 0) {
664
+ break;
665
+ }
666
+ reader.skip(tag & 7);
667
+ }
668
+ return message;
669
+ },
670
+ fromJSON(object) {
671
+ return {
672
+ quality: isSet(object.quality) ? globalThis.String(object.quality) : "",
673
+ size: isSet(object.size) ? globalThis.String(object.size) : "",
674
+ price: isSet(object.price) ? globalThis.Number(object.price) : 0,
675
+ };
676
+ },
677
+ toJSON(message) {
678
+ const obj = {};
679
+ if (message.quality !== "") {
680
+ obj.quality = message.quality;
681
+ }
682
+ if (message.size !== "") {
683
+ obj.size = message.size;
684
+ }
685
+ if (message.price !== 0) {
686
+ obj.price = message.price;
687
+ }
688
+ return obj;
689
+ },
690
+ create(base) {
691
+ return exports.ImageGenerationPrice.fromPartial(base !== null && base !== void 0 ? base : {});
692
+ },
693
+ fromPartial(object) {
694
+ var _a, _b, _c;
695
+ const message = createBaseImageGenerationPrice();
696
+ message.quality = (_a = object.quality) !== null && _a !== void 0 ? _a : "";
697
+ message.size = (_b = object.size) !== null && _b !== void 0 ? _b : "";
698
+ message.price = (_c = object.price) !== null && _c !== void 0 ? _c : 0;
699
+ return message;
700
+ },
701
+ };
702
+ function createBaseAdditionalUnitPrice() {
703
+ return { unit: "", price: 0 };
704
+ }
705
+ exports.AdditionalUnitPrice = {
706
+ encode(message, writer = new wire_1.BinaryWriter()) {
707
+ if (message.unit !== "") {
708
+ writer.uint32(10).string(message.unit);
709
+ }
710
+ if (message.price !== 0) {
711
+ writer.uint32(17).double(message.price);
712
+ }
713
+ return writer;
714
+ },
715
+ decode(input, length) {
716
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
717
+ const end = length === undefined ? reader.len : reader.pos + length;
718
+ const message = createBaseAdditionalUnitPrice();
719
+ while (reader.pos < end) {
720
+ const tag = reader.uint32();
721
+ switch (tag >>> 3) {
722
+ case 1: {
723
+ if (tag !== 10) {
724
+ break;
725
+ }
726
+ message.unit = reader.string();
727
+ continue;
728
+ }
729
+ case 2: {
730
+ if (tag !== 17) {
731
+ break;
732
+ }
733
+ message.price = reader.double();
734
+ continue;
735
+ }
736
+ }
737
+ if ((tag & 7) === 4 || tag === 0) {
738
+ break;
739
+ }
740
+ reader.skip(tag & 7);
741
+ }
742
+ return message;
743
+ },
744
+ fromJSON(object) {
745
+ return {
746
+ unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
747
+ price: isSet(object.price) ? globalThis.Number(object.price) : 0,
748
+ };
749
+ },
750
+ toJSON(message) {
751
+ const obj = {};
752
+ if (message.unit !== "") {
753
+ obj.unit = message.unit;
754
+ }
755
+ if (message.price !== 0) {
756
+ obj.price = message.price;
757
+ }
758
+ return obj;
759
+ },
760
+ create(base) {
761
+ return exports.AdditionalUnitPrice.fromPartial(base !== null && base !== void 0 ? base : {});
762
+ },
763
+ fromPartial(object) {
764
+ var _a, _b;
765
+ const message = createBaseAdditionalUnitPrice();
766
+ message.unit = (_a = object.unit) !== null && _a !== void 0 ? _a : "";
767
+ message.price = (_b = object.price) !== null && _b !== void 0 ? _b : 0;
768
+ return message;
769
+ },
770
+ };
771
+ function createBaseModelParam() {
772
+ return { key: "", type: "", defaultValue: undefined, minValue: undefined, maxValue: undefined, allowedValues: [] };
773
+ }
774
+ exports.ModelParam = {
775
+ encode(message, writer = new wire_1.BinaryWriter()) {
776
+ if (message.key !== "") {
777
+ writer.uint32(10).string(message.key);
778
+ }
779
+ if (message.type !== "") {
780
+ writer.uint32(18).string(message.type);
781
+ }
782
+ if (message.defaultValue !== undefined) {
783
+ struct_pb_1.Value.encode(struct_pb_1.Value.wrap(message.defaultValue), writer.uint32(26).fork()).join();
784
+ }
785
+ if (message.minValue !== undefined) {
786
+ struct_pb_1.Value.encode(struct_pb_1.Value.wrap(message.minValue), writer.uint32(34).fork()).join();
787
+ }
788
+ if (message.maxValue !== undefined) {
789
+ struct_pb_1.Value.encode(struct_pb_1.Value.wrap(message.maxValue), writer.uint32(42).fork()).join();
790
+ }
791
+ for (const v of message.allowedValues) {
792
+ struct_pb_1.Value.encode(struct_pb_1.Value.wrap(v), writer.uint32(50).fork()).join();
793
+ }
794
+ return writer;
795
+ },
796
+ decode(input, length) {
797
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
798
+ const end = length === undefined ? reader.len : reader.pos + length;
799
+ const message = createBaseModelParam();
800
+ while (reader.pos < end) {
801
+ const tag = reader.uint32();
802
+ switch (tag >>> 3) {
803
+ case 1: {
804
+ if (tag !== 10) {
805
+ break;
806
+ }
807
+ message.key = reader.string();
808
+ continue;
809
+ }
810
+ case 2: {
811
+ if (tag !== 18) {
812
+ break;
813
+ }
814
+ message.type = reader.string();
815
+ continue;
816
+ }
817
+ case 3: {
818
+ if (tag !== 26) {
819
+ break;
820
+ }
821
+ message.defaultValue = struct_pb_1.Value.unwrap(struct_pb_1.Value.decode(reader, reader.uint32()));
822
+ continue;
823
+ }
824
+ case 4: {
825
+ if (tag !== 34) {
826
+ break;
827
+ }
828
+ message.minValue = struct_pb_1.Value.unwrap(struct_pb_1.Value.decode(reader, reader.uint32()));
829
+ continue;
830
+ }
831
+ case 5: {
832
+ if (tag !== 42) {
833
+ break;
834
+ }
835
+ message.maxValue = struct_pb_1.Value.unwrap(struct_pb_1.Value.decode(reader, reader.uint32()));
836
+ continue;
837
+ }
838
+ case 6: {
839
+ if (tag !== 50) {
840
+ break;
841
+ }
842
+ message.allowedValues.push(struct_pb_1.Value.unwrap(struct_pb_1.Value.decode(reader, reader.uint32())));
843
+ continue;
844
+ }
845
+ }
846
+ if ((tag & 7) === 4 || tag === 0) {
847
+ break;
848
+ }
849
+ reader.skip(tag & 7);
850
+ }
851
+ return message;
852
+ },
853
+ fromJSON(object) {
854
+ return {
855
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
856
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
857
+ defaultValue: isSet(object === null || object === void 0 ? void 0 : object.defaultValue)
858
+ ? object.defaultValue
859
+ : isSet(object === null || object === void 0 ? void 0 : object.default_value)
860
+ ? object.default_value
861
+ : undefined,
862
+ minValue: isSet(object === null || object === void 0 ? void 0 : object.minValue) ? object.minValue : isSet(object === null || object === void 0 ? void 0 : object.min_value) ? object.min_value : undefined,
863
+ maxValue: isSet(object === null || object === void 0 ? void 0 : object.maxValue) ? object.maxValue : isSet(object === null || object === void 0 ? void 0 : object.max_value) ? object.max_value : undefined,
864
+ allowedValues: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.allowedValues)
865
+ ? [...object.allowedValues]
866
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.allowed_values)
867
+ ? [...object.allowed_values]
868
+ : [],
869
+ };
870
+ },
871
+ toJSON(message) {
872
+ var _a;
873
+ const obj = {};
874
+ if (message.key !== "") {
875
+ obj.key = message.key;
876
+ }
877
+ if (message.type !== "") {
878
+ obj.type = message.type;
879
+ }
880
+ if (message.defaultValue !== undefined) {
881
+ obj.defaultValue = message.defaultValue;
882
+ }
883
+ if (message.minValue !== undefined) {
884
+ obj.minValue = message.minValue;
885
+ }
886
+ if (message.maxValue !== undefined) {
887
+ obj.maxValue = message.maxValue;
888
+ }
889
+ if ((_a = message.allowedValues) === null || _a === void 0 ? void 0 : _a.length) {
890
+ obj.allowedValues = message.allowedValues;
891
+ }
892
+ return obj;
893
+ },
894
+ create(base) {
895
+ return exports.ModelParam.fromPartial(base !== null && base !== void 0 ? base : {});
896
+ },
897
+ fromPartial(object) {
898
+ var _a;
899
+ var _b, _c, _d, _e, _f;
900
+ const message = createBaseModelParam();
901
+ message.key = (_b = object.key) !== null && _b !== void 0 ? _b : "";
902
+ message.type = (_c = object.type) !== null && _c !== void 0 ? _c : "";
903
+ message.defaultValue = (_d = object.defaultValue) !== null && _d !== void 0 ? _d : undefined;
904
+ message.minValue = (_e = object.minValue) !== null && _e !== void 0 ? _e : undefined;
905
+ message.maxValue = (_f = object.maxValue) !== null && _f !== void 0 ? _f : undefined;
906
+ message.allowedValues = ((_a = object.allowedValues) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
907
+ return message;
908
+ },
909
+ };
910
+ function createBaseCatalogProvider() {
911
+ return { providerKind: 0 };
912
+ }
913
+ exports.CatalogProvider = {
914
+ encode(message, writer = new wire_1.BinaryWriter()) {
915
+ if (message.providerKind !== 0) {
916
+ writer.uint32(8).int32(message.providerKind);
917
+ }
918
+ return writer;
919
+ },
920
+ decode(input, length) {
921
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
922
+ const end = length === undefined ? reader.len : reader.pos + length;
923
+ const message = createBaseCatalogProvider();
924
+ while (reader.pos < end) {
925
+ const tag = reader.uint32();
926
+ switch (tag >>> 3) {
927
+ case 1: {
928
+ if (tag !== 8) {
929
+ break;
930
+ }
931
+ message.providerKind = reader.int32();
932
+ continue;
933
+ }
934
+ }
935
+ if ((tag & 7) === 4 || tag === 0) {
936
+ break;
937
+ }
938
+ reader.skip(tag & 7);
939
+ }
940
+ return message;
941
+ },
942
+ fromJSON(object) {
943
+ return {
944
+ providerKind: isSet(object.providerKind)
945
+ ? (0, provider_pb_1.providerKindFromJSON)(object.providerKind)
946
+ : isSet(object.provider_kind)
947
+ ? (0, provider_pb_1.providerKindFromJSON)(object.provider_kind)
948
+ : 0,
949
+ };
950
+ },
951
+ toJSON(message) {
952
+ const obj = {};
953
+ if (message.providerKind !== 0) {
954
+ obj.providerKind = (0, provider_pb_1.providerKindToJSON)(message.providerKind);
955
+ }
956
+ return obj;
957
+ },
958
+ create(base) {
959
+ return exports.CatalogProvider.fromPartial(base !== null && base !== void 0 ? base : {});
960
+ },
961
+ fromPartial(object) {
962
+ var _a;
963
+ const message = createBaseCatalogProvider();
964
+ message.providerKind = (_a = object.providerKind) !== null && _a !== void 0 ? _a : 0;
965
+ return message;
966
+ },
967
+ };
968
+ function toTimestamp(date) {
969
+ const seconds = Math.trunc(date.getTime() / 1000);
970
+ const nanos = (date.getTime() % 1000) * 1000000;
971
+ return { seconds, nanos };
972
+ }
973
+ function fromTimestamp(t) {
974
+ let millis = (t.seconds || 0) * 1000;
975
+ millis += (t.nanos || 0) / 1000000;
976
+ return new globalThis.Date(millis);
977
+ }
978
+ function fromJsonTimestamp(o) {
979
+ if (o instanceof globalThis.Date) {
980
+ return o;
981
+ }
982
+ else if (typeof o === "string") {
983
+ return new globalThis.Date(o);
984
+ }
985
+ else {
986
+ return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
987
+ }
988
+ }
989
+ function longToNumber(int64) {
990
+ const num = globalThis.Number(int64.toString());
991
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
992
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
993
+ }
994
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
995
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
996
+ }
997
+ return num;
998
+ }
999
+ function isSet(value) {
1000
+ return value !== null && value !== undefined;
1001
+ }