(file: string, startLine: number, embedding: number[])
| 16 | }); |
| 17 | |
| 18 | function chunk(file: string, startLine: number, embedding: number[]): Chunk { |
| 19 | return { file, startLine, endLine: startLine + 29, text: `code in ${file}`, embedding, hash: `${file}:${startLine}` }; |
| 20 | } |
| 21 | |
| 22 | describe('rankChunks', () => { |
| 23 | it('ranks by cosine similarity, best first, capped at topK', () => { |