-
Notifications
You must be signed in to change notification settings - Fork 53k
feat(memory): add sync_recall option for current-turn relevance #5838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,22 @@ def queue_prefetch(self, query: str, *, session_id: str = "") -> None: | |
| that do background prefetching should override this. | ||
| """ | ||
|
|
||
| def recall_sync(self, query: str, *, session_id: str = "") -> str: | ||
| """Recall relevant context synchronously using the current turn's query. | ||
|
|
||
| Unlike prefetch(), which returns a background result queued for the | ||
| *previous* turn, recall_sync() performs a fresh lookup for the | ||
| *current* query. This guarantees relevance at the cost of added latency. | ||
|
|
||
| Default: fires queue_prefetch() with the current query then immediately | ||
| calls prefetch() which joins the background thread. This is correct for | ||
| all providers that join their thread inside prefetch() (honcho, hindsight, | ||
| mem0, openviking). Providers whose prefetch() reads shared state without | ||
| joining (retaindb) should override this method. | ||
| """ | ||
| self.queue_prefetch(query, session_id=session_id) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This generic composition is not synchronous for current Honcho: its |
||
| return self.prefetch(query, session_id=session_id) | ||
|
|
||
| def sync_turn(self, user_content: str, assistant_content: str, *, session_id: str = "") -> None: | ||
| """Persist a completed turn to the backend. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When porting onto current main, normalize this query exactly as
prefetch_all()does atagent/memory_manager.py:501-503; otherwise/skilland bundle-expanded turns send provider recall the full injected skill body rather than the user instruction.