react-native-nobodywho 2.5.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -7
- package/android/build.gradle +5 -1
- package/generated/cpp/nobodywho.cpp +1050 -315
- package/generated/cpp/nobodywho.hpp +127 -27
- package/generated/ts/nobodywho-ffi.ts +52 -27
- package/generated/ts/nobodywho.ts +1240 -499
- package/package.json +7 -3
- package/src/chat.ts +35 -0
- package/src/encoder.ts +5 -0
- package/src/message.ts +91 -24
- package/src/prompt.ts +8 -8
- package/src/{stt.ts → speech_to_text.ts} +17 -9
- package/src/{tts.ts → text_to_speech.ts} +20 -20
- package/src/vad.ts +104 -0
- package/src/wrapper.ts +11 -8
|
@@ -186,22 +186,90 @@ export async function loadModel(modelPath: string, useGpu: boolean, projectionMo
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
* Create a
|
|
189
|
+
* Create an SpeechToText handle. `source` is a HuggingFace repo (`hf://owner/repo`,
|
|
190
|
+
* e.g. `"hf://onnx-community/whisper-base"`) or a local directory path.
|
|
191
|
+
* `language` is an ISO 639-1 code (e.g. `"en"`); pass `None` to auto-detect.
|
|
192
|
+
* `quantization` selects the ONNX precision variant to download and load:
|
|
193
|
+
* one of `"default"`, `"fp16"`, `"int8"`, `"uint8"`, `"bnb4"`, `"q4"`, `"q4f16"`, `"quantized"`;
|
|
194
|
+
* pass `None` to use `"default"`.
|
|
190
195
|
*/
|
|
191
|
-
export async function
|
|
196
|
+
export async function loadSpeechToText(source: string, language: string | undefined, quantization: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustSpeechToTextInterface> /*throws*/ {
|
|
192
197
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
193
198
|
try {
|
|
194
199
|
return await uniffiRustCallAsync(
|
|
195
200
|
/*rustCaller:*/ uniffiCaller,
|
|
196
201
|
/*rustFutureFunc:*/ () => {
|
|
197
|
-
return nativeModule().
|
|
202
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_speech_to_text(FfiConverterString.lower(source),FfiConverterOptionalString.lower(language),FfiConverterOptionalString.lower(quantization)
|
|
198
203
|
);
|
|
199
204
|
},
|
|
200
205
|
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
|
|
201
206
|
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
|
|
202
207
|
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
|
|
203
208
|
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
|
|
204
|
-
/*liftFunc:*/
|
|
209
|
+
/*liftFunc:*/ FfiConverterTypeRustSpeechToText.lift.bind(FfiConverterTypeRustSpeechToText),
|
|
210
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
211
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
212
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
213
|
+
);
|
|
214
|
+
} catch (__error: any) {
|
|
215
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
216
|
+
__error.stack = __stack;
|
|
217
|
+
}
|
|
218
|
+
throw __error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Create a TextToSpeech synthesizer.
|
|
223
|
+
*/
|
|
224
|
+
export async function loadTextToSpeech(source: string, architecture: string | undefined, voice: string | undefined, language: string | undefined, speed: /*f32*/number | undefined, steps: /*u32*/number | undefined, silenceDuration: /*f32*/number | undefined, precision: string | undefined, temperature: /*f32*/number | undefined, huggingfaceToken: string | undefined, device: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustTextToSpeechInterface> /*throws*/ {
|
|
225
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
226
|
+
try {
|
|
227
|
+
return await uniffiRustCallAsync(
|
|
228
|
+
/*rustCaller:*/ uniffiCaller,
|
|
229
|
+
/*rustFutureFunc:*/ () => {
|
|
230
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_text_to_speech(FfiConverterString.lower(source),FfiConverterOptionalString.lower(architecture),FfiConverterOptionalString.lower(voice),FfiConverterOptionalString.lower(language),FfiConverterOptionalFloat32.lower(speed),FfiConverterOptionalUInt32.lower(steps),FfiConverterOptionalFloat32.lower(silenceDuration),FfiConverterOptionalString.lower(precision),FfiConverterOptionalFloat32.lower(temperature),FfiConverterOptionalString.lower(huggingfaceToken),FfiConverterOptionalString.lower(device)
|
|
231
|
+
);
|
|
232
|
+
},
|
|
233
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
|
|
234
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
|
|
235
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
|
|
236
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
|
|
237
|
+
/*liftFunc:*/ FfiConverterTypeRustTextToSpeech.lift.bind(FfiConverterTypeRustTextToSpeech),
|
|
238
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
239
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
240
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
241
|
+
);
|
|
242
|
+
} catch (__error: any) {
|
|
243
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
244
|
+
__error.stack = __stack;
|
|
245
|
+
}
|
|
246
|
+
throw __error;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Create a voice activity detector. `source` is a HuggingFace repo
|
|
251
|
+
* (`hf://owner/repo`) or local directory for the Silero VAD ONNX model;
|
|
252
|
+
* `None` uses the default (`hf://onnx-community/silero-vad`). `sample_rate`
|
|
253
|
+
* is the rate of the audio you'll pass to `push` — Silero runs at 16kHz
|
|
254
|
+
* internally, anything else is resampled. `threshold`,
|
|
255
|
+
* `min_silence_duration_ms`, `min_speech_duration_ms`, and
|
|
256
|
+
* `preroll_duration_ms` default to the core `VoiceActivityDetectionConfig`
|
|
257
|
+
* defaults when omitted.
|
|
258
|
+
*/
|
|
259
|
+
export async function loadVoiceActivityDetection(source: string | undefined, sampleRate: /*u32*/number, threshold: /*f32*/number | undefined, minSilenceDurationMs: /*u32*/number | undefined, minSpeechDurationMs: /*u32*/number | undefined, prerollDurationMs: /*u32*/number | undefined, device: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustVoiceActivityDetectionInterface> /*throws*/ {
|
|
260
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
261
|
+
try {
|
|
262
|
+
return await uniffiRustCallAsync(
|
|
263
|
+
/*rustCaller:*/ uniffiCaller,
|
|
264
|
+
/*rustFutureFunc:*/ () => {
|
|
265
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_voice_activity_detection(FfiConverterOptionalString.lower(source),FfiConverterUInt32.lower(sampleRate),FfiConverterOptionalFloat32.lower(threshold),FfiConverterOptionalUInt32.lower(minSilenceDurationMs),FfiConverterOptionalUInt32.lower(minSpeechDurationMs),FfiConverterOptionalUInt32.lower(prerollDurationMs),FfiConverterOptionalString.lower(device)
|
|
266
|
+
);
|
|
267
|
+
},
|
|
268
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
|
|
269
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
|
|
270
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
|
|
271
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
|
|
272
|
+
/*liftFunc:*/ FfiConverterTypeRustVoiceActivityDetection.lift.bind(FfiConverterTypeRustVoiceActivityDetection),
|
|
205
273
|
/*liftString:*/ FfiConverterString.lift,
|
|
206
274
|
/*asyncOpts:*/ asyncOpts_,
|
|
207
275
|
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
@@ -487,64 +555,6 @@ const FfiConverterTypeRustToolCallback = new FfiConverterCallback<RustToolCallba
|
|
|
487
555
|
|
|
488
556
|
|
|
489
557
|
|
|
490
|
-
export type Asset = {
|
|
491
|
-
id: string,
|
|
492
|
-
path: string
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Generated factory for {@link Asset} record objects.
|
|
497
|
-
*/
|
|
498
|
-
export const Asset = (() => {
|
|
499
|
-
const defaults = () => ({
|
|
500
|
-
});
|
|
501
|
-
const create = (() => {
|
|
502
|
-
return uniffiCreateRecord<Asset, ReturnType<typeof defaults>>(defaults);
|
|
503
|
-
})();
|
|
504
|
-
return Object.freeze({
|
|
505
|
-
/**
|
|
506
|
-
* Create a frozen instance of {@link Asset}, with defaults specified
|
|
507
|
-
* in Rust, in the {@link nobodywho} crate.
|
|
508
|
-
*/
|
|
509
|
-
create,
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Create a frozen instance of {@link Asset}, with defaults specified
|
|
513
|
-
* in Rust, in the {@link nobodywho} crate.
|
|
514
|
-
*/
|
|
515
|
-
new: create,
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Defaults specified in the {@link nobodywho} crate.
|
|
519
|
-
*/
|
|
520
|
-
defaults: () => Object.freeze(defaults()) as Partial<Asset>,
|
|
521
|
-
|
|
522
|
-
});
|
|
523
|
-
})();
|
|
524
|
-
|
|
525
|
-
const FfiConverterTypeAsset = (() => {
|
|
526
|
-
type TypeName = Asset;
|
|
527
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
528
|
-
read(from: RustBuffer): TypeName {
|
|
529
|
-
return {
|
|
530
|
-
id: FfiConverterString.read(from),
|
|
531
|
-
path: FfiConverterString.read(from)
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
write(value: TypeName, into: RustBuffer): void {
|
|
535
|
-
FfiConverterString.write(value.id, into);
|
|
536
|
-
FfiConverterString.write(value.path, into);
|
|
537
|
-
}
|
|
538
|
-
allocationSize(value: TypeName): number {
|
|
539
|
-
return FfiConverterString.allocationSize(value.id) +
|
|
540
|
-
FfiConverterString.allocationSize(value.path);
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
return new FFIConverter();
|
|
545
|
-
})();
|
|
546
|
-
|
|
547
|
-
|
|
548
558
|
/**
|
|
549
559
|
* A cached `.gguf` model and its on-disk size.
|
|
550
560
|
*/
|
|
@@ -736,6 +746,79 @@ const FfiConverterTypeMtpConfig = (() => {
|
|
|
736
746
|
})();
|
|
737
747
|
|
|
738
748
|
|
|
749
|
+
/**
|
|
750
|
+
* Settings to apply before a `complete` turn. An unset field keeps what the
|
|
751
|
+
* chat has; a set one stays set, like a leading system message.
|
|
752
|
+
*/
|
|
753
|
+
export type Options = {
|
|
754
|
+
sampler: SamplerConfigInterface | undefined,
|
|
755
|
+
/**
|
|
756
|
+
* Replaces the chat's template variables wholesale.
|
|
757
|
+
*/
|
|
758
|
+
templateVariables: Map<string, boolean> | undefined,
|
|
759
|
+
/**
|
|
760
|
+
* Re-selects the chat template, so the turn re-prefills from near token
|
|
761
|
+
* zero. An empty list removes the tools.
|
|
762
|
+
*/
|
|
763
|
+
tools: Array<RustToolInterface> | undefined
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Generated factory for {@link Options} record objects.
|
|
768
|
+
*/
|
|
769
|
+
export const Options = (() => {
|
|
770
|
+
const defaults = () => ({sampler: undefined,templateVariables: undefined,tools: undefined
|
|
771
|
+
});
|
|
772
|
+
const create = (() => {
|
|
773
|
+
return uniffiCreateRecord<Options, ReturnType<typeof defaults>>(defaults);
|
|
774
|
+
})();
|
|
775
|
+
return Object.freeze({
|
|
776
|
+
/**
|
|
777
|
+
* Create a frozen instance of {@link Options}, with defaults specified
|
|
778
|
+
* in Rust, in the {@link nobodywho} crate.
|
|
779
|
+
*/
|
|
780
|
+
create,
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Create a frozen instance of {@link Options}, with defaults specified
|
|
784
|
+
* in Rust, in the {@link nobodywho} crate.
|
|
785
|
+
*/
|
|
786
|
+
new: create,
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Defaults specified in the {@link nobodywho} crate.
|
|
790
|
+
*/
|
|
791
|
+
defaults: () => Object.freeze(defaults()) as Partial<Options>,
|
|
792
|
+
|
|
793
|
+
});
|
|
794
|
+
})();
|
|
795
|
+
|
|
796
|
+
const FfiConverterTypeOptions = (() => {
|
|
797
|
+
type TypeName = Options;
|
|
798
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
799
|
+
read(from: RustBuffer): TypeName {
|
|
800
|
+
return {
|
|
801
|
+
sampler: FfiConverterOptionalTypeSamplerConfig.read(from),
|
|
802
|
+
templateVariables: FfiConverterOptionalMapStringBool.read(from),
|
|
803
|
+
tools: FfiConverterOptionalArrayTypeRustTool.read(from)
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
807
|
+
FfiConverterOptionalTypeSamplerConfig.write(value.sampler, into);
|
|
808
|
+
FfiConverterOptionalMapStringBool.write(value.templateVariables, into);
|
|
809
|
+
FfiConverterOptionalArrayTypeRustTool.write(value.tools, into);
|
|
810
|
+
}
|
|
811
|
+
allocationSize(value: TypeName): number {
|
|
812
|
+
return FfiConverterOptionalTypeSamplerConfig.allocationSize(value.sampler) +
|
|
813
|
+
FfiConverterOptionalMapStringBool.allocationSize(value.templateVariables) +
|
|
814
|
+
FfiConverterOptionalArrayTypeRustTool.allocationSize(value.tools);
|
|
815
|
+
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
return new FFIConverter();
|
|
819
|
+
})();
|
|
820
|
+
|
|
821
|
+
|
|
739
822
|
/**
|
|
740
823
|
* A pending tool call waiting for resolution from the language binding.
|
|
741
824
|
*/
|
|
@@ -931,6 +1014,209 @@ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
|
931
1014
|
|
|
932
1015
|
|
|
933
1016
|
|
|
1017
|
+
// Enum: ContentPart
|
|
1018
|
+
export enum ContentPart_Tags {
|
|
1019
|
+
Text = "Text",
|
|
1020
|
+
Image = "Image",
|
|
1021
|
+
Audio = "Audio"
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* One piece of a message: a run of text, or a media file at this position.
|
|
1025
|
+
* The core type's bitmap id is worker-local, so it is not mirrored — media is
|
|
1026
|
+
* re-registered from the path whenever content is handed back in.
|
|
1027
|
+
*/
|
|
1028
|
+
export const ContentPart = (() => {
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
type Text__interface = {
|
|
1032
|
+
tag: ContentPart_Tags.Text;
|
|
1033
|
+
inner: Readonly<{text: string}>
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
class Text_ extends UniffiEnum implements Text__interface {
|
|
1038
|
+
/**
|
|
1039
|
+
* @private
|
|
1040
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1041
|
+
*/
|
|
1042
|
+
readonly [uniffiTypeNameSymbol] = "ContentPart";
|
|
1043
|
+
readonly tag = ContentPart_Tags.Text;
|
|
1044
|
+
readonly inner: Readonly<{text: string}>;
|
|
1045
|
+
constructor(inner: { text: string }) {
|
|
1046
|
+
super("ContentPart", "Text");
|
|
1047
|
+
this.inner = Object.freeze(inner);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
static new(inner: { text: string }): Text_ {
|
|
1051
|
+
return new Text_(inner);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
static instanceOf(obj: any): obj is Text_ {
|
|
1055
|
+
return obj.tag === ContentPart_Tags.Text;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
type Image__interface = {
|
|
1065
|
+
tag: ContentPart_Tags.Image;
|
|
1066
|
+
inner: Readonly<{path: string}>
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
class Image_ extends UniffiEnum implements Image__interface {
|
|
1071
|
+
/**
|
|
1072
|
+
* @private
|
|
1073
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1074
|
+
*/
|
|
1075
|
+
readonly [uniffiTypeNameSymbol] = "ContentPart";
|
|
1076
|
+
readonly tag = ContentPart_Tags.Image;
|
|
1077
|
+
readonly inner: Readonly<{path: string}>;
|
|
1078
|
+
constructor(inner: { path: string }) {
|
|
1079
|
+
super("ContentPart", "Image");
|
|
1080
|
+
this.inner = Object.freeze(inner);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
static new(inner: { path: string }): Image_ {
|
|
1084
|
+
return new Image_(inner);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
static instanceOf(obj: any): obj is Image_ {
|
|
1088
|
+
return obj.tag === ContentPart_Tags.Image;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
type Audio__interface = {
|
|
1098
|
+
tag: ContentPart_Tags.Audio;
|
|
1099
|
+
inner: Readonly<{path: string}>
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
class Audio_ extends UniffiEnum implements Audio__interface {
|
|
1104
|
+
/**
|
|
1105
|
+
* @private
|
|
1106
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1107
|
+
*/
|
|
1108
|
+
readonly [uniffiTypeNameSymbol] = "ContentPart";
|
|
1109
|
+
readonly tag = ContentPart_Tags.Audio;
|
|
1110
|
+
readonly inner: Readonly<{path: string}>;
|
|
1111
|
+
constructor(inner: { path: string }) {
|
|
1112
|
+
super("ContentPart", "Audio");
|
|
1113
|
+
this.inner = Object.freeze(inner);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
static new(inner: { path: string }): Audio_ {
|
|
1117
|
+
return new Audio_(inner);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
static instanceOf(obj: any): obj is Audio_ {
|
|
1121
|
+
return obj.tag === ContentPart_Tags.Audio;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
function instanceOf(obj: any): obj is ContentPart {
|
|
1130
|
+
return obj[uniffiTypeNameSymbol] === "ContentPart";
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
return Object.freeze({
|
|
1134
|
+
instanceOf,
|
|
1135
|
+
Text: Text_,
|
|
1136
|
+
Image: Image_,
|
|
1137
|
+
Audio: Audio_
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
})();
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* One piece of a message: a run of text, or a media file at this position.
|
|
1145
|
+
* The core type's bitmap id is worker-local, so it is not mirrored — media is
|
|
1146
|
+
* re-registered from the path whenever content is handed back in.
|
|
1147
|
+
*/
|
|
1148
|
+
|
|
1149
|
+
export type ContentPart = InstanceType<
|
|
1150
|
+
typeof ContentPart[keyof Omit<typeof ContentPart, 'instanceOf'>]
|
|
1151
|
+
>;
|
|
1152
|
+
|
|
1153
|
+
// FfiConverter for enum ContentPart
|
|
1154
|
+
const FfiConverterTypeContentPart = (() => {
|
|
1155
|
+
const ordinalConverter = FfiConverterInt32;
|
|
1156
|
+
type TypeName = ContentPart;
|
|
1157
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1158
|
+
read(from: RustBuffer): TypeName {
|
|
1159
|
+
switch (ordinalConverter.read(from)) {
|
|
1160
|
+
case 1: return new ContentPart.Text({text: FfiConverterString.read(from) });
|
|
1161
|
+
case 2: return new ContentPart.Image({path: FfiConverterString.read(from) });
|
|
1162
|
+
case 3: return new ContentPart.Audio({path: FfiConverterString.read(from) });
|
|
1163
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1167
|
+
switch (value.tag) {
|
|
1168
|
+
case ContentPart_Tags.Text: {
|
|
1169
|
+
ordinalConverter.write(1, into);
|
|
1170
|
+
const inner = value.inner;
|
|
1171
|
+
FfiConverterString.write(inner.text, into);
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
case ContentPart_Tags.Image: {
|
|
1175
|
+
ordinalConverter.write(2, into);
|
|
1176
|
+
const inner = value.inner;
|
|
1177
|
+
FfiConverterString.write(inner.path, into);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
case ContentPart_Tags.Audio: {
|
|
1181
|
+
ordinalConverter.write(3, into);
|
|
1182
|
+
const inner = value.inner;
|
|
1183
|
+
FfiConverterString.write(inner.path, into);
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
default:
|
|
1187
|
+
// Throwing from here means that ContentPart_Tags hasn't matched an ordinal.
|
|
1188
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
allocationSize(value: TypeName): number {
|
|
1192
|
+
switch (value.tag) {
|
|
1193
|
+
case ContentPart_Tags.Text: {
|
|
1194
|
+
const inner = value.inner;
|
|
1195
|
+
let size = ordinalConverter.allocationSize(1);
|
|
1196
|
+
size += FfiConverterString.allocationSize(inner.text);
|
|
1197
|
+
return size;
|
|
1198
|
+
}
|
|
1199
|
+
case ContentPart_Tags.Image: {
|
|
1200
|
+
const inner = value.inner;
|
|
1201
|
+
let size = ordinalConverter.allocationSize(2);
|
|
1202
|
+
size += FfiConverterString.allocationSize(inner.path);
|
|
1203
|
+
return size;
|
|
1204
|
+
}
|
|
1205
|
+
case ContentPart_Tags.Audio: {
|
|
1206
|
+
const inner = value.inner;
|
|
1207
|
+
let size = ordinalConverter.allocationSize(3);
|
|
1208
|
+
size += FfiConverterString.allocationSize(inner.path);
|
|
1209
|
+
return size;
|
|
1210
|
+
}
|
|
1211
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
return new FFIConverter();
|
|
1216
|
+
})();
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
934
1220
|
// Enum: Message
|
|
935
1221
|
export enum Message_Tags {
|
|
936
1222
|
User = "User",
|
|
@@ -943,7 +1229,7 @@ export const Message = (() => {
|
|
|
943
1229
|
|
|
944
1230
|
type User__interface = {
|
|
945
1231
|
tag: Message_Tags.User;
|
|
946
|
-
inner: Readonly<{content:
|
|
1232
|
+
inner: Readonly<{content: MessageContent}>
|
|
947
1233
|
};
|
|
948
1234
|
|
|
949
1235
|
|
|
@@ -954,13 +1240,13 @@ export const Message = (() => {
|
|
|
954
1240
|
*/
|
|
955
1241
|
readonly [uniffiTypeNameSymbol] = "Message";
|
|
956
1242
|
readonly tag = Message_Tags.User;
|
|
957
|
-
readonly inner: Readonly<{content:
|
|
958
|
-
constructor(inner: { content:
|
|
1243
|
+
readonly inner: Readonly<{content: MessageContent}>;
|
|
1244
|
+
constructor(inner: { content: MessageContent }) {
|
|
959
1245
|
super("Message", "User");
|
|
960
1246
|
this.inner = Object.freeze(inner);
|
|
961
1247
|
}
|
|
962
1248
|
|
|
963
|
-
static new(inner: { content:
|
|
1249
|
+
static new(inner: { content: MessageContent }): User_ {
|
|
964
1250
|
return new User_(inner);
|
|
965
1251
|
}
|
|
966
1252
|
|
|
@@ -976,7 +1262,7 @@ export const Message = (() => {
|
|
|
976
1262
|
|
|
977
1263
|
type Assistant__interface = {
|
|
978
1264
|
tag: Message_Tags.Assistant;
|
|
979
|
-
inner: Readonly<{content:
|
|
1265
|
+
inner: Readonly<{content: MessageContent; toolCalls: Array<ToolCall> | undefined}>
|
|
980
1266
|
};
|
|
981
1267
|
|
|
982
1268
|
|
|
@@ -987,13 +1273,13 @@ export const Message = (() => {
|
|
|
987
1273
|
*/
|
|
988
1274
|
readonly [uniffiTypeNameSymbol] = "Message";
|
|
989
1275
|
readonly tag = Message_Tags.Assistant;
|
|
990
|
-
readonly inner: Readonly<{content:
|
|
991
|
-
constructor(inner: { content:
|
|
1276
|
+
readonly inner: Readonly<{content: MessageContent; toolCalls: Array<ToolCall> | undefined}>;
|
|
1277
|
+
constructor(inner: { content: MessageContent, toolCalls: Array<ToolCall> | undefined }) {
|
|
992
1278
|
super("Message", "Assistant");
|
|
993
1279
|
this.inner = Object.freeze(inner);
|
|
994
1280
|
}
|
|
995
1281
|
|
|
996
|
-
static new(inner: { content:
|
|
1282
|
+
static new(inner: { content: MessageContent, toolCalls: Array<ToolCall> | undefined }): Assistant_ {
|
|
997
1283
|
return new Assistant_(inner);
|
|
998
1284
|
}
|
|
999
1285
|
|
|
@@ -1009,7 +1295,7 @@ export const Message = (() => {
|
|
|
1009
1295
|
|
|
1010
1296
|
type System__interface = {
|
|
1011
1297
|
tag: Message_Tags.System;
|
|
1012
|
-
inner: Readonly<{content:
|
|
1298
|
+
inner: Readonly<{content: MessageContent}>
|
|
1013
1299
|
};
|
|
1014
1300
|
|
|
1015
1301
|
|
|
@@ -1020,13 +1306,13 @@ export const Message = (() => {
|
|
|
1020
1306
|
*/
|
|
1021
1307
|
readonly [uniffiTypeNameSymbol] = "Message";
|
|
1022
1308
|
readonly tag = Message_Tags.System;
|
|
1023
|
-
readonly inner: Readonly<{content:
|
|
1024
|
-
constructor(inner: { content:
|
|
1309
|
+
readonly inner: Readonly<{content: MessageContent}>;
|
|
1310
|
+
constructor(inner: { content: MessageContent }) {
|
|
1025
1311
|
super("Message", "System");
|
|
1026
1312
|
this.inner = Object.freeze(inner);
|
|
1027
1313
|
}
|
|
1028
1314
|
|
|
1029
|
-
static new(inner: { content:
|
|
1315
|
+
static new(inner: { content: MessageContent }): System_ {
|
|
1030
1316
|
return new System_(inner);
|
|
1031
1317
|
}
|
|
1032
1318
|
|
|
@@ -1042,7 +1328,7 @@ export const Message = (() => {
|
|
|
1042
1328
|
|
|
1043
1329
|
type Tool__interface = {
|
|
1044
1330
|
tag: Message_Tags.Tool;
|
|
1045
|
-
inner: Readonly<{name: string; content:
|
|
1331
|
+
inner: Readonly<{name: string; content: MessageContent}>
|
|
1046
1332
|
};
|
|
1047
1333
|
|
|
1048
1334
|
|
|
@@ -1053,13 +1339,13 @@ export const Message = (() => {
|
|
|
1053
1339
|
*/
|
|
1054
1340
|
readonly [uniffiTypeNameSymbol] = "Message";
|
|
1055
1341
|
readonly tag = Message_Tags.Tool;
|
|
1056
|
-
readonly inner: Readonly<{name: string; content:
|
|
1057
|
-
constructor(inner: { name: string, content:
|
|
1342
|
+
readonly inner: Readonly<{name: string; content: MessageContent}>;
|
|
1343
|
+
constructor(inner: { name: string, content: MessageContent }) {
|
|
1058
1344
|
super("Message", "Tool");
|
|
1059
1345
|
this.inner = Object.freeze(inner);
|
|
1060
1346
|
}
|
|
1061
1347
|
|
|
1062
|
-
static new(inner: { name: string, content:
|
|
1348
|
+
static new(inner: { name: string, content: MessageContent }): Tool_ {
|
|
1063
1349
|
return new Tool_(inner);
|
|
1064
1350
|
}
|
|
1065
1351
|
|
|
@@ -1099,10 +1385,10 @@ const FfiConverterTypeMessage = (() => {
|
|
|
1099
1385
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1100
1386
|
read(from: RustBuffer): TypeName {
|
|
1101
1387
|
switch (ordinalConverter.read(from)) {
|
|
1102
|
-
case 1: return new Message.User({content:
|
|
1103
|
-
case 2: return new Message.Assistant({content:
|
|
1104
|
-
case 3: return new Message.System({content:
|
|
1105
|
-
case 4: return new Message.Tool({name: FfiConverterString.read(from), content:
|
|
1388
|
+
case 1: return new Message.User({content: FfiConverterTypeMessageContent.read(from) });
|
|
1389
|
+
case 2: return new Message.Assistant({content: FfiConverterTypeMessageContent.read(from), toolCalls: FfiConverterOptionalArrayTypeToolCall.read(from) });
|
|
1390
|
+
case 3: return new Message.System({content: FfiConverterTypeMessageContent.read(from) });
|
|
1391
|
+
case 4: return new Message.Tool({name: FfiConverterString.read(from), content: FfiConverterTypeMessageContent.read(from) });
|
|
1106
1392
|
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1107
1393
|
}
|
|
1108
1394
|
}
|
|
@@ -1111,28 +1397,27 @@ const FfiConverterTypeMessage = (() => {
|
|
|
1111
1397
|
case Message_Tags.User: {
|
|
1112
1398
|
ordinalConverter.write(1, into);
|
|
1113
1399
|
const inner = value.inner;
|
|
1114
|
-
|
|
1115
|
-
FfiConverterArrayTypeAsset.write(inner.assets, into);
|
|
1400
|
+
FfiConverterTypeMessageContent.write(inner.content, into);
|
|
1116
1401
|
return;
|
|
1117
1402
|
}
|
|
1118
1403
|
case Message_Tags.Assistant: {
|
|
1119
1404
|
ordinalConverter.write(2, into);
|
|
1120
1405
|
const inner = value.inner;
|
|
1121
|
-
|
|
1406
|
+
FfiConverterTypeMessageContent.write(inner.content, into);
|
|
1122
1407
|
FfiConverterOptionalArrayTypeToolCall.write(inner.toolCalls, into);
|
|
1123
1408
|
return;
|
|
1124
1409
|
}
|
|
1125
1410
|
case Message_Tags.System: {
|
|
1126
1411
|
ordinalConverter.write(3, into);
|
|
1127
1412
|
const inner = value.inner;
|
|
1128
|
-
|
|
1413
|
+
FfiConverterTypeMessageContent.write(inner.content, into);
|
|
1129
1414
|
return;
|
|
1130
1415
|
}
|
|
1131
1416
|
case Message_Tags.Tool: {
|
|
1132
1417
|
ordinalConverter.write(4, into);
|
|
1133
1418
|
const inner = value.inner;
|
|
1134
1419
|
FfiConverterString.write(inner.name, into);
|
|
1135
|
-
|
|
1420
|
+
FfiConverterTypeMessageContent.write(inner.content, into);
|
|
1136
1421
|
return;
|
|
1137
1422
|
}
|
|
1138
1423
|
default:
|
|
@@ -1145,28 +1430,27 @@ const FfiConverterTypeMessage = (() => {
|
|
|
1145
1430
|
case Message_Tags.User: {
|
|
1146
1431
|
const inner = value.inner;
|
|
1147
1432
|
let size = ordinalConverter.allocationSize(1);
|
|
1148
|
-
size +=
|
|
1149
|
-
size += FfiConverterArrayTypeAsset.allocationSize(inner.assets);
|
|
1433
|
+
size += FfiConverterTypeMessageContent.allocationSize(inner.content);
|
|
1150
1434
|
return size;
|
|
1151
1435
|
}
|
|
1152
1436
|
case Message_Tags.Assistant: {
|
|
1153
1437
|
const inner = value.inner;
|
|
1154
1438
|
let size = ordinalConverter.allocationSize(2);
|
|
1155
|
-
size +=
|
|
1439
|
+
size += FfiConverterTypeMessageContent.allocationSize(inner.content);
|
|
1156
1440
|
size += FfiConverterOptionalArrayTypeToolCall.allocationSize(inner.toolCalls);
|
|
1157
1441
|
return size;
|
|
1158
1442
|
}
|
|
1159
1443
|
case Message_Tags.System: {
|
|
1160
1444
|
const inner = value.inner;
|
|
1161
1445
|
let size = ordinalConverter.allocationSize(3);
|
|
1162
|
-
size +=
|
|
1446
|
+
size += FfiConverterTypeMessageContent.allocationSize(inner.content);
|
|
1163
1447
|
return size;
|
|
1164
1448
|
}
|
|
1165
1449
|
case Message_Tags.Tool: {
|
|
1166
1450
|
const inner = value.inner;
|
|
1167
1451
|
let size = ordinalConverter.allocationSize(4);
|
|
1168
1452
|
size += FfiConverterString.allocationSize(inner.name);
|
|
1169
|
-
size +=
|
|
1453
|
+
size += FfiConverterTypeMessageContent.allocationSize(inner.content);
|
|
1170
1454
|
return size;
|
|
1171
1455
|
}
|
|
1172
1456
|
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
@@ -1178,94 +1462,18 @@ const FfiConverterTypeMessage = (() => {
|
|
|
1178
1462
|
|
|
1179
1463
|
|
|
1180
1464
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
export enum NobodyWhoError_Tags {
|
|
1184
|
-
Error = "Error"
|
|
1185
|
-
}
|
|
1186
|
-
export const NobodyWhoError = (() => {
|
|
1187
|
-
class Error extends UniffiError {
|
|
1188
|
-
/**
|
|
1189
|
-
* @private
|
|
1190
|
-
* This field is private and should not be used.
|
|
1191
|
-
*/
|
|
1192
|
-
readonly [uniffiTypeNameSymbol]: string = "NobodyWhoError";
|
|
1193
|
-
/**
|
|
1194
|
-
* @private
|
|
1195
|
-
* This field is private and should not be used.
|
|
1196
|
-
*/
|
|
1197
|
-
readonly [variantOrdinalSymbol] = 1;
|
|
1198
|
-
|
|
1199
|
-
readonly tag = NobodyWhoError_Tags.Error;
|
|
1200
|
-
|
|
1201
|
-
constructor(message: string) {
|
|
1202
|
-
super("NobodyWhoError", "Error", message);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
static instanceOf(e: any): e is Error {
|
|
1206
|
-
return (
|
|
1207
|
-
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1
|
|
1208
|
-
);
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
// Utility function which does not rely on instanceof.
|
|
1213
|
-
function instanceOf(e: any): e is NobodyWhoError {
|
|
1214
|
-
return (e as any)[uniffiTypeNameSymbol] === "NobodyWhoError";
|
|
1215
|
-
}
|
|
1216
|
-
return {
|
|
1217
|
-
Error,
|
|
1218
|
-
instanceOf,
|
|
1219
|
-
};
|
|
1220
|
-
})();
|
|
1221
|
-
|
|
1222
|
-
// Union type for NobodyWhoError error type.
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
export type NobodyWhoError = InstanceType<
|
|
1226
|
-
typeof NobodyWhoError[keyof Omit<typeof NobodyWhoError, 'instanceOf'>]
|
|
1227
|
-
>;
|
|
1228
|
-
|
|
1229
|
-
const FfiConverterTypeNobodyWhoError = (() => {
|
|
1230
|
-
const intConverter = FfiConverterInt32;
|
|
1231
|
-
type TypeName = NobodyWhoError;
|
|
1232
|
-
class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1233
|
-
read(from: RustBuffer): TypeName {
|
|
1234
|
-
switch (intConverter.read(from)) {
|
|
1235
|
-
case 1: return new NobodyWhoError.Error(FfiConverterString.read(from)
|
|
1236
|
-
);
|
|
1237
|
-
|
|
1238
|
-
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
write(value: TypeName, into: RustBuffer): void {
|
|
1242
|
-
const obj = value as any;
|
|
1243
|
-
const index = obj[variantOrdinalSymbol] as number;
|
|
1244
|
-
intConverter.write(index, into);
|
|
1245
|
-
}
|
|
1246
|
-
allocationSize(value: TypeName): number {
|
|
1247
|
-
return intConverter.allocationSize(0);
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
return new FfiConverter();
|
|
1251
|
-
})();
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
// Enum: PromptPart
|
|
1255
|
-
export enum PromptPart_Tags {
|
|
1465
|
+
// Enum: MessageContent
|
|
1466
|
+
export enum MessageContent_Tags {
|
|
1256
1467
|
Text = "Text",
|
|
1257
|
-
|
|
1258
|
-
|
|
1468
|
+
Parts = "Parts",
|
|
1469
|
+
Json = "Json"
|
|
1259
1470
|
}
|
|
1260
|
-
|
|
1261
|
-
* A part of a multimodal prompt. Mirrors the core `PromptPart` enum.
|
|
1262
|
-
*/
|
|
1263
|
-
export const PromptPart = (() => {
|
|
1471
|
+
export const MessageContent = (() => {
|
|
1264
1472
|
|
|
1265
1473
|
|
|
1266
1474
|
type Text__interface = {
|
|
1267
|
-
tag:
|
|
1268
|
-
inner: Readonly<{
|
|
1475
|
+
tag: MessageContent_Tags.Text;
|
|
1476
|
+
inner: Readonly<{text: string}>
|
|
1269
1477
|
};
|
|
1270
1478
|
|
|
1271
1479
|
|
|
@@ -1274,20 +1482,20 @@ export const PromptPart = (() => {
|
|
|
1274
1482
|
* @private
|
|
1275
1483
|
* This field is private and should not be used, use `tag` instead.
|
|
1276
1484
|
*/
|
|
1277
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
1278
|
-
readonly tag =
|
|
1279
|
-
readonly inner: Readonly<{
|
|
1280
|
-
constructor(inner: {
|
|
1281
|
-
super("
|
|
1485
|
+
readonly [uniffiTypeNameSymbol] = "MessageContent";
|
|
1486
|
+
readonly tag = MessageContent_Tags.Text;
|
|
1487
|
+
readonly inner: Readonly<{text: string}>;
|
|
1488
|
+
constructor(inner: { text: string }) {
|
|
1489
|
+
super("MessageContent", "Text");
|
|
1282
1490
|
this.inner = Object.freeze(inner);
|
|
1283
1491
|
}
|
|
1284
1492
|
|
|
1285
|
-
static new(inner: {
|
|
1493
|
+
static new(inner: { text: string }): Text_ {
|
|
1286
1494
|
return new Text_(inner);
|
|
1287
1495
|
}
|
|
1288
1496
|
|
|
1289
1497
|
static instanceOf(obj: any): obj is Text_ {
|
|
1290
|
-
return obj.tag ===
|
|
1498
|
+
return obj.tag === MessageContent_Tags.Text;
|
|
1291
1499
|
}
|
|
1292
1500
|
|
|
1293
1501
|
|
|
@@ -1296,31 +1504,31 @@ export const PromptPart = (() => {
|
|
|
1296
1504
|
}
|
|
1297
1505
|
|
|
1298
1506
|
|
|
1299
|
-
type
|
|
1300
|
-
tag:
|
|
1301
|
-
inner: Readonly<{
|
|
1507
|
+
type Parts__interface = {
|
|
1508
|
+
tag: MessageContent_Tags.Parts;
|
|
1509
|
+
inner: Readonly<{parts: Array<ContentPart>}>
|
|
1302
1510
|
};
|
|
1303
1511
|
|
|
1304
1512
|
|
|
1305
|
-
class
|
|
1513
|
+
class Parts_ extends UniffiEnum implements Parts__interface {
|
|
1306
1514
|
/**
|
|
1307
1515
|
* @private
|
|
1308
1516
|
* This field is private and should not be used, use `tag` instead.
|
|
1309
1517
|
*/
|
|
1310
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
1311
|
-
readonly tag =
|
|
1312
|
-
readonly inner: Readonly<{
|
|
1313
|
-
constructor(inner: {
|
|
1314
|
-
super("
|
|
1518
|
+
readonly [uniffiTypeNameSymbol] = "MessageContent";
|
|
1519
|
+
readonly tag = MessageContent_Tags.Parts;
|
|
1520
|
+
readonly inner: Readonly<{parts: Array<ContentPart>}>;
|
|
1521
|
+
constructor(inner: { parts: Array<ContentPart> }) {
|
|
1522
|
+
super("MessageContent", "Parts");
|
|
1315
1523
|
this.inner = Object.freeze(inner);
|
|
1316
1524
|
}
|
|
1317
1525
|
|
|
1318
|
-
static new(inner: {
|
|
1319
|
-
return new
|
|
1526
|
+
static new(inner: { parts: Array<ContentPart> }): Parts_ {
|
|
1527
|
+
return new Parts_(inner);
|
|
1320
1528
|
}
|
|
1321
1529
|
|
|
1322
|
-
static instanceOf(obj: any): obj is
|
|
1323
|
-
return obj.tag ===
|
|
1530
|
+
static instanceOf(obj: any): obj is Parts_ {
|
|
1531
|
+
return obj.tag === MessageContent_Tags.Parts;
|
|
1324
1532
|
}
|
|
1325
1533
|
|
|
1326
1534
|
|
|
@@ -1329,120 +1537,236 @@ export const PromptPart = (() => {
|
|
|
1329
1537
|
}
|
|
1330
1538
|
|
|
1331
1539
|
|
|
1332
|
-
type
|
|
1333
|
-
tag:
|
|
1334
|
-
inner: Readonly<{
|
|
1540
|
+
type Json__interface = {
|
|
1541
|
+
tag: MessageContent_Tags.Json;
|
|
1542
|
+
inner: Readonly<{json: string}>
|
|
1335
1543
|
};
|
|
1336
1544
|
|
|
1337
1545
|
|
|
1338
|
-
|
|
1546
|
+
/**
|
|
1547
|
+
* JSON-encoded. Chat templates written for structured content receive it
|
|
1548
|
+
* as a real list or map rather than as a string.
|
|
1549
|
+
*/
|
|
1550
|
+
class Json_ extends UniffiEnum implements Json__interface {
|
|
1339
1551
|
/**
|
|
1340
1552
|
* @private
|
|
1341
1553
|
* This field is private and should not be used, use `tag` instead.
|
|
1342
1554
|
*/
|
|
1343
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
1344
|
-
readonly tag =
|
|
1345
|
-
readonly inner: Readonly<{
|
|
1346
|
-
constructor(inner: {
|
|
1347
|
-
super("
|
|
1555
|
+
readonly [uniffiTypeNameSymbol] = "MessageContent";
|
|
1556
|
+
readonly tag = MessageContent_Tags.Json;
|
|
1557
|
+
readonly inner: Readonly<{json: string}>;
|
|
1558
|
+
constructor(inner: { json: string }) {
|
|
1559
|
+
super("MessageContent", "Json");
|
|
1348
1560
|
this.inner = Object.freeze(inner);
|
|
1349
1561
|
}
|
|
1350
1562
|
|
|
1351
|
-
static new(inner: {
|
|
1352
|
-
return new
|
|
1563
|
+
static new(inner: { json: string }): Json_ {
|
|
1564
|
+
return new Json_(inner);
|
|
1353
1565
|
}
|
|
1354
1566
|
|
|
1355
|
-
static instanceOf(obj: any): obj is
|
|
1356
|
-
return obj.tag ===
|
|
1567
|
+
static instanceOf(obj: any): obj is Json_ {
|
|
1568
|
+
return obj.tag === MessageContent_Tags.Json;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
function instanceOf(obj: any): obj is MessageContent {
|
|
1577
|
+
return obj[uniffiTypeNameSymbol] === "MessageContent";
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
return Object.freeze({
|
|
1581
|
+
instanceOf,
|
|
1582
|
+
Text: Text_,
|
|
1583
|
+
Parts: Parts_,
|
|
1584
|
+
Json: Json_
|
|
1585
|
+
});
|
|
1586
|
+
|
|
1587
|
+
})();
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
export type MessageContent = InstanceType<
|
|
1592
|
+
typeof MessageContent[keyof Omit<typeof MessageContent, 'instanceOf'>]
|
|
1593
|
+
>;
|
|
1594
|
+
|
|
1595
|
+
// FfiConverter for enum MessageContent
|
|
1596
|
+
const FfiConverterTypeMessageContent = (() => {
|
|
1597
|
+
const ordinalConverter = FfiConverterInt32;
|
|
1598
|
+
type TypeName = MessageContent;
|
|
1599
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1600
|
+
read(from: RustBuffer): TypeName {
|
|
1601
|
+
switch (ordinalConverter.read(from)) {
|
|
1602
|
+
case 1: return new MessageContent.Text({text: FfiConverterString.read(from) });
|
|
1603
|
+
case 2: return new MessageContent.Parts({parts: FfiConverterArrayTypeContentPart.read(from) });
|
|
1604
|
+
case 3: return new MessageContent.Json({json: FfiConverterString.read(from) });
|
|
1605
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1609
|
+
switch (value.tag) {
|
|
1610
|
+
case MessageContent_Tags.Text: {
|
|
1611
|
+
ordinalConverter.write(1, into);
|
|
1612
|
+
const inner = value.inner;
|
|
1613
|
+
FfiConverterString.write(inner.text, into);
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
case MessageContent_Tags.Parts: {
|
|
1617
|
+
ordinalConverter.write(2, into);
|
|
1618
|
+
const inner = value.inner;
|
|
1619
|
+
FfiConverterArrayTypeContentPart.write(inner.parts, into);
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
case MessageContent_Tags.Json: {
|
|
1623
|
+
ordinalConverter.write(3, into);
|
|
1624
|
+
const inner = value.inner;
|
|
1625
|
+
FfiConverterString.write(inner.json, into);
|
|
1626
|
+
return;
|
|
1627
|
+
}
|
|
1628
|
+
default:
|
|
1629
|
+
// Throwing from here means that MessageContent_Tags hasn't matched an ordinal.
|
|
1630
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
allocationSize(value: TypeName): number {
|
|
1634
|
+
switch (value.tag) {
|
|
1635
|
+
case MessageContent_Tags.Text: {
|
|
1636
|
+
const inner = value.inner;
|
|
1637
|
+
let size = ordinalConverter.allocationSize(1);
|
|
1638
|
+
size += FfiConverterString.allocationSize(inner.text);
|
|
1639
|
+
return size;
|
|
1640
|
+
}
|
|
1641
|
+
case MessageContent_Tags.Parts: {
|
|
1642
|
+
const inner = value.inner;
|
|
1643
|
+
let size = ordinalConverter.allocationSize(2);
|
|
1644
|
+
size += FfiConverterArrayTypeContentPart.allocationSize(inner.parts);
|
|
1645
|
+
return size;
|
|
1646
|
+
}
|
|
1647
|
+
case MessageContent_Tags.Json: {
|
|
1648
|
+
const inner = value.inner;
|
|
1649
|
+
let size = ordinalConverter.allocationSize(3);
|
|
1650
|
+
size += FfiConverterString.allocationSize(inner.json);
|
|
1651
|
+
return size;
|
|
1652
|
+
}
|
|
1653
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
return new FFIConverter();
|
|
1658
|
+
})();
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
// Flat error type: NobodyWhoError
|
|
1664
|
+
export enum NobodyWhoError_Tags {
|
|
1665
|
+
Error = "Error"
|
|
1666
|
+
}
|
|
1667
|
+
export const NobodyWhoError = (() => {
|
|
1668
|
+
class Error extends UniffiError {
|
|
1669
|
+
/**
|
|
1670
|
+
* @private
|
|
1671
|
+
* This field is private and should not be used.
|
|
1672
|
+
*/
|
|
1673
|
+
readonly [uniffiTypeNameSymbol]: string = "NobodyWhoError";
|
|
1674
|
+
/**
|
|
1675
|
+
* @private
|
|
1676
|
+
* This field is private and should not be used.
|
|
1677
|
+
*/
|
|
1678
|
+
readonly [variantOrdinalSymbol] = 1;
|
|
1679
|
+
|
|
1680
|
+
readonly tag = NobodyWhoError_Tags.Error;
|
|
1681
|
+
|
|
1682
|
+
constructor(message: string) {
|
|
1683
|
+
super("NobodyWhoError", "Error", message);
|
|
1357
1684
|
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
1685
|
|
|
1686
|
+
static instanceOf(e: any): e is Error {
|
|
1687
|
+
return (
|
|
1688
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1362
1691
|
}
|
|
1363
1692
|
|
|
1364
|
-
function
|
|
1365
|
-
|
|
1693
|
+
// Utility function which does not rely on instanceof.
|
|
1694
|
+
function instanceOf(e: any): e is NobodyWhoError {
|
|
1695
|
+
return (e as any)[uniffiTypeNameSymbol] === "NobodyWhoError";
|
|
1366
1696
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1697
|
+
return {
|
|
1698
|
+
Error,
|
|
1369
1699
|
instanceOf,
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1700
|
+
};
|
|
1701
|
+
})();
|
|
1702
|
+
|
|
1703
|
+
// Union type for NobodyWhoError error type.
|
|
1704
|
+
|
|
1374
1705
|
|
|
1706
|
+
export type NobodyWhoError = InstanceType<
|
|
1707
|
+
typeof NobodyWhoError[keyof Omit<typeof NobodyWhoError, 'instanceOf'>]
|
|
1708
|
+
>;
|
|
1709
|
+
|
|
1710
|
+
const FfiConverterTypeNobodyWhoError = (() => {
|
|
1711
|
+
const intConverter = FfiConverterInt32;
|
|
1712
|
+
type TypeName = NobodyWhoError;
|
|
1713
|
+
class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1714
|
+
read(from: RustBuffer): TypeName {
|
|
1715
|
+
switch (intConverter.read(from)) {
|
|
1716
|
+
case 1: return new NobodyWhoError.Error(FfiConverterString.read(from)
|
|
1717
|
+
);
|
|
1718
|
+
|
|
1719
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1723
|
+
const obj = value as any;
|
|
1724
|
+
const index = obj[variantOrdinalSymbol] as number;
|
|
1725
|
+
intConverter.write(index, into);
|
|
1726
|
+
}
|
|
1727
|
+
allocationSize(value: TypeName): number {
|
|
1728
|
+
return intConverter.allocationSize(0);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
return new FfiConverter();
|
|
1375
1732
|
})();
|
|
1376
1733
|
|
|
1377
1734
|
|
|
1378
1735
|
/**
|
|
1379
|
-
*
|
|
1736
|
+
* `push` always returns one of these: `Speech`/`Silence` for the confirmed
|
|
1737
|
+
* state when unchanged since the last call, or `SpeechStarted`/`SpeechEnded`
|
|
1738
|
+
* on the call that confirmed the transition.
|
|
1380
1739
|
*/
|
|
1740
|
+
export enum VoiceActivityDetectionEvent {
|
|
1741
|
+
Speech,
|
|
1742
|
+
SpeechStarted,
|
|
1743
|
+
SpeechEnded,
|
|
1744
|
+
Silence
|
|
1745
|
+
}
|
|
1381
1746
|
|
|
1382
|
-
|
|
1383
|
-
typeof PromptPart[keyof Omit<typeof PromptPart, 'instanceOf'>]
|
|
1384
|
-
>;
|
|
1385
|
-
|
|
1386
|
-
// FfiConverter for enum PromptPart
|
|
1387
|
-
const FfiConverterTypePromptPart = (() => {
|
|
1747
|
+
const FfiConverterTypeVoiceActivityDetectionEvent = (() => {
|
|
1388
1748
|
const ordinalConverter = FfiConverterInt32;
|
|
1389
|
-
type TypeName =
|
|
1749
|
+
type TypeName = VoiceActivityDetectionEvent;
|
|
1390
1750
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1391
1751
|
read(from: RustBuffer): TypeName {
|
|
1392
1752
|
switch (ordinalConverter.read(from)) {
|
|
1393
|
-
case 1: return
|
|
1394
|
-
case 2: return
|
|
1395
|
-
case 3: return
|
|
1753
|
+
case 1: return VoiceActivityDetectionEvent.Speech;
|
|
1754
|
+
case 2: return VoiceActivityDetectionEvent.SpeechStarted;
|
|
1755
|
+
case 3: return VoiceActivityDetectionEvent.SpeechEnded;
|
|
1756
|
+
case 4: return VoiceActivityDetectionEvent.Silence;
|
|
1396
1757
|
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1397
1758
|
}
|
|
1398
1759
|
}
|
|
1399
1760
|
write(value: TypeName, into: RustBuffer): void {
|
|
1400
|
-
switch (value
|
|
1401
|
-
case
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
return;
|
|
1406
|
-
}
|
|
1407
|
-
case PromptPart_Tags.Image: {
|
|
1408
|
-
ordinalConverter.write(2, into);
|
|
1409
|
-
const inner = value.inner;
|
|
1410
|
-
FfiConverterString.write(inner.path, into);
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
case PromptPart_Tags.Audio: {
|
|
1414
|
-
ordinalConverter.write(3, into);
|
|
1415
|
-
const inner = value.inner;
|
|
1416
|
-
FfiConverterString.write(inner.path, into);
|
|
1417
|
-
return;
|
|
1418
|
-
}
|
|
1419
|
-
default:
|
|
1420
|
-
// Throwing from here means that PromptPart_Tags hasn't matched an ordinal.
|
|
1421
|
-
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1761
|
+
switch (value) {
|
|
1762
|
+
case VoiceActivityDetectionEvent.Speech: return ordinalConverter.write(1, into);
|
|
1763
|
+
case VoiceActivityDetectionEvent.SpeechStarted: return ordinalConverter.write(2, into);
|
|
1764
|
+
case VoiceActivityDetectionEvent.SpeechEnded: return ordinalConverter.write(3, into);
|
|
1765
|
+
case VoiceActivityDetectionEvent.Silence: return ordinalConverter.write(4, into);
|
|
1422
1766
|
}
|
|
1423
1767
|
}
|
|
1424
1768
|
allocationSize(value: TypeName): number {
|
|
1425
|
-
|
|
1426
|
-
case PromptPart_Tags.Text: {
|
|
1427
|
-
const inner = value.inner;
|
|
1428
|
-
let size = ordinalConverter.allocationSize(1);
|
|
1429
|
-
size += FfiConverterString.allocationSize(inner.content);
|
|
1430
|
-
return size;
|
|
1431
|
-
}
|
|
1432
|
-
case PromptPart_Tags.Image: {
|
|
1433
|
-
const inner = value.inner;
|
|
1434
|
-
let size = ordinalConverter.allocationSize(2);
|
|
1435
|
-
size += FfiConverterString.allocationSize(inner.path);
|
|
1436
|
-
return size;
|
|
1437
|
-
}
|
|
1438
|
-
case PromptPart_Tags.Audio: {
|
|
1439
|
-
const inner = value.inner;
|
|
1440
|
-
let size = ordinalConverter.allocationSize(3);
|
|
1441
|
-
size += FfiConverterString.allocationSize(inner.path);
|
|
1442
|
-
return size;
|
|
1443
|
-
}
|
|
1444
|
-
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1445
|
-
}
|
|
1769
|
+
return ordinalConverter.allocationSize(0);
|
|
1446
1770
|
}
|
|
1447
1771
|
}
|
|
1448
1772
|
return new FFIConverter();
|
|
@@ -1450,6 +1774,12 @@ const FfiConverterTypePromptPart = (() => {
|
|
|
1450
1774
|
|
|
1451
1775
|
|
|
1452
1776
|
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
// FfiConverter for Map</*i32*/number, /*f32*/number>
|
|
1780
|
+
const FfiConverterMapInt32Float32 = new FfiConverterMap(FfiConverterInt32, FfiConverterFloat32);
|
|
1781
|
+
|
|
1782
|
+
|
|
1453
1783
|
// FfiConverter for Map<string, boolean>
|
|
1454
1784
|
const FfiConverterMapStringBool = new FfiConverterMap(FfiConverterString, FfiConverterBool);
|
|
1455
1785
|
|
|
@@ -1474,10 +1804,23 @@ export interface RustChatInterface {
|
|
|
1474
1804
|
/**
|
|
1475
1805
|
* Send a multimodal prompt (text + images/audio) and get a token stream.
|
|
1476
1806
|
*
|
|
1477
|
-
* `parts` is an ordered list of `
|
|
1807
|
+
* `parts` is an ordered list of `ContentPart` items.
|
|
1478
1808
|
* Image and audio parts should contain a local file-system path.
|
|
1479
1809
|
*/
|
|
1480
|
-
askWithPrompt(parts: Array<
|
|
1810
|
+
askWithPrompt(parts: Array<ContentPart>) : RustTokenStreamInterface;
|
|
1811
|
+
/**
|
|
1812
|
+
* Answer a full list of messages and get a token stream, replacing the chat
|
|
1813
|
+
* history.
|
|
1814
|
+
*
|
|
1815
|
+
* The list is the whole conversation, used as given: it must be non-empty, end
|
|
1816
|
+
* in a user or tool message, and carry a system message only first. That system
|
|
1817
|
+
* message sets the chat's system prompt; leave it out and the prompt already on
|
|
1818
|
+
* the chat is kept. The response is appended, and the next `ask` continues from
|
|
1819
|
+
* there.
|
|
1820
|
+
*
|
|
1821
|
+
* `options` follows the same rule for the chat's other settings.
|
|
1822
|
+
*/
|
|
1823
|
+
complete(messages: Array<Message>, options: Options) /*throws*/: RustTokenStreamInterface;
|
|
1481
1824
|
/**
|
|
1482
1825
|
* Get the current chat history as a list of messages.
|
|
1483
1826
|
*/
|
|
@@ -1544,7 +1887,7 @@ export interface RustChatInterface {
|
|
|
1544
1887
|
* Tokenize a multimodal prompt and return the token IDs.
|
|
1545
1888
|
* Text tokens produce an integer ID; image/audio embedding slots produce null.
|
|
1546
1889
|
*/
|
|
1547
|
-
tokenizeWithPrompt(parts: Array<
|
|
1890
|
+
tokenizeWithPrompt(parts: Array<ContentPart>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*i32*/number | undefined>>;
|
|
1548
1891
|
}
|
|
1549
1892
|
|
|
1550
1893
|
|
|
@@ -1629,14 +1972,40 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
|
|
|
1629
1972
|
/**
|
|
1630
1973
|
* Send a multimodal prompt (text + images/audio) and get a token stream.
|
|
1631
1974
|
*
|
|
1632
|
-
* `parts` is an ordered list of `
|
|
1975
|
+
* `parts` is an ordered list of `ContentPart` items.
|
|
1633
1976
|
* Image and audio parts should contain a local file-system path.
|
|
1634
1977
|
*/
|
|
1635
|
-
askWithPrompt(parts: Array<
|
|
1978
|
+
askWithPrompt(parts: Array<ContentPart>): RustTokenStreamInterface {
|
|
1636
1979
|
return FfiConverterTypeRustTokenStream.lift(uniffiCaller.rustCall(
|
|
1637
1980
|
/*caller:*/ (callStatus) => {
|
|
1638
1981
|
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_ask_with_prompt(uniffiTypeRustChatObjectFactory.clonePointer(this),
|
|
1639
|
-
|
|
1982
|
+
FfiConverterArrayTypeContentPart.lower(parts),
|
|
1983
|
+
callStatus);
|
|
1984
|
+
},
|
|
1985
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
1986
|
+
));
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* Answer a full list of messages and get a token stream, replacing the chat
|
|
1991
|
+
* history.
|
|
1992
|
+
*
|
|
1993
|
+
* The list is the whole conversation, used as given: it must be non-empty, end
|
|
1994
|
+
* in a user or tool message, and carry a system message only first. That system
|
|
1995
|
+
* message sets the chat's system prompt; leave it out and the prompt already on
|
|
1996
|
+
* the chat is kept. The response is appended, and the next `ask` continues from
|
|
1997
|
+
* there.
|
|
1998
|
+
*
|
|
1999
|
+
* `options` follows the same rule for the chat's other settings.
|
|
2000
|
+
*/
|
|
2001
|
+
complete(messages: Array<Message>, options: Options): RustTokenStreamInterface /*throws*/ {
|
|
2002
|
+
return FfiConverterTypeRustTokenStream.lift(
|
|
2003
|
+
uniffiCaller.rustCallWithError(
|
|
2004
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
2005
|
+
/*caller:*/ (callStatus) => {
|
|
2006
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_complete(uniffiTypeRustChatObjectFactory.clonePointer(this),
|
|
2007
|
+
FfiConverterArrayTypeMessage.lower(messages),
|
|
2008
|
+
FfiConverterTypeOptions.lower(options),
|
|
1640
2009
|
callStatus);
|
|
1641
2010
|
},
|
|
1642
2011
|
/*liftString:*/ FfiConverterString.lift,
|
|
@@ -2094,7 +2463,7 @@ async tokenize(message: string, asyncOpts_?: { signal: AbortSignal }): Promise<
|
|
|
2094
2463
|
* Tokenize a multimodal prompt and return the token IDs.
|
|
2095
2464
|
* Text tokens produce an integer ID; image/audio embedding slots produce null.
|
|
2096
2465
|
*/
|
|
2097
|
-
async tokenizeWithPrompt(parts: Array<
|
|
2466
|
+
async tokenizeWithPrompt(parts: Array<ContentPart>, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*i32*/number | undefined>> /*throws*/ {
|
|
2098
2467
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2099
2468
|
try {
|
|
2100
2469
|
return await uniffiRustCallAsync(
|
|
@@ -2102,7 +2471,7 @@ async tokenizeWithPrompt(parts: Array<PromptPart>, asyncOpts_?: { signal: Abort
|
|
|
2102
2471
|
/*rustFutureFunc:*/ () => {
|
|
2103
2472
|
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_tokenize_with_prompt(
|
|
2104
2473
|
uniffiTypeRustChatObjectFactory.clonePointer(this),
|
|
2105
|
-
|
|
2474
|
+
FfiConverterArrayTypeContentPart.lower(parts)
|
|
2106
2475
|
);
|
|
2107
2476
|
},
|
|
2108
2477
|
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
@@ -2384,6 +2753,10 @@ export interface RustEncoderInterface {
|
|
|
2384
2753
|
* Encode text into an embedding vector.
|
|
2385
2754
|
*/
|
|
2386
2755
|
encode(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*f32*/number>>;
|
|
2756
|
+
/**
|
|
2757
|
+
* Encode multiple texts into embedding vectors, preserving input order.
|
|
2758
|
+
*/
|
|
2759
|
+
encodeBatch(texts: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Array</*f32*/number>>>;
|
|
2387
2760
|
}
|
|
2388
2761
|
|
|
2389
2762
|
|
|
@@ -2445,6 +2818,37 @@ async encode(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array
|
|
|
2445
2818
|
}
|
|
2446
2819
|
}
|
|
2447
2820
|
|
|
2821
|
+
/**
|
|
2822
|
+
* Encode multiple texts into embedding vectors, preserving input order.
|
|
2823
|
+
*/
|
|
2824
|
+
async encodeBatch(texts: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<Array<Array</*f32*/number>>> /*throws*/ {
|
|
2825
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2826
|
+
try {
|
|
2827
|
+
return await uniffiRustCallAsync(
|
|
2828
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2829
|
+
/*rustFutureFunc:*/ () => {
|
|
2830
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustencoder_encode_batch(
|
|
2831
|
+
uniffiTypeRustEncoderObjectFactory.clonePointer(this),
|
|
2832
|
+
FfiConverterArrayString.lower(texts)
|
|
2833
|
+
);
|
|
2834
|
+
},
|
|
2835
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
2836
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
2837
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
2838
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
2839
|
+
/*liftFunc:*/ FfiConverterArrayArrayFloat32.lift.bind(FfiConverterArrayArrayFloat32),
|
|
2840
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
2841
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2842
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
2843
|
+
);
|
|
2844
|
+
} catch (__error: any) {
|
|
2845
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
2846
|
+
__error.stack = __stack;
|
|
2847
|
+
}
|
|
2848
|
+
throw __error;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2448
2852
|
|
|
2449
2853
|
/**
|
|
2450
2854
|
* {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
|
|
@@ -2627,35 +3031,35 @@ const FfiConverterTypeRustModel = new FfiConverterObject(uniffiTypeRustModelObj
|
|
|
2627
3031
|
|
|
2628
3032
|
|
|
2629
3033
|
/**
|
|
2630
|
-
* Speech-to-text handle. Wraps `nobodywho::
|
|
2631
|
-
* Use `transcribe_file` or `transcribe_pcm` to get a `
|
|
3034
|
+
* Speech-to-text handle. Wraps `nobodywho::speech_to_text::SpeechToText`.
|
|
3035
|
+
* Use `transcribe_file` or `transcribe_pcm` to get a `RustSpeechToTextStream`.
|
|
2632
3036
|
*/
|
|
2633
|
-
export interface
|
|
3037
|
+
export interface RustSpeechToTextInterface {
|
|
2634
3038
|
|
|
2635
3039
|
/**
|
|
2636
3040
|
* Start transcribing an audio file (WAV / MP3).
|
|
2637
|
-
* Returns a `
|
|
3041
|
+
* Returns a `RustSpeechToTextStream` to consume tokens as they are generated.
|
|
2638
3042
|
*/
|
|
2639
|
-
transcribeFile(path: string) /*throws*/:
|
|
3043
|
+
transcribeFile(path: string) /*throws*/: RustSpeechToTextStreamInterface;
|
|
2640
3044
|
/**
|
|
2641
3045
|
* Start transcribing raw i16 PCM samples (e.g. from a microphone stream).
|
|
2642
3046
|
* `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
|
|
2643
3047
|
*/
|
|
2644
|
-
transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number) /*throws*/:
|
|
3048
|
+
transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number) /*throws*/: RustSpeechToTextStreamInterface;
|
|
2645
3049
|
}
|
|
2646
3050
|
|
|
2647
3051
|
|
|
2648
3052
|
/**
|
|
2649
|
-
* Speech-to-text handle. Wraps `nobodywho::
|
|
2650
|
-
* Use `transcribe_file` or `transcribe_pcm` to get a `
|
|
3053
|
+
* Speech-to-text handle. Wraps `nobodywho::speech_to_text::SpeechToText`.
|
|
3054
|
+
* Use `transcribe_file` or `transcribe_pcm` to get a `RustSpeechToTextStream`.
|
|
2651
3055
|
*/
|
|
2652
|
-
export class
|
|
3056
|
+
export class RustSpeechToText extends UniffiAbstractObject implements RustSpeechToTextInterface {
|
|
2653
3057
|
|
|
2654
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
3058
|
+
readonly [uniffiTypeNameSymbol] = "RustSpeechToText";
|
|
2655
3059
|
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
2656
3060
|
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
2657
3061
|
/**
|
|
2658
|
-
* Create an
|
|
3062
|
+
* Create an SpeechToText handle. `source` is a HuggingFace repo (`hf://owner/repo`,
|
|
2659
3063
|
* e.g. `"hf://onnx-community/whisper-base"`) or a local directory path.
|
|
2660
3064
|
* `language` is an ISO 639-1 code (e.g. `"en"`); pass `None` to auto-detect.
|
|
2661
3065
|
* `quantization` selects the ONNX precision variant to download and load:
|
|
@@ -2669,7 +3073,7 @@ export class RustStt extends UniffiAbstractObject implements RustSttInterface {
|
|
|
2669
3073
|
uniffiCaller.rustCallWithError(
|
|
2670
3074
|
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
2671
3075
|
/*caller:*/ (callStatus) => {
|
|
2672
|
-
return nativeModule().
|
|
3076
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustspeechtotext_new(
|
|
2673
3077
|
FfiConverterString.lower(source),
|
|
2674
3078
|
FfiConverterOptionalString.lower(language),
|
|
2675
3079
|
FfiConverterOptionalString.lower(quantization),
|
|
@@ -2678,7 +3082,7 @@ export class RustStt extends UniffiAbstractObject implements RustSttInterface {
|
|
|
2678
3082
|
/*liftString:*/ FfiConverterString.lift,
|
|
2679
3083
|
);
|
|
2680
3084
|
this[pointerLiteralSymbol] = pointer;
|
|
2681
|
-
this[destructorGuardSymbol] =
|
|
3085
|
+
this[destructorGuardSymbol] = uniffiTypeRustSpeechToTextObjectFactory.bless(pointer);
|
|
2682
3086
|
}
|
|
2683
3087
|
|
|
2684
3088
|
|
|
@@ -2686,37 +3090,208 @@ export class RustStt extends UniffiAbstractObject implements RustSttInterface {
|
|
|
2686
3090
|
|
|
2687
3091
|
/**
|
|
2688
3092
|
* Start transcribing an audio file (WAV / MP3).
|
|
2689
|
-
* Returns a `
|
|
3093
|
+
* Returns a `RustSpeechToTextStream` to consume tokens as they are generated.
|
|
2690
3094
|
*/
|
|
2691
|
-
transcribeFile(path: string):
|
|
2692
|
-
return
|
|
3095
|
+
transcribeFile(path: string): RustSpeechToTextStreamInterface /*throws*/ {
|
|
3096
|
+
return FfiConverterTypeRustSpeechToTextStream.lift(
|
|
2693
3097
|
uniffiCaller.rustCallWithError(
|
|
2694
3098
|
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
2695
3099
|
/*caller:*/ (callStatus) => {
|
|
2696
|
-
return nativeModule().
|
|
3100
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustspeechtotext_transcribe_file(uniffiTypeRustSpeechToTextObjectFactory.clonePointer(this),
|
|
2697
3101
|
FfiConverterString.lower(path),
|
|
2698
3102
|
callStatus);
|
|
2699
3103
|
},
|
|
2700
3104
|
/*liftString:*/ FfiConverterString.lift,
|
|
2701
|
-
));
|
|
3105
|
+
));
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
/**
|
|
3109
|
+
* Start transcribing raw i16 PCM samples (e.g. from a microphone stream).
|
|
3110
|
+
* `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
|
|
3111
|
+
*/
|
|
3112
|
+
transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number): RustSpeechToTextStreamInterface /*throws*/ {
|
|
3113
|
+
return FfiConverterTypeRustSpeechToTextStream.lift(
|
|
3114
|
+
uniffiCaller.rustCallWithError(
|
|
3115
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
3116
|
+
/*caller:*/ (callStatus) => {
|
|
3117
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustspeechtotext_transcribe_pcm(uniffiTypeRustSpeechToTextObjectFactory.clonePointer(this),
|
|
3118
|
+
FfiConverterArrayInt16.lower(samples),
|
|
3119
|
+
FfiConverterUInt32.lower(sampleRate),
|
|
3120
|
+
callStatus);
|
|
3121
|
+
},
|
|
3122
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
3123
|
+
));
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
/**
|
|
3128
|
+
* {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
|
|
3129
|
+
*/
|
|
3130
|
+
uniffiDestroy(): void {
|
|
3131
|
+
const ptr = (this as any)[destructorGuardSymbol];
|
|
3132
|
+
if (ptr !== undefined) {
|
|
3133
|
+
const pointer = uniffiTypeRustSpeechToTextObjectFactory.pointer(this);
|
|
3134
|
+
uniffiTypeRustSpeechToTextObjectFactory.freePointer(pointer);
|
|
3135
|
+
uniffiTypeRustSpeechToTextObjectFactory.unbless(ptr);
|
|
3136
|
+
delete (this as any)[destructorGuardSymbol];
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
static instanceOf(obj: any): obj is RustSpeechToText {
|
|
3141
|
+
return uniffiTypeRustSpeechToTextObjectFactory.isConcreteType(obj);
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
const uniffiTypeRustSpeechToTextObjectFactory: UniffiObjectFactory<RustSpeechToTextInterface> = (() => {
|
|
3148
|
+
|
|
3149
|
+
return {
|
|
3150
|
+
create(pointer: UniffiHandle): RustSpeechToTextInterface {
|
|
3151
|
+
const instance = Object.create(RustSpeechToText.prototype);
|
|
3152
|
+
instance[pointerLiteralSymbol] = pointer;
|
|
3153
|
+
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
3154
|
+
instance[uniffiTypeNameSymbol] = "RustSpeechToText";
|
|
3155
|
+
return instance;
|
|
3156
|
+
},
|
|
3157
|
+
|
|
3158
|
+
|
|
3159
|
+
bless(p: UniffiHandle): UniffiGcObject {
|
|
3160
|
+
return uniffiCaller.rustCall(
|
|
3161
|
+
/*caller:*/ (status) =>
|
|
3162
|
+
nativeModule().ubrn_uniffi_internal_fn_method_rustspeechtotext_ffi__bless_pointer(p, status),
|
|
3163
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3164
|
+
);
|
|
3165
|
+
},
|
|
3166
|
+
|
|
3167
|
+
unbless(ptr: UniffiGcObject) {
|
|
3168
|
+
ptr.markDestroyed();
|
|
3169
|
+
},
|
|
3170
|
+
|
|
3171
|
+
pointer(obj: RustSpeechToTextInterface): UniffiHandle {
|
|
3172
|
+
if ((obj as any)[destructorGuardSymbol] === undefined) {
|
|
3173
|
+
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
3174
|
+
}
|
|
3175
|
+
return (obj as any)[pointerLiteralSymbol];
|
|
3176
|
+
},
|
|
3177
|
+
|
|
3178
|
+
clonePointer(obj: RustSpeechToTextInterface): UniffiHandle {
|
|
3179
|
+
const pointer = this.pointer(obj);
|
|
3180
|
+
return uniffiCaller.rustCall(
|
|
3181
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustspeechtotext(pointer, callStatus),
|
|
3182
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3183
|
+
);
|
|
3184
|
+
},
|
|
3185
|
+
|
|
3186
|
+
freePointer(pointer: UniffiHandle): void {
|
|
3187
|
+
uniffiCaller.rustCall(
|
|
3188
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustspeechtotext(pointer, callStatus),
|
|
3189
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3190
|
+
);
|
|
3191
|
+
},
|
|
3192
|
+
|
|
3193
|
+
isConcreteType(obj: any): obj is RustSpeechToTextInterface {
|
|
3194
|
+
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustSpeechToText";
|
|
3195
|
+
},
|
|
3196
|
+
}})();
|
|
3197
|
+
// FfiConverter for RustSpeechToTextInterface
|
|
3198
|
+
const FfiConverterTypeRustSpeechToText = new FfiConverterObject(uniffiTypeRustSpeechToTextObjectFactory);
|
|
3199
|
+
|
|
3200
|
+
|
|
3201
|
+
/**
|
|
3202
|
+
* A stream of transcript tokens from a Whisper SpeechToText run.
|
|
3203
|
+
*/
|
|
3204
|
+
export interface RustSpeechToTextStreamInterface {
|
|
3205
|
+
|
|
3206
|
+
/**
|
|
3207
|
+
* Wait for transcription to finish and return the full transcript.
|
|
3208
|
+
*/
|
|
3209
|
+
completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
|
|
3210
|
+
/**
|
|
3211
|
+
* Get the next transcript token. Returns `None` when transcription is complete.
|
|
3212
|
+
*/
|
|
3213
|
+
nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
|
|
3217
|
+
/**
|
|
3218
|
+
* A stream of transcript tokens from a Whisper SpeechToText run.
|
|
3219
|
+
*/
|
|
3220
|
+
export class RustSpeechToTextStream extends UniffiAbstractObject implements RustSpeechToTextStreamInterface {
|
|
3221
|
+
|
|
3222
|
+
readonly [uniffiTypeNameSymbol] = "RustSpeechToTextStream";
|
|
3223
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
3224
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
3225
|
+
// No primary constructor declared for this class.
|
|
3226
|
+
private constructor(pointer: UniffiHandle) {
|
|
3227
|
+
super();
|
|
3228
|
+
this[pointerLiteralSymbol] = pointer;
|
|
3229
|
+
this[destructorGuardSymbol] = uniffiTypeRustSpeechToTextStreamObjectFactory.bless(pointer);
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
|
|
3233
|
+
|
|
3234
|
+
|
|
3235
|
+
/**
|
|
3236
|
+
* Wait for transcription to finish and return the full transcript.
|
|
3237
|
+
*/
|
|
3238
|
+
async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
|
|
3239
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
3240
|
+
try {
|
|
3241
|
+
return await uniffiRustCallAsync(
|
|
3242
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3243
|
+
/*rustFutureFunc:*/ () => {
|
|
3244
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustspeechtotextstream_completed(
|
|
3245
|
+
uniffiTypeRustSpeechToTextStreamObjectFactory.clonePointer(this)
|
|
3246
|
+
|
|
3247
|
+
);
|
|
3248
|
+
},
|
|
3249
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
3250
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
3251
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
3252
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
3253
|
+
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3254
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
3255
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3256
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
3257
|
+
);
|
|
3258
|
+
} catch (__error: any) {
|
|
3259
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
3260
|
+
__error.stack = __stack;
|
|
3261
|
+
}
|
|
3262
|
+
throw __error;
|
|
3263
|
+
}
|
|
2702
3264
|
}
|
|
2703
3265
|
|
|
2704
3266
|
/**
|
|
2705
|
-
*
|
|
2706
|
-
* `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
|
|
3267
|
+
* Get the next transcript token. Returns `None` when transcription is complete.
|
|
2707
3268
|
*/
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
/*
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
3269
|
+
async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
|
|
3270
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
3271
|
+
try {
|
|
3272
|
+
return await uniffiRustCallAsync(
|
|
3273
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3274
|
+
/*rustFutureFunc:*/ () => {
|
|
3275
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustspeechtotextstream_next_token(
|
|
3276
|
+
uniffiTypeRustSpeechToTextStreamObjectFactory.clonePointer(this)
|
|
3277
|
+
|
|
3278
|
+
);
|
|
2717
3279
|
},
|
|
3280
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
3281
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
3282
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
3283
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
3284
|
+
/*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
|
|
2718
3285
|
/*liftString:*/ FfiConverterString.lift,
|
|
2719
|
-
|
|
3286
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3287
|
+
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
3288
|
+
);
|
|
3289
|
+
} catch (__error: any) {
|
|
3290
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
3291
|
+
__error.stack = __stack;
|
|
3292
|
+
}
|
|
3293
|
+
throw __error;
|
|
3294
|
+
}
|
|
2720
3295
|
}
|
|
2721
3296
|
|
|
2722
3297
|
|
|
@@ -2726,28 +3301,28 @@ export class RustStt extends UniffiAbstractObject implements RustSttInterface {
|
|
|
2726
3301
|
uniffiDestroy(): void {
|
|
2727
3302
|
const ptr = (this as any)[destructorGuardSymbol];
|
|
2728
3303
|
if (ptr !== undefined) {
|
|
2729
|
-
const pointer =
|
|
2730
|
-
|
|
2731
|
-
|
|
3304
|
+
const pointer = uniffiTypeRustSpeechToTextStreamObjectFactory.pointer(this);
|
|
3305
|
+
uniffiTypeRustSpeechToTextStreamObjectFactory.freePointer(pointer);
|
|
3306
|
+
uniffiTypeRustSpeechToTextStreamObjectFactory.unbless(ptr);
|
|
2732
3307
|
delete (this as any)[destructorGuardSymbol];
|
|
2733
3308
|
}
|
|
2734
3309
|
}
|
|
2735
3310
|
|
|
2736
|
-
static instanceOf(obj: any): obj is
|
|
2737
|
-
return
|
|
3311
|
+
static instanceOf(obj: any): obj is RustSpeechToTextStream {
|
|
3312
|
+
return uniffiTypeRustSpeechToTextStreamObjectFactory.isConcreteType(obj);
|
|
2738
3313
|
}
|
|
2739
3314
|
|
|
2740
3315
|
|
|
2741
3316
|
}
|
|
2742
3317
|
|
|
2743
|
-
const
|
|
3318
|
+
const uniffiTypeRustSpeechToTextStreamObjectFactory: UniffiObjectFactory<RustSpeechToTextStreamInterface> = (() => {
|
|
2744
3319
|
|
|
2745
3320
|
return {
|
|
2746
|
-
create(pointer: UniffiHandle):
|
|
2747
|
-
const instance = Object.create(
|
|
3321
|
+
create(pointer: UniffiHandle): RustSpeechToTextStreamInterface {
|
|
3322
|
+
const instance = Object.create(RustSpeechToTextStream.prototype);
|
|
2748
3323
|
instance[pointerLiteralSymbol] = pointer;
|
|
2749
3324
|
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
2750
|
-
instance[uniffiTypeNameSymbol] = "
|
|
3325
|
+
instance[uniffiTypeNameSymbol] = "RustSpeechToTextStream";
|
|
2751
3326
|
return instance;
|
|
2752
3327
|
},
|
|
2753
3328
|
|
|
@@ -2755,7 +3330,7 @@ const uniffiTypeRustSttObjectFactory: UniffiObjectFactory<RustSttInterface> = ((
|
|
|
2755
3330
|
bless(p: UniffiHandle): UniffiGcObject {
|
|
2756
3331
|
return uniffiCaller.rustCall(
|
|
2757
3332
|
/*caller:*/ (status) =>
|
|
2758
|
-
nativeModule().
|
|
3333
|
+
nativeModule().ubrn_uniffi_internal_fn_method_rustspeechtotextstream_ffi__bless_pointer(p, status),
|
|
2759
3334
|
/*liftString:*/ FfiConverterString.lift
|
|
2760
3335
|
);
|
|
2761
3336
|
},
|
|
@@ -2764,120 +3339,122 @@ const uniffiTypeRustSttObjectFactory: UniffiObjectFactory<RustSttInterface> = ((
|
|
|
2764
3339
|
ptr.markDestroyed();
|
|
2765
3340
|
},
|
|
2766
3341
|
|
|
2767
|
-
pointer(obj:
|
|
3342
|
+
pointer(obj: RustSpeechToTextStreamInterface): UniffiHandle {
|
|
2768
3343
|
if ((obj as any)[destructorGuardSymbol] === undefined) {
|
|
2769
3344
|
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
2770
3345
|
}
|
|
2771
3346
|
return (obj as any)[pointerLiteralSymbol];
|
|
2772
3347
|
},
|
|
2773
3348
|
|
|
2774
|
-
clonePointer(obj:
|
|
3349
|
+
clonePointer(obj: RustSpeechToTextStreamInterface): UniffiHandle {
|
|
2775
3350
|
const pointer = this.pointer(obj);
|
|
2776
3351
|
return uniffiCaller.rustCall(
|
|
2777
|
-
/*caller:*/ (callStatus) => nativeModule().
|
|
3352
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustspeechtotextstream(pointer, callStatus),
|
|
2778
3353
|
/*liftString:*/ FfiConverterString.lift
|
|
2779
3354
|
);
|
|
2780
3355
|
},
|
|
2781
3356
|
|
|
2782
3357
|
freePointer(pointer: UniffiHandle): void {
|
|
2783
3358
|
uniffiCaller.rustCall(
|
|
2784
|
-
/*caller:*/ (callStatus) => nativeModule().
|
|
3359
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustspeechtotextstream(pointer, callStatus),
|
|
2785
3360
|
/*liftString:*/ FfiConverterString.lift
|
|
2786
3361
|
);
|
|
2787
3362
|
},
|
|
2788
3363
|
|
|
2789
|
-
isConcreteType(obj: any): obj is
|
|
2790
|
-
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "
|
|
3364
|
+
isConcreteType(obj: any): obj is RustSpeechToTextStreamInterface {
|
|
3365
|
+
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustSpeechToTextStream";
|
|
2791
3366
|
},
|
|
2792
3367
|
}})();
|
|
2793
|
-
// FfiConverter for
|
|
2794
|
-
const
|
|
3368
|
+
// FfiConverter for RustSpeechToTextStreamInterface
|
|
3369
|
+
const FfiConverterTypeRustSpeechToTextStream = new FfiConverterObject(uniffiTypeRustSpeechToTextStreamObjectFactory);
|
|
2795
3370
|
|
|
2796
3371
|
|
|
2797
|
-
|
|
2798
|
-
* A stream of transcript tokens from a Whisper STT run.
|
|
2799
|
-
*/
|
|
2800
|
-
export interface RustSttStreamInterface {
|
|
3372
|
+
export interface RustTextToSpeechInterface {
|
|
2801
3373
|
|
|
2802
3374
|
/**
|
|
2803
|
-
*
|
|
3375
|
+
* Synthesize text and return WAV bytes.
|
|
2804
3376
|
*/
|
|
2805
|
-
|
|
3377
|
+
synthesize(text: string) /*throws*/: ArrayBuffer;
|
|
2806
3378
|
/**
|
|
2807
|
-
*
|
|
3379
|
+
* Synthesize text asynchronously and return WAV bytes.
|
|
2808
3380
|
*/
|
|
2809
|
-
|
|
3381
|
+
synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ArrayBuffer>;
|
|
2810
3382
|
}
|
|
2811
3383
|
|
|
2812
3384
|
|
|
2813
|
-
|
|
2814
|
-
* A stream of transcript tokens from a Whisper STT run.
|
|
2815
|
-
*/
|
|
2816
|
-
export class RustSttStream extends UniffiAbstractObject implements RustSttStreamInterface {
|
|
3385
|
+
export class RustTextToSpeech extends UniffiAbstractObject implements RustTextToSpeechInterface {
|
|
2817
3386
|
|
|
2818
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
3387
|
+
readonly [uniffiTypeNameSymbol] = "RustTextToSpeech";
|
|
2819
3388
|
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
2820
3389
|
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
3390
|
+
/**
|
|
3391
|
+
* Create a TextToSpeech synthesizer.
|
|
3392
|
+
*/
|
|
3393
|
+
constructor(source: string, architecture: string | undefined, voice: string | undefined, language: string | undefined, speed: /*f32*/number | undefined, steps: /*u32*/number | undefined, silenceDuration: /*f32*/number | undefined, precision: string | undefined, temperature: /*f32*/number | undefined, huggingfaceToken: string | undefined, device: string | undefined) /*throws*/ {
|
|
3394
|
+
super();
|
|
3395
|
+
const pointer =
|
|
3396
|
+
|
|
3397
|
+
uniffiCaller.rustCallWithError(
|
|
3398
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
3399
|
+
/*caller:*/ (callStatus) => {
|
|
3400
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rusttexttospeech_new(
|
|
3401
|
+
FfiConverterString.lower(source),
|
|
3402
|
+
FfiConverterOptionalString.lower(architecture),
|
|
3403
|
+
FfiConverterOptionalString.lower(voice),
|
|
3404
|
+
FfiConverterOptionalString.lower(language),
|
|
3405
|
+
FfiConverterOptionalFloat32.lower(speed),
|
|
3406
|
+
FfiConverterOptionalUInt32.lower(steps),
|
|
3407
|
+
FfiConverterOptionalFloat32.lower(silenceDuration),
|
|
3408
|
+
FfiConverterOptionalString.lower(precision),
|
|
3409
|
+
FfiConverterOptionalFloat32.lower(temperature),
|
|
3410
|
+
FfiConverterOptionalString.lower(huggingfaceToken),
|
|
3411
|
+
FfiConverterOptionalString.lower(device),
|
|
3412
|
+
callStatus);
|
|
3413
|
+
},
|
|
3414
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
3415
|
+
);
|
|
3416
|
+
this[pointerLiteralSymbol] = pointer;
|
|
3417
|
+
this[destructorGuardSymbol] = uniffiTypeRustTextToSpeechObjectFactory.bless(pointer);
|
|
3418
|
+
}
|
|
2827
3419
|
|
|
2828
3420
|
|
|
2829
3421
|
|
|
2830
3422
|
|
|
2831
3423
|
/**
|
|
2832
|
-
*
|
|
3424
|
+
* Synthesize text and return WAV bytes.
|
|
2833
3425
|
*/
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
/*
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
);
|
|
3426
|
+
synthesize(text: string): ArrayBuffer /*throws*/ {
|
|
3427
|
+
return FfiConverterArrayBuffer.lift(
|
|
3428
|
+
uniffiCaller.rustCallWithError(
|
|
3429
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
3430
|
+
/*caller:*/ (callStatus) => {
|
|
3431
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttexttospeech_synthesize(uniffiTypeRustTextToSpeechObjectFactory.clonePointer(this),
|
|
3432
|
+
FfiConverterString.lower(text),
|
|
3433
|
+
callStatus);
|
|
2844
3434
|
},
|
|
2845
|
-
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
2846
|
-
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
2847
|
-
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
2848
|
-
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
2849
|
-
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2850
3435
|
/*liftString:*/ FfiConverterString.lift,
|
|
2851
|
-
|
|
2852
|
-
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
2853
|
-
);
|
|
2854
|
-
} catch (__error: any) {
|
|
2855
|
-
if (uniffiIsDebug && __error instanceof Error) {
|
|
2856
|
-
__error.stack = __stack;
|
|
2857
|
-
}
|
|
2858
|
-
throw __error;
|
|
2859
|
-
}
|
|
3436
|
+
));
|
|
2860
3437
|
}
|
|
2861
3438
|
|
|
2862
3439
|
/**
|
|
2863
|
-
*
|
|
3440
|
+
* Synthesize text asynchronously and return WAV bytes.
|
|
2864
3441
|
*/
|
|
2865
|
-
async
|
|
3442
|
+
async synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<ArrayBuffer> /*throws*/ {
|
|
2866
3443
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2867
3444
|
try {
|
|
2868
3445
|
return await uniffiRustCallAsync(
|
|
2869
3446
|
/*rustCaller:*/ uniffiCaller,
|
|
2870
3447
|
/*rustFutureFunc:*/ () => {
|
|
2871
|
-
return nativeModule().
|
|
2872
|
-
|
|
2873
|
-
|
|
3448
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttexttospeech_synthesize_async(
|
|
3449
|
+
uniffiTypeRustTextToSpeechObjectFactory.clonePointer(this),
|
|
3450
|
+
FfiConverterString.lower(text)
|
|
2874
3451
|
);
|
|
2875
3452
|
},
|
|
2876
3453
|
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
2877
3454
|
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
2878
3455
|
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
2879
3456
|
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
2880
|
-
/*liftFunc:*/
|
|
3457
|
+
/*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
|
|
2881
3458
|
/*liftString:*/ FfiConverterString.lift,
|
|
2882
3459
|
/*asyncOpts:*/ asyncOpts_,
|
|
2883
3460
|
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
@@ -2897,28 +3474,28 @@ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefin
|
|
|
2897
3474
|
uniffiDestroy(): void {
|
|
2898
3475
|
const ptr = (this as any)[destructorGuardSymbol];
|
|
2899
3476
|
if (ptr !== undefined) {
|
|
2900
|
-
const pointer =
|
|
2901
|
-
|
|
2902
|
-
|
|
3477
|
+
const pointer = uniffiTypeRustTextToSpeechObjectFactory.pointer(this);
|
|
3478
|
+
uniffiTypeRustTextToSpeechObjectFactory.freePointer(pointer);
|
|
3479
|
+
uniffiTypeRustTextToSpeechObjectFactory.unbless(ptr);
|
|
2903
3480
|
delete (this as any)[destructorGuardSymbol];
|
|
2904
3481
|
}
|
|
2905
3482
|
}
|
|
2906
3483
|
|
|
2907
|
-
static instanceOf(obj: any): obj is
|
|
2908
|
-
return
|
|
3484
|
+
static instanceOf(obj: any): obj is RustTextToSpeech {
|
|
3485
|
+
return uniffiTypeRustTextToSpeechObjectFactory.isConcreteType(obj);
|
|
2909
3486
|
}
|
|
2910
3487
|
|
|
2911
3488
|
|
|
2912
3489
|
}
|
|
2913
3490
|
|
|
2914
|
-
const
|
|
3491
|
+
const uniffiTypeRustTextToSpeechObjectFactory: UniffiObjectFactory<RustTextToSpeechInterface> = (() => {
|
|
2915
3492
|
|
|
2916
3493
|
return {
|
|
2917
|
-
create(pointer: UniffiHandle):
|
|
2918
|
-
const instance = Object.create(
|
|
3494
|
+
create(pointer: UniffiHandle): RustTextToSpeechInterface {
|
|
3495
|
+
const instance = Object.create(RustTextToSpeech.prototype);
|
|
2919
3496
|
instance[pointerLiteralSymbol] = pointer;
|
|
2920
3497
|
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
2921
|
-
instance[uniffiTypeNameSymbol] = "
|
|
3498
|
+
instance[uniffiTypeNameSymbol] = "RustTextToSpeech";
|
|
2922
3499
|
return instance;
|
|
2923
3500
|
},
|
|
2924
3501
|
|
|
@@ -2926,7 +3503,7 @@ const uniffiTypeRustSttStreamObjectFactory: UniffiObjectFactory<RustSttStreamInt
|
|
|
2926
3503
|
bless(p: UniffiHandle): UniffiGcObject {
|
|
2927
3504
|
return uniffiCaller.rustCall(
|
|
2928
3505
|
/*caller:*/ (status) =>
|
|
2929
|
-
nativeModule().
|
|
3506
|
+
nativeModule().ubrn_uniffi_internal_fn_method_rusttexttospeech_ffi__bless_pointer(p, status),
|
|
2930
3507
|
/*liftString:*/ FfiConverterString.lift
|
|
2931
3508
|
);
|
|
2932
3509
|
},
|
|
@@ -2935,34 +3512,34 @@ const uniffiTypeRustSttStreamObjectFactory: UniffiObjectFactory<RustSttStreamInt
|
|
|
2935
3512
|
ptr.markDestroyed();
|
|
2936
3513
|
},
|
|
2937
3514
|
|
|
2938
|
-
pointer(obj:
|
|
3515
|
+
pointer(obj: RustTextToSpeechInterface): UniffiHandle {
|
|
2939
3516
|
if ((obj as any)[destructorGuardSymbol] === undefined) {
|
|
2940
3517
|
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
2941
3518
|
}
|
|
2942
3519
|
return (obj as any)[pointerLiteralSymbol];
|
|
2943
3520
|
},
|
|
2944
3521
|
|
|
2945
|
-
clonePointer(obj:
|
|
3522
|
+
clonePointer(obj: RustTextToSpeechInterface): UniffiHandle {
|
|
2946
3523
|
const pointer = this.pointer(obj);
|
|
2947
3524
|
return uniffiCaller.rustCall(
|
|
2948
|
-
/*caller:*/ (callStatus) => nativeModule().
|
|
3525
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rusttexttospeech(pointer, callStatus),
|
|
2949
3526
|
/*liftString:*/ FfiConverterString.lift
|
|
2950
3527
|
);
|
|
2951
3528
|
},
|
|
2952
3529
|
|
|
2953
3530
|
freePointer(pointer: UniffiHandle): void {
|
|
2954
3531
|
uniffiCaller.rustCall(
|
|
2955
|
-
/*caller:*/ (callStatus) => nativeModule().
|
|
3532
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rusttexttospeech(pointer, callStatus),
|
|
2956
3533
|
/*liftString:*/ FfiConverterString.lift
|
|
2957
3534
|
);
|
|
2958
3535
|
},
|
|
2959
3536
|
|
|
2960
|
-
isConcreteType(obj: any): obj is
|
|
2961
|
-
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "
|
|
3537
|
+
isConcreteType(obj: any): obj is RustTextToSpeechInterface {
|
|
3538
|
+
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustTextToSpeech";
|
|
2962
3539
|
},
|
|
2963
3540
|
}})();
|
|
2964
|
-
// FfiConverter for
|
|
2965
|
-
const
|
|
3541
|
+
// FfiConverter for RustTextToSpeechInterface
|
|
3542
|
+
const FfiConverterTypeRustTextToSpeech = new FfiConverterObject(uniffiTypeRustTextToSpeechObjectFactory);
|
|
2966
3543
|
|
|
2967
3544
|
|
|
2968
3545
|
export interface RustTokenStreamInterface {
|
|
@@ -3328,67 +3905,115 @@ const uniffiTypeRustToolObjectFactory: UniffiObjectFactory<RustToolInterface> =
|
|
|
3328
3905
|
const FfiConverterTypeRustTool = new FfiConverterObject(uniffiTypeRustToolObjectFactory);
|
|
3329
3906
|
|
|
3330
3907
|
|
|
3331
|
-
|
|
3908
|
+
/**
|
|
3909
|
+
* Voice activity detector. Wraps `nobodywho::voice_activity_detection::VoiceActivityDetection`.
|
|
3910
|
+
* Feed audio chunks via `push`; once `push` returns `SpeechEnded`, call
|
|
3911
|
+
* `finish` to get that turn's captured audio (with pre-roll) and reset.
|
|
3912
|
+
*/
|
|
3913
|
+
export interface RustVoiceActivityDetectionInterface {
|
|
3332
3914
|
|
|
3333
3915
|
/**
|
|
3334
|
-
*
|
|
3916
|
+
* Return the current turn's captured audio (from the confirmed
|
|
3917
|
+
* `SpeechStarted`, including a small pre-roll, through to
|
|
3918
|
+
* `SpeechEnded`) and reset internal state for the next turn. Empty if
|
|
3919
|
+
* speech was never confirmed.
|
|
3335
3920
|
*/
|
|
3336
|
-
|
|
3921
|
+
finish() : Array</*i16*/number>;
|
|
3337
3922
|
/**
|
|
3338
|
-
*
|
|
3923
|
+
* Feed the newest chunk of i16 PCM audio (not the whole accumulated
|
|
3924
|
+
* buffer — the detector tracks the current turn internally). Always
|
|
3925
|
+
* returns the current confirmed state: `Speech`/`Silence` if unchanged
|
|
3926
|
+
* since the last call, or `SpeechStarted`/`SpeechEnded` on the call that
|
|
3927
|
+
* confirmed the transition.
|
|
3339
3928
|
*/
|
|
3340
|
-
|
|
3929
|
+
push(chunk: Array</*i16*/number>) /*throws*/: VoiceActivityDetectionEvent;
|
|
3930
|
+
/**
|
|
3931
|
+
* Detect every speech segment in a complete audio buffer, returning
|
|
3932
|
+
* each segment's audio (with a short pre-roll) in order. Unlike `push`,
|
|
3933
|
+
* correctly finds every segment regardless of buffer size — use this
|
|
3934
|
+
* for offline/batch processing instead of live streaming.
|
|
3935
|
+
*/
|
|
3936
|
+
segment(samples: Array</*i16*/number>) /*throws*/: Array<Array</*i16*/number>>;
|
|
3341
3937
|
}
|
|
3342
3938
|
|
|
3343
3939
|
|
|
3344
|
-
|
|
3940
|
+
/**
|
|
3941
|
+
* Voice activity detector. Wraps `nobodywho::voice_activity_detection::VoiceActivityDetection`.
|
|
3942
|
+
* Feed audio chunks via `push`; once `push` returns `SpeechEnded`, call
|
|
3943
|
+
* `finish` to get that turn's captured audio (with pre-roll) and reset.
|
|
3944
|
+
*/
|
|
3945
|
+
export class RustVoiceActivityDetection extends UniffiAbstractObject implements RustVoiceActivityDetectionInterface {
|
|
3345
3946
|
|
|
3346
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
3947
|
+
readonly [uniffiTypeNameSymbol] = "RustVoiceActivityDetection";
|
|
3347
3948
|
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
3348
3949
|
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
3349
3950
|
/**
|
|
3350
|
-
* Create a
|
|
3951
|
+
* Create a voice activity detector.
|
|
3952
|
+
*
|
|
3953
|
+
* `source` is a HuggingFace repo (`hf://owner/repo`) or local directory
|
|
3954
|
+
* for the Silero VAD ONNX model; `None` uses the default
|
|
3955
|
+
* (`hf://onnx-community/silero-vad`). `sample_rate` is the rate of the
|
|
3956
|
+
* audio you'll pass to `push` — Silero runs at 16kHz internally,
|
|
3957
|
+
* anything else is resampled. `threshold`, `min_silence_duration_ms`,
|
|
3958
|
+
* `min_speech_duration_ms`, and `preroll_duration_ms` default to the
|
|
3959
|
+
* core `VoiceActivityDetectionConfig` defaults when omitted.
|
|
3351
3960
|
*/
|
|
3352
|
-
constructor(source: string
|
|
3961
|
+
constructor(source: string | undefined, sampleRate: /*u32*/number, threshold: /*f32*/number | undefined, minSilenceDurationMs: /*u32*/number | undefined, minSpeechDurationMs: /*u32*/number | undefined, prerollDurationMs: /*u32*/number | undefined, device: string | undefined) /*throws*/ {
|
|
3353
3962
|
super();
|
|
3354
3963
|
const pointer =
|
|
3355
3964
|
|
|
3356
3965
|
uniffiCaller.rustCallWithError(
|
|
3357
3966
|
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
3358
3967
|
/*caller:*/ (callStatus) => {
|
|
3359
|
-
return nativeModule().
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
FfiConverterOptionalUInt32.lower(
|
|
3366
|
-
FfiConverterOptionalFloat32.lower(silenceDuration),
|
|
3367
|
-
FfiConverterOptionalString.lower(precision),
|
|
3368
|
-
FfiConverterOptionalFloat32.lower(temperature),
|
|
3369
|
-
FfiConverterOptionalString.lower(huggingfaceToken),
|
|
3968
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rustvoiceactivitydetection_new(
|
|
3969
|
+
FfiConverterOptionalString.lower(source),
|
|
3970
|
+
FfiConverterUInt32.lower(sampleRate),
|
|
3971
|
+
FfiConverterOptionalFloat32.lower(threshold),
|
|
3972
|
+
FfiConverterOptionalUInt32.lower(minSilenceDurationMs),
|
|
3973
|
+
FfiConverterOptionalUInt32.lower(minSpeechDurationMs),
|
|
3974
|
+
FfiConverterOptionalUInt32.lower(prerollDurationMs),
|
|
3370
3975
|
FfiConverterOptionalString.lower(device),
|
|
3371
3976
|
callStatus);
|
|
3372
3977
|
},
|
|
3373
3978
|
/*liftString:*/ FfiConverterString.lift,
|
|
3374
3979
|
);
|
|
3375
3980
|
this[pointerLiteralSymbol] = pointer;
|
|
3376
|
-
this[destructorGuardSymbol] =
|
|
3981
|
+
this[destructorGuardSymbol] = uniffiTypeRustVoiceActivityDetectionObjectFactory.bless(pointer);
|
|
3377
3982
|
}
|
|
3378
3983
|
|
|
3379
3984
|
|
|
3380
3985
|
|
|
3381
3986
|
|
|
3382
3987
|
/**
|
|
3383
|
-
*
|
|
3988
|
+
* Return the current turn's captured audio (from the confirmed
|
|
3989
|
+
* `SpeechStarted`, including a small pre-roll, through to
|
|
3990
|
+
* `SpeechEnded`) and reset internal state for the next turn. Empty if
|
|
3991
|
+
* speech was never confirmed.
|
|
3384
3992
|
*/
|
|
3385
|
-
|
|
3386
|
-
return
|
|
3993
|
+
finish(): Array</*i16*/number> {
|
|
3994
|
+
return FfiConverterArrayInt16.lift(uniffiCaller.rustCall(
|
|
3995
|
+
/*caller:*/ (callStatus) => {
|
|
3996
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustvoiceactivitydetection_finish(uniffiTypeRustVoiceActivityDetectionObjectFactory.clonePointer(this),
|
|
3997
|
+
callStatus);
|
|
3998
|
+
},
|
|
3999
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
4000
|
+
));
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
/**
|
|
4004
|
+
* Feed the newest chunk of i16 PCM audio (not the whole accumulated
|
|
4005
|
+
* buffer — the detector tracks the current turn internally). Always
|
|
4006
|
+
* returns the current confirmed state: `Speech`/`Silence` if unchanged
|
|
4007
|
+
* since the last call, or `SpeechStarted`/`SpeechEnded` on the call that
|
|
4008
|
+
* confirmed the transition.
|
|
4009
|
+
*/
|
|
4010
|
+
push(chunk: Array</*i16*/number>): VoiceActivityDetectionEvent /*throws*/ {
|
|
4011
|
+
return FfiConverterTypeVoiceActivityDetectionEvent.lift(
|
|
3387
4012
|
uniffiCaller.rustCallWithError(
|
|
3388
4013
|
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
3389
4014
|
/*caller:*/ (callStatus) => {
|
|
3390
|
-
return nativeModule().
|
|
3391
|
-
|
|
4015
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustvoiceactivitydetection_push(uniffiTypeRustVoiceActivityDetectionObjectFactory.clonePointer(this),
|
|
4016
|
+
FfiConverterArrayInt16.lower(chunk),
|
|
3392
4017
|
callStatus);
|
|
3393
4018
|
},
|
|
3394
4019
|
/*liftString:*/ FfiConverterString.lift,
|
|
@@ -3396,34 +4021,22 @@ export class RustTts extends UniffiAbstractObject implements RustTtsInterface {
|
|
|
3396
4021
|
}
|
|
3397
4022
|
|
|
3398
4023
|
/**
|
|
3399
|
-
*
|
|
4024
|
+
* Detect every speech segment in a complete audio buffer, returning
|
|
4025
|
+
* each segment's audio (with a short pre-roll) in order. Unlike `push`,
|
|
4026
|
+
* correctly finds every segment regardless of buffer size — use this
|
|
4027
|
+
* for offline/batch processing instead of live streaming.
|
|
3400
4028
|
*/
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
/*
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
FfiConverterString.lower(text)
|
|
3410
|
-
);
|
|
4029
|
+
segment(samples: Array</*i16*/number>): Array<Array</*i16*/number>> /*throws*/ {
|
|
4030
|
+
return FfiConverterArrayArrayInt16.lift(
|
|
4031
|
+
uniffiCaller.rustCallWithError(
|
|
4032
|
+
/*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
|
|
4033
|
+
/*caller:*/ (callStatus) => {
|
|
4034
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustvoiceactivitydetection_segment(uniffiTypeRustVoiceActivityDetectionObjectFactory.clonePointer(this),
|
|
4035
|
+
FfiConverterArrayInt16.lower(samples),
|
|
4036
|
+
callStatus);
|
|
3411
4037
|
},
|
|
3412
|
-
/*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
|
|
3413
|
-
/*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
|
|
3414
|
-
/*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
|
|
3415
|
-
/*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
|
|
3416
|
-
/*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
|
|
3417
4038
|
/*liftString:*/ FfiConverterString.lift,
|
|
3418
|
-
|
|
3419
|
-
/*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
|
|
3420
|
-
);
|
|
3421
|
-
} catch (__error: any) {
|
|
3422
|
-
if (uniffiIsDebug && __error instanceof Error) {
|
|
3423
|
-
__error.stack = __stack;
|
|
3424
|
-
}
|
|
3425
|
-
throw __error;
|
|
3426
|
-
}
|
|
4039
|
+
));
|
|
3427
4040
|
}
|
|
3428
4041
|
|
|
3429
4042
|
|
|
@@ -3433,28 +4046,28 @@ async synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }): Prom
|
|
|
3433
4046
|
uniffiDestroy(): void {
|
|
3434
4047
|
const ptr = (this as any)[destructorGuardSymbol];
|
|
3435
4048
|
if (ptr !== undefined) {
|
|
3436
|
-
const pointer =
|
|
3437
|
-
|
|
3438
|
-
|
|
4049
|
+
const pointer = uniffiTypeRustVoiceActivityDetectionObjectFactory.pointer(this);
|
|
4050
|
+
uniffiTypeRustVoiceActivityDetectionObjectFactory.freePointer(pointer);
|
|
4051
|
+
uniffiTypeRustVoiceActivityDetectionObjectFactory.unbless(ptr);
|
|
3439
4052
|
delete (this as any)[destructorGuardSymbol];
|
|
3440
4053
|
}
|
|
3441
4054
|
}
|
|
3442
4055
|
|
|
3443
|
-
static instanceOf(obj: any): obj is
|
|
3444
|
-
return
|
|
4056
|
+
static instanceOf(obj: any): obj is RustVoiceActivityDetection {
|
|
4057
|
+
return uniffiTypeRustVoiceActivityDetectionObjectFactory.isConcreteType(obj);
|
|
3445
4058
|
}
|
|
3446
4059
|
|
|
3447
4060
|
|
|
3448
4061
|
}
|
|
3449
4062
|
|
|
3450
|
-
const
|
|
4063
|
+
const uniffiTypeRustVoiceActivityDetectionObjectFactory: UniffiObjectFactory<RustVoiceActivityDetectionInterface> = (() => {
|
|
3451
4064
|
|
|
3452
4065
|
return {
|
|
3453
|
-
create(pointer: UniffiHandle):
|
|
3454
|
-
const instance = Object.create(
|
|
4066
|
+
create(pointer: UniffiHandle): RustVoiceActivityDetectionInterface {
|
|
4067
|
+
const instance = Object.create(RustVoiceActivityDetection.prototype);
|
|
3455
4068
|
instance[pointerLiteralSymbol] = pointer;
|
|
3456
4069
|
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
3457
|
-
instance[uniffiTypeNameSymbol] = "
|
|
4070
|
+
instance[uniffiTypeNameSymbol] = "RustVoiceActivityDetection";
|
|
3458
4071
|
return instance;
|
|
3459
4072
|
},
|
|
3460
4073
|
|
|
@@ -3462,7 +4075,7 @@ const uniffiTypeRustTtsObjectFactory: UniffiObjectFactory<RustTtsInterface> = ((
|
|
|
3462
4075
|
bless(p: UniffiHandle): UniffiGcObject {
|
|
3463
4076
|
return uniffiCaller.rustCall(
|
|
3464
4077
|
/*caller:*/ (status) =>
|
|
3465
|
-
nativeModule().
|
|
4078
|
+
nativeModule().ubrn_uniffi_internal_fn_method_rustvoiceactivitydetection_ffi__bless_pointer(p, status),
|
|
3466
4079
|
/*liftString:*/ FfiConverterString.lift
|
|
3467
4080
|
);
|
|
3468
4081
|
},
|
|
@@ -3471,34 +4084,34 @@ const uniffiTypeRustTtsObjectFactory: UniffiObjectFactory<RustTtsInterface> = ((
|
|
|
3471
4084
|
ptr.markDestroyed();
|
|
3472
4085
|
},
|
|
3473
4086
|
|
|
3474
|
-
pointer(obj:
|
|
4087
|
+
pointer(obj: RustVoiceActivityDetectionInterface): UniffiHandle {
|
|
3475
4088
|
if ((obj as any)[destructorGuardSymbol] === undefined) {
|
|
3476
4089
|
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
3477
4090
|
}
|
|
3478
4091
|
return (obj as any)[pointerLiteralSymbol];
|
|
3479
4092
|
},
|
|
3480
4093
|
|
|
3481
|
-
clonePointer(obj:
|
|
4094
|
+
clonePointer(obj: RustVoiceActivityDetectionInterface): UniffiHandle {
|
|
3482
4095
|
const pointer = this.pointer(obj);
|
|
3483
4096
|
return uniffiCaller.rustCall(
|
|
3484
|
-
/*caller:*/ (callStatus) => nativeModule().
|
|
4097
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rustvoiceactivitydetection(pointer, callStatus),
|
|
3485
4098
|
/*liftString:*/ FfiConverterString.lift
|
|
3486
4099
|
);
|
|
3487
4100
|
},
|
|
3488
4101
|
|
|
3489
4102
|
freePointer(pointer: UniffiHandle): void {
|
|
3490
4103
|
uniffiCaller.rustCall(
|
|
3491
|
-
/*caller:*/ (callStatus) => nativeModule().
|
|
4104
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rustvoiceactivitydetection(pointer, callStatus),
|
|
3492
4105
|
/*liftString:*/ FfiConverterString.lift
|
|
3493
4106
|
);
|
|
3494
4107
|
},
|
|
3495
4108
|
|
|
3496
|
-
isConcreteType(obj: any): obj is
|
|
3497
|
-
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "
|
|
4109
|
+
isConcreteType(obj: any): obj is RustVoiceActivityDetectionInterface {
|
|
4110
|
+
return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustVoiceActivityDetection";
|
|
3498
4111
|
},
|
|
3499
4112
|
}})();
|
|
3500
|
-
// FfiConverter for
|
|
3501
|
-
const
|
|
4113
|
+
// FfiConverter for RustVoiceActivityDetectionInterface
|
|
4114
|
+
const FfiConverterTypeRustVoiceActivityDetection = new FfiConverterObject(uniffiTypeRustVoiceActivityDetectionObjectFactory);
|
|
3502
4115
|
|
|
3503
4116
|
|
|
3504
4117
|
export interface SamplerBuilderInterface {
|
|
@@ -3511,6 +4124,16 @@ export interface SamplerBuilderInterface {
|
|
|
3511
4124
|
* DRY (Don't Repeat Yourself) sampler to reduce repetition.
|
|
3512
4125
|
*/
|
|
3513
4126
|
dry(multiplier: /*f32*/number, base: /*f32*/number, allowedLength: /*i32*/number, penaltyLastN: /*i32*/number, seqBreakers: Array<string>) : SamplerBuilderInterface;
|
|
4127
|
+
/**
|
|
4128
|
+
* Apply dynamic temperature scaling (a.k.a. entropy) described in the paper
|
|
4129
|
+
* <https://arxiv.org/abs/2309.02772>.
|
|
4130
|
+
*
|
|
4131
|
+
* Args:
|
|
4132
|
+
* temperature: Temperature value (lower = more focused, higher = more random)
|
|
4133
|
+
* delta: Dynamic temperature range. The final temperature will be in the range of `[temperature - delta; temperature + delta]`.
|
|
4134
|
+
* exponent: Temperature is calculated as `entropy^exponent` (bounded by the range above)
|
|
4135
|
+
*/
|
|
4136
|
+
dynamicTemperature(temperature: /*f32*/number, delta: /*f32*/number, exponent: /*f32*/number) : SamplerBuilderInterface;
|
|
3514
4137
|
/**
|
|
3515
4138
|
* Deprecated: Use `sampler_preset_constrain_with_grammar()` instead. It accepts both Lark and GBNF strings.
|
|
3516
4139
|
*/
|
|
@@ -3519,6 +4142,16 @@ export interface SamplerBuilderInterface {
|
|
|
3519
4142
|
* Always select the most probable token (deterministic).
|
|
3520
4143
|
*/
|
|
3521
4144
|
greedy() : SamplerConfigInterface;
|
|
4145
|
+
/**
|
|
4146
|
+
* Modify the likelihood of specific tokens.
|
|
4147
|
+
*
|
|
4148
|
+
* Args:
|
|
4149
|
+
* biases: Mapping from token ID to its bias.
|
|
4150
|
+
* The bias modifies the likelihood of the token being selected
|
|
4151
|
+
* (`>0.0` means higher probability of the token being selected).
|
|
4152
|
+
* Use `-Infinity` to ban a token.
|
|
4153
|
+
*/
|
|
4154
|
+
logitBias(biases: Map</*i32*/number, /*f32*/number>) : SamplerBuilderInterface;
|
|
3522
4155
|
/**
|
|
3523
4156
|
* Keep tokens with probability above min_p * (probability of most likely token).
|
|
3524
4157
|
*/
|
|
@@ -3548,6 +4181,14 @@ export interface SamplerBuilderInterface {
|
|
|
3548
4181
|
* Keep only the top K most probable tokens.
|
|
3549
4182
|
*/
|
|
3550
4183
|
topK(topK: /*i32*/number) : SamplerBuilderInterface;
|
|
4184
|
+
/**
|
|
4185
|
+
* Top-nσ sampling as described in academic paper "Top-nσ: Not All Logits Are You Need"
|
|
4186
|
+
* <https://arxiv.org/pdf/2411.07641>
|
|
4187
|
+
*
|
|
4188
|
+
* Args:
|
|
4189
|
+
* n: Number of standard deviations from the mean to include in sampling.
|
|
4190
|
+
*/
|
|
4191
|
+
topNSigma(n: /*f32*/number) : SamplerBuilderInterface;
|
|
3551
4192
|
/**
|
|
3552
4193
|
* Keep tokens whose cumulative probability is below top_p.
|
|
3553
4194
|
*/
|
|
@@ -3619,6 +4260,28 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
|
|
|
3619
4260
|
));
|
|
3620
4261
|
}
|
|
3621
4262
|
|
|
4263
|
+
/**
|
|
4264
|
+
* Apply dynamic temperature scaling (a.k.a. entropy) described in the paper
|
|
4265
|
+
* <https://arxiv.org/abs/2309.02772>.
|
|
4266
|
+
*
|
|
4267
|
+
* Args:
|
|
4268
|
+
* temperature: Temperature value (lower = more focused, higher = more random)
|
|
4269
|
+
* delta: Dynamic temperature range. The final temperature will be in the range of `[temperature - delta; temperature + delta]`.
|
|
4270
|
+
* exponent: Temperature is calculated as `entropy^exponent` (bounded by the range above)
|
|
4271
|
+
*/
|
|
4272
|
+
dynamicTemperature(temperature: /*f32*/number, delta: /*f32*/number, exponent: /*f32*/number): SamplerBuilderInterface {
|
|
4273
|
+
return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
|
|
4274
|
+
/*caller:*/ (callStatus) => {
|
|
4275
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_dynamic_temperature(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
|
|
4276
|
+
FfiConverterFloat32.lower(temperature),
|
|
4277
|
+
FfiConverterFloat32.lower(delta),
|
|
4278
|
+
FfiConverterFloat32.lower(exponent),
|
|
4279
|
+
callStatus);
|
|
4280
|
+
},
|
|
4281
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
4282
|
+
));
|
|
4283
|
+
}
|
|
4284
|
+
|
|
3622
4285
|
/**
|
|
3623
4286
|
* Deprecated: Use `sampler_preset_constrain_with_grammar()` instead. It accepts both Lark and GBNF strings.
|
|
3624
4287
|
*/
|
|
@@ -3648,6 +4311,26 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
|
|
|
3648
4311
|
));
|
|
3649
4312
|
}
|
|
3650
4313
|
|
|
4314
|
+
/**
|
|
4315
|
+
* Modify the likelihood of specific tokens.
|
|
4316
|
+
*
|
|
4317
|
+
* Args:
|
|
4318
|
+
* biases: Mapping from token ID to its bias.
|
|
4319
|
+
* The bias modifies the likelihood of the token being selected
|
|
4320
|
+
* (`>0.0` means higher probability of the token being selected).
|
|
4321
|
+
* Use `-Infinity` to ban a token.
|
|
4322
|
+
*/
|
|
4323
|
+
logitBias(biases: Map</*i32*/number, /*f32*/number>): SamplerBuilderInterface {
|
|
4324
|
+
return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
|
|
4325
|
+
/*caller:*/ (callStatus) => {
|
|
4326
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_logit_bias(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
|
|
4327
|
+
FfiConverterMapInt32Float32.lower(biases),
|
|
4328
|
+
callStatus);
|
|
4329
|
+
},
|
|
4330
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
4331
|
+
));
|
|
4332
|
+
}
|
|
4333
|
+
|
|
3651
4334
|
/**
|
|
3652
4335
|
* Keep tokens with probability above min_p * (probability of most likely token).
|
|
3653
4336
|
*/
|
|
@@ -3754,6 +4437,24 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
|
|
|
3754
4437
|
));
|
|
3755
4438
|
}
|
|
3756
4439
|
|
|
4440
|
+
/**
|
|
4441
|
+
* Top-nσ sampling as described in academic paper "Top-nσ: Not All Logits Are You Need"
|
|
4442
|
+
* <https://arxiv.org/pdf/2411.07641>
|
|
4443
|
+
*
|
|
4444
|
+
* Args:
|
|
4445
|
+
* n: Number of standard deviations from the mean to include in sampling.
|
|
4446
|
+
*/
|
|
4447
|
+
topNSigma(n: /*f32*/number): SamplerBuilderInterface {
|
|
4448
|
+
return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
|
|
4449
|
+
/*caller:*/ (callStatus) => {
|
|
4450
|
+
return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_top_n_sigma(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
|
|
4451
|
+
FfiConverterFloat32.lower(n),
|
|
4452
|
+
callStatus);
|
|
4453
|
+
},
|
|
4454
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
4455
|
+
));
|
|
4456
|
+
}
|
|
4457
|
+
|
|
3757
4458
|
/**
|
|
3758
4459
|
* Keep tokens whose cumulative probability is below top_p.
|
|
3759
4460
|
*/
|
|
@@ -4041,10 +4742,6 @@ const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
|
|
|
4041
4742
|
const FfiConverterArrayInt16 = new FfiConverterArray(FfiConverterInt16);
|
|
4042
4743
|
|
|
4043
4744
|
|
|
4044
|
-
// FfiConverter for Array<Asset>
|
|
4045
|
-
const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
4745
|
// FfiConverter for Array<CachedModel>
|
|
4049
4746
|
const FfiConverterArrayTypeCachedModel = new FfiConverterArray(FfiConverterTypeCachedModel);
|
|
4050
4747
|
|
|
@@ -4077,12 +4774,12 @@ const FfiConverterOptionalTypeSamplerConfig = new FfiConverterOptional(FfiConver
|
|
|
4077
4774
|
const FfiConverterOptionalArrayTypeToolCall = new FfiConverterOptional(FfiConverterArrayTypeToolCall);
|
|
4078
4775
|
|
|
4079
4776
|
|
|
4080
|
-
// FfiConverter for Array<
|
|
4081
|
-
const
|
|
4777
|
+
// FfiConverter for Array<ContentPart>
|
|
4778
|
+
const FfiConverterArrayTypeContentPart = new FfiConverterArray(FfiConverterTypeContentPart);
|
|
4082
4779
|
|
|
4083
4780
|
|
|
4084
|
-
// FfiConverter for Array<
|
|
4085
|
-
const
|
|
4781
|
+
// FfiConverter for Array<Message>
|
|
4782
|
+
const FfiConverterArrayTypeMessage = new FfiConverterArray(FfiConverterTypeMessage);
|
|
4086
4783
|
|
|
4087
4784
|
|
|
4088
4785
|
// FfiConverter for Array<RustToolInterface>
|
|
@@ -4093,6 +4790,14 @@ const FfiConverterArrayTypeRustTool = new FfiConverterArray(FfiConverterTypeRust
|
|
|
4093
4790
|
const FfiConverterArrayOptionalInt32 = new FfiConverterArray(FfiConverterOptionalInt32);
|
|
4094
4791
|
|
|
4095
4792
|
|
|
4793
|
+
// FfiConverter for Array<Array</*f32*/number>>
|
|
4794
|
+
const FfiConverterArrayArrayFloat32 = new FfiConverterArray(FfiConverterArrayFloat32);
|
|
4795
|
+
|
|
4796
|
+
|
|
4797
|
+
// FfiConverter for Array<Array</*i16*/number>>
|
|
4798
|
+
const FfiConverterArrayArrayInt16 = new FfiConverterArray(FfiConverterArrayInt16);
|
|
4799
|
+
|
|
4800
|
+
|
|
4096
4801
|
// FfiConverter for Array<RustToolInterface> | undefined
|
|
4097
4802
|
const FfiConverterOptionalArrayTypeRustTool = new FfiConverterOptional(FfiConverterArrayTypeRustTool);
|
|
4098
4803
|
|
|
@@ -4126,8 +4831,14 @@ function uniffiEnsureInitialized() {
|
|
|
4126
4831
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 22964) {
|
|
4127
4832
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
|
|
4128
4833
|
}
|
|
4129
|
-
if (nativeModule().
|
|
4130
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4834
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_speech_to_text() !== 3224) {
|
|
4835
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_speech_to_text");
|
|
4836
|
+
}
|
|
4837
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_text_to_speech() !== 45176) {
|
|
4838
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_text_to_speech");
|
|
4839
|
+
}
|
|
4840
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_voice_activity_detection() !== 42331) {
|
|
4841
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_voice_activity_detection");
|
|
4131
4842
|
}
|
|
4132
4843
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar() !== 13698) {
|
|
4133
4844
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar");
|
|
@@ -4168,9 +4879,12 @@ function uniffiEnsureInitialized() {
|
|
|
4168
4879
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_json_prompt() !== 63877) {
|
|
4169
4880
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_json_prompt");
|
|
4170
4881
|
}
|
|
4171
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt() !==
|
|
4882
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt() !== 46807) {
|
|
4172
4883
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt");
|
|
4173
4884
|
}
|
|
4885
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_complete() !== 37833) {
|
|
4886
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_complete");
|
|
4887
|
+
}
|
|
4174
4888
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_chat_history() !== 12722) {
|
|
4175
4889
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_chat_history");
|
|
4176
4890
|
}
|
|
@@ -4216,7 +4930,7 @@ function uniffiEnsureInitialized() {
|
|
|
4216
4930
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize() !== 52520) {
|
|
4217
4931
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize");
|
|
4218
4932
|
}
|
|
4219
|
-
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt() !==
|
|
4933
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt() !== 15286) {
|
|
4220
4934
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt");
|
|
4221
4935
|
}
|
|
4222
4936
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank() !== 55500) {
|
|
@@ -4228,20 +4942,29 @@ function uniffiEnsureInitialized() {
|
|
|
4228
4942
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode() !== 52601) {
|
|
4229
4943
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode");
|
|
4230
4944
|
}
|
|
4945
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode_batch() !== 20675) {
|
|
4946
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode_batch");
|
|
4947
|
+
}
|
|
4231
4948
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx() !== 52004) {
|
|
4232
4949
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx");
|
|
4233
4950
|
}
|
|
4234
|
-
if (nativeModule().
|
|
4235
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4951
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustspeechtotext_transcribe_file() !== 59975) {
|
|
4952
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustspeechtotext_transcribe_file");
|
|
4953
|
+
}
|
|
4954
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustspeechtotext_transcribe_pcm() !== 9293) {
|
|
4955
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustspeechtotext_transcribe_pcm");
|
|
4236
4956
|
}
|
|
4237
|
-
if (nativeModule().
|
|
4238
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4957
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustspeechtotextstream_completed() !== 15944) {
|
|
4958
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustspeechtotextstream_completed");
|
|
4239
4959
|
}
|
|
4240
|
-
if (nativeModule().
|
|
4241
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4960
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustspeechtotextstream_next_token() !== 8103) {
|
|
4961
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustspeechtotextstream_next_token");
|
|
4242
4962
|
}
|
|
4243
|
-
if (nativeModule().
|
|
4244
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4963
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttexttospeech_synthesize() !== 61700) {
|
|
4964
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttexttospeech_synthesize");
|
|
4965
|
+
}
|
|
4966
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttexttospeech_synthesize_async() !== 14494) {
|
|
4967
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttexttospeech_synthesize_async");
|
|
4245
4968
|
}
|
|
4246
4969
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
|
|
4247
4970
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
|
|
@@ -4258,11 +4981,14 @@ function uniffiEnsureInitialized() {
|
|
|
4258
4981
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call() !== 10096) {
|
|
4259
4982
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call");
|
|
4260
4983
|
}
|
|
4261
|
-
if (nativeModule().
|
|
4262
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4984
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustvoiceactivitydetection_finish() !== 1447) {
|
|
4985
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustvoiceactivitydetection_finish");
|
|
4986
|
+
}
|
|
4987
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustvoiceactivitydetection_push() !== 58012) {
|
|
4988
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustvoiceactivitydetection_push");
|
|
4263
4989
|
}
|
|
4264
|
-
if (nativeModule().
|
|
4265
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4990
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustvoiceactivitydetection_segment() !== 39967) {
|
|
4991
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustvoiceactivitydetection_segment");
|
|
4266
4992
|
}
|
|
4267
4993
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist() !== 23376) {
|
|
4268
4994
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist");
|
|
@@ -4270,12 +4996,18 @@ function uniffiEnsureInitialized() {
|
|
|
4270
4996
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dry() !== 35315) {
|
|
4271
4997
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dry");
|
|
4272
4998
|
}
|
|
4999
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dynamic_temperature() !== 5004) {
|
|
5000
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dynamic_temperature");
|
|
5001
|
+
}
|
|
4273
5002
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar() !== 3547) {
|
|
4274
5003
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_grammar");
|
|
4275
5004
|
}
|
|
4276
5005
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_greedy() !== 32898) {
|
|
4277
5006
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_greedy");
|
|
4278
5007
|
}
|
|
5008
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_logit_bias() !== 61844) {
|
|
5009
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_logit_bias");
|
|
5010
|
+
}
|
|
4279
5011
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_min_p() !== 33705) {
|
|
4280
5012
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_min_p");
|
|
4281
5013
|
}
|
|
@@ -4297,6 +5029,9 @@ function uniffiEnsureInitialized() {
|
|
|
4297
5029
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k() !== 26600) {
|
|
4298
5030
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_k");
|
|
4299
5031
|
}
|
|
5032
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_n_sigma() !== 44336) {
|
|
5033
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_n_sigma");
|
|
5034
|
+
}
|
|
4300
5035
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p() !== 54577) {
|
|
4301
5036
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_top_p");
|
|
4302
5037
|
}
|
|
@@ -4318,8 +5053,11 @@ function uniffiEnsureInitialized() {
|
|
|
4318
5053
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new() !== 27902) {
|
|
4319
5054
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new");
|
|
4320
5055
|
}
|
|
4321
|
-
if (nativeModule().
|
|
4322
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
5056
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustspeechtotext_new() !== 9249) {
|
|
5057
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustspeechtotext_new");
|
|
5058
|
+
}
|
|
5059
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttexttospeech_new() !== 55766) {
|
|
5060
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttexttospeech_new");
|
|
4323
5061
|
}
|
|
4324
5062
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new() !== 9431) {
|
|
4325
5063
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new");
|
|
@@ -4327,8 +5065,8 @@ function uniffiEnsureInitialized() {
|
|
|
4327
5065
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async() !== 54521) {
|
|
4328
5066
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async");
|
|
4329
5067
|
}
|
|
4330
|
-
if (nativeModule().
|
|
4331
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
5068
|
+
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustvoiceactivitydetection_new() !== 47351) {
|
|
5069
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustvoiceactivitydetection_new");
|
|
4332
5070
|
}
|
|
4333
5071
|
if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new() !== 50214) {
|
|
4334
5072
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new");
|
|
@@ -4350,26 +5088,29 @@ function uniffiEnsureInitialized() {
|
|
|
4350
5088
|
export default Object.freeze({
|
|
4351
5089
|
initialize: uniffiEnsureInitialized,
|
|
4352
5090
|
converters: {
|
|
4353
|
-
FfiConverterTypeAsset,
|
|
4354
5091
|
FfiConverterTypeCachedModel,
|
|
4355
5092
|
FfiConverterTypeChatStats,
|
|
5093
|
+
FfiConverterTypeContentPart,
|
|
4356
5094
|
FfiConverterTypeMessage,
|
|
5095
|
+
FfiConverterTypeMessageContent,
|
|
4357
5096
|
FfiConverterTypeMtpConfig,
|
|
4358
5097
|
FfiConverterTypeNobodyWhoError,
|
|
5098
|
+
FfiConverterTypeOptions,
|
|
4359
5099
|
FfiConverterTypePendingToolCall,
|
|
4360
|
-
FfiConverterTypePromptPart,
|
|
4361
5100
|
FfiConverterTypeRustChat,
|
|
4362
5101
|
FfiConverterTypeRustCrossEncoder,
|
|
4363
5102
|
FfiConverterTypeRustEncoder,
|
|
4364
5103
|
FfiConverterTypeRustModel,
|
|
4365
|
-
|
|
4366
|
-
|
|
5104
|
+
FfiConverterTypeRustSpeechToText,
|
|
5105
|
+
FfiConverterTypeRustSpeechToTextStream,
|
|
5106
|
+
FfiConverterTypeRustTextToSpeech,
|
|
4367
5107
|
FfiConverterTypeRustTokenStream,
|
|
4368
5108
|
FfiConverterTypeRustTool,
|
|
4369
|
-
|
|
5109
|
+
FfiConverterTypeRustVoiceActivityDetection,
|
|
4370
5110
|
FfiConverterTypeSamplerBuilder,
|
|
4371
5111
|
FfiConverterTypeSamplerConfig,
|
|
4372
5112
|
FfiConverterTypeToolCall,
|
|
4373
5113
|
FfiConverterTypeToolParameter,
|
|
5114
|
+
FfiConverterTypeVoiceActivityDetectionEvent,
|
|
4374
5115
|
}
|
|
4375
5116
|
});
|