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>
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""Compare old keyword search vs new hybrid search."""
|
|
|
|
from memory_system import MemorySystem
|
|
|
|
print("Initializing memory system...")
|
|
memory = MemorySystem()
|
|
|
|
print("\n" + "="*70)
|
|
print("KEYWORD vs HYBRID SEARCH COMPARISON")
|
|
print("="*70)
|
|
|
|
# Test queries that benefit from semantic understanding
|
|
test_queries = [
|
|
("How do I reduce costs?", "Testing semantic understanding of 'reduce costs' -> 'cost optimization'"),
|
|
("when was I born", "Testing semantic match for birthday/birth date"),
|
|
("what database do we use", "Testing keyword match for 'SQLite'"),
|
|
("vector similarity", "Testing technical term matching"),
|
|
]
|
|
|
|
for query, description in test_queries:
|
|
print(f"\n{description}")
|
|
print(f"Query: '{query}'")
|
|
print("-" * 70)
|
|
|
|
# Keyword-only search
|
|
print("\n KEYWORD SEARCH (old):")
|
|
keyword_results = memory.search(query, max_results=2)
|
|
if keyword_results:
|
|
for i, r in enumerate(keyword_results, 1):
|
|
print(f" {i}. {r['path']}:{r['start_line']} (score: {r['score']:.3f})")
|
|
print(f" {r['snippet'][:80]}...")
|
|
else:
|
|
print(" No results found!")
|
|
|
|
# Hybrid search
|
|
print("\n HYBRID SEARCH (new):")
|
|
hybrid_results = memory.search_hybrid(query, max_results=2)
|
|
if hybrid_results:
|
|
for i, r in enumerate(hybrid_results, 1):
|
|
print(f" {i}. {r['path']}:{r['start_line']} (score: {r['score']:.3f})")
|
|
print(f" {r['snippet'][:80]}...")
|
|
else:
|
|
print(" No results found!")
|
|
|
|
print()
|
|
|
|
print("\n" + "="*70)
|
|
print(f"[OK] Hybrid search loaded with {len(memory.vector_index)} vector embeddings")
|
|
print(f"[OK] Vector index: {memory.vector_index_path}")
|
|
print(f"[OK] Database: {memory.db_path}")
|
|
print("="*70)
|
|
|
|
memory.close()
|