Skip to content

iprajwaal/AI-Powered-Market-Analyst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Ή AI-Powered Market Analyst

AI Market Analyst is a multi-agent system that uses advanced LLMs to research companies and industries, generate tailored AI use cases, and provide implementation resources. The system leverages LangChain, and LangGraph to create a sophisticated analysis pipeline with web-grounded information.

Project Overview

Features

  • Industry & Company Research: Automatically researches companies and industries using web search
  • AI Use Case Generation: Creates tailored AI/ML implementation strategies with business value analysis
  • Resource Discovery: Finds relevant datasets and implementation resources from Kaggle, HuggingFace, and GitHub
  • Structured Reasoning: Uses enhanced chain-of-thought reasoning and structured outputs
  • Full-Stack Implementation: Includes a FastAPI backend and React/Next.js frontend

πŸ› οΈ Project Structure

AI-Powered-Market-Analyst/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ settings.py          # Configuration for APIs and environments
β”‚   β”‚   └── logging_config.py    # Logging setup
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ industry_research_agent.py
β”‚   β”‚   β”œβ”€β”€ use_case_generation_agent.py
β”‚   β”‚   β”œβ”€β”€ resource_collection_agent.py
β”‚   β”‚   └── orchestrator.py
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ search_tools.py
β”‚   β”‚   β”œβ”€β”€ dataset_tools.py
β”‚   β”‚   β”œβ”€β”€ analysis_tools.py
β”‚   β”‚   └── document_tools.py
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ llm_interface.py
β”‚   β”‚   └── gemini_client.py
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ research_workflow.py
β”‚   β”‚   β”œβ”€β”€ use_case_workflow.py
β”‚   β”‚   └── resource_workflow.py
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ prompt_templates.py
β”‚   β”‚   β”œβ”€β”€ output_formatter.py
β”‚   β”‚   └── validation.py
β”‚   β”œβ”€β”€ monitoring/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ langfuse_tracker.py
β”‚   β”‚   └── metrics.py
β”‚   β”œβ”€β”€ app.py            # FastAPI application
β”‚   └── requirements.txt  # Backend dependencies
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”‚   β”‚   └── Layout.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Button.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Card.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Input.jsx
β”‚   β”‚   β”‚   β”‚   └── Loader.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ forms/
β”‚   β”‚   β”‚   β”‚   └── AnalysisForm.jsx
β”‚   β”‚   β”‚   └── results/
β”‚   β”‚   β”‚       β”œβ”€β”€ ResultsPanel.jsx
β”‚   β”‚   β”‚       β”œβ”€β”€ UseCaseCard.jsx
β”‚   β”‚   β”‚       └── ResourceLinks.jsx
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   β”‚   └── hello.js
β”‚   β”‚   β”‚   └── results/[id].js
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── api.js
β”‚   β”‚   └── styles/
β”‚   β”‚       └── globals.css
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”‚
└── README.md

⏳ Agentic workflow

Agentic flow

Prerequisites

  • Python 3.10 or higher
  • Node.js 18 or higher
  • Google API key for Gemini
  • SERP API key for web search
  • Kaggle API credentials (optional)
  • Google Cloud credentials (optional, for VertexAI)

Installation

Backend Setup

  1. Clone the repository:

    git clone https://github.com/iprajwaal/AI-Powered-Market-Analyst.git
    cd AI-Powered-Market-Analyst
  2. Set up a virtual environment:

    cd backend
    python -m venv .venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    export PYTHONDONTWRITEBYTECODE=1
    export PYTHONPATH=$PYTHONPATH:./backend

Setting up Credentials

This project uses API keys for Google Cloud Platform (GCP), Gemini, and SERP API. Store these securely.

  1. Create a credentials folder in the project root:

    mkdir credentials
  2. Gemini API Key:

    • Visit the Google AI Studio
    • Create a new API key
    • Save this key in your .env file
  3. SERP API Credentials:

    • Sign up for a SERP API account
    • Obtain your API key from the dashboard
    • Create a file named api.yml inside the credentials folder:
      serp:
        key: your_serp_api_key_here
  4. Kaggle API Credentials (Optional):

    • Create a Kaggle account if you don't have one
    • Go to your account settings and create a new API token
    • Download the kaggle.json file and place it in the credentials folder
  5. Create .env file:

    # API Keys
    GEMINI_API_KEY=your_gemini_api_key
    SERPAPI_KEY=your_serpapi_key
    KAGGLE_USERNAME=your_kaggle_username
    KAGGLE_KEY=your_kaggle_key
    HUGGINGFACE_API_KEY=your_huggingface_api_key
    
    # Optional Langfuse Monitoring
    LANGFUSE_PUBLIC_KEY=pk-lf-your_langfuse_public_key
    LANGFUSE_SECRET_KEY=sk-lf-your_langfuse_secret_key
    
    # LLM Configuration
    LLM_PROVIDER=llm_provider
    LLM_MODEL=llm_model
    

Frontend Setup

  1. Navigate to the frontend directory:

    cd ../frontend
  2. Install dependencies:

    npm install
  3. Create .env.local file:

    NEXT_PUBLIC_API_URL=http://localhost:8000
    

Running the Application

Start the Backend

cd backend
uvicorn app:app --host 0.0.0.0 --port 8000 --reload

Start the Frontend

cd frontend
npm run dev

The application will be available at http://localhost:3000.

Usage

  1. Navigate to the home page
  2. Enter a company name (e.g., "Microsoft") or industry name (e.g., "Healthcare")
  3. Set the Number of Use Cases to Generate
  4. Submit the form and wait for the analysis to complete
  5. Explore the generated use cases and resources
  6. Download the markdown report if desired

API Endpoints

  • POST /api/analyze: Start an analysis with company or industry information
  • GET /api/analysis/{request_id}: Get the status and results of an analysis
  • GET /api/markdown/{request_id}: Get the markdown output for an analysis
  • GET /health: Health check endpoint

Technical Details

Backend Components

  • FastAPI: Web framework for the API
  • LangChain: Framework for tool integration
  • LangGraph: Framework for workflow orchestration
  • Gemini API: Large language model for text generation
  • SerpAPI: Web search API for information retrieval
  • Kaggle API: Dataset discovery

Frontend Components

  • Next.js: React framework for the web application
  • Tailwind CSS: Utility-first CSS framework for styling

Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a new branch for your feature or bug fix
  3. Make your changes and commit them
  4. Push your changes to your fork
  5. Create a pull request to the main repository

Acknowledgements

About

Automated Market Researcher

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published