This repository contains a system for analyzing competitors using data from various sources like Google, Wikipedia, LinkedIn and Reddit. It dynamically generates SWOT analyses and PDF reports using advanced AI-driven techniques.
- Multi-Source Data Integration: Aggregates data from Google Search, Wikipedia, LinkedIn and Reddit.
- AI-Driven SWOT Analysis: Uses state-of-the-art LLMs (e.g., Llama-2, Gemma 2) to extract insights and generate SWOT analyses.
- Automated PDF Reporting: Produces professional reports summarizing the analysis.
- Modular Multi-Agent System: Designed for scalability and easy extensibility.
The system follows a modular, multi-agent architecture:
- Data Retrieval Agent: Aggregates data from multiple external sources.
- NLP Processing Agent: Normalizes and preprocesses raw data for downstream tasks.
- SWOT Analysis Agent: Uses an LLM to generate Strengths, Weaknesses, Opportunities, and Threats.
- Report Generator: Creates a polished PDF report for the final analysis.
- Orchestrator: Manages the workflow between agents.
git clone [email protected]:FardinHash/competitor-analysis.git
cd competitor-analysis
python3 -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file in the root directory and populate it with the following variables:
OPENAI_API_KEY=your-openai-api-key
CRUNCHBASE_API_KEY=your-crunchbase-api-key
REDDIT_CLIENT_ID=your-reddit-client-id
REDDIT_CLIENT_SECRET=your-reddit-client-secret
REDDIT_USER_AGENT=your-reddit-user-agent
HUGGINGFACE_HUB_TOKEN=your-huggingface-hub-token
To run the system, execute the following command:
python src/main.py
- Enter a company name or product query (e.g.,
Tesla
). - The system retrieves and processes data, generates a SWOT analysis, and creates a PDF report.
- The report is saved in the
outputs/reports/
directory.
To ensure the system works as expected, use the following example test cases:
- Test Input: Query for a company like
OpenAI
. - Expected Output: Retrieved summaries from Google, Wikipedia, and Reddit in structured format.
- Test Input: Raw data from multiple sources.
- Expected Output: Normalized and cleaned data ready for SWOT analysis.
- Test Input: Normalized data for
Tesla
. - Expected Output: A coherent SWOT analysis with structured Strengths, Weaknesses, Opportunities, and Threats.
- Test Input: SWOT analysis for
SpaceX
. - Expected Output: A PDF file saved in
outputs/reports/SpaceX_analysis_report.pdf
.
- Test Input: Query for
NVIDIA
. - Expected Output: Complete analysis with a generated PDF report containing SWOT insights.
To run the test scripts, use:
pytest tests/
This project is licensed under the MIT License. See the LICENSE file for details.