Skip to main content

upsert_vec

Function upsert_vec 

Source
pub fn upsert_vec(
    conn: &Connection,
    memory_id: i64,
    namespace: &str,
    memory_type: &str,
    embedding: &[f32],
    name: &str,
    snippet: &str,
) -> Result<(), AppError>
Expand description

Replaces the vector row for a memory in vec_memories.

sqlite-vec virtual tables do not implement INSERT OR REPLACE, so the existing row is deleted first and a fresh vector is inserted. Callers must pass an embedding with length crate::constants::EMBEDDING_DIM.

ยงErrors

Returns Err(AppError::Database) on any rusqlite failure.