CoolFace
Apppublic

abdullah9873/physical-ai-backend

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
App README

Backend README

This is the README for the RAG Chatbot backend service.

Setup

  1. 1.Prerequisites:
  2. 2.Python 3.11+ installed
  3. 3.requirements.txt file with all necessary dependencies
  4. 4.Environment variables configured (OPENAI_API_KEY, QDRANT_API_KEY, QDRANT_HOST, DATABASE_URL)
  1. 1.Installation:
bash
    pip install -r requirements.txt
  1. 1.Database Setup: (Assuming Alembic is used for migrations)
bash
    alembic upgrade head

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

  1. 1.Running the Server:
bash
    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:

bash
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.