CoolFace
Apppublic

Abiram965/AIML

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

Intelligent Query System

This project is an intelligent query system that can answer questions based on the content of a PDF document. It uses a combination of natural language processing models and a vector database to provide accurate and relevant answers.

Features

  • —PDF Text Extraction: Extracts text from PDF documents.
  • —Text Chunking: Splits the extracted text into smaller, manageable chunks.
  • —Vector Embeddings: Converts the text chunks into vector embeddings using Hugging Face's sentence-transformers.
  • —Vector Storage: Stores the vector embeddings in a Qdrant vector database.
  • —Question Answering: Uses Google's Gemini model to answer questions based on the document's content.
  • —FastAPI Backend: Exposes the functionality through a FastAPI backend.

Setup

  1. 1.Clone the repository:
bash
    git clone https://github.com/abiram965/intelligent-query-system.git
    cd intelligent-query-system
  1. 1.Create a virtual environment and activate it:
bash
    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  1. 1.Install the dependencies:
bash
    pip install -r requirements.txt
  1. 1.Create a `.env` file and add your API keys:
    QDRANT_URL="your_qdrant_url"
    QDRANT_API_KEY="your_qdrant_api_key"
    GEMINI_API_KEY="your_gemini_api_key"
  1. 1.Run the FastAPI server:
bash
    uvicorn main:app --reload

API Endpoint

POST /hackrx/run

This endpoint takes a PDF document and a list of questions as input and returns a list of answers.

  • —Request Body:
json
    {
      "documents": "url_to_your_pdf_document",
      "questions": ["Your first question", "Your second question"]
    }
  • —Headers:
  • —Authorization: Bearer your_auth_token
  • —Response:
json
    {
      "answers": ["Answer to the first question", "Answer to the second question"]
    }

Dependencies

  • —fastapi
  • —uvicorn
  • —pydantic
  • —requests
  • —pdfplumber
  • —python-dotenv
  • —langchain-core
  • —langchain-huggingface
  • —langchain-qdrant
  • —qdrant-client
  • —google-generativeai
  • —sentence-transformers