Class: PGVectorStore
Provides support for writing and querying vector data in Postgres.
Implements
Constructors
constructor
• new PGVectorStore()
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:40
Properties
collection
• Private
collection: string
= ""
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:18
db
• Optional
db: Client
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:38
storesText
• storesText: boolean
= true
Implementation of
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:16
Methods
add
▸ add(embeddingResults
): Promise
<string
[]>
Adds vector record(s) to the table. NOTE: Uses the collection property controlled by setCollection/getCollection.
Parameters
Name | Type | Description |
---|---|---|
embeddingResults | BaseNode <Metadata >[] | The Nodes to be inserted, optionally including metadata tuples. |
Returns
Promise
<string
[]>
A list of zero or more id values for the created records.
Implementation of
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:144
checkSchema
▸ Private
checkSchema(db
): Promise
<Client
>
Parameters
Name | Type |
---|---|
db | Client |
Returns
Promise
<Client
>
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:90
clearCollection
▸ clearCollection(): Promise
<QueryResult
<any
>>
Delete all vector records for the specified collection. NOTE: Uses the collection property controlled by setCollection/getCollection.
Returns
Promise
<QueryResult
<any
>>
The result of the delete query.
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:128
client
▸ client(): Promise
<Client
>
Connects to the database specified in environment vars. This method also checks and creates the vector extension, the destination table and indexes if not found.
Returns
Promise
<Client
>
A connection to the database, or the error encountered while connecting/setting up.
Implementation of
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:119
delete
▸ delete(refDocId
, deleteKwargs?
): Promise
<void
>
Deletes a single record from the database by id. NOTE: Uses the collection property controlled by setCollection/getCollection.
Parameters
Name | Type | Description |
---|---|---|
refDocId | string | Unique identifier for the record to delete. |
deleteKwargs? | any | Required by VectorStore interface. Currently ignored. |
Returns
Promise
<void
>
Promise that resolves if the delete query did not throw an error.
Implementation of
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:196