
Security News
pnpm 11.5 Adds Support for Recognizing npm Staged Publishes
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.
@langchain/google-cloud-sql-pg
Advanced tools
LangChain.js integrations for Google Cloud SQL for PostgreSQL
The LangChain package for CloudSQL for Postgres provides a way to connect to Cloud SQL instances from the LangChain ecosystem.
Main features:
In order to use this package, you first need to go through the following steps:
$ pnpm install @langchain/google-cloud-sql-pg
Before you use the PostgresVectorStore you will need to create a postgres connection through the PostgresEngine interface.
import { Column, PostgresEngine, PostgresEngineArgs, PostgresVectorStore, VectorStoreTableArgs } from "@langchain/google-cloud-sql-pg";
import { SyntheticEmbeddings } from "@langchain/core/utils/testing";
const pgArgs: PostgresEngineArgs = {
user: "db-user",
password: "password"
}
const engine: PostgresEngine = await PostgresEngine.fromInstance(
"project-id",
"region",
"instance-name",
"database-name",
pgArgs
);
const vectorStoreTableArgs: VectorStoreTableArgs = {
metadataColumns: [new Column("page", "TEXT"), new Column("source", "TEXT")],
};
await engine.initVectorstoreTable("my-table", 768, vectorStoreTableArgs);
const embeddingService = new SyntheticEmbeddings({ vectorSize: 768 });
Use a PostgresVectorStore to store embedded data and perform vector similarity search for Postgres.
const pvectorArgs: PostgresVectorStoreArgs = {
idColumn: "ID_COLUMN",
contentColumn: "CONTENT_COLUMN",
embeddingColumn: "EMBEDDING_COLUMN",
metadataColumns: ["page", "source"]
}
const vectorStoreInstance = await PostgresVectorStore.initialize(engine, embeddingService, "my-table", pvectorArgs)
PostgresVectorStore interface methods available:
See the full Vector Store tutorial.
Use PostgresChatMessageHistory to store messages and provide conversation history in Postgres.
First, initialize the Chat History Table and then create the ChatMessageHistory instance.
// ChatHistory table initialization
await engine.initChatHistoryTable("chat_message_table");
const historyInstance = await PostgresChatMessageHistory.initialize(engine, "test", "chat_message_table");
The create method of the PostgresChatMessageHistory receives the engine, the session Id and the table name.
PostgresChatMessageHistory interface methods available:
See the full Chat Message History tutorial.
Use a document loader to load data as LangChain Documents.
import { PostgresEngine, PostgresLoader } from "@langchain/google-cloud-sql-pg";
const documentLoaderArgs: PostgresLoaderOptions = {
tableName: "test_table_custom",
contentColumns: [ "fruit_name", "variety"],
metadataColumns: ["fruit_id", "quantity_in_stock", "price_per_unit", "organic"],
format: "text"
};
const documentLoaderInstance = await PostgresLoader.initialize(PEInstance, documentLoaderArgs);
const documents = await documentLoaderInstance.load();
See the full Loader tutorial.
FAQs
LangChain.js integrations for Google Cloud SQL for PostgreSQL
The npm package @langchain/google-cloud-sql-pg receives a total of 171 weekly downloads. As such, @langchain/google-cloud-sql-pg popularity was classified as not popular.
We found that @langchain/google-cloud-sql-pg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.