Spaces:
Build error
Build error
Commit History
-
Fix CI: guard starlette imports, asyncio.run(), deprecate datetime.utcnow()
- Guard starlette imports in test_compress_api.py (skip ASGI tests without proxy deps) - Replace asyncio.get_event_loop().run_until_complete() with asyncio.run() (Python 3.13) - Replace datetime.utcnow() with datetime.now(timezone.utc).replace(tzinfo=None) everywhere5f8e891
-
Add centralized ML model configuration
- Create headroom/models/config.py as single source of truth for all ML model defaults - Support environment variable overrides (HEADROOM_SENTENCE_TRANSFORMER, etc.) - Update all components to use ML_MODEL_DEFAULTS instead of hardcoded values - Switch LLMLingua default to smaller bert-base model (~350MB vs 1GB) - Total memory footprint reduced from ~1.6GB to ~980MB Updated files: - MLModelRegistry now resolves defaults from config - EmbeddingScorer, LocalEmbedder, TrainedRouter use config - All dataclass configs use field(default_factory=...) for consistency - Tests updated to handle auto-selected vector backendscdde22e -
Add SQLite vector backend as default and fix HNSW test skipping
- Add VectorBackend.AUTO that prefers SQLITE_VEC if available, else HNSW - Add SQLiteVectorIndex configuration options (vector_db_path, vector_cache_size_kb) - Add update_embedding() method to SQLiteVectorIndex for VectorIndex protocol - Update factory to create SQLiteVectorIndex when appropriate - Skip HNSW-specific tests when hnswlib is not available (fixes CI on Python 3.12)3c1f81f -
Add SQLiteGraphStore for bounded, persistent graph storage
Replace unbounded InMemoryGraphStore with SQLite-backed implementation: - Persistent storage survives proxy restarts - Memory bounded by configurable SQLite page cache (default 8MB) - Same async interface as InMemoryGraphStore (drop-in replacement) - LocalBackend now uses SQLiteGraphStore by default (graph_persist=True) New files: - headroom/memory/adapters/sqlite_graph.py: SQLite graph store implementation - tests/test_sqlite_graph_store.py: 37 comprehensive tests Key features: - O(log n) lookups via database indexes - Case-insensitive entity name lookup per user - BFS subgraph traversal and shortest path finding - CASCADE delete for entity relationships - MemoryTracker integration via get_memory_stats()c1ef3d8
-
Add multi-provider memory system with auto-detection
- Add MemoryToolAdapter for unified memory across providers - Anthropic: Uses native memory tool (memory_20250818) for subscription safety - OpenAI/Gemini/Others: Uses function calling format - All providers share the same semantic vector store backend - Simplify CLI to single --memory flag with auto-detection - Add proper resource cleanup (close methods) to fix test isolation - Update README with memory documentation308f1f9
-
Fix mypy errors and add network timeout handler for flaky CI tests
Mypy fixes (no-any-return errors from external libraries): - litellm_pricing.py: cast litellm.model_cost - anthropic.py: cast litellm cost returns - cohere.py: cast litellm info/cost returns - compressor.py: explicit int() for PIL size calculations - sqlite.py: explicit bytes() for numpy tobytes() - universal.py: explicit str() for CCR store key - direct_mem0.py: explicit list() for OpenAI embedding - langchain/agents.py: explicit str() for result - server.py: explicit str() for httpx response.text - runner_v2/v3.py: add hasattr check for backend.close() Test fixes (flaky network timeouts in CI): - Add network_timeout_handler decorator to skip on httpx.ReadTimeout - Applied to test_close_idempotent, test_save_with_entities, test_add_batch_basic Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>7a63807 -
fix: resolve mypy type errors
- Add Transform type annotation for context_manager in proxy/server.py - Import Transform from headroom.transforms - Fix response.content[0].text access in judge.py with hasattr check - Add _neo4j_driver type annotation in direct_mem0.py0a19dd0
-
fix: improve error handling and add comprehensive test coverage
Bug fixes: - Replace bare except handlers with specific exception types and logging in proxy/server.py (6 instances for CCR, SSE parsing, cost tracking) - Fix session_id filtering security bug in memory/backends/local.py (sessions were not properly isolated in vector search) New tests (344 total): - test_ccr_batch_processor.py: 51 tests for batch result processing - test_compression_store.py: 76 tests for compression cache - test_log_compressor.py: 47 tests for log format detection/compression - test_search_compressor.py: 48 tests for grep output compression - test_integrations/langchain/: 122 tests for LangChain integration (agents, memory, retriever, streaming) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>0274139 -
fix: resolve mypy type errors across codebase
- Add type annotations for variables with inferred Any types - Add close() method to MemoryBackend protocol - Fix union type assignments in eval runners - Add explicit casts for return type mismatches - Fix None callable issues with assertions - Regenerate uv.lock to fix corrupted pillow dependency7de545c -
Add hierarchical memory system with graph + vector storage
Implement comprehensive memory system supporting: - Local backend (SQLite + FTS5 + HNSW) for zero-dependency operation - Mem0 backends (Neo4j + Qdrant) for production graph memory - DirectMem0Adapter for optimized pre-extracted data (bypasses LLM) - Memory extraction with facts, entities, and relationships - Proxy integration with --memory flag for automatic memory injection Key components: - headroom/memory/backends/: LocalBackend, Mem0Backend, DirectMem0Adapter - headroom/memory/system.py: MemorySystem with tool-based interface - headroom/memory/extraction.py: Entity and relationship extraction - headroom/proxy/memory_handler.py: Proxy integration layer - headroom/prediction/feature_extractor.py: Content analysis features Testing: - 217 new memory system tests covering all backends - LoCoMo evaluation framework for memory quality assessment - Integration tests for proxy memory functionality Also removes deprecated example files in favor of focused test coverage.eb1c19a