How yoangelica/studygen works
Project type and purpose
• StudyGen is a lightweight, single‐repository “full-stack” Python application.
• It exposes a Streamlit web UI (frontend) and a RAG (Retrieval-Augmented Generation) backend pipeline in one service.
• Purpose: let users upload source materials (PDFs, web pages, YouTube URLs), store embeddings, and generate exam-style questions via local LLMs.
File structure
• Top level:
• README.md, pyproject.toml, .env/.gitignore – project config and dependencies
• src/app.py – Streamlit UI code
• src/rag.py – RAG pipeline (document loading, chunking, embeddings, vector store, LLM calls)
• No separate “frontend” or “backend” services; both live in the Python process.
• External services invoked:
• Ollama (LLM + embedding models)
• Chroma (local vector database)
• LangSmith (for tracing/logging)
Extract architecture insights from README
• Orchestration: LangChain
• Embeddings: nomic-embed-text via Ollama
• Question generation: llama3.2 via Ollama
• Storage: Chroma vector store
• UI: Streamlit served by “uv run streamlit”
Main components
a. Streamlit Web UI (Component A)
b. RAG Orchestrator (Component B – src/rag.py with LangChain)
c. Vector Store (Component C – local Chroma DB)
d. Embedding & LLM Service (Component D – Ollama daemon hosting: nomic-embed-text & llama3.2)
e. External Tracing/Logging (Component E – LangSmith API)
f. User-provided Content Source (Component F – PDFs, URLs, YouTube)
Relationships and interactions
• User (browser) ► Streamlit UI
• UI ► RAG Orchestrator (passes uploaded content metadata)
• Orchestrator ► Embedding Service (“nomic-embed-text” via Ollama) ► Vector Store (Chroma)
• Orchestrator ► LLM Service (“llama3.2” via Ollama) ► Generated questions ► UI
• Orchestrator ► LangSmith API (trace calls, logging)
• Vector Store persists embeddings locally between sessions
Architectural patterns & design principles
• Modular separation: UI layer vs. RAG pipeline layer
• Micro-service-style integration with Ollama & Chroma as external dependencies
• Single process vs. external “model as a service” components
• RAG pattern: embedding + vector retrieval + generation
Technologies & frameworks
• Python + Streamlit (web UI)
• LangChain (RAG orchestration)
• Ollama (local LLM/embedding service)
• Chroma (local vector DB)
• LangSmith (API for observability/tracing)
• Use arrowheads to show request/response or data flow
• Data flows: “Chunks → embeddings,” “Query → retrieval,” “Prompt → generation”
• Environment variables (.env) near the UI or orchestrator for configuration context