11. How to Update Embeddings After Modifying Knowledge Base?

11.1. Knowledge Base Files to Update

  • frontend/assets/data/topics.json

  • frontend/pages/_slug/pageData/json/*.json (all JSON files except sample.js)

11.2. Update Steps

  1. Setup Python virtual environment:

    cd backend
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  2. Install requirements:

    pip install -r requirements.txt
    
  3. Set environment variable:

    echo "GEMINI_API_KEY=your_api_key_here" > .env
    
  4. Run embedding script:

    python scripts/generate_embeddings.py
    
  5. Deploy updated file:

    • Commit and push backend/data/embeddings.json

    • Restart backend server (if local)