react-native-nobodywho 2.3.0 → 2.5.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.
@@ -45,9 +45,11 @@ import {
45
45
  type UniffiRustCallStatus,
46
46
  AbstractFfiConverterByteArray,
47
47
  FfiConverterArray,
48
+ FfiConverterArrayBuffer,
48
49
  FfiConverterBool,
49
50
  FfiConverterCallback,
50
51
  FfiConverterFloat32,
52
+ FfiConverterInt16,
51
53
  FfiConverterInt32,
52
54
  FfiConverterMap,
53
55
  FfiConverterObject,
@@ -143,20 +145,28 @@ export function getCachedModels(): Array<CachedModel> /*throws*/ {
143
145
  /**
144
146
  * Load a GGUF model from a local path or remote URL.
145
147
  *
146
- * Accepts local filesystem paths, `hf://owner/repo/file.gguf` for HuggingFace downloads,
147
- * or `https://` URLs. Downloaded models are cached automatically.
148
+ * Accepts local filesystem paths, `hf://owner/repo/file.gguf`, `https://` URLs,
149
+ * or `auto` for memory-based selection. Downloaded models are cached automatically.
150
+ *
151
+ * # MTP speculative decoding
152
+ *
153
+ * Pass `draft_model_path` pointing to a compatible MTP heads gguf (e.g.
154
+ * `mtp-gemma-4-E2B-it.gguf` for Gemma-4-E2B) to enable MTP
155
+ * speculative decoding on chats built from this model. Whether MTP is
156
+ * actually used is a per-chat decision — pass it through
157
+ * `Chat`-level config on the wrapping binding.
148
158
  *
149
159
  * This is a free function instead of an async constructor because
150
160
  * uniffi-bindgen-react-native generates invalid JS (`async static` instead
151
161
  * of `static async`) for async constructors.
152
162
  */
153
- export async function loadModel(modelPath: string, useGpu: boolean, projectionModelPath: string | undefined, onDownloadProgress: RustDownloadProgressCallback | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustModelInterface> /*throws*/ {
163
+ export async function loadModel(modelPath: string, useGpu: boolean, projectionModelPath: string | undefined, draftModelPath: string | undefined, onDownloadProgress: RustDownloadProgressCallback | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustModelInterface> /*throws*/ {
154
164
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
155
165
  try {
156
166
  return await uniffiRustCallAsync(
157
167
  /*rustCaller:*/ uniffiCaller,
158
168
  /*rustFutureFunc:*/ () => {
159
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_model(FfiConverterString.lower(modelPath),FfiConverterBool.lower(useGpu),FfiConverterOptionalString.lower(projectionModelPath),FfiConverterOptionalTypeRustDownloadProgressCallback.lower(onDownloadProgress)
169
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_model(FfiConverterString.lower(modelPath),FfiConverterBool.lower(useGpu),FfiConverterOptionalString.lower(projectionModelPath),FfiConverterOptionalString.lower(draftModelPath),FfiConverterOptionalTypeRustDownloadProgressCallback.lower(onDownloadProgress)
160
170
  );
161
171
  },
162
172
  /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
@@ -175,6 +185,34 @@ export async function loadModel(modelPath: string, useGpu: boolean, projectionMo
175
185
  throw __error;
176
186
  }
177
187
  }
188
+ /**
189
+ * Create a TTS synthesizer.
190
+ */
191
+ export async function loadTts(source: string, architecture: string | undefined, voice: string | undefined, language: string | undefined, speed: /*f32*/number | undefined, steps: /*u32*/number | undefined, silenceDuration: /*f32*/number | undefined, precision: string | undefined, temperature: /*f32*/number | undefined, huggingfaceToken: string | undefined, device: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustTtsInterface> /*throws*/ {
192
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
193
+ try {
194
+ return await uniffiRustCallAsync(
195
+ /*rustCaller:*/ uniffiCaller,
196
+ /*rustFutureFunc:*/ () => {
197
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_tts(FfiConverterString.lower(source),FfiConverterOptionalString.lower(architecture),FfiConverterOptionalString.lower(voice),FfiConverterOptionalString.lower(language),FfiConverterOptionalFloat32.lower(speed),FfiConverterOptionalUInt32.lower(steps),FfiConverterOptionalFloat32.lower(silenceDuration),FfiConverterOptionalString.lower(precision),FfiConverterOptionalFloat32.lower(temperature),FfiConverterOptionalString.lower(huggingfaceToken),FfiConverterOptionalString.lower(device)
198
+ );
199
+ },
200
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
201
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
202
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
203
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
204
+ /*liftFunc:*/ FfiConverterTypeRustTts.lift.bind(FfiConverterTypeRustTts),
205
+ /*liftString:*/ FfiConverterString.lift,
206
+ /*asyncOpts:*/ asyncOpts_,
207
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
208
+ );
209
+ } catch (__error: any) {
210
+ if (uniffiIsDebug && __error instanceof Error) {
211
+ __error.stack = __stack;
212
+ }
213
+ throw __error;
214
+ }
215
+ }
178
216
  /**
179
217
  * Create a sampler that constrains output using a Lark grammar via llguidance.
180
218
  */
@@ -316,6 +354,8 @@ export function samplerPresetTopP(topP: /*f32*/number): SamplerConfigInterface {
316
354
 
317
355
 
318
356
 
357
+
358
+
319
359
  /**
320
360
  * Callback interface for download progress reporting. Implement this in your
321
361
  * language to receive `(downloadedBytes, totalBytes)` events while a remote
@@ -445,6 +485,8 @@ const FfiConverterTypeRustToolCallback = new FfiConverterCallback<RustToolCallba
445
485
 
446
486
 
447
487
 
488
+
489
+
448
490
  export type Asset = {
449
491
  id: string,
450
492
  path: string
@@ -564,6 +606,136 @@ const FfiConverterTypeCachedModel = (() => {
564
606
  })();
565
607
 
566
608
 
609
+ export type ChatStats = {
610
+ contextSize: /*u32*/number,
611
+ contextUsed: /*u32*/number
612
+ }
613
+
614
+ /**
615
+ * Generated factory for {@link ChatStats} record objects.
616
+ */
617
+ export const ChatStats = (() => {
618
+ const defaults = () => ({
619
+ });
620
+ const create = (() => {
621
+ return uniffiCreateRecord<ChatStats, ReturnType<typeof defaults>>(defaults);
622
+ })();
623
+ return Object.freeze({
624
+ /**
625
+ * Create a frozen instance of {@link ChatStats}, with defaults specified
626
+ * in Rust, in the {@link nobodywho} crate.
627
+ */
628
+ create,
629
+
630
+ /**
631
+ * Create a frozen instance of {@link ChatStats}, with defaults specified
632
+ * in Rust, in the {@link nobodywho} crate.
633
+ */
634
+ new: create,
635
+
636
+ /**
637
+ * Defaults specified in the {@link nobodywho} crate.
638
+ */
639
+ defaults: () => Object.freeze(defaults()) as Partial<ChatStats>,
640
+
641
+ });
642
+ })();
643
+
644
+ const FfiConverterTypeChatStats = (() => {
645
+ type TypeName = ChatStats;
646
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
647
+ read(from: RustBuffer): TypeName {
648
+ return {
649
+ contextSize: FfiConverterUInt32.read(from),
650
+ contextUsed: FfiConverterUInt32.read(from)
651
+ };
652
+ }
653
+ write(value: TypeName, into: RustBuffer): void {
654
+ FfiConverterUInt32.write(value.contextSize, into);
655
+ FfiConverterUInt32.write(value.contextUsed, into);
656
+ }
657
+ allocationSize(value: TypeName): number {
658
+ return FfiConverterUInt32.allocationSize(value.contextSize) +
659
+ FfiConverterUInt32.allocationSize(value.contextUsed);
660
+
661
+ }
662
+ };
663
+ return new FFIConverter();
664
+ })();
665
+
666
+
667
+ /**
668
+ * Tuning for MTP speculative decoding. Passing one to `RustChat::new`
669
+ * enables MTP; `null` runs the solo decode path. Requires the model to
670
+ * have been loaded with a compatible `draft_model_path`.
671
+ */
672
+ export type MtpConfig = {
673
+ /**
674
+ * Maximum draft tokens proposed per speculative step (llama.cpp `n_max`).
675
+ * Higher values draft more per decode; returns diminish past ~4–6.
676
+ */
677
+ kMax: /*u32*/number,
678
+ /**
679
+ * Minimum draft-token probability the drafter will propose (llama.cpp
680
+ * `p_min`). `0.0` accepts all proposals; raise it to skip low-confidence
681
+ * drafts.
682
+ */
683
+ pMin: /*f32*/number
684
+ }
685
+
686
+ /**
687
+ * Generated factory for {@link MtpConfig} record objects.
688
+ */
689
+ export const MtpConfig = (() => {
690
+ const defaults = () => ({kMax: 3,pMin: 0.0
691
+ });
692
+ const create = (() => {
693
+ return uniffiCreateRecord<MtpConfig, ReturnType<typeof defaults>>(defaults);
694
+ })();
695
+ return Object.freeze({
696
+ /**
697
+ * Create a frozen instance of {@link MtpConfig}, with defaults specified
698
+ * in Rust, in the {@link nobodywho} crate.
699
+ */
700
+ create,
701
+
702
+ /**
703
+ * Create a frozen instance of {@link MtpConfig}, with defaults specified
704
+ * in Rust, in the {@link nobodywho} crate.
705
+ */
706
+ new: create,
707
+
708
+ /**
709
+ * Defaults specified in the {@link nobodywho} crate.
710
+ */
711
+ defaults: () => Object.freeze(defaults()) as Partial<MtpConfig>,
712
+
713
+ });
714
+ })();
715
+
716
+ const FfiConverterTypeMtpConfig = (() => {
717
+ type TypeName = MtpConfig;
718
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
719
+ read(from: RustBuffer): TypeName {
720
+ return {
721
+ kMax: FfiConverterUInt32.read(from),
722
+ pMin: FfiConverterFloat32.read(from)
723
+ };
724
+ }
725
+ write(value: TypeName, into: RustBuffer): void {
726
+ FfiConverterUInt32.write(value.kMax, into);
727
+ FfiConverterFloat32.write(value.pMin, into);
728
+ }
729
+ allocationSize(value: TypeName): number {
730
+ return FfiConverterUInt32.allocationSize(value.kMax) +
731
+ FfiConverterFloat32.allocationSize(value.pMin);
732
+
733
+ }
734
+ };
735
+ return new FFIConverter();
736
+ })();
737
+
738
+
567
739
  /**
568
740
  * A pending tool call waiting for resolution from the language binding.
569
741
  */
@@ -1292,6 +1464,13 @@ export interface RustChatInterface {
1292
1464
  * Send a message and get a token stream for the response.
1293
1465
  */
1294
1466
  ask(message: string) : RustTokenStreamInterface;
1467
+ /**
1468
+ * Send a JSON-encoded prompt and get a token stream.
1469
+ *
1470
+ * `json` must be a valid JSON string. The wrapper layer is responsible for
1471
+ * serializing native objects (dicts, arrays, etc.) to JSON before calling this.
1472
+ */
1473
+ askWithJsonPrompt(json: string) /*throws*/: RustTokenStreamInterface;
1295
1474
  /**
1296
1475
  * Send a multimodal prompt (text + images/audio) and get a token stream.
1297
1476
  *
@@ -1307,6 +1486,10 @@ export interface RustChatInterface {
1307
1486
  * Get the current sampler configuration as a JSON string.
1308
1487
  */
1309
1488
  getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1489
+ /**
1490
+ * Get context usage statistics.
1491
+ */
1492
+ getStats(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ChatStats>;
1310
1493
  /**
1311
1494
  * Get the current system prompt.
1312
1495
  */
@@ -1315,6 +1498,12 @@ export interface RustChatInterface {
1315
1498
  * Get all template variables.
1316
1499
  */
1317
1500
  getTemplateVariables(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Map<string, boolean>>;
1501
+ /**
1502
+ * MTP draft acceptance rate for the most recent generation, in `[0.0, 1.0]`.
1503
+ *
1504
+ * Resets each generation. `null` when MTP is disabled or no drafts were proposed.
1505
+ */
1506
+ mtpAcceptanceRate(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise</*f32*/number | undefined>;
1318
1507
  /**
1319
1508
  * Reset the chat context with a new system prompt and tools.
1320
1509
  */
@@ -1347,6 +1536,15 @@ export interface RustChatInterface {
1347
1536
  * Stop the current generation.
1348
1537
  */
1349
1538
  stopGeneration() : void;
1539
+ /**
1540
+ * Tokenize a plain text string and return the token IDs.
1541
+ */
1542
+ tokenize(message: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*i32*/number | undefined>>;
1543
+ /**
1544
+ * Tokenize a multimodal prompt and return the token IDs.
1545
+ * Text tokens produce an integer ID; image/audio embedding slots produce null.
1546
+ */
1547
+ tokenizeWithPrompt(parts: Array<PromptPart>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*i32*/number | undefined>>;
1350
1548
  }
1351
1549
 
1352
1550
 
@@ -1357,8 +1555,18 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
1357
1555
  readonly [pointerLiteralSymbol]: UniffiHandle;
1358
1556
  /**
1359
1557
  * Create a new chat session.
1558
+ *
1559
+ * Pass an `mtp` config to enable MTP speculative decoding for this
1560
+ * chat; `null` disables it. Requires the `RustModel` to have been
1561
+ * loaded with a compatible `draft_model_path`; otherwise construction
1562
+ * fails. Adds around 5% to VRAM usage.
1563
+ *
1564
+ * `thread_count` is the number of CPU threads used for inference; `null`
1565
+ * detects the device's physical core count (performance cores only, on
1566
+ * Apple silicon), since hyperthreads and efficiency cores make inference
1567
+ * slower. Clamped to the CPU count.
1360
1568
  */
1361
- constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) /*throws*/ {
1569
+ constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined, mtp: MtpConfig | undefined, threadCount: /*u32*/number | undefined) /*throws*/ {
1362
1570
  super();
1363
1571
  const pointer =
1364
1572
 
@@ -1372,6 +1580,8 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
1372
1580
  FfiConverterOptionalMapStringBool.lower(templateVariables),
1373
1581
  FfiConverterOptionalArrayTypeRustTool.lower(tools),
1374
1582
  FfiConverterOptionalTypeSamplerConfig.lower(sampler),
1583
+ FfiConverterOptionalTypeMtpConfig.lower(mtp),
1584
+ FfiConverterOptionalUInt32.lower(threadCount),
1375
1585
  callStatus);
1376
1586
  },
1377
1587
  /*liftString:*/ FfiConverterString.lift,
@@ -1397,6 +1607,25 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
1397
1607
  ));
1398
1608
  }
1399
1609
 
1610
+ /**
1611
+ * Send a JSON-encoded prompt and get a token stream.
1612
+ *
1613
+ * `json` must be a valid JSON string. The wrapper layer is responsible for
1614
+ * serializing native objects (dicts, arrays, etc.) to JSON before calling this.
1615
+ */
1616
+ askWithJsonPrompt(json: string): RustTokenStreamInterface /*throws*/ {
1617
+ return FfiConverterTypeRustTokenStream.lift(
1618
+ uniffiCaller.rustCallWithError(
1619
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
1620
+ /*caller:*/ (callStatus) => {
1621
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_ask_with_json_prompt(uniffiTypeRustChatObjectFactory.clonePointer(this),
1622
+ FfiConverterString.lower(json),
1623
+ callStatus);
1624
+ },
1625
+ /*liftString:*/ FfiConverterString.lift,
1626
+ ));
1627
+ }
1628
+
1400
1629
  /**
1401
1630
  * Send a multimodal prompt (text + images/audio) and get a token stream.
1402
1631
  *
@@ -1476,6 +1705,37 @@ async getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }): Promise<strin
1476
1705
  }
1477
1706
  }
1478
1707
 
1708
+ /**
1709
+ * Get context usage statistics.
1710
+ */
1711
+ async getStats(asyncOpts_?: { signal: AbortSignal }): Promise<ChatStats> /*throws*/ {
1712
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1713
+ try {
1714
+ return await uniffiRustCallAsync(
1715
+ /*rustCaller:*/ uniffiCaller,
1716
+ /*rustFutureFunc:*/ () => {
1717
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_get_stats(
1718
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1719
+
1720
+ );
1721
+ },
1722
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1723
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1724
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1725
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1726
+ /*liftFunc:*/ FfiConverterTypeChatStats.lift.bind(FfiConverterTypeChatStats),
1727
+ /*liftString:*/ FfiConverterString.lift,
1728
+ /*asyncOpts:*/ asyncOpts_,
1729
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1730
+ );
1731
+ } catch (__error: any) {
1732
+ if (uniffiIsDebug && __error instanceof Error) {
1733
+ __error.stack = __stack;
1734
+ }
1735
+ throw __error;
1736
+ }
1737
+ }
1738
+
1479
1739
  /**
1480
1740
  * Get the current system prompt.
1481
1741
  */
@@ -1538,6 +1798,39 @@ async getTemplateVariables(asyncOpts_?: { signal: AbortSignal }): Promise<Map<s
1538
1798
  }
1539
1799
  }
1540
1800
 
1801
+ /**
1802
+ * MTP draft acceptance rate for the most recent generation, in `[0.0, 1.0]`.
1803
+ *
1804
+ * Resets each generation. `null` when MTP is disabled or no drafts were proposed.
1805
+ */
1806
+ async mtpAcceptanceRate(asyncOpts_?: { signal: AbortSignal }): Promise</*f32*/number | undefined> /*throws*/ {
1807
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1808
+ try {
1809
+ return await uniffiRustCallAsync(
1810
+ /*rustCaller:*/ uniffiCaller,
1811
+ /*rustFutureFunc:*/ () => {
1812
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_mtp_acceptance_rate(
1813
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1814
+
1815
+ );
1816
+ },
1817
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1818
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1819
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1820
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1821
+ /*liftFunc:*/ FfiConverterOptionalFloat32.lift.bind(FfiConverterOptionalFloat32),
1822
+ /*liftString:*/ FfiConverterString.lift,
1823
+ /*asyncOpts:*/ asyncOpts_,
1824
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1825
+ );
1826
+ } catch (__error: any) {
1827
+ if (uniffiIsDebug && __error instanceof Error) {
1828
+ __error.stack = __stack;
1829
+ }
1830
+ throw __error;
1831
+ }
1832
+ }
1833
+
1541
1834
  /**
1542
1835
  * Reset the chat context with a new system prompt and tools.
1543
1836
  */
@@ -1766,6 +2059,69 @@ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSig
1766
2059
  );
1767
2060
  }
1768
2061
 
2062
+ /**
2063
+ * Tokenize a plain text string and return the token IDs.
2064
+ */
2065
+ async tokenize(message: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*i32*/number | undefined>> /*throws*/ {
2066
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2067
+ try {
2068
+ return await uniffiRustCallAsync(
2069
+ /*rustCaller:*/ uniffiCaller,
2070
+ /*rustFutureFunc:*/ () => {
2071
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_tokenize(
2072
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
2073
+ FfiConverterString.lower(message)
2074
+ );
2075
+ },
2076
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2077
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2078
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2079
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2080
+ /*liftFunc:*/ FfiConverterArrayOptionalInt32.lift.bind(FfiConverterArrayOptionalInt32),
2081
+ /*liftString:*/ FfiConverterString.lift,
2082
+ /*asyncOpts:*/ asyncOpts_,
2083
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2084
+ );
2085
+ } catch (__error: any) {
2086
+ if (uniffiIsDebug && __error instanceof Error) {
2087
+ __error.stack = __stack;
2088
+ }
2089
+ throw __error;
2090
+ }
2091
+ }
2092
+
2093
+ /**
2094
+ * Tokenize a multimodal prompt and return the token IDs.
2095
+ * Text tokens produce an integer ID; image/audio embedding slots produce null.
2096
+ */
2097
+ async tokenizeWithPrompt(parts: Array<PromptPart>, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*i32*/number | undefined>> /*throws*/ {
2098
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2099
+ try {
2100
+ return await uniffiRustCallAsync(
2101
+ /*rustCaller:*/ uniffiCaller,
2102
+ /*rustFutureFunc:*/ () => {
2103
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_tokenize_with_prompt(
2104
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
2105
+ FfiConverterArrayTypePromptPart.lower(parts)
2106
+ );
2107
+ },
2108
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2109
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2110
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2111
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2112
+ /*liftFunc:*/ FfiConverterArrayOptionalInt32.lift.bind(FfiConverterArrayOptionalInt32),
2113
+ /*liftString:*/ FfiConverterString.lift,
2114
+ /*asyncOpts:*/ asyncOpts_,
2115
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2116
+ );
2117
+ } catch (__error: any) {
2118
+ if (uniffiIsDebug && __error instanceof Error) {
2119
+ __error.stack = __stack;
2120
+ }
2121
+ throw __error;
2122
+ }
2123
+ }
2124
+
1769
2125
 
1770
2126
  /**
1771
2127
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -2166,6 +2522,7 @@ const FfiConverterTypeRustEncoder = new FfiConverterObject(uniffiTypeRustEncode
2166
2522
 
2167
2523
  export interface RustModelInterface {
2168
2524
 
2525
+ maxCtx() : /*u32*/number;
2169
2526
  }
2170
2527
 
2171
2528
 
@@ -2184,12 +2541,22 @@ private constructor(pointer: UniffiHandle) {
2184
2541
 
2185
2542
 
2186
2543
 
2187
-
2188
- /**
2189
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2190
- */
2191
- uniffiDestroy(): void {
2192
- const ptr = (this as any)[destructorGuardSymbol];
2544
+ maxCtx(): /*u32*/number {
2545
+ return FfiConverterUInt32.lift(uniffiCaller.rustCall(
2546
+ /*caller:*/ (callStatus) => {
2547
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustmodel_max_ctx(uniffiTypeRustModelObjectFactory.clonePointer(this),
2548
+ callStatus);
2549
+ },
2550
+ /*liftString:*/ FfiConverterString.lift,
2551
+ ));
2552
+ }
2553
+
2554
+
2555
+ /**
2556
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2557
+ */
2558
+ uniffiDestroy(): void {
2559
+ const ptr = (this as any)[destructorGuardSymbol];
2193
2560
  if (ptr !== undefined) {
2194
2561
  const pointer = uniffiTypeRustModelObjectFactory.pointer(this);
2195
2562
  uniffiTypeRustModelObjectFactory.freePointer(pointer);
@@ -2259,6 +2626,345 @@ const uniffiTypeRustModelObjectFactory: UniffiObjectFactory<RustModelInterface>
2259
2626
  const FfiConverterTypeRustModel = new FfiConverterObject(uniffiTypeRustModelObjectFactory);
2260
2627
 
2261
2628
 
2629
+ /**
2630
+ * Speech-to-text handle. Wraps `nobodywho::stt::Stt`.
2631
+ * Use `transcribe_file` or `transcribe_pcm` to get a `RustSTTStream`.
2632
+ */
2633
+ export interface RustSttInterface {
2634
+
2635
+ /**
2636
+ * Start transcribing an audio file (WAV / MP3).
2637
+ * Returns a `RustSTTStream` to consume tokens as they are generated.
2638
+ */
2639
+ transcribeFile(path: string) /*throws*/: RustSttStreamInterface;
2640
+ /**
2641
+ * Start transcribing raw i16 PCM samples (e.g. from a microphone stream).
2642
+ * `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
2643
+ */
2644
+ transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number) /*throws*/: RustSttStreamInterface;
2645
+ }
2646
+
2647
+
2648
+ /**
2649
+ * Speech-to-text handle. Wraps `nobodywho::stt::Stt`.
2650
+ * Use `transcribe_file` or `transcribe_pcm` to get a `RustSTTStream`.
2651
+ */
2652
+ export class RustStt extends UniffiAbstractObject implements RustSttInterface {
2653
+
2654
+ readonly [uniffiTypeNameSymbol] = "RustStt";
2655
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2656
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2657
+ /**
2658
+ * Create an STT handle. `source` is a HuggingFace repo (`hf://owner/repo`,
2659
+ * e.g. `"hf://onnx-community/whisper-base"`) or a local directory path.
2660
+ * `language` is an ISO 639-1 code (e.g. `"en"`); pass `None` to auto-detect.
2661
+ * `quantization` selects the ONNX precision variant to download and load:
2662
+ * one of `"default"`, `"fp16"`, `"int8"`, `"uint8"`, `"bnb4"`, `"q4"`, `"q4f16"`, `"quantized"`;
2663
+ * pass `None` to use `"default"`.
2664
+ */
2665
+ constructor(source: string, language: string | undefined, quantization: string | undefined) /*throws*/ {
2666
+ super();
2667
+ const pointer =
2668
+
2669
+ uniffiCaller.rustCallWithError(
2670
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2671
+ /*caller:*/ (callStatus) => {
2672
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_ruststt_new(
2673
+ FfiConverterString.lower(source),
2674
+ FfiConverterOptionalString.lower(language),
2675
+ FfiConverterOptionalString.lower(quantization),
2676
+ callStatus);
2677
+ },
2678
+ /*liftString:*/ FfiConverterString.lift,
2679
+ );
2680
+ this[pointerLiteralSymbol] = pointer;
2681
+ this[destructorGuardSymbol] = uniffiTypeRustSttObjectFactory.bless(pointer);
2682
+ }
2683
+
2684
+
2685
+
2686
+
2687
+ /**
2688
+ * Start transcribing an audio file (WAV / MP3).
2689
+ * Returns a `RustSTTStream` to consume tokens as they are generated.
2690
+ */
2691
+ transcribeFile(path: string): RustSttStreamInterface /*throws*/ {
2692
+ return FfiConverterTypeRustSTTStream.lift(
2693
+ uniffiCaller.rustCallWithError(
2694
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2695
+ /*caller:*/ (callStatus) => {
2696
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststt_transcribe_file(uniffiTypeRustSttObjectFactory.clonePointer(this),
2697
+ FfiConverterString.lower(path),
2698
+ callStatus);
2699
+ },
2700
+ /*liftString:*/ FfiConverterString.lift,
2701
+ ));
2702
+ }
2703
+
2704
+ /**
2705
+ * Start transcribing raw i16 PCM samples (e.g. from a microphone stream).
2706
+ * `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
2707
+ */
2708
+ transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number): RustSttStreamInterface /*throws*/ {
2709
+ return FfiConverterTypeRustSTTStream.lift(
2710
+ uniffiCaller.rustCallWithError(
2711
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2712
+ /*caller:*/ (callStatus) => {
2713
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststt_transcribe_pcm(uniffiTypeRustSttObjectFactory.clonePointer(this),
2714
+ FfiConverterArrayInt16.lower(samples),
2715
+ FfiConverterUInt32.lower(sampleRate),
2716
+ callStatus);
2717
+ },
2718
+ /*liftString:*/ FfiConverterString.lift,
2719
+ ));
2720
+ }
2721
+
2722
+
2723
+ /**
2724
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2725
+ */
2726
+ uniffiDestroy(): void {
2727
+ const ptr = (this as any)[destructorGuardSymbol];
2728
+ if (ptr !== undefined) {
2729
+ const pointer = uniffiTypeRustSttObjectFactory.pointer(this);
2730
+ uniffiTypeRustSttObjectFactory.freePointer(pointer);
2731
+ uniffiTypeRustSttObjectFactory.unbless(ptr);
2732
+ delete (this as any)[destructorGuardSymbol];
2733
+ }
2734
+ }
2735
+
2736
+ static instanceOf(obj: any): obj is RustStt {
2737
+ return uniffiTypeRustSttObjectFactory.isConcreteType(obj);
2738
+ }
2739
+
2740
+
2741
+ }
2742
+
2743
+ const uniffiTypeRustSttObjectFactory: UniffiObjectFactory<RustSttInterface> = (() => {
2744
+
2745
+ return {
2746
+ create(pointer: UniffiHandle): RustSttInterface {
2747
+ const instance = Object.create(RustStt.prototype);
2748
+ instance[pointerLiteralSymbol] = pointer;
2749
+ instance[destructorGuardSymbol] = this.bless(pointer);
2750
+ instance[uniffiTypeNameSymbol] = "RustStt";
2751
+ return instance;
2752
+ },
2753
+
2754
+
2755
+ bless(p: UniffiHandle): UniffiGcObject {
2756
+ return uniffiCaller.rustCall(
2757
+ /*caller:*/ (status) =>
2758
+ nativeModule().ubrn_uniffi_internal_fn_method_ruststt_ffi__bless_pointer(p, status),
2759
+ /*liftString:*/ FfiConverterString.lift
2760
+ );
2761
+ },
2762
+
2763
+ unbless(ptr: UniffiGcObject) {
2764
+ ptr.markDestroyed();
2765
+ },
2766
+
2767
+ pointer(obj: RustSttInterface): UniffiHandle {
2768
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2769
+ throw new UniffiInternalError.UnexpectedNullPointer();
2770
+ }
2771
+ return (obj as any)[pointerLiteralSymbol];
2772
+ },
2773
+
2774
+ clonePointer(obj: RustSttInterface): UniffiHandle {
2775
+ const pointer = this.pointer(obj);
2776
+ return uniffiCaller.rustCall(
2777
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_ruststt(pointer, callStatus),
2778
+ /*liftString:*/ FfiConverterString.lift
2779
+ );
2780
+ },
2781
+
2782
+ freePointer(pointer: UniffiHandle): void {
2783
+ uniffiCaller.rustCall(
2784
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_ruststt(pointer, callStatus),
2785
+ /*liftString:*/ FfiConverterString.lift
2786
+ );
2787
+ },
2788
+
2789
+ isConcreteType(obj: any): obj is RustSttInterface {
2790
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustStt";
2791
+ },
2792
+ }})();
2793
+ // FfiConverter for RustSttInterface
2794
+ const FfiConverterTypeRustSTT = new FfiConverterObject(uniffiTypeRustSttObjectFactory);
2795
+
2796
+
2797
+ /**
2798
+ * A stream of transcript tokens from a Whisper STT run.
2799
+ */
2800
+ export interface RustSttStreamInterface {
2801
+
2802
+ /**
2803
+ * Wait for transcription to finish and return the full transcript.
2804
+ */
2805
+ completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
2806
+ /**
2807
+ * Get the next transcript token. Returns `None` when transcription is complete.
2808
+ */
2809
+ nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
2810
+ }
2811
+
2812
+
2813
+ /**
2814
+ * A stream of transcript tokens from a Whisper STT run.
2815
+ */
2816
+ export class RustSttStream extends UniffiAbstractObject implements RustSttStreamInterface {
2817
+
2818
+ readonly [uniffiTypeNameSymbol] = "RustSttStream";
2819
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2820
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2821
+ // No primary constructor declared for this class.
2822
+ private constructor(pointer: UniffiHandle) {
2823
+ super();
2824
+ this[pointerLiteralSymbol] = pointer;
2825
+ this[destructorGuardSymbol] = uniffiTypeRustSttStreamObjectFactory.bless(pointer);
2826
+ }
2827
+
2828
+
2829
+
2830
+
2831
+ /**
2832
+ * Wait for transcription to finish and return the full transcript.
2833
+ */
2834
+ async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
2835
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2836
+ try {
2837
+ return await uniffiRustCallAsync(
2838
+ /*rustCaller:*/ uniffiCaller,
2839
+ /*rustFutureFunc:*/ () => {
2840
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststtstream_completed(
2841
+ uniffiTypeRustSttStreamObjectFactory.clonePointer(this)
2842
+
2843
+ );
2844
+ },
2845
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2846
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2847
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2848
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2849
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
2850
+ /*liftString:*/ FfiConverterString.lift,
2851
+ /*asyncOpts:*/ asyncOpts_,
2852
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2853
+ );
2854
+ } catch (__error: any) {
2855
+ if (uniffiIsDebug && __error instanceof Error) {
2856
+ __error.stack = __stack;
2857
+ }
2858
+ throw __error;
2859
+ }
2860
+ }
2861
+
2862
+ /**
2863
+ * Get the next transcript token. Returns `None` when transcription is complete.
2864
+ */
2865
+ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
2866
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2867
+ try {
2868
+ return await uniffiRustCallAsync(
2869
+ /*rustCaller:*/ uniffiCaller,
2870
+ /*rustFutureFunc:*/ () => {
2871
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststtstream_next_token(
2872
+ uniffiTypeRustSttStreamObjectFactory.clonePointer(this)
2873
+
2874
+ );
2875
+ },
2876
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2877
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2878
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2879
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2880
+ /*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
2881
+ /*liftString:*/ FfiConverterString.lift,
2882
+ /*asyncOpts:*/ asyncOpts_,
2883
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2884
+ );
2885
+ } catch (__error: any) {
2886
+ if (uniffiIsDebug && __error instanceof Error) {
2887
+ __error.stack = __stack;
2888
+ }
2889
+ throw __error;
2890
+ }
2891
+ }
2892
+
2893
+
2894
+ /**
2895
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2896
+ */
2897
+ uniffiDestroy(): void {
2898
+ const ptr = (this as any)[destructorGuardSymbol];
2899
+ if (ptr !== undefined) {
2900
+ const pointer = uniffiTypeRustSttStreamObjectFactory.pointer(this);
2901
+ uniffiTypeRustSttStreamObjectFactory.freePointer(pointer);
2902
+ uniffiTypeRustSttStreamObjectFactory.unbless(ptr);
2903
+ delete (this as any)[destructorGuardSymbol];
2904
+ }
2905
+ }
2906
+
2907
+ static instanceOf(obj: any): obj is RustSttStream {
2908
+ return uniffiTypeRustSttStreamObjectFactory.isConcreteType(obj);
2909
+ }
2910
+
2911
+
2912
+ }
2913
+
2914
+ const uniffiTypeRustSttStreamObjectFactory: UniffiObjectFactory<RustSttStreamInterface> = (() => {
2915
+
2916
+ return {
2917
+ create(pointer: UniffiHandle): RustSttStreamInterface {
2918
+ const instance = Object.create(RustSttStream.prototype);
2919
+ instance[pointerLiteralSymbol] = pointer;
2920
+ instance[destructorGuardSymbol] = this.bless(pointer);
2921
+ instance[uniffiTypeNameSymbol] = "RustSttStream";
2922
+ return instance;
2923
+ },
2924
+
2925
+
2926
+ bless(p: UniffiHandle): UniffiGcObject {
2927
+ return uniffiCaller.rustCall(
2928
+ /*caller:*/ (status) =>
2929
+ nativeModule().ubrn_uniffi_internal_fn_method_ruststtstream_ffi__bless_pointer(p, status),
2930
+ /*liftString:*/ FfiConverterString.lift
2931
+ );
2932
+ },
2933
+
2934
+ unbless(ptr: UniffiGcObject) {
2935
+ ptr.markDestroyed();
2936
+ },
2937
+
2938
+ pointer(obj: RustSttStreamInterface): UniffiHandle {
2939
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2940
+ throw new UniffiInternalError.UnexpectedNullPointer();
2941
+ }
2942
+ return (obj as any)[pointerLiteralSymbol];
2943
+ },
2944
+
2945
+ clonePointer(obj: RustSttStreamInterface): UniffiHandle {
2946
+ const pointer = this.pointer(obj);
2947
+ return uniffiCaller.rustCall(
2948
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_ruststtstream(pointer, callStatus),
2949
+ /*liftString:*/ FfiConverterString.lift
2950
+ );
2951
+ },
2952
+
2953
+ freePointer(pointer: UniffiHandle): void {
2954
+ uniffiCaller.rustCall(
2955
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_ruststtstream(pointer, callStatus),
2956
+ /*liftString:*/ FfiConverterString.lift
2957
+ );
2958
+ },
2959
+
2960
+ isConcreteType(obj: any): obj is RustSttStreamInterface {
2961
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustSttStream";
2962
+ },
2963
+ }})();
2964
+ // FfiConverter for RustSttStreamInterface
2965
+ const FfiConverterTypeRustSTTStream = new FfiConverterObject(uniffiTypeRustSttStreamObjectFactory);
2966
+
2967
+
2262
2968
  export interface RustTokenStreamInterface {
2263
2969
 
2264
2970
  /**
@@ -2622,6 +3328,179 @@ const uniffiTypeRustToolObjectFactory: UniffiObjectFactory<RustToolInterface> =
2622
3328
  const FfiConverterTypeRustTool = new FfiConverterObject(uniffiTypeRustToolObjectFactory);
2623
3329
 
2624
3330
 
3331
+ export interface RustTtsInterface {
3332
+
3333
+ /**
3334
+ * Synthesize text and return WAV bytes.
3335
+ */
3336
+ synthesize(text: string) /*throws*/: ArrayBuffer;
3337
+ /**
3338
+ * Synthesize text asynchronously and return WAV bytes.
3339
+ */
3340
+ synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ArrayBuffer>;
3341
+ }
3342
+
3343
+
3344
+ export class RustTts extends UniffiAbstractObject implements RustTtsInterface {
3345
+
3346
+ readonly [uniffiTypeNameSymbol] = "RustTts";
3347
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3348
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3349
+ /**
3350
+ * Create a TTS synthesizer.
3351
+ */
3352
+ constructor(source: string, architecture: string | undefined, voice: string | undefined, language: string | undefined, speed: /*f32*/number | undefined, steps: /*u32*/number | undefined, silenceDuration: /*f32*/number | undefined, precision: string | undefined, temperature: /*f32*/number | undefined, huggingfaceToken: string | undefined, device: string | undefined) /*throws*/ {
3353
+ super();
3354
+ const pointer =
3355
+
3356
+ uniffiCaller.rustCallWithError(
3357
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
3358
+ /*caller:*/ (callStatus) => {
3359
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rusttts_new(
3360
+ FfiConverterString.lower(source),
3361
+ FfiConverterOptionalString.lower(architecture),
3362
+ FfiConverterOptionalString.lower(voice),
3363
+ FfiConverterOptionalString.lower(language),
3364
+ FfiConverterOptionalFloat32.lower(speed),
3365
+ FfiConverterOptionalUInt32.lower(steps),
3366
+ FfiConverterOptionalFloat32.lower(silenceDuration),
3367
+ FfiConverterOptionalString.lower(precision),
3368
+ FfiConverterOptionalFloat32.lower(temperature),
3369
+ FfiConverterOptionalString.lower(huggingfaceToken),
3370
+ FfiConverterOptionalString.lower(device),
3371
+ callStatus);
3372
+ },
3373
+ /*liftString:*/ FfiConverterString.lift,
3374
+ );
3375
+ this[pointerLiteralSymbol] = pointer;
3376
+ this[destructorGuardSymbol] = uniffiTypeRustTtsObjectFactory.bless(pointer);
3377
+ }
3378
+
3379
+
3380
+
3381
+
3382
+ /**
3383
+ * Synthesize text and return WAV bytes.
3384
+ */
3385
+ synthesize(text: string): ArrayBuffer /*throws*/ {
3386
+ return FfiConverterArrayBuffer.lift(
3387
+ uniffiCaller.rustCallWithError(
3388
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
3389
+ /*caller:*/ (callStatus) => {
3390
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttts_synthesize(uniffiTypeRustTtsObjectFactory.clonePointer(this),
3391
+ FfiConverterString.lower(text),
3392
+ callStatus);
3393
+ },
3394
+ /*liftString:*/ FfiConverterString.lift,
3395
+ ));
3396
+ }
3397
+
3398
+ /**
3399
+ * Synthesize text asynchronously and return WAV bytes.
3400
+ */
3401
+ async synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<ArrayBuffer> /*throws*/ {
3402
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
3403
+ try {
3404
+ return await uniffiRustCallAsync(
3405
+ /*rustCaller:*/ uniffiCaller,
3406
+ /*rustFutureFunc:*/ () => {
3407
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttts_synthesize_async(
3408
+ uniffiTypeRustTtsObjectFactory.clonePointer(this),
3409
+ FfiConverterString.lower(text)
3410
+ );
3411
+ },
3412
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
3413
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
3414
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
3415
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
3416
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
3417
+ /*liftString:*/ FfiConverterString.lift,
3418
+ /*asyncOpts:*/ asyncOpts_,
3419
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
3420
+ );
3421
+ } catch (__error: any) {
3422
+ if (uniffiIsDebug && __error instanceof Error) {
3423
+ __error.stack = __stack;
3424
+ }
3425
+ throw __error;
3426
+ }
3427
+ }
3428
+
3429
+
3430
+ /**
3431
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
3432
+ */
3433
+ uniffiDestroy(): void {
3434
+ const ptr = (this as any)[destructorGuardSymbol];
3435
+ if (ptr !== undefined) {
3436
+ const pointer = uniffiTypeRustTtsObjectFactory.pointer(this);
3437
+ uniffiTypeRustTtsObjectFactory.freePointer(pointer);
3438
+ uniffiTypeRustTtsObjectFactory.unbless(ptr);
3439
+ delete (this as any)[destructorGuardSymbol];
3440
+ }
3441
+ }
3442
+
3443
+ static instanceOf(obj: any): obj is RustTts {
3444
+ return uniffiTypeRustTtsObjectFactory.isConcreteType(obj);
3445
+ }
3446
+
3447
+
3448
+ }
3449
+
3450
+ const uniffiTypeRustTtsObjectFactory: UniffiObjectFactory<RustTtsInterface> = (() => {
3451
+
3452
+ return {
3453
+ create(pointer: UniffiHandle): RustTtsInterface {
3454
+ const instance = Object.create(RustTts.prototype);
3455
+ instance[pointerLiteralSymbol] = pointer;
3456
+ instance[destructorGuardSymbol] = this.bless(pointer);
3457
+ instance[uniffiTypeNameSymbol] = "RustTts";
3458
+ return instance;
3459
+ },
3460
+
3461
+
3462
+ bless(p: UniffiHandle): UniffiGcObject {
3463
+ return uniffiCaller.rustCall(
3464
+ /*caller:*/ (status) =>
3465
+ nativeModule().ubrn_uniffi_internal_fn_method_rusttts_ffi__bless_pointer(p, status),
3466
+ /*liftString:*/ FfiConverterString.lift
3467
+ );
3468
+ },
3469
+
3470
+ unbless(ptr: UniffiGcObject) {
3471
+ ptr.markDestroyed();
3472
+ },
3473
+
3474
+ pointer(obj: RustTtsInterface): UniffiHandle {
3475
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
3476
+ throw new UniffiInternalError.UnexpectedNullPointer();
3477
+ }
3478
+ return (obj as any)[pointerLiteralSymbol];
3479
+ },
3480
+
3481
+ clonePointer(obj: RustTtsInterface): UniffiHandle {
3482
+ const pointer = this.pointer(obj);
3483
+ return uniffiCaller.rustCall(
3484
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rusttts(pointer, callStatus),
3485
+ /*liftString:*/ FfiConverterString.lift
3486
+ );
3487
+ },
3488
+
3489
+ freePointer(pointer: UniffiHandle): void {
3490
+ uniffiCaller.rustCall(
3491
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rusttts(pointer, callStatus),
3492
+ /*liftString:*/ FfiConverterString.lift
3493
+ );
3494
+ },
3495
+
3496
+ isConcreteType(obj: any): obj is RustTtsInterface {
3497
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustTts";
3498
+ },
3499
+ }})();
3500
+ // FfiConverter for RustTtsInterface
3501
+ const FfiConverterTypeRustTts = new FfiConverterObject(uniffiTypeRustTtsObjectFactory);
3502
+
3503
+
2625
3504
  export interface SamplerBuilderInterface {
2626
3505
 
2627
3506
  /**
@@ -3130,6 +4009,18 @@ const FfiConverterTypeSamplerConfig = new FfiConverterObject(uniffiTypeSamplerC
3130
4009
  const FfiConverterOptionalTypeRustDownloadProgressCallback = new FfiConverterOptional(FfiConverterTypeRustDownloadProgressCallback);
3131
4010
 
3132
4011
 
4012
+ // FfiConverter for /*f32*/number | undefined
4013
+ const FfiConverterOptionalFloat32 = new FfiConverterOptional(FfiConverterFloat32);
4014
+
4015
+
4016
+ // FfiConverter for /*i32*/number | undefined
4017
+ const FfiConverterOptionalInt32 = new FfiConverterOptional(FfiConverterInt32);
4018
+
4019
+
4020
+ // FfiConverter for MtpConfig | undefined
4021
+ const FfiConverterOptionalTypeMtpConfig = new FfiConverterOptional(FfiConverterTypeMtpConfig);
4022
+
4023
+
3133
4024
  // FfiConverter for PendingToolCall | undefined
3134
4025
  const FfiConverterOptionalTypePendingToolCall = new FfiConverterOptional(FfiConverterTypePendingToolCall);
3135
4026
 
@@ -3146,6 +4037,10 @@ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
3146
4037
  const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
3147
4038
 
3148
4039
 
4040
+ // FfiConverter for Array</*i16*/number>
4041
+ const FfiConverterArrayInt16 = new FfiConverterArray(FfiConverterInt16);
4042
+
4043
+
3149
4044
  // FfiConverter for Array<Asset>
3150
4045
  const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
3151
4046
 
@@ -3194,6 +4089,10 @@ const FfiConverterArrayTypePromptPart = new FfiConverterArray(FfiConverterTypePr
3194
4089
  const FfiConverterArrayTypeRustTool = new FfiConverterArray(FfiConverterTypeRustTool);
3195
4090
 
3196
4091
 
4092
+ // FfiConverter for Array</*i32*/number | undefined>
4093
+ const FfiConverterArrayOptionalInt32 = new FfiConverterArray(FfiConverterOptionalInt32);
4094
+
4095
+
3197
4096
  // FfiConverter for Array<RustToolInterface> | undefined
3198
4097
  const FfiConverterOptionalArrayTypeRustTool = new FfiConverterOptional(FfiConverterArrayTypeRustTool);
3199
4098
 
@@ -3224,9 +4123,12 @@ function uniffiEnsureInitialized() {
3224
4123
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models() !== 12002) {
3225
4124
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_get_cached_models");
3226
4125
  }
3227
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 33587) {
4126
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 22964) {
3228
4127
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
3229
4128
  }
4129
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_tts() !== 26587) {
4130
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_tts");
4131
+ }
3230
4132
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar() !== 13698) {
3231
4133
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar");
3232
4134
  }
@@ -3263,6 +4165,9 @@ function uniffiEnsureInitialized() {
3263
4165
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask() !== 53575) {
3264
4166
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask");
3265
4167
  }
4168
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_json_prompt() !== 63877) {
4169
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_json_prompt");
4170
+ }
3266
4171
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt() !== 65089) {
3267
4172
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt");
3268
4173
  }
