Class: AstraDBVectorStore
Implements
Constructors
constructor
• new AstraDBVectorStore(init?
): AstraDBVectorStore
Parameters
Name | Type |
---|---|
init? | Partial <AstraDBVectorStore > & { params? : { endpoint : string ; namespace? : string ; token : string } } |
Returns
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:23
Properties
astraClient
• Private
astraClient: DataAPIClient
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:19
astraDB
• Private
astraDB: Db
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:20
collection
• Private
collection: undefined
| Collection
<SomeDoc
>
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:21
contentKey
• contentKey: string
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:17
flatMetadata
• flatMetadata: boolean
= true
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:14
idKey
• idKey: string
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:16
storesText
• storesText: boolean
= true
Implementation of
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:13
Methods
add
▸ add(nodes
): Promise
<string
[]>
Add your document(s) to your Astra DB collection.
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
Returns
Promise
<string
[]>
and array of node ids which were added
Implementation of
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:101
client
▸ client(): DataAPIClient
Get an instance of your Astra DB client.
Returns
DataAPIClient
the AstraDB client
Implementation of
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:92
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
Name | Type |
---|---|
collection | string |
Returns
Promise
<void
>
Promise that resolves if the connection did not throw an error.
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:81
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
Name | Type |
---|---|
collection | string |
options? | CreateCollectionOptions <SomeDoc > |
Returns
Promise
<void
>
Promise that resolves if the creation did not throw an error.
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:64
delete
▸ delete(refDocId
, deleteOptions?
): Promise
<void
>
Delete a document from your Astra DB collection.
Parameters
Name | Type |
---|---|
refDocId | string |
deleteOptions? | DeleteOneOptions |
Returns
Promise
<void
>
Promise that resolves if the delete query did not throw an error.
Implementation of
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:141
query
▸ query(query
, options?
): Promise
<VectorStoreQueryResult
>
Query documents from your Astra DB collection to get the closest match to your embedding.
Parameters
Name | Type |
---|---|
query | VectorStoreQuery |
options? | FindOptions |
Returns
Promise
<VectorStoreQueryResult
>
Implementation of
Defined in
packages/core/src/storage/vectorStore/AstraDBVectorStore.ts:166