Expand description
Memory interface trait for reasonkit-mem integration.
Defines how reasonkit-core communicates with the reasonkit-mem crate for storage, retrieval, and embedding operations. Memory Interface Trait
This module defines the trait that reasonkit-core uses to interface with reasonkit-mem. It provides a clean abstraction for document storage, retrieval, and context assembly.
§Design Principles
- Async-first: All operations are async (tokio runtime required)
- Result-oriented: All operations return
Result<T>with structured error handling - Trait-based: Allows multiple implementations (in-memory, Qdrant, file-based, etc.)
- Batch-friendly: Supports operations on multiple documents/queries
§Usage Example
ⓘ
use reasonkit::memory_interface::MemoryService;
use reasonkit_mem::Document;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Get memory service implementation (from reasonkit-mem)
let memory = create_memory_service().await?;
// Store a document
memory.store_document(doc).await?;
// Search for related content
let results = memory.search("query text", 10).await?;
// Get context for reasoning
let context = memory.get_context("query", 5).await?;
Ok(())
}Structs§
- Context
Config - Configuration for context retrieval
- Context
Quality - Quality metrics for a context window
- Context
Window - A context window retrieved from memory
- Index
Stats - Index statistics from indexing operations
- Memory
Error - Error type for memory interface operations
- Memory
Stats - Statistics about memory service state
Enums§
- Error
Category - Error categories for memory operations
- Match
Source Non- memory
Traits§
- Memory
Service - Main trait for memory service operations
Type Aliases§
- Chunk
Non- memory - Document
Non- memory - Document
Content Non- memory - Document
Type Non- memory - Memory
Result - Result type for memory interface operations
- Metadata
Non- memory - Processing
State Non- memory - Processing
Status Non- memory - Retrieval
Config Non- memory - Search
Result Non- memory - Source
Non- memory - Source
Type Non- memory