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