pub struct KnowledgeItem {
pub id: String,
pub name: String,
pub description: String,
pub triggers: Vec<String>,
pub category: String,
pub core_content: String,
pub references: Vec<KnowledgeReference>,
pub metadata: HashMap<String, String>,
pub enabled: bool,
pub priority: u32,
}Expand description
A knowledge item represents a specialized area of expertise that can be loaded on-demand to provide context to the agent.
Fields§
§id: StringUnique identifier for this knowledge item
name: StringHuman-readable name
description: StringBrief description with trigger keywords
triggers: Vec<String>Keywords that trigger this knowledge item
category: StringCategory for organization (e.g., “language”, “framework”, “tool”)
core_content: StringCore content (lean, ~80 lines max)
references: Vec<KnowledgeReference>Reference files that can be loaded on-demand
metadata: HashMap<String, String>Metadata for filtering and search
enabled: boolWhether this knowledge is enabled
priority: u32Priority for conflict resolution (higher = more important)
Implementations§
Source§impl KnowledgeItem
impl KnowledgeItem
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
description: impl Into<String>,
) -> KnowledgeItem
pub fn new( id: impl Into<String>, name: impl Into<String>, description: impl Into<String>, ) -> KnowledgeItem
Create a new knowledge item with minimal required fields
Sourcepub fn with_trigger(self, trigger: impl Into<String>) -> KnowledgeItem
pub fn with_trigger(self, trigger: impl Into<String>) -> KnowledgeItem
Add a trigger keyword
Sourcepub fn with_triggers(
self,
triggers: impl IntoIterator<Item = impl Into<String>>,
) -> KnowledgeItem
pub fn with_triggers( self, triggers: impl IntoIterator<Item = impl Into<String>>, ) -> KnowledgeItem
Add multiple trigger keywords
Sourcepub fn with_category(self, category: impl Into<String>) -> KnowledgeItem
pub fn with_category(self, category: impl Into<String>) -> KnowledgeItem
Set the category
Sourcepub fn with_content(self, content: impl Into<String>) -> KnowledgeItem
pub fn with_content(self, content: impl Into<String>) -> KnowledgeItem
Set the core content
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> KnowledgeItem
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> KnowledgeItem
Set a metadata key/value pair (used for attribution, source tracking, filtering, etc.)
Sourcepub fn with_enabled(self, enabled: bool) -> KnowledgeItem
pub fn with_enabled(self, enabled: bool) -> KnowledgeItem
Set whether this item is enabled (note: session-scoped enablement is handled separately).
Sourcepub fn with_priority(self, priority: u32) -> KnowledgeItem
pub fn with_priority(self, priority: u32) -> KnowledgeItem
Set priority for conflict resolution (higher = more important)
Sourcepub fn with_reference(self, reference: KnowledgeReference) -> KnowledgeItem
pub fn with_reference(self, reference: KnowledgeReference) -> KnowledgeItem
Add a reference
Sourcepub fn matches(&self, query: &str) -> Option<KnowledgeMatch>
pub fn matches(&self, query: &str) -> Option<KnowledgeMatch>
Check if this knowledge item matches a query
Trait Implementations§
Source§impl Clone for KnowledgeItem
impl Clone for KnowledgeItem
Source§fn clone(&self) -> KnowledgeItem
fn clone(&self) -> KnowledgeItem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KnowledgeItem
impl Debug for KnowledgeItem
Source§impl<'de> Deserialize<'de> for KnowledgeItem
impl<'de> Deserialize<'de> for KnowledgeItem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<KnowledgeItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<KnowledgeItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for KnowledgeItem
impl Serialize for KnowledgeItem
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for KnowledgeItem
impl RefUnwindSafe for KnowledgeItem
impl Send for KnowledgeItem
impl Sync for KnowledgeItem
impl Unpin for KnowledgeItem
impl UnwindSafe for KnowledgeItem
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].