react-native-nobodywho 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,7 +104,7 @@ export function cosineSimilarity(a: Array</*f32*/number>, b: Array</*f32*/number
104
104
  * uniffi-bindgen-react-native generates invalid JS (`async static` instead
105
105
  * of `static async`) for async constructors.
106
106
  */
107
- export async function loadModel(modelPath: string, useGpu: boolean, projectionModelPath: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<ModelInterface> /*throws*/ {
107
+ export async function loadModel(modelPath: string, useGpu: boolean, projectionModelPath: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustModelInterface> /*throws*/ {
108
108
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
109
109
  try {
110
110
  return await uniffiRustCallAsync(
@@ -117,7 +117,7 @@ export async function loadModel(modelPath: string, useGpu: boolean, projectionMo
117
117
  /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
118
118
  /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
119
119
  /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
120
- /*liftFunc:*/ FfiConverterTypeModel.lift.bind(FfiConverterTypeModel),
120
+ /*liftFunc:*/ FfiConverterTypeRustModel.lift.bind(FfiConverterTypeRustModel),
121
121
  /*liftString:*/ FfiConverterString.lift,
122
122
  /*asyncOpts:*/ asyncOpts_,
123
123
  /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
@@ -1012,424 +1012,6 @@ const FfiConverterTypeRole = (() => {
1012
1012
  const FfiConverterMapStringBool = new FfiConverterMap(FfiConverterString, FfiConverterBool);
1013
1013
 
1014
1014
 
1015
- export interface CrossEncoderInterface {
1016
-
1017
- /**
1018
- * Rank documents by relevance to a query. Returns similarity scores.
1019
- */
1020
- rank(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
1021
- /**
1022
- * Rank documents and return them sorted by descending relevance.
1023
- * Returns a JSON string of [document, score] pairs since UniFFI
1024
- * doesn't support tuples directly.
1025
- */
1026
- rankAndSortJson(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1027
- }
1028
-
1029
-
1030
- export class CrossEncoder extends UniffiAbstractObject implements CrossEncoderInterface {
1031
-
1032
- readonly [uniffiTypeNameSymbol] = "CrossEncoder";
1033
- readonly [destructorGuardSymbol]: UniffiGcObject;
1034
- readonly [pointerLiteralSymbol]: UniffiHandle;
1035
- /**
1036
- * Create a new cross-encoder for ranking documents by relevance.
1037
- */
1038
- constructor(model: ModelInterface, contextSize: /*u32*/number | undefined) {
1039
- super();
1040
- const pointer =
1041
- uniffiCaller.rustCall(
1042
- /*caller:*/ (callStatus) => {
1043
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_crossencoder_new(
1044
- FfiConverterTypeModel.lower(model),
1045
- FfiConverterOptionalUInt32.lower(contextSize),
1046
- callStatus);
1047
- },
1048
- /*liftString:*/ FfiConverterString.lift,
1049
- );
1050
- this[pointerLiteralSymbol] = pointer;
1051
- this[destructorGuardSymbol] = uniffiTypeCrossEncoderObjectFactory.bless(pointer);
1052
- }
1053
-
1054
-
1055
-
1056
-
1057
- /**
1058
- * Rank documents by relevance to a query. Returns similarity scores.
1059
- */
1060
- async rank(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*f32*/number>> /*throws*/ {
1061
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
1062
- try {
1063
- return await uniffiRustCallAsync(
1064
- /*rustCaller:*/ uniffiCaller,
1065
- /*rustFutureFunc:*/ () => {
1066
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_crossencoder_rank(
1067
- uniffiTypeCrossEncoderObjectFactory.clonePointer(this),
1068
- FfiConverterString.lower(query),FfiConverterArrayString.lower(documents)
1069
- );
1070
- },
1071
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1072
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1073
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1074
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1075
- /*liftFunc:*/ FfiConverterArrayFloat32.lift.bind(FfiConverterArrayFloat32),
1076
- /*liftString:*/ FfiConverterString.lift,
1077
- /*asyncOpts:*/ asyncOpts_,
1078
- /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1079
- );
1080
- } catch (__error: any) {
1081
- if (uniffiIsDebug && __error instanceof Error) {
1082
- __error.stack = __stack;
1083
- }
1084
- throw __error;
1085
- }
1086
- }
1087
-
1088
- /**
1089
- * Rank documents and return them sorted by descending relevance.
1090
- * Returns a JSON string of [document, score] pairs since UniFFI
1091
- * doesn't support tuples directly.
1092
- */
1093
- async rankAndSortJson(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
1094
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
1095
- try {
1096
- return await uniffiRustCallAsync(
1097
- /*rustCaller:*/ uniffiCaller,
1098
- /*rustFutureFunc:*/ () => {
1099
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_crossencoder_rank_and_sort_json(
1100
- uniffiTypeCrossEncoderObjectFactory.clonePointer(this),
1101
- FfiConverterString.lower(query),FfiConverterArrayString.lower(documents)
1102
- );
1103
- },
1104
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1105
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1106
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1107
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1108
- /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
1109
- /*liftString:*/ FfiConverterString.lift,
1110
- /*asyncOpts:*/ asyncOpts_,
1111
- /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1112
- );
1113
- } catch (__error: any) {
1114
- if (uniffiIsDebug && __error instanceof Error) {
1115
- __error.stack = __stack;
1116
- }
1117
- throw __error;
1118
- }
1119
- }
1120
-
1121
-
1122
- /**
1123
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1124
- */
1125
- uniffiDestroy(): void {
1126
- const ptr = (this as any)[destructorGuardSymbol];
1127
- if (ptr !== undefined) {
1128
- const pointer = uniffiTypeCrossEncoderObjectFactory.pointer(this);
1129
- uniffiTypeCrossEncoderObjectFactory.freePointer(pointer);
1130
- uniffiTypeCrossEncoderObjectFactory.unbless(ptr);
1131
- delete (this as any)[destructorGuardSymbol];
1132
- }
1133
- }
1134
-
1135
- static instanceOf(obj: any): obj is CrossEncoder {
1136
- return uniffiTypeCrossEncoderObjectFactory.isConcreteType(obj);
1137
- }
1138
-
1139
-
1140
- }
1141
-
1142
- const uniffiTypeCrossEncoderObjectFactory: UniffiObjectFactory<CrossEncoderInterface> = (() => {
1143
-
1144
- return {
1145
- create(pointer: UniffiHandle): CrossEncoderInterface {
1146
- const instance = Object.create(CrossEncoder.prototype);
1147
- instance[pointerLiteralSymbol] = pointer;
1148
- instance[destructorGuardSymbol] = this.bless(pointer);
1149
- instance[uniffiTypeNameSymbol] = "CrossEncoder";
1150
- return instance;
1151
- },
1152
-
1153
-
1154
- bless(p: UniffiHandle): UniffiGcObject {
1155
- return uniffiCaller.rustCall(
1156
- /*caller:*/ (status) =>
1157
- nativeModule().ubrn_uniffi_internal_fn_method_crossencoder_ffi__bless_pointer(p, status),
1158
- /*liftString:*/ FfiConverterString.lift
1159
- );
1160
- },
1161
-
1162
- unbless(ptr: UniffiGcObject) {
1163
- ptr.markDestroyed();
1164
- },
1165
-
1166
- pointer(obj: CrossEncoderInterface): UniffiHandle {
1167
- if ((obj as any)[destructorGuardSymbol] === undefined) {
1168
- throw new UniffiInternalError.UnexpectedNullPointer();
1169
- }
1170
- return (obj as any)[pointerLiteralSymbol];
1171
- },
1172
-
1173
- clonePointer(obj: CrossEncoderInterface): UniffiHandle {
1174
- const pointer = this.pointer(obj);
1175
- return uniffiCaller.rustCall(
1176
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_crossencoder(pointer, callStatus),
1177
- /*liftString:*/ FfiConverterString.lift
1178
- );
1179
- },
1180
-
1181
- freePointer(pointer: UniffiHandle): void {
1182
- uniffiCaller.rustCall(
1183
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_crossencoder(pointer, callStatus),
1184
- /*liftString:*/ FfiConverterString.lift
1185
- );
1186
- },
1187
-
1188
- isConcreteType(obj: any): obj is CrossEncoderInterface {
1189
- return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "CrossEncoder";
1190
- },
1191
- }})();
1192
- // FfiConverter for CrossEncoderInterface
1193
- const FfiConverterTypeCrossEncoder = new FfiConverterObject(uniffiTypeCrossEncoderObjectFactory);
1194
-
1195
-
1196
- export interface EncoderInterface {
1197
-
1198
- /**
1199
- * Encode text into an embedding vector.
1200
- */
1201
- encode(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
1202
- }
1203
-
1204
-
1205
- export class Encoder extends UniffiAbstractObject implements EncoderInterface {
1206
-
1207
- readonly [uniffiTypeNameSymbol] = "Encoder";
1208
- readonly [destructorGuardSymbol]: UniffiGcObject;
1209
- readonly [pointerLiteralSymbol]: UniffiHandle;
1210
- /**
1211
- * Create a new encoder for generating text embeddings.
1212
- */
1213
- constructor(model: ModelInterface, contextSize: /*u32*/number | undefined) {
1214
- super();
1215
- const pointer =
1216
- uniffiCaller.rustCall(
1217
- /*caller:*/ (callStatus) => {
1218
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_encoder_new(
1219
- FfiConverterTypeModel.lower(model),
1220
- FfiConverterOptionalUInt32.lower(contextSize),
1221
- callStatus);
1222
- },
1223
- /*liftString:*/ FfiConverterString.lift,
1224
- );
1225
- this[pointerLiteralSymbol] = pointer;
1226
- this[destructorGuardSymbol] = uniffiTypeEncoderObjectFactory.bless(pointer);
1227
- }
1228
-
1229
-
1230
-
1231
-
1232
- /**
1233
- * Encode text into an embedding vector.
1234
- */
1235
- async encode(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*f32*/number>> /*throws*/ {
1236
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
1237
- try {
1238
- return await uniffiRustCallAsync(
1239
- /*rustCaller:*/ uniffiCaller,
1240
- /*rustFutureFunc:*/ () => {
1241
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_encoder_encode(
1242
- uniffiTypeEncoderObjectFactory.clonePointer(this),
1243
- FfiConverterString.lower(text)
1244
- );
1245
- },
1246
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1247
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1248
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1249
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1250
- /*liftFunc:*/ FfiConverterArrayFloat32.lift.bind(FfiConverterArrayFloat32),
1251
- /*liftString:*/ FfiConverterString.lift,
1252
- /*asyncOpts:*/ asyncOpts_,
1253
- /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1254
- );
1255
- } catch (__error: any) {
1256
- if (uniffiIsDebug && __error instanceof Error) {
1257
- __error.stack = __stack;
1258
- }
1259
- throw __error;
1260
- }
1261
- }
1262
-
1263
-
1264
- /**
1265
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1266
- */
1267
- uniffiDestroy(): void {
1268
- const ptr = (this as any)[destructorGuardSymbol];
1269
- if (ptr !== undefined) {
1270
- const pointer = uniffiTypeEncoderObjectFactory.pointer(this);
1271
- uniffiTypeEncoderObjectFactory.freePointer(pointer);
1272
- uniffiTypeEncoderObjectFactory.unbless(ptr);
1273
- delete (this as any)[destructorGuardSymbol];
1274
- }
1275
- }
1276
-
1277
- static instanceOf(obj: any): obj is Encoder {
1278
- return uniffiTypeEncoderObjectFactory.isConcreteType(obj);
1279
- }
1280
-
1281
-
1282
- }
1283
-
1284
- const uniffiTypeEncoderObjectFactory: UniffiObjectFactory<EncoderInterface> = (() => {
1285
-
1286
- return {
1287
- create(pointer: UniffiHandle): EncoderInterface {
1288
- const instance = Object.create(Encoder.prototype);
1289
- instance[pointerLiteralSymbol] = pointer;
1290
- instance[destructorGuardSymbol] = this.bless(pointer);
1291
- instance[uniffiTypeNameSymbol] = "Encoder";
1292
- return instance;
1293
- },
1294
-
1295
-
1296
- bless(p: UniffiHandle): UniffiGcObject {
1297
- return uniffiCaller.rustCall(
1298
- /*caller:*/ (status) =>
1299
- nativeModule().ubrn_uniffi_internal_fn_method_encoder_ffi__bless_pointer(p, status),
1300
- /*liftString:*/ FfiConverterString.lift
1301
- );
1302
- },
1303
-
1304
- unbless(ptr: UniffiGcObject) {
1305
- ptr.markDestroyed();
1306
- },
1307
-
1308
- pointer(obj: EncoderInterface): UniffiHandle {
1309
- if ((obj as any)[destructorGuardSymbol] === undefined) {
1310
- throw new UniffiInternalError.UnexpectedNullPointer();
1311
- }
1312
- return (obj as any)[pointerLiteralSymbol];
1313
- },
1314
-
1315
- clonePointer(obj: EncoderInterface): UniffiHandle {
1316
- const pointer = this.pointer(obj);
1317
- return uniffiCaller.rustCall(
1318
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_encoder(pointer, callStatus),
1319
- /*liftString:*/ FfiConverterString.lift
1320
- );
1321
- },
1322
-
1323
- freePointer(pointer: UniffiHandle): void {
1324
- uniffiCaller.rustCall(
1325
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_encoder(pointer, callStatus),
1326
- /*liftString:*/ FfiConverterString.lift
1327
- );
1328
- },
1329
-
1330
- isConcreteType(obj: any): obj is EncoderInterface {
1331
- return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "Encoder";
1332
- },
1333
- }})();
1334
- // FfiConverter for EncoderInterface
1335
- const FfiConverterTypeEncoder = new FfiConverterObject(uniffiTypeEncoderObjectFactory);
1336
-
1337
-
1338
- export interface ModelInterface {
1339
-
1340
- }
1341
-
1342
-
1343
- export class Model extends UniffiAbstractObject implements ModelInterface {
1344
-
1345
- readonly [uniffiTypeNameSymbol] = "Model";
1346
- readonly [destructorGuardSymbol]: UniffiGcObject;
1347
- readonly [pointerLiteralSymbol]: UniffiHandle;
1348
- // No primary constructor declared for this class.
1349
- private constructor(pointer: UniffiHandle) {
1350
- super();
1351
- this[pointerLiteralSymbol] = pointer;
1352
- this[destructorGuardSymbol] = uniffiTypeModelObjectFactory.bless(pointer);
1353
- }
1354
-
1355
-
1356
-
1357
-
1358
-
1359
- /**
1360
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1361
- */
1362
- uniffiDestroy(): void {
1363
- const ptr = (this as any)[destructorGuardSymbol];
1364
- if (ptr !== undefined) {
1365
- const pointer = uniffiTypeModelObjectFactory.pointer(this);
1366
- uniffiTypeModelObjectFactory.freePointer(pointer);
1367
- uniffiTypeModelObjectFactory.unbless(ptr);
1368
- delete (this as any)[destructorGuardSymbol];
1369
- }
1370
- }
1371
-
1372
- static instanceOf(obj: any): obj is Model {
1373
- return uniffiTypeModelObjectFactory.isConcreteType(obj);
1374
- }
1375
-
1376
-
1377
- }
1378
-
1379
- const uniffiTypeModelObjectFactory: UniffiObjectFactory<ModelInterface> = (() => {
1380
-
1381
- return {
1382
- create(pointer: UniffiHandle): ModelInterface {
1383
- const instance = Object.create(Model.prototype);
1384
- instance[pointerLiteralSymbol] = pointer;
1385
- instance[destructorGuardSymbol] = this.bless(pointer);
1386
- instance[uniffiTypeNameSymbol] = "Model";
1387
- return instance;
1388
- },
1389
-
1390
-
1391
- bless(p: UniffiHandle): UniffiGcObject {
1392
- return uniffiCaller.rustCall(
1393
- /*caller:*/ (status) =>
1394
- nativeModule().ubrn_uniffi_internal_fn_method_model_ffi__bless_pointer(p, status),
1395
- /*liftString:*/ FfiConverterString.lift
1396
- );
1397
- },
1398
-
1399
- unbless(ptr: UniffiGcObject) {
1400
- ptr.markDestroyed();
1401
- },
1402
-
1403
- pointer(obj: ModelInterface): UniffiHandle {
1404
- if ((obj as any)[destructorGuardSymbol] === undefined) {
1405
- throw new UniffiInternalError.UnexpectedNullPointer();
1406
- }
1407
- return (obj as any)[pointerLiteralSymbol];
1408
- },
1409
-
1410
- clonePointer(obj: ModelInterface): UniffiHandle {
1411
- const pointer = this.pointer(obj);
1412
- return uniffiCaller.rustCall(
1413
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_model(pointer, callStatus),
1414
- /*liftString:*/ FfiConverterString.lift
1415
- );
1416
- },
1417
-
1418
- freePointer(pointer: UniffiHandle): void {
1419
- uniffiCaller.rustCall(
1420
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_model(pointer, callStatus),
1421
- /*liftString:*/ FfiConverterString.lift
1422
- );
1423
- },
1424
-
1425
- isConcreteType(obj: any): obj is ModelInterface {
1426
- return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "Model";
1427
- },
1428
- }})();
1429
- // FfiConverter for ModelInterface
1430
- const FfiConverterTypeModel = new FfiConverterObject(uniffiTypeModelObjectFactory);
1431
-
1432
-
1433
1015
  export interface RustChatInterface {
1434
1016
 
1435
1017
  /**
@@ -1502,13 +1084,13 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
1502
1084
  /**
1503
1085
  * Create a new chat session.
1504
1086
  */
1505
- constructor(model: ModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) {
1087
+ constructor(model: RustModelInterface, systemPrompt: string | undefined, contextSize: /*u32*/number, templateVariables: Map<string, boolean> | undefined, tools: Array<RustToolInterface> | undefined, sampler: SamplerConfigInterface | undefined) {
1506
1088
  super();
1507
1089
  const pointer =
1508
1090
  uniffiCaller.rustCall(
1509
1091
  /*caller:*/ (callStatus) => {
1510
1092
  return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustchat_new(
1511
- FfiConverterTypeModel.lower(model),
1093
+ FfiConverterTypeRustModel.lower(model),
1512
1094
  FfiConverterOptionalString.lower(systemPrompt),
1513
1095
  FfiConverterUInt32.lower(contextSize),
1514
1096
  FfiConverterOptionalMapStringBool.lower(templateVariables),
@@ -1805,24 +1387,245 @@ async setSamplerConfig(sampler: SamplerConfigInterface, asyncOpts_?: { signal:
1805
1387
  }
1806
1388
 
1807
1389
  /**
1808
- * Set the system prompt.
1390
+ * Set the system prompt.
1391
+ */
1392
+ async setSystemPrompt(systemPrompt: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1393
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1394
+ try {
1395
+ return await uniffiRustCallAsync(
1396
+ /*rustCaller:*/ uniffiCaller,
1397
+ /*rustFutureFunc:*/ () => {
1398
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_system_prompt(
1399
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1400
+ FfiConverterOptionalString.lower(systemPrompt)
1401
+ );
1402
+ },
1403
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1404
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1405
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1406
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1407
+ /*liftFunc:*/ (_v) => {},
1408
+ /*liftString:*/ FfiConverterString.lift,
1409
+ /*asyncOpts:*/ asyncOpts_,
1410
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1411
+ );
1412
+ } catch (__error: any) {
1413
+ if (uniffiIsDebug && __error instanceof Error) {
1414
+ __error.stack = __stack;
1415
+ }
1416
+ throw __error;
1417
+ }
1418
+ }
1419
+
1420
+ /**
1421
+ * Set a template variable.
1422
+ */
1423
+ async setTemplateVariable(name: string, value: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1424
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1425
+ try {
1426
+ return await uniffiRustCallAsync(
1427
+ /*rustCaller:*/ uniffiCaller,
1428
+ /*rustFutureFunc:*/ () => {
1429
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_template_variable(
1430
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1431
+ FfiConverterString.lower(name),FfiConverterBool.lower(value)
1432
+ );
1433
+ },
1434
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1435
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1436
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1437
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1438
+ /*liftFunc:*/ (_v) => {},
1439
+ /*liftString:*/ FfiConverterString.lift,
1440
+ /*asyncOpts:*/ asyncOpts_,
1441
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1442
+ );
1443
+ } catch (__error: any) {
1444
+ if (uniffiIsDebug && __error instanceof Error) {
1445
+ __error.stack = __stack;
1446
+ }
1447
+ throw __error;
1448
+ }
1449
+ }
1450
+
1451
+ /**
1452
+ * Set the tools available to the model.
1453
+ */
1454
+ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1455
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1456
+ try {
1457
+ return await uniffiRustCallAsync(
1458
+ /*rustCaller:*/ uniffiCaller,
1459
+ /*rustFutureFunc:*/ () => {
1460
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_tools(
1461
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1462
+ FfiConverterArrayTypeRustTool.lower(tools)
1463
+ );
1464
+ },
1465
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1466
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1467
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1468
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1469
+ /*liftFunc:*/ (_v) => {},
1470
+ /*liftString:*/ FfiConverterString.lift,
1471
+ /*asyncOpts:*/ asyncOpts_,
1472
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1473
+ );
1474
+ } catch (__error: any) {
1475
+ if (uniffiIsDebug && __error instanceof Error) {
1476
+ __error.stack = __stack;
1477
+ }
1478
+ throw __error;
1479
+ }
1480
+ }
1481
+
1482
+ /**
1483
+ * Stop the current generation.
1484
+ */
1485
+ stopGeneration(): void {uniffiCaller.rustCall(
1486
+ /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_stop_generation(uniffiTypeRustChatObjectFactory.clonePointer(this),
1487
+ callStatus);
1488
+ },
1489
+ /*liftString:*/ FfiConverterString.lift,
1490
+ );
1491
+ }
1492
+
1493
+
1494
+ /**
1495
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1496
+ */
1497
+ uniffiDestroy(): void {
1498
+ const ptr = (this as any)[destructorGuardSymbol];
1499
+ if (ptr !== undefined) {
1500
+ const pointer = uniffiTypeRustChatObjectFactory.pointer(this);
1501
+ uniffiTypeRustChatObjectFactory.freePointer(pointer);
1502
+ uniffiTypeRustChatObjectFactory.unbless(ptr);
1503
+ delete (this as any)[destructorGuardSymbol];
1504
+ }
1505
+ }
1506
+
1507
+ static instanceOf(obj: any): obj is RustChat {
1508
+ return uniffiTypeRustChatObjectFactory.isConcreteType(obj);
1509
+ }
1510
+
1511
+
1512
+ }
1513
+
1514
+ const uniffiTypeRustChatObjectFactory: UniffiObjectFactory<RustChatInterface> = (() => {
1515
+
1516
+ return {
1517
+ create(pointer: UniffiHandle): RustChatInterface {
1518
+ const instance = Object.create(RustChat.prototype);
1519
+ instance[pointerLiteralSymbol] = pointer;
1520
+ instance[destructorGuardSymbol] = this.bless(pointer);
1521
+ instance[uniffiTypeNameSymbol] = "RustChat";
1522
+ return instance;
1523
+ },
1524
+
1525
+
1526
+ bless(p: UniffiHandle): UniffiGcObject {
1527
+ return uniffiCaller.rustCall(
1528
+ /*caller:*/ (status) =>
1529
+ nativeModule().ubrn_uniffi_internal_fn_method_rustchat_ffi__bless_pointer(p, status),
1530
+ /*liftString:*/ FfiConverterString.lift
1531
+ );
1532
+ },
1533
+
1534
+ unbless(ptr: UniffiGcObject) {
1535
+ ptr.markDestroyed();
1536
+ },
1537
+
1538
+ pointer(obj: RustChatInterface): UniffiHandle {
1539
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1540
+ throw new UniffiInternalError.UnexpectedNullPointer();
1541
+ }
1542
+ return (obj as any)[pointerLiteralSymbol];
1543
+ },
1544
+
1545
+ clonePointer(obj: RustChatInterface): UniffiHandle {
1546
+ const pointer = this.pointer(obj);
1547
+ return uniffiCaller.rustCall(
1548
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustchat(pointer, callStatus),
1549
+ /*liftString:*/ FfiConverterString.lift
1550
+ );
1551
+ },
1552
+
1553
+ freePointer(pointer: UniffiHandle): void {
1554
+ uniffiCaller.rustCall(
1555
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustchat(pointer, callStatus),
1556
+ /*liftString:*/ FfiConverterString.lift
1557
+ );
1558
+ },
1559
+
1560
+ isConcreteType(obj: any): obj is RustChatInterface {
1561
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustChat";
1562
+ },
1563
+ }})();
1564
+ // FfiConverter for RustChatInterface
1565
+ const FfiConverterTypeRustChat = new FfiConverterObject(uniffiTypeRustChatObjectFactory);
1566
+
1567
+
1568
+ export interface RustCrossEncoderInterface {
1569
+
1570
+ /**
1571
+ * Rank documents by relevance to a query. Returns similarity scores.
1572
+ */
1573
+ rank(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
1574
+ /**
1575
+ * Rank documents and return them sorted by descending relevance.
1576
+ * Returns a JSON string of [document, score] pairs since UniFFI
1577
+ * doesn't support tuples directly.
1578
+ */
1579
+ rankAndSortJson(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1580
+ }
1581
+
1582
+
1583
+ export class RustCrossEncoder extends UniffiAbstractObject implements RustCrossEncoderInterface {
1584
+
1585
+ readonly [uniffiTypeNameSymbol] = "RustCrossEncoder";
1586
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1587
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1588
+ /**
1589
+ * Create a new cross-encoder for ranking documents by relevance.
1590
+ */
1591
+ constructor(model: RustModelInterface, contextSize: /*u32*/number | undefined) {
1592
+ super();
1593
+ const pointer =
1594
+ uniffiCaller.rustCall(
1595
+ /*caller:*/ (callStatus) => {
1596
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustcrossencoder_new(
1597
+ FfiConverterTypeRustModel.lower(model),
1598
+ FfiConverterOptionalUInt32.lower(contextSize),
1599
+ callStatus);
1600
+ },
1601
+ /*liftString:*/ FfiConverterString.lift,
1602
+ );
1603
+ this[pointerLiteralSymbol] = pointer;
1604
+ this[destructorGuardSymbol] = uniffiTypeRustCrossEncoderObjectFactory.bless(pointer);
1605
+ }
1606
+
1607
+
1608
+
1609
+
1610
+ /**
1611
+ * Rank documents by relevance to a query. Returns similarity scores.
1809
1612
  */
1810
- async setSystemPrompt(systemPrompt: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1613
+ async rank(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*f32*/number>> /*throws*/ {
1811
1614
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
1812
1615
  try {
1813
1616
  return await uniffiRustCallAsync(
1814
1617
  /*rustCaller:*/ uniffiCaller,
1815
1618
  /*rustFutureFunc:*/ () => {
1816
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_system_prompt(
1817
- uniffiTypeRustChatObjectFactory.clonePointer(this),
1818
- FfiConverterOptionalString.lower(systemPrompt)
1619
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustcrossencoder_rank(
1620
+ uniffiTypeRustCrossEncoderObjectFactory.clonePointer(this),
1621
+ FfiConverterString.lower(query),FfiConverterArrayString.lower(documents)
1819
1622
  );
1820
1623
  },
1821
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1822
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1823
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1824
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1825
- /*liftFunc:*/ (_v) => {},
1624
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1625
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1626
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1627
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1628
+ /*liftFunc:*/ FfiConverterArrayFloat32.lift.bind(FfiConverterArrayFloat32),
1826
1629
  /*liftString:*/ FfiConverterString.lift,
1827
1630
  /*asyncOpts:*/ asyncOpts_,
1828
1631
  /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
@@ -1836,24 +1639,26 @@ async setSystemPrompt(systemPrompt: string | undefined, asyncOpts_?: { signal:
1836
1639
  }
1837
1640
 
1838
1641
  /**
1839
- * Set a template variable.
1642
+ * Rank documents and return them sorted by descending relevance.
1643
+ * Returns a JSON string of [document, score] pairs since UniFFI
1644
+ * doesn't support tuples directly.
1840
1645
  */
1841
- async setTemplateVariable(name: string, value: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1646
+ async rankAndSortJson(query: string, documents: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
1842
1647
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
1843
1648
  try {
1844
1649
  return await uniffiRustCallAsync(
1845
1650
  /*rustCaller:*/ uniffiCaller,
1846
1651
  /*rustFutureFunc:*/ () => {
1847
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_template_variable(
1848
- uniffiTypeRustChatObjectFactory.clonePointer(this),
1849
- FfiConverterString.lower(name),FfiConverterBool.lower(value)
1652
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustcrossencoder_rank_and_sort_json(
1653
+ uniffiTypeRustCrossEncoderObjectFactory.clonePointer(this),
1654
+ FfiConverterString.lower(query),FfiConverterArrayString.lower(documents)
1850
1655
  );
1851
1656
  },
1852
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1853
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1854
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1855
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1856
- /*liftFunc:*/ (_v) => {},
1657
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1658
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1659
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1660
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1661
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
1857
1662
  /*liftString:*/ FfiConverterString.lift,
1858
1663
  /*asyncOpts:*/ asyncOpts_,
1859
1664
  /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
@@ -1866,25 +1671,136 @@ async setTemplateVariable(name: string, value: boolean, asyncOpts_?: { signal:
1866
1671
  }
1867
1672
  }
1868
1673
 
1674
+
1869
1675
  /**
1870
- * Set the tools available to the model.
1676
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1871
1677
  */
1872
- async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
1678
+ uniffiDestroy(): void {
1679
+ const ptr = (this as any)[destructorGuardSymbol];
1680
+ if (ptr !== undefined) {
1681
+ const pointer = uniffiTypeRustCrossEncoderObjectFactory.pointer(this);
1682
+ uniffiTypeRustCrossEncoderObjectFactory.freePointer(pointer);
1683
+ uniffiTypeRustCrossEncoderObjectFactory.unbless(ptr);
1684
+ delete (this as any)[destructorGuardSymbol];
1685
+ }
1686
+ }
1687
+
1688
+ static instanceOf(obj: any): obj is RustCrossEncoder {
1689
+ return uniffiTypeRustCrossEncoderObjectFactory.isConcreteType(obj);
1690
+ }
1691
+
1692
+
1693
+ }
1694
+
1695
+ const uniffiTypeRustCrossEncoderObjectFactory: UniffiObjectFactory<RustCrossEncoderInterface> = (() => {
1696
+
1697
+ return {
1698
+ create(pointer: UniffiHandle): RustCrossEncoderInterface {
1699
+ const instance = Object.create(RustCrossEncoder.prototype);
1700
+ instance[pointerLiteralSymbol] = pointer;
1701
+ instance[destructorGuardSymbol] = this.bless(pointer);
1702
+ instance[uniffiTypeNameSymbol] = "RustCrossEncoder";
1703
+ return instance;
1704
+ },
1705
+
1706
+
1707
+ bless(p: UniffiHandle): UniffiGcObject {
1708
+ return uniffiCaller.rustCall(
1709
+ /*caller:*/ (status) =>
1710
+ nativeModule().ubrn_uniffi_internal_fn_method_rustcrossencoder_ffi__bless_pointer(p, status),
1711
+ /*liftString:*/ FfiConverterString.lift
1712
+ );
1713
+ },
1714
+
1715
+ unbless(ptr: UniffiGcObject) {
1716
+ ptr.markDestroyed();
1717
+ },
1718
+
1719
+ pointer(obj: RustCrossEncoderInterface): UniffiHandle {
1720
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1721
+ throw new UniffiInternalError.UnexpectedNullPointer();
1722
+ }
1723
+ return (obj as any)[pointerLiteralSymbol];
1724
+ },
1725
+
1726
+ clonePointer(obj: RustCrossEncoderInterface): UniffiHandle {
1727
+ const pointer = this.pointer(obj);
1728
+ return uniffiCaller.rustCall(
1729
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustcrossencoder(pointer, callStatus),
1730
+ /*liftString:*/ FfiConverterString.lift
1731
+ );
1732
+ },
1733
+
1734
+ freePointer(pointer: UniffiHandle): void {
1735
+ uniffiCaller.rustCall(
1736
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustcrossencoder(pointer, callStatus),
1737
+ /*liftString:*/ FfiConverterString.lift
1738
+ );
1739
+ },
1740
+
1741
+ isConcreteType(obj: any): obj is RustCrossEncoderInterface {
1742
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustCrossEncoder";
1743
+ },
1744
+ }})();
1745
+ // FfiConverter for RustCrossEncoderInterface
1746
+ const FfiConverterTypeRustCrossEncoder = new FfiConverterObject(uniffiTypeRustCrossEncoderObjectFactory);
1747
+
1748
+
1749
+ export interface RustEncoderInterface {
1750
+
1751
+ /**
1752
+ * Encode text into an embedding vector.
1753
+ */
1754
+ encode(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
1755
+ }
1756
+
1757
+
1758
+ export class RustEncoder extends UniffiAbstractObject implements RustEncoderInterface {
1759
+
1760
+ readonly [uniffiTypeNameSymbol] = "RustEncoder";
1761
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1762
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1763
+ /**
1764
+ * Create a new encoder for generating text embeddings.
1765
+ */
1766
+ constructor(model: RustModelInterface, contextSize: /*u32*/number | undefined) {
1767
+ super();
1768
+ const pointer =
1769
+ uniffiCaller.rustCall(
1770
+ /*caller:*/ (callStatus) => {
1771
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustencoder_new(
1772
+ FfiConverterTypeRustModel.lower(model),
1773
+ FfiConverterOptionalUInt32.lower(contextSize),
1774
+ callStatus);
1775
+ },
1776
+ /*liftString:*/ FfiConverterString.lift,
1777
+ );
1778
+ this[pointerLiteralSymbol] = pointer;
1779
+ this[destructorGuardSymbol] = uniffiTypeRustEncoderObjectFactory.bless(pointer);
1780
+ }
1781
+
1782
+
1783
+
1784
+
1785
+ /**
1786
+ * Encode text into an embedding vector.
1787
+ */
1788
+ async encode(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*f32*/number>> /*throws*/ {
1873
1789
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
1874
1790
  try {
1875
1791
  return await uniffiRustCallAsync(
1876
1792
  /*rustCaller:*/ uniffiCaller,
1877
1793
  /*rustFutureFunc:*/ () => {
1878
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_set_tools(
1879
- uniffiTypeRustChatObjectFactory.clonePointer(this),
1880
- FfiConverterArrayTypeRustTool.lower(tools)
1794
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustencoder_encode(
1795
+ uniffiTypeRustEncoderObjectFactory.clonePointer(this),
1796
+ FfiConverterString.lower(text)
1881
1797
  );
1882
1798
  },
1883
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_void,
1884
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_void,
1885
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_void,
1886
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_void,
1887
- /*liftFunc:*/ (_v) => {},
1799
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1800
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1801
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1802
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1803
+ /*liftFunc:*/ FfiConverterArrayFloat32.lift.bind(FfiConverterArrayFloat32),
1888
1804
  /*liftString:*/ FfiConverterString.lift,
1889
1805
  /*asyncOpts:*/ asyncOpts_,
1890
1806
  /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
@@ -1897,16 +1813,100 @@ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSig
1897
1813
  }
1898
1814
  }
1899
1815
 
1816
+
1900
1817
  /**
1901
- * Stop the current generation.
1818
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1902
1819
  */
1903
- stopGeneration(): void {uniffiCaller.rustCall(
1904
- /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_stop_generation(uniffiTypeRustChatObjectFactory.clonePointer(this),
1905
- callStatus);
1906
- },
1907
- /*liftString:*/ FfiConverterString.lift,
1908
- );
1820
+ uniffiDestroy(): void {
1821
+ const ptr = (this as any)[destructorGuardSymbol];
1822
+ if (ptr !== undefined) {
1823
+ const pointer = uniffiTypeRustEncoderObjectFactory.pointer(this);
1824
+ uniffiTypeRustEncoderObjectFactory.freePointer(pointer);
1825
+ uniffiTypeRustEncoderObjectFactory.unbless(ptr);
1826
+ delete (this as any)[destructorGuardSymbol];
1827
+ }
1909
1828
  }
1829
+
1830
+ static instanceOf(obj: any): obj is RustEncoder {
1831
+ return uniffiTypeRustEncoderObjectFactory.isConcreteType(obj);
1832
+ }
1833
+
1834
+
1835
+ }
1836
+
1837
+ const uniffiTypeRustEncoderObjectFactory: UniffiObjectFactory<RustEncoderInterface> = (() => {
1838
+
1839
+ return {
1840
+ create(pointer: UniffiHandle): RustEncoderInterface {
1841
+ const instance = Object.create(RustEncoder.prototype);
1842
+ instance[pointerLiteralSymbol] = pointer;
1843
+ instance[destructorGuardSymbol] = this.bless(pointer);
1844
+ instance[uniffiTypeNameSymbol] = "RustEncoder";
1845
+ return instance;
1846
+ },
1847
+
1848
+
1849
+ bless(p: UniffiHandle): UniffiGcObject {
1850
+ return uniffiCaller.rustCall(
1851
+ /*caller:*/ (status) =>
1852
+ nativeModule().ubrn_uniffi_internal_fn_method_rustencoder_ffi__bless_pointer(p, status),
1853
+ /*liftString:*/ FfiConverterString.lift
1854
+ );
1855
+ },
1856
+
1857
+ unbless(ptr: UniffiGcObject) {
1858
+ ptr.markDestroyed();
1859
+ },
1860
+
1861
+ pointer(obj: RustEncoderInterface): UniffiHandle {
1862
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1863
+ throw new UniffiInternalError.UnexpectedNullPointer();
1864
+ }
1865
+ return (obj as any)[pointerLiteralSymbol];
1866
+ },
1867
+
1868
+ clonePointer(obj: RustEncoderInterface): UniffiHandle {
1869
+ const pointer = this.pointer(obj);
1870
+ return uniffiCaller.rustCall(
1871
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustencoder(pointer, callStatus),
1872
+ /*liftString:*/ FfiConverterString.lift
1873
+ );
1874
+ },
1875
+
1876
+ freePointer(pointer: UniffiHandle): void {
1877
+ uniffiCaller.rustCall(
1878
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustencoder(pointer, callStatus),
1879
+ /*liftString:*/ FfiConverterString.lift
1880
+ );
1881
+ },
1882
+
1883
+ isConcreteType(obj: any): obj is RustEncoderInterface {
1884
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustEncoder";
1885
+ },
1886
+ }})();
1887
+ // FfiConverter for RustEncoderInterface
1888
+ const FfiConverterTypeRustEncoder = new FfiConverterObject(uniffiTypeRustEncoderObjectFactory);
1889
+
1890
+
1891
+ export interface RustModelInterface {
1892
+
1893
+ }
1894
+
1895
+
1896
+ export class RustModel extends UniffiAbstractObject implements RustModelInterface {
1897
+
1898
+ readonly [uniffiTypeNameSymbol] = "RustModel";
1899
+ readonly [destructorGuardSymbol]: UniffiGcObject;
1900
+ readonly [pointerLiteralSymbol]: UniffiHandle;
1901
+ // No primary constructor declared for this class.
1902
+ private constructor(pointer: UniffiHandle) {
1903
+ super();
1904
+ this[pointerLiteralSymbol] = pointer;
1905
+ this[destructorGuardSymbol] = uniffiTypeRustModelObjectFactory.bless(pointer);
1906
+ }
1907
+
1908
+
1909
+
1910
1910
 
1911
1911
 
1912
1912
  /**
@@ -1915,28 +1915,28 @@ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSig
1915
1915
  uniffiDestroy(): void {
1916
1916
  const ptr = (this as any)[destructorGuardSymbol];
1917
1917
  if (ptr !== undefined) {
1918
- const pointer = uniffiTypeRustChatObjectFactory.pointer(this);
1919
- uniffiTypeRustChatObjectFactory.freePointer(pointer);
1920
- uniffiTypeRustChatObjectFactory.unbless(ptr);
1918
+ const pointer = uniffiTypeRustModelObjectFactory.pointer(this);
1919
+ uniffiTypeRustModelObjectFactory.freePointer(pointer);
1920
+ uniffiTypeRustModelObjectFactory.unbless(ptr);
1921
1921
  delete (this as any)[destructorGuardSymbol];
1922
1922
  }
1923
1923
  }
1924
1924
 
1925
- static instanceOf(obj: any): obj is RustChat {
1926
- return uniffiTypeRustChatObjectFactory.isConcreteType(obj);
1925
+ static instanceOf(obj: any): obj is RustModel {
1926
+ return uniffiTypeRustModelObjectFactory.isConcreteType(obj);
1927
1927
  }
1928
1928
 
1929
1929
 
1930
1930
  }
1931
1931
 
1932
- const uniffiTypeRustChatObjectFactory: UniffiObjectFactory<RustChatInterface> = (() => {
1932
+ const uniffiTypeRustModelObjectFactory: UniffiObjectFactory<RustModelInterface> = (() => {
1933
1933
 
1934
1934
  return {
1935
- create(pointer: UniffiHandle): RustChatInterface {
1936
- const instance = Object.create(RustChat.prototype);
1935
+ create(pointer: UniffiHandle): RustModelInterface {
1936
+ const instance = Object.create(RustModel.prototype);
1937
1937
  instance[pointerLiteralSymbol] = pointer;
1938
1938
  instance[destructorGuardSymbol] = this.bless(pointer);
1939
- instance[uniffiTypeNameSymbol] = "RustChat";
1939
+ instance[uniffiTypeNameSymbol] = "RustModel";
1940
1940
  return instance;
1941
1941
  },
1942
1942
 
@@ -1944,7 +1944,7 @@ const uniffiTypeRustChatObjectFactory: UniffiObjectFactory<RustChatInterface> =
1944
1944
  bless(p: UniffiHandle): UniffiGcObject {
1945
1945
  return uniffiCaller.rustCall(
1946
1946
  /*caller:*/ (status) =>
1947
- nativeModule().ubrn_uniffi_internal_fn_method_rustchat_ffi__bless_pointer(p, status),
1947
+ nativeModule().ubrn_uniffi_internal_fn_method_rustmodel_ffi__bless_pointer(p, status),
1948
1948
  /*liftString:*/ FfiConverterString.lift
1949
1949
  );
1950
1950
  },
@@ -1953,34 +1953,34 @@ const uniffiTypeRustChatObjectFactory: UniffiObjectFactory<RustChatInterface> =
1953
1953
  ptr.markDestroyed();
1954
1954
  },
1955
1955
 
1956
- pointer(obj: RustChatInterface): UniffiHandle {
1956
+ pointer(obj: RustModelInterface): UniffiHandle {
1957
1957
  if ((obj as any)[destructorGuardSymbol] === undefined) {
1958
1958
  throw new UniffiInternalError.UnexpectedNullPointer();
1959
1959
  }
1960
1960
  return (obj as any)[pointerLiteralSymbol];
1961
1961
  },
1962
1962
 
1963
- clonePointer(obj: RustChatInterface): UniffiHandle {
1963
+ clonePointer(obj: RustModelInterface): UniffiHandle {
1964
1964
  const pointer = this.pointer(obj);
1965
1965
  return uniffiCaller.rustCall(
1966
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustchat(pointer, callStatus),
1966
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustmodel(pointer, callStatus),
1967
1967
  /*liftString:*/ FfiConverterString.lift
1968
1968
  );
1969
1969
  },
1970
1970
 
1971
1971
  freePointer(pointer: UniffiHandle): void {
1972
1972
  uniffiCaller.rustCall(
1973
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustchat(pointer, callStatus),
1973
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustmodel(pointer, callStatus),
1974
1974
  /*liftString:*/ FfiConverterString.lift
1975
1975
  );
1976
1976
  },
1977
1977
 
1978
- isConcreteType(obj: any): obj is RustChatInterface {
1979
- return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustChat";
1978
+ isConcreteType(obj: any): obj is RustModelInterface {
1979
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustModel";
1980
1980
  },
1981
1981
  }})();
1982
- // FfiConverter for RustChatInterface
1983
- const FfiConverterTypeRustChat = new FfiConverterObject(uniffiTypeRustChatObjectFactory);
1982
+ // FfiConverter for RustModelInterface
1983
+ const FfiConverterTypeRustModel = new FfiConverterObject(uniffiTypeRustModelObjectFactory);
1984
1984
 
1985
1985
 
1986
1986
  export interface RustTokenStreamInterface {
@@ -2844,7 +2844,7 @@ function uniffiEnsureInitialized() {
2844
2844
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_cosine_similarity() !== 63439) {
2845
2845
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_cosine_similarity");
2846
2846
  }
2847
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 57455) {
2847
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 63144) {
2848
2848
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
2849
2849
  }
2850
2850
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_default() !== 10834) {
@@ -2871,15 +2871,6 @@ function uniffiEnsureInitialized() {
2871
2871
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_top_p() !== 54893) {
2872
2872
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_top_p");
2873
2873
  }
2874
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank() !== 14399) {
2875
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank");
2876
- }
2877
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank_and_sort_json() !== 4173) {
2878
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_crossencoder_rank_and_sort_json");
2879
- }
2880
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_encoder_encode() !== 21765) {
2881
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_encoder_encode");
2882
- }
2883
2874
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask() !== 53575) {
2884
2875
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask");
2885
2876
  }
@@ -2922,6 +2913,15 @@ function uniffiEnsureInitialized() {
2922
2913
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation() !== 24711) {
2923
2914
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation");
2924
2915
  }
2916
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank() !== 55500) {
2917
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank");
2918
+ }
2919
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank_and_sort_json() !== 24587) {
2920
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank_and_sort_json");
2921
+ }
2922
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode() !== 52601) {
2923
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode");
2924
+ }
2925
2925
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
2926
2926
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
2927
2927
  }
@@ -2973,14 +2973,14 @@ function uniffiEnsureInitialized() {
2973
2973
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json() !== 51798) {
2974
2974
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerconfig_to_json");
2975
2975
  }
2976
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_crossencoder_new() !== 12491) {
2977
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_crossencoder_new");
2976
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 38902) {
2977
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new");
2978
2978
  }
2979
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_encoder_new() !== 32094) {
2980
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_encoder_new");
2979
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new() !== 9022) {
2980
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustcrossencoder_new");
2981
2981
  }
2982
- if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new() !== 6355) {
2983
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustchat_new");
2982
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new() !== 27902) {
2983
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new");
2984
2984
  }
2985
2985
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new() !== 54104) {
2986
2986
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new");
@@ -3002,14 +3002,14 @@ export default Object.freeze({
3002
3002
  initialize: uniffiEnsureInitialized,
3003
3003
  converters: {
3004
3004
  FfiConverterTypeAsset,
3005
- FfiConverterTypeCrossEncoder,
3006
- FfiConverterTypeEncoder,
3007
3005
  FfiConverterTypeMessage,
3008
- FfiConverterTypeModel,
3009
3006
  FfiConverterTypeNobodyWhoError,
3010
3007
  FfiConverterTypePromptPart,
3011
3008
  FfiConverterTypeRole,
3012
3009
  FfiConverterTypeRustChat,
3010
+ FfiConverterTypeRustCrossEncoder,
3011
+ FfiConverterTypeRustEncoder,
3012
+ FfiConverterTypeRustModel,
3013
3013
  FfiConverterTypeRustTokenStream,
3014
3014
  FfiConverterTypeRustTool,
3015
3015
  FfiConverterTypeSamplerBuilder,