Skip to content

csharpinc/Knowledge-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Alright, here's a professional-grade folder structure + code scaffolding plan for the AI Knowledge Engine, designed to keep it simple, clean, and deployable within 10 hours.

📁 Project Folder Structure

knowledge_engine/
├── backend/
│   ├── manage.py
│   ├── requirements.txt
│   ├── backend/              # Django project folder
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── urls.py
│   │   ├── wsgi.py
│   ├── api/                  # Django app
│   │   ├── __init__.py
│   │   ├── views.py
│   │   ├── urls.py
│   │   ├── embeddings.py     # Embedding + retrieval logic
│   │   ├── llm_response.py   # Call HuggingFace / LLM for final answer
│   │   ├── sample_data.txt   # Preloaded knowledge base (sample text)
├── frontend/
│   ├── index.html
│   ├── assets/
│   │   ├── styles.css
│   │   ├── script.js
├── README.md

🛠 Code Scaffolding Plan

1. Backend (Django + DRF)

  • backend/settings.py

    • Setup basic Django config + CORS allow all origins

    • Add rest_framework, corsheaders, api to INSTALLED_APPS

  • backend/urls.py

    • Route all API endpoints (e.g., /api/ask)
  • api/urls.py

    • Define path('ask/', AskView.as_view())
  • api/views.py

    • Class AskView(APIView):

      • POST method: receives question

      • Calls retrieval function

      • Calls LLM response generation

      • Returns final answer as JSON

  • api/embeddings.py

    • Load sample_data.txt

    • Embed text chunks

    • Implement basic semantic search (cosine similarity or FAISS)

  • api/llm_response.py

    • Use HuggingFace pipeline (or API) to generate answer from matched context.
  • Djangodjangorestframeworktransformerssentence-transformerstorchfaiss-cpudjango-cors-headers

2. Frontend (HTML + Bootstrap + Vanilla JS)

  • index.html

    • Simple Bootstrap layout

      • Header

      • Input field for question

      • "Ask" button

      • Answer card

  • assets/styles.css

    • Custom minor styling (loading spinner, answer card formatting)
  • assets/script.js

    • Fetch question via POST /api/ask

    • Show loading spinner

    • Render the answer dynamically on the page

3. Deployment Notes

  • Add gunicorn to requirements.txt for production

  • web: gunicorn backend.wsgi

  • Set environment variables like DJANGO_ALLOWED_HOSTS=*

  • Frontend can be pushed as a static site if needed, or served via Django staticfiles.

⚡ Fast Milestones Timeline

Time SlotDeliverable1st HourDjango + DRF skeleton setup2nd-3rd HourBuild embedding + retrieval modules4th HourSetup API + Test with Postman5th HourFrontend HTML + Bootstrap UI6th HourJS fetch integration7th-8th HourFinal polish: loaders, error handling9th HourDeployment setup10th HourLive Demo + GitHub push

📦 Output at the End

✅ Working full-stack AI Knowledge Engine✅ Hosted live version (Render or HuggingFace Spaces)✅ GitHub repo with clean README

Would you also like me to give you a starter views.py and script.js template?(Literally plug-and-play in class.) 🚀Ready if you want it!

About

Project for Fullstack AI Bootcamp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published