pub struct AgentDB { /* private fields */ }Expand description
Main AgentDB interface providing vector storage, reflexion, causal, and skill management
Implementations§
Source§impl AgentDB
impl AgentDB
Sourcepub async fn new(config: AgentDBConfig) -> Result<Self, AgentDBError>
pub async fn new(config: AgentDBConfig) -> Result<Self, AgentDBError>
Creates a new AgentDB instance with the given configuration
Sourcepub async fn vector_store(
&self,
embedding: Embedding,
metadata: Value,
) -> Result<VectorId, AgentDBError>
pub async fn vector_store( &self, embedding: Embedding, metadata: Value, ) -> Result<VectorId, AgentDBError>
Stores a vector embedding with associated metadata
Sourcepub async fn vector_search(
&self,
query: &Embedding,
k: usize,
) -> Result<Vec<VectorResult>, AgentDBError>
pub async fn vector_search( &self, query: &Embedding, k: usize, ) -> Result<Vec<VectorResult>, AgentDBError>
Searches for the k most similar vectors using HNSW index
Sourcepub async fn vector_get(
&self,
id: &str,
) -> Result<(Embedding, Value), AgentDBError>
pub async fn vector_get( &self, id: &str, ) -> Result<(Embedding, Value), AgentDBError>
Retrieves a specific vector by ID
Sourcepub async fn vector_delete(&self, id: &str) -> Result<(), AgentDBError>
pub async fn vector_delete(&self, id: &str) -> Result<(), AgentDBError>
Deletes a vector by ID
Sourcepub async fn reflexion_store(
&self,
episode: ReflexionEpisode,
) -> Result<ReflexionId, AgentDBError>
pub async fn reflexion_store( &self, episode: ReflexionEpisode, ) -> Result<ReflexionId, AgentDBError>
Stores a reflexion episode for learning from experience
Sourcepub async fn reflexion_retrieve(
&self,
task: &str,
limit: usize,
) -> Result<Vec<ReflexionEpisode>, AgentDBError>
pub async fn reflexion_retrieve( &self, task: &str, limit: usize, ) -> Result<Vec<ReflexionEpisode>, AgentDBError>
Retrieves similar reflexion episodes for a given task
Sourcepub async fn reflexion_by_session(
&self,
session_id: &str,
) -> Result<Vec<ReflexionEpisode>, AgentDBError>
pub async fn reflexion_by_session( &self, session_id: &str, ) -> Result<Vec<ReflexionEpisode>, AgentDBError>
Retrieves reflexion episodes by session ID
Sourcepub async fn reflexion_analyze(
&self,
task_prefix: &str,
) -> Result<ReflexionStats, AgentDBError>
pub async fn reflexion_analyze( &self, task_prefix: &str, ) -> Result<ReflexionStats, AgentDBError>
Analyzes reflexion episodes to calculate success metrics
Sourcepub async fn causal_add_edge(
&self,
edge: CausalEdge,
) -> Result<(), AgentDBError>
pub async fn causal_add_edge( &self, edge: CausalEdge, ) -> Result<(), AgentDBError>
Adds or updates a causal edge
Sourcepub async fn causal_query_effects(
&self,
cause: &str,
) -> Result<Vec<CausalEdge>, AgentDBError>
pub async fn causal_query_effects( &self, cause: &str, ) -> Result<Vec<CausalEdge>, AgentDBError>
Queries effects caused by a specific cause
Sourcepub async fn causal_query_causes(
&self,
effect: &str,
) -> Result<Vec<CausalEdge>, AgentDBError>
pub async fn causal_query_causes( &self, effect: &str, ) -> Result<Vec<CausalEdge>, AgentDBError>
Queries causes that lead to a specific effect
Sourcepub async fn causal_find_path(
&self,
start: &str,
end: &str,
max_depth: usize,
) -> Result<Vec<Vec<String>>, AgentDBError>
pub async fn causal_find_path( &self, start: &str, end: &str, max_depth: usize, ) -> Result<Vec<Vec<String>>, AgentDBError>
Finds causal paths between a cause and effect
Sourcepub async fn skill_create(&self, skill: Skill) -> Result<SkillId, AgentDBError>
pub async fn skill_create(&self, skill: Skill) -> Result<SkillId, AgentDBError>
Creates a new skill with embedding
Sourcepub async fn skill_search(
&self,
query: &str,
limit: usize,
) -> Result<Vec<Skill>, AgentDBError>
pub async fn skill_search( &self, query: &str, limit: usize, ) -> Result<Vec<Skill>, AgentDBError>
Searches for skills using semantic similarity
Sourcepub async fn skill_search_by_embedding(
&self,
query_embedding: &Embedding,
limit: usize,
) -> Result<Vec<(Skill, f64)>, AgentDBError>
pub async fn skill_search_by_embedding( &self, query_embedding: &Embedding, limit: usize, ) -> Result<Vec<(Skill, f64)>, AgentDBError>
Searches for skills using embedding similarity
Sourcepub async fn skill_update_stats(
&self,
skill_id: &str,
success: bool,
) -> Result<(), AgentDBError>
pub async fn skill_update_stats( &self, skill_id: &str, success: bool, ) -> Result<(), AgentDBError>
Updates skill usage statistics
Sourcepub async fn skill_get(&self, skill_id: &str) -> Result<Skill, AgentDBError>
pub async fn skill_get(&self, skill_id: &str) -> Result<Skill, AgentDBError>
Gets a skill by ID
Sourcepub async fn stats(&self) -> AgentDBStats
pub async fn stats(&self) -> AgentDBStats
Returns statistics about the database
Sourcepub async fn clear(&self) -> Result<(), AgentDBError>
pub async fn clear(&self) -> Result<(), AgentDBError>
Clears all data from the database
Auto Trait Implementations§
impl Freeze for AgentDB
impl !RefUnwindSafe for AgentDB
impl Send for AgentDB
impl Sync for AgentDB
impl Unpin for AgentDB
impl !UnwindSafe for AgentDB
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
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>
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>
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