pub struct QueryBuilder { /* private fields */ }Expand description
Query builder for fluent API
ImplementationsΒ§
SourceΒ§impl QueryBuilder
impl QueryBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/basic_usage.rs (line 82)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("π§ ExoGenesis Omega - Cosmic Memory System Demo\n");
10
11 // Initialize the cosmic memory system
12 let memory = CosmicMemory::new().await?;
13 println!("β
Initialized 12-tier cosmic memory system\n");
14
15 // Store memories in different tiers
16 println!("π Storing memories across tiers...\n");
17
18 // Tier 1: Instant memory
19 let instant_mem = Memory::new(
20 MemoryTier::Instant,
21 MemoryContent::Text("Current thought: Processing user input".to_string()),
22 vec![0.1, 0.2, 0.3, 0.4],
23 0.3,
24 );
25 memory.store(instant_mem).await?;
26 println!(" [T1] Instant: Working memory stored");
27
28 // Tier 2: Session memory
29 let session_mem = Memory::new(
30 MemoryTier::Session,
31 MemoryContent::Text("Conversation context about Rust programming".to_string()),
32 vec![0.5, 0.6, 0.7, 0.8],
33 0.5,
34 );
35 memory.store(session_mem).await?;
36 println!(" [T2] Session: Conversation context stored");
37
38 // Tier 3: Episodic memory
39 let episodic_mem = Memory::new(
40 MemoryTier::Episodic,
41 MemoryContent::Text("Completed implementation of memory system on 2025-12-04".to_string()),
42 vec![0.2, 0.4, 0.6, 0.8],
43 0.7,
44 );
45 memory.store(episodic_mem).await?;
46 println!(" [T3] Episodic: Event memory stored");
47
48 // Tier 4: Semantic memory
49 let semantic_mem = Memory::new(
50 MemoryTier::Semantic,
51 MemoryContent::Text("Knowledge: Rust uses ownership for memory safety".to_string()),
52 vec![0.9, 0.8, 0.7, 0.6],
53 0.8,
54 );
55 memory.store(semantic_mem).await?;
56 println!(" [T4] Semantic: Knowledge stored");
57
58 // Tier 5: Collective memory
59 let collective_mem = Memory::new(
60 MemoryTier::Collective,
61 MemoryContent::Text("Shared pattern: Async/await improves concurrency".to_string()),
62 vec![0.7, 0.7, 0.7, 0.7],
63 0.75,
64 );
65 memory.store(collective_mem).await?;
66 println!(" [T5] Collective: Shared knowledge stored");
67
68 // Tier 12: Omega memory
69 let omega_mem = Memory::new(
70 MemoryTier::Omega,
71 MemoryContent::Text("Universal principle: Information cannot be destroyed".to_string()),
72 vec![1.0, 1.0, 1.0, 1.0],
73 0.99,
74 );
75 memory.store(omega_mem).await?;
76 println!(" [T12] Omega: Universal truth stored\n");
77
78 // Query memories
79 println!("π Querying memories...\n");
80
81 // Query individual scale memories
82 let query = QueryBuilder::new()
83 .individual()
84 .min_importance(0.5)
85 .build();
86
87 let results = memory.recall(&query, &[
88 MemoryTier::Instant,
89 MemoryTier::Session,
90 MemoryTier::Episodic,
91 MemoryTier::Semantic,
92 ]).await?;
93
94 println!(" Found {} memories in individual scale (T1-T4):", results.len());
95 for mem in &results {
96 if let MemoryContent::Text(text) = &mem.content {
97 println!(" - {}: {}", mem.tier, text);
98 }
99 }
100
101 // Memory statistics
102 println!("\nπ Memory Statistics:\n");
103 let stats = memory.stats().await;
104 println!(" Individual Scale (T1-T4):");
105 println!(" - Instant: {}", stats.individual.instant);
106 println!(" - Session: {}", stats.individual.session);
107 println!(" - Episodic: {}", stats.individual.episodic);
108 println!(" - Semantic: {}", stats.individual.semantic);
109 println!(" Species Scale (T5-T8):");
110 println!(" - Collective: {}", stats.species.collective);
111 println!(" - Evolutionary: {}", stats.species.evolutionary);
112 println!(" - Architectural: {}", stats.species.architectural);
113 println!(" - Substrate: {}", stats.species.substrate);
114 println!(" Cosmic Scale (T9-T12):");
115 println!(" - Civilizational: {}", stats.cosmic.civilizational);
116 println!(" - Temporal: {}", stats.cosmic.temporal);
117 println!(" - Physical: {}", stats.cosmic.physical);
118 println!(" - Omega: {}", stats.cosmic.omega);
119 println!("\n Total memories: {}", stats.total_memories);
120
121 // Run consolidation
122 println!("\nπ Running automatic consolidation...");
123 memory.auto_consolidate().await?;
124 println!("β
Consolidation complete\n");
125
126 println!("π Demo complete!");
127
128 Ok(())
129}pub fn text(self, text: impl Into<String>) -> Self
pub fn embedding(self, embedding: Vec<f32>) -> Self
Sourcepub fn min_importance(self, importance: f64) -> Self
pub fn min_importance(self, importance: f64) -> Self
Examples found in repository?
examples/basic_usage.rs (line 84)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("π§ ExoGenesis Omega - Cosmic Memory System Demo\n");
10
11 // Initialize the cosmic memory system
12 let memory = CosmicMemory::new().await?;
13 println!("β
Initialized 12-tier cosmic memory system\n");
14
15 // Store memories in different tiers
16 println!("π Storing memories across tiers...\n");
17
18 // Tier 1: Instant memory
19 let instant_mem = Memory::new(
20 MemoryTier::Instant,
21 MemoryContent::Text("Current thought: Processing user input".to_string()),
22 vec![0.1, 0.2, 0.3, 0.4],
23 0.3,
24 );
25 memory.store(instant_mem).await?;
26 println!(" [T1] Instant: Working memory stored");
27
28 // Tier 2: Session memory
29 let session_mem = Memory::new(
30 MemoryTier::Session,
31 MemoryContent::Text("Conversation context about Rust programming".to_string()),
32 vec![0.5, 0.6, 0.7, 0.8],
33 0.5,
34 );
35 memory.store(session_mem).await?;
36 println!(" [T2] Session: Conversation context stored");
37
38 // Tier 3: Episodic memory
39 let episodic_mem = Memory::new(
40 MemoryTier::Episodic,
41 MemoryContent::Text("Completed implementation of memory system on 2025-12-04".to_string()),
42 vec![0.2, 0.4, 0.6, 0.8],
43 0.7,
44 );
45 memory.store(episodic_mem).await?;
46 println!(" [T3] Episodic: Event memory stored");
47
48 // Tier 4: Semantic memory
49 let semantic_mem = Memory::new(
50 MemoryTier::Semantic,
51 MemoryContent::Text("Knowledge: Rust uses ownership for memory safety".to_string()),
52 vec![0.9, 0.8, 0.7, 0.6],
53 0.8,
54 );
55 memory.store(semantic_mem).await?;
56 println!(" [T4] Semantic: Knowledge stored");
57
58 // Tier 5: Collective memory
59 let collective_mem = Memory::new(
60 MemoryTier::Collective,
61 MemoryContent::Text("Shared pattern: Async/await improves concurrency".to_string()),
62 vec![0.7, 0.7, 0.7, 0.7],
63 0.75,
64 );
65 memory.store(collective_mem).await?;
66 println!(" [T5] Collective: Shared knowledge stored");
67
68 // Tier 12: Omega memory
69 let omega_mem = Memory::new(
70 MemoryTier::Omega,
71 MemoryContent::Text("Universal principle: Information cannot be destroyed".to_string()),
72 vec![1.0, 1.0, 1.0, 1.0],
73 0.99,
74 );
75 memory.store(omega_mem).await?;
76 println!(" [T12] Omega: Universal truth stored\n");
77
78 // Query memories
79 println!("π Querying memories...\n");
80
81 // Query individual scale memories
82 let query = QueryBuilder::new()
83 .individual()
84 .min_importance(0.5)
85 .build();
86
87 let results = memory.recall(&query, &[
88 MemoryTier::Instant,
89 MemoryTier::Session,
90 MemoryTier::Episodic,
91 MemoryTier::Semantic,
92 ]).await?;
93
94 println!(" Found {} memories in individual scale (T1-T4):", results.len());
95 for mem in &results {
96 if let MemoryContent::Text(text) = &mem.content {
97 println!(" - {}: {}", mem.tier, text);
98 }
99 }
100
101 // Memory statistics
102 println!("\nπ Memory Statistics:\n");
103 let stats = memory.stats().await;
104 println!(" Individual Scale (T1-T4):");
105 println!(" - Instant: {}", stats.individual.instant);
106 println!(" - Session: {}", stats.individual.session);
107 println!(" - Episodic: {}", stats.individual.episodic);
108 println!(" - Semantic: {}", stats.individual.semantic);
109 println!(" Species Scale (T5-T8):");
110 println!(" - Collective: {}", stats.species.collective);
111 println!(" - Evolutionary: {}", stats.species.evolutionary);
112 println!(" - Architectural: {}", stats.species.architectural);
113 println!(" - Substrate: {}", stats.species.substrate);
114 println!(" Cosmic Scale (T9-T12):");
115 println!(" - Civilizational: {}", stats.cosmic.civilizational);
116 println!(" - Temporal: {}", stats.cosmic.temporal);
117 println!(" - Physical: {}", stats.cosmic.physical);
118 println!(" - Omega: {}", stats.cosmic.omega);
119 println!("\n Total memories: {}", stats.total_memories);
120
121 // Run consolidation
122 println!("\nπ Running automatic consolidation...");
123 memory.auto_consolidate().await?;
124 println!("β
Consolidation complete\n");
125
126 println!("π Demo complete!");
127
128 Ok(())
129}pub fn limit(self, limit: usize) -> Self
pub fn tier(self, tier: MemoryTier) -> Self
pub fn tiers(self, tiers: Vec<MemoryTier>) -> Self
pub fn instant(self) -> Self
pub fn session(self) -> Self
pub fn episodic(self) -> Self
pub fn semantic(self) -> Self
Sourcepub fn individual(self) -> Self
pub fn individual(self) -> Self
Examples found in repository?
examples/basic_usage.rs (line 83)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("π§ ExoGenesis Omega - Cosmic Memory System Demo\n");
10
11 // Initialize the cosmic memory system
12 let memory = CosmicMemory::new().await?;
13 println!("β
Initialized 12-tier cosmic memory system\n");
14
15 // Store memories in different tiers
16 println!("π Storing memories across tiers...\n");
17
18 // Tier 1: Instant memory
19 let instant_mem = Memory::new(
20 MemoryTier::Instant,
21 MemoryContent::Text("Current thought: Processing user input".to_string()),
22 vec![0.1, 0.2, 0.3, 0.4],
23 0.3,
24 );
25 memory.store(instant_mem).await?;
26 println!(" [T1] Instant: Working memory stored");
27
28 // Tier 2: Session memory
29 let session_mem = Memory::new(
30 MemoryTier::Session,
31 MemoryContent::Text("Conversation context about Rust programming".to_string()),
32 vec![0.5, 0.6, 0.7, 0.8],
33 0.5,
34 );
35 memory.store(session_mem).await?;
36 println!(" [T2] Session: Conversation context stored");
37
38 // Tier 3: Episodic memory
39 let episodic_mem = Memory::new(
40 MemoryTier::Episodic,
41 MemoryContent::Text("Completed implementation of memory system on 2025-12-04".to_string()),
42 vec![0.2, 0.4, 0.6, 0.8],
43 0.7,
44 );
45 memory.store(episodic_mem).await?;
46 println!(" [T3] Episodic: Event memory stored");
47
48 // Tier 4: Semantic memory
49 let semantic_mem = Memory::new(
50 MemoryTier::Semantic,
51 MemoryContent::Text("Knowledge: Rust uses ownership for memory safety".to_string()),
52 vec![0.9, 0.8, 0.7, 0.6],
53 0.8,
54 );
55 memory.store(semantic_mem).await?;
56 println!(" [T4] Semantic: Knowledge stored");
57
58 // Tier 5: Collective memory
59 let collective_mem = Memory::new(
60 MemoryTier::Collective,
61 MemoryContent::Text("Shared pattern: Async/await improves concurrency".to_string()),
62 vec![0.7, 0.7, 0.7, 0.7],
63 0.75,
64 );
65 memory.store(collective_mem).await?;
66 println!(" [T5] Collective: Shared knowledge stored");
67
68 // Tier 12: Omega memory
69 let omega_mem = Memory::new(
70 MemoryTier::Omega,
71 MemoryContent::Text("Universal principle: Information cannot be destroyed".to_string()),
72 vec![1.0, 1.0, 1.0, 1.0],
73 0.99,
74 );
75 memory.store(omega_mem).await?;
76 println!(" [T12] Omega: Universal truth stored\n");
77
78 // Query memories
79 println!("π Querying memories...\n");
80
81 // Query individual scale memories
82 let query = QueryBuilder::new()
83 .individual()
84 .min_importance(0.5)
85 .build();
86
87 let results = memory.recall(&query, &[
88 MemoryTier::Instant,
89 MemoryTier::Session,
90 MemoryTier::Episodic,
91 MemoryTier::Semantic,
92 ]).await?;
93
94 println!(" Found {} memories in individual scale (T1-T4):", results.len());
95 for mem in &results {
96 if let MemoryContent::Text(text) = &mem.content {
97 println!(" - {}: {}", mem.tier, text);
98 }
99 }
100
101 // Memory statistics
102 println!("\nπ Memory Statistics:\n");
103 let stats = memory.stats().await;
104 println!(" Individual Scale (T1-T4):");
105 println!(" - Instant: {}", stats.individual.instant);
106 println!(" - Session: {}", stats.individual.session);
107 println!(" - Episodic: {}", stats.individual.episodic);
108 println!(" - Semantic: {}", stats.individual.semantic);
109 println!(" Species Scale (T5-T8):");
110 println!(" - Collective: {}", stats.species.collective);
111 println!(" - Evolutionary: {}", stats.species.evolutionary);
112 println!(" - Architectural: {}", stats.species.architectural);
113 println!(" - Substrate: {}", stats.species.substrate);
114 println!(" Cosmic Scale (T9-T12):");
115 println!(" - Civilizational: {}", stats.cosmic.civilizational);
116 println!(" - Temporal: {}", stats.cosmic.temporal);
117 println!(" - Physical: {}", stats.cosmic.physical);
118 println!(" - Omega: {}", stats.cosmic.omega);
119 println!("\n Total memories: {}", stats.total_memories);
120
121 // Run consolidation
122 println!("\nπ Running automatic consolidation...");
123 memory.auto_consolidate().await?;
124 println!("β
Consolidation complete\n");
125
126 println!("π Demo complete!");
127
128 Ok(())
129}pub fn species(self) -> Self
pub fn cosmic(self) -> Self
pub fn all_tiers(self) -> Self
pub fn metadata(self, metadata: Value) -> Self
Sourcepub fn build(self) -> Query
pub fn build(self) -> Query
Examples found in repository?
examples/basic_usage.rs (line 85)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 println!("π§ ExoGenesis Omega - Cosmic Memory System Demo\n");
10
11 // Initialize the cosmic memory system
12 let memory = CosmicMemory::new().await?;
13 println!("β
Initialized 12-tier cosmic memory system\n");
14
15 // Store memories in different tiers
16 println!("π Storing memories across tiers...\n");
17
18 // Tier 1: Instant memory
19 let instant_mem = Memory::new(
20 MemoryTier::Instant,
21 MemoryContent::Text("Current thought: Processing user input".to_string()),
22 vec![0.1, 0.2, 0.3, 0.4],
23 0.3,
24 );
25 memory.store(instant_mem).await?;
26 println!(" [T1] Instant: Working memory stored");
27
28 // Tier 2: Session memory
29 let session_mem = Memory::new(
30 MemoryTier::Session,
31 MemoryContent::Text("Conversation context about Rust programming".to_string()),
32 vec![0.5, 0.6, 0.7, 0.8],
33 0.5,
34 );
35 memory.store(session_mem).await?;
36 println!(" [T2] Session: Conversation context stored");
37
38 // Tier 3: Episodic memory
39 let episodic_mem = Memory::new(
40 MemoryTier::Episodic,
41 MemoryContent::Text("Completed implementation of memory system on 2025-12-04".to_string()),
42 vec![0.2, 0.4, 0.6, 0.8],
43 0.7,
44 );
45 memory.store(episodic_mem).await?;
46 println!(" [T3] Episodic: Event memory stored");
47
48 // Tier 4: Semantic memory
49 let semantic_mem = Memory::new(
50 MemoryTier::Semantic,
51 MemoryContent::Text("Knowledge: Rust uses ownership for memory safety".to_string()),
52 vec![0.9, 0.8, 0.7, 0.6],
53 0.8,
54 );
55 memory.store(semantic_mem).await?;
56 println!(" [T4] Semantic: Knowledge stored");
57
58 // Tier 5: Collective memory
59 let collective_mem = Memory::new(
60 MemoryTier::Collective,
61 MemoryContent::Text("Shared pattern: Async/await improves concurrency".to_string()),
62 vec![0.7, 0.7, 0.7, 0.7],
63 0.75,
64 );
65 memory.store(collective_mem).await?;
66 println!(" [T5] Collective: Shared knowledge stored");
67
68 // Tier 12: Omega memory
69 let omega_mem = Memory::new(
70 MemoryTier::Omega,
71 MemoryContent::Text("Universal principle: Information cannot be destroyed".to_string()),
72 vec![1.0, 1.0, 1.0, 1.0],
73 0.99,
74 );
75 memory.store(omega_mem).await?;
76 println!(" [T12] Omega: Universal truth stored\n");
77
78 // Query memories
79 println!("π Querying memories...\n");
80
81 // Query individual scale memories
82 let query = QueryBuilder::new()
83 .individual()
84 .min_importance(0.5)
85 .build();
86
87 let results = memory.recall(&query, &[
88 MemoryTier::Instant,
89 MemoryTier::Session,
90 MemoryTier::Episodic,
91 MemoryTier::Semantic,
92 ]).await?;
93
94 println!(" Found {} memories in individual scale (T1-T4):", results.len());
95 for mem in &results {
96 if let MemoryContent::Text(text) = &mem.content {
97 println!(" - {}: {}", mem.tier, text);
98 }
99 }
100
101 // Memory statistics
102 println!("\nπ Memory Statistics:\n");
103 let stats = memory.stats().await;
104 println!(" Individual Scale (T1-T4):");
105 println!(" - Instant: {}", stats.individual.instant);
106 println!(" - Session: {}", stats.individual.session);
107 println!(" - Episodic: {}", stats.individual.episodic);
108 println!(" - Semantic: {}", stats.individual.semantic);
109 println!(" Species Scale (T5-T8):");
110 println!(" - Collective: {}", stats.species.collective);
111 println!(" - Evolutionary: {}", stats.species.evolutionary);
112 println!(" - Architectural: {}", stats.species.architectural);
113 println!(" - Substrate: {}", stats.species.substrate);
114 println!(" Cosmic Scale (T9-T12):");
115 println!(" - Civilizational: {}", stats.cosmic.civilizational);
116 println!(" - Temporal: {}", stats.cosmic.temporal);
117 println!(" - Physical: {}", stats.cosmic.physical);
118 println!(" - Omega: {}", stats.cosmic.omega);
119 println!("\n Total memories: {}", stats.total_memories);
120
121 // Run consolidation
122 println!("\nπ Running automatic consolidation...");
123 memory.auto_consolidate().await?;
124 println!("β
Consolidation complete\n");
125
126 println!("π Demo complete!");
127
128 Ok(())
129}Trait ImplementationsΒ§
Auto Trait ImplementationsΒ§
impl Freeze for QueryBuilder
impl RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl UnwindSafe for QueryBuilder
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