@dbx-tools/model-rs 0.6.224 → 0.6.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/index.ts +1 -1
- package/lib/index.js +383 -29
- package/package.json +8 -8
- package/src/_bindings-ffi.ts +36 -0
- package/src/_bindings.ts +610 -33
package/src/_bindings.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import nativeModule from "./_bindings-ffi.ts";
|
|
10
10
|
import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct,
|
|
11
11
|
} from "./_bindings-ffi.ts";
|
|
12
|
-
import { type UniffiByteArray, AbstractFfiConverterByteArray, Cursor, FfiConverterArray, FfiConverterBool, FfiConverterOptional, FfiConverterUInt8, RustBuffer, UniffiEnum, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString,
|
|
12
|
+
import { type UniffiByteArray, AbstractFfiConverterByteArray, Cursor, FfiConverterArray, FfiConverterBool, FfiConverterFloat64, FfiConverterMap, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt8, RustBuffer, UniffiEnum, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString, uniffiCreateRecord,
|
|
13
13
|
} from "@ubjs/core";
|
|
14
14
|
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
|
|
15
15
|
|
|
@@ -55,6 +55,25 @@ export function isResponsesOnly(value: string): boolean {
|
|
|
55
55
|
));
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Return the normalized family name parsed from a model identity.
|
|
60
|
+
*/
|
|
61
|
+
export function modelFamily(value: string): string | undefined {
|
|
62
|
+
const __rb: Uint8Array = uniffiCaller.rustCall(
|
|
63
|
+
/*caller:*/ (callStatus) => {
|
|
64
|
+
return nativeModule().uniffi_dbx_tools_model_fn_func_model_family(
|
|
65
|
+
FfiConverterString.lower(value, nativeModule().rustbuffer_alloc),
|
|
66
|
+
callStatus);
|
|
67
|
+
},
|
|
68
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
69
|
+
);
|
|
70
|
+
try {
|
|
71
|
+
return FfiConverterOptionalString.lift(__rb);
|
|
72
|
+
} finally {
|
|
73
|
+
nativeModule().rustbuffer_free(__rb);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
58
77
|
/**
|
|
59
78
|
* Return the Databricks inference protocol required by a model.
|
|
60
79
|
*/
|
|
@@ -74,6 +93,45 @@ export function modelServingApi(value: string): ModelServingApi {
|
|
|
74
93
|
}
|
|
75
94
|
}
|
|
76
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Rank model endpoints through the generated UniFFI surface.
|
|
98
|
+
*/
|
|
99
|
+
export function rankModels(endpoints: Array<ServingEndpointSummary>, query: ModelQuery): Array<RankedModel> {
|
|
100
|
+
const __rb: Uint8Array = uniffiCaller.rustCall(
|
|
101
|
+
/*caller:*/ (callStatus) => {
|
|
102
|
+
return nativeModule().uniffi_dbx_tools_model_fn_func_rank_models(
|
|
103
|
+
FfiConverterSequenceTypeServingEndpointSummary.lower(endpoints, nativeModule().rustbuffer_alloc),
|
|
104
|
+
FfiConverterTypeModelQuery.lower(query, nativeModule().rustbuffer_alloc),
|
|
105
|
+
callStatus);
|
|
106
|
+
},
|
|
107
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
108
|
+
);
|
|
109
|
+
try {
|
|
110
|
+
return FfiConverterSequenceTypeRankedModel.lift(__rb);
|
|
111
|
+
} finally {
|
|
112
|
+
nativeModule().rustbuffer_free(__rb);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Infer provider wire values accepted by a model or service name.
|
|
118
|
+
*/
|
|
119
|
+
export function reasoningEffortNamesByFamily(name: string): Array<string> {
|
|
120
|
+
const __rb: Uint8Array = uniffiCaller.rustCall(
|
|
121
|
+
/*caller:*/ (callStatus) => {
|
|
122
|
+
return nativeModule().uniffi_dbx_tools_model_fn_func_reasoning_effort_names_by_family(
|
|
123
|
+
FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
|
|
124
|
+
callStatus);
|
|
125
|
+
},
|
|
126
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
127
|
+
);
|
|
128
|
+
try {
|
|
129
|
+
return FfiConverterSequenceString.lift(__rb);
|
|
130
|
+
} finally {
|
|
131
|
+
nativeModule().rustbuffer_free(__rb);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
77
135
|
/**
|
|
78
136
|
* Infer the accepted reasoning efforts from a model or service name.
|
|
79
137
|
*/
|
|
@@ -108,33 +166,125 @@ export function supportsToolsByFamily(name: string): boolean {
|
|
|
108
166
|
}
|
|
109
167
|
|
|
110
168
|
/**
|
|
111
|
-
* Databricks
|
|
169
|
+
* Databricks AI Gateway profile scores for an endpoint.
|
|
112
170
|
*/
|
|
113
|
-
export
|
|
171
|
+
export type ModelProfile = {
|
|
114
172
|
/**
|
|
115
|
-
*
|
|
173
|
+
* Relative model quality score.
|
|
116
174
|
*/
|
|
117
|
-
|
|
175
|
+
quality?: number,
|
|
118
176
|
/**
|
|
119
|
-
*
|
|
177
|
+
* Relative model speed score.
|
|
120
178
|
*/
|
|
121
|
-
|
|
179
|
+
speed?: number,
|
|
180
|
+
/**
|
|
181
|
+
* Relative model cost score.
|
|
182
|
+
*/
|
|
183
|
+
cost?: number
|
|
122
184
|
}
|
|
123
185
|
|
|
124
|
-
|
|
125
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Generated factory for {@link ModelProfile} record objects.
|
|
188
|
+
*/
|
|
189
|
+
export const ModelProfile = (() => {
|
|
190
|
+
const defaults = () => ({
|
|
191
|
+
});
|
|
192
|
+
const create = (() => {
|
|
193
|
+
return uniffiCreateRecord<ModelProfile, ReturnType<typeof defaults>>(defaults);
|
|
194
|
+
})();
|
|
195
|
+
return Object.freeze({
|
|
196
|
+
create,
|
|
197
|
+
new: create,
|
|
198
|
+
defaults: () => Object.freeze(defaults()) as Partial<ModelProfile>,
|
|
199
|
+
});
|
|
200
|
+
})();
|
|
201
|
+
|
|
202
|
+
const FfiConverterTypeModelProfile = (() => {
|
|
203
|
+
type TypeName = ModelProfile;
|
|
204
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
205
|
+
readFromCursor(c: Cursor): TypeName {
|
|
206
|
+
return {
|
|
207
|
+
quality: FfiConverterOptionalFloat64.readFromCursor(c),
|
|
208
|
+
speed: FfiConverterOptionalFloat64.readFromCursor(c),
|
|
209
|
+
cost: FfiConverterOptionalFloat64.readFromCursor(c)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
213
|
+
FfiConverterOptionalFloat64.writeIntoCursor(value.quality, c);
|
|
214
|
+
FfiConverterOptionalFloat64.writeIntoCursor(value.speed, c);
|
|
215
|
+
FfiConverterOptionalFloat64.writeIntoCursor(value.cost, c);
|
|
216
|
+
}
|
|
217
|
+
allocationSize(value: TypeName): number {
|
|
218
|
+
return FfiConverterOptionalFloat64.allocationSize(value.quality) +
|
|
219
|
+
FfiConverterOptionalFloat64.allocationSize(value.speed) +
|
|
220
|
+
FfiConverterOptionalFloat64.allocationSize(value.cost);
|
|
221
|
+
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
return new FFIConverter();
|
|
225
|
+
})();
|
|
226
|
+
|
|
227
|
+
const stringConverter = (() => {
|
|
228
|
+
const encoder = new TextEncoder();
|
|
229
|
+
const decoder = new TextDecoder();
|
|
230
|
+
return {
|
|
231
|
+
stringToBytes: (s: string) => encoder.encode(s),
|
|
232
|
+
bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
|
|
233
|
+
stringByteLength: (s: string) => encoder.encode(s).byteLength,
|
|
234
|
+
writeStringIntoBuffer: (s: string, buf: any, offset: number): number => {
|
|
235
|
+
const view = new Uint8Array(
|
|
236
|
+
buf.arrayBuffer,
|
|
237
|
+
offset,
|
|
238
|
+
buf.arrayBuffer.byteLength - offset,
|
|
239
|
+
);
|
|
240
|
+
return encoder.encodeInto(s, view).written;
|
|
241
|
+
},
|
|
242
|
+
readStringFromBuffer: (buf: any, offset: number, length: number): string =>
|
|
243
|
+
decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length)),
|
|
244
|
+
};
|
|
245
|
+
})();
|
|
246
|
+
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Intent-oriented class used to select a Model Serving endpoint.
|
|
250
|
+
*/
|
|
251
|
+
export enum ModelClass {
|
|
252
|
+
/**
|
|
253
|
+
* Higher-quality chat models suited to deliberate reasoning.
|
|
254
|
+
*/
|
|
255
|
+
ChatThinking,
|
|
256
|
+
/**
|
|
257
|
+
* General-purpose chat models balancing quality and latency.
|
|
258
|
+
*/
|
|
259
|
+
ChatBalanced,
|
|
260
|
+
/**
|
|
261
|
+
* Low-latency chat models.
|
|
262
|
+
*/
|
|
263
|
+
ChatFast,
|
|
264
|
+
/**
|
|
265
|
+
* Text embedding models.
|
|
266
|
+
*/
|
|
267
|
+
Embedding
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const FfiConverterTypeModelClass = (() => {
|
|
271
|
+
type TypeName = ModelClass;
|
|
126
272
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
127
273
|
readFromCursor(c: Cursor): TypeName {
|
|
128
274
|
switch (c.readI32()) {
|
|
129
|
-
case 1: return
|
|
130
|
-
case 2: return
|
|
275
|
+
case 1: return ModelClass.ChatThinking;
|
|
276
|
+
case 2: return ModelClass.ChatBalanced;
|
|
277
|
+
case 3: return ModelClass.ChatFast;
|
|
278
|
+
case 4: return ModelClass.Embedding;
|
|
131
279
|
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
132
280
|
}
|
|
133
281
|
}
|
|
134
282
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
135
283
|
switch (value) {
|
|
136
|
-
case
|
|
137
|
-
case
|
|
284
|
+
case ModelClass.ChatThinking: return c.writeI32(1);
|
|
285
|
+
case ModelClass.ChatBalanced: return c.writeI32(2);
|
|
286
|
+
case ModelClass.ChatFast: return c.writeI32(3);
|
|
287
|
+
case ModelClass.Embedding: return c.writeI32(4);
|
|
138
288
|
}
|
|
139
289
|
}
|
|
140
290
|
allocationSize(value: TypeName): number {
|
|
@@ -144,6 +294,131 @@ const FfiConverterTypeModelServingApi = (() => {
|
|
|
144
294
|
return new FFIConverter();
|
|
145
295
|
})();
|
|
146
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Filters and ranking controls for a model catalogue query.
|
|
299
|
+
*/
|
|
300
|
+
export type ModelQuery = {
|
|
301
|
+
/**
|
|
302
|
+
* Optional fuzzy model-name search.
|
|
303
|
+
*/
|
|
304
|
+
search?: string,
|
|
305
|
+
/**
|
|
306
|
+
* Requested model-class ceiling, or the exact embedding class.
|
|
307
|
+
*/
|
|
308
|
+
modelClass?: ModelClass,
|
|
309
|
+
/**
|
|
310
|
+
* Whether candidates must support tool calling.
|
|
311
|
+
*/
|
|
312
|
+
requiresTools: boolean,
|
|
313
|
+
/**
|
|
314
|
+
* Whether retired models remain eligible.
|
|
315
|
+
*/
|
|
316
|
+
includeDeprecated: boolean,
|
|
317
|
+
/**
|
|
318
|
+
* Maximum number of results.
|
|
319
|
+
*/
|
|
320
|
+
limit?: number,
|
|
321
|
+
/**
|
|
322
|
+
* Maximum fuzzy-match distance.
|
|
323
|
+
*/
|
|
324
|
+
threshold?: number
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Generated factory for {@link ModelQuery} record objects.
|
|
329
|
+
*/
|
|
330
|
+
export const ModelQuery = (() => {
|
|
331
|
+
const defaults = () => ({
|
|
332
|
+
});
|
|
333
|
+
const create = (() => {
|
|
334
|
+
return uniffiCreateRecord<ModelQuery, ReturnType<typeof defaults>>(defaults);
|
|
335
|
+
})();
|
|
336
|
+
return Object.freeze({
|
|
337
|
+
create,
|
|
338
|
+
new: create,
|
|
339
|
+
defaults: () => Object.freeze(defaults()) as Partial<ModelQuery>,
|
|
340
|
+
});
|
|
341
|
+
})();
|
|
342
|
+
|
|
343
|
+
const FfiConverterTypeModelQuery = (() => {
|
|
344
|
+
type TypeName = ModelQuery;
|
|
345
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
346
|
+
readFromCursor(c: Cursor): TypeName {
|
|
347
|
+
return {
|
|
348
|
+
search: FfiConverterOptionalString.readFromCursor(c),
|
|
349
|
+
modelClass: FfiConverterOptionalTypeModelClass.readFromCursor(c),
|
|
350
|
+
requiresTools: FfiConverterBool.readFromCursor(c),
|
|
351
|
+
includeDeprecated: FfiConverterBool.readFromCursor(c),
|
|
352
|
+
limit: FfiConverterOptionalUInt32.readFromCursor(c),
|
|
353
|
+
threshold: FfiConverterOptionalFloat64.readFromCursor(c)
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
357
|
+
FfiConverterOptionalString.writeIntoCursor(value.search, c);
|
|
358
|
+
FfiConverterOptionalTypeModelClass.writeIntoCursor(value.modelClass, c);
|
|
359
|
+
FfiConverterBool.writeIntoCursor(value.requiresTools, c);
|
|
360
|
+
FfiConverterBool.writeIntoCursor(value.includeDeprecated, c);
|
|
361
|
+
FfiConverterOptionalUInt32.writeIntoCursor(value.limit, c);
|
|
362
|
+
FfiConverterOptionalFloat64.writeIntoCursor(value.threshold, c);
|
|
363
|
+
}
|
|
364
|
+
allocationSize(value: TypeName): number {
|
|
365
|
+
return FfiConverterOptionalString.allocationSize(value.search) +
|
|
366
|
+
FfiConverterOptionalTypeModelClass.allocationSize(value.modelClass) +
|
|
367
|
+
FfiConverterBool.allocationSize(value.requiresTools) +
|
|
368
|
+
FfiConverterBool.allocationSize(value.includeDeprecated) +
|
|
369
|
+
FfiConverterOptionalUInt32.allocationSize(value.limit) +
|
|
370
|
+
FfiConverterOptionalFloat64.allocationSize(value.threshold);
|
|
371
|
+
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
return new FFIConverter();
|
|
375
|
+
})();
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Lifecycle status associated with a model.
|
|
379
|
+
*/
|
|
380
|
+
export type ModelStatus = {
|
|
381
|
+
/**
|
|
382
|
+
* Whether Databricks lists the model as retired or deprecated.
|
|
383
|
+
*/
|
|
384
|
+
deprecated: boolean
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Generated factory for {@link ModelStatus} record objects.
|
|
389
|
+
*/
|
|
390
|
+
export const ModelStatus = (() => {
|
|
391
|
+
const defaults = () => ({
|
|
392
|
+
});
|
|
393
|
+
const create = (() => {
|
|
394
|
+
return uniffiCreateRecord<ModelStatus, ReturnType<typeof defaults>>(defaults);
|
|
395
|
+
})();
|
|
396
|
+
return Object.freeze({
|
|
397
|
+
create,
|
|
398
|
+
new: create,
|
|
399
|
+
defaults: () => Object.freeze(defaults()) as Partial<ModelStatus>,
|
|
400
|
+
});
|
|
401
|
+
})();
|
|
402
|
+
|
|
403
|
+
const FfiConverterTypeModelStatus = (() => {
|
|
404
|
+
type TypeName = ModelStatus;
|
|
405
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
406
|
+
readFromCursor(c: Cursor): TypeName {
|
|
407
|
+
return {
|
|
408
|
+
deprecated: FfiConverterBool.readFromCursor(c)
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
412
|
+
FfiConverterBool.writeIntoCursor(value.deprecated, c);
|
|
413
|
+
}
|
|
414
|
+
allocationSize(value: TypeName): number {
|
|
415
|
+
return FfiConverterBool.allocationSize(value.deprecated);
|
|
416
|
+
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
return new FFIConverter();
|
|
420
|
+
})();
|
|
421
|
+
|
|
147
422
|
/**
|
|
148
423
|
* Reasoning effort accepted by a model endpoint.
|
|
149
424
|
*/
|
|
@@ -211,33 +486,319 @@ const FfiConverterTypeReasoningEffort = (() => {
|
|
|
211
486
|
return new FFIConverter();
|
|
212
487
|
})();
|
|
213
488
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
489
|
+
/**
|
|
490
|
+
* Normalized metadata for a Databricks Model Serving endpoint.
|
|
491
|
+
*/
|
|
492
|
+
export type ServingEndpointSummary = {
|
|
493
|
+
/**
|
|
494
|
+
* Model Serving endpoint name used for invocation.
|
|
495
|
+
*/
|
|
496
|
+
name: string,
|
|
497
|
+
/**
|
|
498
|
+
* Human-readable endpoint or model name.
|
|
499
|
+
*/
|
|
500
|
+
displayName?: string,
|
|
501
|
+
/**
|
|
502
|
+
* Endpoint task, such as chat or embeddings.
|
|
503
|
+
*/
|
|
504
|
+
task?: string,
|
|
505
|
+
/**
|
|
506
|
+
* Endpoint readiness state.
|
|
507
|
+
*/
|
|
508
|
+
state?: string,
|
|
509
|
+
/**
|
|
510
|
+
* Endpoint description supplied by Databricks.
|
|
511
|
+
*/
|
|
512
|
+
description?: string,
|
|
513
|
+
/**
|
|
514
|
+
* Whether the endpoint supports tool calling.
|
|
515
|
+
*/
|
|
516
|
+
supportsTools?: boolean,
|
|
517
|
+
/**
|
|
518
|
+
* AI Gateway model profile scores.
|
|
519
|
+
*/
|
|
520
|
+
profile?: ModelProfile,
|
|
521
|
+
/**
|
|
522
|
+
* Intent-oriented endpoint class.
|
|
523
|
+
*/
|
|
524
|
+
modelClass?: ModelClass,
|
|
525
|
+
/**
|
|
526
|
+
* Provider names mapped to provider-specific model names.
|
|
527
|
+
*/
|
|
528
|
+
serviceNames: Map<string, string>,
|
|
529
|
+
/**
|
|
530
|
+
* Foundation model name reported by the served entity.
|
|
531
|
+
*/
|
|
532
|
+
modelServiceName?: string,
|
|
533
|
+
/**
|
|
534
|
+
* Reasoning effort values accepted by the endpoint.
|
|
535
|
+
*/
|
|
536
|
+
reasoningEfforts: Array<ReasoningEffort>,
|
|
537
|
+
/**
|
|
538
|
+
* Retirement status for the served model.
|
|
539
|
+
*/
|
|
540
|
+
status: ModelStatus
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Generated factory for {@link ServingEndpointSummary} record objects.
|
|
545
|
+
*/
|
|
546
|
+
export const ServingEndpointSummary = (() => {
|
|
547
|
+
const defaults = () => ({
|
|
548
|
+
});
|
|
549
|
+
const create = (() => {
|
|
550
|
+
return uniffiCreateRecord<ServingEndpointSummary, ReturnType<typeof defaults>>(defaults);
|
|
551
|
+
})();
|
|
552
|
+
return Object.freeze({
|
|
553
|
+
create,
|
|
554
|
+
new: create,
|
|
555
|
+
defaults: () => Object.freeze(defaults()) as Partial<ServingEndpointSummary>,
|
|
556
|
+
});
|
|
557
|
+
})();
|
|
558
|
+
|
|
559
|
+
const FfiConverterTypeServingEndpointSummary = (() => {
|
|
560
|
+
type TypeName = ServingEndpointSummary;
|
|
561
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
562
|
+
readFromCursor(c: Cursor): TypeName {
|
|
563
|
+
return {
|
|
564
|
+
name: FfiConverterString.readFromCursor(c),
|
|
565
|
+
displayName: FfiConverterOptionalString.readFromCursor(c),
|
|
566
|
+
task: FfiConverterOptionalString.readFromCursor(c),
|
|
567
|
+
state: FfiConverterOptionalString.readFromCursor(c),
|
|
568
|
+
description: FfiConverterOptionalString.readFromCursor(c),
|
|
569
|
+
supportsTools: FfiConverterOptionalBoolean.readFromCursor(c),
|
|
570
|
+
profile: FfiConverterOptionalTypeModelProfile.readFromCursor(c),
|
|
571
|
+
modelClass: FfiConverterOptionalTypeModelClass.readFromCursor(c),
|
|
572
|
+
serviceNames: FfiConverterMapStringString.readFromCursor(c),
|
|
573
|
+
modelServiceName: FfiConverterOptionalString.readFromCursor(c),
|
|
574
|
+
reasoningEfforts: FfiConverterSequenceTypeReasoningEffort.readFromCursor(c),
|
|
575
|
+
status: FfiConverterTypeModelStatus.readFromCursor(c)
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
579
|
+
FfiConverterString.writeIntoCursor(value.name, c);
|
|
580
|
+
FfiConverterOptionalString.writeIntoCursor(value.displayName, c);
|
|
581
|
+
FfiConverterOptionalString.writeIntoCursor(value.task, c);
|
|
582
|
+
FfiConverterOptionalString.writeIntoCursor(value.state, c);
|
|
583
|
+
FfiConverterOptionalString.writeIntoCursor(value.description, c);
|
|
584
|
+
FfiConverterOptionalBoolean.writeIntoCursor(value.supportsTools, c);
|
|
585
|
+
FfiConverterOptionalTypeModelProfile.writeIntoCursor(value.profile, c);
|
|
586
|
+
FfiConverterOptionalTypeModelClass.writeIntoCursor(value.modelClass, c);
|
|
587
|
+
FfiConverterMapStringString.writeIntoCursor(value.serviceNames, c);
|
|
588
|
+
FfiConverterOptionalString.writeIntoCursor(value.modelServiceName, c);
|
|
589
|
+
FfiConverterSequenceTypeReasoningEffort.writeIntoCursor(value.reasoningEfforts, c);
|
|
590
|
+
FfiConverterTypeModelStatus.writeIntoCursor(value.status, c);
|
|
591
|
+
}
|
|
592
|
+
allocationSize(value: TypeName): number {
|
|
593
|
+
return FfiConverterString.allocationSize(value.name) +
|
|
594
|
+
FfiConverterOptionalString.allocationSize(value.displayName) +
|
|
595
|
+
FfiConverterOptionalString.allocationSize(value.task) +
|
|
596
|
+
FfiConverterOptionalString.allocationSize(value.state) +
|
|
597
|
+
FfiConverterOptionalString.allocationSize(value.description) +
|
|
598
|
+
FfiConverterOptionalBoolean.allocationSize(value.supportsTools) +
|
|
599
|
+
FfiConverterOptionalTypeModelProfile.allocationSize(value.profile) +
|
|
600
|
+
FfiConverterOptionalTypeModelClass.allocationSize(value.modelClass) +
|
|
601
|
+
FfiConverterMapStringString.allocationSize(value.serviceNames) +
|
|
602
|
+
FfiConverterOptionalString.allocationSize(value.modelServiceName) +
|
|
603
|
+
FfiConverterSequenceTypeReasoningEffort.allocationSize(value.reasoningEfforts) +
|
|
604
|
+
FfiConverterTypeModelStatus.allocationSize(value.status);
|
|
605
|
+
|
|
606
|
+
}
|
|
231
607
|
};
|
|
608
|
+
return new FFIConverter();
|
|
232
609
|
})();
|
|
233
|
-
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
234
610
|
|
|
235
|
-
|
|
236
|
-
|
|
611
|
+
/**
|
|
612
|
+
* Model Serving endpoint plus its classification and search score.
|
|
613
|
+
*/
|
|
614
|
+
export type RankedModel = {
|
|
615
|
+
/**
|
|
616
|
+
* Matching endpoint metadata.
|
|
617
|
+
*/
|
|
618
|
+
endpoint: ServingEndpointSummary,
|
|
619
|
+
/**
|
|
620
|
+
* Intent-oriented endpoint class.
|
|
621
|
+
*/
|
|
622
|
+
modelClass: ModelClass,
|
|
623
|
+
/**
|
|
624
|
+
* Fuzzy-match distance, where lower values are closer.
|
|
625
|
+
*/
|
|
626
|
+
score?: number
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Generated factory for {@link RankedModel} record objects.
|
|
631
|
+
*/
|
|
632
|
+
export const RankedModel = (() => {
|
|
633
|
+
const defaults = () => ({
|
|
634
|
+
});
|
|
635
|
+
const create = (() => {
|
|
636
|
+
return uniffiCreateRecord<RankedModel, ReturnType<typeof defaults>>(defaults);
|
|
637
|
+
})();
|
|
638
|
+
return Object.freeze({
|
|
639
|
+
create,
|
|
640
|
+
new: create,
|
|
641
|
+
defaults: () => Object.freeze(defaults()) as Partial<RankedModel>,
|
|
642
|
+
});
|
|
643
|
+
})();
|
|
644
|
+
|
|
645
|
+
const FfiConverterTypeRankedModel = (() => {
|
|
646
|
+
type TypeName = RankedModel;
|
|
647
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
648
|
+
readFromCursor(c: Cursor): TypeName {
|
|
649
|
+
return {
|
|
650
|
+
endpoint: FfiConverterTypeServingEndpointSummary.readFromCursor(c),
|
|
651
|
+
modelClass: FfiConverterTypeModelClass.readFromCursor(c),
|
|
652
|
+
score: FfiConverterOptionalFloat64.readFromCursor(c)
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
656
|
+
FfiConverterTypeServingEndpointSummary.writeIntoCursor(value.endpoint, c);
|
|
657
|
+
FfiConverterTypeModelClass.writeIntoCursor(value.modelClass, c);
|
|
658
|
+
FfiConverterOptionalFloat64.writeIntoCursor(value.score, c);
|
|
659
|
+
}
|
|
660
|
+
allocationSize(value: TypeName): number {
|
|
661
|
+
return FfiConverterTypeServingEndpointSummary.allocationSize(value.endpoint) +
|
|
662
|
+
FfiConverterTypeModelClass.allocationSize(value.modelClass) +
|
|
663
|
+
FfiConverterOptionalFloat64.allocationSize(value.score);
|
|
664
|
+
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
return new FFIConverter();
|
|
668
|
+
})();
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Result of resolving a requested model name.
|
|
672
|
+
*/
|
|
673
|
+
export type ResolvedModel = {
|
|
674
|
+
/**
|
|
675
|
+
* Resolved endpoint name or the original request when unmatched.
|
|
676
|
+
*/
|
|
677
|
+
modelId: string,
|
|
678
|
+
/**
|
|
679
|
+
* Whether the request matched a known endpoint.
|
|
680
|
+
*/
|
|
681
|
+
matched: boolean,
|
|
682
|
+
/**
|
|
683
|
+
* Fuzzy-match distance when available.
|
|
684
|
+
*/
|
|
685
|
+
score?: number
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Generated factory for {@link ResolvedModel} record objects.
|
|
690
|
+
*/
|
|
691
|
+
export const ResolvedModel = (() => {
|
|
692
|
+
const defaults = () => ({
|
|
693
|
+
});
|
|
694
|
+
const create = (() => {
|
|
695
|
+
return uniffiCreateRecord<ResolvedModel, ReturnType<typeof defaults>>(defaults);
|
|
696
|
+
})();
|
|
697
|
+
return Object.freeze({
|
|
698
|
+
create,
|
|
699
|
+
new: create,
|
|
700
|
+
defaults: () => Object.freeze(defaults()) as Partial<ResolvedModel>,
|
|
701
|
+
});
|
|
702
|
+
})();
|
|
703
|
+
|
|
704
|
+
const FfiConverterTypeResolvedModel = (() => {
|
|
705
|
+
type TypeName = ResolvedModel;
|
|
706
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
707
|
+
readFromCursor(c: Cursor): TypeName {
|
|
708
|
+
return {
|
|
709
|
+
modelId: FfiConverterString.readFromCursor(c),
|
|
710
|
+
matched: FfiConverterBool.readFromCursor(c),
|
|
711
|
+
score: FfiConverterOptionalFloat64.readFromCursor(c)
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
715
|
+
FfiConverterString.writeIntoCursor(value.modelId, c);
|
|
716
|
+
FfiConverterBool.writeIntoCursor(value.matched, c);
|
|
717
|
+
FfiConverterOptionalFloat64.writeIntoCursor(value.score, c);
|
|
718
|
+
}
|
|
719
|
+
allocationSize(value: TypeName): number {
|
|
720
|
+
return FfiConverterString.allocationSize(value.modelId) +
|
|
721
|
+
FfiConverterBool.allocationSize(value.matched) +
|
|
722
|
+
FfiConverterOptionalFloat64.allocationSize(value.score);
|
|
723
|
+
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
return new FFIConverter();
|
|
727
|
+
})();
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Databricks inference protocol selected for a model.
|
|
731
|
+
*/
|
|
732
|
+
export enum ModelServingApi {
|
|
733
|
+
/**
|
|
734
|
+
* OpenAI-compatible Chat Completions.
|
|
735
|
+
*/
|
|
736
|
+
Chat,
|
|
737
|
+
/**
|
|
738
|
+
* Native OpenAI Responses.
|
|
739
|
+
*/
|
|
740
|
+
Responses
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const FfiConverterTypeModelServingApi = (() => {
|
|
744
|
+
type TypeName = ModelServingApi;
|
|
745
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
746
|
+
readFromCursor(c: Cursor): TypeName {
|
|
747
|
+
switch (c.readI32()) {
|
|
748
|
+
case 1: return ModelServingApi.Chat;
|
|
749
|
+
case 2: return ModelServingApi.Responses;
|
|
750
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
754
|
+
switch (value) {
|
|
755
|
+
case ModelServingApi.Chat: return c.writeI32(1);
|
|
756
|
+
case ModelServingApi.Responses: return c.writeI32(2);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
allocationSize(value: TypeName): number {
|
|
760
|
+
return 4;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return new FFIConverter();
|
|
764
|
+
})();
|
|
765
|
+
|
|
766
|
+
// FfiConverter for number | undefined
|
|
767
|
+
const FfiConverterOptionalFloat64 = new FfiConverterOptional(FfiConverterFloat64);
|
|
768
|
+
|
|
769
|
+
// FfiConverter for string | undefined
|
|
770
|
+
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
771
|
+
|
|
772
|
+
// FfiConverter for ModelClass | undefined
|
|
773
|
+
const FfiConverterOptionalTypeModelClass = new FfiConverterOptional(FfiConverterTypeModelClass);
|
|
774
|
+
|
|
775
|
+
// FfiConverter for number | undefined
|
|
776
|
+
const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
|
|
777
|
+
|
|
778
|
+
// FfiConverter for boolean | undefined
|
|
779
|
+
const FfiConverterOptionalBoolean = new FfiConverterOptional(FfiConverterBool);
|
|
780
|
+
|
|
781
|
+
// FfiConverter for ModelProfile | undefined
|
|
782
|
+
const FfiConverterOptionalTypeModelProfile = new FfiConverterOptional(FfiConverterTypeModelProfile);
|
|
783
|
+
|
|
784
|
+
// FfiConverter for Map<string, string>
|
|
785
|
+
const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
|
|
237
786
|
|
|
238
787
|
// FfiConverter for Array<ReasoningEffort>
|
|
239
788
|
const FfiConverterSequenceTypeReasoningEffort = new FfiConverterArray(FfiConverterTypeReasoningEffort);
|
|
240
789
|
|
|
790
|
+
// FfiConverter for ReasoningEffort | undefined
|
|
791
|
+
const FfiConverterOptionalTypeReasoningEffort = new FfiConverterOptional(FfiConverterTypeReasoningEffort);
|
|
792
|
+
|
|
793
|
+
// FfiConverter for Array<ServingEndpointSummary>
|
|
794
|
+
const FfiConverterSequenceTypeServingEndpointSummary = new FfiConverterArray(FfiConverterTypeServingEndpointSummary);
|
|
795
|
+
|
|
796
|
+
// FfiConverter for Array<RankedModel>
|
|
797
|
+
const FfiConverterSequenceTypeRankedModel = new FfiConverterArray(FfiConverterTypeRankedModel);
|
|
798
|
+
|
|
799
|
+
// FfiConverter for Array<string>
|
|
800
|
+
const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
|
|
801
|
+
|
|
241
802
|
|
|
242
803
|
/**
|
|
243
804
|
* This should be called before anything else.
|
|
@@ -263,9 +824,18 @@ function uniffiEnsureInitialized() {
|
|
|
263
824
|
if (nativeModule().uniffi_dbx_tools_model_checksum_func_is_responses_only() !== 5794) {
|
|
264
825
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_model_checksum_func_is_responses_only");
|
|
265
826
|
}
|
|
827
|
+
if (nativeModule().uniffi_dbx_tools_model_checksum_func_model_family() !== 2675) {
|
|
828
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_model_checksum_func_model_family");
|
|
829
|
+
}
|
|
266
830
|
if (nativeModule().uniffi_dbx_tools_model_checksum_func_model_serving_api() !== 54338) {
|
|
267
831
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_model_checksum_func_model_serving_api");
|
|
268
832
|
}
|
|
833
|
+
if (nativeModule().uniffi_dbx_tools_model_checksum_func_rank_models() !== 57675) {
|
|
834
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_model_checksum_func_rank_models");
|
|
835
|
+
}
|
|
836
|
+
if (nativeModule().uniffi_dbx_tools_model_checksum_func_reasoning_effort_names_by_family() !== 48201) {
|
|
837
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_model_checksum_func_reasoning_effort_names_by_family");
|
|
838
|
+
}
|
|
269
839
|
if (nativeModule().uniffi_dbx_tools_model_checksum_func_reasoning_efforts_by_family() !== 49390) {
|
|
270
840
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_model_checksum_func_reasoning_efforts_by_family");
|
|
271
841
|
}
|
|
@@ -278,7 +848,14 @@ function uniffiEnsureInitialized() {
|
|
|
278
848
|
export default Object.freeze({
|
|
279
849
|
initialize: uniffiEnsureInitialized,
|
|
280
850
|
converters: {
|
|
851
|
+
FfiConverterTypeModelClass,
|
|
852
|
+
FfiConverterTypeModelProfile,
|
|
853
|
+
FfiConverterTypeModelQuery,
|
|
281
854
|
FfiConverterTypeModelServingApi,
|
|
855
|
+
FfiConverterTypeModelStatus,
|
|
856
|
+
FfiConverterTypeRankedModel,
|
|
282
857
|
FfiConverterTypeReasoningEffort,
|
|
858
|
+
FfiConverterTypeResolvedModel,
|
|
859
|
+
FfiConverterTypeServingEndpointSummary,
|
|
283
860
|
}
|
|
284
861
|
});
|