pub struct AgenticDB { /* private fields */ }Expand description
Main AgenticDB interface
Implementations§
Source§impl AgenticDB
impl AgenticDB
Sourcepub fn new(options: DbOptions) -> Result<Self>
pub fn new(options: DbOptions) -> Result<Self>
Create a new AgenticDB with the given options and default hash-based embeddings
Sourcepub fn with_embedding_provider(
options: DbOptions,
embedding_provider: BoxedEmbeddingProvider,
) -> Result<Self>
pub fn with_embedding_provider( options: DbOptions, embedding_provider: BoxedEmbeddingProvider, ) -> Result<Self>
Create a new AgenticDB with a custom embedding provider
§Example with API embeddings
use ruvector_core::{AgenticDB, ApiEmbedding};
use ruvector_core::types::DbOptions;
use std::sync::Arc;
let mut options = DbOptions::default();
options.dimensions = 1536; // OpenAI embedding dimensions
options.storage_path = "agenticdb.db".to_string();
let provider = Arc::new(ApiEmbedding::openai("sk-...", "text-embedding-3-small"));
let db = AgenticDB::with_embedding_provider(options, provider)?;§Example with Candle (requires feature flag)
use ruvector_core::{AgenticDB, CandleEmbedding};
use ruvector_core::types::DbOptions;
use std::sync::Arc;
let mut options = DbOptions::default();
options.dimensions = 384; // MiniLM dimensions
options.storage_path = "agenticdb.db".to_string();
let provider = Arc::new(CandleEmbedding::from_pretrained(
"sentence-transformers/all-MiniLM-L6-v2",
false
)?);
let db = AgenticDB::with_embedding_provider(options, provider)?;Sourcepub fn with_dimensions(dimensions: usize) -> Result<Self>
pub fn with_dimensions(dimensions: usize) -> Result<Self>
Create with default options and hash-based embeddings
Sourcepub fn embedding_provider_name(&self) -> &str
pub fn embedding_provider_name(&self) -> &str
Get the embedding provider name (for debugging/logging)
Sourcepub fn insert(&self, entry: VectorEntry) -> Result<VectorId>
pub fn insert(&self, entry: VectorEntry) -> Result<VectorId>
Insert a vector entry
Sourcepub fn insert_batch(&self, entries: Vec<VectorEntry>) -> Result<Vec<VectorId>>
pub fn insert_batch(&self, entries: Vec<VectorEntry>) -> Result<Vec<VectorId>>
Insert multiple vectors in a batch
Sourcepub fn search(&self, query: SearchQuery) -> Result<Vec<SearchResult>>
pub fn search(&self, query: SearchQuery) -> Result<Vec<SearchResult>>
Search for similar vectors
Sourcepub fn store_episode(
&self,
task: String,
actions: Vec<String>,
observations: Vec<String>,
critique: String,
) -> Result<String>
pub fn store_episode( &self, task: String, actions: Vec<String>, observations: Vec<String>, critique: String, ) -> Result<String>
Store a reflexion episode with self-critique
Sourcepub fn retrieve_similar_episodes(
&self,
query: &str,
k: usize,
) -> Result<Vec<ReflexionEpisode>>
pub fn retrieve_similar_episodes( &self, query: &str, k: usize, ) -> Result<Vec<ReflexionEpisode>>
Retrieve similar reflexion episodes
Sourcepub fn create_skill(
&self,
name: String,
description: String,
parameters: HashMap<String, String>,
examples: Vec<String>,
) -> Result<String>
pub fn create_skill( &self, name: String, description: String, parameters: HashMap<String, String>, examples: Vec<String>, ) -> Result<String>
Create a new skill in the library
Sourcepub fn search_skills(
&self,
query_description: &str,
k: usize,
) -> Result<Vec<Skill>>
pub fn search_skills( &self, query_description: &str, k: usize, ) -> Result<Vec<Skill>>
Search skills by description
Sourcepub fn auto_consolidate(
&self,
action_sequences: Vec<Vec<String>>,
success_threshold: usize,
) -> Result<Vec<String>>
pub fn auto_consolidate( &self, action_sequences: Vec<Vec<String>>, success_threshold: usize, ) -> Result<Vec<String>>
Auto-consolidate action sequences into skills
Sourcepub fn add_causal_edge(
&self,
causes: Vec<String>,
effects: Vec<String>,
confidence: f64,
context: String,
) -> Result<String>
pub fn add_causal_edge( &self, causes: Vec<String>, effects: Vec<String>, confidence: f64, context: String, ) -> Result<String>
Add a causal edge (supporting hypergraphs with multiple causes/effects)
Sourcepub fn query_with_utility(
&self,
query: &str,
k: usize,
alpha: f64,
beta: f64,
gamma: f64,
) -> Result<Vec<UtilitySearchResult>>
pub fn query_with_utility( &self, query: &str, k: usize, alpha: f64, beta: f64, gamma: f64, ) -> Result<Vec<UtilitySearchResult>>
Query with utility function: U = α·similarity + β·causal_uplift − γ·latency
Sourcepub fn start_session(
&self,
algorithm: String,
state_dim: usize,
action_dim: usize,
) -> Result<String>
pub fn start_session( &self, algorithm: String, state_dim: usize, action_dim: usize, ) -> Result<String>
Start a new learning session
Sourcepub fn add_experience(
&self,
session_id: &str,
state: Vec<f32>,
action: Vec<f32>,
reward: f64,
next_state: Vec<f32>,
done: bool,
) -> Result<()>
pub fn add_experience( &self, session_id: &str, state: Vec<f32>, action: Vec<f32>, reward: f64, next_state: Vec<f32>, done: bool, ) -> Result<()>
Add an experience to a learning session
Sourcepub fn predict_with_confidence(
&self,
session_id: &str,
state: Vec<f32>,
) -> Result<Prediction>
pub fn predict_with_confidence( &self, session_id: &str, state: Vec<f32>, ) -> Result<Prediction>
Predict action with confidence interval
Sourcepub fn get_session(&self, session_id: &str) -> Result<Option<LearningSession>>
pub fn get_session(&self, session_id: &str) -> Result<Option<LearningSession>>
Get learning session by ID
Auto Trait Implementations§
impl Freeze for AgenticDB
impl !RefUnwindSafe for AgenticDB
impl Send for AgenticDB
impl Sync for AgenticDB
impl Unpin for AgenticDB
impl !UnwindSafe for AgenticDB
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> 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>
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