pub struct ThoughtQuery {Show 13 fields
pub thought_types: Option<Vec<ThoughtType>>,
pub roles: Option<Vec<ThoughtRole>>,
pub agent_ids: Option<Vec<String>>,
pub agent_names: Option<Vec<String>>,
pub agent_owners: Option<Vec<String>>,
pub tags_any: Vec<String>,
pub concepts_any: Vec<String>,
pub text_contains: Option<String>,
pub min_importance: Option<f32>,
pub min_confidence: Option<f32>,
pub since: Option<DateTime<Utc>>,
pub until: Option<DateTime<Utc>>,
pub limit: Option<usize>,
}Expand description
Retrieval filter for semantic memory queries.
ThoughtQuery lets callers ask for slices of memory without replaying the
entire chain.
ThoughtQuery is read-only. It does not create or modify thoughts. Its job
is to select already-committed Thought records by semantic type,
operational role, agent identity, tags, concepts, text, confidence,
importance, and time range.
The relationship between the three main data shapes is:
ThoughtInput: proposed memory to appendThought: committed durable memoryThoughtQuery: retrieval filter over committed memory
§Example
use thoughtchain::{ThoughtQuery, ThoughtType};
let query = ThoughtQuery::new()
.with_types(vec![ThoughtType::Decision, ThoughtType::Constraint])
.with_min_importance(0.8);
assert!(query.min_importance.is_some());Fields§
§thought_types: Option<Vec<ThoughtType>>Semantic thought types to match.
roles: Option<Vec<ThoughtRole>>Operational roles to match.
agent_ids: Option<Vec<String>>Agent ids to match.
agent_names: Option<Vec<String>>Agent names to match.
agent_owners: Option<Vec<String>>Agent owners to match.
Match if any tag matches.
concepts_any: Vec<String>Match if any concept matches.
text_contains: Option<String>Text filter applied to content, tags, and concepts.
min_importance: Option<f32>Minimum importance threshold.
min_confidence: Option<f32>Minimum confidence threshold.
since: Option<DateTime<Utc>>Start of the timestamp window, inclusive.
until: Option<DateTime<Utc>>End of the timestamp window, inclusive.
limit: Option<usize>Maximum number of thoughts to return.
Implementations§
Source§impl ThoughtQuery
impl ThoughtQuery
Sourcepub fn with_types(self, thought_types: Vec<ThoughtType>) -> Self
pub fn with_types(self, thought_types: Vec<ThoughtType>) -> Self
Limit matches to the provided semantic thought types.
Sourcepub fn with_roles(self, roles: Vec<ThoughtRole>) -> Self
pub fn with_roles(self, roles: Vec<ThoughtRole>) -> Self
Limit matches to the provided thought roles.
Sourcepub fn with_agent_ids<I, S>(self, agent_ids: I) -> Self
pub fn with_agent_ids<I, S>(self, agent_ids: I) -> Self
Limit matches to the provided agent identifiers.
Sourcepub fn with_agent_names<I, S>(self, agent_names: I) -> Self
pub fn with_agent_names<I, S>(self, agent_names: I) -> Self
Limit matches to the provided agent names.
Sourcepub fn with_agent_owners<I, S>(self, agent_owners: I) -> Self
pub fn with_agent_owners<I, S>(self, agent_owners: I) -> Self
Limit matches to the provided agent owner labels.
Match thoughts that have at least one of the provided tags.
Sourcepub fn with_concepts_any<I, S>(self, concepts: I) -> Self
pub fn with_concepts_any<I, S>(self, concepts: I) -> Self
Match thoughts that have at least one of the provided concepts.
Sourcepub fn with_text(self, text: impl Into<String>) -> Self
pub fn with_text(self, text: impl Into<String>) -> Self
Match thoughts whose content, tags, or concepts contain the provided text.
Sourcepub fn with_min_importance(self, importance: f32) -> Self
pub fn with_min_importance(self, importance: f32) -> Self
Only match thoughts whose importance is at least this value.
Sourcepub fn with_min_confidence(self, confidence: f32) -> Self
pub fn with_min_confidence(self, confidence: f32) -> Self
Only match thoughts whose confidence is at least this value.
Sourcepub fn with_since(self, since: DateTime<Utc>) -> Self
pub fn with_since(self, since: DateTime<Utc>) -> Self
Only match thoughts at or after the given timestamp.
Sourcepub fn with_until(self, until: DateTime<Utc>) -> Self
pub fn with_until(self, until: DateTime<Utc>) -> Self
Only match thoughts at or before the given timestamp.
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Limit the number of returned thoughts.
Trait Implementations§
Source§impl Clone for ThoughtQuery
impl Clone for ThoughtQuery
Source§fn clone(&self) -> ThoughtQuery
fn clone(&self) -> ThoughtQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more