Docs

JavaScript: Vectors and embeddings

Turn text into embeddings, store vectors with metadata and run similarity search with @sovaria/sdk.

Updated Oct 16, 2026

sovaria.vector stores embeddings in collections and finds the nearest ones to a query — the building block for semantic search and retrieval-augmented generation.

await sovaria.vector.upsert('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('articles', 'forgot my login', { topK: 3, metadataFilter: { lang: 'en' } })

sovaria.vector

sovaria.vector.embed

Embed.

sovaria.vector.embed(
  texts: string[],
): Promise<{ vectors: number[][]; dim: number; count: number; }>

Parameters

textsstring[]required
Texts to embed.
Returns
Promise<{ vectors: number[][]; dim: number; count: number; }> — { vectors } — one array of numbers per text.
HTTP
POST /api/v1/embed

sovaria.vector.upsert

Upsert.

sovaria.vector.upsert(
  collection: string,
  docs: Array<{ id?: string; text: string; metadata?: JsonObject }>,
): Promise<JsonObject>

Parameters

collectionstringrequired
Collection name.
docsArray<{ id?: string; text: string; metadata?: JsonObject }>required
[{ id?, text, metadata? }]; texts are embedded for you.
Returns
Promise<JsonObject>
HTTP
POST /api/v1/vectors/upsert

sovaria.vector.listCollections

List collections.

sovaria.vector.listCollections(): Promise<JsonObject>
Returns
Promise<JsonObject>
HTTP
GET /api/v1/collections

sovaria.vector.listRecords

List records.

sovaria.vector.listRecords(
  collection: string,
  options?: { limit?: number; offset?: number } = {},
): Promise<JsonObject>

Parameters

collectionstringrequired
options{ limit?: number; offset?: number }optionaldefault {}
Returns
Promise<JsonObject>
HTTP
GET /api/v1/collections/{…}/records

sovaria.vector.deleteRecord

Delete record.

sovaria.vector.deleteRecord(collection: string, recordId: string): Promise<JsonObject>

Parameters

collectionstringrequired
recordIdstringrequired
Returns
Promise<JsonObject>
HTTP
DELETE /api/v1/collections/{…}/records/{…}

sovaria.vector.deleteCollection

Delete collection.

sovaria.vector.deleteCollection(collection: string): Promise<JsonObject>

Parameters

collectionstringrequired
Returns
Promise<JsonObject>
HTTP
DELETE /api/v1/collections/{…}
Something unclear or missing on this page?Tell us