Commit a85d0ad
Feature/optimize ollama batching (#152)
* feat: add metadata output to search results
- Add --show-metadata flag to display file paths in search results
- Preserve document metadata (file_path, file_name, timestamps) during chunking
- Update MCP tool schema to support show_metadata parameter
- Enhance CLI search output to display metadata when requested
- Fix pre-existing bug: args.backend -> args.backend_name
Resolves #144
* fix: resolve ZMQ linking issues in Python extension
- Use pkg_check_modules IMPORTED_TARGET to create PkgConfig::ZMQ
- Set PKG_CONFIG_PATH to prioritize ARM64 Homebrew on Apple Silicon
- Override macOS -undefined dynamic_lookup to force proper symbol resolution
- Use PUBLIC linkage for ZMQ in faiss library for transitive linking
- Mark cppzmq includes as SYSTEM to suppress warnings
Fixes editable install ZMQ symbol errors while maintaining compatibility
across Linux, macOS Intel, and macOS ARM64 platforms.
* style: apply ruff formatting
* chore: update faiss submodule to use ww2283 fork
Use ww2283/faiss fork with fix/zmq-linking branch to resolve CI checkout
failures. The ZMQ linking fixes are not yet merged upstream.
* feat: implement true batch processing for Ollama embeddings
Migrate from deprecated /api/embeddings to modern /api/embed endpoint
which supports batch inputs. This reduces HTTP overhead by sending
32 texts per request instead of making individual API calls.
Changes:
- Update endpoint from /api/embeddings to /api/embed
- Change parameter from 'prompt' (single) to 'input' (array)
- Update response parsing for batch embeddings array
- Increase timeout to 60s for batch processing
- Improve error handling for batch requests
Performance:
- Reduces API calls by 32x (batch size)
- Eliminates HTTP connection overhead per text
- Note: Ollama still processes batch items sequentially internally
Related: #151
* fall back to original faiss as i merge the PR
---------
Co-authored-by: yichuan520030910320 <[email protected]>1 parent dbb5f4d commit a85d0ad
File tree
4 files changed
+126
-64
lines changed- packages
- leann-backend-hnsw
- leann-core/src/leann
4 files changed
+126
-64
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
35 | 48 | | |
36 | 49 | | |
37 | | - | |
| 50 | + | |
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
258 | 263 | | |
259 | 264 | | |
260 | 265 | | |
| |||
1263 | 1268 | | |
1264 | 1269 | | |
1265 | 1270 | | |
1266 | | - | |
| 1271 | + | |
1267 | 1272 | | |
1268 | 1273 | | |
1269 | 1274 | | |
| |||
1274 | 1279 | | |
1275 | 1280 | | |
1276 | 1281 | | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1277 | 1290 | | |
1278 | 1291 | | |
1279 | 1292 | | |
| |||
1285 | 1298 | | |
1286 | 1299 | | |
1287 | 1300 | | |
| 1301 | + | |
1288 | 1302 | | |
1289 | 1303 | | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
1290 | 1316 | | |
1291 | 1317 | | |
1292 | 1318 | | |
1293 | 1319 | | |
1294 | 1320 | | |
1295 | | - | |
1296 | | - | |
1297 | | - | |
1298 | | - | |
| 1321 | + | |
1299 | 1322 | | |
1300 | 1323 | | |
1301 | 1324 | | |
| |||
1370 | 1393 | | |
1371 | 1394 | | |
1372 | 1395 | | |
1373 | | - | |
| 1396 | + | |
1374 | 1397 | | |
1375 | 1398 | | |
1376 | 1399 | | |
| |||
1382 | 1405 | | |
1383 | 1406 | | |
1384 | 1407 | | |
1385 | | - | |
| 1408 | + | |
1386 | 1409 | | |
1387 | 1410 | | |
1388 | 1411 | | |
| |||
1393 | 1416 | | |
1394 | 1417 | | |
1395 | 1418 | | |
1396 | | - | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
| 1419 | + | |
| 1420 | + | |
1400 | 1421 | | |
1401 | 1422 | | |
1402 | 1423 | | |
| |||
1517 | 1538 | | |
1518 | 1539 | | |
1519 | 1540 | | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
1520 | 1558 | | |
1521 | 1559 | | |
1522 | 1560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
578 | 578 | | |
579 | | - | |
| 579 | + | |
| 580 | + | |
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
| |||
681 | 682 | | |
682 | 683 | | |
683 | 684 | | |
684 | | - | |
| 685 | + | |
685 | 686 | | |
686 | 687 | | |
687 | | - | |
688 | | - | |
| 688 | + | |
| 689 | + | |
689 | 690 | | |
690 | 691 | | |
691 | 692 | | |
| |||
717 | 718 | | |
718 | 719 | | |
719 | 720 | | |
720 | | - | |
| 721 | + | |
721 | 722 | | |
722 | 723 | | |
723 | | - | |
724 | | - | |
725 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
726 | 727 | | |
727 | | - | |
728 | | - | |
729 | | - | |
| 728 | + | |
| 729 | + | |
730 | 730 | | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
741 | 743 | | |
742 | | - | |
743 | | - | |
| 744 | + | |
| 745 | + | |
744 | 746 | | |
745 | | - | |
746 | | - | |
| 747 | + | |
| 748 | + | |
747 | 749 | | |
748 | | - | |
749 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
750 | 756 | | |
751 | | - | |
752 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
753 | 762 | | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
761 | 768 | | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
| 769 | + | |
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
787 | | - | |
| 787 | + | |
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
802 | 806 | | |
803 | 807 | | |
804 | 808 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| 112 | + | |
| 113 | + | |
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
| |||
0 commit comments