(&self, hash: &str, vector: &[f32])
| 63 | } |
| 64 | |
| 65 | fn insert(&self, hash: &str, vector: &[f32]) -> Result<(), Box<dyn std::error::Error>> { |
| 66 | let conn = self.conn.lock().unwrap(); |
| 67 | let blob = bincode::serialize(vector)?; |
| 68 | conn.execute( |
| 69 | "INSERT OR REPLACE INTO embedding_cache (hash, vector, created_at) VALUES (?1, ?2, strftime('%s', 'now'))", |
| 70 | params![hash, blob], |
| 71 | )?; |
| 72 | Ok(()) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | #[derive(Deserialize)] |
no outgoing calls