Skip to content

v0.5.0 - Hybrid Search & Semantic Retrieval

Choose a tag to compare

@scream4ik scream4ik released this 23 Dec 16:58
· 3 commits to main since this release

This release transforms MemState into a complete Memory Engine.
Previously, MemState ensured your data was written consistently. Now, it ensures it is retrieved consistently.

🔍 New Feature: Hybrid Structured-Semantic Search

We introduced a unified store.search() API that bridges the gap between Vector similarity and SQL strictness.

Why is this safer than standard RAG?
Standard RAG retrieves text directly from the Vector DB. If your Vector DB is slightly behind (indexing lag) or out of sync, you get stale data.
MemState Search uses the "Index-Lookaside" pattern:

  1. Discovery: Finds relevant IDs in the Vector DB (using semantic query + metadata filters).
  2. Hydration: Loads the actual payload from the SQL Storage (Source of Truth).
  3. Result: You always get the latest committed state, never stale vectors.
# Search by meaning + Filter by strict metadata
results = await store.search(
    query="What does the user like?",
    filters={"role": "preference"},
    limit=5
)
# Returns ScoredFact objects with fresh data

✨ Integrations Upgrade

  • Qdrant: Implemented modern query_points API. Added DX Magic: you can now pass simple Python dicts {"role": "user"} as filters, and MemState automatically converts them to Qdrant's complex models.Filter syntax.
  • ChromaDB: Full support for semantic search with metadata filtering.

⚠️ Breaking Changes

  • Protocol Update: The MemoryHook and AsyncMemoryHook protocols now require a search method. If you have written custom hooks, you need to implement this method (returning an empty list [] is acceptable if retrieval is not supported).