n8n-nodes-rag
Version:
Advanced RAG (Retrieval-Augmented Generation) knowledge base nodes for n8n
54 lines (53 loc) • 1.3 kB
TypeScript
export interface ITextChunk {
id: string;
text: string;
metadata: Record<string, any>;
embedding?: number[];
source?: string;
index?: number;
}
export interface IProcessingOptions {
cleanText: boolean;
removeExtraWhitespace: boolean;
removeEmptyLines: boolean;
normalizeLineBreaks: boolean;
trimText: boolean;
}
export interface IChunkingOptions {
strategy: 'fixed' | 'sentence' | 'paragraph' | 'semantic';
chunkSize: number;
overlap: number;
preserveStructure: boolean;
separators?: string[];
}
export interface IEmbeddingOptions {
enabled: boolean;
provider?: 'openai' | 'huggingface' | 'custom';
model?: string;
apiKey?: string;
endpoint?: string;
dimensions?: number;
}
export interface IVectorStoreConfig {
provider: string;
endpoint?: string;
apiKey?: string;
collection?: string;
database?: string;
options?: Record<string, any>;
}
export interface ISearchOptions {
type: 'vector' | 'fulltext' | 'hybrid';
limit: number;
threshold?: number;
alpha?: number;
includeMetadata: boolean;
filter?: Record<string, any>;
}
export interface ISearchResult {
id: string;
text: string;
score: number;
metadata: Record<string, any>;
source?: string;
}