@n8n/n8n-nodes-langchain
Version:
80 lines (75 loc) • 3.19 kB
text/typescript
/**
* Redis Vector Store Node - Version 1.4
* Discriminator: mode=insert
*/
interface Credentials {
redis: CredentialReference;
}
/** Insert documents into vector store */
export type LcVectorStoreRedisV14InsertParams = {
/**
* 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';
redisIndex?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
* Number of documents to embed in a single batch
* @default 200
*/
embeddingBatchSize?: number | Expression<number>;
/**
* Options
* @default {}
*/
options?: {
/** Prefix for Redis keys storing the documents
*/
keyPrefix?: string | Expression<string>;
/** Whether existing documents and the index should be overwritten
* @default false
*/
overwriteDocuments?: boolean | Expression<boolean>;
/** The hash key to be used to store the metadata of the document
*/
metadataKey?: string | Expression<string>;
/** JSON array defining metadata field types for indexing. If not provided, schema will be inferred from documents. Example: <code>[{"name": "category", "type": "tag"}, {"name": "price", "type": "numeric", "options": {"sortable": true}}]</code>
* @hint Learn more about metadata schema configuration <a target="_blank" href="https://docs.langchain.com/oss/javascript/integrations/vectorstores/redis#advanced-features">here</a>
*/
metadataSchema?: string | Expression<string>;
/** The hash key to be used to store the content of the document
*/
contentKey?: string | Expression<string>;
/** The hash key to be used to store the embedding of the document
*/
vectorKey?: string | Expression<string>;
/** Time-to-live for the documents in seconds
*/
ttl?: number | Expression<number>;
};
};
export interface LcVectorStoreRedisV14InsertSubnodeConfig {
embedding: EmbeddingInstance | EmbeddingInstance[];
documentLoader: DocumentLoaderInstance | DocumentLoaderInstance[];
}
export type LcVectorStoreRedisV14InsertNode = {
type: '@n8n/n8n-nodes-langchain.vectorStoreRedis';
version: 1.4;
config: NodeConfig<LcVectorStoreRedisV14InsertParams> & { credentials?: Credentials } & { subnodes: LcVectorStoreRedisV14InsertSubnodeConfig };
};