Vector search and embeddings
Store text as embeddings in collections and find the most similar items — semantic search and retrieval-augmented generation (RAG) for your app.
A vector collection holds items (text plus your own metadata) as embeddings. Searching it with a question returns the items closest in meaning, not just matching words — the core of semantic search, recommendations and RAG.
Index and search
await sovaria.vector.upsert('help-articles', [
{ id: 'a1', text: 'How to reset your password', metadata: { lang: 'en' } },
{ id: 'a2', text: 'Exporting invoices as PDF', metadata: { lang: 'en' } },
])
const hits = await sovaria.vector.search('help-articles', 'I forgot my login', {
topK: 3,
metadataFilter: { lang: 'en' },
})Retrieval-augmented generation
Index your content
Upsert each document (or each paragraph of long ones) with an id and metadata such as
lang,productortenant.Search with the user's question
Take the top 3–5 hits, filtered by metadata the user may see.
Answer with context
Send the hits to your model as context. Doing this in an edge function keeps your model key on the server — see Functions.
Manage collections
vector.listCollections(), listRecords(collection), deleteRecord(collection, id) and deleteCollection(collection) (Python: vector_list_collections, vector_list_records, vector_delete_record, vector_delete_collection). Full signatures: JavaScript: Vectors and embeddings and Python: Vectors and embeddings.