@n8n/n8n-nodes-langchain
Version:
73 lines (68 loc) • 2.47 kB
text/typescript
/**
* MongoDB Atlas Vector Store Node - Version 1
* Discriminator: mode=insert
*/
interface Credentials {
mongoDb: CredentialReference;
}
/** Insert documents into vector store */
export type LcVectorStoreMongoDBAtlasV1InsertParams = {
/**
* 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';
mongoCollection?: { __rl: true; mode: 'list' | 'name'; value: string; cachedResultName?: string };
/**
* The field with the embedding array
* @default embedding
*/
embedding?: string | Expression<string>;
/**
* The text field of the raw data
* @default text
*/
metadata_field?: string | Expression<string>;
/**
* The name of the vector index
*/
vectorIndexName: string | Expression<string>;
/**
* Options
* @default {}
*/
options?: {
/** Whether to clear documents in the namespace before inserting new data
* @default false
*/
clearNamespace?: boolean | Expression<boolean>;
/** Logical partition for documents. Uses metadata.namespace field for filtering.
*/
namespace?: string | Expression<string>;
};
};
export interface LcVectorStoreMongoDBAtlasV1InsertSubnodeConfig {
embedding: EmbeddingInstance | EmbeddingInstance[];
documentLoader: DocumentLoaderInstance | DocumentLoaderInstance[];
}
export type LcVectorStoreMongoDBAtlasV1InsertNode = {
type: '@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas';
version: 1;
config: NodeConfig<LcVectorStoreMongoDBAtlasV1InsertParams> & { credentials?: Credentials } & { subnodes: LcVectorStoreMongoDBAtlasV1InsertSubnodeConfig };
};