UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

54 lines (53 loc) 1.71 kB
/** * Base Chunker * * Abstract base class for all chunker implementations. * Provides common functionality and interface contract. */ import type { Chunk, Chunker, ChunkerConfig, ChunkingStrategy } from "../../types/index.js"; /** * Default chunker configuration */ export declare const DEFAULT_CHUNKER_CONFIG: ChunkerConfig; /** * Base Chunker abstract class * * All chunker implementations should extend this class. */ export declare abstract class BaseChunker implements Chunker { abstract readonly strategy: ChunkingStrategy; protected config: ChunkerConfig; constructor(config?: ChunkerConfig); /** * Get default configuration for this chunker */ getDefaultConfig(): ChunkerConfig; /** * Validate chunker configuration */ protected validateConfig(): void; /** * Chunk content into smaller pieces */ chunk(content: string, config?: ChunkerConfig): Promise<Chunk[]>; /** * Perform the actual chunking (to be implemented by subclasses) */ protected abstract doChunk(content: string, config: ChunkerConfig): Promise<Chunk[]>; /** * Filter chunks based on minimum size */ protected filterChunks(chunks: Chunk[], config: ChunkerConfig): Chunk[]; /** * Create a chunk object */ protected createChunk(text: string, chunkIndex: number, startPosition: number, endPosition: number, documentId?: string, customMetadata?: Record<string, unknown>): Chunk; /** * Split content by size with overlap */ protected splitBySizeWithOverlap(content: string, maxSize: number, overlap: number): Array<{ text: string; start: number; end: number; }>; }