An AI-powered system that generates, validates, and evaluates Real-Time Bidding (RTB) strategies using Large Language Models (Gemma3 via Ollama).
- Automated Strategy Generation: Uses LLMs to write Python bidding code based on high-level goals (e.g., "Maximize Impressions", "Aggressive").
- Sandboxed Execution: Validates generated code for safety and syntax.
- Historical Replay Engine: Simulates auctions using mock or real historical data.
- Interactive Arena: Compare multiple strategies side-by-side with real-time visualization.
- Design Patterns: Built with Clean Architecture principles (Strategy, Builder, Adapter, Factory).
- Python 3.8+
- [Optional] Ollama installed and running with
gemma3:12bmodel for real AI generation.- Run
ollama run gemma3:12bto pull the model.
- Run
pip install -r requirements.txtYou can launch the web interface using the provided helper script:
chmod +x run_arena.sh
./run_arena.shOr manually:
streamlit run bidding_arena/visualization/app.pycore/: Interfaces and base logic (Clean Architecture).generation/: LLM interaction, Prompt Builder, and Code Validator.data/: Data generation and loading.visualization/: Streamlit dashboard.
- Strategy Pattern:
IBiddingStrategyallows swapping different bidding logic (generated code) at runtime. - Builder Pattern:
PromptBuilderconstructs complex prompts based on strategy configuration. - Adapter Pattern:
ILLMClientabstracts the AI provider (Mock vs Ollama). - Factory Method:
StrategyGeneratorencapsulates the creation and validation of strategy objects.
Run unit tests (coming soon):
pytest tests/