Skip to content
2 min read · 437 words

@nhtio/adk/batteries/vector/types

Type definitions for the vector storage provider battery.

Remarks

This module owns the shared types and interfaces used by all vector storage adapters. It defines the core abstractions for vectors, metadata, search results, and adapter capabilities without any runtime logic or driver dependencies.

Interfaces

InterfaceDescription
BaseVectorStoreOptionsShared base options every adapter extends with its own connection block.
EnsureCollectionOptionsOptions for ensuring a collection exists.
VectorConsistencyCapabilityHow an adapter handles the VectorConsistency option. configurable:false → the backend is already strongly consistent (pgvector, sqlite-vec, in-memory, orama, …); the option is a no-op and default is always 'strong'. configurable:true → an eventually-consistent backend (Pinecone today; ElasticSearch / OpenSearch, Mongo Atlas Vector Search, multi-node Weaviate later) that honors the option. default is what applies when neither a per-operation .consistency() nor a store-level consistency option is set; modes enumerates what it accepts.
VectorMatchA result row from a vector search or filter scan. All fields are opt-in via .select().
VectorRecordA stored vector record. All fields are optional; at minimum, an id is required.
VectorStoreCapabilities-

Type Aliases

Type AliasDescription
DistanceMetricMetric used to compare vectors during similarity search.
EncodeKindIndicates whether text is being encoded as a query or as a document.
VectorConsistencyRead-after-write guarantee a write (.upsert() / .delete()) provides. 'strong' — the write Promise does not resolve until the change is confirmed visible to subsequent reads. On timeout it THROWS E_VECTOR_STORE_CONSISTENCY_TIMEOUT — never resolves unconfirmed. 'best-effort' — poll up to the bound, then resolve whether or not visibility was confirmed. The ONLY mode that may proceed unconfirmed, and only because the caller asked for it. NOTE: on an eventually-consistent backend a write-after-write race (e.g. deleting a just-upserted id from a concurrent writer) may not take effect — this mode does not detect it. Use 'strong' if you delete records you may have just written. 'eventual' — resolve on durable acknowledgement, with no visibility wait. Fastest; inherits the same write-after-write race as 'best-effort', silently.
VectorEncoderFnThe BYO text-to-vector contract. Batch-shaped: one round-trip for many texts.
VectorInputInput to the encoder: either a raw vector array or raw text to be embedded.
VectorMetadataA flat or nested object mapping metadata keys to values.
VectorMetadataValueA metadata value may be a primitive, null, or a nested object/array of such values.