メインコンテンツまでスキップ

Class: AstraDBVectorStore

Implements

Constructors

constructor

new AstraDBVectorStore(init?): AstraDBVectorStore

Parameters

NameType
init?Partial<AstraDBVectorStore> & { params?: { endpoint: string ; token: string } }

Returns

AstraDBVectorStore

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:20

Properties

astraDBClient

astraDBClient: AstraDB

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:13


collection

Private collection: undefined | Collection

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:18


contentKey

contentKey: undefined | string

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:15


flatMetadata

flatMetadata: boolean = true

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:11


idKey

idKey: string

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:14


metadataKey

metadataKey: string

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:16


storesText

storesText: boolean = true

Implementation of

VectorStore.storesText

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:10

Methods

add

add(nodes): Promise<string[]>

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

Parameters

NameType
nodesBaseNode<Metadata>[]

Returns

Promise<string[]>

and array of node ids which were added

Implementation of

VectorStore.add

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:96


client

client(): AstraDB

Get an instance of your Astra DB client.

Returns

AstraDB

the AstraDB client

Implementation of

VectorStore.client

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:87


connect

connect(collection): Promise<void>

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

Parameters

NameTypeDescription
collectionstringyour existing colletion's name

Returns

Promise<void>

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

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:76


create

create(collection, options): Promise<void>

Create a new collection in your Astra DB vector database. You must still use connect() to connect to the collection.

Parameters

NameTypeDescription
collectionstringyour new colletion's name
options_CreateCollectionOptions-

Returns

Promise<void>

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

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:59


delete

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

Delete a document from your Astra DB collection.

Parameters

NameTypeDescription
refDocIdstringthe id of the document to delete
deleteOptions?any-

Returns

Promise<void>

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

Implementation of

VectorStore.delete

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:139


query

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

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

Parameters

NameType
queryVectorStoreQuery
options?any

Returns

Promise<VectorStoreQueryResult>

Implementation of

VectorStore.query

Defined in

packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:161