react-native-nobodywho 0.0.1 → 0.1.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.
@@ -0,0 +1,3048 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ // @ts-nocheck
7
+ import nativeModule, {
8
+ type UniffiRustFutureContinuationCallback,
9
+ type UniffiForeignFutureDroppedCallback,
10
+ type UniffiForeignFutureDroppedCallbackStruct,
11
+ type UniffiForeignFutureResultU8,
12
+ type UniffiForeignFutureCompleteU8,
13
+ type UniffiForeignFutureResultI8,
14
+ type UniffiForeignFutureCompleteI8,
15
+ type UniffiForeignFutureResultU16,
16
+ type UniffiForeignFutureCompleteU16,
17
+ type UniffiForeignFutureResultI16,
18
+ type UniffiForeignFutureCompleteI16,
19
+ type UniffiForeignFutureResultU32,
20
+ type UniffiForeignFutureCompleteU32,
21
+ type UniffiForeignFutureResultI32,
22
+ type UniffiForeignFutureCompleteI32,
23
+ type UniffiForeignFutureResultU64,
24
+ type UniffiForeignFutureCompleteU64,
25
+ type UniffiForeignFutureResultI64,
26
+ type UniffiForeignFutureCompleteI64,
27
+ type UniffiForeignFutureResultF32,
28
+ type UniffiForeignFutureCompleteF32,
29
+ type UniffiForeignFutureResultF64,
30
+ type UniffiForeignFutureCompleteF64,
31
+ type UniffiForeignFutureResultRustBuffer,
32
+ type UniffiForeignFutureCompleteRustBuffer,
33
+ type UniffiForeignFutureResultVoid,
34
+ type UniffiForeignFutureCompleteVoid,
35
+ type UniffiVTableCallbackInterfaceRustToolCallback,
36
+ } from "./nobodywho-ffi";
37
+ import {
38
+ type FfiConverter,
39
+ type UniffiByteArray,
40
+ type UniffiGcObject,
41
+ type UniffiHandle,
42
+ type UniffiObjectFactory,
43
+ type UniffiReferenceHolder,
44
+ type UniffiRustCallStatus,
45
+ AbstractFfiConverterByteArray,
46
+ FfiConverterArray,
47
+ FfiConverterBool,
48
+ FfiConverterCallback,
49
+ FfiConverterFloat32,
50
+ FfiConverterInt32,
51
+ FfiConverterMap,
52
+ FfiConverterObject,
53
+ FfiConverterOptional,
54
+ FfiConverterUInt32,
55
+ FfiConverterUInt64,
56
+ RustBuffer,
57
+ UniffiAbstractObject,
58
+ UniffiEnum,
59
+ UniffiError,
60
+ UniffiInternalError,
61
+ UniffiResult,
62
+ UniffiRustCaller,
63
+ destructorGuardSymbol,
64
+ pointerLiteralSymbol,
65
+ uniffiCreateFfiConverterString,
66
+ uniffiCreateRecord,
67
+ uniffiRustCallAsync,
68
+ uniffiTraitInterfaceCall,
69
+ uniffiTypeNameSymbol,
70
+ variantOrdinalSymbol } from "uniffi-bindgen-react-native";
71
+
72
+ // Get converters from the other files, if any.
73
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
74
+
75
+ const uniffiIsDebug =
76
+ // @ts-ignore -- The process global might not be defined
77
+ typeof process !== "object" ||
78
+ // @ts-ignore -- The process global might not be defined
79
+ process?.env?.NODE_ENV !== "production" ||
80
+ false;
81
+ // Public interface members begin here.
82
+
83
+ /**
84
+ * Compute the cosine similarity between two vectors.
85
+ */
86
+ export function cosineSimilarity(a: Array</*f32*/number>, b: Array</*f32*/number>): /*f32*/number {
87
+ return FfiConverterFloat32.lift(uniffiCaller.rustCall(
88
+ /*caller:*/ (callStatus) => {
89
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_cosine_similarity(
90
+ FfiConverterArrayFloat32.lower(a),
91
+ FfiConverterArrayFloat32.lower(b),
92
+ callStatus);
93
+ },
94
+ /*liftString:*/ FfiConverterString.lift,
95
+ ));
96
+ }
97
+ /**
98
+ * Load a GGUF model from disk.
99
+ * This is a free function instead of an async constructor because
100
+ * uniffi-bindgen-react-native generates invalid JS (`async static` instead
101
+ * of `static async`) for async constructors.
102
+ */
103
+ export async function loadModel(modelPath: string, useGpu: boolean, imageModelPath: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<ModelInterface> /*throws*/ {
104
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
105
+ try {
106
+ return await uniffiRustCallAsync(
107
+ /*rustCaller:*/ uniffiCaller,
108
+ /*rustFutureFunc:*/ () => {
109
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_model(FfiConverterString.lower(modelPath),FfiConverterBool.lower(useGpu),FfiConverterOptionalString.lower(imageModelPath)
110
+ );
111
+ },
112
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
113
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
114
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
115
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
116
+ /*liftFunc:*/ FfiConverterTypeModel.lift.bind(FfiConverterTypeModel),
117
+ /*liftString:*/ FfiConverterString.lift,
118
+ /*asyncOpts:*/ asyncOpts_,
119
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
120
+ );
121
+ } catch (__error: any) {
122
+ if (uniffiIsDebug && __error instanceof Error) {
123
+ __error.stack = __stack;
124
+ }
125
+ throw __error;
126
+ }
127
+ }
128
+ /**
129
+ * Get the default sampler configuration.
130
+ */
131
+ export function samplerPresetDefault(): SamplerConfigInterface {
132
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
133
+ /*caller:*/ (callStatus) => {
134
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_default(
135
+ callStatus);
136
+ },
137
+ /*liftString:*/ FfiConverterString.lift,
138
+ ));
139
+ }
140
+ /**
141
+ * Create a DRY sampler preset to reduce repetition.
142
+ */
143
+ export function samplerPresetDry(): SamplerConfigInterface {
144
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
145
+ /*caller:*/ (callStatus) => {
146
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_dry(
147
+ callStatus);
148
+ },
149
+ /*liftString:*/ FfiConverterString.lift,
150
+ ));
151
+ }
152
+ /**
153
+ * Create a sampler with a custom grammar constraint.
154
+ */
155
+ export function samplerPresetGrammar(grammar: string): SamplerConfigInterface {
156
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
157
+ /*caller:*/ (callStatus) => {
158
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_grammar(
159
+ FfiConverterString.lower(grammar),
160
+ callStatus);
161
+ },
162
+ /*liftString:*/ FfiConverterString.lift,
163
+ ));
164
+ }
165
+ /**
166
+ * Create a greedy sampler (always picks most probable token).
167
+ */
168
+ export function samplerPresetGreedy(): SamplerConfigInterface {
169
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
170
+ /*caller:*/ (callStatus) => {
171
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_greedy(
172
+ callStatus);
173
+ },
174
+ /*liftString:*/ FfiConverterString.lift,
175
+ ));
176
+ }
177
+ /**
178
+ * Create a sampler configured for JSON output generation.
179
+ */
180
+ export function samplerPresetJson(): SamplerConfigInterface {
181
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
182
+ /*caller:*/ (callStatus) => {
183
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_json(
184
+ callStatus);
185
+ },
186
+ /*liftString:*/ FfiConverterString.lift,
187
+ ));
188
+ }
189
+ /**
190
+ * Create a sampler with temperature scaling.
191
+ */
192
+ export function samplerPresetTemperature(temperature: /*f32*/number): SamplerConfigInterface {
193
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
194
+ /*caller:*/ (callStatus) => {
195
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_temperature(
196
+ FfiConverterFloat32.lower(temperature),
197
+ callStatus);
198
+ },
199
+ /*liftString:*/ FfiConverterString.lift,
200
+ ));
201
+ }
202
+ /**
203
+ * Create a sampler with top-k filtering only.
204
+ */
205
+ export function samplerPresetTopK(topK: /*i32*/number): SamplerConfigInterface {
206
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
207
+ /*caller:*/ (callStatus) => {
208
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_top_k(
209
+ FfiConverterInt32.lower(topK),
210
+ callStatus);
211
+ },
212
+ /*liftString:*/ FfiConverterString.lift,
213
+ ));
214
+ }
215
+ /**
216
+ * Create a sampler with nucleus (top-p) sampling.
217
+ */
218
+ export function samplerPresetTopP(topP: /*f32*/number): SamplerConfigInterface {
219
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
220
+ /*caller:*/ (callStatus) => {
221
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_sampler_preset_top_p(
222
+ FfiConverterFloat32.lower(topP),
223
+ callStatus);
224
+ },
225
+ /*liftString:*/ FfiConverterString.lift,
226
+ ));
227
+ }
228
+
229
+
230
+
231
+
232
+
233
+ /**
234
+ * Callback interface for tool functions.
235
+ * Implement this in your language to provide the tool's logic.
236
+ * The `call` method receives the tool arguments as a JSON string
237
+ * and should return the tool's result as a string.
238
+ */
239
+ export interface RustToolCallback {
240
+
241
+ call(argumentsJson: string) : string;
242
+ }
243
+
244
+
245
+ // Put the implementation in a struct so we don't pollute the top-level namespace
246
+ const uniffiCallbackInterfaceRustToolCallback: { vtable: UniffiVTableCallbackInterfaceRustToolCallback; register: () => void; } = {
247
+ // Create the VTable using a series of closures.
248
+ // ts automatically converts these into C callback functions.
249
+ vtable: {
250
+ call: (
251
+ uniffiHandle: bigint,
252
+ argumentsJson: Uint8Array,) => {
253
+ const uniffiMakeCall =
254
+ ()
255
+ : string => {
256
+ const jsCallback = FfiConverterTypeRustToolCallback.lift(uniffiHandle);
257
+ return jsCallback.call(
258
+ FfiConverterString.lift(argumentsJson)
259
+ )
260
+ };
261
+ const uniffiResult = UniffiResult.ready<Uint8Array>();
262
+ const uniffiHandleSuccess = (obj: any) => {
263
+ UniffiResult.writeSuccess(uniffiResult, FfiConverterString.lower(obj));
264
+ };
265
+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
266
+ UniffiResult.writeError(uniffiResult, code, errBuf);
267
+ };
268
+ uniffiTraitInterfaceCall(
269
+ /*makeCall:*/ uniffiMakeCall,
270
+ /*handleSuccess:*/ uniffiHandleSuccess,
271
+ /*handleError:*/ uniffiHandleError,
272
+ /*lowerString:*/ FfiConverterString.lower
273
+ )
274
+ return uniffiResult;
275
+ },
276
+ uniffiFree: (uniffiHandle: UniffiHandle): void => {
277
+ // RustToolCallback: this will throw a stale handle error if the handle isn't found.
278
+ FfiConverterTypeRustToolCallback.drop(uniffiHandle);
279
+ },
280
+ uniffiClone: (uniffiHandle: UniffiHandle): UniffiHandle => {
281
+ return FfiConverterTypeRustToolCallback.clone(uniffiHandle);
282
+ }
283
+ },
284
+ register: () => {
285
+ nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_init_callback_vtable_rusttoolcallback(
286
+ uniffiCallbackInterfaceRustToolCallback.vtable
287
+ );
288
+ },
289
+ };
290
+
291
+ // FfiConverter protocol for callback interfaces
292
+ const FfiConverterTypeRustToolCallback = new FfiConverterCallback<RustToolCallback>();
293
+
294
+
295
+
296
+
297
+
298
+
299
+ export type Asset = {
300
+ id: string,
301
+ path: string
302
+ }
303
+
304
+ /**
305
+ * Generated factory for {@link Asset} record objects.
306
+ */
307
+ export const Asset = (() => {
308
+ const defaults = () => ({
309
+ });
310
+ const create = (() => {
311
+ return uniffiCreateRecord<Asset, ReturnType<typeof defaults>>(defaults);
312
+ })();
313
+ return Object.freeze({
314
+ /**
315
+ * Create a frozen instance of {@link Asset}, with defaults specified
316
+ * in Rust, in the {@link nobodywho} crate.
317
+ */
318
+ create,
319
+
320
+ /**
321
+ * Create a frozen instance of {@link Asset}, with defaults specified
322
+ * in Rust, in the {@link nobodywho} crate.
323
+ */
324
+ new: create,
325
+
326
+ /**
327
+ * Defaults specified in the {@link nobodywho} crate.
328
+ */
329
+ defaults: () => Object.freeze(defaults()) as Partial<Asset>,
330
+
331
+ });
332
+ })();
333
+
334
+ const FfiConverterTypeAsset = (() => {
335
+ type TypeName = Asset;
336
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
337
+ read(from: RustBuffer): TypeName {
338
+ return {
339
+ id: FfiConverterString.read(from),
340
+ path: FfiConverterString.read(from)
341
+ };
342
+ }
343
+ write(value: TypeName, into: RustBuffer): void {
344
+ FfiConverterString.write(value.id, into);
345
+ FfiConverterString.write(value.path, into);
346
+ }
347
+ allocationSize(value: TypeName): number {
348
+ return FfiConverterString.allocationSize(value.id) +
349
+ FfiConverterString.allocationSize(value.path);
350
+
351
+ }
352
+ };
353
+ return new FFIConverter();
354
+ })();
355
+
356
+
357
+ export type ToolCall = {
358
+ name: string,
359
+ argumentsJson: string
360
+ }
361
+
362
+ /**
363
+ * Generated factory for {@link ToolCall} record objects.
364
+ */
365
+ export const ToolCall = (() => {
366
+ const defaults = () => ({
367
+ });
368
+ const create = (() => {
369
+ return uniffiCreateRecord<ToolCall, ReturnType<typeof defaults>>(defaults);
370
+ })();
371
+ return Object.freeze({
372
+ /**
373
+ * Create a frozen instance of {@link ToolCall}, with defaults specified
374
+ * in Rust, in the {@link nobodywho} crate.
375
+ */
376
+ create,
377
+
378
+ /**
379
+ * Create a frozen instance of {@link ToolCall}, with defaults specified
380
+ * in Rust, in the {@link nobodywho} crate.
381
+ */
382
+ new: create,
383
+
384
+ /**
385
+ * Defaults specified in the {@link nobodywho} crate.
386
+ */
387
+ defaults: () => Object.freeze(defaults()) as Partial<ToolCall>,
388
+
389
+ });
390
+ })();
391
+
392
+ const FfiConverterTypeToolCall = (() => {
393
+ type TypeName = ToolCall;
394
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
395
+ read(from: RustBuffer): TypeName {
396
+ return {
397
+ name: FfiConverterString.read(from),
398
+ argumentsJson: FfiConverterString.read(from)
399
+ };
400
+ }
401
+ write(value: TypeName, into: RustBuffer): void {
402
+ FfiConverterString.write(value.name, into);
403
+ FfiConverterString.write(value.argumentsJson, into);
404
+ }
405
+ allocationSize(value: TypeName): number {
406
+ return FfiConverterString.allocationSize(value.name) +
407
+ FfiConverterString.allocationSize(value.argumentsJson);
408
+
409
+ }
410
+ };
411
+ return new FFIConverter();
412
+ })();
413
+
414
+
415
+ export type ToolParameter = {
416
+ name: string,
417
+ /**
418
+ * JSON Schema for this parameter (e.g. `{"type": "string"}`).
419
+ */
420
+ schema: string
421
+ }
422
+
423
+ /**
424
+ * Generated factory for {@link ToolParameter} record objects.
425
+ */
426
+ export const ToolParameter = (() => {
427
+ const defaults = () => ({
428
+ });
429
+ const create = (() => {
430
+ return uniffiCreateRecord<ToolParameter, ReturnType<typeof defaults>>(defaults);
431
+ })();
432
+ return Object.freeze({
433
+ /**
434
+ * Create a frozen instance of {@link ToolParameter}, with defaults specified
435
+ * in Rust, in the {@link nobodywho} crate.
436
+ */
437
+ create,
438
+
439
+ /**
440
+ * Create a frozen instance of {@link ToolParameter}, with defaults specified
441
+ * in Rust, in the {@link nobodywho} crate.
442
+ */
443
+ new: create,
444
+
445
+ /**
446
+ * Defaults specified in the {@link nobodywho} crate.
447
+ */
448
+ defaults: () => Object.freeze(defaults()) as Partial<ToolParameter>,
449
+
450
+ });
451
+ })();
452
+
453
+ const FfiConverterTypeToolParameter = (() => {
454
+ type TypeName = ToolParameter;
455
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
456
+ read(from: RustBuffer): TypeName {
457
+ return {
458
+ name: FfiConverterString.read(from),
459
+ schema: FfiConverterString.read(from)
460
+ };
461
+ }
462
+ write(value: TypeName, into: RustBuffer): void {
463
+ FfiConverterString.write(value.name, into);
464
+ FfiConverterString.write(value.schema, into);
465
+ }
466
+ allocationSize(value: TypeName): number {
467
+ return FfiConverterString.allocationSize(value.name) +
468
+ FfiConverterString.allocationSize(value.schema);
469
+
470
+ }
471
+ };
472
+ return new FFIConverter();
473
+ })();
474
+
475
+
476
+ const stringConverter = {
477
+ stringToBytes: (s: string) =>
478
+ uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status)),
479
+ bytesToString: (ab: UniffiByteArray) =>
480
+ uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status)),
481
+ stringByteLength: (s: string) =>
482
+ uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status)),
483
+ };
484
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
485
+
486
+
487
+
488
+
489
+
490
+
491
+ // Enum: Message
492
+ export enum Message_Tags {
493
+ Message = "Message",
494
+ ToolCalls = "ToolCalls",
495
+ ToolResp = "ToolResp"
496
+ }
497
+ export const Message = (() => {
498
+
499
+
500
+ type Message__interface = {
501
+ tag: Message_Tags.Message;
502
+ inner: Readonly<{role: Role; content: string; assets: Array<Asset>}>
503
+ };
504
+
505
+
506
+ class Message_ extends UniffiEnum implements Message__interface {
507
+ /**
508
+ * @private
509
+ * This field is private and should not be used, use `tag` instead.
510
+ */
511
+ readonly [uniffiTypeNameSymbol] = "Message";
512
+ readonly tag = Message_Tags.Message;
513
+ readonly inner: Readonly<{role: Role; content: string; assets: Array<Asset>}>;
514
+ constructor(inner: { role: Role, content: string, assets: Array<Asset> }) {
515
+ super("Message", "Message");
516
+ this.inner = Object.freeze(inner);
517
+ }
518
+
519
+ static new(inner: { role: Role, content: string, assets: Array<Asset> }): Message_ {
520
+ return new Message_(inner);
521
+ }
522
+
523
+ static instanceOf(obj: any): obj is Message_ {
524
+ return obj.tag === Message_Tags.Message;
525
+ }
526
+
527
+
528
+
529
+
530
+ }
531
+
532
+
533
+ type ToolCalls__interface = {
534
+ tag: Message_Tags.ToolCalls;
535
+ inner: Readonly<{role: Role; content: string; toolCalls: Array<ToolCall>}>
536
+ };
537
+
538
+
539
+ class ToolCalls_ extends UniffiEnum implements ToolCalls__interface {
540
+ /**
541
+ * @private
542
+ * This field is private and should not be used, use `tag` instead.
543
+ */
544
+ readonly [uniffiTypeNameSymbol] = "Message";
545
+ readonly tag = Message_Tags.ToolCalls;
546
+ readonly inner: Readonly<{role: Role; content: string; toolCalls: Array<ToolCall>}>;
547
+ constructor(inner: { role: Role, content: string, toolCalls: Array<ToolCall> }) {
548
+ super("Message", "ToolCalls");
549
+ this.inner = Object.freeze(inner);
550
+ }
551
+
552
+ static new(inner: { role: Role, content: string, toolCalls: Array<ToolCall> }): ToolCalls_ {
553
+ return new ToolCalls_(inner);
554
+ }
555
+
556
+ static instanceOf(obj: any): obj is ToolCalls_ {
557
+ return obj.tag === Message_Tags.ToolCalls;
558
+ }
559
+
560
+
561
+
562
+
563
+ }
564
+
565
+
566
+ type ToolResp__interface = {
567
+ tag: Message_Tags.ToolResp;
568
+ inner: Readonly<{role: Role; name: string; content: string}>
569
+ };
570
+
571
+
572
+ class ToolResp_ extends UniffiEnum implements ToolResp__interface {
573
+ /**
574
+ * @private
575
+ * This field is private and should not be used, use `tag` instead.
576
+ */
577
+ readonly [uniffiTypeNameSymbol] = "Message";
578
+ readonly tag = Message_Tags.ToolResp;
579
+ readonly inner: Readonly<{role: Role; name: string; content: string}>;
580
+ constructor(inner: { role: Role, name: string, content: string }) {
581
+ super("Message", "ToolResp");
582
+ this.inner = Object.freeze(inner);
583
+ }
584
+
585
+ static new(inner: { role: Role, name: string, content: string }): ToolResp_ {
586
+ return new ToolResp_(inner);
587
+ }
588
+
589
+ static instanceOf(obj: any): obj is ToolResp_ {
590
+ return obj.tag === Message_Tags.ToolResp;
591
+ }
592
+
593
+
594
+
595
+
596
+ }
597
+
598
+ function instanceOf(obj: any): obj is Message {
599
+ return obj[uniffiTypeNameSymbol] === "Message";
600
+ }
601
+
602
+ return Object.freeze({
603
+ instanceOf,
604
+ Message: Message_,
605
+ ToolCalls: ToolCalls_,
606
+ ToolResp: ToolResp_
607
+ });
608
+
609
+ })();
610
+
611
+
612
+
613
+ export type Message = InstanceType<
614
+ typeof Message[keyof Omit<typeof Message, 'instanceOf'>]
615
+ >;
616
+
617
+ // FfiConverter for enum Message
618
+ const FfiConverterTypeMessage = (() => {
619
+ const ordinalConverter = FfiConverterInt32;
620
+ type TypeName = Message;
621
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
622
+ read(from: RustBuffer): TypeName {
623
+ switch (ordinalConverter.read(from)) {
624
+ case 1: return new Message.Message({role: FfiConverterTypeRole.read(from), content: FfiConverterString.read(from), assets: FfiConverterArrayTypeAsset.read(from) });
625
+ case 2: return new Message.ToolCalls({role: FfiConverterTypeRole.read(from), content: FfiConverterString.read(from), toolCalls: FfiConverterArrayTypeToolCall.read(from) });
626
+ case 3: return new Message.ToolResp({role: FfiConverterTypeRole.read(from), name: FfiConverterString.read(from), content: FfiConverterString.read(from) });
627
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
628
+ }
629
+ }
630
+ write(value: TypeName, into: RustBuffer): void {
631
+ switch (value.tag) {
632
+ case Message_Tags.Message: {
633
+ ordinalConverter.write(1, into);
634
+ const inner = value.inner;
635
+ FfiConverterTypeRole.write(inner.role, into);
636
+ FfiConverterString.write(inner.content, into);
637
+ FfiConverterArrayTypeAsset.write(inner.assets, into);
638
+ return;
639
+ }
640
+ case Message_Tags.ToolCalls: {
641
+ ordinalConverter.write(2, into);
642
+ const inner = value.inner;
643
+ FfiConverterTypeRole.write(inner.role, into);
644
+ FfiConverterString.write(inner.content, into);
645
+ FfiConverterArrayTypeToolCall.write(inner.toolCalls, into);
646
+ return;
647
+ }
648
+ case Message_Tags.ToolResp: {
649
+ ordinalConverter.write(3, into);
650
+ const inner = value.inner;
651
+ FfiConverterTypeRole.write(inner.role, into);
652
+ FfiConverterString.write(inner.name, into);
653
+ FfiConverterString.write(inner.content, into);
654
+ return;
655
+ }
656
+ default:
657
+ // Throwing from here means that Message_Tags hasn't matched an ordinal.
658
+ throw new UniffiInternalError.UnexpectedEnumCase();
659
+ }
660
+ }
661
+ allocationSize(value: TypeName): number {
662
+ switch (value.tag) {
663
+ case Message_Tags.Message: {
664
+ const inner = value.inner;
665
+ let size = ordinalConverter.allocationSize(1);
666
+ size += FfiConverterTypeRole.allocationSize(inner.role);
667
+ size += FfiConverterString.allocationSize(inner.content);
668
+ size += FfiConverterArrayTypeAsset.allocationSize(inner.assets);
669
+ return size;
670
+ }
671
+ case Message_Tags.ToolCalls: {
672
+ const inner = value.inner;
673
+ let size = ordinalConverter.allocationSize(2);
674
+ size += FfiConverterTypeRole.allocationSize(inner.role);
675
+ size += FfiConverterString.allocationSize(inner.content);
676
+ size += FfiConverterArrayTypeToolCall.allocationSize(inner.toolCalls);
677
+ return size;
678
+ }
679
+ case Message_Tags.ToolResp: {
680
+ const inner = value.inner;
681
+ let size = ordinalConverter.allocationSize(3);
682
+ size += FfiConverterTypeRole.allocationSize(inner.role);
683
+ size += FfiConverterString.allocationSize(inner.name);
684
+ size += FfiConverterString.allocationSize(inner.content);
685
+ return size;
686
+ }
687
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
688
+ }
689
+ }
690
+ }
691
+ return new FFIConverter();
692
+ })();
693
+
694
+
695
+
696
+ // Error type: NobodyWhoError
697
+
698
+ // Enum: NobodyWhoError
699
+ export enum NobodyWhoError_Tags {
700
+ Error = "Error"
701
+ }
702
+ export const NobodyWhoError = (() => {
703
+
704
+
705
+ type Error__interface = {
706
+ tag: NobodyWhoError_Tags.Error;
707
+ inner: Readonly<{message: string}>
708
+ };
709
+
710
+
711
+ class Error_ extends UniffiError implements Error__interface {
712
+ /**
713
+ * @private
714
+ * This field is private and should not be used, use `tag` instead.
715
+ */
716
+ readonly [uniffiTypeNameSymbol] = "NobodyWhoError";
717
+ readonly tag = NobodyWhoError_Tags.Error;
718
+ readonly inner: Readonly<{message: string}>;
719
+ constructor(inner: { message: string }) {
720
+ super("NobodyWhoError", "Error");
721
+ this.inner = Object.freeze(inner);
722
+ }
723
+
724
+ static new(inner: { message: string }): Error_ {
725
+ return new Error_(inner);
726
+ }
727
+
728
+ static instanceOf(obj: any): obj is Error_ {
729
+ return obj.tag === NobodyWhoError_Tags.Error;
730
+ }
731
+
732
+
733
+
734
+ static hasInner(obj: any): obj is Error_ {
735
+ return Error_.instanceOf(obj);
736
+ }
737
+
738
+ static getInner(obj: Error_): Readonly<{message: string}> {
739
+ return obj.inner;
740
+ }
741
+
742
+ }
743
+
744
+ function instanceOf(obj: any): obj is NobodyWhoError {
745
+ return obj[uniffiTypeNameSymbol] === "NobodyWhoError";
746
+ }
747
+
748
+ return Object.freeze({
749
+ instanceOf,
750
+ Error: Error_
751
+ });
752
+
753
+ })();
754
+
755
+
756
+
757
+ export type NobodyWhoError = InstanceType<
758
+ typeof NobodyWhoError[keyof Omit<typeof NobodyWhoError, 'instanceOf'>]
759
+ >;
760
+
761
+ // FfiConverter for enum NobodyWhoError
762
+ const FfiConverterTypeNobodyWhoError = (() => {
763
+ const ordinalConverter = FfiConverterInt32;
764
+ type TypeName = NobodyWhoError;
765
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
766
+ read(from: RustBuffer): TypeName {
767
+ switch (ordinalConverter.read(from)) {
768
+ case 1: return new NobodyWhoError.Error({message: FfiConverterString.read(from) });
769
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
770
+ }
771
+ }
772
+ write(value: TypeName, into: RustBuffer): void {
773
+ switch (value.tag) {
774
+ case NobodyWhoError_Tags.Error: {
775
+ ordinalConverter.write(1, into);
776
+ const inner = value.inner;
777
+ FfiConverterString.write(inner.message, into);
778
+ return;
779
+ }
780
+ default:
781
+ // Throwing from here means that NobodyWhoError_Tags hasn't matched an ordinal.
782
+ throw new UniffiInternalError.UnexpectedEnumCase();
783
+ }
784
+ }
785
+ allocationSize(value: TypeName): number {
786
+ switch (value.tag) {
787
+ case NobodyWhoError_Tags.Error: {
788
+ const inner = value.inner;
789
+ let size = ordinalConverter.allocationSize(1);
790
+ size += FfiConverterString.allocationSize(inner.message);
791
+ return size;
792
+ }
793
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
794
+ }
795
+ }
796
+ }
797
+ return new FFIConverter();
798
+ })();
799
+
800
+
801
+ // Enum: PromptPart
802
+ export enum PromptPart_Tags {
803
+ Text = "Text",
804
+ Image = "Image",
805
+ Audio = "Audio"
806
+ }
807
+ /**
808
+ * A part of a multimodal prompt. Mirrors the core `PromptPart` enum.
809
+ */
810
+ export const PromptPart = (() => {
811
+
812
+
813
+ type Text__interface = {
814
+ tag: PromptPart_Tags.Text;
815
+ inner: Readonly<{content: string}>
816
+ };
817
+
818
+
819
+ class Text_ extends UniffiEnum implements Text__interface {
820
+ /**
821
+ * @private
822
+ * This field is private and should not be used, use `tag` instead.
823
+ */
824
+ readonly [uniffiTypeNameSymbol] = "PromptPart";
825
+ readonly tag = PromptPart_Tags.Text;
826
+ readonly inner: Readonly<{content: string}>;
827
+ constructor(inner: { content: string }) {
828
+ super("PromptPart", "Text");
829
+ this.inner = Object.freeze(inner);
830
+ }
831
+
832
+ static new(inner: { content: string }): Text_ {
833
+ return new Text_(inner);
834
+ }
835
+
836
+ static instanceOf(obj: any): obj is Text_ {
837
+ return obj.tag === PromptPart_Tags.Text;
838
+ }
839
+
840
+
841
+
842
+
843
+ }
844
+
845
+
846
+ type Image__interface = {
847
+ tag: PromptPart_Tags.Image;
848
+ inner: Readonly<{path: string}>
849
+ };
850
+
851
+
852
+ class Image_ extends UniffiEnum implements Image__interface {
853
+ /**
854
+ * @private
855
+ * This field is private and should not be used, use `tag` instead.
856
+ */
857
+ readonly [uniffiTypeNameSymbol] = "PromptPart";
858
+ readonly tag = PromptPart_Tags.Image;
859
+ readonly inner: Readonly<{path: string}>;
860
+ constructor(inner: { path: string }) {
861
+ super("PromptPart", "Image");
862
+ this.inner = Object.freeze(inner);
863
+ }
864
+
865
+ static new(inner: { path: string }): Image_ {
866
+ return new Image_(inner);
867
+ }
868
+
869
+ static instanceOf(obj: any): obj is Image_ {
870
+ return obj.tag === PromptPart_Tags.Image;
871
+ }
872
+
873
+
874
+
875
+
876
+ }
877
+
878
+
879
+ type Audio__interface = {
880
+ tag: PromptPart_Tags.Audio;
881
+ inner: Readonly<{path: string}>
882
+ };
883
+
884
+
885
+ class Audio_ extends UniffiEnum implements Audio__interface {
886
+ /**
887
+ * @private
888
+ * This field is private and should not be used, use `tag` instead.
889
+ */
890
+ readonly [uniffiTypeNameSymbol] = "PromptPart";
891
+ readonly tag = PromptPart_Tags.Audio;
892
+ readonly inner: Readonly<{path: string}>;
893
+ constructor(inner: { path: string }) {
894
+ super("PromptPart", "Audio");
895
+ this.inner = Object.freeze(inner);
896
+ }
897
+
898
+ static new(inner: { path: string }): Audio_ {
899
+ return new Audio_(inner);
900
+ }
901
+
902
+ static instanceOf(obj: any): obj is Audio_ {
903
+ return obj.tag === PromptPart_Tags.Audio;
904
+ }
905
+
906
+
907
+
908
+
909
+ }
910
+
911
+ function instanceOf(obj: any): obj is PromptPart {
912
+ return obj[uniffiTypeNameSymbol] === "PromptPart";
913
+ }
914
+
915
+ return Object.freeze({
916
+ instanceOf,
917
+ Text: Text_,
918
+ Image: Image_,
919
+ Audio: Audio_
920
+ });
921
+
922
+ })();
923
+
924
+
925
+ /**
926
+ * A part of a multimodal prompt. Mirrors the core `PromptPart` enum.
927
+ */
928
+
929
+ export type PromptPart = InstanceType<
930
+ typeof PromptPart[keyof Omit<typeof PromptPart, 'instanceOf'>]
931
+ >;
932
+
933
+ // FfiConverter for enum PromptPart
934
+ const FfiConverterTypePromptPart = (() => {
935
+ const ordinalConverter = FfiConverterInt32;
936
+ type TypeName = PromptPart;
937
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
938
+ read(from: RustBuffer): TypeName {
939
+ switch (ordinalConverter.read(from)) {
940
+ case 1: return new PromptPart.Text({content: FfiConverterString.read(from) });
941
+ case 2: return new PromptPart.Image({path: FfiConverterString.read(from) });
942
+ case 3: return new PromptPart.Audio({path: FfiConverterString.read(from) });
943
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
944
+ }
945
+ }
946
+ write(value: TypeName, into: RustBuffer): void {
947
+ switch (value.tag) {
948
+ case PromptPart_Tags.Text: {
949
+ ordinalConverter.write(1, into);
950
+ const inner = value.inner;
951
+ FfiConverterString.write(inner.content, into);
952
+ return;
953
+ }
954
+ case PromptPart_Tags.Image: {
955
+ ordinalConverter.write(2, into);
956
+ const inner = value.inner;
957
+ FfiConverterString.write(inner.path, into);
958
+ return;
959
+ }
960
+ case PromptPart_Tags.Audio: {
961
+ ordinalConverter.write(3, into);
962
+ const inner = value.inner;
963
+ FfiConverterString.write(inner.path, into);
964
+ return;
965
+ }
966
+ default:
967
+ // Throwing from here means that PromptPart_Tags hasn't matched an ordinal.
968
+ throw new UniffiInternalError.UnexpectedEnumCase();
969
+ }
970
+ }
971
+ allocationSize(value: TypeName): number {
972
+ switch (value.tag) {
973
+ case PromptPart_Tags.Text: {
974
+ const inner = value.inner;
975
+ let size = ordinalConverter.allocationSize(1);
976
+ size += FfiConverterString.allocationSize(inner.content);
977
+ return size;
978
+ }
979
+ case PromptPart_Tags.Image: {
980
+ const inner = value.inner;
981
+ let size = ordinalConverter.allocationSize(2);
982
+ size += FfiConverterString.allocationSize(inner.path);
983
+ return size;
984
+ }
985
+ case PromptPart_Tags.Audio: {
986
+ const inner = value.inner;
987
+ let size = ordinalConverter.allocationSize(3);
988
+ size += FfiConverterString.allocationSize(inner.path);
989
+ return size;
990
+ }
991
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
992
+ }
993
+ }
994
+ }
995
+ return new FFIConverter();
996
+ })();
997
+
998
+
999
+
1000
+ export enum Role {
1001
+ User,
1002
+ Assistant,
1003
+ System,
1004
+ Tool
1005
+ }
1006
+
1007
+ const FfiConverterTypeRole = (() => {
1008
+ const ordinalConverter = FfiConverterInt32;
1009
+ type TypeName = Role;
1010
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1011
+ read(from: RustBuffer): TypeName {
1012
+ switch (ordinalConverter.read(from)) {
1013
+ case 1: return Role.User;
1014
+ case 2: return Role.Assistant;
1015
+ case 3: return Role.System;
1016
+ case 4: return Role.Tool;
1017
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
1018
+ }
1019
+ }
1020
+ write(value: TypeName, into: RustBuffer): void {
1021
+ switch (value) {
1022
+ case Role.User: return ordinalConverter.write(1, into);
1023
+ case Role.Assistant: return ordinalConverter.write(2, into);
1024
+ case Role.System: return ordinalConverter.write(3, into);
1025
+ case Role.Tool: return ordinalConverter.write(4, into);
1026
+ }
1027
+ }
1028
+ allocationSize(value: TypeName): number {
1029
+ return ordinalConverter.allocationSize(0);
1030
+ }
1031
+ }
1032
+ return new FFIConverter();
1033
+ })();
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+ // FfiConverter for Map<string, boolean>
1040
+ const FfiConverterMapStringBool = new FfiConverterMap(FfiConverterString, FfiConverterBool);
1041
+
1042
+
1043
+ export interface CrossEncoderInterface {
1044
+
1045
+ /**
1046
+ * Rank documents by relevance to a query. Returns similarity scores.
1047
+ */
1048
+ rank(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
1049
+ /**
1050
+ * Rank documents and return them sorted by descending relevance.
1051
+ * Returns a JSON string of [document, score] pairs since UniFFI
1052
+ * doesn't support tuples directly.
1053
+ */
1054
+ rankAndSortJson(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1055
+ }
1056
+
1057
+
1058
+ export class CrossEncoder extends UniffiAbstractObject implements CrossEncoderInterface {
1059
+
1060
+ readonly [uniffiTypeNameSymbol] = "CrossEncoder";
1061
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1062
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1063
+ /**
1064
+ * Create a new cross-encoder for ranking documents by relevance.
1065
+ */
1066
+ constructor(model: ModelInterface, contextSize: /*u32*/number | undefined) {
1067
+ super();
1068
+ const pointer =
1069
+ uniffiCaller.rustCall(
1070
+ /*caller:*/ (callStatus) => {
1071
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_crossencoder_new(
1072
+ FfiConverterTypeModel.lower(model),
1073
+ FfiConverterOptionalUInt32.lower(contextSize),
1074
+ callStatus);
1075
+ },
1076
+ /*liftString:*/ FfiConverterString.lift,
1077
+ );
1078
+ this[pointerLiteralSymbol] = pointer;
1079
+ this[destructorGuardSymbol] = uniffiTypeCrossEncoderObjectFactory.bless(pointer);
1080
+ }
1081
+
1082
+
1083
+
1084
+
1085
+ /**
1086
+ * Rank documents by relevance to a query. Returns similarity scores.
1087
+ */
1088
+ async rank(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*f32*/number>> /*throws*/ {
1089
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1090
+ try {
1091
+ return await uniffiRustCallAsync(
1092
+ /*rustCaller:*/ uniffiCaller,
1093
+ /*rustFutureFunc:*/ () => {
1094
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_crossencoder_rank(
1095
+ uniffiTypeCrossEncoderObjectFactory.clonePointer(this),
1096
+ FfiConverterString.lower(query),FfiConverterArrayString.lower(documents)
1097
+ );
1098
+ },
1099
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1100
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1101
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1102
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1103
+ /*liftFunc:*/ FfiConverterArrayFloat32.lift.bind(FfiConverterArrayFloat32),
1104
+ /*liftString:*/ FfiConverterString.lift,
1105
+ /*asyncOpts:*/ asyncOpts_,
1106
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1107
+ );
1108
+ } catch (__error: any) {
1109
+ if (uniffiIsDebug && __error instanceof Error) {
1110
+ __error.stack = __stack;
1111
+ }
1112
+ throw __error;
1113
+ }
1114
+ }
1115
+
1116
+ /**
1117
+ * Rank documents and return them sorted by descending relevance.
1118
+ * Returns a JSON string of [document, score] pairs since UniFFI
1119
+ * doesn't support tuples directly.
1120
+ */
1121
+ async rankAndSortJson(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
1122
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1123
+ try {
1124
+ return await uniffiRustCallAsync(
1125
+ /*rustCaller:*/ uniffiCaller,
1126
+ /*rustFutureFunc:*/ () => {
1127
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_crossencoder_rank_and_sort_json(
1128
+ uniffiTypeCrossEncoderObjectFactory.clonePointer(this),
1129
+ FfiConverterString.lower(query),FfiConverterArrayString.lower(documents)
1130
+ );
1131
+ },
1132
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1133
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1134
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1135
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1136
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
1137
+ /*liftString:*/ FfiConverterString.lift,
1138
+ /*asyncOpts:*/ asyncOpts_,
1139
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1140
+ );
1141
+ } catch (__error: any) {
1142
+ if (uniffiIsDebug && __error instanceof Error) {
1143
+ __error.stack = __stack;
1144
+ }
1145
+ throw __error;
1146
+ }
1147
+ }
1148
+
1149
+
1150
+ /**
1151
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1152
+ */
1153
+ uniffiDestroy(): void {
1154
+ const ptr = (this as any)[destructorGuardSymbol];
1155
+ if (ptr !== undefined) {
1156
+ const pointer = uniffiTypeCrossEncoderObjectFactory.pointer(this);
1157
+ uniffiTypeCrossEncoderObjectFactory.freePointer(pointer);
1158
+ uniffiTypeCrossEncoderObjectFactory.unbless(ptr);
1159
+ delete (this as any)[destructorGuardSymbol];
1160
+ }
1161
+ }
1162
+
1163
+ static instanceOf(obj: any): obj is CrossEncoder {
1164
+ return uniffiTypeCrossEncoderObjectFactory.isConcreteType(obj);
1165
+ }
1166
+
1167
+
1168
+ }
1169
+
1170
+ const uniffiTypeCrossEncoderObjectFactory: UniffiObjectFactory<CrossEncoderInterface> = (() => {
1171
+
1172
+ return {
1173
+ create(pointer: UniffiHandle): CrossEncoderInterface {
1174
+ const instance = Object.create(CrossEncoder.prototype);
1175
+ instance[pointerLiteralSymbol] = pointer;
1176
+ instance[destructorGuardSymbol] = this.bless(pointer);
1177
+ instance[uniffiTypeNameSymbol] = "CrossEncoder";
1178
+ return instance;
1179
+ },
1180
+
1181
+
1182
+ bless(p: UniffiHandle): UniffiGcObject {
1183
+ return uniffiCaller.rustCall(
1184
+ /*caller:*/ (status) =>
1185
+ nativeModule().ubrn_uniffi_internal_fn_method_crossencoder_ffi__bless_pointer(p, status),
1186
+ /*liftString:*/ FfiConverterString.lift
1187
+ );
1188
+ },
1189
+
1190
+ unbless(ptr: UniffiGcObject) {
1191
+ ptr.markDestroyed();
1192
+ },
1193
+
1194
+ pointer(obj: CrossEncoderInterface): UniffiHandle {
1195
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1196
+ throw new UniffiInternalError.UnexpectedNullPointer();
1197
+ }
1198
+ return (obj as any)[pointerLiteralSymbol];
1199
+ },
1200
+
1201
+ clonePointer(obj: CrossEncoderInterface): UniffiHandle {
1202
+ const pointer = this.pointer(obj);
1203
+ return uniffiCaller.rustCall(
1204
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_crossencoder(pointer, callStatus),
1205
+ /*liftString:*/ FfiConverterString.lift
1206
+ );
1207
+ },
1208
+
1209
+ freePointer(pointer: UniffiHandle): void {
1210
+ uniffiCaller.rustCall(
1211
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_crossencoder(pointer, callStatus),
1212
+ /*liftString:*/ FfiConverterString.lift
1213
+ );
1214
+ },
1215
+
1216
+ isConcreteType(obj: any): obj is CrossEncoderInterface {
1217
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "CrossEncoder";
1218
+ },
1219
+ }})();
1220
+ // FfiConverter for CrossEncoderInterface
1221
+ const FfiConverterTypeCrossEncoder = new FfiConverterObject(uniffiTypeCrossEncoderObjectFactory);
1222
+
1223
+
1224
+ export interface EncoderInterface {
1225
+
1226
+ /**
1227
+ * Encode text into an embedding vector.
1228
+ */
1229
+ encode(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
1230
+ }
1231
+
1232
+
1233
+ export class Encoder extends UniffiAbstractObject implements EncoderInterface {
1234
+
1235
+ readonly [uniffiTypeNameSymbol] = "Encoder";
1236
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1237
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1238
+ /**
1239
+ * Create a new encoder for generating text embeddings.
1240
+ */
1241
+ constructor(model: ModelInterface, contextSize: /*u32*/number | undefined) {
1242
+ super();
1243
+ const pointer =
1244
+ uniffiCaller.rustCall(
1245
+ /*caller:*/ (callStatus) => {
1246
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_encoder_new(
1247
+ FfiConverterTypeModel.lower(model),
1248
+ FfiConverterOptionalUInt32.lower(contextSize),
1249
+ callStatus);
1250
+ },
1251
+ /*liftString:*/ FfiConverterString.lift,
1252
+ );
1253
+ this[pointerLiteralSymbol] = pointer;
1254
+ this[destructorGuardSymbol] = uniffiTypeEncoderObjectFactory.bless(pointer);
1255
+ }
1256
+
1257
+
1258
+
1259
+
1260
+ /**
1261
+ * Encode text into an embedding vector.
1262
+ */
1263
+ async encode(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*f32*/number>> /*throws*/ {
1264
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1265
+ try {
1266
+ return await uniffiRustCallAsync(
1267
+ /*rustCaller:*/ uniffiCaller,
1268
+ /*rustFutureFunc:*/ () => {
1269
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_encoder_encode(
1270
+ uniffiTypeEncoderObjectFactory.clonePointer(this),
1271
+ FfiConverterString.lower(text)
1272
+ );
1273
+ },
1274
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1275
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1276
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1277
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1278
+ /*liftFunc:*/ FfiConverterArrayFloat32.lift.bind(FfiConverterArrayFloat32),
1279
+ /*liftString:*/ FfiConverterString.lift,
1280
+ /*asyncOpts:*/ asyncOpts_,
1281
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1282
+ );
1283
+ } catch (__error: any) {
1284
+ if (uniffiIsDebug && __error instanceof Error) {
1285
+ __error.stack = __stack;
1286
+ }
1287
+ throw __error;
1288
+ }
1289
+ }
1290
+
1291
+
1292
+ /**
1293
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1294
+ */
1295
+ uniffiDestroy(): void {
1296
+ const ptr = (this as any)[destructorGuardSymbol];
1297
+ if (ptr !== undefined) {
1298
+ const pointer = uniffiTypeEncoderObjectFactory.pointer(this);
1299
+ uniffiTypeEncoderObjectFactory.freePointer(pointer);
1300
+ uniffiTypeEncoderObjectFactory.unbless(ptr);
1301
+ delete (this as any)[destructorGuardSymbol];
1302
+ }
1303
+ }
1304
+
1305
+ static instanceOf(obj: any): obj is Encoder {
1306
+ return uniffiTypeEncoderObjectFactory.isConcreteType(obj);
1307
+ }
1308
+
1309
+
1310
+ }
1311
+
1312
+ const uniffiTypeEncoderObjectFactory: UniffiObjectFactory<EncoderInterface> = (() => {
1313
+
1314
+ return {
1315
+ create(pointer: UniffiHandle): EncoderInterface {
1316
+ const instance = Object.create(Encoder.prototype);
1317
+ instance[pointerLiteralSymbol] = pointer;
1318
+ instance[destructorGuardSymbol] = this.bless(pointer);
1319
+ instance[uniffiTypeNameSymbol] = "Encoder";
1320
+ return instance;
1321
+ },
1322
+
1323
+
1324
+ bless(p: UniffiHandle): UniffiGcObject {
1325
+ return uniffiCaller.rustCall(
1326
+ /*caller:*/ (status) =>
1327
+ nativeModule().ubrn_uniffi_internal_fn_method_encoder_ffi__bless_pointer(p, status),
1328
+ /*liftString:*/ FfiConverterString.lift
1329
+ );
1330
+ },
1331
+
1332
+ unbless(ptr: UniffiGcObject) {
1333
+ ptr.markDestroyed();
1334
+ },
1335
+
1336
+ pointer(obj: EncoderInterface): UniffiHandle {
1337
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1338
+ throw new UniffiInternalError.UnexpectedNullPointer();
1339
+ }
1340
+ return (obj as any)[pointerLiteralSymbol];
1341
+ },
1342
+
1343
+ clonePointer(obj: EncoderInterface): UniffiHandle {
1344
+ const pointer = this.pointer(obj);
1345
+ return uniffiCaller.rustCall(
1346
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_encoder(pointer, callStatus),
1347
+ /*liftString:*/ FfiConverterString.lift
1348
+ );
1349
+ },
1350
+
1351
+ freePointer(pointer: UniffiHandle): void {
1352
+ uniffiCaller.rustCall(
1353
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_encoder(pointer, callStatus),
1354
+ /*liftString:*/ FfiConverterString.lift
1355
+ );
1356
+ },
1357
+
1358
+ isConcreteType(obj: any): obj is EncoderInterface {
1359
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "Encoder";
1360
+ },
1361
+ }})();
1362
+ // FfiConverter for EncoderInterface
1363
+ const FfiConverterTypeEncoder = new FfiConverterObject(uniffiTypeEncoderObjectFactory);
1364
+
1365
+
1366
+ export interface ModelInterface {
1367
+
1368
+ }
1369
+
1370
+
1371
+ export class Model extends UniffiAbstractObject implements ModelInterface {
1372
+
1373
+ readonly [uniffiTypeNameSymbol] = "Model";
1374
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1375
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1376
+ // No primary constructor declared for this class.
1377
+ private constructor(pointer: UniffiHandle) {
1378
+ super();
1379
+ this[pointerLiteralSymbol] = pointer;
1380
+ this[destructorGuardSymbol] = uniffiTypeModelObjectFactory.bless(pointer);
1381
+ }
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+ /**
1388
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1389
+ */
1390
+ uniffiDestroy(): void {
1391
+ const ptr = (this as any)[destructorGuardSymbol];
1392
+ if (ptr !== undefined) {
1393
+ const pointer = uniffiTypeModelObjectFactory.pointer(this);
1394
+ uniffiTypeModelObjectFactory.freePointer(pointer);
1395
+ uniffiTypeModelObjectFactory.unbless(ptr);
1396
+ delete (this as any)[destructorGuardSymbol];
1397
+ }
1398
+ }
1399
+
1400
+ static instanceOf(obj: any): obj is Model {
1401
+ return uniffiTypeModelObjectFactory.isConcreteType(obj);
1402
+ }
1403
+
1404
+
1405
+ }
1406
+
1407
+ const uniffiTypeModelObjectFactory: UniffiObjectFactory<ModelInterface> = (() => {
1408
+
1409
+ return {
1410
+ create(pointer: UniffiHandle): ModelInterface {
1411
+ const instance = Object.create(Model.prototype);
1412
+ instance[pointerLiteralSymbol] = pointer;
1413
+ instance[destructorGuardSymbol] = this.bless(pointer);
1414
+ instance[uniffiTypeNameSymbol] = "Model";
1415
+ return instance;
1416
+ },
1417
+
1418
+
1419
+ bless(p: UniffiHandle): UniffiGcObject {
1420
+ return uniffiCaller.rustCall(
1421
+ /*caller:*/ (status) =>
1422
+ nativeModule().ubrn_uniffi_internal_fn_method_model_ffi__bless_pointer(p, status),
1423
+ /*liftString:*/ FfiConverterString.lift
1424
+ );
1425
+ },
1426
+
1427
+ unbless(ptr: UniffiGcObject) {
1428
+ ptr.markDestroyed();
1429
+ },
1430
+
1431
+ pointer(obj: ModelInterface): UniffiHandle {
1432
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1433
+ throw new UniffiInternalError.UnexpectedNullPointer();
1434
+ }
1435
+ return (obj as any)[pointerLiteralSymbol];
1436
+ },
1437
+
1438
+ clonePointer(obj: ModelInterface): UniffiHandle {
1439
+ const pointer = this.pointer(obj);
1440
+ return uniffiCaller.rustCall(
1441
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_model(pointer, callStatus),
1442
+ /*liftString:*/ FfiConverterString.lift
1443
+ );
1444
+ },
1445
+
1446
+ freePointer(pointer: UniffiHandle): void {
1447
+ uniffiCaller.rustCall(
1448
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_model(pointer, callStatus),
1449
+ /*liftString:*/ FfiConverterString.lift
1450
+ );
1451
+ },
1452
+
1453
+ isConcreteType(obj: any): obj is ModelInterface {
1454
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "Model";
1455
+ },
1456
+ }})();
1457
+ // FfiConverter for ModelInterface
1458
+ const FfiConverterTypeModel = new FfiConverterObject(uniffiTypeModelObjectFactory);
1459
+
1460
+
1461
+ export interface RustChatInterface {
1462
+
1463
+ /**
1464
+ * Send a message and get a token stream for the response.
1465
+ */
1466
+ ask(message: string) : RustTokenStreamInterface;
1467
+ /**
1468
+ * Send a multimodal prompt (text + images/audio) and get a token stream.
1469
+ *
1470
+ * `parts` is an ordered list of `PromptPart` items.
1471
+ * Image and audio parts should contain a local file-system path.
1472
+ */
1473
+ askWithPrompt(parts: Array<PromptPart>) : RustTokenStreamInterface;
1474
+ /**
1475
+ * Get the current chat history as a list of messages.
1476
+ */
1477
+ getChatHistory(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Message>>;
1478
+ /**
1479
+ * Get the current sampler configuration as a JSON string.
1480
+ */
1481
+ getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1482
+ /**
1483
+ * Get the current system prompt.
1484
+ */
1485
+ getSystemPrompt(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
1486
+ /**
1487
+ * Get all template variables.
1488
+ */
1489
+ getTemplateVariables(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Map<string, boolean>>;
1490
+ /**
1491
+ * Reset the chat context with a new system prompt and tools.
1492
+ */
1493
+ resetContext(systemPrompt: string | undefined, tools: Array<RustToolInterface> | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1494
+ /**
1495
+ * Reset the chat history, keeping the system prompt and tools.
1496
+ */
1497
+ resetHistory(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1498
+ /**
1499
+ * Set the chat history from a list of messages.
1500
+ */
1501
+ setChatHistory(messages: Array<Message>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1502
+ /**
1503
+ * Set the sampler configuration.
1504
+ */
1505
+ setSamplerConfig(sampler: SamplerConfigInterface, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1506
+ /**
1507
+ * Set the system prompt.
1508
+ */
1509
+ setSystemPrompt(systemPrompt: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1510
+ /**
1511
+ * Set a template variable.
1512
+ */
1513
+ setTemplateVariable(name: string, value: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1514
+ /**
1515
+ * Set the tools available to the model.
1516
+ */
1517
+ setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
1518
+ /**
1519
+ * Stop the current generation.
1520
+ */
1521
+ stopGeneration() : void;
1522
+ }
1523
+
1524
+
1525
+ export class RustChat extends UniffiAbstractObject implements RustChatInterface {
1526
+
1527
+ readonly [uniffiTypeNameSymbol] = "RustChat";
1528
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1529
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1530
+ /**
1531
+ * Create a new chat session.
1532
+ */
1533
+ constructor(model: ModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) {
1534
+ super();
1535
+ const pointer =
1536
+ uniffiCaller.rustCall(
1537
+ /*caller:*/ (callStatus) => {
1538
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustchat_new(
1539
+ FfiConverterTypeModel.lower(model),
1540
+ FfiConverterOptionalString.lower(systemPrompt),
1541
+ FfiConverterUInt32.lower(contextSize),
1542
+ FfiConverterOptionalMapStringBool.lower(templateVariables),
1543
+ FfiConverterOptionalArrayTypeRustTool.lower(tools),
1544
+ FfiConverterOptionalTypeSamplerConfig.lower(sampler),
1545
+ callStatus);
1546
+ },
1547
+ /*liftString:*/ FfiConverterString.lift,
1548
+ );
1549
+ this[pointerLiteralSymbol] = pointer;
1550
+ this[destructorGuardSymbol] = uniffiTypeRustChatObjectFactory.bless(pointer);
1551
+ }
1552
+
1553
+
1554
+
1555
+
1556
+ /**
1557
+ * Send a message and get a token stream for the response.
1558
+ */
1559
+ ask(message: string): RustTokenStreamInterface {
1560
+ return FfiConverterTypeRustTokenStream.lift(uniffiCaller.rustCall(
1561
+ /*caller:*/ (callStatus) => {
1562
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_ask(uniffiTypeRustChatObjectFactory.clonePointer(this),
1563
+ FfiConverterString.lower(message),
1564
+ callStatus);
1565
+ },
1566
+ /*liftString:*/ FfiConverterString.lift,
1567
+ ));
1568
+ }
1569
+
1570
+ /**
1571
+ * Send a multimodal prompt (text + images/audio) and get a token stream.
1572
+ *
1573
+ * `parts` is an ordered list of `PromptPart` items.
1574
+ * Image and audio parts should contain a local file-system path.
1575
+ */
1576
+ askWithPrompt(parts: Array<PromptPart>): RustTokenStreamInterface {
1577
+ return FfiConverterTypeRustTokenStream.lift(uniffiCaller.rustCall(
1578
+ /*caller:*/ (callStatus) => {
1579
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_ask_with_prompt(uniffiTypeRustChatObjectFactory.clonePointer(this),
1580
+ FfiConverterArrayTypePromptPart.lower(parts),
1581
+ callStatus);
1582
+ },
1583
+ /*liftString:*/ FfiConverterString.lift,
1584
+ ));
1585
+ }
1586
+
1587
+ /**
1588
+ * Get the current chat history as a list of messages.
1589
+ */
1590
+ async getChatHistory(asyncOpts_?: { signal: AbortSignal }): Promise<Array<Message>> /*throws*/ {
1591
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1592
+ try {
1593
+ return await uniffiRustCallAsync(
1594
+ /*rustCaller:*/ uniffiCaller,
1595
+ /*rustFutureFunc:*/ () => {
1596
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_get_chat_history(
1597
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1598
+
1599
+ );
1600
+ },
1601
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1602
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1603
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1604
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1605
+ /*liftFunc:*/ FfiConverterArrayTypeMessage.lift.bind(FfiConverterArrayTypeMessage),
1606
+ /*liftString:*/ FfiConverterString.lift,
1607
+ /*asyncOpts:*/ asyncOpts_,
1608
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1609
+ );
1610
+ } catch (__error: any) {
1611
+ if (uniffiIsDebug && __error instanceof Error) {
1612
+ __error.stack = __stack;
1613
+ }
1614
+ throw __error;
1615
+ }
1616
+ }
1617
+
1618
+ /**
1619
+ * Get the current sampler configuration as a JSON string.
1620
+ */
1621
+ async getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
1622
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1623
+ try {
1624
+ return await uniffiRustCallAsync(
1625
+ /*rustCaller:*/ uniffiCaller,
1626
+ /*rustFutureFunc:*/ () => {
1627
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_get_sampler_config_json(
1628
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1629
+
1630
+ );
1631
+ },
1632
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1633
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1634
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1635
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1636
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
1637
+ /*liftString:*/ FfiConverterString.lift,
1638
+ /*asyncOpts:*/ asyncOpts_,
1639
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1640
+ );
1641
+ } catch (__error: any) {
1642
+ if (uniffiIsDebug && __error instanceof Error) {
1643
+ __error.stack = __stack;
1644
+ }
1645
+ throw __error;
1646
+ }
1647
+ }
1648
+
1649
+ /**
1650
+ * Get the current system prompt.
1651
+ */
1652
+ async getSystemPrompt(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
1653
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1654
+ try {
1655
+ return await uniffiRustCallAsync(
1656
+ /*rustCaller:*/ uniffiCaller,
1657
+ /*rustFutureFunc:*/ () => {
1658
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_get_system_prompt(
1659
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1660
+
1661
+ );
1662
+ },
1663
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1664
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1665
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1666
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1667
+ /*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
1668
+ /*liftString:*/ FfiConverterString.lift,
1669
+ /*asyncOpts:*/ asyncOpts_,
1670
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1671
+ );
1672
+ } catch (__error: any) {
1673
+ if (uniffiIsDebug && __error instanceof Error) {
1674
+ __error.stack = __stack;
1675
+ }
1676
+ throw __error;
1677
+ }
1678
+ }
1679
+
1680
+ /**
1681
+ * Get all template variables.
1682
+ */
1683
+ async getTemplateVariables(asyncOpts_?: { signal: AbortSignal }): Promise<Map<string, boolean>> /*throws*/ {
1684
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1685
+ try {
1686
+ return await uniffiRustCallAsync(
1687
+ /*rustCaller:*/ uniffiCaller,
1688
+ /*rustFutureFunc:*/ () => {
1689
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_get_template_variables(
1690
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1691
+
1692
+ );
1693
+ },
1694
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1695
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1696
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1697
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1698
+ /*liftFunc:*/ FfiConverterMapStringBool.lift.bind(FfiConverterMapStringBool),
1699
+ /*liftString:*/ FfiConverterString.lift,
1700
+ /*asyncOpts:*/ asyncOpts_,
1701
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1702
+ );
1703
+ } catch (__error: any) {
1704
+ if (uniffiIsDebug && __error instanceof Error) {
1705
+ __error.stack = __stack;
1706
+ }
1707
+ throw __error;
1708
+ }
1709
+ }
1710
+
1711
+ /**
1712
+ * Reset the chat context with a new system prompt and tools.
1713
+ */
1714
+ async resetContext(systemPrompt: string | undefined, tools: Array<RustToolInterface> | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1715
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1716
+ try {
1717
+ return await uniffiRustCallAsync(
1718
+ /*rustCaller:*/ uniffiCaller,
1719
+ /*rustFutureFunc:*/ () => {
1720
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_reset_context(
1721
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1722
+ FfiConverterOptionalString.lower(systemPrompt),FfiConverterOptionalArrayTypeRustTool.lower(tools)
1723
+ );
1724
+ },
1725
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1726
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1727
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1728
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1729
+ /*liftFunc:*/ (_v) => {},
1730
+ /*liftString:*/ FfiConverterString.lift,
1731
+ /*asyncOpts:*/ asyncOpts_,
1732
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1733
+ );
1734
+ } catch (__error: any) {
1735
+ if (uniffiIsDebug && __error instanceof Error) {
1736
+ __error.stack = __stack;
1737
+ }
1738
+ throw __error;
1739
+ }
1740
+ }
1741
+
1742
+ /**
1743
+ * Reset the chat history, keeping the system prompt and tools.
1744
+ */
1745
+ async resetHistory(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1746
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1747
+ try {
1748
+ return await uniffiRustCallAsync(
1749
+ /*rustCaller:*/ uniffiCaller,
1750
+ /*rustFutureFunc:*/ () => {
1751
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_reset_history(
1752
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1753
+
1754
+ );
1755
+ },
1756
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1757
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1758
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1759
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1760
+ /*liftFunc:*/ (_v) => {},
1761
+ /*liftString:*/ FfiConverterString.lift,
1762
+ /*asyncOpts:*/ asyncOpts_,
1763
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1764
+ );
1765
+ } catch (__error: any) {
1766
+ if (uniffiIsDebug && __error instanceof Error) {
1767
+ __error.stack = __stack;
1768
+ }
1769
+ throw __error;
1770
+ }
1771
+ }
1772
+
1773
+ /**
1774
+ * Set the chat history from a list of messages.
1775
+ */
1776
+ async setChatHistory(messages: Array<Message>, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1777
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1778
+ try {
1779
+ return await uniffiRustCallAsync(
1780
+ /*rustCaller:*/ uniffiCaller,
1781
+ /*rustFutureFunc:*/ () => {
1782
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_chat_history(
1783
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1784
+ FfiConverterArrayTypeMessage.lower(messages)
1785
+ );
1786
+ },
1787
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1788
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1789
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1790
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1791
+ /*liftFunc:*/ (_v) => {},
1792
+ /*liftString:*/ FfiConverterString.lift,
1793
+ /*asyncOpts:*/ asyncOpts_,
1794
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1795
+ );
1796
+ } catch (__error: any) {
1797
+ if (uniffiIsDebug && __error instanceof Error) {
1798
+ __error.stack = __stack;
1799
+ }
1800
+ throw __error;
1801
+ }
1802
+ }
1803
+
1804
+ /**
1805
+ * Set the sampler configuration.
1806
+ */
1807
+ async setSamplerConfig(sampler: SamplerConfigInterface, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1808
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1809
+ try {
1810
+ return await uniffiRustCallAsync(
1811
+ /*rustCaller:*/ uniffiCaller,
1812
+ /*rustFutureFunc:*/ () => {
1813
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_sampler_config(
1814
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1815
+ FfiConverterTypeSamplerConfig.lower(sampler)
1816
+ );
1817
+ },
1818
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1819
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1820
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1821
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1822
+ /*liftFunc:*/ (_v) => {},
1823
+ /*liftString:*/ FfiConverterString.lift,
1824
+ /*asyncOpts:*/ asyncOpts_,
1825
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1826
+ );
1827
+ } catch (__error: any) {
1828
+ if (uniffiIsDebug && __error instanceof Error) {
1829
+ __error.stack = __stack;
1830
+ }
1831
+ throw __error;
1832
+ }
1833
+ }
1834
+
1835
+ /**
1836
+ * Set the system prompt.
1837
+ */
1838
+ async setSystemPrompt(systemPrompt: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1839
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1840
+ try {
1841
+ return await uniffiRustCallAsync(
1842
+ /*rustCaller:*/ uniffiCaller,
1843
+ /*rustFutureFunc:*/ () => {
1844
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_system_prompt(
1845
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1846
+ FfiConverterOptionalString.lower(systemPrompt)
1847
+ );
1848
+ },
1849
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1850
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1851
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1852
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1853
+ /*liftFunc:*/ (_v) => {},
1854
+ /*liftString:*/ FfiConverterString.lift,
1855
+ /*asyncOpts:*/ asyncOpts_,
1856
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1857
+ );
1858
+ } catch (__error: any) {
1859
+ if (uniffiIsDebug && __error instanceof Error) {
1860
+ __error.stack = __stack;
1861
+ }
1862
+ throw __error;
1863
+ }
1864
+ }
1865
+
1866
+ /**
1867
+ * Set a template variable.
1868
+ */
1869
+ async setTemplateVariable(name: string, value: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1870
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1871
+ try {
1872
+ return await uniffiRustCallAsync(
1873
+ /*rustCaller:*/ uniffiCaller,
1874
+ /*rustFutureFunc:*/ () => {
1875
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_template_variable(
1876
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1877
+ FfiConverterString.lower(name),FfiConverterBool.lower(value)
1878
+ );
1879
+ },
1880
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1881
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1882
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1883
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1884
+ /*liftFunc:*/ (_v) => {},
1885
+ /*liftString:*/ FfiConverterString.lift,
1886
+ /*asyncOpts:*/ asyncOpts_,
1887
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1888
+ );
1889
+ } catch (__error: any) {
1890
+ if (uniffiIsDebug && __error instanceof Error) {
1891
+ __error.stack = __stack;
1892
+ }
1893
+ throw __error;
1894
+ }
1895
+ }
1896
+
1897
+ /**
1898
+ * Set the tools available to the model.
1899
+ */
1900
+ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1901
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1902
+ try {
1903
+ return await uniffiRustCallAsync(
1904
+ /*rustCaller:*/ uniffiCaller,
1905
+ /*rustFutureFunc:*/ () => {
1906
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_tools(
1907
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1908
+ FfiConverterArrayTypeRustTool.lower(tools)
1909
+ );
1910
+ },
1911
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1912
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1913
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1914
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1915
+ /*liftFunc:*/ (_v) => {},
1916
+ /*liftString:*/ FfiConverterString.lift,
1917
+ /*asyncOpts:*/ asyncOpts_,
1918
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1919
+ );
1920
+ } catch (__error: any) {
1921
+ if (uniffiIsDebug && __error instanceof Error) {
1922
+ __error.stack = __stack;
1923
+ }
1924
+ throw __error;
1925
+ }
1926
+ }
1927
+
1928
+ /**
1929
+ * Stop the current generation.
1930
+ */
1931
+ stopGeneration(): void {uniffiCaller.rustCall(
1932
+ /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_stop_generation(uniffiTypeRustChatObjectFactory.clonePointer(this),
1933
+ callStatus);
1934
+ },
1935
+ /*liftString:*/ FfiConverterString.lift,
1936
+ );
1937
+ }
1938
+
1939
+
1940
+ /**
1941
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1942
+ */
1943
+ uniffiDestroy(): void {
1944
+ const ptr = (this as any)[destructorGuardSymbol];
1945
+ if (ptr !== undefined) {
1946
+ const pointer = uniffiTypeRustChatObjectFactory.pointer(this);
1947
+ uniffiTypeRustChatObjectFactory.freePointer(pointer);
1948
+ uniffiTypeRustChatObjectFactory.unbless(ptr);
1949
+ delete (this as any)[destructorGuardSymbol];
1950
+ }
1951
+ }
1952
+
1953
+ static instanceOf(obj: any): obj is RustChat {
1954
+ return uniffiTypeRustChatObjectFactory.isConcreteType(obj);
1955
+ }
1956
+
1957
+
1958
+ }
1959
+
1960
+ const uniffiTypeRustChatObjectFactory: UniffiObjectFactory<RustChatInterface> = (() => {
1961
+
1962
+ return {
1963
+ create(pointer: UniffiHandle): RustChatInterface {
1964
+ const instance = Object.create(RustChat.prototype);
1965
+ instance[pointerLiteralSymbol] = pointer;
1966
+ instance[destructorGuardSymbol] = this.bless(pointer);
1967
+ instance[uniffiTypeNameSymbol] = "RustChat";
1968
+ return instance;
1969
+ },
1970
+
1971
+
1972
+ bless(p: UniffiHandle): UniffiGcObject {
1973
+ return uniffiCaller.rustCall(
1974
+ /*caller:*/ (status) =>
1975
+ nativeModule().ubrn_uniffi_internal_fn_method_rustchat_ffi__bless_pointer(p, status),
1976
+ /*liftString:*/ FfiConverterString.lift
1977
+ );
1978
+ },
1979
+
1980
+ unbless(ptr: UniffiGcObject) {
1981
+ ptr.markDestroyed();
1982
+ },
1983
+
1984
+ pointer(obj: RustChatInterface): UniffiHandle {
1985
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1986
+ throw new UniffiInternalError.UnexpectedNullPointer();
1987
+ }
1988
+ return (obj as any)[pointerLiteralSymbol];
1989
+ },
1990
+
1991
+ clonePointer(obj: RustChatInterface): UniffiHandle {
1992
+ const pointer = this.pointer(obj);
1993
+ return uniffiCaller.rustCall(
1994
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustchat(pointer, callStatus),
1995
+ /*liftString:*/ FfiConverterString.lift
1996
+ );
1997
+ },
1998
+
1999
+ freePointer(pointer: UniffiHandle): void {
2000
+ uniffiCaller.rustCall(
2001
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustchat(pointer, callStatus),
2002
+ /*liftString:*/ FfiConverterString.lift
2003
+ );
2004
+ },
2005
+
2006
+ isConcreteType(obj: any): obj is RustChatInterface {
2007
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustChat";
2008
+ },
2009
+ }})();
2010
+ // FfiConverter for RustChatInterface
2011
+ const FfiConverterTypeRustChat = new FfiConverterObject(uniffiTypeRustChatObjectFactory);
2012
+
2013
+
2014
+ export interface RustTokenStreamInterface {
2015
+
2016
+ /**
2017
+ * Wait for the full response to complete and return it.
2018
+ */
2019
+ completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
2020
+ /**
2021
+ * Get the next token. Returns None when generation is complete.
2022
+ */
2023
+ nextToken(asyncOpts_?: { signal: AbortSignal }) : Promise<string | undefined>;
2024
+ }
2025
+
2026
+
2027
+ export class RustTokenStream extends UniffiAbstractObject implements RustTokenStreamInterface {
2028
+
2029
+ readonly [uniffiTypeNameSymbol] = "RustTokenStream";
2030
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2031
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2032
+ // No primary constructor declared for this class.
2033
+ private constructor(pointer: UniffiHandle) {
2034
+ super();
2035
+ this[pointerLiteralSymbol] = pointer;
2036
+ this[destructorGuardSymbol] = uniffiTypeRustTokenStreamObjectFactory.bless(pointer);
2037
+ }
2038
+
2039
+
2040
+
2041
+
2042
+ /**
2043
+ * Wait for the full response to complete and return it.
2044
+ */
2045
+ async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
2046
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2047
+ try {
2048
+ return await uniffiRustCallAsync(
2049
+ /*rustCaller:*/ uniffiCaller,
2050
+ /*rustFutureFunc:*/ () => {
2051
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_completed(
2052
+ uniffiTypeRustTokenStreamObjectFactory.clonePointer(this)
2053
+
2054
+ );
2055
+ },
2056
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2057
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2058
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2059
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2060
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
2061
+ /*liftString:*/ FfiConverterString.lift,
2062
+ /*asyncOpts:*/ asyncOpts_,
2063
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2064
+ );
2065
+ } catch (__error: any) {
2066
+ if (uniffiIsDebug && __error instanceof Error) {
2067
+ __error.stack = __stack;
2068
+ }
2069
+ throw __error;
2070
+ }
2071
+ }
2072
+
2073
+ /**
2074
+ * Get the next token. Returns None when generation is complete.
2075
+ */
2076
+ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> {
2077
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2078
+ try {
2079
+ return await uniffiRustCallAsync(
2080
+ /*rustCaller:*/ uniffiCaller,
2081
+ /*rustFutureFunc:*/ () => {
2082
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_next_token(
2083
+ uniffiTypeRustTokenStreamObjectFactory.clonePointer(this)
2084
+
2085
+ );
2086
+ },
2087
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2088
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2089
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2090
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2091
+ /*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
2092
+ /*liftString:*/ FfiConverterString.lift,
2093
+ /*asyncOpts:*/ asyncOpts_,
2094
+
2095
+ );
2096
+ } catch (__error: any) {
2097
+ if (uniffiIsDebug && __error instanceof Error) {
2098
+ __error.stack = __stack;
2099
+ }
2100
+ throw __error;
2101
+ }
2102
+ }
2103
+
2104
+
2105
+ /**
2106
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2107
+ */
2108
+ uniffiDestroy(): void {
2109
+ const ptr = (this as any)[destructorGuardSymbol];
2110
+ if (ptr !== undefined) {
2111
+ const pointer = uniffiTypeRustTokenStreamObjectFactory.pointer(this);
2112
+ uniffiTypeRustTokenStreamObjectFactory.freePointer(pointer);
2113
+ uniffiTypeRustTokenStreamObjectFactory.unbless(ptr);
2114
+ delete (this as any)[destructorGuardSymbol];
2115
+ }
2116
+ }
2117
+
2118
+ static instanceOf(obj: any): obj is RustTokenStream {
2119
+ return uniffiTypeRustTokenStreamObjectFactory.isConcreteType(obj);
2120
+ }
2121
+
2122
+
2123
+ }
2124
+
2125
+ const uniffiTypeRustTokenStreamObjectFactory: UniffiObjectFactory<RustTokenStreamInterface> = (() => {
2126
+
2127
+ return {
2128
+ create(pointer: UniffiHandle): RustTokenStreamInterface {
2129
+ const instance = Object.create(RustTokenStream.prototype);
2130
+ instance[pointerLiteralSymbol] = pointer;
2131
+ instance[destructorGuardSymbol] = this.bless(pointer);
2132
+ instance[uniffiTypeNameSymbol] = "RustTokenStream";
2133
+ return instance;
2134
+ },
2135
+
2136
+
2137
+ bless(p: UniffiHandle): UniffiGcObject {
2138
+ return uniffiCaller.rustCall(
2139
+ /*caller:*/ (status) =>
2140
+ nativeModule().ubrn_uniffi_internal_fn_method_rusttokenstream_ffi__bless_pointer(p, status),
2141
+ /*liftString:*/ FfiConverterString.lift
2142
+ );
2143
+ },
2144
+
2145
+ unbless(ptr: UniffiGcObject) {
2146
+ ptr.markDestroyed();
2147
+ },
2148
+
2149
+ pointer(obj: RustTokenStreamInterface): UniffiHandle {
2150
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2151
+ throw new UniffiInternalError.UnexpectedNullPointer();
2152
+ }
2153
+ return (obj as any)[pointerLiteralSymbol];
2154
+ },
2155
+
2156
+ clonePointer(obj: RustTokenStreamInterface): UniffiHandle {
2157
+ const pointer = this.pointer(obj);
2158
+ return uniffiCaller.rustCall(
2159
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rusttokenstream(pointer, callStatus),
2160
+ /*liftString:*/ FfiConverterString.lift
2161
+ );
2162
+ },
2163
+
2164
+ freePointer(pointer: UniffiHandle): void {
2165
+ uniffiCaller.rustCall(
2166
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rusttokenstream(pointer, callStatus),
2167
+ /*liftString:*/ FfiConverterString.lift
2168
+ );
2169
+ },
2170
+
2171
+ isConcreteType(obj: any): obj is RustTokenStreamInterface {
2172
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustTokenStream";
2173
+ },
2174
+ }})();
2175
+ // FfiConverter for RustTokenStreamInterface
2176
+ const FfiConverterTypeRustTokenStream = new FfiConverterObject(uniffiTypeRustTokenStreamObjectFactory);
2177
+
2178
+
2179
+ export interface RustToolInterface {
2180
+
2181
+ /**
2182
+ * Get the JSON schema for this tool's parameters as a string.
2183
+ */
2184
+ getSchemaJson() : string;
2185
+ }
2186
+
2187
+
2188
+ export class RustTool extends UniffiAbstractObject implements RustToolInterface {
2189
+
2190
+ readonly [uniffiTypeNameSymbol] = "RustTool";
2191
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2192
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2193
+ /**
2194
+ * Create a tool that the model can call during inference.
2195
+ *
2196
+ * `parameters` is an ordered list of parameter definitions.
2197
+ * Each entry has a `name` and a `type` (e.g. `"string"`, `"integer"`, `"number"`, `"boolean"`).
2198
+ * The order matters — binding layers use it to map positional arguments
2199
+ * in the user's callback function to named JSON parameters.
2200
+ *
2201
+ * Supported types: `"string"`, `"integer"` / `"int"`, `"number"` / `"float"` / `"double"`,
2202
+ * `"boolean"` / `"bool"`.
2203
+ * A JSON schema is generated automatically from this list.
2204
+ *
2205
+ * The callback receives the model's arguments as a JSON string
2206
+ * (e.g. `{"city": "London", "degrees": 22}`).
2207
+ * Each binding layer wraps the user's function to parse this JSON and
2208
+ * pass individual typed arguments to the original function.
2209
+ */
2210
+ constructor(name: string, description: string, parameters: Array<ToolParameter>, callback: RustToolCallback) {
2211
+ super();
2212
+ const pointer =
2213
+ uniffiCaller.rustCall(
2214
+ /*caller:*/ (callStatus) => {
2215
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rusttool_new(
2216
+ FfiConverterString.lower(name),
2217
+ FfiConverterString.lower(description),
2218
+ FfiConverterArrayTypeToolParameter.lower(parameters),
2219
+ FfiConverterTypeRustToolCallback.lower(callback),
2220
+ callStatus);
2221
+ },
2222
+ /*liftString:*/ FfiConverterString.lift,
2223
+ );
2224
+ this[pointerLiteralSymbol] = pointer;
2225
+ this[destructorGuardSymbol] = uniffiTypeRustToolObjectFactory.bless(pointer);
2226
+ }
2227
+
2228
+
2229
+
2230
+
2231
+ /**
2232
+ * Get the JSON schema for this tool's parameters as a string.
2233
+ */
2234
+ getSchemaJson(): string {
2235
+ return FfiConverterString.lift(uniffiCaller.rustCall(
2236
+ /*caller:*/ (callStatus) => {
2237
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttool_get_schema_json(uniffiTypeRustToolObjectFactory.clonePointer(this),
2238
+ callStatus);
2239
+ },
2240
+ /*liftString:*/ FfiConverterString.lift,
2241
+ ));
2242
+ }
2243
+
2244
+
2245
+ /**
2246
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2247
+ */
2248
+ uniffiDestroy(): void {
2249
+ const ptr = (this as any)[destructorGuardSymbol];
2250
+ if (ptr !== undefined) {
2251
+ const pointer = uniffiTypeRustToolObjectFactory.pointer(this);
2252
+ uniffiTypeRustToolObjectFactory.freePointer(pointer);
2253
+ uniffiTypeRustToolObjectFactory.unbless(ptr);
2254
+ delete (this as any)[destructorGuardSymbol];
2255
+ }
2256
+ }
2257
+
2258
+ static instanceOf(obj: any): obj is RustTool {
2259
+ return uniffiTypeRustToolObjectFactory.isConcreteType(obj);
2260
+ }
2261
+
2262
+
2263
+ }
2264
+
2265
+ const uniffiTypeRustToolObjectFactory: UniffiObjectFactory<RustToolInterface> = (() => {
2266
+
2267
+ return {
2268
+ create(pointer: UniffiHandle): RustToolInterface {
2269
+ const instance = Object.create(RustTool.prototype);
2270
+ instance[pointerLiteralSymbol] = pointer;
2271
+ instance[destructorGuardSymbol] = this.bless(pointer);
2272
+ instance[uniffiTypeNameSymbol] = "RustTool";
2273
+ return instance;
2274
+ },
2275
+
2276
+
2277
+ bless(p: UniffiHandle): UniffiGcObject {
2278
+ return uniffiCaller.rustCall(
2279
+ /*caller:*/ (status) =>
2280
+ nativeModule().ubrn_uniffi_internal_fn_method_rusttool_ffi__bless_pointer(p, status),
2281
+ /*liftString:*/ FfiConverterString.lift
2282
+ );
2283
+ },
2284
+
2285
+ unbless(ptr: UniffiGcObject) {
2286
+ ptr.markDestroyed();
2287
+ },
2288
+
2289
+ pointer(obj: RustToolInterface): UniffiHandle {
2290
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2291
+ throw new UniffiInternalError.UnexpectedNullPointer();
2292
+ }
2293
+ return (obj as any)[pointerLiteralSymbol];
2294
+ },
2295
+
2296
+ clonePointer(obj: RustToolInterface): UniffiHandle {
2297
+ const pointer = this.pointer(obj);
2298
+ return uniffiCaller.rustCall(
2299
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rusttool(pointer, callStatus),
2300
+ /*liftString:*/ FfiConverterString.lift
2301
+ );
2302
+ },
2303
+
2304
+ freePointer(pointer: UniffiHandle): void {
2305
+ uniffiCaller.rustCall(
2306
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rusttool(pointer, callStatus),
2307
+ /*liftString:*/ FfiConverterString.lift
2308
+ );
2309
+ },
2310
+
2311
+ isConcreteType(obj: any): obj is RustToolInterface {
2312
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustTool";
2313
+ },
2314
+ }})();
2315
+ // FfiConverter for RustToolInterface
2316
+ const FfiConverterTypeRustTool = new FfiConverterObject(uniffiTypeRustToolObjectFactory);
2317
+
2318
+
2319
+ export interface SamplerBuilderInterface {
2320
+
2321
+ /**
2322
+ * Sample from the probability distribution (weighted random selection).
2323
+ */
2324
+ dist() : SamplerConfigInterface;
2325
+ /**
2326
+ * DRY (Don't Repeat Yourself) sampler to reduce repetition.
2327
+ */
2328
+ dry(multiplier: /*f32*/number, base: /*f32*/number, allowedLength: /*i32*/number, penaltyLastN: /*i32*/number, seqBreakers: Array<string>) : SamplerBuilderInterface;
2329
+ /**
2330
+ * Apply a grammar constraint to enforce structured output.
2331
+ */
2332
+ grammar(grammar: string, triggerOn: string | undefined, root: string) : SamplerBuilderInterface;
2333
+ /**
2334
+ * Always select the most probable token (deterministic).
2335
+ */
2336
+ greedy() : SamplerConfigInterface;
2337
+ /**
2338
+ * Keep tokens with probability above min_p * (probability of most likely token).
2339
+ */
2340
+ minP(minP: /*f32*/number, minKeep: /*u32*/number) : SamplerBuilderInterface;
2341
+ /**
2342
+ * Use Mirostat v1 algorithm for perplexity-controlled sampling.
2343
+ */
2344
+ mirostatV1(tau: /*f32*/number, eta: /*f32*/number, m: /*i32*/number) : SamplerConfigInterface;
2345
+ /**
2346
+ * Use Mirostat v2 algorithm for perplexity-controlled sampling.
2347
+ */
2348
+ mirostatV2(tau: /*f32*/number, eta: /*f32*/number) : SamplerConfigInterface;
2349
+ /**
2350
+ * Apply repetition penalties to discourage repeated tokens.
2351
+ */
2352
+ penalties(penaltyLastN: /*i32*/number, penaltyRepeat: /*f32*/number, penaltyFreq: /*f32*/number, penaltyPresent: /*f32*/number) : SamplerBuilderInterface;
2353
+ /**
2354
+ * Apply temperature scaling to the probability distribution.
2355
+ */
2356
+ temperature(temperature: /*f32*/number) : SamplerBuilderInterface;
2357
+ /**
2358
+ * Keep only the top K most probable tokens.
2359
+ */
2360
+ topK(topK: /*i32*/number) : SamplerBuilderInterface;
2361
+ /**
2362
+ * Keep tokens whose cumulative probability is below top_p.
2363
+ */
2364
+ topP(topP: /*f32*/number, minKeep: /*u32*/number) : SamplerBuilderInterface;
2365
+ /**
2366
+ * Typical sampling: keeps tokens close to expected information content.
2367
+ */
2368
+ typicalP(typP: /*f32*/number, minKeep: /*u32*/number) : SamplerBuilderInterface;
2369
+ /**
2370
+ * XTC sampler that probabilistically excludes high-probability tokens.
2371
+ */
2372
+ xtc(xtcProbability: /*f32*/number, xtcThreshold: /*f32*/number, minKeep: /*u32*/number) : SamplerBuilderInterface;
2373
+ }
2374
+
2375
+
2376
+ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuilderInterface {
2377
+
2378
+ readonly [uniffiTypeNameSymbol] = "SamplerBuilder";
2379
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2380
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2381
+ /**
2382
+ * Create a new SamplerBuilder to construct a custom sampler chain.
2383
+ */
2384
+ constructor() {
2385
+ super();
2386
+ const pointer =
2387
+ uniffiCaller.rustCall(
2388
+ /*caller:*/ (callStatus) => {
2389
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_samplerbuilder_new(
2390
+ callStatus);
2391
+ },
2392
+ /*liftString:*/ FfiConverterString.lift,
2393
+ );
2394
+ this[pointerLiteralSymbol] = pointer;
2395
+ this[destructorGuardSymbol] = uniffiTypeSamplerBuilderObjectFactory.bless(pointer);
2396
+ }
2397
+
2398
+
2399
+
2400
+
2401
+ /**
2402
+ * Sample from the probability distribution (weighted random selection).
2403
+ */
2404
+ dist(): SamplerConfigInterface {
2405
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
2406
+ /*caller:*/ (callStatus) => {
2407
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_dist(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2408
+ callStatus);
2409
+ },
2410
+ /*liftString:*/ FfiConverterString.lift,
2411
+ ));
2412
+ }
2413
+
2414
+ /**
2415
+ * DRY (Don't Repeat Yourself) sampler to reduce repetition.
2416
+ */
2417
+ dry(multiplier: /*f32*/number, base: /*f32*/number, allowedLength: /*i32*/number, penaltyLastN: /*i32*/number, seqBreakers: Array<string>): SamplerBuilderInterface {
2418
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2419
+ /*caller:*/ (callStatus) => {
2420
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_dry(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2421
+ FfiConverterFloat32.lower(multiplier),
2422
+ FfiConverterFloat32.lower(base),
2423
+ FfiConverterInt32.lower(allowedLength),
2424
+ FfiConverterInt32.lower(penaltyLastN),
2425
+ FfiConverterArrayString.lower(seqBreakers),
2426
+ callStatus);
2427
+ },
2428
+ /*liftString:*/ FfiConverterString.lift,
2429
+ ));
2430
+ }
2431
+
2432
+ /**
2433
+ * Apply a grammar constraint to enforce structured output.
2434
+ */
2435
+ grammar(grammar: string, triggerOn: string | undefined, root: string): SamplerBuilderInterface {
2436
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2437
+ /*caller:*/ (callStatus) => {
2438
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_grammar(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2439
+ FfiConverterString.lower(grammar),
2440
+ FfiConverterOptionalString.lower(triggerOn),
2441
+ FfiConverterString.lower(root),
2442
+ callStatus);
2443
+ },
2444
+ /*liftString:*/ FfiConverterString.lift,
2445
+ ));
2446
+ }
2447
+
2448
+ /**
2449
+ * Always select the most probable token (deterministic).
2450
+ */
2451
+ greedy(): SamplerConfigInterface {
2452
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
2453
+ /*caller:*/ (callStatus) => {
2454
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_greedy(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2455
+ callStatus);
2456
+ },
2457
+ /*liftString:*/ FfiConverterString.lift,
2458
+ ));
2459
+ }
2460
+
2461
+ /**
2462
+ * Keep tokens with probability above min_p * (probability of most likely token).
2463
+ */
2464
+ minP(minP: /*f32*/number, minKeep: /*u32*/number): SamplerBuilderInterface {
2465
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2466
+ /*caller:*/ (callStatus) => {
2467
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_min_p(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2468
+ FfiConverterFloat32.lower(minP),
2469
+ FfiConverterUInt32.lower(minKeep),
2470
+ callStatus);
2471
+ },
2472
+ /*liftString:*/ FfiConverterString.lift,
2473
+ ));
2474
+ }
2475
+
2476
+ /**
2477
+ * Use Mirostat v1 algorithm for perplexity-controlled sampling.
2478
+ */
2479
+ mirostatV1(tau: /*f32*/number, eta: /*f32*/number, m: /*i32*/number): SamplerConfigInterface {
2480
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
2481
+ /*caller:*/ (callStatus) => {
2482
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_mirostat_v1(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2483
+ FfiConverterFloat32.lower(tau),
2484
+ FfiConverterFloat32.lower(eta),
2485
+ FfiConverterInt32.lower(m),
2486
+ callStatus);
2487
+ },
2488
+ /*liftString:*/ FfiConverterString.lift,
2489
+ ));
2490
+ }
2491
+
2492
+ /**
2493
+ * Use Mirostat v2 algorithm for perplexity-controlled sampling.
2494
+ */
2495
+ mirostatV2(tau: /*f32*/number, eta: /*f32*/number): SamplerConfigInterface {
2496
+ return FfiConverterTypeSamplerConfig.lift(uniffiCaller.rustCall(
2497
+ /*caller:*/ (callStatus) => {
2498
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_mirostat_v2(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2499
+ FfiConverterFloat32.lower(tau),
2500
+ FfiConverterFloat32.lower(eta),
2501
+ callStatus);
2502
+ },
2503
+ /*liftString:*/ FfiConverterString.lift,
2504
+ ));
2505
+ }
2506
+
2507
+ /**
2508
+ * Apply repetition penalties to discourage repeated tokens.
2509
+ */
2510
+ penalties(penaltyLastN: /*i32*/number, penaltyRepeat: /*f32*/number, penaltyFreq: /*f32*/number, penaltyPresent: /*f32*/number): SamplerBuilderInterface {
2511
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2512
+ /*caller:*/ (callStatus) => {
2513
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_penalties(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2514
+ FfiConverterInt32.lower(penaltyLastN),
2515
+ FfiConverterFloat32.lower(penaltyRepeat),
2516
+ FfiConverterFloat32.lower(penaltyFreq),
2517
+ FfiConverterFloat32.lower(penaltyPresent),
2518
+ callStatus);
2519
+ },
2520
+ /*liftString:*/ FfiConverterString.lift,
2521
+ ));
2522
+ }
2523
+
2524
+ /**
2525
+ * Apply temperature scaling to the probability distribution.
2526
+ */
2527
+ temperature(temperature: /*f32*/number): SamplerBuilderInterface {
2528
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2529
+ /*caller:*/ (callStatus) => {
2530
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_temperature(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2531
+ FfiConverterFloat32.lower(temperature),
2532
+ callStatus);
2533
+ },
2534
+ /*liftString:*/ FfiConverterString.lift,
2535
+ ));
2536
+ }
2537
+
2538
+ /**
2539
+ * Keep only the top K most probable tokens.
2540
+ */
2541
+ topK(topK: /*i32*/number): SamplerBuilderInterface {
2542
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2543
+ /*caller:*/ (callStatus) => {
2544
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_top_k(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2545
+ FfiConverterInt32.lower(topK),
2546
+ callStatus);
2547
+ },
2548
+ /*liftString:*/ FfiConverterString.lift,
2549
+ ));
2550
+ }
2551
+
2552
+ /**
2553
+ * Keep tokens whose cumulative probability is below top_p.
2554
+ */
2555
+ topP(topP: /*f32*/number, minKeep: /*u32*/number): SamplerBuilderInterface {
2556
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2557
+ /*caller:*/ (callStatus) => {
2558
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_top_p(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2559
+ FfiConverterFloat32.lower(topP),
2560
+ FfiConverterUInt32.lower(minKeep),
2561
+ callStatus);
2562
+ },
2563
+ /*liftString:*/ FfiConverterString.lift,
2564
+ ));
2565
+ }
2566
+
2567
+ /**
2568
+ * Typical sampling: keeps tokens close to expected information content.
2569
+ */
2570
+ typicalP(typP: /*f32*/number, minKeep: /*u32*/number): SamplerBuilderInterface {
2571
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2572
+ /*caller:*/ (callStatus) => {
2573
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_typical_p(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2574
+ FfiConverterFloat32.lower(typP),
2575
+ FfiConverterUInt32.lower(minKeep),
2576
+ callStatus);
2577
+ },
2578
+ /*liftString:*/ FfiConverterString.lift,
2579
+ ));
2580
+ }
2581
+
2582
+ /**
2583
+ * XTC sampler that probabilistically excludes high-probability tokens.
2584
+ */
2585
+ xtc(xtcProbability: /*f32*/number, xtcThreshold: /*f32*/number, minKeep: /*u32*/number): SamplerBuilderInterface {
2586
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
2587
+ /*caller:*/ (callStatus) => {
2588
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_xtc(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
2589
+ FfiConverterFloat32.lower(xtcProbability),
2590
+ FfiConverterFloat32.lower(xtcThreshold),
2591
+ FfiConverterUInt32.lower(minKeep),
2592
+ callStatus);
2593
+ },
2594
+ /*liftString:*/ FfiConverterString.lift,
2595
+ ));
2596
+ }
2597
+
2598
+
2599
+ /**
2600
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2601
+ */
2602
+ uniffiDestroy(): void {
2603
+ const ptr = (this as any)[destructorGuardSymbol];
2604
+ if (ptr !== undefined) {
2605
+ const pointer = uniffiTypeSamplerBuilderObjectFactory.pointer(this);
2606
+ uniffiTypeSamplerBuilderObjectFactory.freePointer(pointer);
2607
+ uniffiTypeSamplerBuilderObjectFactory.unbless(ptr);
2608
+ delete (this as any)[destructorGuardSymbol];
2609
+ }
2610
+ }
2611
+
2612
+ static instanceOf(obj: any): obj is SamplerBuilder {
2613
+ return uniffiTypeSamplerBuilderObjectFactory.isConcreteType(obj);
2614
+ }
2615
+
2616
+
2617
+ }
2618
+
2619
+ const uniffiTypeSamplerBuilderObjectFactory: UniffiObjectFactory<SamplerBuilderInterface> = (() => {
2620
+
2621
+ return {
2622
+ create(pointer: UniffiHandle): SamplerBuilderInterface {
2623
+ const instance = Object.create(SamplerBuilder.prototype);
2624
+ instance[pointerLiteralSymbol] = pointer;
2625
+ instance[destructorGuardSymbol] = this.bless(pointer);
2626
+ instance[uniffiTypeNameSymbol] = "SamplerBuilder";
2627
+ return instance;
2628
+ },
2629
+
2630
+
2631
+ bless(p: UniffiHandle): UniffiGcObject {
2632
+ return uniffiCaller.rustCall(
2633
+ /*caller:*/ (status) =>
2634
+ nativeModule().ubrn_uniffi_internal_fn_method_samplerbuilder_ffi__bless_pointer(p, status),
2635
+ /*liftString:*/ FfiConverterString.lift
2636
+ );
2637
+ },
2638
+
2639
+ unbless(ptr: UniffiGcObject) {
2640
+ ptr.markDestroyed();
2641
+ },
2642
+
2643
+ pointer(obj: SamplerBuilderInterface): UniffiHandle {
2644
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2645
+ throw new UniffiInternalError.UnexpectedNullPointer();
2646
+ }
2647
+ return (obj as any)[pointerLiteralSymbol];
2648
+ },
2649
+
2650
+ clonePointer(obj: SamplerBuilderInterface): UniffiHandle {
2651
+ const pointer = this.pointer(obj);
2652
+ return uniffiCaller.rustCall(
2653
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_samplerbuilder(pointer, callStatus),
2654
+ /*liftString:*/ FfiConverterString.lift
2655
+ );
2656
+ },
2657
+
2658
+ freePointer(pointer: UniffiHandle): void {
2659
+ uniffiCaller.rustCall(
2660
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_samplerbuilder(pointer, callStatus),
2661
+ /*liftString:*/ FfiConverterString.lift
2662
+ );
2663
+ },
2664
+
2665
+ isConcreteType(obj: any): obj is SamplerBuilderInterface {
2666
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "SamplerBuilder";
2667
+ },
2668
+ }})();
2669
+ // FfiConverter for SamplerBuilderInterface
2670
+ const FfiConverterTypeSamplerBuilder = new FfiConverterObject(uniffiTypeSamplerBuilderObjectFactory);
2671
+
2672
+
2673
+ export interface SamplerConfigInterface {
2674
+
2675
+ /**
2676
+ * Serialize the sampler configuration to a JSON string.
2677
+ */
2678
+ toJson() /*throws*/: string;
2679
+ }
2680
+
2681
+
2682
+ export class SamplerConfig extends UniffiAbstractObject implements SamplerConfigInterface {
2683
+
2684
+ readonly [uniffiTypeNameSymbol] = "SamplerConfig";
2685
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2686
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2687
+ // No primary constructor declared for this class.
2688
+ private constructor(pointer: UniffiHandle) {
2689
+ super();
2690
+ this[pointerLiteralSymbol] = pointer;
2691
+ this[destructorGuardSymbol] = uniffiTypeSamplerConfigObjectFactory.bless(pointer);
2692
+ }
2693
+
2694
+
2695
+ /**
2696
+ * Deserialize a sampler configuration from a JSON string.
2697
+ */
2698
+ static fromJson(jsonStr: string): SamplerConfigInterface /*throws*/ {
2699
+ return FfiConverterTypeSamplerConfig.lift(
2700
+ uniffiCaller.rustCallWithError(
2701
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2702
+ /*caller:*/ (callStatus) => {
2703
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_samplerconfig_from_json(
2704
+ FfiConverterString.lower(jsonStr),
2705
+ callStatus);
2706
+ },
2707
+ /*liftString:*/ FfiConverterString.lift,
2708
+ ));
2709
+ }
2710
+
2711
+
2712
+
2713
+ /**
2714
+ * Serialize the sampler configuration to a JSON string.
2715
+ */
2716
+ toJson(): string /*throws*/ {
2717
+ return FfiConverterString.lift(
2718
+ uniffiCaller.rustCallWithError(
2719
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2720
+ /*caller:*/ (callStatus) => {
2721
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerconfig_to_json(uniffiTypeSamplerConfigObjectFactory.clonePointer(this),
2722
+ callStatus);
2723
+ },
2724
+ /*liftString:*/ FfiConverterString.lift,
2725
+ ));
2726
+ }
2727
+
2728
+
2729
+ /**
2730
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2731
+ */
2732
+ uniffiDestroy(): void {
2733
+ const ptr = (this as any)[destructorGuardSymbol];
2734
+ if (ptr !== undefined) {
2735
+ const pointer = uniffiTypeSamplerConfigObjectFactory.pointer(this);
2736
+ uniffiTypeSamplerConfigObjectFactory.freePointer(pointer);
2737
+ uniffiTypeSamplerConfigObjectFactory.unbless(ptr);
2738
+ delete (this as any)[destructorGuardSymbol];
2739
+ }
2740
+ }
2741
+
2742
+ static instanceOf(obj: any): obj is SamplerConfig {
2743
+ return uniffiTypeSamplerConfigObjectFactory.isConcreteType(obj);
2744
+ }
2745
+
2746
+
2747
+ }
2748
+
2749
+ const uniffiTypeSamplerConfigObjectFactory: UniffiObjectFactory<SamplerConfigInterface> = (() => {
2750
+
2751
+ return {
2752
+ create(pointer: UniffiHandle): SamplerConfigInterface {
2753
+ const instance = Object.create(SamplerConfig.prototype);
2754
+ instance[pointerLiteralSymbol] = pointer;
2755
+ instance[destructorGuardSymbol] = this.bless(pointer);
2756
+ instance[uniffiTypeNameSymbol] = "SamplerConfig";
2757
+ return instance;
2758
+ },
2759
+
2760
+
2761
+ bless(p: UniffiHandle): UniffiGcObject {
2762
+ return uniffiCaller.rustCall(
2763
+ /*caller:*/ (status) =>
2764
+ nativeModule().ubrn_uniffi_internal_fn_method_samplerconfig_ffi__bless_pointer(p, status),
2765
+ /*liftString:*/ FfiConverterString.lift
2766
+ );
2767
+ },
2768
+
2769
+ unbless(ptr: UniffiGcObject) {
2770
+ ptr.markDestroyed();
2771
+ },
2772
+
2773
+ pointer(obj: SamplerConfigInterface): UniffiHandle {
2774
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2775
+ throw new UniffiInternalError.UnexpectedNullPointer();
2776
+ }
2777
+ return (obj as any)[pointerLiteralSymbol];
2778
+ },
2779
+
2780
+ clonePointer(obj: SamplerConfigInterface): UniffiHandle {
2781
+ const pointer = this.pointer(obj);
2782
+ return uniffiCaller.rustCall(
2783
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_samplerconfig(pointer, callStatus),
2784
+ /*liftString:*/ FfiConverterString.lift
2785
+ );
2786
+ },
2787
+
2788
+ freePointer(pointer: UniffiHandle): void {
2789
+ uniffiCaller.rustCall(
2790
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_samplerconfig(pointer, callStatus),
2791
+ /*liftString:*/ FfiConverterString.lift
2792
+ );
2793
+ },
2794
+
2795
+ isConcreteType(obj: any): obj is SamplerConfigInterface {
2796
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "SamplerConfig";
2797
+ },
2798
+ }})();
2799
+ // FfiConverter for SamplerConfigInterface
2800
+ const FfiConverterTypeSamplerConfig = new FfiConverterObject(uniffiTypeSamplerConfigObjectFactory);
2801
+
2802
+
2803
+ // FfiConverter for string | undefined
2804
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
2805
+
2806
+
2807
+ // FfiConverter for /*u32*/number | undefined
2808
+ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
2809
+
2810
+
2811
+ // FfiConverter for Array</*f32*/number>
2812
+ const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
2813
+
2814
+
2815
+ // FfiConverter for Array<Asset>
2816
+ const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
2817
+
2818
+
2819
+ // FfiConverter for Array<ToolCall>
2820
+ const FfiConverterArrayTypeToolCall = new FfiConverterArray(FfiConverterTypeToolCall);
2821
+
2822
+
2823
+ // FfiConverter for Array<ToolParameter>
2824
+ const FfiConverterArrayTypeToolParameter = new FfiConverterArray(FfiConverterTypeToolParameter);
2825
+
2826
+
2827
+ // FfiConverter for Array<string>
2828
+ const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
2829
+
2830
+
2831
+ // FfiConverter for Map<string, boolean> | undefined
2832
+ const FfiConverterOptionalMapStringBool = new FfiConverterOptional(FfiConverterMapStringBool);
2833
+
2834
+
2835
+ // FfiConverter for SamplerConfigInterface | undefined
2836
+ const FfiConverterOptionalTypeSamplerConfig = new FfiConverterOptional(FfiConverterTypeSamplerConfig);
2837
+
2838
+
2839
+ // FfiConverter for Array<Message>
2840
+ const FfiConverterArrayTypeMessage = new FfiConverterArray(FfiConverterTypeMessage);
2841
+
2842
+
2843
+ // FfiConverter for Array<PromptPart>
2844
+ const FfiConverterArrayTypePromptPart = new FfiConverterArray(FfiConverterTypePromptPart);
2845
+
2846
+
2847
+ // FfiConverter for Array<RustToolInterface>
2848
+ const FfiConverterArrayTypeRustTool = new FfiConverterArray(FfiConverterTypeRustTool);
2849
+
2850
+
2851
+ // FfiConverter for Array<RustToolInterface> | undefined
2852
+ const FfiConverterOptionalArrayTypeRustTool = new FfiConverterOptional(FfiConverterArrayTypeRustTool);
2853
+
2854
+ /**
2855
+ * This should be called before anything else.
2856
+ *
2857
+ * It is likely that this is being done for you by the library's `index.ts`.
2858
+ *
2859
+ * It checks versions of uniffi between when the Rust scaffolding was generated
2860
+ * and when the bindings were generated.
2861
+ *
2862
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
2863
+ */
2864
+ function uniffiEnsureInitialized() {
2865
+ // Get the bindings contract version from our ComponentInterface
2866
+ const bindingsContractVersion = 30;
2867
+ // Get the scaffolding contract version by calling the into the dylib
2868
+ const scaffoldingContractVersion = nativeModule().ubrn_ffi_nobodywho_uniffi_uniffi_contract_version();
2869
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
2870
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
2871
+ }
2872
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity() !== 63439) {
2873
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_cosine_similarity");
2874
+ }
2875
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 19243) {
2876
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
2877
+ }
2878
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default() !== 10834) {
2879
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default");
2880
+ }
2881
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_dry() !== 55378) {
2882
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_dry");
2883
+ }
2884
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_grammar() !== 29288) {
2885
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_grammar");
2886
+ }
2887
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_greedy() !== 13219) {
2888
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_greedy");
2889
+ }
2890
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_json() !== 40006) {
2891
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_json");
2892
+ }
2893
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_temperature() !== 64803) {
2894
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_temperature");
2895
+ }
2896
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_top_k() !== 44137) {
2897
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_top_k");
2898
+ }
2899
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_top_p() !== 54893) {
2900
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_top_p");
2901
+ }
2902
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank() !== 14399) {
2903
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank");
2904
+ }
2905
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank_and_sort_json() !== 4173) {
2906
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank_and_sort_json");
2907
+ }
2908
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_encoder_encode() !== 21765) {
2909
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_encoder_encode");
2910
+ }
2911
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask() !== 53575) {
2912
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask");
2913
+ }
2914
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt() !== 65089) {
2915
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt");
2916
+ }
2917
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_chat_history() !== 12722) {
2918
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_chat_history");
2919
+ }
2920
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json() !== 33078) {
2921
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json");
2922
+ }
2923
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt() !== 57727) {
2924
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt");
2925
+ }
2926
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_template_variables() !== 19616) {
2927
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_template_variables");
2928
+ }
2929
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_reset_context() !== 47191) {
2930
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_reset_context");
2931
+ }
2932
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_reset_history() !== 12058) {
2933
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_reset_history");
2934
+ }
2935
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_set_chat_history() !== 6058) {
2936
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_set_chat_history");
2937
+ }
2938
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_set_sampler_config() !== 28012) {
2939
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_set_sampler_config");
2940
+ }
2941
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_set_system_prompt() !== 31690) {
2942
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_set_system_prompt");
2943
+ }
2944
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_set_template_variable() !== 64000) {
2945
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_set_template_variable");
2946
+ }
2947
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_set_tools() !== 55680) {
2948
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_set_tools");
2949
+ }
2950
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation() !== 24711) {
2951
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation");
2952
+ }
2953
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
2954
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
2955
+ }
2956
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token() !== 44770) {
2957
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_next_token");
2958
+ }
2959
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_get_schema_json() !== 4679) {
2960
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttool_get_schema_json");
2961
+ }
2962
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist() !== 23376) {
2963
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist");
2964
+ }
2965
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dry() !== 35315) {
2966
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dry");
2967
+ }
2968
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar() !== 24369) {
2969
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar");
2970
+ }
2971
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_greedy() !== 32898) {
2972
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_greedy");
2973
+ }
2974
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_min_p() !== 33705) {
2975
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_min_p");
2976
+ }
2977
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v1() !== 58563) {
2978
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v1");
2979
+ }
2980
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v2() !== 41682) {
2981
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_mirostat_v2");
2982
+ }
2983
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties() !== 40767) {
2984
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties");
2985
+ }
2986
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature() !== 8456) {
2987
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature");
2988
+ }
2989
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k() !== 26600) {
2990
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k");
2991
+ }
2992
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p() !== 54577) {
2993
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p");
2994
+ }
2995
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_typical_p() !== 28727) {
2996
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_typical_p");
2997
+ }
2998
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_xtc() !== 22853) {
2999
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_xtc");
3000
+ }
3001
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json() !== 51798) {
3002
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json");
3003
+ }
3004
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_crossencoder_new() !== 12491) {
3005
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_crossencoder_new");
3006
+ }
3007
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_encoder_new() !== 32094) {
3008
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_encoder_new");
3009
+ }
3010
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 6355) {
3011
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new");
3012
+ }
3013
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new() !== 54104) {
3014
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new");
3015
+ }
3016
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new() !== 50214) {
3017
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new");
3018
+ }
3019
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_samplerconfig_from_json() !== 6867) {
3020
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_samplerconfig_from_json");
3021
+ }
3022
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttoolcallback_call() !== 43958) {
3023
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttoolcallback_call");
3024
+ }
3025
+
3026
+ uniffiCallbackInterfaceRustToolCallback.register();
3027
+ }
3028
+
3029
+ export default Object.freeze({
3030
+ initialize: uniffiEnsureInitialized,
3031
+ converters: {
3032
+ FfiConverterTypeAsset,
3033
+ FfiConverterTypeCrossEncoder,
3034
+ FfiConverterTypeEncoder,
3035
+ FfiConverterTypeMessage,
3036
+ FfiConverterTypeModel,
3037
+ FfiConverterTypeNobodyWhoError,
3038
+ FfiConverterTypePromptPart,
3039
+ FfiConverterTypeRole,
3040
+ FfiConverterTypeRustChat,
3041
+ FfiConverterTypeRustTokenStream,
3042
+ FfiConverterTypeRustTool,
3043
+ FfiConverterTypeSamplerBuilder,
3044
+ FfiConverterTypeSamplerConfig,
3045
+ FfiConverterTypeToolCall,
3046
+ FfiConverterTypeToolParameter,
3047
+ }
3048
+ });