pub struct KnowledgeBase { /* private fields */ }Expand description
A self-learning knowledge base powered by ruvector.
Implementations§
Source§impl KnowledgeBase
impl KnowledgeBase
Sourcepub async fn open(path: impl AsRef<Path>) -> Result<Self>
pub async fn open(path: impl AsRef<Path>) -> Result<Self>
Open or create a knowledge base at the given path.
Sourcepub async fn with_config(config: KnowledgeBaseConfig) -> Result<Self>
pub async fn with_config(config: KnowledgeBaseConfig) -> Result<Self>
Create a knowledge base with custom configuration.
Sourcepub fn config(&self) -> &KnowledgeBaseConfig
pub fn config(&self) -> &KnowledgeBaseConfig
Get configuration.
Sourcepub async fn add_entry(&self, entry: KnowledgeEntry) -> Result<Uuid>
pub async fn add_entry(&self, entry: KnowledgeEntry) -> Result<Uuid>
Add a new knowledge entry.
Sourcepub async fn add_entries(
&self,
entries: Vec<KnowledgeEntry>,
) -> Result<Vec<Uuid>>
pub async fn add_entries( &self, entries: Vec<KnowledgeEntry>, ) -> Result<Vec<Uuid>>
Add multiple entries in batch.
Sourcepub fn get(&self, id: Uuid) -> Option<KnowledgeEntry>
pub fn get(&self, id: Uuid) -> Option<KnowledgeEntry>
Get an entry by ID.
Sourcepub async fn update_entry(&self, entry: KnowledgeEntry) -> Result<()>
pub async fn update_entry(&self, entry: KnowledgeEntry) -> Result<()>
Update an existing entry.
Sourcepub async fn delete_entry(&self, id: Uuid) -> Result<()>
pub async fn delete_entry(&self, id: Uuid) -> Result<()>
Delete an entry.
Sourcepub async fn search(
&self,
query: &str,
options: SearchOptions,
) -> Result<Vec<SearchResult>>
pub async fn search( &self, query: &str, options: SearchOptions, ) -> Result<Vec<SearchResult>>
Search the knowledge base.
Sourcepub async fn search_simple(
&self,
query: &str,
limit: usize,
) -> Result<Vec<SearchResult>>
pub async fn search_simple( &self, query: &str, limit: usize, ) -> Result<Vec<SearchResult>>
Simple search with default options.
Sourcepub async fn record_feedback(
&self,
entry_id: Uuid,
positive: bool,
) -> Result<()>
pub async fn record_feedback( &self, entry_id: Uuid, positive: bool, ) -> Result<()>
Record user feedback on a search result.
Get entries related to a given entry.
Sourcepub async fn link_entries(&self, id1: Uuid, id2: Uuid) -> Result<()>
pub async fn link_entries(&self, id1: Uuid, id2: Uuid) -> Result<()>
Link two entries as related.
Sourcepub fn all_entries(&self) -> Vec<KnowledgeEntry>
pub fn all_entries(&self) -> Vec<KnowledgeEntry>
Get all entries (for export/backup).
Auto Trait Implementations§
impl Freeze for KnowledgeBase
impl !RefUnwindSafe for KnowledgeBase
impl Send for KnowledgeBase
impl Sync for KnowledgeBase
impl Unpin for KnowledgeBase
impl UnsafeUnpin for KnowledgeBase
impl !UnwindSafe for KnowledgeBase
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request