66 lines
2.8 KiB
Python
Executable file
66 lines
2.8 KiB
Python
Executable file
from app.agents.base_agent import BaseAgent
|
|
from app.models.schemas import SubReview
|
|
from app.services.gemini_service import GeminiService
|
|
from app.services.reference_docs import ReferenceDocsService
|
|
|
|
|
|
class BrandAgent(BaseAgent):
|
|
"""Brand Agent - analyzes proofs against Barclays brand guidelines using Gemini."""
|
|
|
|
name = "Brand Agent"
|
|
|
|
def __init__(self, gemini_service: GeminiService, reference_docs: ReferenceDocsService):
|
|
"""
|
|
Initialize the Brand Agent.
|
|
|
|
Args:
|
|
gemini_service: Service for making Gemini API calls
|
|
reference_docs: Service for loading reference documents
|
|
"""
|
|
self.gemini = gemini_service
|
|
self.brand_context = reference_docs.get_brand_context()
|
|
|
|
async def analyze(self, file_data: bytes, file_type: str) -> SubReview:
|
|
"""
|
|
Analyze the proof for brand guideline adherence.
|
|
|
|
Args:
|
|
file_data: Raw bytes of the file to analyze
|
|
file_type: MIME type of the file
|
|
|
|
Returns:
|
|
SubReview with brand compliance assessment
|
|
"""
|
|
prompt = f"""You are a brand expert for Barclays Bank. Your role is to analyze marketing proofs for adherence to Barclays UK brand guidelines.
|
|
|
|
Here are the brand guidelines to use for your analysis:
|
|
|
|
{self.brand_context}
|
|
|
|
---
|
|
|
|
Analyze the uploaded proof against these Barclays brand guidelines, checking for:
|
|
|
|
1. **Logo Usage**: Is the Barclays Eagle/logo used correctly? Check sizing, placement (should be top-right or as specified), clear space requirements, and that it hasn't been altered.
|
|
|
|
2. **Card Portal**: If the Card Portal asset is present, verify it follows the sizing rules (1/12 of shortest side for print, responsive for digital), proper cyan color, and corner visibility.
|
|
|
|
3. **Color Palette**: Are only approved brand colors used? Check for proper color pairings and that cyan is used appropriately as a sacred asset.
|
|
|
|
4. **Typography**: Is Barclays Effra (or approved fallback) used correctly? Check font weights, sizes, and hierarchy.
|
|
|
|
5. **Design Principles**: Does the overall design reflect the brand principles of Bold, Purposeful, and Expressive?
|
|
|
|
6. **Sacred Assets**: Verify that sacred assets (Cyan, Logo/Eagle, Portal) are not altered or misused.
|
|
|
|
Provide your analysis as a JSON object. Be specific about any issues found and reference the relevant guideline sections.
|
|
|
|
RAG Status Guidelines:
|
|
- **Green**: Fully compliant with brand guidelines, no issues
|
|
- **Amber**: Minor deviations that should be addressed but don't severely impact brand integrity
|
|
- **Red**: Significant brand guideline violations that must be fixed before use
|
|
|
|
If the proof is nonsensical, not a marketing material, or cannot be analyzed, set analysisStatus to 'low_confidence'.
|
|
"""
|
|
|
|
return await self.gemini.analyze_with_image(prompt, file_data, file_type)
|