@wendellresearch-ai/benchwarmers 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/AGENTS.md +147 -147
  2. package/BENCHMARKS.md +262 -262
  3. package/GATEWAY.md +272 -271
  4. package/NOTICE +28 -28
  5. package/PRIVACY.md +46 -46
  6. package/README.md +368 -275
  7. package/SECURITY.md +83 -83
  8. package/TERMS.md +22 -22
  9. package/USAGE.md +170 -155
  10. package/VERSION +1 -1
  11. package/bin/benchwarmers.js +16 -72
  12. package/cli.py +666 -0
  13. package/examples/config/gateway.json +5 -5
  14. package/examples/config/model-roles.json +11 -11
  15. package/gateway.py +755 -712
  16. package/launcher.py +120 -0
  17. package/mcp_server.py +266 -0
  18. package/metrics/alerts.py +116 -116
  19. package/metrics/aliases.py +41 -41
  20. package/metrics/bench_collections.py +141 -141
  21. package/metrics/catalog.py +295 -295
  22. package/metrics/client.py +394 -373
  23. package/metrics/cliproxy.py +191 -191
  24. package/metrics/connect.py +691 -691
  25. package/metrics/cost.py +152 -152
  26. package/metrics/decide.py +227 -227
  27. package/metrics/discover.py +318 -318
  28. package/metrics/endpoints.py +436 -436
  29. package/metrics/guard.py +617 -592
  30. package/metrics/learn.py +221 -221
  31. package/metrics/litellm_hub.py +206 -206
  32. package/metrics/model_roles.py +84 -84
  33. package/metrics/offload.py +166 -166
  34. package/metrics/owui.py +205 -205
  35. package/metrics/paths.py +60 -60
  36. package/metrics/route.py +579 -574
  37. package/metrics/scheduler.py +275 -275
  38. package/metrics/sources.py +167 -167
  39. package/metrics/wrong.py +144 -144
  40. package/package.json +68 -64
  41. package/perf/README.md +89 -89
  42. package/perf/run.py +261 -261
  43. package/scripts/auto_retire.py +367 -367
  44. package/scripts/check.py +108 -104
  45. package/scripts/check_deprecations.py +378 -378
  46. package/scripts/check_themes.py +103 -103
  47. package/scripts/init.py +124 -124
  48. package/scripts/list_served.py +78 -78
  49. package/scripts/notice.py +78 -78
  50. package/scripts/onboard.py +401 -331
  51. package/scripts/provider_tags.py +129 -129
  52. package/scripts/reprefix.py +136 -136
  53. package/scripts/sync_config.py +105 -105
  54. package/scripts/test_auth.py +255 -255
  55. package/scripts/test_cli.py +189 -0
  56. package/scripts/test_client.py +233 -233
  57. package/scripts/test_connect.py +222 -222
  58. package/scripts/test_first_run.py +180 -180
  59. package/scripts/test_hubs.py +328 -328
  60. package/scripts/test_launcher.py +67 -0
  61. package/scripts/test_llm_log.py +85 -0
  62. package/scripts/test_mcp.py +178 -0
  63. package/scripts/test_merged.py +214 -193
  64. package/scripts/test_no_owui.py +291 -291
  65. package/scripts/test_owui.py +90 -90
  66. package/scripts/test_serve_edit.py +448 -386
  67. package/scripts/test_verdict.py +98 -98
  68. package/scripts/test_vision.py +228 -228
  69. package/serve.py +3904 -3662
  70. package/suite/mine.py +154 -154
  71. package/suite/pace.py +145 -145
  72. package/suite/run.py +1046 -1040
  73. package/suite/seed.py +421 -421
  74. package/suite/tasks/claim-alias-unbound/fixtures/onboard.py +286 -286
  75. package/suite/tasks/claim-error-text-string/fixtures/decide.py +187 -187
  76. package/suite/tasks/claim-list-body/fixtures/gateway.py +235 -235
  77. package/suite/tasks/claim-member-nominated-twice/fixtures/gateway.py +284 -284
  78. package/suite/tasks/claim-nominee-uses-slot/fixtures/gateway.py +284 -284
  79. package/suite/tasks/claim-silent-exit/fixtures/gateway.py +235 -235
  80. package/suite/tasks/claim-sse-hang/fixtures/gateway.py +235 -235
  81. package/suite/tasks/claim-unknown-nominee-crash/fixtures/gateway.py +284 -284
  82. package/suite/tasks/rebench-matchms-809-bug/task.json +23 -23
  83. package/suite/tasks/rebench-matchms-809-control/task.json +27 -27
  84. package/suite/tasks/rebench-more-itertools-1028-bug/task.json +23 -23
  85. package/suite/tasks/rebench-more-itertools-1028-control/task.json +27 -27
  86. package/suite/tasks/rebench-narwhals-2864-bug/task.json +23 -23
  87. package/suite/tasks/rebench-narwhals-2864-control/task.json +27 -27
  88. package/suite/tasks/rebench-quantecon-py-769-bug/task.json +23 -23
  89. package/suite/tasks/rebench-quantecon-py-769-control/task.json +27 -27
  90. package/suite/tasks/rebench-scrapy-6867-bug/task.json +23 -23
  91. package/suite/tasks/rebench-scrapy-6867-control/task.json +27 -27
  92. package/ui/bench.css +430 -424
  93. package/ui/bench.js +1756 -1555
  94. package/ui/themes/dark.css +35 -35
  95. package/ui/themes/hardwood.css +52 -52
  96. package/ui/themes/rainforest.css +32 -32
