UNPKG

giga-code

Version:

A personal AI CLI assistant powered by Grok for local development.

45 lines (44 loc) 1.41 kB
import { RAGConfig } from '../utils/rag-config'; export interface CodeChunk { id: string; content: string; filePath: string; type: 'function' | 'class' | 'import' | 'file' | 'comment' | 'interface' | 'type'; name?: string; startLine?: number; endLine?: number; metadata: Record<string, any>; } export interface SearchResult { chunk: CodeChunk; score: number; distance: number; } export declare class RAGService { private genAI; private config; private dbPath; private indexPath; private vectorIndex; constructor(projectPath: string, config?: Partial<RAGConfig>); initialize(): Promise<void>; private loadIndex; private createEmptyIndex; private saveIndex; private truncateText; private generateEmbedding; private createSimpleEmbedding; private cosineSimilarity; indexChunks(chunks: CodeChunk[]): Promise<void>; search(query: string, maxResults?: number): Promise<SearchResult[]>; deleteChunk(chunkId: string): Promise<void>; deleteByFilePath(filePath: string): Promise<void>; getCollectionInfo(): Promise<{ count: number; config: RAGConfig; }>; clearCollection(): Promise<void>; updateConfig(newConfig: Partial<RAGConfig>): void; getConfig(): RAGConfig; static generateChunkId(filePath: string, type: string, name?: string, startLine?: number): string; }