pub struct KnowledgeEntry {
pub id: Uuid,
pub title: String,
pub content: String,
pub category: Option<String>,
pub tags: Vec<String>,
pub source: Option<String>,
pub metadata: Metadata,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub access_count: u64,
pub learned_relevance: f32,
pub related_entries: Vec<Uuid>,
}Expand description
A single entry in the knowledge base.
Fields§
§id: UuidUnique identifier for the entry.
title: StringTitle or short summary.
content: StringFull content of the entry.
category: Option<String>Category or type classification.
Tags for categorization.
source: Option<String>Source URL or reference.
metadata: MetadataCustom metadata.
created_at: DateTime<Utc>Creation timestamp.
updated_at: DateTime<Utc>Last update timestamp.
access_count: u64Access count for learning.
learned_relevance: f32Relevance score from learning.
Related entry IDs (knowledge graph).
Implementations§
Source§impl KnowledgeEntry
impl KnowledgeEntry
Sourcepub fn new(title: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(title: impl Into<String>, content: impl Into<String>) -> Self
Create a new knowledge entry.
Sourcepub fn with_category(self, category: impl Into<String>) -> Self
pub fn with_category(self, category: impl Into<String>) -> Self
Set the category.
Add tags.
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set the source.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata.
Add a related entry.
Sourcepub fn embedding_text(&self) -> String
pub fn embedding_text(&self) -> String
Get the combined text for embedding.
Sourcepub fn record_access(&mut self, relevance_boost: f32)
pub fn record_access(&mut self, relevance_boost: f32)
Record an access and update relevance.
Trait Implementations§
Source§impl Clone for KnowledgeEntry
impl Clone for KnowledgeEntry
Source§fn clone(&self) -> KnowledgeEntry
fn clone(&self) -> KnowledgeEntry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KnowledgeEntry
impl Debug for KnowledgeEntry
Source§impl<'de> Deserialize<'de> for KnowledgeEntry
impl<'de> Deserialize<'de> for KnowledgeEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for KnowledgeEntry
impl RefUnwindSafe for KnowledgeEntry
impl Send for KnowledgeEntry
impl Sync for KnowledgeEntry
impl Unpin for KnowledgeEntry
impl UnsafeUnpin for KnowledgeEntry
impl UnwindSafe for KnowledgeEntry
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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