How eftimovdaniel/askugd works
AskUGD is a multilingual, document-grounded university assistant. A student asks through the web widget or Gradio UI; the backend guards the request, plans retrieval and generation, then returns a cited answer, optionally as a stream. A separate ingestion workflow prepares official documents for search. The graph also preserves hybrid retrieval, reranking, table-aware extraction, session/cache behavior, and security. Some links rely on README claims or source-index references; unsampled implementation details are not assumed.
Main entry points: pipeline.py Turn planner · run_ingestion.py Ingestion runner · chat.py Chat API · retriever.py Hybrid retrieval
Components 28
Student interfaces
- Web widget
frontend/src/ugdAgent.ts - Widget bootstrap
frontend/src/main.ts - Gradio UI
app.py
Chat service
- Chat API
backend/app/api/chat.py - Turn planner
backend/app/core/pipeline.py - FastAPI app
backend/app/main.py
Knowledge ingestion
- Ingestion runner
backend/ingestion/run_ingestion.py - PDF loader
backend/ingestion/pdf_loader.py - OCR processing
backend/ingestion/ocr.py - Table extraction
backend/ingestion/table_extractor.py - HTML scraper
backend/ingestion/html_scraper.py - Document chunker
backend/ingestion/chunker.py - Table chunker
backend/ingestion/chunker_tabeli.py
Search and answer
- Hybrid retrieval
backend/app/core/retriever.py - Vector store
backend/app/core/vectorstore.py - Cross-encoder reranker
backend/app/core/rerank.py - Answer generator
backend/app/core/generator.py - Intent handling
backend/app/core/intents.py - Language handling
backend/app/core/language.py
State and security
- Answer cache
backend/app/core/cache.py - Conversation history
backend/app/core/history.py - Signed sessions
backend/app/core/sessions.py - Request defenses
backend/app/security.py
Other components
- Student
- Qdrant
- LLM provider
- Redis
- Official documents
Connections 29
- Student → Web widget: asks via
- Widget bootstrap → Web widget: initializes
frontend/src/main.ts - Web widget → Chat API: streams questions
- Student → Gradio UI: asks via
app.py - Gradio UI → Turn planner: starts turn
app.py - FastAPI app → Chat API: mounts routes
backend/app/main.py - Chat API → Request defenses: guards requests
backend/app/api/chat.py - Chat API → Turn planner: plans and commits
backend/app/api/chat.py - Turn planner → Intent handling: checks intent
backend/app/core/pipeline.py - Turn planner → Answer cache: checks cache
backend/app/core/pipeline.py - Turn planner → Conversation history: loads and appends
backend/app/core/pipeline.py - Turn planner → Signed sessions: resolves session
backend/app/core/pipeline.py - Turn planner → Hybrid retrieval: retrieves passages
backend/app/core/pipeline.py - Hybrid retrieval → Vector store: searches
backend/app/core/retriever.py - Hybrid retrieval → Cross-encoder reranker: reranks candidates
backend/app/core/retriever.py - Hybrid retrieval → Language handling: uses language tools
- Chat API → Answer generator: generates answers
backend/app/api/chat.py - Answer generator → LLM provider: requests completion
- Vector store → Qdrant: searches and writes
backend/app/core/vectorstore.py - Ingestion runner → Official documents: reads sources
backend/ingestion/run_ingestion.py - Ingestion runner → PDF loader: loads PDFs
backend/ingestion/run_ingestion.py - Ingestion runner → HTML scraper: scrapes web sources
backend/ingestion/run_ingestion.py - PDF loader → OCR processing: uses OCR
backend/ingestion/pdf_loader.py - PDF loader → Table extraction: extracts tables
- Ingestion runner → Document chunker: chunks documents
backend/ingestion/run_ingestion.py - Ingestion runner → Table chunker: chunks table blocks
backend/ingestion/run_ingestion.py - Ingestion runner → Vector store: writes chunks
backend/ingestion/run_ingestion.py - Signed sessions → Redis: stores session data
- Conversation history → Redis: uses shared storage