spb/llmindex Public
The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.
TypeScript 77.9%
TeX 15.2%
Python 3.7%
SQL 1.4%
JavaScript 1.1%
Shell 0.5%
1/**2 * llmindex.io — read live benchmark progress from Redis (server-side)3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import 'server-only';8import Redis from 'ioredis';910const PROGRESS_KEY = 'llmindex:benchmark:progress';1112let redis: Redis | null | undefined;1314function getRedis(): Redis | null {15 if (redis !== undefined) return redis;16 const url = process.env.REDIS_URL;17 if (!url) {18 redis = null;19 return redis;20 }21 redis = new Redis(url, { maxRetriesPerRequest: 1, enableOfflineQueue: false });22 redis.on('error', () => {23 /* progress endpoint fails soft */24 });25 return redis;26}2728export interface PublicBenchmarkProgress {29 active: boolean;30 started_at?: string;31 updated_at?: string;32 models?: string[];33 completed?: string[];34 failed?: string[];35 current?: {36 model: string;37 domain: string;38 domain_index: number;39 domains_total: number;40 calls_done: number;41 calls_total: number;42 } | null;43 currents?: Array<{44 model: string;45 domain: string;46 domain_index: number;47 domains_total: number;48 calls_done: number;49 calls_total: number;50 }>;51 last_refit_run_id?: string | null;52 note?: string;53}5455export async function readBenchmarkProgress(): Promise<PublicBenchmarkProgress> {56 const client = getRedis();57 if (!client) return { active: false };58 try {59 const raw = await client.get(PROGRESS_KEY);60 if (!raw) return { active: false };61 return JSON.parse(raw) as PublicBenchmarkProgress;62 } catch {63 return { active: false };64 }65}66