8000 feat: Add BM25 retriever for in-memory memory service - issue #786 by latentspace7 · Pull Request #872 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content

feat: Add BM25 retriever for in-memory memory service - issue #786 #872

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

latentspace7
Copy link

Fixes: #786

This PR introduces a BM25-based retriever - the InMemoryBM25RetrievalMemoryService using the rank_bm25 library. This gives users another option in for in-memory memory in addition to the keyword based memory. This enhances search relevance by leveraging a proven term-weighting algorithm.

Key Changes

  • Adds rank_bm25 to provide BM25 search capabilities.
  • A BM25 index is built on-the-fly from user session events.
  • The index is cached per user and invalidated upon new session additions to ensure accuracy.
  • Has a max_results parameter (defaults to 3 when BM25 is used)

Testing Plan

  • Added new unit tests for the BM25 in-memory memory service
  • Verified that the local package builds successfully (uv build)
  • BM25 tests passing
  • Code has been formatted with pyink.*)

@latentspace7 latentspace7 force-pushed the feat/in-memory-BM25-retreiver-issue-786 branch from aa5f305 to 8f92e31 Compare May 22, 2025 13:49
@latentspace7 latentspace7 reopened this May 22, 2025
@latentspace7 latentspace7 force-pushed the feat/in-memory-BM25-retreiver-issue-786 branch from 8f92e31 to ea8406e Compare May 22, 2025 13:58
@latentspace7 latentspace7 marked this pull request as draft May 22, 2025 14:57
@latentspace7 latentspace7 force-pushed the feat/in-memory-BM25-retreiver-issue-786 branch from 7b8e8f1 to e799bcb Compare May 22, 2025 15:02
@latentspace7 latentspace7 marked this pull request as ready for review May 22, 2025 15:03
feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Format and remove lock file

Fix dpes

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Format and remove lock file

Fix dpes

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Format and remove lock file

Fix dpes

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Remove uv lock

feat: Add BM25 as an option for inmemory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

feat: Add BM25 in-memory memory service - issue google#786

Fix dpes
@hangfei hangfei self-requested a review May 30, 2025 20:59
@latentspace7
Copy link
Author

Hi @hangfei Just wanted to gently check in on the above PR submitted a few weeks ago. When you get a chance, could you please take a look? Thankyou!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add BM25-based In-Memory Retriever to Enhance Search Functionality
1 participant
0