Spaces:
Running
Running
|
Download services/codemap.md from Deign86/mathpulse-api-v3test: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/spaces/Deign86/mathpulse-api-v3test/resolve/main/services/codemap.md
- Command line
-
hf download hf://spaces/Deign86/mathpulse-api-v3test/services/codemap.md
-
curl -L -o codemap.md https://huggingface.co/spaces/Deign86/mathpulse-api-v3test/resolve/main/services/codemap.md
2.03 kB
backend/services/
Responsibility
Reusable backend domain and infrastructure services for Firestore persistence, model inference, analytics, risk, memory, and communications.
Design
- Service modules expose focused functions/classes rather than HTTP routers; route modules call them for domain work.
inference_clientandai_clientcentralize model configuration and DeepSeek access;wri_serviceandintervention_engineown risk/intervention logic.- Firestore-backed modules obtain clients at the service boundary; examples include
curriculum_service,memory_service, andclass_analytics_engine. - Other key symbols include
ClassAnalyticsEngine,DeterministicResponseCache,EmailService,QuestionBankServicefunctions, andUserProvisioningService.
Flow
/api/curriculum/...โcurriculum_routesโcurriculum_service.get_subjects/get_topicsโ Firestore./api/analytics/class/{class_id}โclass_analytics_routesโget_class_analytics_engine()/ClassAnalyticsEngineโ Firestore and WRI classifications./api/risk/computeโrisk_router.compute_risk_endpointโ WRI service โ risk response; batch route delegates per-student calculation.- Chat and generation routes โ
inference_client/ai_client.get_deepseek_clientโ DeepSeek;memory_servicepersists chat turns and summaries in Firestore. - Quiz Battle routes โ
question_bank_service.get_questions_for_battle/cache_session_questionsโ Firestore question bank and session cache. - Class-record upload/report routes โ
wri_serviceand inference client โ Firestore records and computed insights.
Integration
- Called primarily by
backend/routes/; selected services are also used bybackend/main.pyand RAG ingestion. - Firebase Admin/Google Firestore are the persistence boundary; model calls pass through the shared inference/AI clients.
- RAG retrieval/chunk storage lives in
backend/rag/; services consume RAG results where needed rather than owning Chroma indexing.