Skip to content

A powerful Q&A system using Google's Gemini Pro API with vector storage (AstraDB) and LLM monitoring. Supports text, images, PDFs, DOCXs, URLs, and YouTube videos.

Notifications You must be signed in to change notification settings

VisionExpo/QA-System-using-Gemini-Pro-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– QA System using Gemini Pro API

Version Python Flask Gemini AstraDB LangSmith License Deployment GitHub

A powerful Question and Answer system built with Google's Gemini Pro API, featuring vector storage with AstraDB and LLM monitoring with LangSmith.

✨ Features

  • πŸ’¬ Text Q&A: Ask questions and get detailed answers powered by Gemini Pro
  • πŸ–ΌοΈ Image Analysis: Upload images for AI-powered analysis with Gemini Pro Vision
  • πŸ“„ Document Processing: Extract and analyze text from PDF, DOCX, and other file formats
  • πŸ”— URL Processing: Analyze content from web pages and YouTube videos
  • πŸ” Semantic Search: Find similar content using vector embeddings
  • πŸ“Š LLM Monitoring: Track and analyze model performance with LangSmith
  • πŸ—„οΈ Vector Storage: Store and retrieve vectors using AstraDB
  • 🌐 Web Interface: Clean, responsive Flask web application

πŸš€ Tech Stack

Technology Purpose
Python Core language
Flask Web framework
Gemini Pro LLM model
AstraDB Vector database
LangSmith LLM monitoring
Sentence Transformers Text embeddings
Docker Containerization
Render Cloud hosting

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚     β”‚                 β”‚     β”‚                 β”‚
β”‚  Web Interface  │────▢│  Flask Backend  │────▢│   Gemini Pro    β”‚
β”‚                 β”‚     β”‚                 β”‚     β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚                             β”‚
                 β”‚  File/URL/Image Processing  β”‚
                 β”‚                             β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚                            β”‚
                 β”‚  Sentence Transformers     β”‚
                 β”‚  (Vector Embeddings)       β”‚
                 β”‚                            β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                  β”‚ β”‚ β”‚                   β”‚
          β”‚     AstraDB      │◀┴─▢│    LangSmith      β”‚
          β”‚  (Vector Store)  β”‚   β”‚    (Monitoring)   β”‚
          β”‚                  β”‚   β”‚                   β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Installation

Prerequisites

  • Python 3.10 or higher
  • Google API key for Gemini Pro
  • AstraDB account and token
  • (Optional) LangSmith API key

Option 1: Using Setup Scripts (Recommended) πŸš€

  1. Clone the repository:

    git clone https://github.com/VisionExpo/QA-System-using-Gemini-Pro-API.git
    cd QA-System-using-Gemini-Pro-API
  2. Run the setup script:

    For Windows:

    setup_env.bat

    For macOS/Linux:

    chmod +x setup_env.sh
    ./setup_env.sh

    This script will:

    • πŸ”¨ Create a virtual environment
    • ⚑ Activate the virtual environment
    • πŸ“¦ Install dependencies
    • πŸ”‘ Create a .env file from the example if it doesn't exist
  3. Edit the .env file and add your API keys:

    • GOOGLE_API_KEY: Your Google API key
    • ASTRA_DB_TOKEN: Your AstraDB token
    • ASTRA_DB_ENDPOINT: Your AstraDB endpoint
    • LANGCHAIN_API_KEY: (Optional) Your LangSmith API key

Option 2: Manual Setup πŸ› οΈ

  1. Clone the repository:

    git clone https://github.com/VisionExpo/QA-System-using-Gemini-Pro-API.git
    cd QA-System-using-Gemini-Pro-API
  2. Create and activate a virtual environment:

    For Windows:

    python -m venv venv
    venv\Scripts\activate

    For macOS/Linux:

    python -m venv venv
    source venv/bin/activate
  3. Install dependencies:

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

    cp .env.example .env

    Then edit the .env file to add your API keys.

πŸš€ Usage

Running the Application

python app.py

Then open http://127.0.0.1:5000 in your web browser.

πŸ’¬ Text Q&A Mode

Ask any question and get detailed answers from Gemini Pro:

  • General knowledge questions
  • Coding help
  • Explanations of complex topics
  • Creative writing assistance

πŸ–ΌοΈ Image Analysis Mode

Upload images for AI-powered analysis:

  • Object identification
  • Scene description
  • Text extraction from images
  • Visual content analysis

πŸ“„ Document Processing

Upload and analyze documents:

  • PDF files
  • Word documents (DOCX)
  • Text files
  • CSV data

πŸ”— URL and YouTube Processing

Analyze content from:

  • Web pages
  • YouTube videos (transcripts and summaries)
  • Online articles

🌐 Deployment

This application is deployed on Render. You can access it at: https://qa-system-using-gemini-pro-api-1.onrender.com/

For detailed deployment instructions, see RENDER_DEPLOYMENT.md.

πŸ§ͺ Testing

To run tests:

python -m pytest tests/

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgements

  • Google for the Gemini Pro API
  • DataStax for AstraDB
  • LangChain for LangSmith
  • The open-source community for various libraries used in this project

πŸ“ž Contact

For questions or feedback, please open an issue on GitHub or contact the maintainer at gorulevishal984@gmail.com.


Made with ❀️ by Vishal Gorule