@n8n/n8n-nodes-langchain
Version:
92 lines (87 loc) • 3.4 kB
text/typescript
/**
* Databricks Vector Store Node - Version 1
* Discriminator: mode=load
*/
interface Credentials {
databricksOAuth2Api: CredentialReference;
}
/** Get many ranked documents from vector store for query */
export type LcVectorStoreDatabricksV1LoadParams = {
/**
* One-shot similarity search on the main flow using the `prompt` parameter. Declare with `vectorStore({...})`. Required subnodes: `embedding`. For LLM-driven querying (RAG), use `mode: 'retrieve-as-tool'` instead.
* <patterns>
* <pattern title="load mode — one-shot similarity search (generic)">
* // Substitute the type literal and provider-specific parameters — see the rest of this file.
* const lookup = vectorStore({
* type: '@n8n/n8n-nodes-langchain.vectorStoreXxx',
* config: {
* name: 'Knowledge Base',
* parameters: {
* mode: 'load',
* prompt: expr('{{ $json.query }}'),
* // ...provider-specific parameters
* },
* subnodes: { embedding: embeddingsOpenAi }
* }
* });
* </pattern>
* </patterns>
*/
mode: 'load';
databricksIndex?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
* Column that becomes the document text. Leave empty on a managed-embedding index to use its embedding source column. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.
* @loadOptionsMethod getIndexColumns
*/
contentColumn?: string | Expression<string>;
/**
* Options
* @default {}
*/
options?: {
/** Columns to return in document metadata. Defaults to all columns except the key, content and vector columns. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.
* @loadOptionsMethod getIndexColumns
* @default []
*/
metadataColumns?: string[];
/** Vector ranks purely by semantic similarity. Hybrid adds keyword matching on top, using the search text. Sent as query_type ANN or HYBRID.
* @default ANN
*/
searchMode?: 'ANN' | 'HYBRID' | Expression<string>;
/** Restrict results to rows matching this metadata condition, for example {"source": "handbook"}. Sent as filters_json. Works on STANDARD endpoints only.
* @default {}
*/
searchFilterJson?: IDataObject | string | Expression<string>;
};
/**
* Search prompt to retrieve matching documents from the vector store using similarity-based ranking
*/
prompt: string | Expression<string>;
/**
* Number of top results to fetch from vector store
* @default 4
*/
topK?: number | Expression<number>;
/**
* Whether or not to include document metadata
* @default true
*/
includeDocumentMetadata?: boolean | Expression<boolean>;
/**
* Whether or not to rerank results
* @default false
*/
useReranker?: boolean | Expression<boolean>;
};
export interface LcVectorStoreDatabricksV1LoadSubnodeConfig {
embedding: EmbeddingInstance | EmbeddingInstance[];
/**
* @displayOptions.show { useReranker: [true] }
*/
reranker: RerankerInstance;
}
export type LcVectorStoreDatabricksV1LoadNode = {
type: '@n8n/n8n-nodes-langchain.vectorStoreDatabricks';
version: 1;
config: NodeConfig<LcVectorStoreDatabricksV1LoadParams> & { credentials?: Credentials } & { subnodes: LcVectorStoreDatabricksV1LoadSubnodeConfig };
};