mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Merge 0db1a063f8
into 8790a0df3d
This commit is contained in:
commit
6304799d97
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue