Skip to content

asppanda12/radiac.ai_assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Ad Campaign Creation Agent

An LLM-driven agent that converts campaign briefs into structured ad campaign plans.


🚀 Features

  • Converts natural language campaign briefs into machine-readable JSON plans
  • Generates multiple ad creative variants with justifications
  • Performs automated consistency checks
  • Supports mock LLM responses for testing
  • Includes example briefs and outputs

⚙️ Setup

  1. Clone the repository

    git clone https://github.com/yourusername/campaign-agent.git
    cd campaign-agent
  2. Create a virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    cp .env.example .env

    Then add your OpenAI API key and model settings inside .env.


🖥️ Usage

Streamlit UI

Run the web interface:

streamlit run ui/app.py

The UI provides a user-friendly interface for:

  • Creating and editing campaign briefs
  • Generating campaign plans
  • Viewing detailed results
  • Downloading campaign plans as JSON

Command Line

Process a campaign brief:

python -m src.agent examples/brief1.json

Python API

from src.agent import CampaignAgent

# Initialize agent
agent = CampaignAgent()

# Process brief from file
campaign = agent.process_brief_from_file("examples/brief1.json")

# Or process brief directly
brief = {
    "campaign_id": "cmp_2025_09_01",
    "goal": "increase trial signups",
    # ... rest of brief ...
}

campaign = agent.process_brief(brief)

🧪 Testing

Run tests with mock LLM responses:

pytest tests/

📁 Project Structure

campaign-agent/
├── src/                     # Main source code
│   ├── agent.py             # Campaign agent implementation
│   ├── models/              # Data models
│   ├── prompts/             # LLM prompts
│   ├── validators/          # Validation logic
│   └── utils/               # Utility functions
├── tests/                   # Test files
├── examples/                # Example briefs and outputs
├── requirements.txt         # Python dependencies
└── .env.example             # Environment variables template

🔑 Environment Variables

Variable Description Default
OPENAI_API_KEY Your OpenAI API key
LLM_MODEL Model to use gpt-4
TEMPERATURE Model temperature 0.7
MAX_TOKENS Maximum tokens per response 2000
MOCK_LLM Use mock responses for testing false

🧩 Limitations and Future Improvements

  1. Limited grounding: Currently doesn’t use a knowledge base for product facts or past metrics
  2. Basic validation: Could add more sophisticated checks for ad copy quality
  3. No performance prediction: Future versions could include ML-based creative scoring

📜 License

MIT License


Project: radiac.ai_assignment

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published