Spaces:
Running
Running
|
Download rag/codemap.md from Deign86/mathpulse-api-v3test: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/spaces/Deign86/mathpulse-api-v3test/resolve/main/rag/codemap.md
- Command line
-
hf download hf://spaces/Deign86/mathpulse-api-v3test/rag/codemap.md
-
curl -L -o codemap.md https://huggingface.co/spaces/Deign86/mathpulse-api-v3test/resolve/main/rag/codemap.md
2.08 kB
backend/rag/
Responsibility
Curriculum document parsing, ingestion, vector-store access, and retrieval of source-grounded lesson context.
Design
curriculum_rag.pynormalizes filters, builds Chroma queries, scores/organizes chunks, and formats lesson/problem prompts.vectorstore_loader.get_vectorstore_componentslazily initializes the Chroma collection and sentence-transformer embedder; health/reset helpers support diagnostics/tests.pdf_ingestion.ingest_pdfextracts and chunks source PDFs, generates question/embedding data, and records processing state.liteparse_utils,pdf_parser, anddocx_parserisolate document parsing;firebase_storage_loaderlocates curriculum objects in Firebase Storage.teacher_module_generator.generate_teacher_modulebuilds structured teacher modules from retrieved material.
Flow
/api/rag/...(rag_routes/deepseek_rag_routes) →retrieve_curriculum_contextor lesson retrieval helpers →get_vectorstore_components→ Chromacurriculum_chunks→ formatted context → inference/DeepSeek response./api/curriculum/generate-module→fun_modules_routes.generate_module→ curriculum retrieval +generate_teacher_module→ structured module response.- Admin PDF reingestion →
admin_routesingestion orchestration → Firebase Storage/document parsing →pdf_ingestion.ingest_pdf→ chunk/question and vector persistence. - Exact lesson retrieval uses
retrieve_lesson_pdf_context/build_exact_lesson_query; generic retrieval usesretrieve_curriculum_contextand metadata filters.
Integration
- Route consumers live under
backend/routes/; model access is shared throughservices.ai_client/services.inference_client. - Source PDFs can be loaded from Firebase Storage; retrieval uses the local/configured Chroma vector store and
BAAI/bge-small-en-v1.5-style sentence-transformer embeddings. - Firestore is used by ingestion for manifests/question metadata where configured; Chroma is the retrieval index, not the API router's persistence layer.