@@ -3272,12 +4177,18 @@ function uniffiEnsureInitialized() {
3272
4177
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json() !== 33078) {
3273
4178
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json");
3274
4179
  }
4180
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_stats() !== 59932) {
4181
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_stats");
4182
+ }
3275
4183
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt() !== 57727) {
3276
4184
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt");
3277
4185
  }
3278
4186
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_template_variables() !== 19616) {
3279
4187
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_template_variables");
3280
4188
  }
4189
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_mtp_acceptance_rate() !== 727) {
4190
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_mtp_acceptance_rate");
4191
+ }
3281
4192
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_reset_context() !== 47191) {
3282
4193
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_reset_context");
3283
4194
  }
@@ -3302,6 +4213,12 @@ function uniffiEnsureInitialized() {
3302
4213
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation() !== 24711) {
3303
4214
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation");
3304
4215
  }
4216
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize() !== 52520) {
4217
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize");
4218
+ }
4219
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt() !== 60528) {
4220
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt");
4221
+ }
3305
4222
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank() !== 55500) {
3306
4223
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank");
3307
4224
  }
@@ -3311,6 +4228,21 @@ function uniffiEnsureInitialized() {
3311
4228
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode() !== 52601) {
3312
4229
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode");
3313
4230
  }
4231
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx() !== 52004) {
4232
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx");
4233
+ }
4234
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_file() !== 43975) {
4235
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_file");
4236
+ }
4237
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_pcm() !== 61166) {
4238
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_pcm");
4239
+ }
4240
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststtstream_completed() !== 22443) {
4241
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststtstream_completed");
4242
+ }
4243
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststtstream_next_token() !== 38526) {
4244
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststtstream_next_token");
4245
+ }
3314
4246
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
3315
4247
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
3316
4248
  }
@@ -3326,6 +4258,12 @@ function uniffiEnsureInitialized() {
3326
4258
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call() !== 10096) {
3327
4259
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call");
3328
4260
  }
4261
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize() !== 56024) {
4262
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize");
4263
+ }
4264
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize_async() !== 54670) {
4265
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize_async");
4266
+ }
3329
4267
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist() !== 23376) {
3330
4268
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist");
3331
4269
  }
@@ -3371,7 +4309,7 @@ function uniffiEnsureInitialized() {
3371
4309
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json() !== 51798) {
3372
4310
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json");
3373
4311
  }
3374
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 24505) {
4312
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 2313) {
3375
4313
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new");
3376
4314
  }
3377
4315
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new() !== 9022) {
@@ -3380,12 +4318,18 @@ function uniffiEnsureInitialized() {
3380
4318
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new() !== 27902) {
3381
4319
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new");
3382
4320
  }
4321
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_ruststt_new() !== 44850) {
4322
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_ruststt_new");
4323
+ }
3383
4324
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new() !== 9431) {
3384
4325
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new");
3385
4326
  }
3386
4327
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async() !== 54521) {
3387
4328
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async");
3388
4329
  }
4330
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttts_new() !== 34899) {
4331
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttts_new");
4332
+ }
3389
4333
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new() !== 50214) {
3390
4334
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new");
3391
4335
  }
@@ -3408,7 +4352,9 @@ export default Object.freeze({
3408
4352
  converters: {
3409
4353
  FfiConverterTypeAsset,
3410
4354
  FfiConverterTypeCachedModel,
4355
+ FfiConverterTypeChatStats,
3411
4356
  FfiConverterTypeMessage,
4357
+ FfiConverterTypeMtpConfig,
3412
4358
  FfiConverterTypeNobodyWhoError,
3413
4359
  FfiConverterTypePendingToolCall,
3414
4360
  FfiConverterTypePromptPart,
@@ -3416,8 +4362,11 @@ export default Object.freeze({
3416
4362
  FfiConverterTypeRustCrossEncoder,
3417
4363
  FfiConverterTypeRustEncoder,
3418
4364
  FfiConverterTypeRustModel,
4365
+ FfiConverterTypeRustSTT,
4366
+ FfiConverterTypeRustSTTStream,
3419
4367
  FfiConverterTypeRustTokenStream,
3420
4368
  FfiConverterTypeRustTool,
4369
+ FfiConverterTypeRustTts,
3421
4370
  FfiConverterTypeSamplerBuilder,
3422
4371
  FfiConverterTypeSamplerConfig,
3423
4372
  FfiConverterTypeToolCall,