weirdnet-semcache
The answer cache for Weirdnet inference nodes. Before an inference node routes a prompt it asks
the cache; afterwards it offers the finished answer. Requests and answers are
weirdnet-agent 0.5.1 infer/2 types.
AnswerCache: the seam,get(model, request)andput(model, request, answer).CachedAnswer: text, reasoning, tool calls, finish reason, usage and model;From<&Answer>for aweirdnet_agent::remote::pool::Answer.AnswerStore: where answers live, opaque bytes under 32-byte keys, so the store can be in memory, on disk or shared between nodes.MemoryStoreis bounded and least-recently-used.ExactCache: answers only byte-identical deterministic requests (temperature 0, no tools, inline messages, same model, seed, response format and raw flag), and keeps only answers that finished withstoporlength. The key is SHA-256 over the CBOR of those parts.NoCache: caches nothing.may_read(request)/may_store(request): the request's ownCacheMode.bypassneither reads nor stores;refreshskips the read and stores the fresh answer over the old one.ExactCachehonours both.get_rev/put_revandexact_key_rev: key on the model's revision (its weights) as well as its id, so a fine-tune served under the same id doesn't replay the old weights' answers. With no revision the key is unchanged from 0.2.0.
use ;
let cache = new;
if let Some = cache.get_rev
// after a finished answer:
cache.put_rev;
License
BSD-3-Clause.