Expand description
fim-engine — embedded fill-in-the-middle code completion.
A self-contained local code-completion engine: it downloads a small quantized qwen2.5-coder model on first use, caches it, and runs inference in-process via candle — no external daemon, no API key, no network after the one-time download.
Shared by mnml + tmnl. Typical use:
use fim_engine::{FimEngine, ModelChoice};
// Blocking — do this on a worker thread.
let cache = fim_engine::default_cache_dir();
let mut engine = FimEngine::load(&cache, ModelChoice::Qwen1_5B, &|p| {
eprintln!("{}: {}/{:?}", p.label, p.received, p.total);
})?;
let completion = engine.complete("fn add(a: i32, b: i32) -> i32 {\n ", "\n}", 64)?;Structs§
- Download
Progress - Progress callback payload — emitted periodically during a download so the host can paint a progress bar.
- FimEngine
- A loaded local FIM completion engine. Holds the model in memory;
keep one alive and call
FimEngine::completerepeatedly. - Model
Paths - Resolved on-disk paths to the two model files.
Enums§
- Model
Choice - Which qwen2.5-coder size to run. 1.5B is the fast default; 3B is noticeably smarter at multi-line completion but ~2x slower + a bigger download. (Instruct GGUFs — the base GGUF repos are gated; instruct retains FIM capability.)
Functions§
- default_
cache_ dir - The canonical, host-agnostic model cache directory — every consumer
(mnml, tmnl, …) should pass this to
FimEngine::loadso the ~1 GB download is shared, not duplicated per app. - is_
model_ cached - True when both model files for
choiceare already cached.