How girishg17/ai-benchmark works
AI Benchmark is a multi-model query router with two ways to build routing knowledge: interactive user feedback and offline model benchmarking. In the interactive path, the CLI builds the router, classifies a question, selects a capable model using exploration/UCB, returns its answer, and records feedback. Offline benchmarking evaluates configured models against datasets to initialize stats. The graph preserves the documented benchmark and provider capabilities; benchmark internals and configuration details are represented at their supported directory paths because their source was not excerpted.
Main entry points: dynamic_router.py Dynamic routing · models.py Model clients · run_offline_bench.py Benchmark launcher · main.py Router setup
Components 20
User entry
- Interactive CLI
scripts/cli.py - Router setup
router/main.py
Routing
- Task classifier
router/classifier.py - Dynamic routing
router/dynamic_router.py - Best-fit policy
router/routing_policy.py
Models
- Model clients
router/models.py
Evaluation
- Feedback record
router/feedback.py - Benchmark launcher
scripts/run_offline_bench.py - Benchmark execution
benchmark - Benchmark datasets
benchmark/data - Benchmark metrics
benchmark/metrics.py
State and config
- Model configuration
config/models.yaml - Routing configuration
config/routing.yaml - Routing statistics
storage/router_stats.json - JSON persistence
utils/io.py - Logging
utils/logger.py
Other components
- Questioner
- OpenAI API
- RapidAPI models
- Perplexity API
Connections 25
- Questioner → Interactive CLI: enters question
README.md - Interactive CLI → Router setup: starts CLI
scripts/cli.py - Router setup → Dynamic routing: builds router
router/main.py - Router setup → Model clients: loads models
router/main.py - Router setup → Routing configuration: reads settings
router/main.py - Router setup → Model configuration: loads definitions
router/main.py - Interactive CLI → Dynamic routing: routes question
- Dynamic routing → Task classifier: classifies query
router/dynamic_router.py - Dynamic routing → Model clients: calls selected model
router/dynamic_router.py - Dynamic routing → JSON persistence: loads and saves stats
router/dynamic_router.py - JSON persistence → Routing statistics: reads and writes
- Dynamic routing → Logging: logs decisions
router/dynamic_router.py - Interactive CLI → Dynamic routing: records feedback
- Model clients → RapidAPI models: sends requests
router/models.py - Model clients → Perplexity API: sends requests
router/models.py - Model clients → OpenAI API: supports client
- Benchmark launcher → Benchmark execution: runs benchmark
scripts/run_offline_bench.py - Benchmark launcher → Benchmark datasets: selects datasets
scripts/run_offline_bench.py - Benchmark launcher → Model clients: loads models
scripts/run_offline_bench.py - Benchmark execution → Benchmark metrics: uses metrics
- Benchmark launcher → Routing statistics: initializes scores
scripts/run_offline_bench.py - Benchmark launcher → JSON persistence: writes scores
scripts/run_offline_bench.py - Feedback record → Task classifier: uses task types
router/feedback.py - Best-fit policy → Task classifier: uses task types
router/routing_policy.py - Best-fit policy → Dynamic routing: uses model stats
router/routing_policy.py