@n8n/n8n-nodes-langchain
Version:
76 lines (71 loc) • 2.69 kB
text/typescript
/**
* Qdrant Vector Store Node - Version 1
* Discriminator: mode=retrieve
*/
interface Credentials {
qdrantApi: CredentialReference;
}
/** Retrieve documents from vector store to be used as vector store with AI nodes */
export type LcVectorStoreQdrantV1RetrieveParams = {
/**
* Exposes the store as an `ai_vectorStore` subnode for another node (e.g. `toolVectorStore`). Declare with `vectorStore({...})`. Required subnodes: `embedding`. For RAG with an AI Agent directly, prefer `mode: 'retrieve-as-tool'`.
* <patterns>
* <pattern title="retrieve mode — feed another node as a subnode (generic)">
* // Substitute the type literal and provider-specific parameters — see the rest of this file.
* const store = vectorStore({
* type: '@n8n/n8n-nodes-langchain.vectorStoreXxx',
* config: {
* name: 'Knowledge Base',
* parameters: { mode: 'retrieve' /* + provider-specific parameters *\/ },
* subnodes: { embedding: embeddingsOpenAi }
* }
* });
*
* const retrieverTool = tool({
* type: '@n8n/n8n-nodes-langchain.toolVectorStore',
* config: {
* name: 'KB Retriever',
* parameters: { description: 'Search the product knowledge base' },
* subnodes: { vectorStore: store, model: openAiModel }
* }
* });
* </pattern>
* </patterns>
*/
mode: 'retrieve';
qdrantCollection?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
* Whether or not to rerank results
* @default false
*/
useReranker?: boolean | Expression<boolean>;
/**
* Options
* @default {}
*/
options?: {
/** Filter pageContent or metadata using this <a href="https://qdrant.tech/documentation/concepts/filtering/" target="_blank">filtering syntax</a>
*/
searchFilterJson?: IDataObject | string | Expression<string>;
/** The key to use for the content payload in Qdrant. Default is "content".
* @default content
*/
contentPayloadKey?: string | Expression<string>;
/** The key to use for the metadata payload in Qdrant. Default is "metadata".
* @default metadata
*/
metadataPayloadKey?: string | Expression<string>;
};
};
export interface LcVectorStoreQdrantV1RetrieveSubnodeConfig {
embedding: EmbeddingInstance | EmbeddingInstance[];
/**
* @displayOptions.show { useReranker: [true] }
*/
reranker: RerankerInstance;
}
export type LcVectorStoreQdrantV1RetrieveNode = {
type: '@n8n/n8n-nodes-langchain.vectorStoreQdrant';
version: 1;
config: NodeConfig<LcVectorStoreQdrantV1RetrieveParams> & { credentials?: Credentials } & { subnodes: LcVectorStoreQdrantV1RetrieveSubnodeConfig };
};