Logo
Classes

AstraDBVectorStore

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:26

Extends

  • BaseVectorStore

Constructors

new AstraDBVectorStore()

new AstraDBVectorStore(init?): AstraDBVectorStore

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:37

Parameters

init?

Partial<AstraDBVectorStore> & object & VectorStoreBaseParams

Returns

AstraDBVectorStore

Overrides

BaseVectorStore.constructor

Properties

storesText

storesText: boolean = true

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:27

Overrides

BaseVectorStore.storesText


flatMetadata

flatMetadata: boolean = true

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:28


idKey

idKey: string

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:30


contentKey

contentKey: string

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:31

Methods

createAndConnect()

createAndConnect(collection, options?): Promise<void>

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:79

Create a new collection in your Astra DB vector database and connects to it. You must call this method or connect before adding, deleting, or querying.

Parameters

collection

string

Your new collection's name

options?

CreateCollectionOptions<SomeDoc>

CreateCollectionOptions used to set the number of vector dimensions and similarity metric

Returns

Promise<void>

Promise that resolves if the creation did not throw an error.


connect()

connect(collection): Promise<void>

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:96

Connect to an existing collection in your Astra DB vector database. You must call this method or createAndConnect before adding, deleting, or querying.

Parameters

collection

string

Your existing collection's name

Returns

Promise<void>

Promise that resolves if the connection did not throw an error.


client()

client(): DataAPIClient

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:107

Get an instance of your Astra DB client.

Returns

DataAPIClient

the AstraDB client

Overrides

BaseVectorStore.client


add()

add(nodes): Promise<string[]>

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:116

Add your document(s) to your Astra DB collection.

Parameters

nodes

BaseNode<Metadata>[]

Returns

Promise<string[]>

an array of node ids which were added

Overrides

BaseVectorStore.add


delete()

delete(refDocId, deleteOptions?): Promise<void>

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:156

Delete a document from your Astra DB collection.

Parameters

refDocId

string

The id of the document to delete

deleteOptions?

DeleteOneOptions

DeleteOneOptions to pass to the delete query

Returns

Promise<void>

Promise that resolves if the delete query did not throw an error.

Overrides

BaseVectorStore.delete


query()

query(query, options?): Promise<VectorStoreQueryResult>

Defined in: providers/storage/astra/src/AstraDBVectorStore.ts:181

Query documents from your Astra DB collection to get the closest match to your embedding.

Parameters

query

VectorStoreQuery

VectorStoreQuery

options?

FindOptions

FindOptions

Returns

Promise<VectorStoreQueryResult>

Overrides

BaseVectorStore.query