Skip to content

Implement Content-based Search in SQLiteLTMStore #59

@csmangum

Description

@csmangum

Currently, the SQLiteLTMStore lacks implementation for content-based search functionality, which causes failures when trying to use search_by_content() method in the memory system. This causes the memory retrieval demo to fail or require error handling workarounds.

Current Behavior

When memory_system.search_by_content() is called with a SQLite backend, an AttributeError is thrown because the method is not implemented in the SQLiteLTMStore class.

Expected Behavior

The SQLiteLTMStore should implement content-based search capability to allow searching through stored memories based on text content, with proper embedding support.

Proposed Solution

Implement a search_by_content method in the SQLiteLTMStore class that:

  1. Accepts a search query and optional parameters (k, threshold)
  2. Leverages text embeddings to find semantically similar content
  3. Returns memories ranked by relevance

Implementation Details

Suggested approach:

  • Add a new column for embeddings in the SQLite schema
  • When storing memories, calculate and store embeddings for the content
  • Implement vector similarity search (cosine similarity) within SQLite
  • Consider using SQLite extensions like sqlite-vss or implement a basic vector similarity calculation
  • Return results sorted by similarity score

Related Components

  • memory/stores/sqlite_ltm_store.py - Needs to be modified
  • memory/memory_system.py - May need updates for consistent interface

Acceptance Criteria

  • search_by_content() works with SQLite backend without errors
  • Relevant test cases are added
  • The memory retrieval demo runs successfully with content-based search
  • Performance is acceptable for reasonably sized memory stores

Additional Notes

This would complete the full feature parity between different storage backends and make the memory system more robust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions