react-native-nobodywho 2.2.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.
@@ -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);
@@ -270,6 +272,8 @@ float uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
270
272
  RustBuffer a, RustBuffer b, RustCallStatus *uniffi_out_err);
271
273
  /*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_download_model(
272
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);
273
277
  /*handle*/ uint64_t uniffi_nobodywho_uniffi_fn_func_load_model(
274
278
  RustBuffer model_path, int8_t use_gpu, RustBuffer projection_model_path,
275
279
  RustBuffer on_download_progress);
@@ -419,6 +423,7 @@ void ffi_nobodywho_uniffi_rust_future_complete_void(
419
423
  /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
420
424
  uint16_t uniffi_nobodywho_uniffi_checksum_func_cosine_similarity();
421
425
  uint16_t uniffi_nobodywho_uniffi_checksum_func_download_model();
426
+ uint16_t uniffi_nobodywho_uniffi_checksum_func_get_cached_models();
422
427
  uint16_t uniffi_nobodywho_uniffi_checksum_func_load_model();
423
428
  uint16_t
424
429
  uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar();
@@ -469,6 +474,7 @@ uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_min_p();
469
474
  uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v1();
470
475
  uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v2();
471
476
  uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties();
477
+ uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed();
472
478
  uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature();
473
479
  uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k();
474
480
  uint16_t uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p();
@@ -3230,6 +3236,18 @@ NativeNobodywho::NativeNobodywho(
3230
3236
  ->cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(
3231
3237
  rt, thisVal, args, count);
3232
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
+ });
3233
3251
  props["ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature"] =
3234
3252
  jsi::Function::createFromHostFunction(
3235
3253
  rt,
@@ -3386,6 +3404,17 @@ NativeNobodywho::NativeNobodywho(
3386
3404
  return this->cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
3387
3405
  rt, thisVal, args, count);
3388
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
+ });
3389
3418
  props["ubrn_uniffi_nobodywho_uniffi_fn_func_load_model"] =
3390
3419
  jsi::Function::createFromHostFunction(
3391
3420
  rt,
@@ -4086,6 +4115,19 @@ NativeNobodywho::NativeNobodywho(
4086
4115
  ->cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
4087
4116
  rt, thisVal, args, count);
4088
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
+ });
4089
4131
  props["ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model"] =
4090
4132
  jsi::Function::createFromHostFunction(
4091
4133
  rt,
@@ -4594,6 +4636,18 @@ NativeNobodywho::NativeNobodywho(
4594
4636
  ->cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties(
4595
4637
  rt, thisVal, args, count);
4596
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
+ });
4597
4651
  props["ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_"
4598
4652
  "temperature"] = jsi::Function::createFromHostFunction(
4599
4653
  rt,
@@ -5833,6 +5887,23 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(
5833
5887
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
5834
5888
  value);
5835
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
+ }
5836
5907
  jsi::Value NativeNobodywho::
5837
5908
  cpp_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature(
5838
5909
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -6035,6 +6106,18 @@ jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
6035
6106
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
6036
6107
  value);
6037
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
+ }
6038
6121
  jsi::Value NativeNobodywho::cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
6039
6122
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
6040
6123
  size_t count) {
@@ -6769,6 +6852,14 @@ NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
6769
6852
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
6770
6853
  }
6771
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
6772
6863
  NativeNobodywho::cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
6773
6864
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
6774
6865
  size_t count) {
@@ -7127,6 +7218,14 @@ jsi::Value NativeNobodywho::
7127
7218
 
7128
7219
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
7129
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
+ }
7130
7229
  jsi::Value NativeNobodywho::
7131
7230
  cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature(
7132
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);
@@ -224,6 +227,9 @@ protected:
224
227
  jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_download_model(
225
228
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
226
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);
227
233
  jsi::Value cpp_uniffi_nobodywho_uniffi_fn_func_load_model(
228
234
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
229
235
  size_t count);
@@ -413,6 +419,9 @@ protected:
413
419
  jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_download_model(
414
420
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
415
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);
416
425
  jsi::Value cpp_uniffi_nobodywho_uniffi_checksum_func_load_model(
417
426
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
418
427
  size_t count);
