This commit is contained in:
Luis 2025-03-05 11:22:59 +01:00 committed by GitHub
commit 6304799d97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@ import type { Embeddings } from '@langchain/core/embeddings';
import type { VectorStore } from '@langchain/core/vectorstores'; import type { VectorStore } from '@langchain/core/vectorstores';
import { DynamicTool } from 'langchain/tools'; import { DynamicTool } from 'langchain/tools';
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow'; import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
import { PGVectorStore } from '@langchain/community/vectorstores/pgvector';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
INodeCredentialDescription, INodeCredentialDescription,
@ -481,7 +482,14 @@ export const createVectorStoreNode = <T extends VectorStore = VectorStore>(
if (mode === 'retrieve') { if (mode === 'retrieve') {
const vectorStore = await args.getVectorStoreClient(this, filter, embeddings, itemIndex); const vectorStore = await args.getVectorStoreClient(this, filter, embeddings, itemIndex);
async function closeFunction() {
const pgVectorStore = vectorStore as PGVectorStore;
void pgVectorStore?.client?.release();
}
return { return {
closeFunction,
response: logWrapper(vectorStore, this), response: logWrapper(vectorStore, this),
closeFunction: async () => { closeFunction: async () => {
args.releaseVectorStoreClient?.(vectorStore); args.releaseVectorStoreClient?.(vectorStore);