Originally created by: SAMAD101
Add a candle module to orko-providers: an in-process Provider that runs open-weight
models locally through Candle (candle-core is already
pinned in [workspace.dependencies]). No HTTP, no SSE — this is the "local inference" half of
the crate's remit and the only provider that does not sit on the codec/transport split from [#3].
Every other row in the providers table is a wire format (#3 OpenAI-compat, [#6] Anthropic) or a
preset over one. Local servers (#12 ollama, [#13] vllm, [#14] llamacpp) are still HTTP presets.
Candle is the case where the model lives in the same process: load weights → tokenize →
autoregressive decode → stream tokens. It implements orko_core::Provider directly, which is
exactly the escape hatch the crate design leaves open ("users can … implement Provider directly").
candle (off by default). Pulls candle-core, candle-nn,candle-transformers, tokenizers, hf-hub only behind the flag. Default build oforko-providers must not compile any of it.candle-cuda, candle-metal, candle-accelerate.CandleProvider — construction:CandleProvider::from_hub(repo_id) — downloads via hf-hub into the standard HF cacheHF_HOME / HF_TOKEN honoured), picks safetensors + tokenizer.json.CandleProvider::from_files(weights, tokenizer, config) — fully offline path.device (auto → cuda/metal/cpu), dtype, seed, max_new_tokens.Llama (covers Llama-3.x, and via candle-transformers the same codetokenizer_config.json → chat_template)system:/user:/assistant: fallback. Map Roles fromorko_core::Message accordingly. Tool calls / structured outputs are out of scope forError::Unsupported if the request carries tools.CompletionStream that yields one CompletionChunk per decoded tokenfinish_reason (stop on EOS / stop token,length on max_new_tokens) and usage (prompt / completion token counts).CompletionOptions, mapped tocandle_transformers::generation::LogitsProcessor.std::thread and bridge to the async stream with a futures::channel::mpsc (bounded).tx.is_closed() per token).Send + Sync: model + tokenizer behind Arc<Mutex<_>> is acceptable for v0.1 — oneorko_core::Error with the underlyingcomplete().cargo build -p orko-providers (no features) does not compile candle.cargo build -p orko-providers --features candle builds on macOS (metal) and Linux (cpu).CompletionOptions →LogitsProcessor mapping, and that a dropped stream halts the generation thread#[ignore] integration test that loads a tiny model (e.g. a Llama-arch smoke modelclippy -D warnings clean with and without the feature.from_hub + create_agent(provider).candle supports it; separate issue once safetensors path lands).Nothing in [#3] — this bypasses the HTTP stack. It only depends on the frozen orko-core
Provider / CompletionStream types.