react-native-nobodywho 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generated/cpp/nobodywho.cpp +145 -0
- package/generated/cpp/nobodywho.hpp +18 -0
- package/generated/ts/nobodywho-ffi.ts +6 -0
- package/generated/ts/nobodywho.ts +159 -9
- package/package.json +1 -1
- package/src/wrapper.ts +34 -1
|
@@ -239,6 +239,8 @@ uniffi_nobodywho_uniffi_fn_method_samplerbuilder_mirostat_v2(
|
|
|
239
239
|
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(
|
|
240
240
|
/*handle*/ uint64_t ptr, int32_t penalty_last_n, float penalty_repeat,
|
|
241
241
|
float penalty_freq, float penalty_present, RustCallStatus *uniffi_out_err);
|
|
242
|
+
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(
|
|
243
|
+
/*handle*/ uint64_t ptr, uint32_t seed, RustCallStatus *uniffi_out_err);
|
|
242
244
|
/*handle*/ uint64_t
|
|
243
245
|
uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature(
|
|
244
246
|
/*handle*/ uint64_t ptr, float temperature, RustCallStatus *uniffi_out_err);
|
|
@@ -268,6 +270,10 @@ void uniffi_nobodywho_uniffi_fn_init_callback_vtable_rusttoolcallback(
|
|
|
268
270
|
UniffiVTableCallbackInterfaceRustToolCallback *vtable);
|
|
269
271
|
float uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
270
272
|
RustBuffer a, RustBuffer b, RustCallStatus *uniffi_out_err);
|
|
273
|
+
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
274
|
+
RustBuffer model_path, RustBuffer headers, RustBuffer on_download_progress);
|
|
275
|
+
RustBuffer uniffi_nobodywho_uniffi_fn_func_get_cached_models(
|
|
276
|
+
RustCallStatus *uniffi_out_err);
|
|
271
277
|
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
272
278
|
RustBuffer model_path, int8_t use_gpu, RustBuffer projection_model_path,
|
|
273
279
|
RustBuffer on_download_progress);
|
|
@@ -416,6 +422,8 @@ void ffi_nobodywho_uniffi_rust_future_free_void(
|
|
|
416
422
|
void ffi_nobodywho_uniffi_rust_future_complete_void(
|
|
417
423
|
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
418
424
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_cosine_similarity();
|
|
425
|
+
uint16_t uniffi_nobodywho_uniffi_checksum_func_download_model();
|
|
426
|
+
uint16_t uniffi_nobodywho_uniffi_checksum_func_get_cached_models();
|
|
419
427
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_load_model();
|
|
420
428
|
uint16_t
|
|
421
429
|
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar();
|
|
@@ -466,6 +474,7 @@ uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_min_p();
|
|
|
466
474
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v1();
|
|
467
475
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v2();
|
|
468
476
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties();
|
|
477
|
+
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed();
|
|
469
478
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature();
|
|
470
479
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k();
|
|
471
480
|
uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p();
|
|
@@ -3227,6 +3236,18 @@ NativeNobodywho::NativeNobodywho(
|
|
|
3227
3236
|
->cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(
|
|
3228
3237
|
rt, thisVal, args, count);
|
|
3229
3238
|
});
|
|
3239
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed"] =
|
|
3240
|
+
jsi::Function::createFromHostFunction(
|
|
3241
|
+
rt,
|
|
3242
|
+
jsi::PropNameID::forAscii(
|
|
3243
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed"),
|
|
3244
|
+
2,
|
|
3245
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3246
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3247
|
+
return this
|
|
3248
|
+
->cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(
|
|
3249
|
+
rt, thisVal, args, count);
|
|
3250
|
+
});
|
|
3230
3251
|
props["ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature"] =
|
|
3231
3252
|
jsi::Function::createFromHostFunction(
|
|
3232
3253
|
rt,
|
|
@@ -3372,6 +3393,28 @@ NativeNobodywho::NativeNobodywho(
|
|
|
3372
3393
|
return this->cpp_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
3373
3394
|
rt, thisVal, args, count);
|
|
3374
3395
|
});
|
|
3396
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_func_download_model"] =
|
|
3397
|
+
jsi::Function::createFromHostFunction(
|
|
3398
|
+
rt,
|
|
3399
|
+
jsi::PropNameID::forAscii(
|
|
3400
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_func_download_model"),
|
|
3401
|
+
3,
|
|
3402
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3403
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3404
|
+
return this->cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
3405
|
+
rt, thisVal, args, count);
|
|
3406
|
+
});
|
|
3407
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_func_get_cached_models"] =
|
|
3408
|
+
jsi::Function::createFromHostFunction(
|
|
3409
|
+
rt,
|
|
3410
|
+
jsi::PropNameID::forAscii(
|
|
3411
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_func_get_cached_models"),
|
|
3412
|
+
0,
|
|
3413
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3414
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3415
|
+
return this->cpp_uniffi_nobodywho_uniffi_fn_func_get_cached_models(
|
|
3416
|
+
rt, thisVal, args, count);
|
|
3417
|
+
});
|
|
3375
3418
|
props["ubrn_uniffi_nobodywho_uniffi_fn_func_load_model"] =
|
|
3376
3419
|
jsi::Function::createFromHostFunction(
|
|
3377
3420
|
rt,
|
|
@@ -4060,6 +4103,31 @@ NativeNobodywho::NativeNobodywho(
|
|
|
4060
4103
|
->cpp_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(
|
|
4061
4104
|
rt, thisVal, args, count);
|
|
4062
4105
|
});
|
|
4106
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model"] =
|
|
4107
|
+
jsi::Function::createFromHostFunction(
|
|
4108
|
+
rt,
|
|
4109
|
+
jsi::PropNameID::forAscii(
|
|
4110
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model"),
|
|
4111
|
+
0,
|
|
4112
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4113
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4114
|
+
return this
|
|
4115
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
|
|
4116
|
+
rt, thisVal, args, count);
|
|
4117
|
+
});
|
|
4118
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models"] =
|
|
4119
|
+
jsi::Function::createFromHostFunction(
|
|
4120
|
+
rt,
|
|
4121
|
+
jsi::PropNameID::forAscii(
|
|
4122
|
+
rt,
|
|
4123
|
+
"ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models"),
|
|
4124
|
+
0,
|
|
4125
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4126
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4127
|
+
return this
|
|
4128
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_func_get_cached_models(
|
|
4129
|
+
rt, thisVal, args, count);
|
|
4130
|
+
});
|
|
4063
4131
|
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model"] =
|
|
4064
4132
|
jsi::Function::createFromHostFunction(
|
|
4065
4133
|
rt,
|
|
@@ -4568,6 +4636,18 @@ NativeNobodywho::NativeNobodywho(
|
|
|
4568
4636
|
->cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties(
|
|
4569
4637
|
rt, thisVal, args, count);
|
|
4570
4638
|
});
|
|
4639
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed"] =
|
|
4640
|
+
jsi::Function::createFromHostFunction(
|
|
4641
|
+
rt,
|
|
4642
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_nobodywho_uniffi_checksum_"
|
|
4643
|
+
"method_samplerbuilder_seed"),
|
|
4644
|
+
0,
|
|
4645
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4646
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4647
|
+
return this
|
|
4648
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed(
|
|
4649
|
+
rt, thisVal, args, count);
|
|
4650
|
+
});
|
|
4571
4651
|
props["ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_"
|
|
4572
4652
|
"temperature"] = jsi::Function::createFromHostFunction(
|
|
4573
4653
|
rt,
|
|
@@ -5807,6 +5887,23 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(
|
|
|
5807
5887
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
5808
5888
|
value);
|
|
5809
5889
|
}
|
|
5890
|
+
jsi::Value
|
|
5891
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(
|
|
5892
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
5893
|
+
size_t count) {
|
|
5894
|
+
RustCallStatus status =
|
|
5895
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
5896
|
+
auto value = uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(
|
|
5897
|
+
uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
|
|
5898
|
+
args[0]),
|
|
5899
|
+
uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[1]),
|
|
5900
|
+
&status);
|
|
5901
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
5902
|
+
rt, callInvoker, status, args[count - 1]);
|
|
5903
|
+
|
|
5904
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
5905
|
+
value);
|
|
5906
|
+
}
|
|
5810
5907
|
jsi::Value NativeNobodywho::
|
|
5811
5908
|
cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature(
|
|
5812
5909
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -5997,6 +6094,30 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
|
5997
6094
|
|
|
5998
6095
|
return uniffi_jsi::Bridging<float>::toJs(rt, callInvoker, value);
|
|
5999
6096
|
}
|
|
6097
|
+
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
6098
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6099
|
+
size_t count) {
|
|
6100
|
+
auto value = uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
6101
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
|
|
6102
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
|
|
6103
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
6104
|
+
args[2]));
|
|
6105
|
+
|
|
6106
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6107
|
+
value);
|
|
6108
|
+
}
|
|
6109
|
+
jsi::Value
|
|
6110
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_get_cached_models(
|
|
6111
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6112
|
+
size_t count) {
|
|
6113
|
+
RustCallStatus status =
|
|
6114
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6115
|
+
auto value = uniffi_nobodywho_uniffi_fn_func_get_cached_models(&status);
|
|
6116
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6117
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6118
|
+
|
|
6119
|
+
return uniffi::nobodywho::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
|
|
6120
|
+
}
|
|
6000
6121
|
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
6001
6122
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6002
6123
|
size_t count) {
|
|
@@ -6723,6 +6844,22 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(
|
|
|
6723
6844
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6724
6845
|
}
|
|
6725
6846
|
jsi::Value
|
|
6847
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
|
|
6848
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6849
|
+
size_t count) {
|
|
6850
|
+
auto value = uniffi_nobodywho_uniffi_checksum_func_download_model();
|
|
6851
|
+
|
|
6852
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6853
|
+
}
|
|
6854
|
+
jsi::Value
|
|
6855
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_get_cached_models(
|
|
6856
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6857
|
+
size_t count) {
|
|
6858
|
+
auto value = uniffi_nobodywho_uniffi_checksum_func_get_cached_models();
|
|
6859
|
+
|
|
6860
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6861
|
+
}
|
|
6862
|
+
jsi::Value
|
|
6726
6863
|
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
|
|
6727
6864
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6728
6865
|
size_t count) {
|
|
@@ -7081,6 +7218,14 @@ jsi::Value NativeNobodywho::
|
|
|
7081
7218
|
|
|
7082
7219
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
7083
7220
|
}
|
|
7221
|
+
jsi::Value NativeNobodywho::
|
|
7222
|
+
cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed(
|
|
7223
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
7224
|
+
size_t count) {
|
|
7225
|
+
auto value = uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed();
|
|
7226
|
+
|
|
7227
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
7228
|
+
}
|
|
7084
7229
|
jsi::Value NativeNobodywho::
|
|
7085
7230
|
cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature(
|
|
7086
7231
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -183,6 +183,9 @@ protected:
|
|
|
183
183
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(
|
|
184
184
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
185
185
|
size_t count);
|
|
186
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(
|
|
187
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
188
|
+
size_t count);
|
|
186
189
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature(
|
|
187
190
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
188
191
|
size_t count);
|
|
@@ -221,6 +224,12 @@ protected:
|
|
|
221
224
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
222
225
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
223
226
|
size_t count);
|
|
227
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
228
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
229
|
+
size_t count);
|
|
230
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_get_cached_models(
|
|
231
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
232
|
+
size_t count);
|
|
224
233
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
225
234
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
226
235
|
size_t count);
|
|
@@ -407,6 +416,12 @@ protected:
|
|
|
407
416
|
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(
|
|
408
417
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
409
418
|
size_t count);
|
|
419
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
|
|
420
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
421
|
+
size_t count);
|
|
422
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_get_cached_models(
|
|
423
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
424
|
+
size_t count);
|
|
410
425
|
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
|
|
411
426
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
412
427
|
size_t count);
|
|
@@ -556,6 +571,9 @@ protected:
|
|
|
556
571
|
cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties(
|
|
557
572
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
558
573
|
size_t count);
|
|
574
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed(
|
|
575
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
576
|
+
size_t count);
|
|
559
577
|
jsi::Value
|
|
560
578
|
cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature(
|
|
561
579
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -68,6 +68,7 @@ interface NativeModuleInterface {
|
|
|
68
68
|
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_mirostat_v1(ptr: bigint, tau: number, eta: number, m: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
69
69
|
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_mirostat_v2(ptr: bigint, tau: number, eta: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
70
70
|
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(ptr: bigint, penaltyLastN: number, penaltyRepeat: number, penaltyFreq: number, penaltyPresent: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
71
|
+
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(ptr: bigint, seed: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
71
72
|
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature(ptr: bigint, temperature: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
72
73
|
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_top_k(ptr: bigint, topK: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
73
74
|
ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_top_p(ptr: bigint, topP: number, minKeep: number, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
@@ -80,6 +81,8 @@ interface NativeModuleInterface {
|
|
|
80
81
|
ubrn_uniffi_nobodywho_uniffi_fn_init_callback_vtable_rustdownloadprogresscallback(vtable: UniffiVTableCallbackInterfaceRustDownloadProgressCallback): void;
|
|
81
82
|
ubrn_uniffi_nobodywho_uniffi_fn_init_callback_vtable_rusttoolcallback(vtable: UniffiVTableCallbackInterfaceRustToolCallback): void;
|
|
82
83
|
ubrn_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(a: Uint8Array, b: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
|
|
84
|
+
ubrn_uniffi_nobodywho_uniffi_fn_func_download_model(modelPath: Uint8Array, headers: Uint8Array, onDownloadProgress: Uint8Array): bigint;
|
|
85
|
+
ubrn_uniffi_nobodywho_uniffi_fn_func_get_cached_models(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
83
86
|
ubrn_uniffi_nobodywho_uniffi_fn_func_load_model(modelPath: Uint8Array, useGpu: number, projectionModelPath: Uint8Array, onDownloadProgress: Uint8Array): bigint;
|
|
84
87
|
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(grammar: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
85
88
|
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(schema: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
@@ -141,6 +144,8 @@ interface NativeModuleInterface {
|
|
|
141
144
|
ubrn_ffi_nobodywho_uniffi_rust_future_free_void(handle: bigint): void;
|
|
142
145
|
ubrn_ffi_nobodywho_uniffi_rust_future_complete_void(handle: bigint, uniffi_out_err: UniffiRustCallStatus): void;
|
|
143
146
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(): number;
|
|
147
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model(): number;
|
|
148
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models(): number;
|
|
144
149
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model(): number;
|
|
145
150
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar(): number;
|
|
146
151
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema(): number;
|
|
@@ -183,6 +188,7 @@ interface NativeModuleInterface {
|
|
|
183
188
|
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v1(): number;
|
|
184
189
|
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v2(): number;
|
|
185
190
|
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties(): number;
|
|
191
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed(): number;
|
|
186
192
|
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature(): number;
|
|
187
193
|
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k(): number;
|
|
188
194
|
ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p(): number;
|
|
@@ -95,6 +95,51 @@ export function cosineSimilarity(a: Array</*f32*/number>, b: Array</*f32*/number
|
|
|
95
95
|
/*liftString:*/ FfiConverterString.lift,
|
|
96
96
|
));
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Download a GGUF model from a remote URL or HuggingFace path and return the local file path.
|
|
100
|
+
*
|
|
101
|
+
* Use this when you need custom headers, e.g. for gated models that require authentication.
|
|
102
|
+
* For unauthenticated downloads, pass the URL directly to `load_model`.
|
|
103
|
+
*/
|
|
104
|
+
export async function downloadModel(modelPath: string, headers: Map<string, string> | undefined, onDownloadProgress: RustDownloadProgressCallback | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
|
|
105
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
106
|
+
try {
|
|
107
|
+
return await uniffiRustCallAsync(
|
|
108
|
+
/*rustCaller:*/ uniffiCaller,
|
|
109
|
+
/*rustFutureFunc:*/ () => {
|
|
110
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_download_model(FfiConverterString.lower(modelPath),FfiConverterOptionalMapStringString.lower(headers),FfiConverterOptionalTypeRustDownloadProgressCallback.lower(onDownloadProgress)
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
114
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
115
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
116
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
117
|
+
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
118
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
119
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
120
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
121
|
+
);
|
|
122
|
+
} catch (__error: any) {
|
|
123
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
124
|
+
__error.stack = __stack;
|
|
125
|
+
}
|
|
126
|
+
throw __error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns every cached `.gguf` model paired with its byte size.
|
|
131
|
+
*/
|
|
132
|
+
export function getCachedModels(): Array<CachedModel> /*throws*/ {
|
|
133
|
+
return FfiConverterArrayTypeCachedModel.lift(
|
|
134
|
+
uniffiCaller.rustCallWithError(
|
|
135
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
136
|
+
/*caller:*/ (callStatus) => {
|
|
137
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_get_cached_models(
|
|
138
|
+
callStatus);
|
|
139
|
+
},
|
|
140
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
141
|
+
));
|
|
142
|
+
}
|
|
98
143
|
/**
|
|
99
144
|
* Load a GGUF model from a local path or remote URL.
|
|
100
145
|
*
|
|
@@ -458,6 +503,67 @@ const FfiConverterTypeAsset = (() => {
|
|
|
458
503
|
})();
|
|
459
504
|
|
|
460
505
|
|
|
506
|
+
/**
|
|
507
|
+
* A cached `.gguf` model and its on-disk size.
|
|
508
|
+
*/
|
|
509
|
+
export type CachedModel = {
|
|
510
|
+
path: string,
|
|
511
|
+
size: /*u64*/bigint
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Generated factory for {@link CachedModel} record objects.
|
|
516
|
+
*/
|
|
517
|
+
export const CachedModel = (() => {
|
|
518
|
+
const defaults = () => ({
|
|
519
|
+
});
|
|
520
|
+
const create = (() => {
|
|
521
|
+
return uniffiCreateRecord<CachedModel, ReturnType<typeof defaults>>(defaults);
|
|
522
|
+
})();
|
|
523
|
+
return Object.freeze({
|
|
524
|
+
/**
|
|
525
|
+
* Create a frozen instance of {@link CachedModel}, with defaults specified
|
|
526
|
+
* in Rust, in the {@link nobodywho} crate.
|
|
527
|
+
*/
|
|
528
|
+
create,
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Create a frozen instance of {@link CachedModel}, with defaults specified
|
|
532
|
+
* in Rust, in the {@link nobodywho} crate.
|
|
533
|
+
*/
|
|
534
|
+
new: create,
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Defaults specified in the {@link nobodywho} crate.
|
|
538
|
+
*/
|
|
539
|
+
defaults: () => Object.freeze(defaults()) as Partial<CachedModel>,
|
|
540
|
+
|
|
541
|
+
});
|
|
542
|
+
})();
|
|
543
|
+
|
|
544
|
+
const FfiConverterTypeCachedModel = (() => {
|
|
545
|
+
type TypeName = CachedModel;
|
|
546
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
547
|
+
read(from: RustBuffer): TypeName {
|
|
548
|
+
return {
|
|
549
|
+
path: FfiConverterString.read(from),
|
|
550
|
+
size: FfiConverterUInt64.read(from)
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
554
|
+
FfiConverterString.write(value.path, into);
|
|
555
|
+
FfiConverterUInt64.write(value.size, into);
|
|
556
|
+
}
|
|
557
|
+
allocationSize(value: TypeName): number {
|
|
558
|
+
return FfiConverterString.allocationSize(value.path) +
|
|
559
|
+
FfiConverterUInt64.allocationSize(value.size);
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
return new FFIConverter();
|
|
564
|
+
})();
|
|
565
|
+
|
|
566
|
+
|
|
461
567
|
/**
|
|
462
568
|
* A pending tool call waiting for resolution from the language binding.
|
|
463
569
|
*/
|
|
@@ -1176,6 +1282,10 @@ const FfiConverterTypePromptPart = (() => {
|
|
|
1176
1282
|
const FfiConverterMapStringBool = new FfiConverterMap(FfiConverterString, FfiConverterBool);
|
|
1177
1283
|
|
|
1178
1284
|
|
|
1285
|
+
// FfiConverter for Map<string, string>
|
|
1286
|
+
const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
|
|
1287
|
+
|
|
1288
|
+
|
|
1179
1289
|
export interface RustChatInterface {
|
|
1180
1290
|
|
|
1181
1291
|
/**
|
|
@@ -1248,10 +1358,12 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
|
|
|
1248
1358
|
/**
|
|
1249
1359
|
* Create a new chat session.
|
|
1250
1360
|
*/
|
|
1251
|
-
constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) {
|
|
1361
|
+
constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) /*throws*/ {
|
|
1252
1362
|
super();
|
|
1253
1363
|
const pointer =
|
|
1254
|
-
|
|
1364
|
+
|
|
1365
|
+
uniffiCaller.rustCallWithError(
|
|
1366
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
1255
1367
|
/*caller:*/ (callStatus) => {
|
|
1256
1368
|
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustchat_new(
|
|
1257
1369
|
FfiConverterTypeRustModel.lower(model),
|
|
@@ -2154,9 +2266,9 @@ export interface RustTokenStreamInterface {
|
|
|
2154
2266
|
*/
|
|
2155
2267
|
completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
|
|
2156
2268
|
/**
|
|
2157
|
-
* Get the next token. Returns None when generation is complete.
|
|
2269
|
+
* Get the next token. Returns None when generation is complete, or an error if generation failed.
|
|
2158
2270
|
*/
|
|
2159
|
-
nextToken(asyncOpts_?: { signal: AbortSignal })
|
|
2271
|
+
nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
|
|
2160
2272
|
}
|
|
2161
2273
|
|
|
2162
2274
|
|
|
@@ -2207,9 +2319,9 @@ async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws
|
|
|
2207
2319
|
}
|
|
2208
2320
|
|
|
2209
2321
|
/**
|
|
2210
|
-
* Get the next token. Returns None when generation is complete.
|
|
2322
|
+
* Get the next token. Returns None when generation is complete, or an error if generation failed.
|
|
2211
2323
|
*/
|
|
2212
|
-
async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> {
|
|
2324
|
+
async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
|
|
2213
2325
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2214
2326
|
try {
|
|
2215
2327
|
return await uniffiRustCallAsync(
|
|
@@ -2227,7 +2339,7 @@ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefin
|
|
|
2227
2339
|
/*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
|
|
2228
2340
|
/*liftString:*/ FfiConverterString.lift,
|
|
2229
2341
|
/*asyncOpts:*/ asyncOpts_,
|
|
2230
|
-
|
|
2342
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
2231
2343
|
);
|
|
2232
2344
|
} catch (__error: any) {
|
|
2233
2345
|
if (uniffiIsDebug && __error instanceof Error) {
|
|
@@ -2544,6 +2656,11 @@ export interface SamplerBuilderInterface {
|
|
|
2544
2656
|
* Apply repetition penalties to discourage repeated tokens.
|
|
2545
2657
|
*/
|
|
2546
2658
|
penalties(penaltyLastN: /*i32*/number, penaltyRepeat: /*f32*/number, penaltyFreq: /*f32*/number, penaltyPresent: /*f32*/number) : SamplerBuilderInterface;
|
|
2659
|
+
/**
|
|
2660
|
+
* Set the RNG seed used by random samplers (`dist`, `mirostat_v1`, `mirostat_v2`, `xtc`).
|
|
2661
|
+
* `greedy` ignores it. If unset, a default seed is used.
|
|
2662
|
+
*/
|
|
2663
|
+
seed(seed: /*u32*/number) : SamplerBuilderInterface;
|
|
2547
2664
|
/**
|
|
2548
2665
|
* Apply temperature scaling to the probability distribution.
|
|
2549
2666
|
*/
|
|
@@ -2715,6 +2832,21 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
|
|
|
2715
2832
|
));
|
|
2716
2833
|
}
|
|
2717
2834
|
|
|
2835
|
+
/**
|
|
2836
|
+
* Set the RNG seed used by random samplers (`dist`, `mirostat_v1`, `mirostat_v2`, `xtc`).
|
|
2837
|
+
* `greedy` ignores it. If unset, a default seed is used.
|
|
2838
|
+
*/
|
|
2839
|
+
seed(seed: /*u32*/number): SamplerBuilderInterface {
|
|
2840
|
+
return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
|
|
2841
|
+
/*caller:*/ (callStatus) => {
|
|
2842
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
|
|
2843
|
+
FfiConverterUInt32.lower(seed),
|
|
2844
|
+
callStatus);
|
|
2845
|
+
},
|
|
2846
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
2847
|
+
));
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2718
2850
|
/**
|
|
2719
2851
|
* Apply temperature scaling to the probability distribution.
|
|
2720
2852
|
*/
|
|
@@ -3018,6 +3150,10 @@ const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
|
|
|
3018
3150
|
const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
|
|
3019
3151
|
|
|
3020
3152
|
|
|
3153
|
+
// FfiConverter for Array<CachedModel>
|
|
3154
|
+
const FfiConverterArrayTypeCachedModel = new FfiConverterArray(FfiConverterTypeCachedModel);
|
|
3155
|
+
|
|
3156
|
+
|
|
3021
3157
|
// FfiConverter for Array<ToolCall>
|
|
3022
3158
|
const FfiConverterArrayTypeToolCall = new FfiConverterArray(FfiConverterTypeToolCall);
|
|
3023
3159
|
|
|
@@ -3034,6 +3170,10 @@ const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
|
|
|
3034
3170
|
const FfiConverterOptionalMapStringBool = new FfiConverterOptional(FfiConverterMapStringBool);
|
|
3035
3171
|
|
|
3036
3172
|
|
|
3173
|
+
// FfiConverter for Map<string, string> | undefined
|
|
3174
|
+
const FfiConverterOptionalMapStringString = new FfiConverterOptional(FfiConverterMapStringString);
|
|
3175
|
+
|
|
3176
|
+
|
|
3037
3177
|
// FfiConverter for SamplerConfigInterface | undefined
|
|
3038
3178
|
const FfiConverterOptionalTypeSamplerConfig = new FfiConverterOptional(FfiConverterTypeSamplerConfig);
|
|
3039
3179
|
|
|
@@ -3078,6 +3218,12 @@ function uniffiEnsureInitialized() {
|
|
|
3078
3218
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity() !== 63439) {
|
|
3079
3219
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_cosine_similarity");
|
|
3080
3220
|
}
|
|
3221
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model() !== 31331) {
|
|
3222
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_download_model");
|
|
3223
|
+
}
|
|
3224
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models() !== 12002) {
|
|
3225
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_get_cached_models");
|
|
3226
|
+
}
|
|
3081
3227
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 33587) {
|
|
3082
3228
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
|
|
3083
3229
|
}
|
|
@@ -3168,7 +3314,7 @@ function uniffiEnsureInitialized() {
|
|
|
3168
3314
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
|
|
3169
3315
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
|
|
3170
3316
|
}
|
|
3171
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token() !==
|
|
3317
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token() !== 59210) {
|
|
3172
3318
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token");
|
|
3173
3319
|
}
|
|
3174
3320
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_get_schema_json() !== 4679) {
|
|
@@ -3204,6 +3350,9 @@ function uniffiEnsureInitialized() {
|
|
|
3204
3350
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties() !== 40767) {
|
|
3205
3351
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties");
|
|
3206
3352
|
}
|
|
3353
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed() !== 25129) {
|
|
3354
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed");
|
|
3355
|
+
}
|
|
3207
3356
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature() !== 8456) {
|
|
3208
3357
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature");
|
|
3209
3358
|
}
|
|
@@ -3222,7 +3371,7 @@ function uniffiEnsureInitialized() {
|
|
|
3222
3371
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json() !== 51798) {
|
|
3223
3372
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json");
|
|
3224
3373
|
}
|
|
3225
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !==
|
|
3374
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 24505) {
|
|
3226
3375
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new");
|
|
3227
3376
|
}
|
|
3228
3377
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new() !== 9022) {
|
|
@@ -3258,6 +3407,7 @@ export default Object.freeze({
|
|
|
3258
3407
|
initialize: uniffiEnsureInitialized,
|
|
3259
3408
|
converters: {
|
|
3260
3409
|
FfiConverterTypeAsset,
|
|
3410
|
+
FfiConverterTypeCachedModel,
|
|
3261
3411
|
FfiConverterTypeMessage,
|
|
3262
3412
|
FfiConverterTypeNobodyWhoError,
|
|
3263
3413
|
FfiConverterTypePendingToolCall,
|
package/package.json
CHANGED
package/src/wrapper.ts
CHANGED
|
@@ -5,11 +5,39 @@
|
|
|
5
5
|
* - Wrapper classes: Model, Chat, Encoder, CrossEncoder, Tool, TokenStream, Prompt
|
|
6
6
|
* - Direct re-exports: SamplerBuilder, SamplerConfig
|
|
7
7
|
* - Types: Message, Asset, ToolCall
|
|
8
|
-
* - Utilities: SamplerPresets, cosineSimilarity
|
|
8
|
+
* - Utilities: SamplerPresets, cosineSimilarity, downloadModel
|
|
9
9
|
*
|
|
10
10
|
* This file is NOT generated — it is safe to edit.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { downloadModel as _downloadModel } from "../generated/ts/nobodywho";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Download a GGUF model from a remote URL or HuggingFace path and return the local file path.
|
|
17
|
+
*
|
|
18
|
+
* Use this when you need custom HTTP headers, e.g. for gated models that require
|
|
19
|
+
* authentication. For unauthenticated downloads, pass the URL directly to `Model.load`.
|
|
20
|
+
*
|
|
21
|
+
* @param opts.modelPath - Path or URL to a GGUF model file (`hf://owner/repo/file.gguf`, `https://`, or a local path)
|
|
22
|
+
* @param opts.headers - Optional HTTP headers (e.g. `{ Authorization: "Bearer hf_..." }`)
|
|
23
|
+
* @param opts.onDownloadProgress - Optional callback receiving `(downloadedBytes, totalBytes)` during download
|
|
24
|
+
* @returns The local filesystem path where the model was cached
|
|
25
|
+
*/
|
|
26
|
+
export async function downloadModel(opts: {
|
|
27
|
+
modelPath: string;
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
onDownloadProgress?: (downloaded: number, total: number) => void;
|
|
30
|
+
}): Promise<string> {
|
|
31
|
+
const headersMap = opts.headers
|
|
32
|
+
? new Map(Object.entries(opts.headers))
|
|
33
|
+
: undefined;
|
|
34
|
+
const cb = opts.onDownloadProgress;
|
|
35
|
+
const progressCallback = cb
|
|
36
|
+
? { onDownloadProgress: (d: bigint, t: bigint) => cb(Number(d), Number(t)) }
|
|
37
|
+
: undefined;
|
|
38
|
+
return _downloadModel(opts.modelPath, headersMap, progressCallback);
|
|
39
|
+
}
|
|
40
|
+
|
|
13
41
|
// Wrapper classes
|
|
14
42
|
export { Model } from "./model";
|
|
15
43
|
export { Chat } from "./chat";
|
|
@@ -23,15 +51,20 @@ export { TokenStream } from "./streaming";
|
|
|
23
51
|
export type { Message } from "./message";
|
|
24
52
|
|
|
25
53
|
// Re-export types that don't need wrapping.
|
|
54
|
+
//
|
|
55
|
+
// Note: `getCachedModels` returns `size` as `bigint` (Rust `u64`). Wrap with
|
|
56
|
+
// `Number(m.size)` at the call site if a JS number is needed.
|
|
26
57
|
export {
|
|
27
58
|
SamplerBuilder,
|
|
28
59
|
SamplerConfig,
|
|
29
60
|
cosineSimilarity,
|
|
61
|
+
getCachedModels,
|
|
30
62
|
} from "./index";
|
|
31
63
|
|
|
32
64
|
export type {
|
|
33
65
|
Asset,
|
|
34
66
|
ToolCall,
|
|
67
|
+
CachedModel,
|
|
35
68
|
} from "./index";
|
|
36
69
|
|
|
37
70
|
// Ergonomic wrapper additions.
|