Package com.tnsai.memory.advanced
Interface VectorIndex
public interface VectorIndex
Storage backend for
VectorMemoryStore.
The in-memory implementation is the default. Optional adapters
(Qdrant, pgvector) implement this seam so tnsai-core stays
free of vector-database clients.
- Since:
- 0.14.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Drops every stored entry.booleanRemoves one entry.searchByVector(float[] queryVector, int topK) Returns the top-topKentries by cosine similarity.intsize()Number of stored entries.voidupsert(String id, MemoryEntry entry, float[] vector) Inserts or replaces one entry and its embedding.
-
Method Details
-
upsert
Inserts or replaces one entry and its embedding.- Parameters:
id- entry identifierentry- memory entryvector- embedding snapshot owned by the caller
-
remove
Removes one entry.- Parameters:
id- entry identifier- Returns:
truewhen the entry was present
-
clear
void clear()Drops every stored entry. -
size
int size()Number of stored entries. -
searchByVector
Returns the top-topKentries by cosine similarity.- Parameters:
queryVector- query embeddingtopK- maximum results- Returns:
- scored entries, highest first
-