implemented longitudinal context retrieval for AI reflection - #119
Open
Sonmale25 wants to merge 2 commits into
Open
implemented longitudinal context retrieval for AI reflection#119Sonmale25 wants to merge 2 commits into
Sonmale25 wants to merge 2 commits into
Conversation
This commit introduces the GET /history/summary/{activity_id} endpoint and its supporting AI logic to generate Growth Summaries from past student reflections. By analyzing historical struggles and goals, this feature moves the AI beyond stateless interactions, enabling it to act as a long-term pedagogical mentor. The output format is explicitly designed to be injected into future system prompts, helping students contextualize their current work within their broader learning journey. PII is strictly excluded from these summaries to ensure student privacy. Currently, the endpoint uses mock reflection data, laying the foundation for future integration with the sugar-datastore.
Implement a GET /history/summary/{activity_id} endpoint to enable cross-session memory. This allows the AI to summarize past reflections from the Sugar Journal, transforming the 'stateless' chatbot into a long-term pedagogical mentor that can track a learner's cognitive growth over time.
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.
I’ve implemented a new /history/summary endpoint that allows the system to retrieve and condense past reflection data. Technically, this prepares the LLM's "System Prompt" with a growth-oriented context, enabling it to ask longitudinal questions (e.g., "How have you improved on the loop logic you started yesterday?").
Key Changes:
Added GET /history/summary/{activity_id} in main.py.
Implemented the summarization logic in ai.py using the existing LLM integration.
Designed a flexible mock interface for historical data to ensure future compatibility with the sugar-datastore.
Testing Performed:
Verified the new endpoint appears and functions in the Swagger UI (/docs).
Confirmed the server starts cleanly even with no historical data (graceful fallback).
Ensured no PII is exposed in the summary JSON.