Skip to content

feat(backend): add source-grounded LLM pipeline for Studio and quizzes - #158

Merged
nullure merged 1 commit into
CaviraOSS:mainfrom
benoualiabdelkader:pr/backend-llm-pipeline
Nov 15, 2026
Merged

nullure merged 1 commit into
CaviraOSS:mainfrom
benoualiabdelkader:pr/backend-llm-pipeline

Conversation

@benoualiabdelkader

Copy link
Copy Markdown
Contributor

Summary

Adds a real, source-grounded generation pipeline used by Studio and the quiz builder. Content is generated from the uploaded source on every run; there are no canned questions, mind maps, or cached results.

What changed

  • New source library routes (/sources) with upload/list/get/delete and text extraction for PDF, DOCX, TXT, and Markdown.
  • Whole-document sampling with explicit omission markers plus SHA-256 source hash and source stats.
  • Groq provider (\openai/gpt-oss-120b) through the existing LangChain adapter.
  • Studio generation service/routes for quizzes, QCM, flashcards, summaries, learning sheets, and mind maps.
  • Quiz route accepts \sourceId\ and options (count, difficulty, question types, language, hints, options count), validates LLM JSON, and retries on malformed output.
  • Source-aware chat context.
  • Tests for source sampling, language prompt/context forwarding, quiz validation, and Studio generation.
  • Environment example entries for Groq and PDF text extraction.

Validation


  • px tsc --noEmit -p backend/tsconfig.json\

  • pm test: 100 passed, 3 skipped in this PR (frontend-only mind-map tests live in the frontend PR).

Notes

  • The only in-memory state is a 30-minute job map used to replay results for late WebSocket subscribers; it is not a content cache.
  • The frontend PRs build on these endpoints.

@nullure nullure left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nullure
nullure merged commit 331980e into CaviraOSS:main Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants