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)
Implements
Constructors
constructor
• 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
Name | Type | Description |
---|---|---|
config? | Object | The configuration settings for the instance. |
config.connectionString? | string | The connection string (optional). |
config.dimensions? | number | The dimensions of the embedding model. |
config.schemaName? | string | The name of the schema (optional). Defaults to PGVECTOR_SCHEMA. |
config.tableName? | string | The name of the table (optional). Defaults to PGVECTOR_TABLE. |
Returns
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:48
Properties
collection
• Private
collection: string
= ""
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:23
connectionString
• Private
connectionString: undefined
| string
= undefined
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:26
db
• Private
Optional
db: Client
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:29
dimensions
• Private
dimensions: number
= 1536
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:27
schemaName
• Private
schemaName: string
= PGVECTOR_SCHEMA
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:24
storesText
• storesText: boolean
= true
Implementation of
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:21
tableName
• Private
tableName: string
= PGVECTOR_TABLE
Defined in
packages/core/src/storage/vectorStore/PGVectorStore.ts:25
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:189
checkSchema
▸ checkSchema(db
): Promise
<Client
>