Skip to main content

mentedb_extraction/
schema.rs

1use serde::{Deserialize, Serialize};
2
3/// The complete result of an extraction call, as returned by the LLM.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct ExtractionResult {
6    pub memories: Vec<ExtractedMemory>,
7}
8
9/// A single memory extracted from a conversation by the LLM.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ExtractedMemory {
12    /// The factual content of the memory.
13    pub content: String,
14    /// Classification: decision, preference, correction, fact, entity, anti_pattern.
15    pub memory_type: String,
16    /// How confident the LLM is that this is worth remembering (0.0 to 1.0).
17    #[serde(default = "default_confidence")]
18    pub confidence: f32,
19    /// Entities mentioned in this memory.
20    #[serde(default)]
21    pub entities: Vec<String>,
22    /// Categorization tags.
23    #[serde(default)]
24    pub tags: Vec<String>,
25    /// Why this memory was extracted (for debugging and auditing).
26    #[serde(default)]
27    pub reasoning: String,
28}
29
30fn default_confidence() -> f32 {
31    0.5
32}