Abiram965/AIML
0
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
- Clone the repository:
git clone https://github.com/abiram965/intelligent-query-system.git
cd intelligent-query-system- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`- Install the dependencies:
pip install -r requirements.txt- 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"- Run the FastAPI server:
uvicorn main:app --reloadAPI 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:
{
"documents": "url_to_your_pdf_document",
"questions": ["Your first question", "Your second question"]
}- Headers:
Authorization:Bearer your_auth_token
- Response:
{
"answers": ["Answer to the first question", "Answer to the second question"]
}Dependencies
fastapiuvicornpydanticrequestspdfplumberpython-dotenvlangchain-corelangchain-huggingfacelangchain-qdrantqdrant-clientgoogle-generativeaisentence-transformers
