Metadata-Version: 2.4
Name: reddit-consensus
Version: 0.1.1
Summary: Autonomous AI agent for tasteful recommendations via Reddit community analysis
Author-email: Jash Vira <jashvira2001404@gmail.com>
Maintainer-email: Jash Vira <jashvira2001404@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/jashvira/reddit-consensus
Project-URL: Repository, https://github.com/jashvira/reddit-consensus.git
Project-URL: Documentation, https://github.com/jashvira/reddit-consensus#readme
Project-URL: Bug Tracker, https://github.com/jashvira/reddit-consensus/issues
Keywords: reddit,ai,agent,recommendations,consensus,community
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openai>=1.88.0
Requires-Dist: asyncpraw>=7.7.1
Requires-Dist: rich>=13.0.0
Provides-Extra: notebook
Requires-Dist: ipykernel>=6.29.5; extra == "notebook"
Requires-Dist: ipywidgets>=8.1.7; extra == "notebook"
Dynamic: license-file

<div align="center">

<img src="logo.png" alt="Reddit Consensus Agent" width="120" height="120">

# Reddit Consensus Agent

*An autonomous AI agent that provides tasteful insights by analyzing Reddit discussions and community feedback.*

[![PyPI version](https://badge.fury.io/py/reddit-consensus.svg)](https://badge.fury.io/py/reddit-consensus)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Rich Console](https://img.shields.io/badge/UI-Rich%20Console-orange.svg)](https://github.com/Textualize/rich)

</div>

---

## Features

- **Elegant Console UI**: Clean side-by-side dashboard with responsive layout
- **Async Parallel Tool Execution**: Uses asyncio for fast, concurrent Reddit API calls
- **Two-Phase Research**: Initial research followed by critical analysis
- **Community-Driven**: Analyzes real Reddit discussions and user opinions
- **Balanced Insights**: Provides both pros and cons based on community feedback
- **Configurable AI Models**: Uses `gpt-4.1-mini` by default, but supports other OpenAI models via [`config.py`](reddit_consensus/config.py)

## Architecture

- **Agent State Management**: Tracks research progress and findings
- **Reddit Tools**: Async tools for searching posts and analyzing comments
- **Prompt Templates**: Centralized prompts for consistent AI interactions
- **Parallel Processing**: Simultaneous tool execution for faster results

## Quick Start

### Installation
```bash
# Install from PyPI
pip install reddit-consensus

# Or clone and install from source
git clone https://github.com/jashvira/reddit-consensus.git
cd reddit-consensus
uv sync
```

### Interactive Session (Recommended)
```bash
# If installed from PyPI
ask-reddit

# If running from source
python ask_reddit.py
```

The interactive session will:
1. Check your API keys (or help you enter them)
2. Ask what you'd like insights on
3. Analyze Reddit discussions with elegant dashboard
4. Show balanced insights with pros/cons
5. Offer to answer another query

### Programmatic Usage
```python
import asyncio
from reddit_consensus.recommender import AutonomousRedditConsensus

async def main():
    agent = AutonomousRedditConsensus()
    result = await agent.process_query("Best cafes in Adelaide Hills")
    agent.print_results()

asyncio.run(main())
```

## Setup

### 1. Install Dependencies
```bash
uv sync
```

### 2. API Keys
You can either set environment variables or enter them when prompted:

#### Option A: Environment Variables (Recommended)
```bash
export OPENAI_API_KEY="your-openai-api-key"
export REDDIT_CLIENT_ID="your-reddit-client-id"
export REDDIT_CLIENT_SECRET="your-reddit-client-secret"
export REDDIT_USER_AGENT="YourApp/1.0 (by /u/yourusername)"
```

#### Option B: Enter When Prompted
Run `python ask_reddit.py` and the interactive session will help you enter credentials.

### 3. Get API Keys
- **OpenAI**: https://platform.openai.com/
- **Reddit**: https://www.reddit.com/prefs/apps/ (create "script" app)

## Requirements

- Python 3.11+
- OpenAI API access
- Reddit API credentials
