mirror of
https://github.com/whit3rabbit/anyllm-proxy.git
synced 2026-09-26 16:00:56 +00:00
RTK (anyllm_rtk crate): command-aware filtering of tool-result text (test/build/git/log output) via a catalog of 55 declarative filters ported from OmniRoute (MIT). IO-free, deterministic, prompt-cache safe (cache_control blocks preserved byte-for-byte). Wired into the Anthropic passthrough (stream + non-stream) and OpenAI-translate paths, gated per-model via RTK_MODELS. RTK_COMPRESS env / admin toggle, rtk_compress/rtk_models runtime config. Optimizer (anyllm_optimize_* crates): opt-in Frozen-Frontier Extractive Compression of long client-sent conversation history for OpenAI Chat Completions, the Anthropic translate path, and the Anthropic passthrough path (client history only, never proxy tool-loop turns). OPTIMIZER_MODE=off|shadow| live env / admin toggle; live places a cache_control breakpoint at the frontier over raw bytes. Optional LLMLingua-2 ONNX scorer behind the optimizer-onnx feature (model fetched on demand, never bundled). New optimizer_* metrics counters and GET/POST /admin/api/optimizer/model endpoints. Both features expose runtime config + Settings UI controls and fail open on any error. Adds workspace members, CI lint/test for the optimizer-onnx feature, and gitignore rules for downloaded ONNX artifacts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
236 lines
3.2 KiB
JSON
236 lines
3.2 KiB
JSON
{
|
|
"input": "def compute_running_average(values):\n \"\"\"Return the running average of a list of numbers.\"\"\"\n total = 0\n averages = []\n for i, v in enumerate(values):\n total += v\n averages.append(total / (i + 1))\n return averages\n\n# Example usage: prints the running average after each new sample.\nif __name__ == \"__main__\":\n print(compute_running_average([1, 2, 3, 4, 5]))\n",
|
|
"ratio": 0.5,
|
|
"words": [
|
|
"def",
|
|
"compute",
|
|
"_",
|
|
"running",
|
|
"_",
|
|
"average",
|
|
"(",
|
|
"values",
|
|
")",
|
|
":",
|
|
"\"",
|
|
"\"",
|
|
"\"",
|
|
"Return",
|
|
"the",
|
|
"running",
|
|
"average",
|
|
"of",
|
|
"a",
|
|
"list",
|
|
"of",
|
|
"numbers",
|
|
".",
|
|
"\"",
|
|
"\"",
|
|
"\"",
|
|
"total",
|
|
"=",
|
|
"0",
|
|
"averages",
|
|
"=",
|
|
"[",
|
|
"]",
|
|
"for",
|
|
"i",
|
|
",",
|
|
"v",
|
|
"in",
|
|
"enumerate",
|
|
"(",
|
|
"values",
|
|
")",
|
|
":",
|
|
"total",
|
|
"+",
|
|
"=",
|
|
"v",
|
|
"averages",
|
|
".",
|
|
"append",
|
|
"(",
|
|
"total",
|
|
"/",
|
|
"(",
|
|
"i",
|
|
"+",
|
|
"1",
|
|
")",
|
|
")",
|
|
"return",
|
|
"averages",
|
|
"#",
|
|
"Example",
|
|
"usage",
|
|
":",
|
|
"prints",
|
|
"the",
|
|
"running",
|
|
"average",
|
|
"after",
|
|
"each",
|
|
"new",
|
|
"sample",
|
|
".",
|
|
"if",
|
|
"_",
|
|
"_",
|
|
"name",
|
|
"_",
|
|
"_",
|
|
"=",
|
|
"=",
|
|
"\"",
|
|
"_",
|
|
"_",
|
|
"main",
|
|
"_",
|
|
"_",
|
|
"\"",
|
|
":",
|
|
"print",
|
|
"(",
|
|
"compute",
|
|
"_",
|
|
"running",
|
|
"_",
|
|
"average",
|
|
"(",
|
|
"[",
|
|
"1",
|
|
",",
|
|
"2",
|
|
",",
|
|
"3",
|
|
",",
|
|
"4",
|
|
",",
|
|
"5",
|
|
"]",
|
|
")",
|
|
")"
|
|
],
|
|
"keep_mask": [
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
false
|
|
],
|
|
"compressed": "compute running average values Return average list numbers total = 0 averages = i, v total + = v averages append ( total i + 1 ) return averages prints running average after each sample main print ( compute running average ( 1, 2, 3, 4, 5 ]",
|
|
"reference": {
|
|
"model": "microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank",
|
|
"llmlingua_version": "0.2.2"
|
|
}
|
|
}
|