Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

2.0 KB
Raw Blame

Token usage from a registered LLM now stays with the research and user that made each call. Each research's token callback is passed with that research's calls and is no longer stored on the model. A model that serves several runs or users is therefore invoked as it is and no longer modified: a registered model instance, or a model that a registered factory returns more than once, such as a cached or singleton model. It keeps its own state, such as a call counter, and other researches never fire that callback. A callback list or manager that a factory gives every model it builds is no longer extended in place, which had made later calls also write their token usage under earlier users' names. When a research ends, LDR now closes only a model that one of its built-in providers built for that research. A model that a registered factory returned is no longer closed, because it can be one cached or singleton model that other researches are still using. A factory that builds a new model with its own HTTP clients on every call, such as a ChatOllama, now has to close those clients itself, as the owner of a registered instance already did. bind() and with_config() on an LLM from get_llm() now return LDR's wrapper, as bind_tools() does, so calls through them record token usage, have <think> tags stripped and stop when the research is cancelled. A config bound with with_config() combines with each call's config as it does in LangChain, and like the wrapper itself, the result cannot be composed with |. Methods the wrapper does not define, such as with_retry() or generate(), reach the model without the token callback and record no token usage for the research. Wrapping a model for a research binds the cancellation scope only to LDR's own wrappers, never to the model or to objects the model holds. Token usage is also recorded when LLM rate limiting is enabled and the model has no callbacks of its own; the callback used to be stored on the rate-limiting wrapper, which never passes it to the model.