Updated model IDs, pricing, display names, and default configurations across all 12 files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| core | ||
| docs | ||
| frontend | ||
| old_web_interface_dont_use | ||
| prompts | ||
| server | ||
| test_batch | ||
| .env | ||
| .gitignore | ||
| Adidas_Logo.svg | ||
| CLAUDE.md | ||
| compare_systems.py | ||
| deployment_instructions.md | ||
| docker-compose.yml | ||
| Dockerfile.backend | ||
| hypercorn.toml | ||
| IMPLEMENTATION_COMPLETE.md | ||
| README.md | ||
| README_GUI.md | ||
| requirements_enhanced.txt | ||
| run_server.py | ||
| server_requirements.txt | ||
| test_document.txt | ||
| test_multiplier_system.py | ||
| test_setup.py | ||
Enhanced Brief Processing System
Multi-Model AI Document Analysis Platform
Extract structured marketing asset information from creative briefs using parallel AI processing
Overview
The Enhanced Brief Processing System is a cutting-edge document analysis platform that leverages multiple state-of-the-art AI models simultaneously to extract comprehensive, structured asset information from unstructured marketing documents. Built for marketing agencies, creative teams, and project managers, this system transforms complex briefs into actionable, structured data through intelligent multi-model consensus.
🚀 Key Features
Multi-Model Parallel Processing
- Simultaneous Analysis: Process documents through multiple AI models in parallel
- Provider Support: OpenAI GPT-5, Claude Opus 4.1/Sonnet 4, Google Gemini 2.5 Pro
- True Async: Native async/await implementation for optimal performance
- Intelligent Fallback: Continues processing even if individual models fail
Advanced Document Processing
- Multi-Format Support: PowerPoint (.pptx), Word (.docx), PDF, Excel (.xlsx)
- LlamaParser Integration: Cloud-based OCR with adaptive table detection
- Structure Preservation: Maintains document hierarchy, tables, and page references
- High-Resolution OCR: Superior text recognition from images and scanned content
Intelligent Asset Extraction
- Multiplier-Based System: Extract base deliverables with expansion arrays
- Smart Consolidation: Merge results from multiple models with bias toward completeness
- Advanced Deduplication: Distinguish true duplicates from legitimate variations
- Quantity Validation: Built-in sense-checks ensure realistic deliverable counts
Cost Management & Monitoring
- Multi-Provider Pricing: Track costs across OpenAI, Anthropic, and Google
- Pre-Processing Estimates: Calculate total cost before execution
- Budget Controls: Configurable spending limits with user confirmation
- Detailed Breakdowns: Per-model cost analysis and optimization insights
📋 What It Extracts
The system identifies and structures marketing deliverables including:
- Technical Specifications: Exact dimensions, file formats, technical requirements
- Market Targeting: Language-country combinations using ISO codes
- Asset Details: Categories, media types, file formats, quantities
- Timeline Information: Review dates, launch dates, expiry dates
- Creative Direction: Design requirements, brand guidelines, reference materials
- Project Context: Page numbers, priority levels, status information
🛠 Installation & Setup
Prerequisites
- Python 3.13+ with virtual environment support
- API Keys: OpenAI, Anthropic, Google AI, and LlamaCloud accounts
Quick Setup
# Clone and navigate to project
cd enhanced-brief-processing-system
# Activate virtual environment
source venv/bin/activate
# Install dependencies with async support
pip install -r requirements_enhanced.txt
# Configure environment variables
cp .env.example .env
# Edit .env with your API keys
Environment Configuration
Create .env file with your credentials:
# API Keys (Required)
OPENAI_API_KEY=your-openai-api-key
ANTHROPIC_API_KEY=your-anthropic-api-key
GOOGLE_API_KEY=your-google-api-key
LLAMACLOUD_API_KEY=your-llamacloud-api-key
# Processing Configuration
DEFAULT_PRIMARY_MODELS=openai-gpt5,anthropic-sonnet4,google-gemini25
DEFAULT_CONSOLIDATION_MODEL=openai-gpt5
MAX_PROCESSING_COST_USD=10.00
🎯 Usage
Command Line Interface
Basic Usage (Recommended):
# Use default 3-model configuration
python process_brief_enhanced.py your_brief.pdf
Custom Model Selection:
# High-quality analysis
python process_brief_enhanced.py brief.pdf \
--primary-models openai-gpt5,anthropic-opus4,google-gemini25 \
--consolidation-model anthropic-opus4
# Cost-effective processing
python process_brief_enhanced.py brief.pdf \
--primary-models openai-gpt5,google-gemini25 \
--consolidation-model google-gemini25
# Single model (fastest)
python process_brief_enhanced.py brief.pdf \
--primary-models openai-gpt5 \
--consolidation-model openai-gpt5
Cost Estimation:
# Estimate costs before processing
python process_brief_enhanced.py brief.pdf --estimate-cost
Web Interface
# Start local web server
# Navigate to index.php for browser-based upload interface
Available Models
| Model | Provider | Best For | Cost |
|---|---|---|---|
openai-gpt5 |
OpenAI | Complex reasoning, detailed analysis | $ |
anthropic-opus4 |
Anthropic | Highest quality, premium analysis | |
anthropic-sonnet4 |
Anthropic | Balanced performance and cost | |
google-gemini25 |
Cost-effective, large context | $ |
🔄 Processing Flow
Stage 1: Document Preprocessing
- LlamaParser Cloud Service: High-resolution OCR and structure extraction
- Content Normalization: Convert to clean markdown with preserved formatting
- Multi-Format Support: Automatic document type detection and handling
Stage 2: Parallel Multi-Model Analysis
- Simultaneous Processing: Multiple AI models analyze the same document
- Universal Schema: Consistent structured output across all providers
- Error Handling: Graceful degradation if individual models fail
- Performance Logging: Track model performance and deliverable counts
Stage 3: Intelligent Consolidation
- Multi-Model Merging: Combine results from all successful analyses
- Advanced Deduplication: Smart algorithms prevent over-counting
- Quality Enhancement: Use best specifications from any contributing model
- Completeness Bias: Include deliverables found by any model
Stage 4: Multiplier-Based Expansion
- Base Deliverable Processing: Expand multiplier arrays into individual assets
- Controlled Multiplication: Only 2 array fields prevent over-expansion
- Quantity Validation: Ensure results match expected deliverable counts
- Detailed Logging: Track expansion calculations for debugging
📊 Output Format
Structured CSV Export
Generated files: output/{filename}-{timestamp}.csv
16-Column Schema:
- Core:
title,category,media,asset_type,status - Technical:
technical_specifications,brand_identifier - Market:
language_country_market(ISO format: "EN-UK", "DE-DE") - Timeline:
review_date,live_date,end_date - Context:
reference_material,page_number,priority_level,creative_direction - Validation:
quantity
Example Output
title,category,media,asset_type,technical_specifications,language_country_market,quantity
"Social Media Assets","Paid Social","IMAGE","JPG","1080x1080","EN-UK","1"
"Social Media Assets","Paid Social","IMAGE","JPG","1080x1920","EN-UK","1"
"Social Media Assets","Paid Social","IMAGE","JPG","1080x1080","DE-DE","1"
⚡ Performance
Processing Times
- Small Documents (1-5 pages): 1-2 minutes
- Medium Documents (6-20 pages): 2-4 minutes
- Large Documents (20+ pages): 3-6 minutes
- Parallel Advantage: 3x faster than sequential model processing
Accuracy Benefits
- Multi-Model Consensus: Higher confidence through diverse AI perspectives
- Reduced Blind Spots: Different models catch different deliverable types
- Quality Enhancement: Best specifications from multiple analyses
- Comprehensive Coverage: Bias toward completeness prevents missed assets
💰 Cost Management
Pricing Awareness
- OpenAI GPT-5: $2.50-$10.00 per 1M tokens
- Anthropic Claude: $3.00-$75.00 per 1M tokens
- Google Gemini: $1.25-$5.00 per 1M tokens
Cost Controls
- Pre-Processing Estimates: Know costs before execution
- Budget Limits: Configurable maximum spending per document
- Real-Time Tracking: Monitor costs during processing
- Model Selection: Choose quality vs cost balance
Typical Costs
- Small Brief: $0.50-$2.00 (3-model analysis)
- Medium Brief: $1.00-$5.00 (3-model analysis)
- Large Brief: $2.00-$10.00 (3-model analysis)
🔧 Configuration
Model Selection Strategies
Maximum Quality (Highest Cost):
--primary-models openai-gpt5,anthropic-opus4,google-gemini25 \
--consolidation-model anthropic-opus4
Balanced Performance (Recommended):
--primary-models openai-gpt5,anthropic-sonnet4,google-gemini25 \
--consolidation-model openai-gpt5
Cost-Optimized:
--primary-models openai-gpt5,google-gemini25 \
--consolidation-model google-gemini25
Speed-Focused:
--primary-models anthropic-sonnet4,google-gemini25 \
--consolidation-model anthropic-sonnet4
Environment Variables
# API Configuration
OPENAI_API_KEY=your-openai-key
ANTHROPIC_API_KEY=your-anthropic-key
GOOGLE_API_KEY=your-google-key
LLAMACLOUD_API_KEY=your-llamacloud-key
# Model Settings
OPENAI_REASONING_EFFORT=medium
ANTHROPIC_MAX_TOKENS=64000
GOOGLE_MAX_OUTPUT_TOKENS=100000
# Processing Controls
MINIMUM_SUCCESS_THRESHOLD=1
ENABLE_COST_ESTIMATION=true
MAX_PROCESSING_COST_USD=10.00
📖 Advanced Usage
Multiplier Field Optimization
The system uses 2 multiplier fields to control expansion:
technical_specifications: Dimensions, sizes, formatslanguage_country_market: Market targeting with ISO codes
Example Multiplier Logic:
Base Deliverable: "Social Media Assets"
Technical Specs: ["1080x1080", "1080x1920", "1200x1200"] (3 sizes)
Markets: ["EN-UK", "DE-DE", "FR-FR"] (3 markets)
Result: 3 × 3 = 9 individual deliverables
Quantity Validation
The system uses the quantity field as a sense-check:
- Purpose: Validate that multiplier expansion matches expected count
- Example: If brief says "20 banners", ensure specs × markets ≈ 20
- Benefit: Prevents over-multiplication and unrealistic deliverable counts
Intelligent Consolidation
"Include if Any Model Found It" Philosophy:
- Multiple models may find different deliverables from the same document
- Consolidation includes all legitimate unique deliverables
- Smart deduplication prevents true duplicates
- Quality enhancement uses best specifications from any model
🛠 Development
Architecture
llm_service/: Multi-provider abstraction layer with async supportprompts/: External prompt templates and universal schemaconsolidation_processor.py: Multi-model result merging logicconfig.py: Environment variable management and validation
Adding New Providers
- Extend
BaseLLMProviderinllm_service/ - Implement async
generate_response()method - Add configuration to
.envandconfig.py - Update model mappings and CLI interface
Customizing Extraction
- Schema: Edit
prompts/universal_schema.json - Prompts: Modify files in
prompts/directory - Processing: Adjust
expand_deliverables()function - Consolidation: Update consolidation logic
📞 Support & Troubleshooting
Common Issues
- API Key Errors: Verify all keys are set in
.env - High Costs: Adjust model selection or cost limits
- Model Failures: Check logs for provider-specific errors
- Over-Expansion: Review multiplier arrays and quantity validation
Debug Information
- Processing Logs:
processing.logwith detailed execution info - Cost Tracking: Token usage and cost breakdown per model
- Expansion Details: Multiplier calculations and validation results
- Model Performance: Success rates and deliverable count comparisons
Getting Help
- Documentation: See
CLAUDE.mdfor detailed technical information - Logs: Check
processing.logfor comprehensive debugging information - Configuration: Verify
.envsettings and API key validity
🎯 Use Cases
Marketing Agencies
- Client Brief Analysis: Extract all deliverables from complex campaign briefs
- Project Planning: Generate comprehensive asset lists for timeline planning
- Resource Estimation: Understand scope and effort required for campaigns
Creative Teams
- Asset Inventory: Catalog all required creative deliverables
- Specification Tracking: Maintain exact technical requirements
- Multi-Market Campaigns: Handle localization and market-specific variations
Project Managers
- Scope Definition: Clear deliverable counts and specifications
- Timeline Planning: Review dates and launch schedules
- Quality Control: Standardized asset information across projects
Enhanced Brief Processing System - Transforming document analysis through multi-model AI intelligence.