|
| 1 | +// PromptFoo configuration for Architecture Template tests |
| 2 | +module.exports = { |
| 3 | + description: 'Architecture Template Quality Evaluation', |
| 4 | + |
| 5 | + // Rate limiting to avoid 429 errors |
| 6 | + maxConcurrency: 1, |
| 7 | + delay: 2000, // 2 second delay between tests |
| 8 | + |
| 9 | + // Architecture prompt |
| 10 | + prompts: ['file://../prompts/arch-prompt.txt'], |
| 11 | + |
| 12 | + // Configure LLM provider using OpenAI-compatible endpoint |
| 13 | + providers: [ |
| 14 | + { |
| 15 | + id: `openai:chat:${process.env.LLM_MODEL || 'claude-sonnet-4-5-20250929'}`, |
| 16 | + label: `${process.env.LLM_MODEL || 'Sonnet 4.5'} (via AI API Gateway)`, |
| 17 | + config: { |
| 18 | + apiBaseUrl: process.env.LLM_BASE_URL, |
| 19 | + apiKey: process.env.LLM_AUTH_TOKEN, |
| 20 | + temperature: 0.7, |
| 21 | + max_tokens: 6000, |
| 22 | + }, |
| 23 | + env: { |
| 24 | + OPENAI_API_KEY: process.env.LLM_AUTH_TOKEN, |
| 25 | + OPENAI_BASE_URL: process.env.LLM_BASE_URL, |
| 26 | + }, |
| 27 | + }, |
| 28 | + ], |
| 29 | + |
| 30 | + defaultTest: { |
| 31 | + options: { |
| 32 | + provider: `openai:chat:${process.env.LLM_MODEL || 'claude-sonnet-4-5-20250929'}`, |
| 33 | + }, |
| 34 | + }, |
| 35 | + |
| 36 | + tests: [ |
| 37 | + // Test 1: Architecture Init Quality - Structure Validation |
| 38 | + { |
| 39 | + description: 'Architecture: Init produces valid Rozanski & Woods structure', |
| 40 | + vars: { |
| 41 | + user_input: |
| 42 | + 'Create an architecture description for an e-commerce platform with a web frontend, REST API backend, PostgreSQL database, and Redis cache. The system handles user authentication, product catalog, shopping cart, and order processing.', |
| 43 | + }, |
| 44 | + assert: [ |
| 45 | + { type: 'icontains', value: 'context view' }, |
| 46 | + { type: 'icontains', value: 'functional view' }, |
| 47 | + { type: 'icontains', value: 'deployment view' }, |
| 48 | + { type: 'icontains', value: 'stakeholder' }, |
| 49 | + { |
| 50 | + type: 'python', |
| 51 | + value: 'file://../graders/custom_graders.py:check_arch_structure', |
| 52 | + }, |
| 53 | + ], |
| 54 | + }, |
| 55 | + |
| 56 | + // Test 2: Blackbox Context View |
| 57 | + { |
| 58 | + description: 'Architecture: Context View enforces blackbox system representation', |
| 59 | + vars: { |
| 60 | + user_input: |
| 61 | + 'Create an architecture description for a SaaS project management tool that integrates with GitHub, Slack, and Google Calendar. Users access it via web browser. An admin manages team settings.', |
| 62 | + }, |
| 63 | + assert: [ |
| 64 | + { |
| 65 | + type: 'python', |
| 66 | + value: 'file://../graders/custom_graders.py:check_blackbox_context_view', |
| 67 | + }, |
| 68 | + { |
| 69 | + type: 'llm-rubric', |
| 70 | + value: |
| 71 | + 'Check if the Context View section treats the system as a single blackbox.\n' + |
| 72 | + 'The Context View should:\n' + |
| 73 | + '1. Show the system as ONE unified node (not broken into internal services)\n' + |
| 74 | + '2. Show external actors (users, admins) interacting with the system\n' + |
| 75 | + '3. Show external systems (GitHub, Slack, Google Calendar) as separate nodes\n' + |
| 76 | + '4. NOT show internal databases, caches, queues, or microservices in this view\n' + |
| 77 | + 'Return 1.0 if blackbox constraint is followed, 0.5 if partially, 0.0 if internal details are exposed.', |
| 78 | + threshold: 0.7, |
| 79 | + }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + |
| 83 | + // Test 3: Architecture Simplicity for Simple Systems |
| 84 | + { |
| 85 | + description: 'Architecture: Simple app gets simple architecture (no over-engineering)', |
| 86 | + vars: { |
| 87 | + user_input: |
| 88 | + 'Create an architecture description for a simple personal blog with basic CRUD for posts, a SQLite database, and static file serving. Single developer, no team.', |
| 89 | + }, |
| 90 | + assert: [ |
| 91 | + { |
| 92 | + type: 'python', |
| 93 | + value: 'file://../graders/custom_graders.py:check_arch_simplicity', |
| 94 | + }, |
| 95 | + { |
| 96 | + type: 'llm-rubric', |
| 97 | + value: |
| 98 | + 'Is the architecture appropriately simple for a personal blog?\n' + |
| 99 | + 'Check for:\n' + |
| 100 | + '- No microservices architecture for a blog\n' + |
| 101 | + '- No Kubernetes or complex orchestration\n' + |
| 102 | + '- No message queues or event sourcing\n' + |
| 103 | + '- Simple deployment (single server or basic hosting)\n' + |
| 104 | + '- Monolith or simple client-server is appropriate\n' + |
| 105 | + 'Return 1.0 if appropriately simple, 0.5 if somewhat over-engineered, 0.0 if heavily over-engineered.', |
| 106 | + threshold: 0.7, |
| 107 | + }, |
| 108 | + ], |
| 109 | + }, |
| 110 | + |
| 111 | + // Test 4: ADR Quality |
| 112 | + { |
| 113 | + description: 'Architecture: ADRs follow template structure with required sections', |
| 114 | + vars: { |
| 115 | + user_input: |
| 116 | + 'Create an architecture description for a real-time chat application with WebSocket support, message persistence, user presence tracking, and file sharing. The system must handle 10,000 concurrent users.', |
| 117 | + }, |
| 118 | + assert: [ |
| 119 | + { type: 'icontains', value: 'adr' }, |
| 120 | + { |
| 121 | + type: 'python', |
| 122 | + value: 'file://../graders/custom_graders.py:check_adr_quality', |
| 123 | + }, |
| 124 | + { |
| 125 | + type: 'llm-rubric', |
| 126 | + value: |
| 127 | + 'Grade the ADR quality in this architecture document (0-1):\n' + |
| 128 | + '1. Does each ADR have a clear Status (Proposed/Accepted/Deprecated/Discovered)?\n' + |
| 129 | + '2. Does each ADR have a Context section explaining why the decision was needed?\n' + |
| 130 | + '3. Does each ADR have a clear Decision statement?\n' + |
| 131 | + '4. Does each ADR document Consequences (positive, negative, risks)?\n' + |
| 132 | + '5. Are alternatives documented with neutral trade-offs (not "rejected because")?\n' + |
| 133 | + 'Return average score 0-1.', |
| 134 | + threshold: 0.7, |
| 135 | + }, |
| 136 | + ], |
| 137 | + }, |
| 138 | + ], |
| 139 | +}; |
0 commit comments