stage4(sagemaker-deployment): Chat Persistence, History, Eviction, Delete Endpoint, Tests & Demo Description - #7
Merged
Conversation
CodeGuardian scan — no results found |
…ndpoint and tests
CodeGuardian scan — no results found |
…and normalize formatting
CodeGuardian scan — no results found |
CodeGuardian scan — no results found |
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.
Description - Fixes #6
Summary
This PR completes the Stage 4 features by adding persistent chat session management, including session history, TTL-based eviction, and a safe delete endpoint. It also adds the necessary tests, a small demo script, and updates to the README to ensure the app can be easily run and demoed locally. This work is hackathon-ready and fully tested.
Key Changes
Persistence
init_chat_db,save_session,load_session,delete_session, andlist_sessions.CHAT_DBenvironment variable.Chat API & Session Management
CHAT_SESSION_TTL_SECONDSandCHAT_EVICT_INTERVAL_SECONDS.Tests
Docs & Demo
demo_demo.pyto simulate upload, analysis, chat, and history operations.How to Run Locally
Install Dependencies
Run Tests
Start the Server
Run the Demo
Access Interactive API Docs
http://127.0.0.1:8000/docs
Environment Variables
CHAT_DB— Path to SQLite DB for chat sessions (default:sessions.db).CHAT_SESSION_TTL_SECONDS— Session TTL in seconds (default: 3600). Set<= 0to disable expiry.CHAT_CONTEXT_TURNS— Number of turns to include in the LLM prompt (default: 10).CHAT_EVICT_INTERVAL_SECONDS— Background eviction interval (default: 60).Next Steps
KnowledgeStoreto use SageMaker embeddings with fallback options.PR Checklist:
/chat/{session_id}/historyand/chat/{session_id}/deleteendpoints.