Build a new `MemoryService` from the provided configuration. This creates the SQLite store, vector index, embedding service, and LLM processor, then loads any existing memories into the vector index.
(config: MemoryConfig)
| 32 | /// This creates the SQLite store, vector index, embedding service, and |
| 33 | /// LLM processor, then loads any existing memories into the vector index. |
| 34 | pub async fn new(config: MemoryConfig) -> GraphBitResult<Self> { |
| 35 | let store = MetadataStore::new(&config.db_path)?; |
| 36 | let vector_index = VectorIndex::new(); |
| 37 | let embedding_service = EmbeddingService::new(config.embedding_config.clone())?; |
| 38 | let llm_provider = LlmProviderFactory::create_provider(config.llm_config.clone())?; |
| 39 | let processor = MemoryProcessor::new( |
| 40 | llm_provider, |
| 41 | config.max_extraction_tokens, |
| 42 | config.extraction_temperature, |
| 43 | ); |
| 44 | |
| 45 | let service = Self { |
| 46 | store, |
| 47 | vector_index, |
| 48 | embedding_service, |
| 49 | processor, |
| 50 | config, |
| 51 | }; |
| 52 | |
| 53 | // Load existing memories into the vector index. |
| 54 | service.load_existing_memories().await?; |
| 55 | |
| 56 | Ok(service) |
| 57 | } |
| 58 | |
| 59 | /// Extract facts from `messages`, embed them, decide actions against |
| 60 | /// existing memories, and persist the results. Returns newly created |
nothing calls this directly
no test coverage detected