End-to-end composition example for the adapter sweep. Walks a
query through the full cascade using crates from f168037 /
b8367d0 / 7328d8c / 03e7571 / 03c063c / 6594a54 — no API keys,
no network, no model-weight downloads required.
Walk shape:
L3.5 fresh ArxivProvider.search(query, 5)
L3.5 fetch JinaReader.read(top_hit.url)
L2 embed OpenAiEmbedBackend.embed_batch([query, ...docs])
L2.5 rerank CohereRerankBackend.rerank(query, docs, top=2)
L3 LLM OllamaBackend.complete(prompt with top doc + query)
receipt prints joule + token accounting
Composition truths the example demonstrates:
- Every adapter shipped in the sweep accepts a caller-injected
transport. The example wires deterministic mock transports
so the binary compiles + runs offline; swapping in
reqwest::blocking wrappers turns it into a real production
walk with no other changes.
- The Transport trait (GET-only, no headers) handles the
free-tier providers; the HttpTransportExt trait (POST + auth
+ headers) handles the paid-tier providers. Both are
demonstrated.
- jouleclaw-llm's sync HttpTransport pattern works identically
across OllamaBackend / OpenAiCompatibleBackend / Anthropic /
Gemini — consumer picks at runtime.
- jouleclaw-embed-api and jouleclaw-rerank-api share the same
bearer-token transport shape, and both produce the typed
shapes (Vec<f32> for embed; Vec<(usize, f32)> for rerank)
the downstream cascade tiers consume.
- Joules + tokens are first-class fields in the receipt; the
example prints joules/token as a single-number summary.
Output (deterministic):
Q: How does Tokio's task scheduler work?
L3.5 fresh (arxiv) — 3 hits
[0] Work-Stealing Task Scheduling …
[1] Parking Strategies for Idle Workers …
[2] Cooperative Scheduling and Fairness …
L3.5 fetch (jina reader) — fetched 136 bytes …
L2 embed (openai-shape) — 4 vectors of dim 4
L2.5 rerank (cohere v3) — top 3 …
L3 LLM (ollama qwen2.5:7b) — 240 prompt tokens, 38 output tokens
ANSWER: Tokio's scheduler is work-stealing with M:N threading. …
RECEIPT: 0.012 J · 278 tokens · 0.043 mJ/token
Dev-deps added to jouleclaw-stack:
jouleclaw-fresh (the providers + Transport / HttpTransportExt)
jouleclaw-embed-api (OpenAiEmbedBackend etc)
jouleclaw-rerank-api (CohereRerankBackend etc)
async-trait, chrono (for the mock Transport impls)
Run: cargo run -p jouleclaw-stack --example seeded_cascade_with_adapters
Co-Authored-By: Claude Opus 4.7 <[email protected]>