flutter_llama library

Classes

ChatChunk
A piece of a streamed reply.
ChatDone
ChatParams
Sampling and chat options.
ChatResult
A whole reply.
ChatTemplate
A chat template override: a llama.cpp built-in name (chatml, llama3, gemma, phi3, mistral-v7, …) or a template string. null in ChatParams = the model's own.
ChatText
ChatToolCalls
ChatUsage
ClassifyParams
ClassifyResult
DeviceFit
Whether a model fits this device.
DownloadedModelInfo
Информация о скачанной модели
DownloadModelRef
DownloadProgress
Информация о прогрессе загрузки
FileModelRef
FlutterLlama
Main class for interacting with llama.cpp models
FlutterLlamaMultimodal
Мультимодальный класс для работы с llama.cpp моделями
GenerationParams
Параметры для генерации текста
HuggingFaceDownloader
Сервис для скачивания моделей с HuggingFace
HuggingFaceFile
Информация о файле в репозитории HuggingFace
JsonSchemaGrammar
Converts JSON schemas to GBNF rules. Supported: type (string, number, integer, boolean, null, object, array, or a list of types), enum, const, properties + required (other properties are not allowed; required ones come first in the declared order, then optional ones may follow), items, minItems / maxItems (≤ 32), anyOf / oneOf, an empty schema (any JSON value), description (ignored).
LlamaBackend
LlamaConfig
Конфигурация для инициализации модели llama.cpp
LlamaLifecycle
LlamaMessage
One chat message. Assistant messages can carry toolCalls; tool results carry toolCallId and name.
LlamaResponse
Ответ от модели llama
ModelCatalog
The built-in presets plus those registered by products.
ModelInfo
What the loaded model is (from GGUF meta and the core's facts).
ModelManager
Унифицированный менеджер моделей
ModelRef
A model to check: a GGUF on disk, or one still to download.
MultimodalConfig
Конфигурация для мультимодальной модели
MultimodalInput
Мультимодальный ввод для поддержки текста, изображений и аудио
MultimodalResponse
Мультимодальный ответ от модели
OllamaDownloader
Сервис для работы с Ollama
OllamaModelInfo
Информация о модели в Ollama
OpenModels
Built-in open models (GGUF Q4_K_M; downloadBytes exact as of 2026-10-08; files is the file to download from the Hugging Face repo id).
PresetModel
Информация о предустановленной модели
PresetModels
Список предустановленных моделей
RawDone
The end of a raw generation.
RawFacts
Facts of the loaded model.
RawSampling
Sampling for one raw generation.
SourceStatus
Статус источника модели
ToolCall
A call the model made.
ToolChoice
When the model may call tools.
ToolSpec
A tool the model may call: parameters is a JSON schema.
UnsupportedBackend
The web (and any platform without a native library).

Enums

ChatStopReason
ClassifyMethod
LlamaRole
Who wrote a message.
LlamaTask
What a model is good for (1.2 catalogue).
MemoryPressureAction
ModelSource
Источник модели
MultimodalType
Типы мультимодального ввода

Extensions

ModelSourceExtension on ModelSource
Расширение для получения человеко-читаемых названий
ToolChoiceX on ToolChoice

Functions

estimateNeedBytes({required int fileBytes, int? kvBytes}) → int
The bytes a load needs: weights × 1.2 (compute buffers, runtime) plus the f16 KV cache for the context.
labelChoiceGrammar(List<String> labels) → String
One label out of labels, verbatim.
nativeToolCallGrammar(List<({String name, Map<String, Object?> parameters})> tools) → String
The native (Qwen / Hermes) tool-call form: <tool_call>\n{"name": "<name>", "arguments": {…}}\n</tool_call>, used when a tool call is required on a model whose template renders tools natively.
toolCallGrammar(List<({String name, Map<String, Object?> parameters})> tools, {bool allowAnswer = true}) → String
The tool-call grammar: exactly one of {"tool": "<name>", "arguments": <that tool's schema>} or {"answer": "<text>"} (when allowAnswer).

Typedefs

DownloadProgressCallback = void Function(DownloadProgress progress)
Callback для отслеживания прогресса загрузки

Exceptions / Errors

Cancelled
ContextOverflow
GrammarInvalid
GrammarSchemaException
Thrown when a schema uses something the converter does not support.
LlamaError
Typed errors of the 1.2 API.
ModelDownloadException
Исключение при ошибке загрузки модели
ModelNotFoundException
Исключение при отсутствии модели
ModelNotLoaded
ModelTooLarge
NativeFailure
TemplateUnavailable
ToolParseFailed
A reply that should hold a tool call did not parse, even after the repair retry (tool_parse_failed).
UnsupportedPlatform