feat: Add streaming endpoint for real-time intervention plan generation#9
Open
keithesanks-prog wants to merge 8 commits intotillioss:mainfrom
Open
feat: Add streaming endpoint for real-time intervention plan generation#9keithesanks-prog wants to merge 8 commits intotillioss:mainfrom
keithesanks-prog wants to merge 8 commits intotillioss:mainfrom
Conversation
added 8 commits
November 7, 2025 00:37
- Add POST /stream endpoint with Server-Sent Events (SSE) support - Implement StreamingModel wrapper for Gemini streaming API - Add build_prompt_and_model helper function in gateway.py - Update CORS configuration to allow frontend origins - Update requirements.txt to fix pydantic version conflict - Add comprehensive documentation for streaming endpoint - Support automatic filling of missing EMT score fields
- Document SSE implementation approach - Explain StreamingModel wrapper architecture - Describe async generator pattern - Detail prompt building process - Add code structure reference
…ible - Updated /health endpoint to return HTTP 200 even if components are degraded - Added component-level health status (llm_healthy, curriculum_healthy) - Improved error handling with graceful degradation - Updated HealthResponse schema to include component status fields - Updated documentation with health check behavior details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new streaming endpoint that enables real-time token streaming for intervention plan generation using Server-Sent Events (SSE).
Changes
API Details
Endpoint:
POST /streamContent-Type:
application/jsonResponse:
text/event-streamExample Request:
{ "scores": { "EMT1": [35.0, 40.0, 38.0] }, "metadata": { "class_id": "A1", "deficient_area": "EMT1", "num_students": 25 } }Example Response:
Testing
Test with curl:
Documentation
Files Changed
app/api/endpoints/stream.py(new)app/api/endpoints/__init__.py(new)app/llm/gateway.py(added StreamingModel and build_prompt_and_model)app/main.py(added router, updated CORS)requirements.txt(fixed pydantic version)README.md(added streaming documentation)DEPLOYMENT.md(added testing instructions)