@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.
- package/AGENTS.md +147 -147
- package/BENCHMARKS.md +262 -262
- package/GATEWAY.md +272 -271
- package/NOTICE +28 -28
- package/PRIVACY.md +46 -46
- package/README.md +368 -275
- package/SECURITY.md +83 -83
- package/TERMS.md +22 -22
- package/USAGE.md +170 -155
- package/VERSION +1 -1
- package/bin/benchwarmers.js +16 -72
- package/cli.py +666 -0
- package/examples/config/gateway.json +5 -5
- package/examples/config/model-roles.json +11 -11
- package/gateway.py +755 -712
- package/launcher.py +120 -0
- package/mcp_server.py +266 -0
- package/metrics/alerts.py +116 -116
- package/metrics/aliases.py +41 -41
- package/metrics/bench_collections.py +141 -141
- package/metrics/catalog.py +295 -295
- package/metrics/client.py +394 -373
- package/metrics/cliproxy.py +191 -191
- package/metrics/connect.py +691 -691
- package/metrics/cost.py +152 -152
- package/metrics/decide.py +227 -227
- package/metrics/discover.py +318 -318
- package/metrics/endpoints.py +436 -436
- package/metrics/guard.py +617 -592
- package/metrics/learn.py +221 -221
- package/metrics/litellm_hub.py +206 -206
- package/metrics/model_roles.py +84 -84
- package/metrics/offload.py +166 -166
- package/metrics/owui.py +205 -205
- package/metrics/paths.py +60 -60
- package/metrics/route.py +579 -574
- package/metrics/scheduler.py +275 -275
- package/metrics/sources.py +167 -167
- package/metrics/wrong.py +144 -144
- package/package.json +68 -64
- package/perf/README.md +89 -89
- package/perf/run.py +261 -261
- package/scripts/auto_retire.py +367 -367
- package/scripts/check.py +108 -104
- package/scripts/check_deprecations.py +378 -378
- package/scripts/check_themes.py +103 -103
- package/scripts/init.py +124 -124
- package/scripts/list_served.py +78 -78
- package/scripts/notice.py +78 -78
- package/scripts/onboard.py +401 -331
- package/scripts/provider_tags.py +129 -129
- package/scripts/reprefix.py +136 -136
- package/scripts/sync_config.py +105 -105
- package/scripts/test_auth.py +255 -255
- package/scripts/test_cli.py +189 -0
- package/scripts/test_client.py +233 -233
- package/scripts/test_connect.py +222 -222
- package/scripts/test_first_run.py +180 -180
- package/scripts/test_hubs.py +328 -328
- package/scripts/test_launcher.py +67 -0
- package/scripts/test_llm_log.py +85 -0
- package/scripts/test_mcp.py +178 -0
- package/scripts/test_merged.py +214 -193
- package/scripts/test_no_owui.py +291 -291
- package/scripts/test_owui.py +90 -90
- package/scripts/test_serve_edit.py +448 -386
- package/scripts/test_verdict.py +98 -98
- package/scripts/test_vision.py +228 -228
- package/serve.py +3904 -3662
- package/suite/mine.py +154 -154
- package/suite/pace.py +145 -145
- package/suite/run.py +1046 -1040
- package/suite/seed.py +421 -421
- package/suite/tasks/claim-alias-unbound/fixtures/onboard.py +286 -286
- package/suite/tasks/claim-error-text-string/fixtures/decide.py +187 -187
- package/suite/tasks/claim-list-body/fixtures/gateway.py +235 -235
- package/suite/tasks/claim-member-nominated-twice/fixtures/gateway.py +284 -284
- package/suite/tasks/claim-nominee-uses-slot/fixtures/gateway.py +284 -284
- package/suite/tasks/claim-silent-exit/fixtures/gateway.py +235 -235
- package/suite/tasks/claim-sse-hang/fixtures/gateway.py +235 -235
- package/suite/tasks/claim-unknown-nominee-crash/fixtures/gateway.py +284 -284
- package/suite/tasks/rebench-matchms-809-bug/task.json +23 -23
- package/suite/tasks/rebench-matchms-809-control/task.json +27 -27
- package/suite/tasks/rebench-more-itertools-1028-bug/task.json +23 -23
- package/suite/tasks/rebench-more-itertools-1028-control/task.json +27 -27
- package/suite/tasks/rebench-narwhals-2864-bug/task.json +23 -23
- package/suite/tasks/rebench-narwhals-2864-control/task.json +27 -27
- package/suite/tasks/rebench-quantecon-py-769-bug/task.json +23 -23
- package/suite/tasks/rebench-quantecon-py-769-control/task.json +27 -27
- package/suite/tasks/rebench-scrapy-6867-bug/task.json +23 -23
- package/suite/tasks/rebench-scrapy-6867-control/task.json +27 -27
- package/ui/bench.css +430 -424
- package/ui/bench.js +1756 -1555
- package/ui/themes/dark.css +35 -35
- package/ui/themes/hardwood.css +52 -52
- package/ui/themes/rainforest.css +32 -32
package/scripts/test_owui.py
CHANGED
|
@@ -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")
|