PGVectorStore
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:155
Provides support for writing and querying vector data in Postgres. Note: Can’t be used with data created using the Python version of the vector store (https://docs.llamaindex.ai/en/stable/examples/vector_stores/postgres/)
Extends
Section titled “Extends”BaseVectorStore
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PGVectorStore(
config
):PGVectorStore
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:168
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”PGVectorStore
Overrides
Section titled “Overrides”BaseVectorStore.constructor
Properties
Section titled “Properties”storesText
Section titled “storesText”storesText:
boolean
=true
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:156
Overrides
Section titled “Overrides”BaseVectorStore.storesText
Methods
Section titled “Methods”setCollection()
Section titled “setCollection()”setCollection(
coll
):void
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:203
Setter for the collection property. Using a collection allows for simple segregation of vector data, e.g. by user, source, or access-level. Leave/set blank to ignore the collection value when querying.
Parameters
Section titled “Parameters”string
Name for the collection.
Returns
Section titled “Returns”void
getCollection()
Section titled “getCollection()”getCollection():
string
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:214
Getter for the collection property. Using a collection allows for simple segregation of vector data, e.g. by user, source, or access-level. Leave/set blank to ignore the collection value when querying.
Returns
Section titled “Returns”string
The currently-set collection value. Default is empty string.
client()
Section titled “client()”client():
Promise
<IsomorphicDB
>
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:286
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
Section titled “Returns”Promise
<IsomorphicDB
>
A connection to the database, or the error encountered while connecting/setting up.
Overrides
Section titled “Overrides”BaseVectorStore.client
clearCollection()
Section titled “clearCollection()”clearCollection():
Promise
<any
[]>
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:295
Delete all vector records for the specified collection. NOTE: Uses the collection property controlled by setCollection/getCollection.
Returns
Section titled “Returns”Promise
<any
[]>
The result of the delete query.
add(
embeddingResults
):Promise
<string
[]>
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:331
Adds vector record(s) to the table. NOTE: Uses the collection property controlled by setCollection/getCollection.
Parameters
Section titled “Parameters”embeddingResults
Section titled “embeddingResults”BaseNode
<Metadata
>[]
The Nodes to be inserted, optionally including metadata tuples.
Returns
Section titled “Returns”Promise
<string
[]>
A list of zero or more id values for the created records.
Overrides
Section titled “Overrides”BaseVectorStore.add
delete()
Section titled “delete()”delete(
refDocId
,deleteKwargs?
):Promise
<void
>
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:380
Deletes a single record from the database by id. NOTE: Uses the collection property controlled by setCollection/getCollection.
Parameters
Section titled “Parameters”refDocId
Section titled “refDocId”string
Unique identifier for the record to delete.
deleteKwargs?
Section titled “deleteKwargs?”object
Required by VectorStore interface. Currently ignored.
Returns
Section titled “Returns”Promise
<void
>
Promise that resolves if the delete query did not throw an error.
Overrides
Section titled “Overrides”BaseVectorStore.delete
query()
Section titled “query()”query(
query
,options?
):Promise
<VectorStoreQueryResult
>
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:515
Query the vector store for the closest matching data to the query embeddings
Parameters
Section titled “Parameters”VectorStoreQuery
The VectorStoreQuery to be used
options?
Section titled “options?”object
Required by VectorStore interface. Currently ignored.
Returns
Section titled “Returns”Promise
<VectorStoreQueryResult
>
Zero or more Document instances with data from the vector store.
Overrides
Section titled “Overrides”BaseVectorStore.query
persist()
Section titled “persist()”persist(
persistPath
):Promise
<void
>
Defined in: .build/typescript/packages/providers/storage/postgres/src/PGVectorStore.ts:590
Required by VectorStore interface. Currently ignored.
Parameters
Section titled “Parameters”persistPath
Section titled “persistPath”string
Returns
Section titled “Returns”Promise
<void
>
Resolved Promise.