llama_cpp_dart library

High-level API for llama.cpp.

Classes

AlpacaFormat
ChatHistory
Manages a collection of chat messages
ChatMLFormat
CompletionEvent
Event emitted when a completion finishes or fails
ContextParams
ContextParams holds configuration settings for the Llama model context
GeminiFormat
Implementation of the Gemini prompt format with system instructions as user messages.
Llama
A Dart wrapper for llama.cpp functionality. Provides text generation capabilities using the llama model.
LlamaChild
Child isolate that handles Llama model operations
LlamaClear
Command to clear the model context
LlamaCommand
Base class for commands sent to the LlamaChild isolate
LlamaEmbedd
LlamaImage
Represents an image input for the Llama model.
LlamaInit
Command to initialize the Llama library
LlamaInput
An abstract class representing a multimodal input for the Llama model.
LlamaLoad
Command to load a model
LlamaParent
Parent class that manages communication with the LlamaChild isolate
LlamaPrompt
Command to send a prompt for generation
LlamaResponse
Response from the LlamaChild isolate
LlamaScope
A scope that filters responses from LlamaParent for specific prompt IDs
LlamaStop
Command to stop ongoing generation
MCPClient
Clean MCP client that handles all the protocol stuff
MCPServer
MCPServerTool
An MCP tool. Implementations must return content parts per MCP: e.g. {'type':'text','text':'hello'}
Message
Represents a single message in a chat conversation
ModelParams
PromptFormat
A class representing a LLM Prompt Format.
SamplerParams
TextChunker
Tool

Enums

ChatFormat
Represents supported chat formats for export
LlamaAttentionType
Attention types for embeddings
LlamaPoolingType
Pooling types for embeddings
LlamaRopeScalingType
RoPE scaling types
LlamaSplitMode
Enum representing how to split the model across multiple GPUs
LlamaStatus
Status tracking for the Llama instance
PromptFormatType
An enumeration representing different types of LLM Prompt Formats.
Role
Represents different roles in a chat conversation

Typedefs

BitmapPointers = ({Pointer<mtmd_bitmap> bitmap, Pointer<Uint8> imageData})
LlamaLogCallback = Void Function(UnsignedInt level, Pointer<Char> text, Pointer<Void> userData)
LlamaLogCallbackDart = void Function(int level, Pointer<Char> text, Pointer<Void> userData)

Exceptions / Errors

LlamaException
Custom exception for Llama-specific errors