Commit ee72708
committed
feat: Normalize embeddings to unit vectors for better cosine similarity
- Normalize embeddings in EmbeddingService.encode_text()
- Converts embeddings to unit vectors (norm=1.0)
- Improves cosine similarity calculations
- Reduces distance between semantically similar texts
- Should fix high distance issues in ChromaDB retrieval1 parent ffbc8ae commit ee72708
1 file changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
412 | 427 | | |
413 | 428 | | |
414 | | - | |
| 429 | + | |
415 | 430 | | |
416 | 431 | | |
417 | 432 | | |
| |||
0 commit comments