gguf library
GGUF file utilities: metadata reading (header parsing, architecture and chat-template keys) and stable cache naming for downloaded artifacts.
Classes
- GgufMetadata
- The metadata values found for the requested keys.
- GgufMetadataNeedsLargerPrefix
- The prefix ended before all requested keys could be ruled in or out.
- GgufMetadataResult
- Outcome of readGgufMetadata.
- GgufMetadataUnsupported
- The bytes are not a readable GGUF header; the reason is user-facing.
Constants
- ggufArchitectureKey → const String
-
GGUF metadata key holding the model architecture (e.g.
'gemma3'). - ggufChatTemplateKey → const String
- GGUF metadata key holding the model's embedded Jinja chat template.
Functions
-
artifactDisplayName(
String name) → String - The original file name encoded in a name produced by stableArtifactFileName or importedArtifactFileName.
-
importedArtifactFileName(
String fileName, {required String nonce}) → String - A cache file name for an artifact imported from local storage, where there is no URL to hash into a stable name.
-
readGgufMetadata(
{required Uint8List headerPrefix, required Set< String> keys}) → GgufMetadataResult -
Reads the string values of
keysfrom the GGUF whose first bytes areheaderPrefix. -
readGgufMetadataFile(
String path, {required Set< String> keys}) → Future<GgufMetadataResult> - Web stub: there is no filesystem to read from.
-
stableArtifactFileName(
Uri url) → String -
A stable cache file name for
url: a short hash of the full URL plus a sanitized tail of its last path segment (so the file stays recognizably e.g.…-gemma-4b-it-q4_k_m.gguf).