Class: PGVectorStore
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.html)
Extends
Implements
Constructors
new PGVectorStore()
new PGVectorStore(
config
?):PGVectorStore
Constructs a new instance of the PGVectorStore
If the connectionString
is not provided the following env variables are
used to connect to the DB:
PGHOST=your database host
PGUSER=your database user
PGPASSWORD=your database password
PGDATABASE=your database name
PGPORT=your database port
Parameters
• config?: object
& Partial
<IEmbedModel
>
The configuration settings for the instance.
Returns
Overrides
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:52
Properties
collection
private
collection:string
=""
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:27
connectionString
private
connectionString:undefined
|string
=undefined
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:30
db?
private
optional
db:Client
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:33
dimensions
private
dimensions:number
=1536
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:31
embedModel
embedModel:
BaseEmbedding
Inherited from
Source
packages/core/src/storage/vectorStore/types.ts:86
schemaName
private
schemaName:string
=PGVECTOR_SCHEMA
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:28
storesText
storesText:
boolean
=true
Implementation of
VectorStoreNoEmbedModel
. storesText
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:25
tableName
private
tableName:string
=PGVECTOR_TABLE
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:29
Methods
add()
add(
embeddingResults
):Promise
<string
[]>
Adds vector record(s) to the table. NOTE: Uses the collection property controlled by setCollection/getCollection.
Parameters
• 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
Source
packages/core/src/storage/vectorStore/PGVectorStore.ts:196
checkSchema()
private
checkSchema(db
):Promise
<Client
>
Parameters
• db: Client