1 import { requireNativeModule } from "expo-modules-core";
2
3 /**
4 * Raw native module interface. All JSON serialization/deserialization
5 * happens in the TypeScript wrapper layer (index.ts), not here.
6 *
7 * Methods that return complex types return JSON strings from the native side.
8 * The TypeScript API layer parses these into typed objects.
9 */
10 export interface OndeInferenceNativeModule {
11 // Sync
12 isLoaded(): boolean;
13 setSystemPrompt(prompt: string): void;
14 clearSystemPrompt(): void;
15 setSampling(samplingJson: string): void;
16 clearHistory(): number;
17 pushHistory(messageJson: string): void;
18
19 // Async (returns JSON strings)
20 loadDefaultModel(
21 systemPrompt: string | null,
22 samplingJson: string | null,
23 ): Promise<string>;
24 loadAssignedModel(
25 appId: string,
26 appSecret: string,
27 systemPrompt: string | null,
28 samplingJson: string | null,
29 ): Promise<string>;
30 loadModel(
31 configJson: string,
32 systemPrompt: string | null,
33 samplingJson: string | null,
34 ): Promise<string>;
35 unloadModel(): Promise<string>;
36 info(): Promise<string>;
37 history(): Promise<string>;
38 sendMessage(message: string): Promise<string>;
39 generate(messagesJson: string, samplingJson: string | null): Promise<string>;
40
41 // Config functions (sync, return JSON strings)
42 defaultModelConfig(): string;
43 qwen251_5bConfig(): string;
44 qwen253bConfig(): string;
45 defaultSamplingConfig(): string;
46 deterministicSamplingConfig(): string;
47 mobileSamplingConfig(): string;
48 }
49
50 export default requireNativeModule<OndeInferenceNativeModule>("OndeInference");