Skip to content

hadywalied/AskAttentionAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ask Attention AI

This project is a question-answering application that uses a Retrieval Augmented Generation (RAG) pipeline to answer questions based on a collection of PDF documents. The application is built with FastAPI and uses a FAISS vector store for efficient retrieval.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Installing

  1. Clone the repository:

    git clone https://github.com/hadywalied/AskAttentionAI
    cd AskAttentionAI
  2. Create a .env file:

    Copy the .env.example file to a new file named .env and fill in your environment variables:

    cp .env.example .env
    • LLM_PROVIDER: The name of the provider (e.g., local, openai, huggingface).
    • LLM_ENDPOINT: The URL of the LLM endpoint (for providers that have one, like a local LLM).
    • LLM_API_KEY: The API key for the LLM provider.
    • LLM_MODEL_ID: The ID of the model to use (for providers that have multiple models, like Hugging Face).
    • VECTOR_DB_DIR: The directory where the vector store is saved.
    • DATA_DIR: The directory where your PDF files are located.
  3. Build and run the application:

    docker-compose up --build

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

API Usage

To ask a question, send a POST request to the /ask endpoint with a JSON payload containing the question.

Example using curl:

curl -X POST "http://localhost:8000/ask" -H "Content-Type: application/json" -d '{
  "question": "What is attention?"
}'

sample output:

{
  "answer": " Attention is a mechanism that helps in understanding long-distance dependencies in sequences. It is used to focus on different parts of the input sequence when generating an output. The attention mechanism allows the model to capture relationships between words in a sentence, even if they are far apart."
}

Project Structure

  • app/
    • main.py: The main FastAPI application file.
    • rag_logic.py: The core RAG pipeline logic.
    • models.py: The Pydantic models for the API.
  • data/: Contains the PDF documents.
  • Dockerfile: The Dockerfile for building the application image.
  • docker-compose.yml: The Docker Compose file for managing the application.
  • requirements.txt: The Python dependencies.

About

RAG-based Technical Document Q&A

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors