UNPKG

@n8n/n8n-nodes-langchain

Version:
104 lines (99 loc) 3.37 kB
/** * Postgres PGVector Store Node - Version 1 * Discriminator: mode=insert */ interface Credentials { postgres: CredentialReference; } /** Insert documents into vector store */ export type LcVectorStorePGVectorV1InsertParams = { /** * Sits on the main flow — pipe the documents you want to embed into this node. Declare with `vectorStore({...})`. Required subnodes: `embedding` and `documentLoader`. If the goal is letting an LLM query the store, use `mode: 'retrieve-as-tool'` instead. * <patterns> * <pattern title="insert mode — upsert documents (generic, works for any vectorStore* node)"> * // Substitute the type literal and provider-specific parameters (e.g. pineconeIndex, * // qdrantCollection, supabaseTableName) — see the rest of this file for the exact shape. * const store = vectorStore({ * type: '@n8n/n8n-nodes-langchain.vectorStoreXxx', * config: { * name: 'Knowledge Base', * parameters: { * mode: 'insert', * // ...provider-specific parameters * }, * subnodes: { embedding: embeddingsOpenAi, documentLoader: defaultDataLoader } * } * }); * </pattern> * </patterns> */ mode: 'insert'; /** * The table name to store the vectors in. If table does not exist, it will be created. * @default n8n_vectors */ tableName?: string | Expression<string>; /** * Options * @default {} */ options?: { /** Collection of vectors * @default {"values":{"useCollection":false,"collectionName":"n8n","collectionTable":"n8n_vector_collections"}} */ collection?: { /** Collection Settings */ values?: { /** Use Collection * @default false */ useCollection?: boolean | Expression<boolean>; /** Collection Name * @displayOptions.show { useCollection: [true] } * @default n8n */ collectionName?: string | Expression<string>; /** Collection Table Name * @displayOptions.show { useCollection: [true] } * @default n8n_vector_collections */ collectionTableName?: string | Expression<string>; }; }; /** The names of the columns in the PGVector table * @default {"values":{"idColumnName":"id","vectorColumnName":"embedding","contentColumnName":"text","metadataColumnName":"metadata"}} */ columnNames?: { /** Column Name Settings */ values?: { /** ID Column Name * @default id */ idColumnName?: string | Expression<string>; /** Vector Column Name * @default embedding */ vectorColumnName?: string | Expression<string>; /** Content Column Name * @default text */ contentColumnName?: string | Expression<string>; /** Metadata Column Name * @default metadata */ metadataColumnName?: string | Expression<string>; }; }; }; }; export interface LcVectorStorePGVectorV1InsertSubnodeConfig { embedding: EmbeddingInstance | EmbeddingInstance[]; documentLoader: DocumentLoaderInstance | DocumentLoaderInstance[]; } export type LcVectorStorePGVectorV1InsertNode = { type: '@n8n/n8n-nodes-langchain.vectorStorePGVector'; version: 1; config: NodeConfig<LcVectorStorePGVectorV1InsertParams> & { credentials?: Credentials } & { subnodes: LcVectorStorePGVectorV1InsertSubnodeConfig }; };