Flashgpt

Project
Enhancing learning outcomes
Flashgpt

Generates study flashcards from arbitrary text input using an LLM backend, with RAG to ground cards in user-supplied material.
User documents are chunked with a sliding window (with overlap to preserve sentence context), embedded via OpenAI embeddings, and stored in a vector index. At generation time, the top-k chunks are retrieved and injected into the prompt as grounding context, reducing hallucination rates for domain-specific content.
GPT doesn't reliably return well-formed flashcard arrays without explicit guidance. The prompt enforces a strict JSON schema (question/answer pairs with optional hints), and responses are validated with Zod before being persisted malformed responses trigger a retry with an error-correction prompt.
Each user's card decks are scoped by session, with server-side auth checks on every API route to prevent cross-user data access.
Generation for large documents can exceed typical request timeouts. Addressed by streaming the LLM response and flushing cards to the client incrementally as each question/answer pair is parsed.
RAG (Retrieval-Augmented Generation) pipeline. Documents are chunked, embedded into a vector store, and the most relevant chunks are retrieved at query time to ground the LLM's flashcard generation — reducing hallucination.
Made with