pub struct VectorStorage {
pub embedder: Arc<TextEmbedding>,
pub db: Connection,
pub index: Index,
}Expand description
The pure-Rust vector storage engine combining SQLite metadata and usearch HNSW index.
Fields§
§embedder: Arc<TextEmbedding>§db: Connection§index: IndexImplementations§
Source§impl VectorStorage
impl VectorStorage
pub fn new( db_path: impl AsRef<Path>, index_path: impl AsRef<Path>, ) -> Result<Self>
pub fn new_with_embedder( db_path: impl AsRef<Path>, index_path: impl AsRef<Path>, embedder: Arc<TextEmbedding>, ) -> Result<Self>
pub fn add_memory( &mut self, text: &str, wing: &str, room: &str, source_file: Option<&str>, source_mtime: Option<f64>, ) -> Result<i64>
pub fn get_source_mtime(&self, source_file: &str) -> Result<Option<f64>>
pub fn search_room( &self, query: &str, wing: &str, room: &str, limit: usize, at_time: Option<i64>, ) -> Result<Vec<MemoryRecord>>
pub fn search(&self, query: &str, limit: usize) -> Result<Vec<MemoryRecord>>
pub fn get_memories( &self, wing: Option<&str>, room: Option<&str>, limit: usize, ) -> Result<Vec<MemoryRecord>>
pub fn get_all_ids(&self, wing: Option<&str>) -> Result<Vec<i64>>
pub fn get_memory_by_id(&self, id: i64) -> Result<MemoryRecord>
pub fn update_memory_summary(&self, id: i64, new_summary: &str) -> Result<()>
pub fn touch_memory(&self, id: i64) -> Result<()>
pub fn delete_memory(&self, id: i64) -> Result<()>
pub fn has_source_file(&self, source_file: &str) -> Result<bool>
pub fn get_wings_rooms(&self) -> Result<Vec<(String, String)>>
pub fn save_index(&self, index_path: impl AsRef<Path>) -> Result<()>
pub fn memory_count(&self) -> Result<u64>
pub fn index_size(&self) -> usize
pub fn embed_single(&self, text: &str) -> Result<Vec<f32>>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for VectorStorage
impl !RefUnwindSafe for VectorStorage
impl Send for VectorStorage
impl !Sync for VectorStorage
impl Unpin for VectorStorage
impl UnsafeUnpin for VectorStorage
impl !UnwindSafe for VectorStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more