pub struct SurrealMemory { /* private fields */ }Implementations§
Source§impl SurrealMemory
impl SurrealMemory
pub async fn graph_upsert_node( &self, kind: &str, text: &str, confidence: f32, status: &str, ) -> Result<String>
pub async fn graph_link( &self, from_id: &str, to_id: &str, rel: &str, ) -> Result<()>
pub async fn graph_neighbors( &self, node_id: &str, limit: usize, ) -> Result<Vec<GraphNode>>
pub async fn graph_match_text( &self, query: &str, limit: usize, ) -> Result<Vec<GraphNode>>
Sourcepub async fn graph_dream_from_loops(
&self,
open_loops: &[String],
) -> Result<usize>
pub async fn graph_dream_from_loops( &self, open_loops: &[String], ) -> Result<usize>
Offline-style dream stub: link open-loop text to a low-confidence idea node.
pub fn format_graph_context(&self, nodes: &[GraphNode]) -> Option<String>
Trait Implementations§
Source§impl Clone for SurrealMemory
impl Clone for SurrealMemory
Source§fn clone(&self) -> SurrealMemory
fn clone(&self) -> SurrealMemory
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl MemoryBackend for SurrealMemory
impl MemoryBackend for SurrealMemory
Source§fn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
value: &'life3 str,
metadata: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
value: &'life3 str,
metadata: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store a key-value memory
Source§fn recall<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn recall<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Recall a specific memory by key
Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
query: &'life2 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
query: &'life2 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search memories by query (semantic or keyword)
Source§fn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete a memory
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all memories in a namespace
Source§fn store_conversation<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
sender_id: &'life2 str,
role: &'life3 str,
content: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn store_conversation<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
sender_id: &'life2 str,
role: &'life3 str,
content: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Store a conversation message
Source§fn store_conversation_batch<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
entries: &'life1 [(&'life2 str, &'life3 str, &'life4 str, &'life5 str)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn store_conversation_batch<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
entries: &'life1 [(&'life2 str, &'life3 str, &'life4 str, &'life5 str)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Store multiple conversation messages in one batch.
Source§fn get_conversation_history<'life0, 'life1, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_conversation_history<'life0, 'life1, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get recent conversation history (returns role, content pairs)
Source§fn clear_conversation<'life0, 'life1, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_conversation<'life0, 'life1, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete every stored message for one chat. Read more
fn search_conversations<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: usize,
chat_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConversationSearchHit>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn get_sticker_cache<'life0, 'life1, 'async_trait>(
&'life0 self,
sticker_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_sticker_cache<'life0, 'life1, 'async_trait>(
&'life0 self,
sticker_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get cached sticker description by ID
Source§fn store_sticker_cache<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sticker_id: &'life1 str,
file_id: &'life2 str,
description: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_sticker_cache<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sticker_id: &'life1 str,
file_id: &'life2 str,
description: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store sticker cache (sticker_id → description)
Source§fn store_embedding<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
vector: &'life3 [f32],
text: &'life4 str,
model: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn store_embedding<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
vector: &'life3 [f32],
text: &'life4 str,
model: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Store a vector embedding for a memory key Read more
Source§fn search_embeddings<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
query_vector: &'life2 [f32],
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search_embeddings<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
query_vector: &'life2 [f32],
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search embeddings by cosine similarity (returns nearest matches) Read more
Source§fn store_file_index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_file_index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record that a file has been indexed
Source§fn get_file_index<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<FileIndex>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_file_index<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<FileIndex>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file index entry (to check if re-indexing is needed)
Source§fn store_chunk<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
file_path: &'life1 str,
start_line: u32,
end_line: u32,
content: &'life2 str,
embedding: Option<&'life3 [f32]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_chunk<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
file_path: &'life1 str,
start_line: u32,
end_line: u32,
content: &'life2 str,
embedding: Option<&'life3 [f32]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store a code chunk with optional embedding
Auto Trait Implementations§
impl !RefUnwindSafe for SurrealMemory
impl !UnwindSafe for SurrealMemory
impl Freeze for SurrealMemory
impl Send for SurrealMemory
impl Sync for SurrealMemory
impl Unpin for SurrealMemory
impl UnsafeUnpin for SurrealMemory
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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