eoc-agent: a local model's measured step is a measured span #127
Loading…
Reference in a new issue
No description provided.
Delete branch "eoc-agent/model-span-provenance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on #124 (eoc per-process energy). Retarget to
mainonce #124 merges.What was wrong.
LlmReplycarried a baremicrojoules, andAgentLoop::charge_llm_steptagged every model stepEstimated. A backend that ran the model in this process and measured it had no way to say so, so its measured figure was recorded as an estimate. Such a backend is aneoc-localbackend whoseMeterSpanis backed by #124's per-process counter.What changed (
eoc-agent):LlmReplycarries aJouleCost.LlmReply::new(text, tokens, µJ)is the provider's estimate, exactly as before.LlmReply::with_cost(text, tokens, cost)gives a figure with its grade.charge_llm_steprecords the provider's cost as graded, and charges the budget that figure.NeuralProvider<B: NeuralBackend>wraps any in-process backend as anLlmProvider. The reply's energy is the backend's ownJouleCost. AResponsehas no token count, so tokens are counted from the text:approx_tokens(one per four characters, rounded up), or the model's tokenizer throughwith_token_counter. Tokens feed only the token budget.Verified
cargo test -p eoc-agent: 42 lib tests plus the integration tests pass.cargo check --workspace --all-targetspasses for eoc-rs.MlcBackendmetered by an advancing counter gives a measured span of exactly what the counter read. A held, failed or stub counter gives the backend's estimate, never 0. A whole ReAct run records the model step measured, and the budget total is that figure.charge_llm_stepto always-estimated fails both end-to-end tests.🤖 Generated with Claude Code
8894a1a66330370b1996