This commit removes deprecated modules and reorganizes code into logical directories: Deleted files (superseded by newer systems): - claude_code_server.py (replaced by agent-sdk direct integration) - heartbeat.py (superseded by scheduled_tasks.py) - pulse_brain.py (unused in production) - config/pulse_brain_config.py (obsolete config) Created directory structure: - examples/ (7 example files: example_*.py, demo_*.py) - tests/ (5 test files: test_*.py) Updated imports: - agent.py: Removed heartbeat module and all enable_heartbeat logic - bot_runner.py: Removed heartbeat parameter from Agent initialization - llm_interface.py: Updated deprecated claude_code_server message Preserved essential files: - hooks.py (for future use) - adapters/skill_integration.py (for future use) - All Google integration tools (Gmail, Calendar, Contacts) - GLM provider code (backward compatibility) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
"""Test hybrid search implementation."""
|
|
|
|
from memory_system import MemorySystem
|
|
|
|
print("Initializing memory system with hybrid search...")
|
|
memory = MemorySystem()
|
|
|
|
print("\nRe-syncing all memories to generate embeddings...")
|
|
# Force re-index by clearing the database
|
|
memory.db.execute("DELETE FROM chunks")
|
|
memory.db.execute("DELETE FROM chunks_fts")
|
|
memory.db.execute("DELETE FROM files")
|
|
memory.db.commit()
|
|
|
|
# Re-sync to generate embeddings
|
|
memory.sync()
|
|
|
|
print("\n" + "="*60)
|
|
print("TESTING HYBRID SEARCH")
|
|
print("="*60)
|
|
|
|
# Test 1: Semantic search (should work even with different wording)
|
|
print("\n1. Testing semantic search for 'when was I born' (looking for birthday):")
|
|
results = memory.search_hybrid("when was I born", max_results=3)
|
|
for i, result in enumerate(results, 1):
|
|
print(f"\n Result {i} (score: {result['score']:.3f}):")
|
|
print(f" {result['path']}:{result['start_line']}-{result['end_line']}")
|
|
print(f" {result['snippet'][:100]}...")
|
|
|
|
# Test 2: Technical keyword search
|
|
print("\n2. Testing keyword search for 'SQLite FTS5':")
|
|
results = memory.search_hybrid("SQLite FTS5", max_results=3)
|
|
for i, result in enumerate(results, 1):
|
|
print(f"\n Result {i} (score: {result['score']:.3f}):")
|
|
print(f" {result['path']}:{result['start_line']}-{result['end_line']}")
|
|
print(f" {result['snippet'][:100]}...")
|
|
|
|
# Test 3: Conceptual search
|
|
print("\n3. Testing conceptual search for 'cost optimization':")
|
|
results = memory.search_hybrid("cost optimization", max_results=3)
|
|
for i, result in enumerate(results, 1):
|
|
print(f"\n Result {i} (score: {result['score']:.3f}):")
|
|
print(f" {result['path']}:{result['start_line']}-{result['end_line']}")
|
|
print(f" {result['snippet'][:100]}...")
|
|
|
|
print("\n" + "="*60)
|
|
print(f"Vector index size: {len(memory.vector_index)} embeddings")
|
|
print("="*60)
|
|
|
|
memory.close()
|
|
print("\nTest complete!")
|