export interface LoadModelOptions { modelPath: string; mmprojPath?: string; gpuLayers?: number; contextSize?: number; threads?: number; debug?: boolean; /** * Print the final chat-template-rendered prompt sent to llama.cpp to stderr. * * This may include private user data. Intended for local debugging only. */ logPrompts?: boolean; /** * Chat template to use for formatting messages. * - "auto" (default): Use the template embedded in the GGUF model file * - Template name: Use a specific built-in template (e.g., "llama3", "chatml", "gemma") */ chatTemplate?: string; /** * Whether to load the model for embedding generation. * When true, creates an embedding context with mean pooling enabled. * Default: false */ embedding?: boolean; } export interface ChatMessage { role: string; content: string; images?: ImageInput[]; toolCalls?: NativeToolCall[]; toolName?: string; toolCallId?: string; } export interface ImageInput { data: Uint8Array; mediaType?: string; } export interface NativeToolCall { id?: string; name: string; arguments: string; } export interface ToolDefinition { name: string; description?: string; parametersJson: string; } export interface GenerateOptions { /** Internal ID used to cancel one in-flight generation without affecting others. */ requestId?: string; messages: ChatMessage[]; tools?: ToolDefinition[]; toolChoice?: "auto" | "required" | "none"; parallelToolCalls?: boolean; maxTokens?: number; temperature?: number; topP?: number; topK?: number; seed?: number; stopSequences?: string[]; /** GBNF grammar string for structured output */ grammar?: string; /** Maximum generated tokens allowed inside the reasoning block. */ reasoningBudgetTokens?: number; /** Marker that starts model reasoning content. */ reasoningBudgetStart?: string; /** Marker that ends model reasoning content. */ reasoningBudgetEnd?: string; /** Whether chat templates that support thinking should enable thinking. */ enableThinking?: boolean; /** Reuse matching prompt prefixes from the previous request on this model. */ promptCache?: boolean; } export interface GenerateResult { text: string; promptTokens: number; completionTokens: number; cacheReadTokens?: number; cacheWriteTokens?: number; finishReason: "stop" | "length" | "error"; errorMessage?: string; toolCalls?: NativeToolCall[]; } export interface EmbedOptions { texts: string[]; } export interface EmbedResult { embeddings: Float32Array[]; totalTokens: number; } export declare function loadModel(options: LoadModelOptions): Promise; export declare function unloadModel(handle: number): boolean; export declare function generate(handle: number, options: GenerateOptions): Promise; export declare function cancelGeneration(handle: number, requestId?: string): boolean; export declare function generateStream(handle: number, options: GenerateOptions, onToken: (token: string) => void): Promise; export declare function isModelLoaded(handle: number): boolean; export declare function embed(handle: number, options: EmbedOptions): Promise; //# sourceMappingURL=native-binding.d.ts.map