1 // Copyright 2026 Splitfire AB (Onde Inference). All rights reserved.
2 // SPDX-License-Identifier: MIT OR Apache-2.0
3
4 import { requireNativeModule } from "expo-modules-core";
5
6 /**
7 * Raw native module interface. All JSON serialization/deserialization
8 * happens in the TypeScript wrapper layer (index.ts), not here.
9 *
10 * Methods that return complex types return JSON strings from the native side.
11 * The TypeScript API layer parses these into typed objects.
12 */
13 export interface OndeInferenceNativeModule {
14 // Sync
15 isLoaded(): boolean;
16 setSystemPrompt(prompt: string): void;
17 clearSystemPrompt(): void;
18 setSampling(samplingJson: string): void;
19 clearHistory(): number;
20 pushHistory(messageJson: string): void;
21
22 // Async (returns JSON strings)
23 loadDefaultModel(
24 systemPrompt: string | null,
25 samplingJson: string | null,
26 ): Promise<string>;
27 loadAssignedModel(
28 appId: string,
29 appSecret: string,
30 systemPrompt: string | null,
31 samplingJson: string | null,
32 ): Promise<string>;
33 loadModel(
34 configJson: string,
35 systemPrompt: string | null,
36 samplingJson: string | null,
37 ): Promise<string>;
38 loadUqffModel(
39 configJson: string,
40 systemPrompt: string | null,
41 samplingJson: string | null,
42 ): Promise<string>;
43 unloadModel(): Promise<string>;
44 info(): Promise<string>;
45 history(): Promise<string>;
46 sendMessage(message: string): Promise<string>;
47 generate(messagesJson: string, samplingJson: string | null): Promise<string>;
48
49 // Config functions (sync, return JSON strings)
50 defaultModelConfig(): string;
51 uqffModelConfig(
52 modelId: string,
53 filesJson: string,
54 displayName: string,
55 approxMemory: string,
56 chatTemplate: string | null,
57 ): string;
58 qwen251_5bConfig(): string;
59 qwen253bConfig(): string;
60 qwen3_0_6bConfig(): string;
61 qwen3_1_7bConfig(): string;
62 qwen3_4bConfig(): string;
63 qwen3_8bConfig(): string;
64 qwen3_14bConfig(): string;
65 qwen3_32bConfig(): string;
66 qwen3_4bInstruct2507Config(): string;
67 qwen3_4bThinking2507Config(): string;
68 qwen3_30bA3bInstruct2507Config(): string;
69 defaultSamplingConfig(): string;
70 deterministicSamplingConfig(): string;
71 mobileSamplingConfig(): string;
72 }
73
74 export default requireNativeModule<OndeInferenceNativeModule>("OndeInference");