Skip to content

Assistant backend: Candle inference, validated tasks, documentation converter (v1.0.0) - #2

Merged
Grohle merged 3 commits into
mainfrom
ccr-af9252c1-pjbxsw
Oct 17, 2026
Merged

Grohle merged 3 commits into
mainfrom
ccr-af9252c1-pjbxsw

Conversation

@Grohle

@Grohle Grohle commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #1: the inference side of the read-only copilot, which the UI, Tauri commands and CLI merged in #1 already call.

  • crates/assistant/src/backend/candle.rs: pure-Rust GGUF inference with Candle (qwen2 and llama families, CPU), greedy decoding so answers are reproducible, repeat penalty, stop tokens, catch_unwind so a corrupt file is an error and never a panic.
  • model.rs: streaming download of the default model (Qwen2.5-0.5B-Instruct Q4_K_M, Apache-2.0, 0.49 GB) with SHA-256 verification and progress events; a .part file is never left as installed. Real hashes pinned.
  • tasks.rs + prompts/*.txt: prompts as data (system rules, JSON schema per task, few-shot examples), JSON priming, one retry with the parser error, then a plain-text fallback marked unstructured. Filter values are validated against the current report (unknown values are dropped and listed); YAML suggestions are validated by the real config parser.
  • convert.rs: documentation → knowledge.yaml for Markdown, text, YAML, JSON, Word (.docx) and PDF; broken files are reported, never fatal.
  • .cargo/config.toml: target-cpu=x86-64-v3 on x86-64 targets so Candle compiles its AVX2/FMA kernels (3–4× faster inference). Documented in the README requirements.
  • Clippy fixes CI flagged on VeriModel 1.0.0: IFC QA gate, QTO, BCF export, desktop app, CLI and local assistant #1 (manual_range_contains, large_enum_variant), RAM figure corrected, release notes updated.

Real-model results (ignored test, run locally with the downloaded model)

Task Result
Ask "What does rule ID-001 check?" "Every element must have a unique GlobalId." with sources
Filter "errors on Level 1 for walls" severity: [ERROR], storey: Level 1, ifc_type: IfcWall, dropped: []
Explain a spatial-containment finding names the element, GlobalId and the fix
Config help "require FireRating on walls" valid required_psets YAML, identical on re-run

Load 1.5 s, prompt 33–38 tok/s, generation 12–15 tok/s on a 4-core CPU; about 30–50 s per question, 1.0 GB resident.

Test plan

  • cargo fmt --all -- --check clean
  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo test --workspace: 168 passed, 0 failed, 2 ignored (real-model smoke test and demo writer, both opt-in)
  • Real-model smoke test passes all four checks (cargo test -p verimodel-assistant --release --test real_model -- --ignored)
  • Windows installer and CLI cross-compiled with cargo-xwin

Generated by Claude Code

…asks, documentation converter

- backend/candle.rs: qwen2/llama GGUF on CPU, greedy decoding, repeat penalty,
  stop tokens, catch_unwind on bad files, generation stats
- model.rs: streaming download with SHA-256 verification and progress, local install
- tasks.rs + prompts/*.txt: system/schema/few-shot prompts, JSON priming, one retry,
  filter values validated against the report, YAML validated by the config parser
- convert.rs: md/txt/yaml/json/docx/pdf -> knowledge.yaml, broken files reported
- real-model smoke test (ignored by default) passes ask/filter/explain/config help
- .cargo/config.toml: x86-64-v3 so Candle compiles its AVX2 kernels
- README/release notes: assistant performance and CPU requirement

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9A82wxTmgsp2fMa8M4Vw1
…) before the reader tests

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9A82wxTmgsp2fMa8M4Vw1
…GitHub Release

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9A82wxTmgsp2fMa8M4Vw1
@Grohle
Grohle merged commit 3e3a3a9 into main Oct 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants