kroma

kroma.retrieval

Retrieval

Retrieval ranks concepts by cosine similarity of a combined text and structure vector.

VectorStore

VectorStore.add(ext_ids, embeddings) -> None
VectorStore.query(query_emb, top_k=5) -> list[(id, score)]

add stacks embedding rows and keeps the external ids in the same order. query L2-normalizes the stored matrix and the query, then returns the top cosine scores. An empty store returns an empty list.

Source: vector_store.py.

Combined embeddings

compute_combined_embeddings(
    adj_dict, node_keys, text_embs,
    n2v_kwargs=None, combine_method="concat", alpha=0.5,
)

The default combine method is concatenation of the text embedding and the Node2Vec embedding. alpha applies when the method is a weighted mix rather than concatenation.

Source: node2vec.py.