Module memory_interface

Module memory_interface 

Source
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§

ContextConfig
Configuration for context retrieval
ContextQuality
Quality metrics for a context window
ContextWindow
A context window retrieved from memory
IndexStats
Index statistics from indexing operations
MemoryError
Error type for memory interface operations
MemoryStats
Statistics about memory service state

Enums§

ErrorCategory
Error categories for memory operations
MatchSourceNon-memory

Traits§

MemoryService
Main trait for memory service operations

Type Aliases§

ChunkNon-memory
DocumentNon-memory
DocumentContentNon-memory
DocumentTypeNon-memory
MemoryResult
Result type for memory interface operations
MetadataNon-memory
ProcessingStateNon-memory
ProcessingStatusNon-memory
RetrievalConfigNon-memory
SearchResultNon-memory
SourceNon-memory
SourceTypeNon-memory