@hpbyte/h-codex-core
Version:
Core indexing and search functionality for h-codex
75 lines (74 loc) • 2.35 kB
TypeScript
import type { CodeChunk, CodeChunkInsert, SearchOptions } from '../types';
export declare class ChunkEmbeddingsRepository {
insertCodeChunks(chunks: CodeChunkInsert[]): Promise<{
id: string;
createdAt: Date | null;
updatedAt: Date | null;
projectId: string;
content: string;
filePath: string;
startLine: number;
endLine: number;
nodeType: string;
language: string | null;
hash: string;
size: number;
}[]>;
insertEmbeddings(codeChunks: CodeChunk[], embeddings: number[][]): Promise<{
id: string;
createdAt: Date | null;
chunkId: string;
embedding: number[] | null;
}[]>;
findSimilarChunks(queryEmbedding: number[], options?: SearchOptions): Promise<{
chunk: {
id: string;
projectId: string;
content: string;
filePath: string;
startLine: number;
endLine: number;
nodeType: string;
language: string | null;
hash: string;
size: number;
createdAt: Date | null;
updatedAt: Date | null;
};
similarity: number;
}[]>;
findSimilarChunksWithContext(queryEmbedding: number[], options?: SearchOptions): Promise<{
chunk: {
id: string;
projectId: string;
content: string;
filePath: string;
startLine: number;
endLine: number;
nodeType: string;
language: string | null;
hash: string;
size: number;
createdAt: Date | null;
updatedAt: Date | null;
};
similarity: number;
context: {
id: string;
projectId: string;
content: string;
filePath: string;
startLine: number;
endLine: number;
nodeType: string;
language: string | null;
hash: string;
size: number;
createdAt: Date | null;
updatedAt: Date | null;
}[];
}[]>;
clearChunkEmbeddings(projectId: string): Promise<import("postgres").RowList<never[]>>;
private diversifyResults;
}
export declare const chunkEmbeddingsRepository: ChunkEmbeddingsRepository;