umpirix/hackathons/geekroom-2026/build-bifrost-cards.py
caelum0x a0ea018c24 feat: integrate Bifrost AI gateway, rename submission to Umpirix
Real Bifrost (github.com/maximhq/bifrost) integration for the Geek Room
hackathon's Bifrost-by-Maxim-AI track, replacing zero prior usage:

- BENCH_LLM_GATEWAY=bifrost routes every LLM-backed call (leaderboard's
  llm row, the auto cascade, and the agent loop's judge stage) through
  Bifrost's universal OpenAI-compatible endpoint instead of the provider
  directly, via one choke point (callBifrostStructured in llm.server.ts).
- Per-call telemetry read straight from Bifrost's own response
  (extra_fields), not recomputed: SystemOneBifrostTelemetry type, a new
  Gateway badge/column on /leaderboard (LeaderboardRow.gateway).
- Real run against a local Bifrost v2.5.1 gateway + Anthropic: 93/93 gold
  calls (accuracy 0.9794), fault-injected re-run (67/93 calls, robustness
  0.621), and a real Bifrost-side fallback demo (5/5 calls served by the
  fallback model, routing_info.is_fallback: true). Full numbers in
  bifrost-run-results.json; reproduce with verify-bifrost.mjs. Committed
  leaderboard.json's llm row now carries this real Bifrost-routed run.
- README gets a "How Bifrost powers Umpirix" section; HACKATHON-SUBMISSION.md
  gets a dedicated Bifrost section + honest-limits bullet.
- Pitch deck: new slide "How Bifrost powers Umpirix", title renamed to
  Umpirix — Benchmark Arena for AI Agents (the owner's submitted project
  title), now 14 slides; re-verified against the actual committed PDF
  (not just the Marp PNG preview) and fixed one real overflow found that
  way. PPTX/PDF rebuilt.
- demo.mp4 rebuilt as a 42.9s real video (real Playwright screen recording
  of the Gateway badge + code-rendered stat cards, no AI footage); prior
  cuts kept as demo-v2-120s-narrated.mp4 / demo-v1-33s-silent.mp4.

Repo/package name intentionally left as openjev (not renamed) per the
owner's direction; Umpirix is the submission's project title.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-11 16:23:02 +03:00

167 lines
5.0 KiB
Python

#!/usr/bin/env python3
"""Build simple, code-rendered (no AI footage) title/stat cards for the
Bifrost demo video, matching this repo's existing video doctrine (plain
typographic cards, monospace for real numbers, dark background)."""
from PIL import Image, ImageDraw, ImageFont
import os
W, H = 1280, 800
BG = (10, 10, 14)
FG = (235, 235, 240)
ACCENT = (110, 180, 255)
MUTED = (150, 150, 160)
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".bifrost-cards")
os.makedirs(OUT, exist_ok=True)
def font(size, bold=False):
candidates = [
"/System/Library/Fonts/Supplemental/Menlo.ttc",
"/System/Library/Fonts/Menlo.ttc",
"/System/Library/Fonts/SFNSMono.ttf",
"/System/Library/Fonts/Monaco.ttf",
]
for c in candidates:
if os.path.exists(c):
try:
return ImageFont.truetype(c, size)
except Exception:
continue
return ImageFont.load_default()
def draw_wrapped(d, text, xy, f, fill, max_width, line_gap=10):
x, y = xy
words = text.split(" ")
line = ""
for w in words:
test = (line + " " + w).strip()
bbox = d.textbbox((0, 0), test, font=f)
if bbox[2] - bbox[0] > max_width and line:
d.text((x, y), line, font=f, fill=fill)
y += (bbox[3] - bbox[1]) + line_gap
line = w
else:
line = test
if line:
bbox = d.textbbox((0, 0), line, font=f)
d.text((x, y), line, font=f, fill=fill)
y += (bbox[3] - bbox[1]) + line_gap
return y
def card(name, title, lines, subtitle=None):
im = Image.new("RGB", (W, H), BG)
d = ImageDraw.Draw(im)
f_title = font(40, bold=True)
f_sub = font(20)
f_mono = font(22)
y = 70
y = draw_wrapped(d, title, (70, y), f_title, FG, W - 140, line_gap=6) + 10
if subtitle:
y = draw_wrapped(d, subtitle, (70, y), f_sub, MUTED, W - 140) + 20
else:
y += 20
d.line((70, y, W - 70, y), fill=(50, 50, 58), width=2)
y += 30
for line in lines:
color = ACCENT if line.startswith(">") else FG
text = line[1:].strip() if line.startswith(">") else line
bbox = d.textbbox((0, 0), text, font=f_mono)
d.text((70, y), text, font=f_mono, fill=color)
y += (bbox[3] - bbox[1]) + 18
im.save(f"{OUT}/{name}.png")
print("wrote", name)
card(
"01-title",
"Umpirix — Benchmark Arena for AI Agents",
[
"Geek Room Global AI Hackathon",
"Bifrost by Maxim AI track",
" ",
"This cut: a real Bifrost-routed benchmark run,",
"a real server-side fallback, and the real trace.",
],
subtitle="github.com/caelum0x/openjev — real code, real run, no staged numbers",
)
card(
"02-setup",
"Setup: real local Bifrost gateway",
[
"$ npx -y @maximhq/bifrost -port 8099",
" (config.json: anthropic provider, real API key",
" in Bifrost's own env — never this app's)",
" ",
"> BENCH_LLM_GATEWAY=bifrost",
"> BIFROST_BASE_URL=http://localhost:8099",
" ",
"One switch routes every LLM-backed call —",
"leaderboard's llm row, auto cascade, and the",
"agent loop's judge stage — through Bifrost.",
],
)
card(
"03-run",
"Real 93-case gold run through Bifrost",
[
"> 93/93 real calls — anthropic / claude-opus-5",
" accuracy 0.9794 strict pass 100%",
" ",
"Bifrost's OWN measured latency (extra_fields):",
" p50 1567ms p95 2324ms",
" ",
"This app's independent timer (cross-check):",
" p50 1580ms p95 2327ms",
" ",
"Real tokens: 106,543 in / 7,350 out",
],
)
card(
"04-fault",
"Real fault-injected re-run (same gateway)",
[
"> seed 7 — 15% timeout / 15% server_error / 10% malformed",
" ",
"67 / 93 real Bifrost calls made",
"(26 short-circuited BEFORE the network call)",
" ",
"clean accuracy 0.9794",
"faulted accuracy 0.6082",
"robustness 0.621",
],
)
card(
"05-fallback",
"Real Bifrost fallback (primary model invalid)",
[
"> model: anthropic/claude-totally-fake-model-xyz",
"> fallbacks: [anthropic/claude-opus-5]",
" ",
"5 / 5 calls served by the fallback model",
"routing_info.is_fallback: true",
" ",
"msg_011CgwABUPuJpfcEr3uhzbi9 -> claude-opus-5",
"msg_011CgwABafg3AKD83Z5YAMDQ -> claude-opus-5",
"msg_011CgwABqeqR5GYobz8zSWQG -> claude-opus-5",
" ",
"Real Bifrost-side failover. Not a client-side retry.",
],
)
card(
"06-outro",
"Live on /leaderboard right now",
[
"Gateway badge: anthropic/claude-opus-5 · 242 calls",
" ",
"Full numbers:",
" hackathons/geekroom-2026/bifrost-run-results.json",
"Reproduce it:",
" node hackathons/geekroom-2026/verify-bifrost.mjs",
" ",
"github.com/caelum0x/openjev",
],
)