backend-rag-chatbot / README.md
abdullah9873's picture
Upload folder using huggingface_hub
8545d23 verified
|
Raw History Blame Contribute Delete
1.34 kB
metadata
title: Physical Ai Backend
emoji: 🤖
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
app_port: 7860

Backend README

This is the README for the RAG Chatbot backend service.

Setup

  1. Prerequisites:

    • Python 3.11+ installed
    • requirements.txt file with all necessary dependencies
    • Environment variables configured (OPENAI_API_KEY, QDRANT_API_KEY, QDRANT_HOST, DATABASE_URL)
  2. Installation:

    pip install -r requirements.txt
    
  3. Database Setup: (Assuming Alembic is used for migrations)

    alembic upgrade head
    

    (If not using Alembic, refer to backend/src/database.py for connection details and manual setup if needed)

  4. Running the Server:

    uvicorn backend.src.main:app --reload
    

Usage

  • The API provides two main endpoints:
    • POST /query/general: For general questions about the book.
    • POST /query/selected-text: For questions about specific text selections.

Data Ingestion

To populate the database and vector store, run the ingestion script:

python scripts/ingest_data.py

Note: Ensure your Docusaurus build output is accessible at the path specified in scripts/ingest_data.py or modify the script to point to the correct location.