@@ -1,90 +1,90 @@
1
- """metrics/owui.py against a fake Open WebUI: nothing is sent anywhere.
2
-
3
- python scripts/test_owui.py
4
-
5
- The config write must give back every key and every other connection exactly
6
- as read, add the id once and only where the connection lists ids, and the
7
- model record must come out public, tagged and with the sibling's logo.
8
- """
9
-
10
- from __future__ import annotations
11
-
12
- import copy
13
- import pathlib
14
- import sys
15
-
16
- ROOT = pathlib.Path(__file__).resolve().parent.parent
17
- sys.path[:0] = [str(ROOT / "metrics"), str(ROOT / "suite")]
18
- import owui # noqa: E402
19
-
20
- CONFIG = {"ENABLE_OPENAI_API": True,
21
- "OPENAI_API_BASE_URLS": ["https://api.groq.com/openai/v1", "https://api.llm7.io/v1"],
22
- "OPENAI_API_KEYS": ["gsk_real_key_1", "llm7_real_key_2"],
23
- "OPENAI_API_CONFIGS": {"0": {"enable": True, "prefix_id": "", "model_ids": ["groq/compound"]},
24
- "1": {"enable": True, "prefix_id": "llm7", "model_ids": []}}}
25
- MODELS = [{"id": "groq/compound", "urlIdx": 0, "tags": [{"name": "groq-api"}]},
26
- {"id": "llm7.codestral-latest", "urlIdx": 1, "tags": [{"name": "llm7-api"}]}]
27
- RECORDS = [{"id": "groq/compound", "name": "groq/compound", "base_model_id": None, "params": {},
28
- "meta": {"profile_image_url": "data:image/webp;base64,LOGO", "capabilities": {"vision": True},
29
- "tags": [{"name": "groq-api"}]}}]
30
-
31
-
32
- def fake(state):
33
- def call(path, body=None):
34
- state["calls"].append((path, copy.deepcopy(body)))
35
- if path == "/api/models":
36
- return {"data": state["models"]}
37
- if path == "/openai/config":
38
- return copy.deepcopy(state["config"])
39
- if path == "/openai/config/update":
40
- state["config"] = copy.deepcopy(body)
41
- return body
42
- if path == "/api/v1/models/base":
43
- return copy.deepcopy(state["records"])
44
- if path in ("/api/v1/models/create", "/api/v1/models/model/update"):
45
- state["records"] = [r for r in state["records"] if r["id"] != body["id"]] + [body]
46
- state["models"] = state["models"] + [{"id": body["id"], "urlIdx": 0, "tags": body["meta"]["tags"]}]
47
- return body
48
- raise AssertionError(path)
49
- return call
50
-
51
-
52
- def run(connection, model, registered):
53
- state = {"config": copy.deepcopy(CONFIG), "models": list(MODELS), "records": copy.deepcopy(RECORDS), "calls": []}
54
- owui._call = fake(state)
55
- owui.endpoint = lambda: "openwebui"
56
- owui.endpoints.models = lambda name, timeout=30: {m["id"]: m for m in state["models"]}
57
- import route
58
- import run as suite_run
59
- suite_run._registered_names = lambda: registered
60
- route.connection_of = lambda alias: {"compound": "groq", "codestral": "llm7-api"}[alias]
61
- served, done = owui.add(connection, model)
62
- return state, served, done
63
-
64
-
65
- state, served, done = run("groq", "moonshotai/kimi-k2", {"compound": "groq/compound"})
66
- cfg = state["config"]
67
- assert served == "moonshotai/kimi-k2", served
68
- assert cfg["OPENAI_API_KEYS"] == CONFIG["OPENAI_API_KEYS"], "keys changed"
69
- assert cfg["OPENAI_API_BASE_URLS"] == CONFIG["OPENAI_API_BASE_URLS"]
70
- assert cfg["OPENAI_API_CONFIGS"]["1"] == CONFIG["OPENAI_API_CONFIGS"]["1"], "another connection changed"
71
- assert cfg["OPENAI_API_CONFIGS"]["0"]["model_ids"] == ["groq/compound", "moonshotai/kimi-k2"]
72
- rec = next(r for r in state["records"] if r["id"] == served)
73
- assert rec["access_grants"] == owui.PUBLIC
74
- assert rec["meta"]["tags"] == [{"name": "groq-api"}], rec["meta"]["tags"] # Open WebUI's tag, not the bench's name
75
- assert rec["meta"]["profile_image_url"] == "data:image/webp;base64,LOGO"
76
- assert any("logo" in d for d in done), done
77
-
78
- # An empty Model IDs list means "everything": nothing is written, and the prefix names the id.
79
- state, served, done = run("llm7-api", "mistral-small", {"codestral": "llm7.codestral-latest"})
80
- assert served == "llm7.mistral-small", served
81
- assert not any(p == "/openai/config/update" for p, _ in state["calls"]), "wrote a config it did not need to"
82
-
83
- # The same id already served by ANOTHER connection is refused, not doubled.
84
- MODELS.append({"id": "llm7.qwen", "urlIdx": 0, "tags": []})
85
- try:
86
- run("llm7-api", "qwen", {"codestral": "llm7.codestral-latest"})
87
- raise AssertionError("a collision with another connection was not refused")
88
- except ValueError as exc:
89
- assert "already serves" in str(exc), exc
90
- print("owui checks pass")
1
+ """metrics/owui.py against a fake Open WebUI: nothing is sent anywhere.
2
+
3
+ python scripts/test_owui.py
4
+
5
+ The config write must give back every key and every other connection exactly
6
+ as read, add the id once and only where the connection lists ids, and the
7
+ model record must come out public, tagged and with the sibling's logo.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import copy
13
+ import pathlib
14
+ import sys
15
+
16
+ ROOT = pathlib.Path(__file__).resolve().parent.parent
17
+ sys.path[:0] = [str(ROOT / "metrics"), str(ROOT / "suite")]
18
+ import owui # noqa: E402
19
+
20
+ CONFIG = {"ENABLE_OPENAI_API": True,
21
+ "OPENAI_API_BASE_URLS": ["https://api.groq.com/openai/v1", "https://api.llm7.io/v1"],
22
+ "OPENAI_API_KEYS": ["gsk_real_key_1", "llm7_real_key_2"],
23
+ "OPENAI_API_CONFIGS": {"0": {"enable": True, "prefix_id": "", "model_ids": ["groq/compound"]},
24
+ "1": {"enable": True, "prefix_id": "llm7", "model_ids": []}}}
25
+ MODELS = [{"id": "groq/compound", "urlIdx": 0, "tags": [{"name": "groq-api"}]},
26
+ {"id": "llm7.codestral-latest", "urlIdx": 1, "tags": [{"name": "llm7-api"}]}]
27
+ RECORDS = [{"id": "groq/compound", "name": "groq/compound", "base_model_id": None, "params": {},
28
+ "meta": {"profile_image_url": "data:image/webp;base64,LOGO", "capabilities": {"vision": True},
29
+ "tags": [{"name": "groq-api"}]}}]
30
+
31
+
32
+ def fake(state):
33
+ def call(path, body=None):
34
+ state["calls"].append((path, copy.deepcopy(body)))
35
+ if path == "/api/models":
36
+ return {"data": state["models"]}
37
+ if path == "/openai/config":
38
+ return copy.deepcopy(state["config"])
39
+ if path == "/openai/config/update":
40
+ state["config"] = copy.deepcopy(body)
41
+ return body
42
+ if path == "/api/v1/models/base":
43
+ return copy.deepcopy(state["records"])
44
+ if path in ("/api/v1/models/create", "/api/v1/models/model/update"):
45
+ state["records"] = [r for r in state["records"] if r["id"] != body["id"]] + [body]
46
+ state["models"] = state["models"] + [{"id": body["id"], "urlIdx": 0, "tags": body["meta"]["tags"]}]
47
+ return body
48
+ raise AssertionError(path)
49
+ return call
50
+
51
+
52
+ def run(connection, model, registered):
53
+ state = {"config": copy.deepcopy(CONFIG), "models": list(MODELS), "records": copy.deepcopy(RECORDS), "calls": []}
54
+ owui._call = fake(state)
55
+ owui.endpoint = lambda: "openwebui"
56
+ owui.endpoints.models = lambda name, timeout=30: {m["id"]: m for m in state["models"]}
57
+ import route
58
+ import run as suite_run
59
+ suite_run._registered_names = lambda: registered
60
+ route.connection_of = lambda alias: {"compound": "groq", "codestral": "llm7-api"}[alias]
61
+ served, done = owui.add(connection, model)
62
+ return state, served, done
63
+
64
+
65
+ state, served, done = run("groq", "moonshotai/kimi-k2", {"compound": "groq/compound"})
66
+ cfg = state["config"]
67
+ assert served == "moonshotai/kimi-k2", served
68
+ assert cfg["OPENAI_API_KEYS"] == CONFIG["OPENAI_API_KEYS"], "keys changed"
69
+ assert cfg["OPENAI_API_BASE_URLS"] == CONFIG["OPENAI_API_BASE_URLS"]
70
+ assert cfg["OPENAI_API_CONFIGS"]["1"] == CONFIG["OPENAI_API_CONFIGS"]["1"], "another connection changed"
71
+ assert cfg["OPENAI_API_CONFIGS"]["0"]["model_ids"] == ["groq/compound", "moonshotai/kimi-k2"]
72
+ rec = next(r for r in state["records"] if r["id"] == served)
73
+ assert rec["access_grants"] == owui.PUBLIC
74
+ assert rec["meta"]["tags"] == [{"name": "groq-api"}], rec["meta"]["tags"] # Open WebUI's tag, not the bench's name
75
+ assert rec["meta"]["profile_image_url"] == "data:image/webp;base64,LOGO"
76
+ assert any("logo" in d for d in done), done
77
+
78
+ # An empty Model IDs list means "everything": nothing is written, and the prefix names the id.
79
+ state, served, done = run("llm7-api", "mistral-small", {"codestral": "llm7.codestral-latest"})
80
+ assert served == "llm7.mistral-small", served
81
+ assert not any(p == "/openai/config/update" for p, _ in state["calls"]), "wrote a config it did not need to"
82
+
83
+ # The same id already served by ANOTHER connection is refused, not doubled.
84
+ MODELS.append({"id": "llm7.qwen", "urlIdx": 0, "tags": []})
85
+ try:
86
+ run("llm7-api", "qwen", {"codestral": "llm7.codestral-latest"})
87
+ raise AssertionError("a collision with another connection was not refused")
88
+ except ValueError as exc:
89
+ assert "already serves" in str(exc), exc
90
+ print("owui checks pass")