react-native-nobodywho 2.0.1 → 2.2.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 +214 -0
- package/generated/cpp/nobodywho.hpp +30 -0
- package/generated/ts/nobodywho-ffi.ts +8 -0
- package/generated/ts/nobodywho.ts +105 -16
- package/package.json +1 -1
- package/src/sampler_presets.ts +28 -2
|
@@ -268,9 +268,20 @@ void uniffi_nobodywho_uniffi_fn_init_callback_vtable_rusttoolcallback(
|
|
|
268
268
|
UniffiVTableCallbackInterfaceRustToolCallback *vtable);
|
|
269
269
|
float uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
270
270
|
RustBuffer a, RustBuffer b, RustCallStatus *uniffi_out_err);
|
|
271
|
+
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
272
|
+
RustBuffer model_path, RustBuffer headers, RustBuffer on_download_progress);
|
|
271
273
|
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
272
274
|
RustBuffer model_path, int8_t use_gpu, RustBuffer projection_model_path,
|
|
273
275
|
RustBuffer on_download_progress);
|
|
276
|
+
/*handle*/ uint64_t
|
|
277
|
+
uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(
|
|
278
|
+
RustBuffer grammar, RustCallStatus *uniffi_out_err);
|
|
279
|
+
/*handle*/ uint64_t
|
|
280
|
+
uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(
|
|
281
|
+
RustBuffer schema, RustCallStatus *uniffi_out_err);
|
|
282
|
+
/*handle*/ uint64_t
|
|
283
|
+
uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(
|
|
284
|
+
RustBuffer pattern, RustCallStatus *uniffi_out_err);
|
|
274
285
|
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_sampler_preset_default(
|
|
275
286
|
RustCallStatus *uniffi_out_err);
|
|
276
287
|
/*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_sampler_preset_dry(
|
|
@@ -407,7 +418,14 @@ void ffi_nobodywho_uniffi_rust_future_free_void(
|
|
|
407
418
|
void ffi_nobodywho_uniffi_rust_future_complete_void(
|
|
408
419
|
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
409
420
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_cosine_similarity();
|
|
421
|
+
uint16_t uniffi_nobodywho_uniffi_checksum_func_download_model();
|
|
410
422
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_load_model();
|
|
423
|
+
uint16_t
|
|
424
|
+
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar();
|
|
425
|
+
uint16_t
|
|
426
|
+
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema();
|
|
427
|
+
uint16_t
|
|
428
|
+
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex();
|
|
411
429
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default();
|
|
412
430
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_sampler_preset_dry();
|
|
413
431
|
uint16_t uniffi_nobodywho_uniffi_checksum_func_sampler_preset_grammar();
|
|
@@ -3357,6 +3375,17 @@ NativeNobodywho::NativeNobodywho(
|
|
|
3357
3375
|
return this->cpp_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
3358
3376
|
rt, thisVal, args, count);
|
|
3359
3377
|
});
|
|
3378
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_func_download_model"] =
|
|
3379
|
+
jsi::Function::createFromHostFunction(
|
|
3380
|
+
rt,
|
|
3381
|
+
jsi::PropNameID::forAscii(
|
|
3382
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_fn_func_download_model"),
|
|
3383
|
+
3,
|
|
3384
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3385
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3386
|
+
return this->cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
3387
|
+
rt, thisVal, args, count);
|
|
3388
|
+
});
|
|
3360
3389
|
props["ubrn_uniffi_nobodywho_uniffi_fn_func_load_model"] =
|
|
3361
3390
|
jsi::Function::createFromHostFunction(
|
|
3362
3391
|
rt,
|
|
@@ -3368,6 +3397,43 @@ NativeNobodywho::NativeNobodywho(
|
|
|
3368
3397
|
return this->cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
3369
3398
|
rt, thisVal, args, count);
|
|
3370
3399
|
});
|
|
3400
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_"
|
|
3401
|
+
"grammar"] = jsi::Function::createFromHostFunction(
|
|
3402
|
+
rt,
|
|
3403
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_nobodywho_uniffi_fn_func_"
|
|
3404
|
+
"sampler_preset_constrain_with_grammar"),
|
|
3405
|
+
1,
|
|
3406
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3407
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3408
|
+
return this
|
|
3409
|
+
->cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(
|
|
3410
|
+
rt, thisVal, args, count);
|
|
3411
|
+
});
|
|
3412
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_"
|
|
3413
|
+
"json_schema"] = jsi::Function::createFromHostFunction(
|
|
3414
|
+
rt,
|
|
3415
|
+
jsi::PropNameID::forAscii(rt,
|
|
3416
|
+
"ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_"
|
|
3417
|
+
"preset_constrain_with_json_schema"),
|
|
3418
|
+
1,
|
|
3419
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3420
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3421
|
+
return this
|
|
3422
|
+
->cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(
|
|
3423
|
+
rt, thisVal, args, count);
|
|
3424
|
+
});
|
|
3425
|
+
props["ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_"
|
|
3426
|
+
"regex"] = jsi::Function::createFromHostFunction(
|
|
3427
|
+
rt,
|
|
3428
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_nobodywho_uniffi_fn_func_"
|
|
3429
|
+
"sampler_preset_constrain_with_regex"),
|
|
3430
|
+
1,
|
|
3431
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
3432
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
3433
|
+
return this
|
|
3434
|
+
->cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(
|
|
3435
|
+
rt, thisVal, args, count);
|
|
3436
|
+
});
|
|
3371
3437
|
props["ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_default"] =
|
|
3372
3438
|
jsi::Function::createFromHostFunction(
|
|
3373
3439
|
rt,
|
|
@@ -4008,6 +4074,18 @@ NativeNobodywho::NativeNobodywho(
|
|
|
4008
4074
|
->cpp_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(
|
|
4009
4075
|
rt, thisVal, args, count);
|
|
4010
4076
|
});
|
|
4077
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model"] =
|
|
4078
|
+
jsi::Function::createFromHostFunction(
|
|
4079
|
+
rt,
|
|
4080
|
+
jsi::PropNameID::forAscii(
|
|
4081
|
+
rt, "ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model"),
|
|
4082
|
+
0,
|
|
4083
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4084
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4085
|
+
return this
|
|
4086
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
|
|
4087
|
+
rt, thisVal, args, count);
|
|
4088
|
+
});
|
|
4011
4089
|
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model"] =
|
|
4012
4090
|
jsi::Function::createFromHostFunction(
|
|
4013
4091
|
rt,
|
|
@@ -4019,6 +4097,44 @@ NativeNobodywho::NativeNobodywho(
|
|
|
4019
4097
|
return this->cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
|
|
4020
4098
|
rt, thisVal, args, count);
|
|
4021
4099
|
});
|
|
4100
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_"
|
|
4101
|
+
"with_grammar"] = jsi::Function::createFromHostFunction(
|
|
4102
|
+
rt,
|
|
4103
|
+
jsi::PropNameID::forAscii(rt,
|
|
4104
|
+
"ubrn_uniffi_nobodywho_uniffi_checksum_func_"
|
|
4105
|
+
"sampler_preset_constrain_with_grammar"),
|
|
4106
|
+
0,
|
|
4107
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4108
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4109
|
+
return this
|
|
4110
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar(
|
|
4111
|
+
rt, thisVal, args, count);
|
|
4112
|
+
});
|
|
4113
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_"
|
|
4114
|
+
"with_json_schema"] = jsi::Function::createFromHostFunction(
|
|
4115
|
+
rt,
|
|
4116
|
+
jsi::PropNameID::forAscii(rt,
|
|
4117
|
+
"ubrn_uniffi_nobodywho_uniffi_checksum_func_"
|
|
4118
|
+
"sampler_preset_constrain_with_json_schema"),
|
|
4119
|
+
0,
|
|
4120
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4121
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4122
|
+
return this
|
|
4123
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema(
|
|
4124
|
+
rt, thisVal, args, count);
|
|
4125
|
+
});
|
|
4126
|
+
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_"
|
|
4127
|
+
"with_regex"] = jsi::Function::createFromHostFunction(
|
|
4128
|
+
rt,
|
|
4129
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_nobodywho_uniffi_checksum_"
|
|
4130
|
+
"func_sampler_preset_constrain_with_regex"),
|
|
4131
|
+
0,
|
|
4132
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
4133
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
4134
|
+
return this
|
|
4135
|
+
->cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex(
|
|
4136
|
+
rt, thisVal, args, count);
|
|
4137
|
+
});
|
|
4022
4138
|
props["ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default"] =
|
|
4023
4139
|
jsi::Function::createFromHostFunction(
|
|
4024
4140
|
rt,
|
|
@@ -5907,6 +6023,18 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
|
5907
6023
|
|
|
5908
6024
|
return uniffi_jsi::Bridging<float>::toJs(rt, callInvoker, value);
|
|
5909
6025
|
}
|
|
6026
|
+
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
6027
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6028
|
+
size_t count) {
|
|
6029
|
+
auto value = uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
6030
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
|
|
6031
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
|
|
6032
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
6033
|
+
args[2]));
|
|
6034
|
+
|
|
6035
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6036
|
+
value);
|
|
6037
|
+
}
|
|
5910
6038
|
jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
5911
6039
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
5912
6040
|
size_t count) {
|
|
@@ -5920,6 +6048,57 @@ jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
|
5920
6048
|
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
5921
6049
|
value);
|
|
5922
6050
|
}
|
|
6051
|
+
jsi::Value NativeNobodywho::
|
|
6052
|
+
cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(
|
|
6053
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6054
|
+
size_t count) {
|
|
6055
|
+
RustCallStatus status =
|
|
6056
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6057
|
+
auto value =
|
|
6058
|
+
uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(
|
|
6059
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
6060
|
+
args[0]),
|
|
6061
|
+
&status);
|
|
6062
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6063
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6064
|
+
|
|
6065
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6066
|
+
value);
|
|
6067
|
+
}
|
|
6068
|
+
jsi::Value NativeNobodywho::
|
|
6069
|
+
cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(
|
|
6070
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6071
|
+
size_t count) {
|
|
6072
|
+
RustCallStatus status =
|
|
6073
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6074
|
+
auto value =
|
|
6075
|
+
uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(
|
|
6076
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
6077
|
+
args[0]),
|
|
6078
|
+
&status);
|
|
6079
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6080
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6081
|
+
|
|
6082
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6083
|
+
value);
|
|
6084
|
+
}
|
|
6085
|
+
jsi::Value NativeNobodywho::
|
|
6086
|
+
cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(
|
|
6087
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6088
|
+
size_t count) {
|
|
6089
|
+
RustCallStatus status =
|
|
6090
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
6091
|
+
auto value =
|
|
6092
|
+
uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(
|
|
6093
|
+
uniffi::nobodywho::Bridging<RustBuffer>::fromJs(rt, callInvoker,
|
|
6094
|
+
args[0]),
|
|
6095
|
+
&status);
|
|
6096
|
+
uniffi::nobodywho::Bridging<RustCallStatus>::copyIntoJs(
|
|
6097
|
+
rt, callInvoker, status, args[count - 1]);
|
|
6098
|
+
|
|
6099
|
+
return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
|
|
6100
|
+
value);
|
|
6101
|
+
}
|
|
5923
6102
|
jsi::Value
|
|
5924
6103
|
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_default(
|
|
5925
6104
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -6582,6 +6761,14 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(
|
|
|
6582
6761
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6583
6762
|
}
|
|
6584
6763
|
jsi::Value
|
|
6764
|
+
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
|
|
6765
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6766
|
+
size_t count) {
|
|
6767
|
+
auto value = uniffi_nobodywho_uniffi_checksum_func_download_model();
|
|
6768
|
+
|
|
6769
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6770
|
+
}
|
|
6771
|
+
jsi::Value
|
|
6585
6772
|
NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
|
|
6586
6773
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6587
6774
|
size_t count) {
|
|
@@ -6589,6 +6776,33 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
|
|
|
6589
6776
|
|
|
6590
6777
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6591
6778
|
}
|
|
6779
|
+
jsi::Value NativeNobodywho::
|
|
6780
|
+
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar(
|
|
6781
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6782
|
+
size_t count) {
|
|
6783
|
+
auto value =
|
|
6784
|
+
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar();
|
|
6785
|
+
|
|
6786
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6787
|
+
}
|
|
6788
|
+
jsi::Value NativeNobodywho::
|
|
6789
|
+
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema(
|
|
6790
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6791
|
+
size_t count) {
|
|
6792
|
+
auto value =
|
|
6793
|
+
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema();
|
|
6794
|
+
|
|
6795
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6796
|
+
}
|
|
6797
|
+
jsi::Value NativeNobodywho::
|
|
6798
|
+
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex(
|
|
6799
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
6800
|
+
size_t count) {
|
|
6801
|
+
auto value =
|
|
6802
|
+
uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex();
|
|
6803
|
+
|
|
6804
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
6805
|
+
}
|
|
6592
6806
|
jsi::Value NativeNobodywho::
|
|
6593
6807
|
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default(
|
|
6594
6808
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
@@ -221,9 +221,24 @@ protected:
|
|
|
221
221
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
|
|
222
222
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
223
223
|
size_t count);
|
|
224
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
|
|
225
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
226
|
+
size_t count);
|
|
224
227
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
|
|
225
228
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
226
229
|
size_t count);
|
|
230
|
+
jsi::Value
|
|
231
|
+
cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(
|
|
232
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
233
|
+
size_t count);
|
|
234
|
+
jsi::Value
|
|
235
|
+
cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(
|
|
236
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
237
|
+
size_t count);
|
|
238
|
+
jsi::Value
|
|
239
|
+
cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(
|
|
240
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
241
|
+
size_t count);
|
|
227
242
|
jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_sampler_preset_default(
|
|
228
243
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
229
244
|
size_t count);
|
|
@@ -395,9 +410,24 @@ protected:
|
|
|
395
410
|
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(
|
|
396
411
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
397
412
|
size_t count);
|
|
413
|
+
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
|
|
414
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
415
|
+
size_t count);
|
|
398
416
|
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
|
|
399
417
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
400
418
|
size_t count);
|
|
419
|
+
jsi::Value
|
|
420
|
+
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar(
|
|
421
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
422
|
+
size_t count);
|
|
423
|
+
jsi::Value
|
|
424
|
+
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema(
|
|
425
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
426
|
+
size_t count);
|
|
427
|
+
jsi::Value
|
|
428
|
+
cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex(
|
|
429
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
430
|
+
size_t count);
|
|
401
431
|
jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default(
|
|
402
432
|
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
403
433
|
size_t count);
|
|
@@ -80,7 +80,11 @@ interface NativeModuleInterface {
|
|
|
80
80
|
ubrn_uniffi_nobodywho_uniffi_fn_init_callback_vtable_rustdownloadprogresscallback(vtable: UniffiVTableCallbackInterfaceRustDownloadProgressCallback): void;
|
|
81
81
|
ubrn_uniffi_nobodywho_uniffi_fn_init_callback_vtable_rusttoolcallback(vtable: UniffiVTableCallbackInterfaceRustToolCallback): void;
|
|
82
82
|
ubrn_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(a: Uint8Array, b: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
|
|
83
|
+
ubrn_uniffi_nobodywho_uniffi_fn_func_download_model(modelPath: Uint8Array, headers: Uint8Array, onDownloadProgress: Uint8Array): bigint;
|
|
83
84
|
ubrn_uniffi_nobodywho_uniffi_fn_func_load_model(modelPath: Uint8Array, useGpu: number, projectionModelPath: Uint8Array, onDownloadProgress: Uint8Array): bigint;
|
|
85
|
+
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(grammar: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
86
|
+
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(schema: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
87
|
+
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(pattern: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
84
88
|
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_default(uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
85
89
|
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_dry(uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
86
90
|
ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_grammar(grammar: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
@@ -138,7 +142,11 @@ interface NativeModuleInterface {
|
|
|
138
142
|
ubrn_ffi_nobodywho_uniffi_rust_future_free_void(handle: bigint): void;
|
|
139
143
|
ubrn_ffi_nobodywho_uniffi_rust_future_complete_void(handle: bigint, uniffi_out_err: UniffiRustCallStatus): void;
|
|
140
144
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(): number;
|
|
145
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model(): number;
|
|
141
146
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model(): number;
|
|
147
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar(): number;
|
|
148
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema(): number;
|
|
149
|
+
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex(): number;
|
|
142
150
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default(): number;
|
|
143
151
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_dry(): number;
|
|
144
152
|
ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_grammar(): number;
|
|
@@ -95,6 +95,37 @@ 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
|
+
}
|
|
98
129
|
/**
|
|
99
130
|
* Load a GGUF model from a local path or remote URL.
|
|
100
131
|
*
|
|
@@ -130,6 +161,45 @@ export async function loadModel(modelPath: string, useGpu: boolean, projectionMo
|
|
|
130
161
|
throw __error;
|
|
131
162
|
}
|
|
132
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Create a sampler that constrains output using a Lark grammar via llguidance.
|
|
166
|
+
*/
|
|
167
|
+
export function samplerPresetConstrainWithGrammar(grammar: string): SamplerConfigInterface {
|
|
168
|
+
return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
|
|
169
|
+
/*caller:*/ (callStatus) => {
|
|
170
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(
|
|
171
|
+
FfiConverterString.lower(grammar),
|
|
172
|
+
callStatus);
|
|
173
|
+
},
|
|
174
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
175
|
+
));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Create a sampler that constrains output to a JSON schema via llguidance.
|
|
179
|
+
*/
|
|
180
|
+
export function samplerPresetConstrainWithJsonSchema(schema: string): SamplerConfigInterface {
|
|
181
|
+
return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
|
|
182
|
+
/*caller:*/ (callStatus) => {
|
|
183
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(
|
|
184
|
+
FfiConverterString.lower(schema),
|
|
185
|
+
callStatus);
|
|
186
|
+
},
|
|
187
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
188
|
+
));
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Create a sampler that constrains output to a regular expression via llguidance.
|
|
192
|
+
*/
|
|
193
|
+
export function samplerPresetConstrainWithRegex(pattern: string): SamplerConfigInterface {
|
|
194
|
+
return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
|
|
195
|
+
/*caller:*/ (callStatus) => {
|
|
196
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_regex(
|
|
197
|
+
FfiConverterString.lower(pattern),
|
|
198
|
+
callStatus);
|
|
199
|
+
},
|
|
200
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
201
|
+
));
|
|
202
|
+
}
|
|
133
203
|
/**
|
|
134
204
|
* Get the default sampler configuration.
|
|
135
205
|
*/
|
|
@@ -179,9 +249,6 @@ export function samplerPresetGreedy(): SamplerConfigInterface {
|
|
|
179
249
|
/*liftString:*/ FfiConverterString.lift,
|
|
180
250
|
));
|
|
181
251
|
}
|
|
182
|
-
/**
|
|
183
|
-
* Create a sampler configured for JSON output generation.
|
|
184
|
-
*/
|
|
185
252
|
export function samplerPresetJson(): SamplerConfigInterface {
|
|
186
253
|
return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
|
|
187
254
|
/*caller:*/ (callStatus) => {
|
|
@@ -1140,6 +1207,10 @@ const FfiConverterTypePromptPart = (() => {
|
|
|
1140
1207
|
const FfiConverterMapStringBool = new FfiConverterMap(FfiConverterString, FfiConverterBool);
|
|
1141
1208
|
|
|
1142
1209
|
|
|
1210
|
+
// FfiConverter for Map<string, string>
|
|
1211
|
+
const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
|
|
1212
|
+
|
|
1213
|
+
|
|
1143
1214
|
export interface RustChatInterface {
|
|
1144
1215
|
|
|
1145
1216
|
/**
|
|
@@ -1212,10 +1283,12 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
|
|
|
1212
1283
|
/**
|
|
1213
1284
|
* Create a new chat session.
|
|
1214
1285
|
*/
|
|
1215
|
-
constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) {
|
|
1286
|
+
constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) /*throws*/ {
|
|
1216
1287
|
super();
|
|
1217
1288
|
const pointer =
|
|
1218
|
-
|
|
1289
|
+
|
|
1290
|
+
uniffiCaller.rustCallWithError(
|
|
1291
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
1219
1292
|
/*caller:*/ (callStatus) => {
|
|
1220
1293
|
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustchat_new(
|
|
1221
1294
|
FfiConverterTypeRustModel.lower(model),
|
|
@@ -2118,9 +2191,9 @@ export interface RustTokenStreamInterface {
|
|
|
2118
2191
|
*/
|
|
2119
2192
|
completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
|
|
2120
2193
|
/**
|
|
2121
|
-
* Get the next token. Returns None when generation is complete.
|
|
2194
|
+
* Get the next token. Returns None when generation is complete, or an error if generation failed.
|
|
2122
2195
|
*/
|
|
2123
|
-
nextToken(asyncOpts_?: { signal: AbortSignal })
|
|
2196
|
+
nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
|
|
2124
2197
|
}
|
|
2125
2198
|
|
|
2126
2199
|
|
|
@@ -2171,9 +2244,9 @@ async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws
|
|
|
2171
2244
|
}
|
|
2172
2245
|
|
|
2173
2246
|
/**
|
|
2174
|
-
* Get the next token. Returns None when generation is complete.
|
|
2247
|
+
* Get the next token. Returns None when generation is complete, or an error if generation failed.
|
|
2175
2248
|
*/
|
|
2176
|
-
async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> {
|
|
2249
|
+
async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
|
|
2177
2250
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2178
2251
|
try {
|
|
2179
2252
|
return await uniffiRustCallAsync(
|
|
@@ -2191,7 +2264,7 @@ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefin
|
|
|
2191
2264
|
/*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
|
|
2192
2265
|
/*liftString:*/ FfiConverterString.lift,
|
|
2193
2266
|
/*asyncOpts:*/ asyncOpts_,
|
|
2194
|
-
|
|
2267
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
2195
2268
|
);
|
|
2196
2269
|
} catch (__error: any) {
|
|
2197
2270
|
if (uniffiIsDebug && __error instanceof Error) {
|
|
@@ -2485,7 +2558,7 @@ export interface SamplerBuilderInterface {
|
|
|
2485
2558
|
*/
|
|
2486
2559
|
dry(multiplier: /*f32*/number, base: /*f32*/number, allowedLength: /*i32*/number, penaltyLastN: /*i32*/number, seqBreakers: Array<string>) : SamplerBuilderInterface;
|
|
2487
2560
|
/**
|
|
2488
|
-
*
|
|
2561
|
+
* Deprecated: Use `sampler_preset_constrain_with_grammar()` instead. It accepts both Lark and GBNF strings.
|
|
2489
2562
|
*/
|
|
2490
2563
|
grammar(grammar: string, triggerOn: string | undefined, root: string) : SamplerBuilderInterface;
|
|
2491
2564
|
/**
|
|
@@ -2588,7 +2661,7 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
|
|
|
2588
2661
|
}
|
|
2589
2662
|
|
|
2590
2663
|
/**
|
|
2591
|
-
*
|
|
2664
|
+
* Deprecated: Use `sampler_preset_constrain_with_grammar()` instead. It accepts both Lark and GBNF strings.
|
|
2592
2665
|
*/
|
|
2593
2666
|
grammar(grammar: string, triggerOn: string | undefined, root: string): SamplerBuilderInterface {
|
|
2594
2667
|
return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
|
|
@@ -2998,6 +3071,10 @@ const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
|
|
|
2998
3071
|
const FfiConverterOptionalMapStringBool = new FfiConverterOptional(FfiConverterMapStringBool);
|
|
2999
3072
|
|
|
3000
3073
|
|
|
3074
|
+
// FfiConverter for Map<string, string> | undefined
|
|
3075
|
+
const FfiConverterOptionalMapStringString = new FfiConverterOptional(FfiConverterMapStringString);
|
|
3076
|
+
|
|
3077
|
+
|
|
3001
3078
|
// FfiConverter for SamplerConfigInterface | undefined
|
|
3002
3079
|
const FfiConverterOptionalTypeSamplerConfig = new FfiConverterOptional(FfiConverterTypeSamplerConfig);
|
|
3003
3080
|
|
|
@@ -3042,9 +3119,21 @@ function uniffiEnsureInitialized() {
|
|
|
3042
3119
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity() !== 63439) {
|
|
3043
3120
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_cosine_similarity");
|
|
3044
3121
|
}
|
|
3122
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model() !== 31331) {
|
|
3123
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_download_model");
|
|
3124
|
+
}
|
|
3045
3125
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 33587) {
|
|
3046
3126
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
|
|
3047
3127
|
}
|
|
3128
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar() !== 13698) {
|
|
3129
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar");
|
|
3130
|
+
}
|
|
3131
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema() !== 4691) {
|
|
3132
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema");
|
|
3133
|
+
}
|
|
3134
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex() !== 25543) {
|
|
3135
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_regex");
|
|
3136
|
+
}
|
|
3048
3137
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default() !== 10834) {
|
|
3049
3138
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default");
|
|
3050
3139
|
}
|
|
@@ -3057,7 +3146,7 @@ function uniffiEnsureInitialized() {
|
|
|
3057
3146
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_greedy() !== 13219) {
|
|
3058
3147
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_greedy");
|
|
3059
3148
|
}
|
|
3060
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_json() !==
|
|
3149
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_json() !== 8103) {
|
|
3061
3150
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_json");
|
|
3062
3151
|
}
|
|
3063
3152
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_temperature() !== 64803) {
|
|
@@ -3123,7 +3212,7 @@ function uniffiEnsureInitialized() {
|
|
|
3123
3212
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
|
|
3124
3213
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
|
|
3125
3214
|
}
|
|
3126
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token() !==
|
|
3215
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token() !== 59210) {
|
|
3127
3216
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token");
|
|
3128
3217
|
}
|
|
3129
3218
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_get_schema_json() !== 4679) {
|
|
@@ -3141,7 +3230,7 @@ function uniffiEnsureInitialized() {
|
|
|
3141
3230
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dry() !== 35315) {
|
|
3142
3231
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dry");
|
|
3143
3232
|
}
|
|
3144
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar() !==
|
|
3233
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar() !== 3547) {
|
|
3145
3234
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar");
|
|
3146
3235
|
}
|
|
3147
3236
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_greedy() !== 32898) {
|
|
@@ -3177,7 +3266,7 @@ function uniffiEnsureInitialized() {
|
|
|
3177
3266
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json() !== 51798) {
|
|
3178
3267
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json");
|
|
3179
3268
|
}
|
|
3180
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !==
|
|
3269
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 24505) {
|
|
3181
3270
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new");
|
|
3182
3271
|
}
|
|
3183
3272
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new() !== 9022) {
|
package/package.json
CHANGED
package/src/sampler_presets.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type SamplerConfig,
|
|
3
|
+
samplerPresetConstrainWithGrammar,
|
|
4
|
+
samplerPresetConstrainWithJsonSchema,
|
|
5
|
+
samplerPresetConstrainWithRegex,
|
|
3
6
|
samplerPresetDefault,
|
|
4
7
|
samplerPresetDry,
|
|
5
8
|
samplerPresetGrammar,
|
|
@@ -52,12 +55,35 @@ export class SamplerPresets {
|
|
|
52
55
|
return samplerPresetDry() as SamplerConfig;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
/** Create a sampler configured for JSON output generation. */
|
|
58
|
+
/** Create a sampler configured for JSON output generation (any valid JSON, GBNF-based). */
|
|
56
59
|
static json(): SamplerConfig {
|
|
57
60
|
return samplerPresetJson() as SamplerConfig;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
/**
|
|
63
|
+
/** Constrain output to a JSON schema via llguidance. Accepts a schema object or a JSON string. */
|
|
64
|
+
static constrainWithJsonSchema(schema: object | string): SamplerConfig {
|
|
65
|
+
const schemaStr = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
66
|
+
return samplerPresetConstrainWithJsonSchema(schemaStr) as SamplerConfig;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Constrain output to a regular expression via llguidance. Accepts a RegExp or a pattern string. */
|
|
70
|
+
static constrainWithRegex(pattern: RegExp | string): SamplerConfig {
|
|
71
|
+
const patternStr = pattern instanceof RegExp ? pattern.source : pattern;
|
|
72
|
+
return samplerPresetConstrainWithRegex(patternStr) as SamplerConfig;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Constrain output using a grammar via llguidance.
|
|
77
|
+
* Accepts both Lark syntax (`start: "yes" | "no"`) and GBNF (`root ::= "yes" | "no"`).
|
|
78
|
+
* GBNF is automatically converted to Lark before use.
|
|
79
|
+
*/
|
|
80
|
+
static constrainWithGrammar(grammar: string): SamplerConfig {
|
|
81
|
+
return samplerPresetConstrainWithGrammar(grammar) as SamplerConfig;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use {@link constrainWithGrammar} instead. It accepts both Lark and GBNF strings.
|
|
86
|
+
*/
|
|
61
87
|
static grammar(grammar: string): SamplerConfig {
|
|
62
88
|
return samplerPresetGrammar(grammar) as SamplerConfig;
|
|
63
89
|
}
|