feat(suggestions): hybrid retrieval-grounded follow-ups behind feature flag#116
Open
yashgoel1331 wants to merge 2 commits into
Open
feat(suggestions): hybrid retrieval-grounded follow-ups behind feature flag#116yashgoel1331 wants to merge 2 commits into
yashgoel1331 wants to merge 2 commits into
Conversation
Introduce retrieval evidence extraction, quality-gated hybrid input, prompt guardrails, observability logs, and updated API/FE documentation behind SUGGESTIONS_HYBRID_ENABLED.
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
search_documentsretrieval evidence plus recent conversation context.SUGGESTIONS_HYBRID_ENABLED(defaultfalse) so production stays on conversation-only baseline until explicitly enabled.This PR contains exactly 2 commits cherry-picked onto current
main:02f46a8— suggestions scope guardrail (non-milk transaction limits)4ebd1d6— hybrid suggestions pipeline + feature flag + docsWhat changed
app/services/chat.py): after each chat turn, distill current-turnsearch_documentstool returns into bounded snippets and cache assuggestions_shadow_{session_id}_{target_lang}.app/tasks/suggestions.py): when flag is enabled and retrieval passes deterministic checks, suggestions use last 3 conversation pairs + distilled evidence; otherwise fallback to last 5 pairs (conversation-only).assets/prompts/suggestions_system.md): hybrid input usage rules, answerability constraints, and milk/cooperative scope limits.app/config.py,example.env):SUGGESTIONS_HYBRID_ENABLED.suggestions_task_queued,chat_stream_complete,suggestions_shadow_evidence,suggestions_task_started,suggestions_input_mode,suggestions_cache_written.API_DOC.mdanddocs/CHAT_ENDPOINT_FE_INTEGRATION.mdwith current/api/suggest/behavior and pipeline details.Design notes
Test plan
SUGGESTIONS_HYBRID_ENABLED=false, verifysuggestions_input_mode ... mode=conversation_only retrieval_reason=hybrid_feature_flag_disabled.SUGGESTIONS_HYBRID_ENABLED=trueand a retrieval-heavy ag query, verifymode=hybrid retrieval_reason=ok.conversation_onlywith explicitretrieval_reason./api/suggest/returns JSON string array after generation.Made with Cursor