Skip to main content
Version: V1.1.0

Default embedded functions

Vector functions convert text documents into vector embeddings for similarity search. seekdb-js supports both built-in and custom vector functions.

The default vector function uses a local model (Xenova/all-MiniLM-L6-v2) without requiring an API key. It is ideal for quick development and testing.

// Use default configuration (automatically uses the default vector function)
const collection = await client.createCollection({
name: "local_embed_collection"
});

The model will be automatically downloaded the first time you perform vectorization. This process typically takes 3-5 minutes, depending on your network conditions. Please be patient.

seekdb-js also allows you to manually import built-in models using the following command:

npm install @seekdb/default-embed

Here is an example of using a built-in function:

import { DefaultEmbeddingFunction } from "@seekdb/default-embed";

const defaultEmbed = new DefaultEmbeddingFunction({
// If you encounter download issues, try switching regions. The default is 'cn'.
// region: 'intl'
});

const collection = await client.createCollection({
name: "local_embed_collection",
embeddingFunction: defaultEmbed
});

If you need to use other built-in functions or custom functions, you can refer to the following documentation to create and use custom functions: