Extract memories from a session transcript using the Haiku sidecar
(
&self,
transcript: &str,
session_id: &str,
)
| 1113 | |
| 1114 | /// Extract memories from a session transcript using the Haiku sidecar |
| 1115 | pub async fn extract_from_transcript( |
| 1116 | &self, |
| 1117 | transcript: &str, |
| 1118 | session_id: &str, |
| 1119 | ) -> Result<Vec<String>> { |
| 1120 | if !memory_llm_judge_available() { |
| 1121 | crate::logging::info("Memory transcript extraction skipped: LLM judge unavailable"); |
| 1122 | return Ok(Vec::new()); |
| 1123 | } |
| 1124 | |
| 1125 | let sidecar = Sidecar::new(); |
| 1126 | let extracted = sidecar.extract_memories(transcript).await?; |
| 1127 | |
| 1128 | let mut ids = Vec::new(); |
| 1129 | for memory in extracted { |
| 1130 | let category: MemoryCategory = memory.category.parse().unwrap_or(MemoryCategory::Fact); |
| 1131 | let trust = match memory.trust.as_str() { |
| 1132 | "high" => TrustLevel::High, |
| 1133 | "medium" => TrustLevel::Medium, |
| 1134 | _ => TrustLevel::Low, |
| 1135 | }; |
| 1136 | |
| 1137 | let entry = MemoryEntry::new(category, memory.content) |
| 1138 | .with_source(session_id) |
| 1139 | .with_trust(trust); |
| 1140 | |
| 1141 | // Store in project scope by default |
| 1142 | let id = self.remember_project(entry)?; |
| 1143 | ids.push(id); |
| 1144 | } |
| 1145 | |
| 1146 | Ok(ids) |
| 1147 | } |
| 1148 | |
| 1149 | /// Check if stored memories are relevant to the current context |
| 1150 | /// Returns memories that the sidecar deems relevant |
nothing calls this directly
no test coverage detected