llama_cpp_dart library
High-level API for llama.cpp.
Classes
- AlpacaFormat
- Implementation of the Alpaca prompt format. Structure:
- ChatHistory
- ChatMLFormat
- Implementation of the ChatML prompt format (used by Qwen, Yi, etc.). Structure: <|im_start|>system {content}<|im_end|> <|im_start|>user {content}<|im_end|> <|im_start|>assistant
- CompletionEvent
- Event emitted when a completion finishes or fails
- ContextParams
- GemmaFormat
- Implementation of the Gemma prompt format (used by Google Gemma/Gemini GGUFs). Format: <start_of_turn>role\ncontent<end_of_turn>
- Llama
- A Dart wrapper for llama.cpp functionality.
- LlamaChild
- Child isolate that handles Llama model operations
- LlamaClear
- LlamaCommand
- Base class for commands sent to the LlamaChild isolate
- LlamaDispose
- LlamaEmbedd
- LlamaFreeSlot
- LlamaImage
- Represents an image input for the Llama model.
- LlamaInit
- LlamaInput
- An abstract class representing a multimodal input for the Llama model.
- LlamaLoad
- LlamaLoadSession
- LlamaLoadState
- LlamaParent
- Parent class that manages communication with the LlamaChild isolate
- LlamaPrompt
- LlamaResponse
- LlamaSaveState
- LlamaScope
- A scope that filters responses from LlamaParent for specific prompt IDs
- LlamaStop
- 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
- ModelParams
- PromptFormat
- A class representing a LLM Prompt Format. Handles formatting of messages for specific model architectures.
- SamplerParams
- TextChunker
- Tool
Enums
- ChatFormat
- Represents supported chat formats for export
- LlamaAttentionType
- LlamaFlashAttnType
- Flash Attention Type (llama_flash_attn_type)
- LlamaKvCacheType
- GGML Types for KV Cache Quantization (ggml_type)
- LlamaPoolingType
- LlamaRopeScalingType
- 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) - TokenLengthFunction = int Function(String text)
Exceptions / Errors
- LlamaException
- Custom exception for Llama-specific errors