Skip to content
3 min read · 676 words

Abstract Class: BaseVectorStore ​

Defined in: src/batteries/vector/contract.ts:54

Abstract base shared by every bundled vector adapter. It implements the cross-cutting surface (query/schema/transaction/asCallable/encode) on top of the small set of backend-specific abstract methods each adapter fills in (connect, executeSearch, createCollection, …). Concrete adapters inherit the doc comments below unless they override them.

Extended by ​

Implements ​

Constructors ​

Constructor ​

ts
new BaseVectorStore(options: BaseVectorStoreOptions): BaseVectorStore;

Defined in: src/batteries/vector/contract.ts:60

Parameters ​

ParameterType
optionsBaseVectorStoreOptions

Returns ​

BaseVectorStore

Properties ​

PropertyModifierTypeDescriptionDefined in
capabilitiesabstractVectorStoreCapabilitiesStatic description of what this backend supports — see VectorStoreCapabilities.src/batteries/vector/contract.ts:56

Accessors ​

schema ​

Get Signature ​

ts
get schema(): VectorSchemaBuilder;

Defined in: src/batteries/vector/contract.ts:109

Schema builder bound to this store, for creating/dropping/migrating collections.

Returns ​

VectorSchemaBuilder

Methods ​

asCallable() ​

ts
asCallable(): CallableVectorStore;

Defined in: src/batteries/vector/contract.ts:123

Wrap this store in a callable proxy so store('collection') is shorthand for store.query('collection'), while all other methods/properties pass through unchanged.

Returns ​

CallableVectorStore


close() ​

ts
abstract close(): Promise<void>;

Defined in: src/batteries/vector/contract.ts:69

Release the backing connection and any held resources.

Returns ​

Promise<void>


connect() ​

ts
abstract connect(): Promise<void>;

Defined in: src/batteries/vector/contract.ts:67

Establish the backing connection (open clients, pools, sockets). Idempotent where the driver allows.

Returns ​

Promise<void>


createCollection() ​

ts
abstract createCollection(spec: CollectionSpec, ifNotExists: boolean): Promise<void>;

Defined in: src/batteries/vector/contract.ts:79

Create a collection from spec; a no-op when ifNotExists and it already exists.

Parameters ​

ParameterType
specCollectionSpec
ifNotExistsboolean

Returns ​

Promise<void>

Implementation of ​

SchemaExecutor.createCollection


dropCollection() ​

ts
abstract dropCollection(collection: string, ifExists: boolean): Promise<void>;

Defined in: src/batteries/vector/contract.ts:81

Drop a collection; a no-op when ifExists and it is absent.

Parameters ​

ParameterType
collectionstring
ifExistsboolean

Returns ​

Promise<void>

Implementation of ​

SchemaExecutor.dropCollection


executeDelete() ​

ts
abstract executeDelete(plan: DeletePlan): Promise<void>;

Defined in: src/batteries/vector/contract.ts:76

Execute a compiled delete plan.

Parameters ​

ParameterType
planDeletePlan

Returns ​

Promise<void>

Implementation of ​

PlanSink.executeDelete


executeSearch() ​

ts
abstract executeSearch(plan: SearchPlan): Promise<VectorMatch[]>;

Defined in: src/batteries/vector/contract.ts:72

Execute a compiled search plan and return the matched records.

Parameters ​

ParameterType
planSearchPlan

Returns ​

Promise<VectorMatch[]>

Implementation of ​

PlanSink.executeSearch


executeUpsert() ​

ts
abstract executeUpsert(plan: UpsertPlan): Promise<void>;

Defined in: src/batteries/vector/contract.ts:74

Execute a compiled upsert plan (insert-or-replace the given records).

Parameters ​

ParameterType
planUpsertPlan

Returns ​

Promise<void>

Implementation of ​

PlanSink.executeUpsert


hasCollection() ​

ts
abstract hasCollection(collection: string): Promise<boolean>;

Defined in: src/batteries/vector/contract.ts:83

Whether a collection currently exists in the backend.

Parameters ​

ParameterType
collectionstring

Returns ​

Promise<boolean>

Implementation of ​

SchemaExecutor.hasCollection


isAvailable() ​

ts
abstract isAvailable(): boolean;

Defined in: src/batteries/vector/contract.ts:65

Whether the backend's optional peer dependency is installed and the store is usable.

Returns ​

boolean


query() ​

ts
query(collection: string): VectorQueryBuilder;

Defined in: src/batteries/vector/contract.ts:114

Open a VectorQueryBuilder scoped to collection (default top-K of 10).

Parameters ​

ParameterType
collectionstring

Returns ​

VectorQueryBuilder


renameCollection() ​

ts
abstract renameCollection(from: string, to: string): Promise<void>;

Defined in: src/batteries/vector/contract.ts:85

Rename a collection from from to to.

Parameters ​

ParameterType
fromstring
tostring

Returns ​

Promise<void>

Implementation of ​

SchemaExecutor.renameCollection


transaction() ​

ts
transaction(_fn: (tx: CallableVectorStore) => Promise<void>): Promise<void>;

Defined in: src/batteries/vector/contract.ts:104

Run fn inside a backend transaction. The base implementation rejects with E_VECTOR_STORE_TRANSACTIONS_UNSUPPORTED; adapters whose backend supports transactions override this.

Parameters ​

ParameterType
_fn(tx: CallableVectorStore) => Promise<void>

Returns ​

Promise<void>