Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AI Marketing Agent project with implementation& data #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,256 changes: 1,256 additions & 0 deletions AI-marketing-agent/AIMarketResearch.ipynb

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions AI-marketing-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# AI Marketing Research Agent

This project implements an intelligent agent for conducting marketing research and competitive analysis using Reddit data. The agent leverages NLP and LLM capabilities to analyze social media discussions, identify market trends, and generate actionable marketing insights.

## Features

- Automated Reddit data collection and analysis
- Intelligent query augmentation for comprehensive research
- Vector database storage for efficient information retrieval
- LLM-powered insight generation
- Graph-based conversation flow

## Technology Stack

- **chromadb**: Vector database for storing and managing embeddings
- **praw**: Python Reddit API Wrapper
- **openai**: OpenAI's API integration
- **python-dotenv**: Environment variable management
- **langchain**: Framework for LLM applications
- **langchain-openai**: OpenAI integration for LangChain
- **langchain-text-splitters**: Text processing utilities
- **langgraph**: Graph-based operations

## Setup

1. Install required packages:
```bash
pip install chromadb praw openai python-dotenv langchain langchain-openai langchain-text-splitters langgraph
```

2. Environment Variables
The following environment variables would be required to run the Reddit API functionality:
```
OPENAI_API_KEY=your_openai_key
REDDIT_CLIENT_ID=your_reddit_client_id
REDDIT_CLIENT_SECRET=your_reddit_client_secret
REDDIT_USER_AGENT=your_user_agent
```

Note: For submission purposes, these credentials are not included and not required. Users wanting to run this code would need to obtain their own API credentials from:
- Reddit API credentials: https://www.reddit.com/prefs/apps
- OpenAI API key: https://platform.openai.com/api-keys

## Project Structure

- `AIMarketResearch.ipynb`: Main notebook containing the implementation
- `augment.json`: Query augmentation rules
- `generator_prompt.txt`: System prompt for insight generation
- `data/chroma_db/`: Directory for vector database storage

## Core Components

### Knowledge Base Generation
- Subreddit search and data collection
- Post and comment extraction
- Vector embedding generation
- ChromaDB storage

### Query Processing
- Query augmentation using predefined rules
- Vector similarity search
- Context-aware response generation

### Insight Generation
- Market trend analysis
- Competitive intelligence
- Customer pain point identification
- Strategic recommendations

## Usage

1. Set `GENERATE_KNOWLEDGE=True` to activate knowledge base generation
2. Input search query and number of subreddits to analyze
3. The agent will:
- Search relevant subreddits
- Collect and process posts/comments
- Generate embeddings
- Store information in ChromaDB
- Generate marketing insights

## Output Format

The agent provides insights in the following structure:
1. Key Findings
2. Market Implications
3. Recommendations§
36 changes: 36 additions & 0 deletions AI-marketing-agent/augment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"searches": [
{
"prefix": "Find popular tools for",
"suffix": "and their main features"
},
{
"prefix": "List common complaints about",
"suffix": "tools and software"
},
{
"prefix": "Identify market leaders in",
"suffix": "tools and their advantages"
},
{
"prefix": "Find current trends in",
"suffix": "tools and technologies"
},
{
"prefix": "What are users wishing for in",
"suffix": "tools and features"
},
{
"prefix": "Compare different",
"suffix": "tools pricing and features"
},
{
"prefix": "Find pain points with existing",
"suffix": "tools and solutions"
},
{
"prefix": "Discover emerging alternatives to",
"suffix": "tools in the market"
}
]
}
9 changes: 9 additions & 0 deletions AI-marketing-agent/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# config.py

# Reddit API Configuration
REDDIT_CONFIG = {
'client_id': 'e9ak0otF8Om8_nGBpNfHZA',
'client_secret': 'u1gxgyKgUBwaJkONZEiFfZyQyCCx-A',
'user_agent': 'analyse-market/1.0 (by /u/Affectionate_Buddy43)',
'redirect_uri': 'http://localhost:8080'
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added AI-marketing-agent/data/chroma_db/chroma.sqlite3
Binary file not shown.
10 changes: 10 additions & 0 deletions AI-marketing-agent/generator_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**You are an expert marketing analyst specializing in competitive analysis, market trends, and consumer behavior. Your role is to analyze social media discussions, customer feedback, and market conversations to provide actionable marketing insights. Focus on identifying market opportunities, competitive advantages, customer pain points, and potential marketing strategies.**

**Instructions:**
Analyze the provided information and provide insights in the following format:
1. Key Findings: Identify main patterns or insights
2. Market Implications: What this means for the market/business
3. Recommendations: Specific, actionable marketing recommendations based on the analysis

**Considerations:**
- Stick to information present in the context. If certain aspects aren't covered in the data, acknowledge the gaps and what additional information would be valuable.