@@ -562,6 +571,9 @@ protected:
562
571
  cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties(
563
572
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
564
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);
565
577
  jsi::Value
566
578
  cpp_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature(
567
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;
@@ -81,6 +82,7 @@ interface NativeModuleInterface {
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;
83
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;
84
86
  ubrn_uniffi_nobodywho_uniffi_fn_func_load_model(modelPath: Uint8Array, useGpu: number, projectionModelPath: Uint8Array, onDownloadProgress: Uint8Array): bigint;
85
87
  ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_grammar(grammar: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
86
88
  ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_constrain_with_json_schema(schema: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
@@ -143,6 +145,7 @@ interface NativeModuleInterface {
143
145
  ubrn_ffi_nobodywho_uniffi_rust_future_complete_void(handle: bigint, uniffi_out_err: UniffiRustCallStatus): void;
144
146
  ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity(): number;
145
147
  ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model(): number;
148
+ ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models(): number;
146
149
  ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model(): number;
147
150
  ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar(): number;
148
151
  ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_json_schema(): number;
@@ -185,6 +188,7 @@ interface NativeModuleInterface {
185
188
  ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v1(): number;
186
189
  ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v2(): number;
187
190
  ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties(): number;
191
+ ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed(): number;
188
192
  ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature(): number;
189
193
  ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k(): number;
190
194
  ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p(): number;
@@ -126,6 +126,20 @@ export async function downloadModel(modelPath: string, headers: Map<string, stri
126
126
  throw __error;
127
127
  }
128
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
+ }
129
143
  /**
130
144
  * Load a GGUF model from a local path or remote URL.
131
145
  *
@@ -489,6 +503,67 @@ const FfiConverterTypeAsset = (() => {
489
503
  })();
490
504
 
491
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
+
492
567
  /**
493
568
  * A pending tool call waiting for resolution from the language binding.
494
569
  */
@@ -2581,6 +2656,11 @@ export interface SamplerBuilderInterface {
2581
2656
  * Apply repetition penalties to discourage repeated tokens.
2582
2657
  */
2583
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;
2584
2664
  /**
2585
2665
  * Apply temperature scaling to the probability distribution.
2586
2666
  */
@@ -2752,6 +2832,21 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
2752
2832
  ));
2753
2833
  }
2754
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
+
2755
2850
  /**
2756
2851
  * Apply temperature scaling to the probability distribution.
2757
2852
  */
@@ -3055,6 +3150,10 @@ const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
3055
3150
  const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
3056
3151
 
3057
3152
 
3153
+ // FfiConverter for Array<CachedModel>
3154
+ const FfiConverterArrayTypeCachedModel = new FfiConverterArray(FfiConverterTypeCachedModel);
3155
+
3156
+
3058
3157
  // FfiConverter for Array<ToolCall>
3059
3158
  const FfiConverterArrayTypeToolCall = new FfiConverterArray(FfiConverterTypeToolCall);
3060
3159
 
@@ -3122,6 +3221,9 @@ function uniffiEnsureInitialized() {
3122
3221
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model() !== 31331) {
3123
3222
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_download_model");
3124
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
+ }
3125
3227
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 33587) {
3126
3228
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
3127
3229
  }
@@ -3248,6 +3350,9 @@ function uniffiEnsureInitialized() {
3248
3350
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties() !== 40767) {
3249
3351
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties");
3250
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
+ }
3251
3356
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature() !== 8456) {
3252
3357
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature");
3253
3358
  }
@@ -3302,6 +3407,7 @@ export default Object.freeze({
3302
3407
  initialize: uniffiEnsureInitialized,
3303
3408
  converters: {
3304
3409
  FfiConverterTypeAsset,
3410
+ FfiConverterTypeCachedModel,
3305
3411
  FfiConverterTypeMessage,
3306
3412
  FfiConverterTypeNobodyWhoError,
3307
3413
  FfiConverterTypePendingToolCall,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nobodywho",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Run LLMs locally with offline inference — React Native bindings",
5
5
  "main": "src/wrapper.ts",
6
6
  "types": "src/wrapper.ts",
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.