Skip to main content

Class: AstraDBVectorStore

Extends

Constructors

new AstraDBVectorStore()

new AstraDBVectorStore(init?): AstraDBVectorStore

Parameters

init?: Partial<AstraDBVectorStore> & object & VectorStoreBaseParams

Returns

AstraDBVectorStore

Overrides

BaseVectorStore.constructor

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:39

Properties

contentKey

contentKey: string

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:33


embedModel

embedModel: BaseEmbedding

Inherited from

BaseVectorStore.embedModel

Defined in

packages/llamaindex/src/vector-store/types.ts:92


flatMetadata

flatMetadata: boolean = true

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:30


idKey

idKey: string

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:32


isEmbeddingQuery?

optional isEmbeddingQuery: boolean

Inherited from

BaseVectorStore.isEmbeddingQuery

Defined in

packages/llamaindex/src/vector-store/types.ts:94


storesText

storesText: boolean = true

Overrides

BaseVectorStore.storesText

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:29

Methods

add()

add(nodes): Promise<string[]>

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

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:118


client()

client(): DataAPIClient

Get an instance of your Astra DB client.

Returns

DataAPIClient

the AstraDB client

Overrides

BaseVectorStore.client

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:109


connect()

connect(collection): Promise<void>

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.

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:98


createAndConnect()

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

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.

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:81


delete()

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

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

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:158


query()

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

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

Defined in

packages/llamaindex/src/vector-store/AstraDBVectorStore.ts:183