second-brain-core 0.5.0

Core library for second-brain: KuzuDB graph storage, BGE embeddings, and weighted query engine
Documentation
use second_brain_core::embedding::{Embedder, query_prompt};

#[test]
fn query_prompt_prefixes_with_bge_retrieval_instruction() {
    assert_eq!(
        query_prompt("foo"),
        "Represent this sentence for searching relevant passages: foo"
    );
}

#[test]
fn embed_query_matches_prefixed_embed_and_differs_from_bare() {
    let embedder = Embedder::new().unwrap();

    let prefixed = embedder
        .embed("Represent this sentence for searching relevant passages: foo")
        .unwrap();
    let queried = embedder.embed_query("foo").unwrap();
    let bare = embedder.embed("foo").unwrap();

    assert_eq!(queried, prefixed, "embed_query must apply the BGE query prefix");
    assert_ne!(queried, bare, "the prefix must change the embedding");
}