pub struct MemoryServiceAdapter { /* private fields */ }Available on crate feature
memory only.Expand description
Adapts any MemoryService into an adk_core::Memory implementation.
Binds app_name and user_id at construction so the runner’s
search(query: &str) calls are forwarded with full context.
Implementations§
Source§impl MemoryServiceAdapter
impl MemoryServiceAdapter
Sourcepub fn new(
inner: Arc<dyn MemoryService>,
app_name: impl Into<String>,
user_id: impl Into<String>,
) -> MemoryServiceAdapter
pub fn new( inner: Arc<dyn MemoryService>, app_name: impl Into<String>, user_id: impl Into<String>, ) -> MemoryServiceAdapter
Create a new adapter binding a memory service to a specific app and user.
Sourcepub fn with_project_id(
self,
project_id: impl Into<String>,
) -> MemoryServiceAdapter
pub fn with_project_id( self, project_id: impl Into<String>, ) -> MemoryServiceAdapter
Bind this adapter to a specific project scope.
When set, search includes project entries, and add/delete
operate within the project scope.
Trait Implementations§
Source§impl Memory for MemoryServiceAdapter
impl Memory for MemoryServiceAdapter
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryServiceAdapter: 'async_trait,
Source§fn add<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryServiceAdapter: 'async_trait,
fn add<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryServiceAdapter: 'async_trait,
Add a single memory entry. Read more
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryServiceAdapter: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryServiceAdapter: 'async_trait,
Delete entries matching a query. Returns count of deleted entries. Read more
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryServiceAdapter: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryServiceAdapter: 'async_trait,
Verify backend connectivity. Read more
Source§fn search_in_project<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
project_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryServiceAdapter: 'async_trait,
fn search_in_project<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
project_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
MemoryServiceAdapter: 'async_trait,
Search for memories within a specific project.
Returns global entries + entries for the given project.
Default delegates to
search (global-only results).Source§fn add_to_project<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
project_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryServiceAdapter: 'async_trait,
fn add_to_project<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
project_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryServiceAdapter: 'async_trait,
Add a memory entry scoped to a specific project.
Default delegates to
add (global entry).Auto Trait Implementations§
impl Freeze for MemoryServiceAdapter
impl !RefUnwindSafe for MemoryServiceAdapter
impl Send for MemoryServiceAdapter
impl Sync for MemoryServiceAdapter
impl Unpin for MemoryServiceAdapter
impl UnsafeUnpin for MemoryServiceAdapter
impl !UnwindSafe for MemoryServiceAdapter
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