PostgresVectorStore
class.
Overview
Integration details
Class | Package | PY support | Version |
---|---|---|---|
PostgresVectorStore | @langchain/google-cloud-sql-pg | ✅ | 0.0.1 |
Before you begin
In order to use this package, you first need to go throught the following steps:- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Cloud SQL Admin API.
- Setup Authentication.
- Create a CloudSQL instance
- Create a CloudSQL database
- Add a user to the database
Authentication
Authenticate locally to your Google Cloud account using thegcloud auth login
command.
Set Your Google Cloud Project
Set your Google Cloud project ID to leverage Google Cloud resources locally:- Run
gcloud config list
. - Run
gcloud projects list
. - See the support page: Locate the project ID.
Setting up a PostgresVectorStore instance
To use the PostgresVectorStore library, you’ll need to install the@langchain/google-cloud-sql-pg
package and then follow the steps bellow.
First, you’ll need to log in to your Google Cloud account and set the following environment variables based on your Google Cloud project; these will be defined based on how you want to configure (fromInstance, fromEngine, fromEngineArgs) your PostgresEngine instance :
Setting up an instance
To instantiate a PostgresVectorStore, you’ll first need to create a database connection through the PostgresEngine, then initialize the vector store table and finally call the.initialize()
method to instantiate the vector store.