Compare commits

...

717 Commits

Author SHA1 Message Date
github-actions[bot] c2a345ebb1 Release 0.9.0 (#1643)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-13 17:34:06 +07:00
Marcus Schiesser d3fa729a30 Cleanups before 0.9 release (#1656) 2025-02-13 17:26:22 +07:00
Thuc Pham c7c08005ec fix: fumadoc build fail (#1655) 2025-02-13 16:24:28 +07:00
Alex Yang bb0ae5e321 chore: fix pkg.pr.new issue (#1651) 2025-02-12 21:19:29 +08:00
Marcus Schiesser f4588bc770 chore: Remove readers package from llamaindex (#1649) 2025-02-12 17:16:41 +07:00
Marcus Schiesser b49037612d remove service context (#1618)
Co-authored-by: thucpn <thucsh2@gmail.com>
2025-02-12 15:10:11 +07:00
Thuc Pham a87efb91a4 docs: update chat engine docs (#1648) 2025-02-12 12:45:26 +07:00
Thuc Pham 6a4a73760b chore: remove re-exporting packages in llamaindex (#1624)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-12 12:44:52 +07:00
Alex Yang 1564831158 ci: fix pkg-pr-new release (#1646) 2025-02-11 22:42:42 +08:00
Alex Yang 4d94f6e50d test: smoke test with cjs/esm dual package (#1644) 2025-02-11 15:02:06 +08:00
Thuc Pham 7bd5d9340c docs: update workflow doc (#1637)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-11 13:41:11 +07:00
Thuc Pham d924c63162 feat: asChatEngine function for index (#1640) 2025-02-11 12:57:15 +07:00
github-actions[bot] 83cff1277c Release 0.8.37 (#1642)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-11 12:48:58 +07:00
Marcus Schiesser 1c908fd852 Revert "fix: bundle output incorrect (#1638)" (#1641) 2025-02-11 12:27:11 +07:00
github-actions[bot] 56f367f08d Release 0.8.36 (#1639)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <14026360+himself65@users.noreply.github.com>
2025-02-10 21:49:19 +08:00
Alex Yang cb608b5d01 fix: bundle output incorrect (#1638) 2025-02-10 21:30:36 +08:00
github-actions[bot] bd55bcffff Release 0.8.35 (#1633)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-10 16:45:42 +07:00
Thuc Pham 6d4d96f8fe chore: update import to workspace pages for examples and docs (#1626)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-10 15:43:29 +07:00
Thuc Pham b6ea2bf964 fix(gemini): use function role for message contains tool-result (#1634) 2025-02-10 12:57:45 +07:00
Parham Saidi 15563a0f70 fix: delete temp competely from params when calling openai o3 (#1629) 2025-02-10 11:07:21 +07:00
github-actions[bot] bd940d1d43 Release 0.8.34 (#1630)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-07 16:02:27 +07:00
Thuc Pham 9f8ad37b79 fix: missing peer deps in llamaindex (#1631) 2025-02-07 15:06:41 +07:00
Peter Goldstein 7265f74c24 Add reasoning_effort for o1 and o3 (#1628) 2025-02-07 12:01:48 +07:00
github-actions[bot] e3f1b85846 Release 0.8.33 (#1619)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-06 15:53:47 +07:00
Peter Goldstein e38e474f86 Add Gemini 2.0 models (#1625) 2025-02-06 15:41:20 +07:00
Parham Saidi 2019a041f7 fix: o3 calls do not support temperature param (#1622) 2025-02-06 10:23:23 +07:00
Thuc Pham 067a4894fe fix: missing condition to stringify tool input (#1620) 2025-02-05 17:25:37 +07:00
clean99 21769c8ad9 Fix: update deprecated response property in examples (#1614)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-05 11:28:32 +07:00
github-actions[bot] 89ea1e1d31 Release 0.8.32 (#1595)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-04 12:23:47 +07:00
siquick d9bbaf95f3 chore: updated docs and examples to use correct PGVectorStore imports (#1611)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-04 11:18:39 +07:00
Marcus Schiesser 8744796c06 update the versioon of chromadb client (#1616)
Co-authored-by: my8bit <mail@my8bit.name>
2025-02-04 10:58:04 +07:00
Ihor Pavlenko f02621e379 fix: doc links (#1610) 2025-02-04 10:46:04 +07:00
Peter Goldstein 1892e1ce1d Add O3 mini model (#1612) 2025-02-04 10:34:22 +07:00
dependabot[bot] d90d8959a5 chore(deps-dev): bump vite from 5.4.11 to 5.4.12 (#1604)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-04 10:33:18 +07:00
Thuc Pham 4df1fe6cca chore: migrate llamaindex llms and embeddings to their own packages (#1615) 2025-02-03 17:32:19 +07:00
Thuc Pham 34faf4821a chore: move vector stores to their own packages (#1605) 2025-01-24 12:45:13 +07:00
Marcus Schiesser b24ffc6174 fix: pinecone import (#1603) 2025-01-21 12:32:05 +07:00
Thuc Pham 82e25c924c fix: remove ignore package from changeset (#1602) 2025-01-21 12:28:39 +07:00
Thuc Pham 1931bbca74 chore: move azure code to own @llamaindex/azure package (#1601) 2025-01-21 12:14:17 +07:00
Thuc Pham 94566169fb chore: move postgres storage classes to @llamaindex/postgres (#1597) 2025-01-20 12:24:44 +07:00
Alex Yang d6c270ec7a feat(cloud): support pass project and org id to llama parse reader (#1594) 2025-01-08 11:23:48 -08:00
github-actions[bot] e3a77044d5 Release 0.8.31 (#1579)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2025-01-08 10:42:19 -08:00
Alex Yang fd9c8294e1 chore: bump llamacloud openapi (#1592) 2025-01-06 23:12:41 -08:00
Thuc Pham 0ebbfc1031 fix: clean up docstore when generating embedding fail (#1588)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-01-07 11:58:09 +07:00
Alex Yang 5dec9f912a chore: bump sdk deps (#1591) 2025-01-06 17:03:15 -08:00
Alex Yang 1f53819b64 chore: bump version (#1583) 2025-01-02 07:43:17 -08:00
Erik d211b7ab13 add tool call history support in chat messages (#1565) 2024-12-22 19:09:38 -08:00
Thuc Pham 057ee146bd fix: add start command for stackblitz (#1577) 2024-12-20 23:55:33 -08:00
Thuc Pham 4a831b192c fix: docs migration issues (#1576) 2024-12-20 16:42:54 +07:00
Thuc Pham cf29ca1bf8 [WIP] feat: remove legacy docs (#1571) 2024-12-20 15:12:01 +07:00
Wassim Chegham 09b933f8da feat: add Azure AI Vector Search (#1485) 2024-12-18 11:26:53 -06:00
Thuc Pham 44c0734106 feat: migrate legacy docs (#1568) 2024-12-18 02:18:47 -08:00
github-actions[bot] a7023b4a93 Release 0.8.30 (#1570)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-16 11:40:25 -08:00
Alex Yang 012495b5ba chore: bump llamacloud sdk (#1569) 2024-12-16 11:10:09 -08:00
github-actions[bot] a8afb9a7a7 Release 0.8.29 (#1566)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-13 19:19:03 -08:00
Peter Goldstein dd596a0cf2 Add Gemini Flash 2.0 Experimental (#1563) 2024-12-13 12:10:46 -08:00
Alex Yang 9e648a0b4f chore: bump version (#1562) 2024-12-11 12:56:38 -08:00
github-actions[bot] bbb87f42ed Release 0.8.28 (#1559)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-12-11 12:09:46 -08:00
Parham Saidi 24caf93efe fix: added inference profile mapping for nova models (#1560) 2024-12-11 11:17:40 -08:00
Thuc Pham a9b5b993fa feat: build api reference pages for new documentation site (#1551) 2024-12-11 09:21:21 -08:00
github-actions[bot] f369d3de4f Release 0.8.27 (#1545)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-12-11 12:18:21 +07:00
Parham Saidi c1850ee370 feat: Amazon Nova support via Bedrock (#1548) 2024-12-10 18:56:35 -08:00
Marcus Schiesser 086a65141d Add adapter to use Vercel model providers (#1558)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-12-09 21:02:57 -08:00
Qwertic d99d598491 Update typescript.mdx (#1557) 2024-12-09 19:52:15 -08:00
Gunnar Holwerda a0e6f57d9b Pass options through to userWebpack in withLlamaIndex (#1550) 2024-12-09 19:51:52 -08:00
Gunnar Holwerda e0f6cc3be1 fix: return actual source nodes with compact and refine response synt… (#1554) 2024-12-09 11:00:12 -08:00
Jingyi Zhao 8386510d86 chore: add e2e working example for ingestion (#1543) 2024-12-04 17:36:00 -08:00
Marcus Schiesser b504303c66 fix: allow Node 18 again to make Stackblitz work (#1544) 2024-12-03 20:57:20 -08:00
Marcus Schiesser cf9a9356e0 fix: discord link (#1542) 2024-12-03 11:16:02 +07:00
github-actions[bot] 335020e242 Release 0.8.26 (#1541)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-12-02 12:23:57 -08:00
Alex Yang 3d1808b5d2 chore: bump version (#1540) 2024-12-02 12:18:51 -08:00
Alex Yang a19cbc7fe0 ci: fix (#1539) 2024-12-02 10:33:44 -08:00
github-actions[bot] b8f0cbc4e0 Release 0.8.25 (#1536)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <marcusschiesser@users.noreply.github.com>
2024-12-02 03:02:36 -08:00
Marcus Schiesser 7e8230b056 fix: release missing readers package (#1537) 2024-12-02 17:54:22 +07:00
Alex Yang 8be45899a7 chore: bump version 2024-12-02 02:21:13 -08:00
github-actions[bot] c4800bcf82 Release @llamaindex/vercel@0.0.2 (#1535) 2024-12-02 14:19:40 +07:00
Thuc Pham fd38a253b7 feat: add vercel chat example (#1532)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-12-02 13:56:28 +07:00
github-actions[bot] 510191cb5d Release 0.8.24 (#1531)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-30 06:05:47 -08:00
Jingyi Zhao 7934ade092 fix: add obsidian reader to index (#1533) 2024-11-30 01:29:45 -08:00
Jingyi Zhao a6c1eab762 feat: data connector for obsidian note taking app (#1529) 2024-11-29 22:39:59 -08:00
crisjy 515f2c1e3d feat: add AzureCosmosDBMongoVectorStore (#1528) 2024-11-28 17:53:09 -08:00
github-actions[bot] dc85649ead Release 0.8.23 (#1526)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-26 17:41:29 -08:00
Alex Yang d2b2722a30 fix: switch tokenizer in cloudflare (#1525) 2024-11-26 15:42:20 -08:00
github-actions[bot] a2bbd62399 Release 0.8.22 (#1520)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-21 23:17:45 -08:00
Alex Yang 969365ca0a feat: add cloudflare worker full example (#1521) 2024-11-21 23:05:40 -08:00
fatmelon 819af453d6 feat: add Azure CosmosDB Mongo vCore Chat store (#1516)
Co-authored-by: root <root@CPC-yangq-FRSGK>
2024-11-21 21:25:41 -08:00
github-actions[bot] 9db36f7384 Release 0.8.21 (#1513)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-19 18:18:35 -08:00
fatmelon efa221116f feat: integrate with azure cosmos db mongo vCore (#1500)
Co-authored-by: root <root@CPC-yangq-FRSGK>
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-19 17:58:25 -08:00
Alex Yang 83c3897539 fix: pinecone vector store (#1512) 2024-11-19 17:51:45 -08:00
github-actions[bot] e1cbce1f80 Release 0.8.20 (#1511)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-19 10:01:18 -08:00
Madarco 02b22da384 fix: supports vercel bundling (#1509)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-19 09:52:56 -08:00
github-actions[bot] 0aa61db547 Release 0.8.19 (#1507)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-19 00:01:48 -08:00
Alex Yang 90d265cf47 chore: bump version (#1505) 2024-11-18 18:39:13 -08:00
github-actions[bot] fc2d5ea1cd Release 0.8.18 (#1506)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-18 13:08:32 -08:00
Thuc Pham ef4f63d9f4 refactor: move mockLLM to core (#1493)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-18 11:39:46 -08:00
Thuc Pham d17450fdfb fix: next.js 15 compatibility (#1474)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-18 11:34:05 -08:00
github-actions[bot] 805d2b0d55 Release 0.8.17 (#1504)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-18 10:28:15 -08:00
Marcus Schiesser 6d22fa2a50 feat: Get PromptTemplate template variables at run-time (#1502) 2024-11-18 09:34:26 -08:00
Aman Rao 16f0068175 chore: update azure cosmos db no sql vector store (#1503) 2024-11-18 09:33:20 -08:00
github-actions[bot] 1054c3382a Release 0.8.16 (#1499)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-17 22:28:02 -08:00
Alex Yang e60328b086 fix: import error in cjs (#1498) 2024-11-17 22:24:09 -08:00
Laurie Voss 3371dfb89f Syncing footer to match main site (#1496) 2024-11-16 00:43:44 -08:00
github-actions[bot] 2065a16a07 Release 0.8.15 (#1494)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-15 11:27:52 -08:00
Wassim Chegham 5dae534f8d fix: propagate queryStr to concrete vectorStore (#1495)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-15 11:16:32 -08:00
Aman Rao 3d503cb810 chore: update azure cosmos db (#1484)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-15 00:55:32 -08:00
Thuc Pham daf8522bec feat: use mock llm (#1492) 2024-11-15 14:50:49 +08:00
github-actions[bot] 223f3136b4 Release 0.8.14 (#1491)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-14 21:49:37 -08:00
Thuc Pham c6bad7d951 docs(next): chat UI with rsc example (#1481)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-11-14 21:33:30 -08:00
Aman Rao 630b425545 feat: add Azure CosmosDB NoSql Chat store (#1490)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-14 21:30:55 -08:00
github-actions[bot] 4c7b891446 Release 0.8.13 (#1480)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-11-14 18:25:19 -08:00
Alex Yang a9c5b4899b docs: update docusaurus.config.js (#1489) 2024-11-14 17:36:52 -08:00
Alex Yang a7b0ac3cb7 feat(anthropic): support prompt caching (#1488) 2024-11-14 17:35:21 -08:00
Alex Yang a7540ff47b docs: update (#1486) 2024-11-14 15:46:48 -08:00
Aman Rao c69605f406 feat: add async support to BaseChatStore and BaseChatStoreMemory (#1483)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-14 13:45:50 -08:00
Alex Yang ee20c44d9b feat(workflow): allow send event with no output (#1479) 2024-11-14 00:17:53 -08:00
Alex Yang 1d470363df docs: add banner for legacy (#1478) 2024-11-13 18:16:13 -08:00
github-actions[bot] b39f40dbd8 Release (#1477)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-11-13 01:25:40 -08:00
Alex Yang fadc8b8ea0 feat: recoverable data with error handling (#1476) 2024-11-13 01:15:50 -08:00
Alex Yang ea92b6986d chore: update changeset 2024-11-13 01:15:28 -08:00
Alex Yang 17f9022d22 fix: output event check (#1475) 2024-11-13 00:46:35 -08:00
github-actions[bot] 14792cd8b4 Release 0.8.12 (#1473)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-12 16:20:25 -08:00
Alex Yang 7ae6eaa0a2 chore: update changeset 2024-11-12 12:49:17 -08:00
Alex Yang dbb5bd9f23 feat: allow tool_choice for OpenAIAgent (#1472) 2024-11-12 12:46:57 -08:00
github-actions[bot] aacd606204 Release 0.8.11 (#1471)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-12 11:49:22 -08:00
Alex Yang f865c984d3 feat: async get message on chat store (#1470) 2024-11-12 10:59:44 -08:00
github-actions[bot] 7b10882d06 Release 0.8.10 (#1466)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-11-11 14:19:46 -08:00
Alex Yang f066e50482 feat: vllm support (#1468) 2024-11-11 13:14:08 -08:00
Alex Yang fd8c882792 refactor: migrate example to new workflow API (#1467) 2024-11-11 12:03:38 -08:00
Alex Yang d89ebe0261 chore: update changeset 2024-11-11 10:11:04 -08:00
Alex Yang 968feb32cd feat: better input type for function tool with zod (#1464) 2024-11-11 10:10:03 -08:00
Alex Yang 43f6f56c5b docs(next): fix turbo.json (#1465) 2024-11-11 10:07:12 -08:00
github-actions[bot] b2364dc5ba Release 0.8.9 (#1460)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-10 23:32:41 -08:00
Alex Yang 67f4db8501 fix: steaming chat in ollama (#1463) 2024-11-10 23:27:09 -08:00
Alex Yang e4151a8b02 feat: support ollama agent (#1462) 2024-11-10 22:38:40 -08:00
Alex Yang 4d4cd8ac6b feat: support ollama tool call (#1461) 2024-11-10 20:46:46 -08:00
Alex Yang 4fc001c8de chore: bump @huggingface/transformers (#1459) 2024-11-10 20:14:44 -08:00
Alex Yang cf675bdc7a chore: bump version (#1458) 2024-11-10 16:43:45 -08:00
github-actions[bot] 660b831b9e Release 0.8.8 (#1457)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-11-08 23:56:46 -08:00
Alex Yang ad85bd0b46 fix: agent streaming final message & async local storage (#1456) 2024-11-08 22:54:13 -08:00
Alex Yang 18ec1f2f61 chore: separate tokenizers (#1454) 2024-11-08 18:53:05 -08:00
Alex Yang b0fbd8b5c8 docs: update CONTRIBUTING.md (#1455) 2024-11-08 18:38:26 -08:00
github-actions[bot] c0dfc8c641 Release 0.8.7 (#1453)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-08 17:57:02 -08:00
Alex Yang a8d3fa68a1 fix: exports in package.json (#1452) 2024-11-08 16:51:21 -08:00
github-actions[bot] f9470c470a Release 0.8.6 (#1450)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-08 14:57:13 -08:00
Alex Yang 95a5cc6ee1 refactor: move storage into core (#1451) 2024-11-08 14:29:08 -08:00
Peter Goldstein 487782cd98 fix: add missing inference endpoints for the Haiku 3.5 models (#1448) 2024-11-07 20:12:34 -08:00
Alex Yang 58e65d399e refactor: move e2e top level (#1449) 2024-11-07 20:11:15 -08:00
github-actions[bot] fdad3d66ac Release 0.8.5 (#1446)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-07 15:57:54 -08:00
Rozstone a6db5dd29b feat: add baseUrl and timeout option in cohere rerank (#1445)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-07 15:13:13 -08:00
Laurie Voss 7b684c4480 docs: home page tweaks (#1447) 2024-11-07 15:12:54 -08:00
Alex Yang c66868a98a chore: fix turbo cache 2024-11-07 15:05:41 -08:00
Alex Yang 14cc9ebe59 chore: move multi-model into single sub module (#1443) 2024-11-07 15:01:17 -08:00
Aman Rao 396b1e1474 feat: integrate with azure cosmos db (#1444)
Co-authored-by: Wassim Chegham <github@wassim.dev>
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-07 14:43:19 -08:00
github-actions[bot] 69f3095424 Release (#1438)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-07 14:30:26 -08:00
Alex Yang dc8bd5ea92 chore: delete .changeset/fresh-dancers-refuse.md 2024-11-07 09:49:54 -08:00
Marcus Schiesser 4af9a77d8b feat: add example using chat-ui components to docs (#1436)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-07 09:44:47 -08:00
Alex Yang 9c1d094455 docs: fix upload llamacloud script 2024-11-07 09:35:30 -08:00
Alex Yang 0a8e3fdbcd docs(next): fix build (#1441) 2024-11-06 15:23:42 -08:00
Alex Yang 1c0e0e1e1d chore: bump version (#1439) 2024-11-06 10:16:18 -08:00
Parham Saidi 47a7c3ea15 feat: added Haiku 3.5 support via Bedrock (#1437) 2024-11-05 13:03:10 -08:00
Alex Yang 898cff0d6a chore: bump pnpm (#1435) 2024-11-04 20:50:15 -08:00
Alex Yang 9df37edef4 fix: remove usage of pnpx (#1434) 2024-11-04 20:38:08 -08:00
github-actions[bot] f86a7a4fa3 Release 0.8.4 (#1432)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-04 14:51:57 -08:00
Aman Rao 35430d3609 feat: add AzureCosmosDBNoSqlVectorStore and SimpleCosmosDBReader (#1331)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-11-04 13:39:39 -08:00
Alex Yang 3c162b2b4a docs: direct to legacy docs (#1431) 2024-11-04 09:54:54 -08:00
github-actions[bot] 5bb4531245 Release 0.8.3 (#1427)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-02 19:05:28 -07:00
Alex Yang 2ff0a89891 fix: expose @llamaindex/node-parser (#1426) 2024-11-02 18:57:05 -07:00
Alex Yang d57917d782 feat: add code splitter and html node parser (#1425) 2024-11-02 15:14:03 -07:00
github-actions[bot] f231e0739f Release (#1424)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-11-01 16:50:36 -07:00
Alex Yang 0765742ef3 feat: revamped workflow (#1422) 2024-11-01 15:59:19 -07:00
github-actions[bot] ec7fd6be5c Release 0.8.2 (#1421)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-31 23:54:40 -07:00
Thuc Pham c7a918c3f5 fix: export postprocessors in core (#1419) 2024-10-31 23:40:37 -07:00
Marcus Schiesser 00e681d43b ci: run type-check for reader examples 2024-11-01 12:52:06 +07:00
Alex Yang c01502fb84 docs: update document (#1418) 2024-10-31 14:02:31 -07:00
github-actions[bot] 075f88dbc3 Release 0.8.1 (#1415)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-31 11:57:26 -07:00
Alex Yang cc47ee0602 docs: update README.md (#1416) 2024-10-31 11:56:54 -07:00
Alex Yang 5e6ef55a5a chore: drop nodejs 18 support (#1414) 2024-10-31 11:23:29 -07:00
Alex Yang 9c73f0a530 fix(core): async local storage in Setting.with API (#1413) 2024-10-31 11:06:14 -07:00
Alex Yang 52a4d2b83d chore: bump to eslint 9 (#1410) 2024-10-30 18:34:17 -07:00
Alex Yang 0fd78d5434 docs(next): fix update llamacloud (#1409) 2024-10-29 21:47:21 -07:00
github-actions[bot] 5c4f4a8d83 Release 0.8.0 (#1397)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-27 20:36:08 -05:00
Alex Yang 620c63cd19 feat: add @llamaindex/readers package (#1404) 2024-10-27 20:28:55 -05:00
Alex Yang cb51ad90ea docs(next): update document (#1402) 2024-10-27 13:44:55 -05:00
Alex Yang 359fd33041 refactor(core): move ContextChatEngine and SimpleChatEngine (#1401) 2024-10-27 00:39:03 -05:00
Alex Yang efb7e1b868 docs(next): ask ai using llamacloud (#1400) 2024-10-27 00:01:55 -05:00
Erik 98ba1e71bd feat: implement context-aware agent functionality. (#1394)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-10-26 09:23:10 -05:00
Alex Yang fd4b09d375 docs(next): fix shiki theme (#1395) 2024-10-26 08:19:50 -05:00
Alex Yang 7c90e1b6b4 docs(next): update homepage & init setup toturial (#1386) 2024-10-25 18:52:09 -05:00
github-actions[bot] 21ba0a80d1 Release 0.7.10 (#1392)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-24 17:43:00 -07:00
Alex Yang 9df9a8fc1d fix: export all huggingface module (#1390) 2024-10-24 15:55:58 -07:00
Alex Yang 60b185ff53 fix: source nodes is empty (#1391) 2024-10-24 15:55:45 -07:00
github-actions[bot] ca75c81bc0 Release 0.7.9 (#1388)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-24 12:32:24 -07:00
Alex Yang 691c5bcaf1 fix: export embeddings utils (#1387) 2024-10-24 12:23:57 -07:00
Alex Yang 9ab998c5d5 chore: add bug report template (#1385) 2024-10-24 11:37:04 -07:00
github-actions[bot] 938b417028 Release 0.7.8 (#1384)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-24 10:17:01 -07:00
Alex Yang fa60fc66ae fix(env): no esm shim (#1383) 2024-10-24 10:08:49 -07:00
marcusschiesser 5607ed2fec chore: update lock file 2024-10-24 16:05:41 +07:00
github-actions[bot] f57ad6150e Release 0.7.7 2024-10-24 16:05:41 +07:00
Marcus Schiesser 2486bd8f41 feat: Add files_via_content example for LlamaCloud retrieval 2024-10-24 15:55:08 +07:00
Marcus Schiesser e2a0876ddd fix: Remove chunk size limit for prompt helper (use LLM default) 2024-10-24 15:55:08 +07:00
github-actions[bot] a75d899a57 Release 0.7.6 (#1373)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-24 00:03:09 -07:00
Alex Yang 809a6e7eea docs(next): generate llamacloud api (#1377) 2024-10-24 00:02:59 -07:00
Wassim Chegham da6eb6474b feat: add user-agent to Azure OpenAI LLM and Embedding (#1367) 2024-10-23 20:28:26 -07:00
Alex Yang cd83f8ee4f fix(next-doc): dark mode & create llama preview (#1376) 2024-10-23 19:23:44 -07:00
Thuc Pham 534d5505cb fix: replicate deps warning in nextjs (#1370) 2024-10-23 19:08:04 -07:00
Alex Yang eb87b96518 feat(next-doc): update create llama preview (#1375) 2024-10-23 19:05:21 -07:00
Alex Yang 9510d45046 chore: fix build command 2024-10-23 18:01:09 -07:00
Alex Yang 9b5b012fdf feat: new doc (#1374) 2024-10-23 17:56:59 -07:00
Parham Saidi a5a75f618d feat: added sonnet 3.5 v2 support via bedrock (#1371) 2024-10-23 10:22:06 -07:00
github-actions[bot] 051faddefd Release 0.7.5 (#1368)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-22 22:47:37 -07:00
Thuc Pham 9f22aae57c fix: unable to resolve unpdf in nextjs (#1369) 2024-10-23 11:48:22 +07:00
Marcus Schiesser e9a111d9d3 fix: VectorIndexRetrieverOptions typing (#1366)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-10-22 11:00:07 -07:00
github-actions[bot] bb7622e4d4 Release 0.7.4 (#1365)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-22 00:55:33 -07:00
Alex Yang 06f632b2cb fix(cloud): allow filename in llama parse (#1364) 2024-10-22 00:49:15 -07:00
github-actions[bot] 76b925e62a Release 0.7.3 (#1357)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-20 20:15:51 -07:00
Alex Yang 0493f679a4 fix(core): inline python-format-js (#1356) 2024-10-20 20:07:48 -07:00
github-actions[bot] 0e0a627c9a Release 0.7.2 (#1355)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-20 19:22:59 -07:00
Alex Yang 4ba2cfe7ab fix(env): align export APIs (#1354) 2024-10-20 17:11:09 -07:00
github-actions[bot] c1578a19d9 Release 0.7.1 (#1342)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-20 15:29:19 -07:00
Alex Yang ae49ff4e15 feat: use gpt-tokenizer (#1352) 2024-10-20 15:18:30 -07:00
Alex Yang a75af835a5 chore: fix misc before release (#1351) 2024-10-20 14:34:21 -07:00
Alex Yang 7c7cd34908 fix(pg): allow passing perform setup (#1350) 2024-10-20 14:01:24 -07:00
Alex Yang f651891196 fix: remove internal getImageEmbedModel 2024-10-20 13:21:15 -07:00
Alex Yang 04714c886f chore: move under providers directory (#1349) 2024-10-19 20:19:12 -07:00
Alex Yang cf28574f51 refactor: move clip&huggingface embedding into single package (#1346) 2024-10-19 18:39:52 -07:00
Jason Musgrave 24d065f054 feat: log api response from failed parse jobs (#1348) 2024-10-19 18:39:28 -07:00
Alex Yang b8719586e3 ci: pack all module under packages (#1345) 2024-10-18 17:26:40 -07:00
Alex Yang 07a40aca49 refactor: move llm into single packages (#1344) 2024-10-18 16:12:52 -07:00
Alex Yang 33b562938d refactor: move data-structs module (#1343) 2024-10-18 14:52:39 -07:00
Alex Yang 723b41c23c refactor: move tools into core module (#1316) 2024-10-18 09:45:01 -07:00
Alex Yang 4c38c1be0b fix: do not detect file type in sdk (#1340) 2024-10-18 09:36:01 -07:00
Alex Yang 0dde0ca27f ci: fix pre-release (#1341) 2024-10-17 23:28:58 -07:00
github-actions[bot] f3e0d07f48 Release 0.7.0 (#1337)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-10-17 11:18:29 -07:00
Bruno Bornsztein 1364e8eeed feat: update metadata extractor to use prompt template (#1338) 2024-10-17 11:10:41 -07:00
Bruno Bornsztein 96fc69cc61 feat: use promptTemplate arg correctly. (#1335) 2024-10-16 16:16:03 -07:00
Parham Saidi 3b7736f763 feat: added gemini 002 support (#1336) 2024-10-16 15:52:36 -07:00
Alex Yang a7a7afe66e fix: vector store type (#1334) 2024-10-15 11:53:35 -07:00
github-actions[bot] c646ee2eca Release 0.6.22 (#1333)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-15 11:27:21 +07:00
Marcus Schiesser 5729bd92fd fix: LlamaCloud API calls for ensuring and index and for file uploads (#1332) 2024-10-15 11:21:35 +07:00
github-actions[bot] e0e52cf879 Release 0.6.21 (#1329)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-14 15:36:53 +07:00
Thuc Pham 6f75306c17 feat: support metadata filters for Astra (#1330)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-10-14 15:31:00 +07:00
Thuc Pham 94cb4ad810 feat: ChromaDb metadata filters (#1323)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-10-14 10:21:52 +07:00
github-actions[bot] 1ea4014746 Release 0.6.20 (#1325)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-11 12:55:16 -07:00
Parham Saidi 6a9a7b1458 fix: use init api key for openai embeddings (#1324) 2024-10-11 12:20:20 -07:00
github-actions[bot] 1c168cd531 Release 0.6.19 (#1318)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-10 15:16:02 +07:00
Marcus Schiesser 62cba5236d feat: Add ensureIndex function to LlamaCloudIndex (#1321) 2024-10-10 14:49:12 +07:00
Thuc Pham d265e96420 fix: ignore webpack resolve unpdf for nextjs (#1320)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-10-10 14:22:38 +07:00
Marcus Schiesser d30bbf799f fix: Convert undefined values to null in LlamaCloud filters (#1319) 2024-10-10 12:00:16 +07:00
Marcus Schiesser 53fd00a7c3 fix: getPipelineId in LlamaCloudIndex (#1317) 2024-10-09 17:51:27 +07:00
Thuc Pham 83f2848d47 feat: add test split nodes with UUID (#1315) 2024-10-09 12:34:46 +07:00
github-actions[bot] 313071e9cd Release 0.6.18 (#1310)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-09 12:05:45 +07:00
Marcus Schiesser 5f6782038a Fix that node parsers generate nodes with UUIDs (#1311) 2024-10-09 11:56:02 +07:00
Marcus Schiesser fe08d0451b fix: llamacloud retrieval with multiple pipelines (#1309) 2024-10-09 11:39:55 +07:00
github-actions[bot] 59c5e5c3d4 Release 0.6.17 (#1305)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-07 14:44:04 +07:00
Thuc Pham ee697fb1b3 fix: generate uuid when inserting to Qdrant (#1301) 2024-10-07 14:17:04 +07:00
Alex Yang cf3320a4ea fix: improve getResponseSynthesizer type (#1304) 2024-10-06 19:15:55 -07:00
github-actions[bot] f2ed69f2f8 Release 0.6.16 (#1300)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-06 18:25:11 -07:00
Alex Yang 3489e7de84 fix: num output incorrect in prompt helper (#1303) 2024-10-06 18:19:05 -07:00
Alex Yang 468bda594e fix: correct warning when chunk size smaller than 0 (#1297) 2024-10-04 12:01:10 -07:00
Thuc Pham 6f3a31caf6 feat: add metadata filters for vector stores (#1289) 2024-10-04 14:25:11 +07:00
Thuc Pham 63e9846e97 fix: preFilters doesnot work with asQueryEngine (#1298) 2024-10-04 14:24:01 +07:00
github-actions[bot] b7382b0d24 Release 0.6.15 (#1295)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-03 19:44:55 -07:00
Alex Yang 2a8241328d fix: lazy load openai (#1294) 2024-10-03 17:12:33 -07:00
Alex Yang 0b20ff9f17 fix(cloud): package.json format (#1291) 2024-10-03 17:07:50 -07:00
github-actions[bot] 1fc26046e3 Release 0.6.14 (#1290)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-03 16:35:54 -07:00
LAWG b17d439d6d fix: ensure id_ is correctly passed during creation (#1282)
Co-authored-by: lawrencegb <lawrence@3api.com>
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-10-03 11:52:26 -07:00
github-actions[bot] 040160c360 Release 0.6.13 (#1288)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-02 16:35:52 -07:00
Alex Yang 981811efd1 fix(cloud): llama parse reader save image incorrectly (#1287) 2024-10-02 14:31:03 -07:00
github-actions[bot] d563b45a27 Release (#1286)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-02 09:14:15 -07:00
Parham Saidi 2774e80234 feat: Meta Llama 3.2 via bedrock (#1285) 2024-10-02 08:59:09 -07:00
github-actions[bot] 449274ca5a Release 0.6.12 (#1273)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-30 16:34:14 -07:00
Alex Yang 78037a664c chore: update changelog 2024-09-30 16:13:22 -07:00
Alex Yang 1d9e3b1000 fix: export llama reader in non-nodejs runtime (#1279) 2024-09-30 16:13:07 -07:00
Alex Yang df83e32107 fix: bypass service context embed model (#1280) 2024-09-30 16:02:48 -07:00
Thuc Pham f7b4e94231 feat: add filters for pinecone (#1272) 2024-09-30 17:04:43 +07:00
Marcus Schiesser 4c07a2655d text: add cycle test (#1270) 2024-09-29 23:13:59 -07:00
Marcus Schiesser 5c0c8b2ec4 test: add concurrent test for workflows (#1269) 2024-09-29 22:10:21 -07:00
Emmanuel Ferdman e5e18688a6 fix: update reader reference (#1268)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-09-28 14:44:44 -07:00
github-actions[bot] b6fb10eba8 Release 0.6.11 (#1267)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-27 13:19:52 -07:00
Alex Yang df441e28f4 chore: release for new env package 2024-09-27 12:54:14 -07:00
github-actions[bot] a4e05ec7ab Release 0.6.10 (#1263)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-27 01:51:07 -07:00
irevived1 96f72ad86e fix: openai streaming with token usage and finish_reason (#1265)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-09-26 17:51:59 -07:00
Alex Yang f3556c011c chore: update changeset 2024-09-26 09:36:20 -07:00
Alex Yang ebc510582b feat: support @vercel/postgres (#1262) 2024-09-25 22:39:32 -07:00
Alex Yang f3bfdc29e3 chore: fix changeset 2024-09-25 20:09:37 -07:00
Alex Yang 6cce3b12ea feat: support npm:postgres (#1248) 2024-09-25 19:40:20 -07:00
Alex Yang 0273e9739a chore: fix docs build with turbo (#1260) 2024-09-25 07:32:37 -07:00
Alex Yang 7c8b883448 fix: turbo cache (#1259) 2024-09-25 04:47:01 -07:00
Alex Yang c2bb418542 chore: fix url in package.json (#1258) 2024-09-25 03:52:33 -07:00
Alex Yang ed6acbead0 fix(core): backward support for legacy typescript (#1257) 2024-09-25 03:19:41 -07:00
Alex Yang 976cce40d7 docs: update README.md (#1255) 2024-09-24 15:03:48 -07:00
Alex Yang e4fd4158bb feat: move agent into core (#1254) 2024-09-24 14:55:40 -07:00
Alex Yang 31d5dffcef refactor: move ollama standalone (#1253) 2024-09-24 12:15:50 -07:00
github-actions[bot] d12edee802 Release 0.6.9 (#1252)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-24 10:31:54 -07:00
Alex Yang ac41ed3aae chore: bump cloud sdk version (#1251) 2024-09-24 09:43:45 -07:00
github-actions[bot] d8c1159032 Release 0.6.8 (#1245)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-23 18:41:44 -07:00
Alex Yang c856c5becb revert: stream back to first parameter (#1247) 2024-09-23 18:35:36 -07:00
John Wick 50e6b57be0 feat: add Amazon Bedrock Retriever (#1219)
Co-authored-by: Arnaud JEAN <arnajean@amazon.com>
Co-authored-by: ajohn-wick <ajohnwick@mrwick.org>
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-09-23 15:11:53 -07:00
Alex Yang 8b7fdba544 refactor: move chat engine & retriever into core (#1242) 2024-09-23 13:26:26 -07:00
github-actions[bot] 22ae8d0166 Release 0.6.7 (#1244)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-23 13:25:02 -07:00
Goran 23bcc379a8 fix: add serializer in doc store (#1243)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-09-23 13:11:51 -07:00
github-actions[bot] bdc4bfe7b0 Release 0.6.6 (#1241)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-23 11:54:33 -07:00
Goran 025ffe6b50 fix: update PostgresKVStore constructor params (#1240)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-09-23 10:46:11 -07:00
Cahid Arda Öz a6595747fa feat: add Upstash Vector Store (#1218)
Co-authored-by: ogzhanolguncu <ogzhan11@gmail.com>
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-09-23 10:00:10 -07:00
Marcus Schiesser d902cc3e7e fix: context not working in contextchatengine (#1237) 2024-09-22 15:19:13 -07:00
github-actions[bot] 726eb41359 Release 0.6.5 (#1239)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-20 14:24:23 -07:00
André Mazayev e9714dbfcd feat: update PGVectorStore constructor parameters (#1225)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-09-20 01:34:51 -07:00
Alex Yang a3618e761e chore: fix cache for cloud package (#1236) 2024-09-19 17:48:39 -07:00
github-actions[bot] 24eabe7f35 Release 0.6.4 (#1234)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-19 16:42:39 -07:00
Alex Yang ecfa939ea6 ci: enable remote cache (#1233) 2024-09-19 15:40:34 -07:00
Alex Yang b48bcc3add feat: support custom @xenova/transformers (#1232) 2024-09-19 14:55:23 -07:00
github-actions[bot] fa01fa2051 Release 0.6.3 (#1220)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-09-19 12:38:23 -07:00
Alex Yang fb36eff5e1 fix: use Blob instead of File (#1231) 2024-09-19 12:32:10 -07:00
Alex Yang d24d3d1e8c fix: print warning when llama parse reader has error (#1230) 2024-09-19 09:41:37 -07:00
Aaron Ji 5c4badbcca chore: add 'late_chunking' for Jina embedding (#1223) 2024-09-18 17:38:46 +07:00
Alex Yang 2cd1383dc8 feat: align response-synthesizers & chat-engine module (#1169) 2024-09-17 15:44:44 -07:00
github-actions[bot] 72440c101f Release 0.6.2 (#1217)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-09-16 16:40:33 -07:00
Alex Yang 423d66b07a refactor: chat memory & chat history into core module (#1201) 2024-09-16 16:09:17 -07:00
Alex Yang b42adebd51 fix: get job result in llama parse reader (#1216) 2024-09-16 16:05:47 -07:00
Alex Yang 749b43a3b1 fix: multi model embedding (#1215) 2024-09-16 15:51:24 -07:00
github-actions[bot] 8daaef44ee Release 0.6.1 (#1202)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-09-16 13:08:49 -07:00
Alex Yang ac07e3cbe6 fix: replace instanceof check with .type check (#1214) 2024-09-16 12:46:40 -07:00
Alex Yang 1a6137b323 feat: experimental support for browser (#1213) 2024-09-16 12:11:24 -07:00
Alex Yang 85c2e198a4 feat: llama cloud sdk update (#1206) 2024-09-16 09:29:33 -07:00
Fabian Wimmer 01263c4cfd docs: fix false params (#1211) 2024-09-16 07:55:59 -07:00
Thuc Pham fbd5e0174d refactor: move groq as llm package (#1209) 2024-09-16 17:44:14 +07:00
Marcus Schiesser 70ccb4ae65 feat: allow arbitrary types in workflow's StartEvent and StopEvent (#1210) 2024-09-16 16:31:08 +07:00
Alex Yang 7eb331774d chore: bump typescript (#1205) 2024-09-13 13:18:35 -07:00
Alex Yang 24a3f058a3 chore: update build script (#1204) 2024-09-13 11:44:40 -07:00
Fabian Wimmer 84c28f95f9 docs: restructure, add API references (#1196) 2024-09-13 11:22:37 -07:00
Alex Yang 7af57982fe test: enable dom & edge runtime (#1203) 2024-09-13 10:43:18 -07:00
Aaron Ji 6b70c5408f chore: update JinaEmbedding for v3 release (#1187) 2024-09-13 09:44:43 -07:00
github-actions[bot] 74fc725f37 Release 0.6.0 (#1199)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <marcusschiesser@users.noreply.github.com>
2024-09-13 16:07:16 +07:00
Marcus Schiesser a0a74aed60 fix: release openai package (#1200) 2024-09-13 16:01:00 +07:00
Marcus Schiesser 11feef8c82 Add workflows (#1188)
Co-authored-by: Thuc Pham <51660321+thucpn@users.noreply.github.com>
2024-09-13 15:46:02 +07:00
github-actions[bot] 9c5ff164ac Release 0.5.27 (#1195)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-12 13:47:11 -07:00
Alex Yang 7edeb1c2d7 feat: decouple openai from llamaindex module (#1194) 2024-09-12 13:36:08 -07:00
github-actions[bot] 8b95abdc85 Release 0.5.26 (#1193)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-12 11:38:07 -07:00
Alex Yang ffe0cd1ef1 chore: update changelog 2024-09-12 11:33:32 -07:00
Alex Yang 5d2111a19f feat: init support openai o1 model (#1192) 2024-09-12 11:31:05 -07:00
Alex Yang 68ac7fd57f ci: fix syntax (#1186) 2024-09-11 16:54:39 -07:00
Alex Yang 7320d96a36 fix: waku build (#1185) 2024-09-11 15:36:39 -07:00
Goran ee17fb475b feat: add PostgreSQL storage (#1180) 2024-09-11 12:31:04 -07:00
github-actions[bot] 28b877e31f Release 0.5.25 (#1182)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-11 12:08:39 -07:00
Alex Yang 4389b80a52 docs: update README.md (#1183) 2024-09-11 11:07:00 -07:00
Alex Yang d3bc663951 fix: vector store cleanup (#1175) 2024-09-11 10:20:55 -07:00
Kieran Simkin 4810364788 fix: handle RouterQueryEngine with string query (#1181) 2024-09-11 10:19:59 -07:00
github-actions[bot] 2dcad52dd9 Release 0.5.24 (#1178)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-10 23:48:51 -07:00
Alex Yang 0bf8d80b12 fix: llama cloud api build 2024-09-10 23:39:58 -07:00
github-actions[bot] e4bba02aec Release 0.5.23 (#1174)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-10 11:41:49 -07:00
Alex Yang 1caa0da657 chore: fix changeset 2024-09-10 11:34:07 -07:00
Alex Yang 711c814bb2 fix: patch python-format-js (#1173) 2024-09-10 09:49:36 -07:00
Alex Yang 5b832eb927 fix: strict type check (#1170) 2024-09-10 09:28:44 -07:00
Alex Yang 49988431f6 refactor: move settings.llm into core package (#1165) 2024-09-09 10:45:57 -07:00
Alex Yang 72d65dd51a docs: fix example (#1168) 2024-09-09 10:45:30 -07:00
Alex Yang 553bc55b19 refactor: move PromptHelper into core package (#1166) 2024-09-09 10:15:21 -07:00
Alex Yang fc6f69833c fix: example code (#1167) 2024-09-09 10:11:58 -07:00
github-actions[bot] c7fd06841f Release 0.5.22 (#1164)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-09 09:27:26 -07:00
Thuc Pham 4648da6849 fix: wrong tiktoken version caused NextJs CL template run fail (#1162) 2024-09-09 09:23:13 -07:00
Fabian Wimmer 0188cf3bb6 docs: fix typos, add API references (#1161) 2024-09-09 11:40:05 +07:00
Alex Yang e0b4f9c047 refactor: move constant into core module (#1158) 2024-09-06 20:29:08 -07:00
github-actions[bot] 4895bba96e Release 0.5.21 (#1140)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-06 15:26:14 -07:00
Alex Yang 76d1df817b chore: update tall-kangaroos-sleep.md 2024-09-06 15:11:10 -07:00
Ryan Lee 83d7f415e2 fix: database insertion for PGVectorStore (#1157) 2024-09-06 14:32:48 -07:00
Fabian Wimmer ae1149ffaf feat: add json streaming to JSONReader (#1119) 2024-09-06 11:22:21 -07:00
Alex Yang 0148354dbe refactor: prompt system (#1154) 2024-09-06 11:22:08 -07:00
Thuc Pham 11b3856334 feat: implement filters for MongoDBAtlasVectorSearch (#1142) 2024-09-05 14:11:31 +07:00
Philipp Serrer e8f229cd01 chore: remove logging from mongodb atlas vector store (#1145) 2024-09-03 18:01:52 -07:00
Alex Yang 75b70e5824 fix: remove Stream API polyfill (#1149) 2024-09-03 18:01:42 -07:00
Marcus Schiesser 1711f6d8fc fix: Export imageToDataUrl for using images in chat (#1146) 2024-09-03 10:56:30 +07:00
Alex Yang 20d16abdf4 chore: bump version (#1143) 2024-08-30 13:08:14 -07:00
Thuc Pham 2411c9fbd0 feat: Auto-create index for MongoDB vector store (if not exists) (#1139)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-08-30 14:24:20 +07:00
Phil Nash be3e280f2a Updates references to SimpleNodeParser to SentenceSplitter. (#1129) 2024-08-30 11:15:57 +07:00
github-actions[bot] 2afcbe6587 Release 0.5.20 (#1132)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-28 10:43:26 +07:00
Marcus Schiesser 22ff486fbe fix: Add tiktoken WASM to withLlamaIndex (#1134)
Co-authored-by: Thuc Pham <51660321+thucpn@users.noreply.github.com>
2024-08-28 10:39:14 +07:00
Thuc Pham eed0b0415d fix: use metadata mode LLM for generating context (#1133)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-08-23 22:56:18 +07:00
Sebastian van Gerwen d9d6c56ed5 pgvectorstore support new conditions and operations (#1131)
Co-authored-by: Sebastian van Gerwen <svangerwen@invertigro.com>
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2024-08-23 14:40:39 +07:00
github-actions[bot] f99a237093 Release 0.5.19 (#1128)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-19 14:04:47 +07:00
Thuc Pham fcbf18344c feat: implement llamacloud file service (#1125) 2024-08-19 14:01:41 +07:00
github-actions[bot] bf8cbeb6c5 Release 0.5.18 (#1124)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-19 12:53:28 +09:00
Alex Yang e27e7dd054 chore: bump natural to 8.0.1 (#1126) 2024-08-17 07:15:08 -07:00
Thuc Pham 8b66cf4341 feat: support organization id in llamacloud index (#1123)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-08-15 13:51:48 +07:00
github-actions[bot] 6f4549bdea Release 0.5.17 (#1117)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-12 17:45:29 +07:00
Thuc Pham c654398f75 feat: implement Weaviate Vector Store in TS (#1109) 2024-08-12 17:41:05 +07:00
github-actions[bot] 0664a99945 Release 0.5.16 (#1115)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-09 22:09:34 -07:00
Alex Yang 58abc5731b chore: update changeset 2024-08-09 22:06:43 -07:00
github-actions[bot] 7498b1e0f1 Release 0.5.15 (#1108)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-09 14:36:47 -07:00
Alex Yang 07a275fea5 chore: bump openai (#1113) 2024-08-09 12:56:30 -07:00
Alex Yang 1b6263e08d fix: export schema in top level (#1112) 2024-08-09 10:10:12 -07:00
Alex Yang 089f1d49c0 refactor: migrate reader type into core (#1111) 2024-08-09 09:53:50 -07:00
Thuc Pham 01c184c608 feat: add is_empty operator for filtering vector store (#1107) 2024-08-09 14:50:57 +07:00
github-actions[bot] 1752463ee6 Release 0.5.14 (#1103)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-07 17:03:00 -07:00
Peter Goldstein c825a2f743 Add gpt-4o-mini to Azure. Add 2024-06-01 API version for Azure (#1102) 2024-08-06 14:23:28 +07:00
github-actions[bot] ba058dc8d4 Release 0.5.13 (#1100)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-02 09:50:07 -07:00
Philipp Serrer 04b2f8e062 fix: metadata should not be included after sentence splitter (#1099) 2024-08-02 09:22:04 -07:00
Alex Yang 62b874e14f fix: enforce no-base-to-string (#1097) 2024-08-01 14:05:19 -07:00
github-actions[bot] 9c9e9b4e03 Release 0.5.12 (#1091)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-30 15:46:39 -07:00
Alex Yang e3c307ab55 chore: fix changeset 2024-07-30 15:32:24 -07:00
André Lago b1b2baa969 docs: fix minor typo (#1092) 2024-07-30 15:07:46 -07:00
Marcus Schiesser 0452af91cc fix: handling errors in splitBySentenceTokenizer (#1087)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-30 09:36:58 -07:00
Marcus Schiesser da5cfc42e5 fix: integrate with create-llama (#1088)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-30 08:19:32 -07:00
Alex Yang eb89223386 chore: bump bunchee@5.3.1 (#1090) 2024-07-30 08:19:01 -07:00
Alex Yang 93dc3a31b3 fix: lock hey-api version (#1089) 2024-07-30 08:00:05 -07:00
Fabian Wimmer 345300f110 feat: add split by page mode to LlamaParseReader (#924) 2024-07-29 16:16:46 +07:00
github-actions[bot] f322c5d202 Release 0.5.11 (#1082)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-26 21:26:11 -07:00
Parham Saidi 376d29a78f feat: meta3.1 405b tool calling support (#1080) 2024-07-26 19:53:24 -07:00
Parham Saidi 224d507ab5 fix: prevent anthropic tool calling getting mixed with conversation (#1078) 2024-07-26 09:55:22 -07:00
Alex Yang 1f680d731d chore: bump llamacloud api (#1081) 2024-07-26 09:53:50 -07:00
github-actions[bot] f0a1cc51b4 Release 0.5.10 (#1074)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-25 16:43:17 -07:00
Alex Yang fee3280799 chore: fix changelog 2024-07-25 11:21:16 -07:00
Alex Yang 54925bf1ae chore: fix changelog 2024-07-25 11:20:47 -07:00
Alex Yang 91d02a4fc0 feat: support transform component callable (#1072) 2024-07-25 11:19:57 -07:00
Erik 086b94038e feat: add DeepSeek LLM class and documentation (#1071) 2024-07-25 11:15:34 -07:00
Fabian Wimmer 5d5716b339 feat: add a reader for JSON data (#1063) 2024-07-25 09:40:54 -07:00
Fabian Wimmer fb6db454d4 feat: update/add pageSeparator params to LlamaParseReader (#1051) 2024-07-25 15:09:43 +07:00
Marcus Schiesser e4d4e0d024 docs: update CONTRIBUTING.md (#1073) 2024-07-25 00:59:45 -07:00
Diego Ferreiro Val 17724d961e feat: add support for buffer on loadJSON API on LlamaParseReader (#1069)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-25 14:44:46 +07:00
github-actions[bot] 6776910c93 Release 0.5.9 (#1070)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-24 12:04:51 -07:00
Alex Yang 15962b36f0 feat: node parser refactor (#1065) 2024-07-24 10:46:00 -07:00
Parham Saidi 3d9a802734 feat: bedrock meta llama 3.1 8b, 70b and 405B (#1068) 2024-07-24 10:45:49 -07:00
github-actions[bot] 9cd8f8b0cf Release 0.5.8 (#1067)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-24 01:43:09 -07:00
Alex Yang b44330cbc6 chore: fix changelog 2024-07-24 01:28:40 -07:00
Niels Swimberghe 3d5ba0873c fix: update user agent in AssemblyAI (#1039)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-24 00:50:35 -07:00
Thuc Pham d917cdc3fa feat: add azure interpreter tool to tool factory (#1064) 2024-07-23 16:04:36 +07:00
github-actions[bot] b370edf329 Release 0.5.7 (#1062)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-22 10:07:44 -07:00
Marcus Schiesser ec59acd329 fix: bundling issue with pnpm (#1060)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-22 09:37:13 -07:00
github-actions[bot] c69e740c56 Release 0.5.6 (#1048)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-18 15:20:19 -07:00
Alex Yang 6cf6ae631c feat: abstract query type (#1052) 2024-07-18 13:27:02 -07:00
Alex Yang 2562244fb6 feat: add gpt4o-mini (#1057) 2024-07-18 12:50:51 -07:00
Thuc Pham a2691ee163 fix: always return false when key not exist in metadata (#1056) 2024-07-18 22:52:00 +07:00
Marcus Schiesser ab700ea546 fix: Add missing authentication to LlamaCloudIndex.fromDocuments (#1055) 2024-07-18 16:32:07 +07:00
Marcus Schiesser e775afc3f2 docs: clarify similarityTopK usage (#1053) 2024-07-18 16:24:49 +07:00
Alex Yang 92f07824a7 feat: use query bundle (#702) 2024-07-17 20:17:06 -07:00
Igor Soares b7cfe5bce6 fix: passing max_token option to replicate's api call (#1050)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-17 12:00:30 -07:00
Chris Paganon 3ccfb28352 docs: fix deprecated similarityTopK for retriever (#1049) 2024-07-17 11:59:28 -07:00
Thuc Pham 325aa51e51 feat: implement Jina embedding through Jina api (#995)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-07-17 20:57:14 +07:00
Marcus Schiesser d1d9bd6e41 docs: add metadata filter operators (#1047) 2024-07-17 17:00:37 +07:00
github-actions[bot] 9a71382243 Release 0.5.5 (#1046)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-17 16:26:38 +07:00
Thuc Pham b974eea341 feat: add MetadataFilter for SimpleVectorStore and Milvus (#1030)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-07-17 16:21:21 +07:00
github-actions[bot] e82632f83d Release 0.5.4 (#1043)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-16 14:53:20 -07:00
Fabian Wimmer 1a65ead849 feat: add vendorMultiModal params to LlamaParseReader (#1042) 2024-07-16 14:20:34 -07:00
Alex Yang 50b7d1b7bb refactor: put embedding into core (#1041) 2024-07-16 10:49:03 -07:00
github-actions[bot] 09beb72f5b Release 0.5.3 (#1038)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-16 10:25:27 -07:00
Fabian Wimmer 9bbbc67c8e feat: add a reader for Discord messages (#1040) 2024-07-16 10:19:48 -07:00
Brian Peiris b3681bf681 fix: DataCloneError when using FunctionTool (#1037) 2024-07-14 15:24:49 -07:00
Alex Yang b548b1443b chore: bump version (#1032) 2024-07-12 15:14:27 -07:00
github-actions[bot] 0e980d962d Release 0.5.2 (#1035)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-12 11:44:32 -07:00
Alex Yang 3ed6acc6a6 chore: bump cloud api (#1036) 2024-07-12 11:21:37 -07:00
Parham Saidi 56746c240f fix: bedrock handle empty content and added max tokens export (#1034) 2024-07-12 09:47:49 -07:00
Alex Yang 5c1c2c7f5b ci: only commit lock file (#1031) 2024-07-10 10:17:35 -07:00
github-actions[bot] a699086f46 Release 0.5.1 (#1028)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-09 15:36:20 -07:00
Alex Yang 454c204112 chore: bump version (#1029) 2024-07-09 13:42:09 -07:00
Julius Lipp 277468160d feat: add mixedbread ai integration (#953) 2024-07-09 09:36:43 -07:00
Ranjan Mangla a0f424e592 fix: corrected the regex in the ReactAgent (#1022)
Signed-off-by: ranjanmangla1 <ranjanmangla1@gmail.com>
2024-07-09 08:55:38 -07:00
github-actions[bot] 3ae832ca28 Release 0.5.0 (#1024)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <himself65@users.noreply.github.com>
2024-07-08 17:16:46 -07:00
Alex Yang 16ef5dd631 feat: simplify callback manager (#1027) 2024-07-08 16:44:54 -07:00
Alex Yang c4bd0a5215 refactor: move llm & callback manager to core module (#1026) 2024-07-08 15:48:59 -07:00
Alex Yang f5c8ca7dfb chore: use bunchee bundler for all (#1025) 2024-07-08 09:45:55 -07:00
Sacha Bron 36ddec44af fix: typo in custom page separator parameter for LlamaParse (#1023) 2024-07-08 09:27:51 -07:00
github-actions[bot] c147d8a271 Release 0.4.14 (#1021)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-05 15:26:31 -07:00
Alex Yang 1c444d58b6 feat(cloud): update openapi.json (#1020) 2024-07-05 15:01:22 -07:00
github-actions[bot] 1f910f7566 Release 0.4.13 (#1016)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-05 11:44:37 -07:00
Thuc Pham 99826cff43 fix: missing dispatch retrieve event on llamacloud retriever (#1018) 2024-07-05 20:43:26 +07:00
Fabian Wimmer e8f8bea969 feat: add boundingBox and targetPages to LlamaParseReader (#1017) 2024-07-05 14:32:26 +07:00
Fabian Wimmer 304484b77a feat: add ignoreErrors flag to LlamaParse (#959)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2024-07-04 20:51:05 +07:00
abgita 29fed77d58 Fixed a typo in the retriever description (#1009) 2024-07-04 20:15:20 +07:00
Alex Yang db070588c8 ci: fix setup pnpm (#1014) 2024-07-03 12:11:48 -07:00
github-actions[bot] 76deca7fea Release 0.4.12 (#1013)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-03 10:24:22 -07:00
Alex Yang f326ab86d2 chore: bump version 2024-07-03 10:20:46 -07:00
Cássio de Freitas e Silva ca8d9709e0 feat: add support for Meta LLMs in AWS Bedrock (#960) 2024-07-03 01:27:58 -07:00
github-actions[bot] e0af059221 Release 0.4.11 (#1008)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-02 15:07:03 -07:00
Alex Yang 8bf5b4acfd fix: llama parse input spreadsheet (#1007) 2024-07-02 14:48:51 -07:00
Alex Yang 93a003baa0 ci: pre release (#1005) 2024-07-02 00:40:45 -07:00
github-actions[bot] 5d9b0bd3f0 Release 0.4.10 (#1003)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-01 23:59:52 -07:00
Alex Yang 9a5525e1b3 refactor(core): migrate llms type (#1002) 2024-07-01 20:13:35 -07:00
Peron 7dce3d28d3 fix: disable External Filters for Gemini (#994)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-07-01 18:28:22 -07:00
github-actions[bot] d4c1482c1c Release 0.4.9 (#1001)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-01 17:20:47 -07:00
Alex Yang 3a96a483a6 fix: anthropic image input (#999) 2024-07-01 16:03:30 -07:00
Alex Yang 7467fce2d4 docs: remove cloudflare worker section (#1000) 2024-07-01 16:01:55 -07:00
github-actions[bot] 06af08cac4 Release 0.4.8 (#998)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-01 15:07:50 -07:00
Alex Yang 83ebdfb1c5 fix: next.js binding (#997) 2024-07-01 14:52:57 -07:00
github-actions[bot] 835b1ac000 Release 0.4.7 (#986)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-28 22:58:14 -07:00
Alex Yang f10b41dbc1 chore: fix release files (#991) 2024-06-28 13:36:55 -07:00
Wassim Chegham 41fe871e2f feat: add support for azure dynamic session tool (#942)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2024-06-27 13:18:05 -07:00
Alex Yang 321c39ddc7 fix: generate api as class (#988) 2024-06-27 09:58:00 -07:00
Alex Yang f7f1af0139 fix: llamacloud sdk edge case (#985) 2024-06-26 23:10:04 -07:00
github-actions[bot] a8c9c279d6 Release 0.4.6 (#981)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-26 17:22:28 -07:00
Alex Yang eece129831 feat: migrate @llamaindex/cloud package (#984) 2024-06-26 16:51:47 -07:00
Alex Yang 80e4f51a83 fix: remove check-minor-version.mjs
We no longer need that
2024-06-26 15:31:08 -07:00
Alex Yang 22ff0837c3 feat: init @llamaindex/core (#938) 2024-06-26 15:28:57 -07:00
Alex Yang 74d7e05bcb ci: continue when commit lockfile error (#982) 2024-06-26 11:06:06 -07:00
Parham Saidi 1feb23bb83 feat: added Gemini tool calling support (#973) 2024-06-26 10:49:11 -07:00
Marcus Schiesser 08c55ec258 fix: Add metadata to PDFs and use Uint8Array for readers content (#980) 2024-06-26 10:16:23 -07:00
github-actions[bot] 394e797567 Release 0.4.5 (#979)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-26 17:42:19 +07:00
Parham Saidi 6c3e5d08b8 fix: switch to correct reference for a static function (#978) 2024-06-26 17:35:22 +07:00
github-actions[bot] 6e19482814 Release 0.4.4 (#977)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-26 14:46:48 +07:00
Marcus Schiesser 42eb73a08f fix: IngestionPipeline not working without vectorStores (#976) 2024-06-26 14:30:58 +07:00
github-actions[bot] 4b59ffee45 Release 0.4.3 (#971)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-25 15:38:10 -07:00
Alex Yang d4e853c8b5 fix: stronger type declaration (#975) 2024-06-25 15:22:13 -07:00
Alex Yang a94b8ec3d2 chore: fix misc (#974) 2024-06-25 14:41:26 -07:00
Alex Yang ed57e6b7be docs: remove i18n temporary (#972) 2024-06-25 14:00:07 -07:00
Alex Yang 05f006e7e1 chore: fix llamaindex version 2024-06-25 12:21:22 -07:00
Alex Yang c3aed72c29 chore: skip install when releasing new version 2024-06-25 12:08:53 -07:00
Alex Yang 7deba94e6b chore: fix lock file 2024-06-25 11:57:04 -07:00
github-actions[bot] d15811f09f Release 0.4.2 (#966)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-25 11:23:01 -07:00
Tasmiyah Iqbal 2ef62a93bb feat: added support for embeddings via HuggingFace Inference API (#929) 2024-06-25 11:16:41 -07:00
Fabian Wimmer 9015aea527 docs: LlamaParse JSON + SimpleDirectoryReader (#970) 2024-06-25 11:16:27 -07:00
Emanuel Ferreira 4bb401e6f9 feat: upgrade llamacloud index (#944)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-25 10:52:06 -07:00
Parham Saidi a87a4d1222 feat: tool calling for Bedrock's Claude and General LLM Agent (#955) 2024-06-25 10:51:40 -07:00
Marcus Schiesser d27ad16335 test: add e2e test for nextjs/node with tokenizer (#963) 2024-06-25 10:02:01 -07:00
Marcus Schiesser 20498a2bce fix: use tiktoken instead of tiktoken/lite (#967) 2024-06-25 09:51:08 -07:00
Andy Garvin 0730140e62 fix: include node relationships when converting jsonToDoc (#968) 2024-06-25 22:59:16 +07:00
Andy Garvin 810711d355 docs: change references from core package to llamaindex (#969) 2024-06-25 22:55:37 +07:00
Marcus Schiesser f3b34b457c docs: add changeset (#965) 2024-06-25 21:36:00 +07:00
Fabian Wimmer 6f4b9f3372 docs: fix broken links, add API References (#962) 2024-06-24 19:10:16 -07:00
Fabian Wimmer 01658fdb31 docs: update data loaders (#961) 2024-06-24 10:45:17 -07:00
Alex Yang 66c26d9cce fix: json import (#958) 2024-06-21 11:27:08 -07:00
Marcus Schiesser a4060a7914 docs: update anthropic examples to use claude 3.5 (#954) 2024-06-21 17:27:56 +07:00
github-actions[bot] 469e438741 Release 0.4.1 (#949)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-21 17:26:01 +07:00
Marcus Schiesser 56fabbb4f5 fix: Release env changes to tokenizer (#952) 2024-06-21 16:58:02 +07:00
Alex Yang dfd8cc1ba4 chore: fix new-version script (#950) 2024-06-20 16:34:09 -07:00
Fabian Wimmer cba54061a2 fix: every Llama Parse job being called "blob" (#946)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-20 16:32:20 -07:00
Peter Goldstein ed467a9889 feat: add Anthropic Claude 3.5 Sonnet model (#948) 2024-06-20 16:21:58 -07:00
Alex Yang 3c4791007f fix: groq llm (#947) 2024-06-20 16:19:55 -07:00
Alex Yang 8f16a179c3 chore: fix lock 2024-06-20 12:51:34 -07:00
github-actions[bot] ce3a4cac6c Release 0.4.0 (#923)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-20 12:38:05 -07:00
Alex Yang be46044b98 build: fix check-minor-version.mjs 2024-06-20 12:31:13 -07:00
Alex Yang 154c7f8e36 chore: bump version (#945) 2024-06-20 12:25:59 -07:00
Alex Yang 8b6c2b45a6 chore: fix version release (#937) 2024-06-17 16:42:38 -07:00
Parham Saidi b1a4a74270 docs: updated Bedrock Opus region and added a basic README (#935) 2024-06-17 14:34:14 -07:00
Alex Yang d7fb095fbd refactor: rename directory core to llamaindex (#936) 2024-06-17 14:33:53 -07:00
Alex Yang 58791d4bdd fix: tokenizer type (#934) 2024-06-17 10:34:37 -07:00
Parham Saidi d3b635b193 fix: agents to use chat history (#933) 2024-06-17 10:33:57 -07:00
Marcus Schiesser 436bc41f82 refactor: unify response and agent response (#930) 2024-06-17 09:01:08 -07:00
Vishwasa Navada K 834f49275a docs: fixed the broken link on Getting Started Section (#932) 2024-06-17 22:56:10 +07:00
Marcus Schiesser a44e54f9ec feat: truncate embedding tokens (#918)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-15 02:13:39 +08:00
Wassim Chegham a51ed8dd70 feat: add support for managed identity for Azure OpenAI (#922)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-11 16:32:39 -07:00
Fabian Wimmer c8cfc6c06d fix: LlamaParse json mode returns array + basic example (#914)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-06-11 10:56:52 -07:00
github-actions[bot] 83b2f0b0af Release 0.3.17 (#920)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-11 10:52:40 -07:00
Alex Yang 1a6abb38bc build: community package cleanup before release (#897) 2024-06-11 10:47:35 -07:00
Fabian Wimmer 6bc5bddb59 feat: add new options to LlamaParseReader (#915) 2024-06-11 16:31:01 +07:00
Alex Yang e6d6576b2f chore: use unpdf (#849) 2024-06-10 16:45:09 -07:00
Alex Yang bf25ff6104 fix: polyfill for cloudflare worker (#919) 2024-06-10 14:08:47 -07:00
Talha Jubair Siam 32ad0992cf docs : fix correctness and relevancy example (#913) 2024-06-10 20:19:06 +07:00
Marcus Schiesser af650343d9 fix: remove debugger statement (#917) 2024-06-10 20:14:26 +07:00
Thuc Pham f6f4ca44bd feat: add gpt-4o tool call fail example (#916)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-06-10 17:29:25 +07:00
github-actions[bot] 9aa918f026 Release 0.3.16 (#896)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-06 07:20:58 -07:00
Marcus Schiesser 00a92cd125 fix: custom reader example 2024-06-06 12:04:27 +02:00
Marcus Schiesser 73819bf19d feat: Unify metadata and ID handling of documents, allow files to be read by Buffer 2024-06-06 11:51:54 +02:00
Marcus Schiesser d10cca28fc chore: use FileReader interface when possible (#912) 2024-06-06 15:37:20 +07:00
Alex Yang 1378ec4e50 feat: set default model to gpt-4o (#911) 2024-06-05 22:44:52 -07:00
Fabian Wimmer 24a9d1e816 feat: add json mode and image retrieval to LlamaParse (#910)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-05 13:50:51 -07:00
Yi Ding b100684bad chore: bump version (#892)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-05 13:50:33 -07:00
Alex Yang c375cd5c6b fix: multiple tool call (#905) 2024-06-05 10:23:41 -07:00
Fabian Wimmer 45952dee59 feat: add parallel processing to SimpleDirectoryReader (#908)
Co-authored-by: Alex Yang <himself65@outlook.com>
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-06-05 23:17:47 +07:00
Marcus Schiesser 6db7f23ec7 Revert "feat: add parallel processing to SimpleDirectoryReader (#883)"
This reverts commit da1f025229.
2024-06-05 13:35:58 +02:00
Marcus Schiesser 0721a84900 fix: ignore empty vector store (#861) 2024-06-04 10:26:16 -07:00
Marcus Schiesser 4d4bd85448 fix: calling tools with large inputs (#901) 2024-06-04 09:07:19 -07:00
Philipp Serrer 11ae9267ae feat: add numCandidates setting to MongoDBAtlasVectorStore for tuning queries (#893)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2024-06-04 16:11:54 +07:00
Fabian Wimmer 174cb3e6da docs: update data loader documentation (#900)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-03 13:50:48 -07:00
Alex Yang 5ab5e5191d fix: empty prefix with inputs (#899) 2024-06-03 12:11:57 -07:00
Parham Saidi 54230f0477 feat: Gemini latest GA released models (#898)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-03 11:41:15 -07:00
Oguz Vuruskaner 3d484da1c5 feat: DeepInfra Embeddings implementation (#890)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-03 11:34:07 -07:00
Oguz Vuruskaner 631f0001ef feat: DeepInfra LLM implementation (#894)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-03 11:21:23 -07:00
Alex Yang 060b700e09 chore: fix changelog 2024-06-03 09:53:15 -07:00
justinmann 83c24f4d50 cannot pass embedModel to MongoDBAtlasVectorStore (#887) 2024-06-03 23:08:33 +07:00
Parham Saidi 883266939e feat: Bedrock support added, only for Anthropic models (#847)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-06-03 09:07:17 -07:00
Philipp Serrer a29d8351c8 fix: setDocumentHash should be async (#868) 2024-06-03 09:05:23 -07:00
Fabian Wimmer da1f025229 feat: add parallel processing to SimpleDirectoryReader (#883)
Co-authored-by: Alex Yang <himself65@outlook.com>
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-06-03 23:01:27 +07:00
Fabian Wimmer 6b1ded41a9 feat: LlamaParse: add gpt4o-mode, invalidate cache, skip diagonal text, update supported file types (#889)
Co-authored-by: Marcus Schiesser <marcus.schiesser@googlemail.com>
2024-06-03 22:22:18 +07:00
github-actions[bot] e01cc053e3 Release 0.3.15 (#884)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-03 21:29:46 +07:00
Marcus Schiesser 6e156edb11 feat: use images in context chat engine (#886) 2024-06-03 21:24:43 +07:00
Marcus Schiesser 0b519958e9 chore: downgrade changeset to patch 2024-06-03 11:18:15 +02:00
Philipp Serrer 265976df12 fix: incorrect hash because of missing params in decorator (#891) 2024-05-28 16:05:24 -07:00
Marcus Schiesser 7e1b96a2db fix: default to Settings.llm (#885) 2024-05-24 22:15:09 +07:00
Marcus Schiesser 8e26f753b7 feat: Add retrieval for images using multi-modal messages (#870) 2024-05-24 22:08:20 +07:00
github-actions[bot] 31e3251435 Release 0.3.14 (#878)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-23 16:00:09 -07:00
Yi Ding 058c275a72 New azure versions (#877) 2024-05-23 09:27:04 -07:00
Parham Saidi 6ff7576eb9 feature: added the latest gpt-4o to azure (#875) 2024-05-23 09:22:25 -07:00
Parham Saidi 94543decad feature: added latest gemini pro models (#876) 2024-05-23 09:21:52 -07:00
Marcus Schiesser b963782137 docs: reorder installation steps (#869) 2024-05-22 06:54:27 -07:00
github-actions[bot] 52c47cada3 Release 0.3.13 (#856)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-22 16:31:23 +07:00
Marcus Schiesser 9216312b11 docs: fix changsets and format 2024-05-22 11:25:09 +02:00
Philipp Serrer 660a2b3495 fix: text before heading in markdown reader (#864) 2024-05-22 16:49:52 +08:00
Henry Heng 6d21092805 Fix/Agent llm initialization (#866) 2024-05-21 15:35:18 -07:00
Laurie Voss fb2c1fa917 Docs update: (#857)
Co-authored-by: Yi Ding <yi.s.ding@gmail.com>
2024-05-20 13:53:23 -07:00
Parham Saidi 37525df529 feat: Gemini Access via Vertex AI (#838) 2024-05-20 17:09:25 +07:00
Marcus Schiesser a1f24753d9 docs: systemprompt changeset 2024-05-20 11:05:20 +02:00
Thuc Pham aa0f586330 feat: allow adding system prompt to chat engine (#855)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-05-20 15:57:58 +07:00
Alex Yang ff03139799 Revert "fix: cloudflare dev (#851)"
`@xenova/transformers` only ship node.js and browser output, it's not possible to load this in edge runtime and workerd

This reverts commit 34fb1d8992.
2024-05-17 12:11:31 -07:00
Marcus Schiesser 1b1081b9c9 feat: bind embedding models to vec stores and use vector store map (#821)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-05-17 22:30:33 +07:00
Thuc Pham 047ae07e74 feat: add local hugging face LLM (#854) 2024-05-17 16:01:10 +07:00
github-actions[bot] d8aa29a115 Release 0.3.12 (#852)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-16 17:45:09 -07:00
Alex Yang 34fb1d8992 fix: cloudflare dev (#851) 2024-05-16 17:25:32 -07:00
github-actions[bot] c517f35526 Release 0.3.11 (#835)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-16 16:35:57 -07:00
Alex Yang e072c45393 fix: remove non-standard API pipeline (#850) 2024-05-16 16:31:48 -07:00
Alex Yang 51241865f8 feat: improve BaseNode (#848) 2024-05-16 16:29:16 -07:00
Thuc Pham 10c83485d2 fix: allow custom task query for agents (#846) 2024-05-16 12:48:50 -07:00
Alex Yang 1e6a18ad2d build: fix jsr release 2024-05-15 18:03:22 -07:00
Alex Yang 9e133ac10d refactor: remove defaultFS from parameters (#841) 2024-05-15 17:37:51 -07:00
Alex Yang ba217eec2c chore: remove test.py (#842) 2024-05-15 16:47:39 -07:00
Alex Yang 64ef70b735 build: ignore example project 2024-05-15 16:10:08 -07:00
Alex Yang 6615aaa4ab chore: use pnpm format
Using `pnpm format:write` will cause two commits which is not expected
2024-05-15 13:11:53 -07:00
Parham Saidi 447105a6dc fix: Gemini text chat - prevent sending broken messageContent and history (#822) 2024-05-15 16:33:55 +07:00
Huu Le (Lee) 320be3fab6 chore: rollback chromadb version to 1.7.3 (#834)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-05-14 16:07:44 +07:00
Alex Yang bbd9f85a45 chore: bump openai (#833) 2024-05-13 12:53:12 -07:00
github-actions[bot] 5f29ba5e2c Release 0.3.10 (#832)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-13 10:53:59 -07:00
Alex Yang 4aba02eb82 feat: support gpt4-o (#831) 2024-05-13 10:51:10 -07:00
Alex Yang 75736ad01b build: release output files 2024-05-10 14:08:21 -07:00
Alex Yang 68a508fcd0 test: fix check host (#829) 2024-05-10 11:07:40 -07:00
github-actions[bot] 6281fc8c91 Release 0.3.9 (#828)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-09 11:16:08 -07:00
Alex Yang c3747d092a feat: add nextjs plugin for llamaindex (#824) 2024-05-09 02:29:11 -05:00
Marcus Schiesser 24a39aefb8 feat: send retrieve start and end events (#827) 2024-05-09 14:16:34 +07:00
Alex Yang 0b1299036d chore: bump version (#826) 2024-05-09 00:11:21 -05:00
Alex Yang 2c8d7941f0 ci: fix publish (#825) 2024-05-08 23:30:17 -05:00
Fabian Wimmer a1a72ab223 feat: LlamaParseReader: update Supported File Types to match python version (#823) 2024-05-09 09:51:01 +07:00
Alex Yang b99ab056d1 feat: init @llamaindex/autotool (#819) 2024-05-08 02:56:42 -05:00
github-actions[bot] 1a45b44307 Release 0.3.8 (#816)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-07 13:05:08 -05:00
JT-Dev-215 804c57519f fix: PGVector similarity score (#817) 2024-05-07 12:54:13 -05:00
Marcus Schiesser ce94780b95 feat: add page number to read PDFs (#815) 2024-05-07 10:45:55 +07:00
ezirmusitua 645fcf6c24 fix: use sha256 hash value as the Document.id_ in MarkdownReader (#768)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-05-07 10:07:39 +07:00
Marcus Schiesser e37fa5d9ca docs: add retriever tool example (#814) 2024-05-07 09:41:14 +07:00
github-actions[bot] 97e4ecd5b8 Release 0.3.7 (#812)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-05 22:11:54 -05:00
Alex Yang b6a660651b feat: allow to change ollama port (#811) 2024-05-05 19:08:00 -05:00
github-actions[bot] 456d3fb0b3 Release 0.3.6 (#810)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-05 18:40:58 -05:00
Alex Yang efa326a871 chore: update package.json and usage of lodash (#809) 2024-05-05 18:30:46 -05:00
Alex Yang 5765b637ce build: fix jsr release 2024-05-03 18:21:08 -05:00
github-actions[bot] 72687b4f69 Release 0.3.5 (#805)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-03 18:16:39 -05:00
Alex Yang 0c67e1f8f3 build: fix new version script 2024-05-03 18:13:24 -05:00
Alex Yang 4a0619758a chore: fix jsr.json 2024-05-03 18:09:05 -05:00
Alex Yang bc7a11cdbe fix: inline ollama build (#807) 2024-05-03 18:03:23 -05:00
Alex Yang 5596e31947 feat: improve @llamaindex/env (#787) 2024-05-03 18:03:14 -05:00
Alex Yang 2fe2b813ba fix: filter with multiple filters in ChromaDB (#784) 2024-05-03 17:07:45 -05:00
Alex Yang be5df5b01b fix(core): multple chat on anthropic agent (#799) 2024-05-03 16:18:46 -05:00
JT-Dev-215 e74fe88342 fix: change <-> to <=> in the SELECT query (#804)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-05-03 12:10:36 -05:00
github-actions[bot] f1862ccab1 Release 0.3.4 (#797)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-02 20:02:06 -05:00
Yi Ding 9e74a4327f feat: add top k to asQueryEngine (#801)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-05-02 19:59:36 -05:00
Alex Yang 5e61934d5a fix: remove clone object in CallbackManager.dispatchEvent (#802) 2024-05-02 19:55:41 -05:00
Alex Yang 2008efe0ee feat: add verbose mode to Agent (#800) 2024-05-02 19:54:05 -05:00
Alex Yang ee719a1fda fix: streaming for ReAct Agent (#798) 2024-05-02 18:52:18 -05:00
Alex Yang 1dce275a7c fix: export StorageContext on edge runtime (#793) 2024-05-02 14:52:16 -05:00
Thuc Pham d10533ef77 feat: add hugging face llm (#796) 2024-05-02 18:43:05 +08:00
github-actions[bot] 8aeb8ae690 Release 0.3.3 (#792)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-01 21:47:16 -05:00
Thuc Pham e8c41c5c27 fix: wrong gemini streaming chat response (#791) 2024-05-02 08:39:57 +07:00
github-actions[bot] 051b4ddfa2 Release 0.3.2 (#790)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-01 19:30:09 -05:00
Alex Yang 61103b677b fix: streaming for Agent.createTask (#788) 2024-05-01 19:26:06 -05:00
Alex Yang e69cac672a docs: update blog post 2024-05-01 13:01:55 -05:00
Alex Yang 94246a3ca8 chore: bump jsr.json 2024-05-01 12:59:03 -05:00
github-actions[bot] b440a008e5 Release 0.3.1 (#786)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-01 12:39:37 -05:00
Alex Yang 46227f2a70 fix: build error on next.js nodejs runtime (#785) 2024-05-01 12:37:43 -05:00
Alex Yang 77f0298f6f chore: update jsr.json 2024-04-30 22:47:09 -05:00
github-actions[bot] c14e112236 Release 0.3.0 (#783)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-30 22:46:10 -05:00
Alex Yang 62b035fdc1 build: fix test package naming 2024-04-30 22:42:06 -05:00
Alex Yang aa0be1469b build: update expectedMinorVersion 2024-04-30 22:37:14 -05:00
Alex Yang 5016f21d52 feat(core): better next.js/cloudflare/vite support 2024-04-30 22:34:54 -05:00
Marcus Schiesser 130b7992a1 refactor: clean gemini embedding (#781) 2024-04-30 10:51:22 +07:00
Yi Ding 0d50b22dbf fix(core): add more exports on llm/index (#780) 2024-04-28 20:43:14 -05:00
Alex Yang db1d1f57c9 build(wasm-tools): fix type check 2024-04-28 20:29:01 -05:00
Alex Yang dccb8163d8 fix(core): polyfill Web Stream APIs (#777) 2024-04-28 18:35:33 -05:00
Fabian Wimmer 1ab3ba407e feat: add Language and parsingInstruction to LlamaParseReader (#779)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-04-28 17:00:58 -05:00
Alex Yang b03f765733 chore: update husky script (#776) 2024-04-27 01:10:34 -05:00
Alex Yang 7488d3c235 fix: agent callback with step infomation (#774) 2024-04-26 18:13:05 -05:00
github-actions[bot] 5cb270d07f Release 0.2.13 (#773)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-26 13:26:12 -05:00
Alex Yang 62771058aa fix: empty tools (#772) 2024-04-26 13:10:57 -05:00
github-actions[bot] ca348a6570 Release 0.2.12 (#770)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-26 13:11:23 +07:00
Marcus Schiesser 44a7fd72e8 ci: publish github release on tag pushes (#771) 2024-04-26 13:09:25 +07:00
Thuc Pham d8d952d937 feat: init gemini llm (#769) 2024-04-26 11:04:33 +07:00
github-actions[bot] 216ba1f22b Release 0.2.11 (#765)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-25 17:53:17 -07:00
Marcus Schiesser 74686f5776 ci: add version to release PR (#766) 2024-04-25 10:55:02 +07:00
Marcus Schiesser 1ebf9e67a4 ci: add release action (#764) 2024-04-25 10:09:55 +07:00
Alex Yang aeefc77da0 test: load large amount of data won't cause error (#762) 2024-04-24 15:04:29 -05:00
ezirmusitua 13d8d7cbbe fix: use Array.prototype.flat (#760)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-04-24 14:36:12 -05:00
Alex Yang 9c34e44b85 ci: coverage node.js 22 (#761) 2024-04-24 14:19:12 -05:00
Thuc Pham cb2dc802d9 docs: update next config for external packages (#759) 2024-04-24 17:27:20 +08:00
Ziniu Yu 5a6cc0e32e feat: support jina ai embedding and reranker (#734) 2024-04-24 15:45:36 +07:00
Marcus Schiesser a63256eb84 feat: add default file metadata (#758) 2024-04-24 13:54:29 +07:00
Alex Yang 0a160b97a0 fix(docs): api generation (#756) 2024-04-23 14:24:17 -05:00
Thuc Pham 95602c7959 feat: overide generate hash function for image document (#751)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-04-23 11:56:37 +07:00
Alex Yang 20bc466ca1 chore: bump notion reader (#753) 2024-04-22 15:14:06 -05:00
Thuc Pham efb1c56ba5 fix: return buffer when loading image data (#749) 2024-04-22 15:28:19 +07:00
Alex Yang 286499388d fix: agent class should implement ChatEngine interface (#746) 2024-04-22 02:13:29 -05:00
Alex Yang 460c6574cc fix: rename ReACTAgent to ReActAgent (#748) 2024-04-22 00:57:43 -05:00
Marcus Schiesser 8b0e0e3cc8 docs: use dedicated embedding model for ollama (#745) 2024-04-22 10:40:39 +07:00
Alex Yang 87142b29fa chore: update changeset 2024-04-21 20:32:57 -05:00
Alex Yang 501b844f0f refactor: use official ollama sdk (#744) 2024-04-21 20:31:16 -05:00
Alex Yang 03157dc295 feat: use json format for tool result (#742) 2024-04-21 19:27:10 -05:00
Alex Yang ef80b684f7 chore: fix llamaindex node_modules link (#743) 2024-04-21 18:21:15 -05:00
Alex Yang 472e70feee refactor: full typed & iterator of agent worker/runner (part 3) (#728)
Fixes: https://github.com/run-llama/LlamaIndexTS/issues/692, https://github.com/run-llama/LlamaIndexTS/issues/557

Refs: https://github.com/run-llama/llama_index/blob/5a6ffe32faa75db0b4737d1e7a85e6fe4afe94af/docs/module_guides/deploying/agents/agent_runner.md
2024-04-19 17:52:36 -05:00
Alex Yang cfb90f7666 docs: update (#738) 2024-04-19 15:17:48 -05:00
Mike Fortman 2e3a287a27 refactor: astra options (#737) 2024-04-19 11:57:34 -05:00
Marcus Schiesser 635fbb8618 release 0.2.10 2024-04-19 16:14:44 +08:00
Marcus Schiesser d2d34acb31 Add streaming for replicate (Llama 3) (#735) 2024-04-19 15:09:20 +07:00
Yi Ding cf70edbede llama 3 support (#731)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-04-18 17:08:40 -07:00
Mike Fortman 79b7d246bd chore: update deps Astra (#733) 2024-04-18 17:55:31 -05:00
Marcus Schiesser bcc3d0b4d1 release v0.2.9 2024-04-17 13:53:31 +08:00
Marcus Schiesser 238ca86534 fix: google fonts not reachable during build 2024-04-17 13:47:11 +08:00
Marcus Schiesser 1f3efe8947 fix: ensure to use build for examples (#729) 2024-04-17 10:40:02 +07:00
yemiscale3 89324b4067 docs: Add Langtrace to observability tools (#726)
Co-authored-by: Yi Ding <yi.s.ding@gmail.com>
2024-04-16 20:13:59 -07:00
Alex Yang 8cc848aee6 docs: fix example code (#727) 2024-04-16 16:00:26 -05:00
Alex Yang cd54a7a66b docs: remove verbose (#725) 2024-04-16 15:54:40 -05:00
Marcus Schiesser dca02f7277 refactor: VectorStoreIndex: use TransformerComponent to calc embeddings (#721) 2024-04-16 10:01:26 +07:00
Marcus Schiesser b757fa9aa3 fix: type-check of modified example 2024-04-16 10:35:26 +08:00
Marcus Schiesser bc594a0674 doc: update vector index example to show source nodes 2024-04-16 10:27:34 +08:00
Alex Yang 208282d62f feat: init anthropic agent (part 2) (#719) 2024-04-15 16:22:47 -05:00
Wessel 060880abfe fix: toolretriever for Agent OpenAI broken (#718) 2024-04-15 13:45:19 -05:00
Marcus Schiesser 728b35e774 chore: remove LLM.ts (#720) 2024-04-14 23:35:15 -05:00
Alex Yang bdaa043404 feat: init claude function call (part 1) (#717) 2024-04-14 15:55:34 -05:00
Alex Yang a55cf8d870 fix: type import 2024-04-14 01:30:54 -05:00
Alex Yang cf4244fd3a chore: put eslint into top level (#716) 2024-04-13 20:39:27 -05:00
Marcus Schiesser 76c3fd64ad feat: add scores to source nodes (#714) 2024-04-12 09:28:46 -07:00
Marcus Schiesser 701e0ac2be release 0.2.8 2024-04-12 12:43:45 +08:00
Alex Yang a285f8ba3a feat: improve ToolsFactory type (#713) 2024-04-11 21:26:14 -05:00
Alex Yang 663821cdf6 test: add openai agent stream chat (#712) 2024-04-11 19:21:02 -05:00
Alex Yang c4b95494ac fix: memory type (#711) 2024-04-11 18:11:33 -05:00
Marcus Schiesser 980fb4e5a3 release llamaindex@0.2.7 2024-04-11 14:57:01 +08:00
Alex Yang 96f8f40291 fix: agent stream (#710) 2024-04-10 23:22:11 -05:00
Alex Yang 1c698df6e0 fix: package.json version 2024-04-10 19:49:16 -05:00
2770 changed files with 176434 additions and 123261 deletions
-5
View File
@@ -1,5 +0,0 @@
---
"llamaindex": patch
---
Fix agent streaming with new OpenAI models
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
rules: {
"max-params": ["error", 4],
"prefer-const": "error",
},
overrides: [
{
files: ["examples/**/*.ts"],
rules: {
"turbo/no-undeclared-env-vars": "off",
},
},
],
ignorePatterns: ["dist/", "lib/"],
};
+46
View File
@@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: ""
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Code to reproduce the behavior:
```ts
// paste the code here
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. macOS, Linux]
- JS Runtime / Framework / Bundler (select all applicable)
- [ ] Node.js
- [ ] Deno
- [ ] Bun
- [ ] Next.js
- [ ] ESBuild
- [ ] Rollup
- [ ] Webpack
- [ ] Turbopack
- [ ] Vite
- [ ] Waku
- [ ] Edge Runtime
- [ ] AWS Lambda
- [ ] Cloudflare Worker
- [ ] Others (please elaborate on this)
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
+1 -3
View File
@@ -13,9 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
+28
View File
@@ -0,0 +1,28 @@
name: Publish Preview
on: [pull_request]
jobs:
pre_release:
name: Pre Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Pre Release
run: pnpx pkg-pr-new publish --pnpm ./packages/* ./packages/providers/* ./packages/providers/storage/*
-36
View File
@@ -1,36 +0,0 @@
name: Publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Publish @llamaindex/env
run: npx jsr publish
working-directory: packages/env
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish @llamaindex/core
run: npx jsr publish --allow-slow-types
working-directory: packages/core
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+37
View File
@@ -0,0 +1,37 @@
name: Publish to GitHub Releases
on:
push:
tags:
- "llamaindex@*"
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build tarball
run: |
pnpm pack
working-directory: packages/llamaindex
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "packages/llamaindex/llamaindex-*.tgz"
name: Release ${{ github.ref }}
bodyFile: "packages/llamaindex/CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
+70
View File
@@ -0,0 +1,70 @@
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Add auth token to .npmrc file
run: |
cat << EOF >> ".npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get changeset status
id: get-changeset-status
run: |
pnpm changeset status --output .changeset/status.json
new_version=$(jq -r '.releases[] | select(.name == "llamaindex") | .newVersion' < .changeset/status.json)
rm -v .changeset/status.json
echo "new-version=${new_version}" >> "$GITHUB_OUTPUT"
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
commit: Release ${{ steps.get-changeset-status.outputs.new-version }}
title: Release ${{ steps.get-changeset-status.outputs.new-version }}
# update version PR with the latest changesets
version: pnpm new-version
# build package and call changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Refs: https://github.com/changesets/changesets/issues/421
- name: Update lock file
continue-on-error: true
run: pnpm install --lockfile-only
- name: Commit lock file
continue-on-error: true
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update lock file"
branch: changeset-release/main
file_pattern: "pnpm-lock.yaml"
+70 -30
View File
@@ -12,21 +12,37 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
POSTGRES_HOST_AUTH_METHOD: trust
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
jobs:
e2e:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 21.x]
node-version: [18.x, 20.x, 22.x, 23.x]
name: E2E on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: ankane/setup-postgres@v1
with:
database: llamaindex_node_test
dev-files: true
- run: |
cd /tmp
git clone --branch v0.7.0 https://github.com/pgvector/pgvector.git
cd pgvector
make
sudo make install
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
@@ -37,13 +53,12 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 21.x]
node-version: [18.x, 20.x, 22.x, 23.x]
name: Test on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
@@ -58,7 +73,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
@@ -67,24 +82,27 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build --filter llamaindex
run: pnpm run build
- name: Run Type Check
run: pnpm run type-check
- name: Run Circular Dependency Check
run: pnpm run circular-check
working-directory: ./packages/core
- uses: actions/upload-artifact@v3
if: failure()
with:
name: typecheck-build-dist
path: ./packages/core/dist
if-no-files-found: error
core-edge-runtime:
e2e-llamaindex-examples:
strategy:
fail-fast: false
matrix:
packages:
- cloudflare-worker-agent
- nextjs-agent
- nextjs-edge-runtime
- nextjs-node-runtime
- waku-query-engine
- llama-parse-browser
runs-on: ubuntu-latest
name: Build LlamaIndex Example (${{ matrix.packages }})
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
@@ -92,17 +110,18 @@ jobs:
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build --filter @llamaindex/edge
- name: Build Edge Runtime
- name: Build llamaindex
run: pnpm run build
working-directory: ./packages/edge/e2e/test-edge-runtime
- name: Build ${{ matrix.packages }}
run: pnpm run build
working-directory: e2e/examples/${{ matrix.packages }}
typecheck-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
@@ -111,18 +130,39 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build --filter llamaindex
run: pnpm run build
- name: Copy examples
run: rsync -rv --exclude=node_modules ./examples ${{ runner.temp }}
- name: Pack @llamaindex/env
run: pnpm pack --pack-destination ${{ runner.temp }}
working-directory: packages/env
- name: Pack llamaindex
run: pnpm pack --pack-destination ${{ runner.temp }}
working-directory: packages/core
- name: Pack packages
run: |
for dir in packages/*; do
if [ -d "$dir" ] && [ -f "$dir/package.json" ] && [[ ! "$dir" =~ autotool ]]; then
echo "Packing $dir"
pnpm pack --pack-destination ${{ runner.temp }} -C $dir
else
echo "Skipping $dir, no package.json found"
fi
done
- name: Pack provider packages
run: |
for dir in packages/providers/* packages/providers/storage/*; do
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
echo "Packing $dir"
pnpm pack --pack-destination ${{ runner.temp }} -C $dir
else
echo "Skipping $dir, no package.json found"
fi
done
- name: Install
run: npm add ${{ runner.temp }}/*.tgz
working-directory: ${{ runner.temp }}/examples
- name: Run Type Check
run: npx tsc --project ./tsconfig.json
working-directory: ${{ runner.temp }}/examples
- uses: actions/upload-artifact@v4
if: failure()
with:
name: build-dist
path: |
${{ runner.temp }}/*.tgz
if-no-files-found: error
+3
View File
@@ -48,3 +48,6 @@ playwright/.cache/
# intellij
**/.idea
# generated API
packages/cloud/src/client
+1 -3
View File
@@ -1,3 +1 @@
pnpm format
pnpm lint
npx lint-staged
pnpm run lint-staged
-1
View File
@@ -1 +0,0 @@
pnpm test
+3
View File
@@ -1,2 +1,5 @@
auto-install-peers = true
enable-pre-post-scripts = true
prefer-workspace-packages = true
save-workspace-protocol = true
link-workspace-packages = true
+1 -1
View File
@@ -1 +1 @@
18
20
+3
View File
@@ -4,3 +4,6 @@ pnpm-lock.yaml
lib/
dist/
.docusaurus/
.source/
# prttier doesn't support mdx3 we are using
*.mdx
+2 -1
View File
@@ -10,8 +10,9 @@
"name": "Debug Example",
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "pnpm",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/examples",
"runtimeArgs": ["ts-node", "${fileBasename}"]
"runtimeArgs": ["npx", "tsx", "${file}"]
}
]
}
+1
View File
@@ -0,0 +1 @@
LlamaIndexTS
+3 -1
View File
@@ -13,5 +13,7 @@
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"prettier.prettierPath": "./node_modules/prettier",
"prettier.configPath": "prettier.config.mjs"
}
+38 -72
View File
@@ -2,86 +2,58 @@
## Structure
This is a monorepo built with Turborepo
LlamaIndex.TS uses pnpm monorepo.
Right now there are two packages of importance:
We recommend you to understand the basics of Node.js, TypeScript, pnpm, and of course, LLM before contributing.
packages/core which is the main NPM library llamaindex
There are some important folders in the repository:
examples is where the demo code lives
### Turborepo docs
You can checkout how Turborepo works using the default [README-turborepo.md](/README-turborepo.md)
- `packages/*`: Contains the source code of the packages. Each package is a separate npm package.
- `llamaindex`: The starter package for LlamaIndex.TS, which contains the all sub-packages.
- `core`: The core package of LlamaIndex.TS, which contains the abstract classes and interfaces. It is designed for
all JS runtime environments.
- `env`: The environment package of LlamaIndex.TS, which contains the environment-specific classes and interfaces. It
includes compatibility layers for Node.js, Deno, Vercel Edge Runtime, Cloudflare Workers...
- `apps/*`: The applications based on LlamaIndex.TS.
- `next`: Our documentation website based on Next.js.
- `examples`: The code examples of LlamaIndex.TS using Node.js.
## Getting Started
Install NodeJS. Preferably v18 using nvm or n.
Inside the LlamaIndexTS directory:
Make sure you have Node.js LIS (Long-term Support) installed. You can check your Node.js version by running:
```shell
node -v
# v20.x.x
```
npm i -g pnpm ts-node
### Use pnpm
```shell
corepack enable
```
### Install dependencies
```shell
pnpm install
```
Note: we use pnpm in this repo, which has a lot of the same functionality and CLI options as npm but it does do some things better in a monorepo, like centralizing dependencies and caching.
### Build the packages
PNPM's has documentation on its [workspace feature](https://pnpm.io/workspaces) and Turborepo had some [useful documentation also](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks).
### Running Typescript
When we publish to NPM we will have a tsc compiled version of the library in JS. For now, the easiest thing to do is use ts-node.
### Test cases
To run them, run
```
pnpm run test
```
To write new test cases write them in [packages/core/src/tests](/packages/core/src/tests)
We use Jest https://jestjs.io/ to write our test cases. Jest comes with a bunch of built in assertions using the expect function: https://jestjs.io/docs/expect
### Demo applications
There is an existing ["example"](/examples/README.md) demos folder with mainly NodeJS scripts. Feel free to add additional demos to that folder. If you would like to try out your changes in the core package with a new demo, you need to run the build command in the README.
You can create new demo applications in the apps folder. Just run pnpm init in the folder after you create it to create its own package.json
### Installing packages
To install packages for a specific package or demo application, run
```
pnpm add [NPM Package] --filter [package or application i.e. core or docs]
```
To install packages for every package or application run
```
pnpm add -w [NPM Package]
```shell
# Build all packages
turbo build --filter "./packages/*"
```
### Docs
To contribute to the docs, go to the docs website folder and run the Docusaurus instance.
```bash
cd apps/docs
pnpm install
pnpm start
```
That should start a webserver which will serve the docs on https://localhost:3000
Any changes you make should be reflected in the browser. If you need to regenerate the API docs and find that your TSDoc isn't getting the updates, feel free to remove apps/docs/api. It will automatically regenerate itself when you run pnpm start again.
See the [docs](./apps/next/README.md) for more information.
## Changeset
We use [changesets](https://github.com/changesets/changesets) for managing versions and changelogs. To create a new changeset, run:
We use [changesets](https://github.com/changesets/changesets) for managing versions and changelogs. To create a new
changeset, run in the root folder:
```
pnpm changeset
@@ -91,16 +63,10 @@ Please send a descriptive changeset for each PR.
## Publishing (maintainers only)
To publish a new version of the library, first create a new version:
The [Release Github Action](.github/workflows/release.yml) is automatically generating and updating a
PR called "Release {version}".
```shell
pnpm new-version
```
This PR will update the `package.json` and `CHANGELOG.md` files of each package according to
the current changesets in the [.changeset](.changeset) folder.
If everything looks good, commit the generated files and release the new version:
```shell
pnpm release
git push # push to the main branch
git push --tags
```
If this PR is merged it will automatically add version tags to the repository and publish the updated packages to NPM.
-81
View File
@@ -1,81 +0,0 @@
# Turborepo starter
This is an official starter Turborepo.
## Using this example
Run the following command:
```sh
npx create-turbo@latest
```
## What's inside?
This Turborepo includes the following packages/apps:
### Apps and Packages
- `docs`: a [Next.js](https://nextjs.org/) app
- `web`: another [Next.js](https://nextjs.org/) app
- `ui`: a stub React component library shared by both `web` and `docs` applications
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
### Utilities
This Turborepo has some additional tools already setup for you:
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting
### Build
To build all apps and packages, run the following command:
```
cd my-turborepo
pnpm build
```
### Develop
To develop all apps and packages, run the following command:
```
cd my-turborepo
pnpm dev
```
### Remote Caching
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
```
cd my-turborepo
npx turbo login
```
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
```
npx turbo link
```
## Useful Links
Learn more about the power of Turborepo:
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
+59 -148
View File
@@ -1,13 +1,17 @@
# LlamaIndex.TS
<p align="center">
<img height="100" width="100" alt="LlamaIndex logo" src="https://ts.llamaindex.ai/square.svg" />
</p>
<h1 align="center">LlamaIndex.TS</h1>
<h3 align="center">
Data framework for your LLM application.
</h3>
[![NPM Version](https://img.shields.io/npm/v/llamaindex)](https://www.npmjs.com/package/llamaindex)
[![NPM License](https://img.shields.io/npm/l/llamaindex)](https://www.npmjs.com/package/llamaindex)
[![NPM Downloads](https://img.shields.io/npm/dm/llamaindex)](https://www.npmjs.com/package/llamaindex)
[![Discord](https://img.shields.io/discord/1059199217496772688)](https://discord.com/invite/eN6D2HQ4aX)
LlamaIndex is a data framework for your LLM application.
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in Typescript and Javascript.
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in JS runtime environments with TypeScript support.
Documentation: https://ts.llamaindex.ai/
@@ -19,58 +23,58 @@ Try examples online:
LlamaIndex.TS aims to be a lightweight, easy to use set of libraries to help you integrate large language models into your applications with your own data.
## Getting started with an example:
## Compatibility
LlamaIndex.TS requires Node v18 or higher. You can download it from https://nodejs.org or use https://nvm.sh (our preferred option).
### Multiple JS Environment Support
In a new folder:
LlamaIndex.TS supports multiple JS environments, including:
```bash
export OPENAI_API_KEY="sk-......" # Replace with your key from https://platform.openai.com/account/api-keys
pnpm init
pnpm install typescript
pnpm exec tsc --init # if needed
- Node.js >= 20 ✅
- Deno ✅
- Bun ✅
- Nitro ✅
- Vercel Edge Runtime ✅ (with some limitations)
- Cloudflare Workers ✅ (with some limitations)
For now, browser support is limited due to the lack of support for [AsyncLocalStorage-like APIs](https://github.com/tc39/proposal-async-context)
### Supported LLMs:
- OpenAI LLms
- Anthropic LLms
- Groq LLMs
- Llama2, Llama3, Llama3.1 LLMs
- MistralAI LLMs
- Fireworks LLMs
- DeepSeek LLMs
- ReplicateAI LLMs
- TogetherAI LLMs
- HuggingFace LLms
- DeepInfra LLMs
- Gemini LLMs
## Getting started
```shell
npm install llamaindex
pnpm install llamaindex
pnpm install @types/node
yarn add llamaindex
```
Create the file example.ts
### Setup in Node.js, Deno, Bun, TypeScript...?
```ts
// example.ts
import fs from "fs/promises";
import { Document, VectorStoreIndex } from "llamaindex";
See our official document: <https://ts.llamaindex.ai/docs/llamaindex/getting_started/>
async function main() {
// Load essay from abramov.txt in Node
const essay = await fs.readFile(
"node_modules/llamaindex/examples/abramov.txt",
"utf-8",
);
### Adding provider packages
// Create Document object with essay
const document = new Document({ text: essay });
In most cases, you'll also need to install provider packages to use LlamaIndexTS. These are for adding AI models, file readers for ingestion or storing documents, e.g. in vector databases.
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments([document]);
For example, to use the OpenAI LLM, you would install the following package:
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What did the author do in college?",
});
// Output response
console.log(response.toString());
}
main();
```
Then you can run it using
```bash
pnpm dlx ts-node example.ts
```shell
npm install @llamaindex/openai
pnpm install @llamaindex/openai
yarn add @llamaindex/openai
```
## Playground
@@ -79,118 +83,25 @@ Check out our NextJS playground at https://llama-playground.vercel.app/. The sou
## Core concepts for getting started:
- [Document](/packages/core/src/Node.ts): A document represents a text file, PDF file or other contiguous piece of data.
- [Document](/packages/llamaindex/src/Node.ts): A document represents a text file, PDF file or other contiguous piece of data.
- [Node](/packages/core/src/Node.ts): The basic data building block. Most commonly, these are parts of the document split into manageable pieces that are small enough to be fed into an embedding model and LLM.
- [Node](/packages/llamaindex/src/Node.ts): The basic data building block. Most commonly, these are parts of the document split into manageable pieces that are small enough to be fed into an embedding model and LLM.
- [Embedding](/packages/core/src/embeddings/OpenAIEmbedding.ts): Embeddings are sets of floating point numbers which represent the data in a Node. By comparing the similarity of embeddings, we can derive an understanding of the similarity of two pieces of data. One use case is to compare the embedding of a question with the embeddings of our Nodes to see which Nodes may contain the data needed to answer that quesiton. Because the default service context is OpenAI, the default embedding is `OpenAIEmbedding`. If using different models, say through Ollama, use this [Embedding](/packages/core/src/embeddings/OllamaEmbedding.ts) (see all [here](/packages/core/src/embeddings)).
- [Embedding](/packages/llamaindex/src/embeddings/OpenAIEmbedding.ts): Embeddings are sets of floating point numbers which represent the data in a Node. By comparing the similarity of embeddings, we can derive an understanding of the similarity of two pieces of data. One use case is to compare the embedding of a question with the embeddings of our Nodes to see which Nodes may contain the data needed to answer that question. Because the default service context is OpenAI, the default embedding is `OpenAIEmbedding`. If using different models, say through Ollama, use this [Embedding](/packages/llamaindex/src/embeddings/OllamaEmbedding.ts) (see all [here](/packages/llamaindex/src/embeddings)).
- [Indices](/packages/core/src/indices/): Indices store the Nodes and the embeddings of those nodes. QueryEngines retrieve Nodes from these Indices using embedding similarity.
- [Indices](/packages/llamaindex/src/indices/): Indices store the Nodes and the embeddings of those nodes. QueryEngines retrieve Nodes from these Indices using embedding similarity.
- [QueryEngine](/packages/core/src/engines/query/RetrieverQueryEngine.ts): Query engines are what generate the query you put in and give you back the result. Query engines generally combine a pre-built prompt with selected Nodes from your Index to give the LLM the context it needs to answer your query. To build a query engine from your Index (recommended), use the [`asQueryEngine`](/packages/core/src/indices/BaseIndex.ts) method on your Index. See all query engines [here](/packages/core/src/engines/query).
- [QueryEngine](/packages/llamaindex/src/engines/query/RetrieverQueryEngine.ts): Query engines are what generate the query you put in and give you back the result. Query engines generally combine a pre-built prompt with selected Nodes from your Index to give the LLM the context it needs to answer your query. To build a query engine from your Index (recommended), use the [`asQueryEngine`](/packages/llamaindex/src/indices/BaseIndex.ts) method on your Index. See all query engines [here](/packages/llamaindex/src/engines/query).
- [ChatEngine](/packages/core/src/engines/chat/SimpleChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices. See all chat engines [here](/packages/core/src/engines/chat).
- [ChatEngine](/packages/llamaindex/src/engines/chat/SimpleChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices. See all chat engines [here](/packages/llamaindex/src/engines/chat).
- [SimplePrompt](/packages/core/src/Prompt.ts): A simple standardized function call definition that takes in inputs and formats them in a template literal. SimplePrompts can be specialized using currying and combined using other SimplePrompt functions.
## Using NextJS
If you're using the NextJS App Router, you can choose between the Node.js and the [Edge runtime](https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes#edge-runtime).
With NextJS 13 and 14, using the Node.js runtime is the default. You can explicitly set the Edge runtime in your [router handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) by adding this line:
```typescript
export const runtime = "edge";
```
The following sections explain further differences in using the Node.js or Edge runtime.
### Using the Node.js runtime
Add the following config to your `next.config.js` to ignore specific packages in the server-side bundling:
```js
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ["pdf2json", "@zilliz/milvus2-sdk-node"],
},
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
sharp$: false,
"onnxruntime-node$": false,
};
return config;
},
};
module.exports = nextConfig;
```
### Using the Edge runtime
We publish a dedicated package (`@llamaindex/edge` instead of `llamaindex`) for using the Edge runtime. To use it, first install the package:
```shell
pnpm install @llamaindex/edge
```
> _Note_: Ensure that your `package.json` doesn't include the `llamaindex` package if you're using `@llamaindex/edge`.
Then make sure to use the correct import statement in your code:
```typescript
// replace 'llamaindex' with '@llamaindex/edge'
import {} from "@llamaindex/edge";
```
A further difference is that the `@llamaindex/edge` package doesn't export classes from the `readers` or `storage` folders. The reason is that most of these classes are not compatible with the Edge runtime.
If you need any of those classes, you have to import them instead directly. Here's an example for importing the `PineconeVectorStore` class:
```typescript
import { PineconeVectorStore } from "@llamaindex/edge/storage/vectorStore/PineconeVectorStore";
```
As the `PDFReader` is not with the Edge runtime, here's how to use the `SimpleDirectoryReader` with the `LlamaParseReader` to load PDFs:
```typescript
import { SimpleDirectoryReader } from "@llamaindex/edge/readers/SimpleDirectoryReader";
import { LlamaParseReader } from "@llamaindex/edge/readers/LlamaParseReader";
export const DATA_DIR = "./data";
export async function getDocuments() {
const reader = new SimpleDirectoryReader();
// Load PDFs using LlamaParseReader
return await reader.loadData({
directoryPath: DATA_DIR,
fileExtToReader: {
pdf: new LlamaParseReader({ resultType: "markdown" }),
},
});
}
```
> _Note_: Reader classes have to be added explictly to the `fileExtToReader` map in the Edge version of the `SimpleDirectoryReader`.
You'll find a complete example of using the Edge runtime with LlamaIndexTS here: https://github.com/run-llama/create_llama_projects/tree/main/nextjs-edge-llamaparse
## Supported LLMs:
- OpenAI GPT-3.5-turbo and GPT-4
- Anthropic Claude 3 (Opus, Sonnet, and Haiku) and the legacy models (Claude 2 and Instant)
- Groq LLMs
- Llama2 Chat LLMs (70B, 13B, and 7B parameters)
- MistralAI Chat LLMs
- Fireworks Chat LLMs
- [SimplePrompt](/packages/llamaindex/src/Prompt.ts): A simple standardized function call definition that takes in inputs and formats them in a template literal. SimplePrompts can be specialized using currying and combined using other SimplePrompt functions.
## Contributing:
We are in the very early days of LlamaIndex.TS. If youre interested in hacking on it with us check out our [contributing guide](/CONTRIBUTING.md)
Please see our [contributing guide](CONTRIBUTING.md) for more information.
You are highly encouraged to contribute to LlamaIndex.TS!
## Bugs? Questions?
## Community
Please join our Discord! https://discord.com/invite/eN6D2HQ4aX
-21
View File
@@ -1,21 +0,0 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
lib
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
-28
View File
@@ -1,28 +0,0 @@
# docs
## 0.0.4
### Patch Changes
- Updated dependencies [5116ad8]
- @llamaindex/env@0.0.5
## 0.0.3
### Patch Changes
- 09bf27a: Add Groq LLM to LlamaIndex
- Updated dependencies [cf87f84]
- @llamaindex/env@0.0.4
## 0.0.2
### Patch Changes
- 0f64084: docs: update API references
## 0.0.1
### Patch Changes
- 3154f52: chore: add qdrant readme
-47
View File
@@ -1,47 +0,0 @@
# Website
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
### Installation
```
$ pnpm
```
### Local Development
```
$ pnpm start
```
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
However, the searchbar may not function with `yarn start`. Instead, run `yarn build` and launch a server:
```
$ npx http-server ./build
```
### Build
```
$ pnpm build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Deployment
Using SSH:
```
$ USE_SSH=true pnpm deploy
```
Not using SSH:
```
$ GIT_USER=<Your GitHub username> pnpm deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
-1
View File
@@ -1 +0,0 @@
api/
-2
View File
@@ -1,2 +0,0 @@
label: Examples
position: 2
-85
View File
@@ -1,85 +0,0 @@
# Agents
A built-in agent that can take decisions and reasoning based on the tools provided to it.
## OpenAI Agent
```ts
import { FunctionTool, OpenAIAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
// Define the parameters of the sum function as a JSON schema
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
// Define the parameters of the divide function as a JSON schema
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The dividend to divide",
},
b: {
type: "number",
description: "The divisor to divide by",
},
},
required: ["a", "b"],
};
async function main() {
// Create a function tool from the sum function
const sumFunctionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
// Create a function tool from the divide function
const divideFunctionTool = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers"
parameters: divideJSON,
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [sumFunctionTool, divideFunctionTool],
verbose: true,
});
// Chat with the agent
const response = await agent.chat({
message: "How much is 5 + 5? then divide by 2",
});
// Print the response
console.log(String(response));
}
main().then(() => {
console.log("Done");
});
```
-12
View File
@@ -1,12 +0,0 @@
---
sidebar_position: 1
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/chatEngine";
# Chat Engine
Chat Engine is a class that allows you to create a chatbot from a retriever. It is a wrapper around a retriever that allows you to chat with it in a conversational manner.
<CodeBlock language="ts">{CodeSource}</CodeBlock>
@@ -1,7 +0,0 @@
---
sidebar_position: 5
---
# More examples
You can check out more examples in the [examples](https://github.com/run-llama/LlamaIndexTS/tree/main/examples) folder of the repository.
@@ -1,10 +0,0 @@
---
sidebar_position: 4
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/storageContext";
# Save/Load an Index
<CodeBlock language="ts">{CodeSource}</CodeBlock>
-10
View File
@@ -1,10 +0,0 @@
---
sidebar_position: 3
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/summaryIndex";
# Summary Index
<CodeBlock language="ts">{CodeSource}</CodeBlock>
-10
View File
@@ -1,10 +0,0 @@
---
sidebar_position: 2
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/vectorIndex";
# Vector Index
<CodeBlock language="ts">{CodeSource}</CodeBlock>
@@ -1,2 +0,0 @@
label: Getting Started
position: 1
@@ -1,78 +0,0 @@
---
sidebar_position: 3
---
# Concepts
LlamaIndex.TS helps you build LLM-powered applications (e.g. Q&A, chatbot) over custom data.
In this high-level concepts guide, you will learn:
- how an LLM can answer questions using your own data.
- key concepts and modules in LlamaIndex.TS for composing your own query pipeline.
## Answering Questions Across Your Data
LlamaIndex uses a two stage method when using an LLM with your data:
1. **indexing stage**: preparing a knowledge base, and
2. **querying stage**: retrieving relevant context from the knowledge to assist the LLM in responding to a question
![](../_static/concepts/rag.jpg)
This process is also known as Retrieval Augmented Generation (RAG).
LlamaIndex.TS provides the essential toolkit for making both steps super easy.
Let's explore each stage in detail.
### Indexing Stage
LlamaIndex.TS help you prepare the knowledge base with a suite of data connectors and indexes.
![](../_static/concepts/indexing.jpg)
[**Data Loaders**](../modules/data_loader.md):
A data connector (i.e. `Reader`) ingest data from different data sources and data formats into a simple `Document` representation (text and simple metadata).
[**Documents / Nodes**](../modules/documents_and_nodes/index.md): A `Document` is a generic container around any data source - for instance, a PDF, an API output, or retrieved data from a database. A `Node` is the atomic unit of data in LlamaIndex and represents a "chunk" of a source `Document`. It's a rich representation that includes metadata and relationships (to other nodes) to enable accurate and expressive retrieval operations.
[**Data Indexes**](../modules/data_index.md):
Once you've ingested your data, LlamaIndex helps you index data into a format that's easy to retrieve.
Under the hood, LlamaIndex parses the raw documents into intermediate representations, calculates vector embeddings, and stores your data in-memory or to disk.
### Querying Stage
In the querying stage, the query pipeline retrieves the most relevant context given a user query,
and pass that to the LLM (along with the query) to synthesize a response.
This gives the LLM up-to-date knowledge that is not in its original training data,
(also reducing hallucination).
The key challenge in the querying stage is retrieval, orchestration, and reasoning over (potentially many) knowledge bases.
LlamaIndex provides composable modules that help you build and integrate RAG pipelines for Q&A (query engine), chatbot (chat engine), or as part of an agent.
These building blocks can be customized to reflect ranking preferences, as well as composed to reason over multiple knowledge bases in a structured way.
![](../_static/concepts/querying.jpg)
#### Building Blocks
[**Retrievers**](../modules/retriever.md):
A retriever defines how to efficiently retrieve relevant context from a knowledge base (i.e. index) when given a query.
The specific retrieval logic differs for difference indices, the most popular being dense retrieval against a vector index.
[**Response Synthesizers**](../modules/response_synthesizer.md):
A response synthesizer generates a response from an LLM, using a user query and a given set of retrieved text chunks.
#### Pipelines
[**Query Engines**](../modules/query_engines):
A query engine is an end-to-end pipeline that allow you to ask question over your data.
It takes in a natural language query, and returns a response, along with reference context retrieved and passed to the LLM.
[**Chat Engines**](../modules/chat_engine.md):
A chat engine is an end-to-end pipeline for having a conversation with your data
(multiple back-and-forth instead of a single question & answer).
@@ -1,15 +0,0 @@
---
sidebar_position: 2
---
# Environments
LlamaIndex currently officially supports NodeJS 18 and NodeJS 20.
## NextJS App Router
If you're using NextJS App Router route handlers/serverless functions, you'll need to use the NodeJS mode:
```js
export const runtime = "nodejs"; // default
```
@@ -1,63 +0,0 @@
---
sidebar_position: 0
---
# Installation and Setup
Make sure you have NodeJS v18 or higher.
## Using create-llama
The easiest way to get started with LlamaIndex is by using `create-llama`. This CLI tool enables you to quickly start building a new LlamaIndex application, with everything set up for you.
Just run
<Tabs>
<TabItem value="1" label="npm" default>
```bash
npx create-llama@latest
```
</TabItem>
<TabItem value="2" label="Yarn">
```bash
yarn create llama
```
</TabItem>
<TabItem value="3" label="pnpm">
```bash
pnpm create llama@latest
```
</TabItem>
</Tabs>
to get started. Once your app is generated, run
```bash npm2yarn
npm run dev
```
to start the development server. You can then visit [http://localhost:3000](http://localhost:3000) to see your app
## Installation from NPM
```bash npm2yarn
npm install llamaindex
```
### Environment variables
Our examples use OpenAI by default. You'll need to set up your Open AI key like so:
```bash
export OPENAI_API_KEY="sk-......" # Replace with your key from https://platform.openai.com/account/api-keys
```
If you want to have it automatically loaded every time, add it to your `.zshrc/.bashrc`.
WARNING: do not check in your OpenAI key into version control.
@@ -1,51 +0,0 @@
---
sidebar_position: 1
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/vectorIndex";
import TSConfigSource from "!!raw-loader!../../../../examples/tsconfig.json";
# Starter Tutorial
Make sure you have installed LlamaIndex.TS and have an OpenAI key. If you haven't, check out the [installation](installation) guide.
## From scratch(node.js + TypeScript):
In a new folder:
```bash npm2yarn
npm init
npm install -D typescript @types/node
```
Create the file `example.ts`. This code will load some example data, create a document, index it (which creates embeddings using OpenAI), and then creates query engine to answer questions about the data.
<CodeBlock language="ts">{CodeSource}</CodeBlock>
Create a `tsconfig.json` file in the same folder:
<CodeBlock language="json">{TSConfigSource}</CodeBlock>
Now you can run the code with
```bash
npx tsx example.ts
```
Also, you can clone our examples and try them out:
```bash npm2yarn
npx degit run-llama/LlamaIndexTS/examples my-new-project
cd my-new-project
npm install
npx tsx ./vectorIndex.ts
```
## From scratch (Next.js + TypeScript):
You just need one command to create a new Next.js project:
```bash npm2yarn
npx create-llama@latest
```
-56
View File
@@ -1,56 +0,0 @@
---
sidebar_position: 0
slug: /
---
# What is LlamaIndex.TS?
LlamaIndex.TS is a data framework for LLM applications to ingest, structure, and access private or domain-specific data. While a python package is also available (see [here](https://docs.llamaindex.ai/en/stable/)), LlamaIndex.TS offers core features in a simple package, optimized for usage with TypeScript.
## 🚀 Why LlamaIndex.TS?
At their core, LLMs offer a natural language interface between humans and inferred data. Widely available models come pre-trained on huge amounts of publicly available data, from Wikipedia and mailing lists to textbooks and source code.
Applications built on top of LLMs often require augmenting these models with private or domain-specific data. Unfortunately, that data can be distributed across siloed applications and data stores. It's behind APIs, in SQL databases, or trapped in PDFs and slide decks.
That's where **LlamaIndex.TS** comes in.
## 🦙 How can LlamaIndex.TS help?
LlamaIndex.TS provides the following tools:
- **Data loading** ingest your existing `.txt`, `.pdf`, `.csv`, `.md` and `.docx` data directly
- **Data indexes** structure your data in intermediate representations that are easy and performant for LLMs to consume.
- **Engines** provide natural language access to your data. For example:
- Query engines are powerful retrieval interfaces for knowledge-augmented output.
- Chat engines are conversational interfaces for multi-message, "back and forth" interactions with your data.
## 👨‍👩‍👧‍👦 Who is LlamaIndex for?
LlamaIndex.TS provides a core set of tools, essential for anyone building LLM apps with JavaScript and TypeScript.
Our high-level API allows beginner users to use LlamaIndex.TS to ingest and query their data.
For more complex applications, our lower-level APIs allow advanced users to customize and extend any module—data connectors, indices, retrievers, and query engines, to fit their needs.
## Getting Started
`npm install llamaindex`
Our documentation includes [Installation Instructions](./getting_started/installation.mdx) and a [Starter Tutorial](./getting_started/starter.mdx) to build your first application.
Once you're up and running, [High-Level Concepts](./getting_started/concepts.md) has an overview of LlamaIndex's modular architecture. For more hands-on practical examples, look through our Examples section on the sidebar.
## 🗺️ Ecosystem
To download or contribute, find LlamaIndex on:
- Github: https://github.com/run-llama/LlamaIndexTS
- NPM: https://www.npmjs.com/package/llamaindex
## Community
Need help? Have a feature suggestion? Join the LlamaIndex community:
- Twitter: https://twitter.com/llama_index
- Discord https://discord.gg/dGcwcsnxhU
-3
View File
@@ -1,3 +0,0 @@
label: "Modules"
collapsed: false
position: 5
@@ -1,2 +0,0 @@
label: "Agents"
position: 3
-14
View File
@@ -1,14 +0,0 @@
# Agents
An “agent” is an automated reasoning and decision engine. It takes in a user input/query and can make internal decisions for executing that query in order to return the correct result. The key agent components can include, but are not limited to:
- Breaking down a complex question into smaller ones
- Choosing an external Tool to use + coming up with parameters for calling the Tool
- Planning out a set of tasks
- Storing previously completed tasks in a memory module
## Getting Started
LlamaIndex.TS comes with a few built-in agents, but you can also create your own. The built-in agents include:
- [OpenAI Agent](./openai.mdx)
@@ -1,309 +0,0 @@
# Multi-Document Agent
In this guide, you learn towards setting up an agent that can effectively answer different types of questions over a larger set of documents.
These questions include the following
- QA over a specific doc
- QA comparing different docs
- Summaries over a specific doc
- Comparing summaries between different docs
We do this with the following architecture:
- setup a “document agent” over each Document: each doc agent can do QA/summarization within its doc
- setup a top-level agent over this set of document agents. Do tool retrieval and then do CoT over the set of tools to answer a question.
## Setup and Download Data
We first start by installing the necessary libraries and downloading the data.
```bash
pnpm i llamaindex
```
```ts
import {
Document,
ObjectIndex,
OpenAI,
OpenAIAgent,
QueryEngineTool,
SimpleNodeParser,
SimpleToolNodeMapping,
SummaryIndex,
VectorStoreIndex,
Settings,
storageContextFromDefaults,
} from "llamaindex";
```
And then for the data we will run through a list of countries and download the wikipedia page for each country.
```ts
import fs from "fs";
import path from "path";
const dataPath = path.join(__dirname, "tmp_data");
const extractWikipediaTitle = async (title: string) => {
const fileExists = fs.existsSync(path.join(dataPath, `${title}.txt`));
if (fileExists) {
console.log(`File already exists for the title: ${title}`);
return;
}
const queryParams = new URLSearchParams({
action: "query",
format: "json",
titles: title,
prop: "extracts",
explaintext: "true",
});
const url = `https://en.wikipedia.org/w/api.php?${queryParams}`;
const response = await fetch(url);
const data: any = await response.json();
const pages = data.query.pages;
const page = pages[Object.keys(pages)[0]];
const wikiText = page.extract;
await new Promise((resolve) => {
fs.writeFile(path.join(dataPath, `${title}.txt`), wikiText, (err: any) => {
if (err) {
console.error(err);
resolve(title);
return;
}
console.log(`${title} stored in file!`);
resolve(title);
});
});
};
```
```ts
export const extractWikipedia = async (titles: string[]) => {
if (!fs.existsSync(dataPath)) {
fs.mkdirSync(dataPath);
}
for await (const title of titles) {
await extractWikipediaTitle(title);
}
console.log("Extration finished!");
```
These files will be saved in the `tmp_data` folder.
Now we can call the function to download the data for each country.
```ts
await extractWikipedia([
"Brazil",
"United States",
"Canada",
"Mexico",
"Argentina",
"Chile",
"Colombia",
"Peru",
"Venezuela",
"Ecuador",
"Bolivia",
"Paraguay",
"Uruguay",
"Guyana",
"Suriname",
"French Guiana",
"Falkland Islands",
]);
```
## Load the data
Now that we have the data, we can load it into the LlamaIndex and store as a document.
```ts
import { Document } from "llamaindex";
const countryDocs: Record<string, Document> = {};
for (const title of wikiTitles) {
const path = `./agent/helpers/tmp_data/${title}.txt`;
const text = await fs.readFile(path, "utf-8");
const document = new Document({ text: text, id_: path });
countryDocs[title] = document;
}
```
## Setup LLM and StorageContext
We will be using gpt-4 for this example and we will use the `StorageContext` to store the documents in-memory.
```ts
Settings.llm = new OpenAI({
model: "gpt-4",
});
const storageContext = await storageContextFromDefaults({
persistDir: "./storage",
});
```
## Building Multi-Document Agents
In this section we show you how to construct the multi-document agent. We first build a document agent for each document, and then define the top-level parent agent with an object index.
```ts
const documentAgents: Record<string, any> = {};
const queryEngines: Record<string, any> = {};
```
Now we iterate over each country and create a document agent for each one.
### Build Agent for each Document
In this section we define “document agents” for each document.
We define both a vector index (for semantic search) and summary index (for summarization) for each document. The two query engines are then converted into tools that are passed to an OpenAI function calling agent.
This document agent can dynamically choose to perform semantic search or summarization within a given document.
We create a separate document agent for each coutnry.
```ts
for (const title of wikiTitles) {
// parse the document into nodes
const nodes = new SimpleNodeParser({
chunkSize: 200,
chunkOverlap: 20,
}).getNodesFromDocuments([countryDocs[title]]);
// create the vector index for specific search
const vectorIndex = await VectorStoreIndex.init({
storageContext: storageContext,
nodes,
});
// create the summary index for broader search
const summaryIndex = await SummaryIndex.init({
nodes,
});
const vectorQueryEngine = summaryIndex.asQueryEngine();
const summaryQueryEngine = summaryIndex.asQueryEngine();
// create the query engines for each task
const queryEngineTools = [
new QueryEngineTool({
queryEngine: vectorQueryEngine,
metadata: {
name: "vector_tool",
description: `Useful for questions related to specific aspects of ${title} (e.g. the history, arts and culture, sports, demographics, or more).`,
},
}),
new QueryEngineTool({
queryEngine: summaryQueryEngine,
metadata: {
name: "summary_tool",
description: `Useful for any requests that require a holistic summary of EVERYTHING about ${title}. For questions about more specific sections, please use the vector_tool.`,
},
}),
];
// create the document agent
const agent = new OpenAIAgent({
tools: queryEngineTools,
llm,
verbose: true,
});
documentAgents[title] = agent;
queryEngines[title] = vectorIndex.asQueryEngine();
}
```
## Build Top-Level Agent
Now we define the top-level agent that can answer questions over the set of document agents.
This agent takes in all document agents as tools. This specific agent RetrieverOpenAIAgent performs tool retrieval before tool use (unlike a default agent that tries to put all tools in the prompt).
Here we use a top-k retriever, but we encourage you to customize the tool retriever method!
Firstly, we create a tool for each document agent
```ts
const allTools: QueryEngineTool[] = [];
```
```ts
for (const title of wikiTitles) {
const wikiSummary = `
This content contains Wikipedia articles about ${title}.
Use this tool if you want to answer any questions about ${title}
`;
const docTool = new QueryEngineTool({
queryEngine: documentAgents[title],
metadata: {
name: `tool_${title}`,
description: wikiSummary,
},
});
allTools.push(docTool);
}
```
Our top level agent will use this document agents as tools and use toolRetriever to retrieve the best tool to answer a question.
```ts
// map the tools to nodes
const toolMapping = SimpleToolNodeMapping.fromObjects(allTools);
// create the object index
const objectIndex = await ObjectIndex.fromObjects(
allTools,
toolMapping,
VectorStoreIndex,
{
storageContext,
},
);
// create the top agent
const topAgent = new OpenAIAgent({
toolRetriever: await objectIndex.asRetriever({}),
llm,
verbose: true,
prefixMessages: [
{
content:
"You are an agent designed to answer queries about a set of given countries. Please always use the tools provided to answer a question. Do not rely on prior knowledge.",
role: "system",
},
],
});
```
## Use the Agent
Now we can use the agent to answer questions.
```ts
const response = await topAgent.chat({
message: "Tell me the differences between Brazil and Canada economics?",
});
// print output
console.log(response);
```
You can find the full code for this example [here](https://github.com/run-llama/LlamaIndexTS/tree/main/examples/agent/multi-document-agent.ts)
-187
View File
@@ -1,187 +0,0 @@
---
sidebar_position: 0
---
# OpenAI Agent
OpenAI API that supports function calling, its never been easier to build your own agent!
In this notebook tutorial, we showcase how to write your own OpenAI agent
## Setup
First, you need to install the `llamaindex` package. You can do this by running the following command in your terminal:
```bash
pnpm i llamaindex
```
Then we can define a function to sum two numbers and another function to divide two numbers.
```ts
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
```
## Create a function tool
Now we can create a function tool from the sum function and another function tool from the divide function.
For the parameters of the sum function, we can define a JSON schema.
### JSON Schema
```ts
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The dividend a to divide",
},
b: {
type: "number",
description: "The divisor b to divide by",
},
},
required: ["a", "b"],
};
const sumFunctionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
const divideFunctionTool = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
```
## Create an OpenAIAgent
Now we can create an OpenAIAgent with the function tools.
```ts
const agent = new OpenAIAgent({
tools: [sumFunctionTool, divideFunctionTool],
verbose: true,
});
```
## Chat with the agent
Now we can chat with the agent.
```ts
const response = await agent.chat({
message: "How much is 5 + 5? then divide by 2",
});
console.log(String(response));
```
## Full code
```ts
import { FunctionTool, OpenAIAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
// Define the parameters of the sum function as a JSON schema
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
// Define the parameters of the divide function as a JSON schema
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The argument a to divide",
},
b: {
type: "number",
description: "The argument b to divide",
},
},
required: ["a", "b"],
};
async function main() {
// Create a function tool from the sum function
const sumFunctionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
// Create a function tool from the divide function
const divideFunctionTool = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [sumFunctionTool, divideFunctionTool],
verbose: true,
});
// Chat with the agent
const response = await agent.chat({
message: "How much is 5 + 5? then divide by 2",
});
// Print the response
console.log(String(response));
}
main().then(() => {
console.log("Done");
});
```
@@ -1,132 +0,0 @@
---
sidebar_position: 1
---
# OpenAI Agent + QueryEngineTool
QueryEngineTool is a tool that allows you to query a vector index. In this example, we will create a vector index from a set of documents and then create a QueryEngineTool from the vector index. We will then create an OpenAIAgent with the QueryEngineTool and chat with the agent.
## Setup
First, you need to install the `llamaindex` package. You can do this by running the following command in your terminal:
```bash
pnpm i llamaindex
```
Then you can import the necessary classes and functions.
```ts
import {
OpenAIAgent,
SimpleDirectoryReader,
VectorStoreIndex,
QueryEngineTool,
} from "llamaindex";
```
## Create a vector index
Now we can create a vector index from a set of documents.
```ts
// Load the documents
const documents = await new SimpleDirectoryReader().loadData({
directoryPath: "node_modules/llamaindex/examples/",
});
// Create a vector index from the documents
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
```
## Create a QueryEngineTool
Now we can create a QueryEngineTool from the vector index.
```ts
// Create a query engine from the vector index
const abramovQueryEngine = vectorIndex.asQueryEngine();
// Create a QueryEngineTool with the query engine
const queryEngineTool = new QueryEngineTool({
queryEngine: abramovQueryEngine,
metadata: {
name: "abramov_query_engine",
description: "A query engine for the Abramov documents",
},
});
```
## Create an OpenAIAgent
```ts
// Create an OpenAIAgent with the query engine tool tools
const agent = new OpenAIAgent({
tools: [queryEngineTool],
verbose: true,
});
```
## Chat with the agent
Now we can chat with the agent.
```ts
const response = await agent.chat({
message: "What was his salary?",
});
console.log(String(response));
```
## Full code
```ts
import {
OpenAIAgent,
SimpleDirectoryReader,
VectorStoreIndex,
QueryEngineTool,
} from "llamaindex";
async function main() {
// Load the documents
const documents = await new SimpleDirectoryReader().loadData({
directoryPath: "node_modules/llamaindex/examples/",
});
// Create a vector index from the documents
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
// Create a query engine from the vector index
const abramovQueryEngine = vectorIndex.asQueryEngine();
// Create a QueryEngineTool with the query engine
const queryEngineTool = new QueryEngineTool({
queryEngine: abramovQueryEngine,
metadata: {
name: "abramov_query_engine",
description: "A query engine for the Abramov documents",
},
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [queryEngineTool],
verbose: true,
});
// Chat with the agent
const response = await agent.chat({
message: "What was his salary?",
});
// Print the response
console.log(String(response));
}
main().then(() => {
console.log("Done");
});
```
@@ -1,203 +0,0 @@
# ReAct Agent
The ReAct agent is an AI agent that can reason over the next action, construct an action command, execute the action, and repeat these steps in an iterative loop until the task is complete.
In this notebook tutorial, we showcase how to write your ReAct agent using the `llamaindex` package.
## Setup
First, you need to install the `llamaindex` package. You can do this by running the following command in your terminal:
```bash
pnpm i llamaindex
```
And then you can import the `OpenAIAgent` and `FunctionTool` from the `llamaindex` package.
```ts
import { FunctionTool, OpenAIAgent } from "llamaindex";
```
Then we can define a function to sum two numbers and another function to divide two numbers.
```ts
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
```
## Create a function tool
Now we can create a function tool from the sum function and another function tool from the divide function.
For the parameters of the sum function, we can define a JSON schema.
### JSON Schema
```ts
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The dividend a to divide",
},
b: {
type: "number",
description: "The divisor b to divide by",
},
},
required: ["a", "b"],
};
const sumFunctionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
const divideFunctionTool = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
```
## Create an ReAct
Now we can create an OpenAIAgent with the function tools.
```ts
const agent = new ReActAgent({
tools: [sumFunctionTool, divideFunctionTool],
verbose: true,
});
```
## Chat with the agent
Now we can chat with the agent.
```ts
const response = await agent.chat({
message: "How much is 5 + 5? then divide by 2",
});
console.log(String(response));
```
The output will be:
```bash
Thought: I need to use a tool to help me answer the question.
Action: sumNumbers
Action Input: {"a":5,"b":5}
Observation: 10
Thought: I can answer without using any more tools.
Answer: The sum of 5 and 5 is 10, and when divided by 2, the result is 5.
The sum of 5 and 5 is 10, and when divided by 2, the result is 5.
```
## Full code
```ts
import { FunctionTool, ReActAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }): number {
return a + b;
}
// Define a function to divide two numbers
function divideNumbers({ a, b }: { a: number; b: number }): number {
return a / b;
}
// Define the parameters of the sum function as a JSON schema
const sumJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The first number",
},
b: {
type: "number",
description: "The second number",
},
},
required: ["a", "b"],
};
// Define the parameters of the divide function as a JSON schema
const divideJSON = {
type: "object",
properties: {
a: {
type: "number",
description: "The argument a to divide",
},
b: {
type: "number",
description: "The argument b to divide",
},
},
required: ["a", "b"],
};
async function main() {
// Create a function tool from the sum function
const sumFunctionTool = new FunctionTool(sumNumbers, {
name: "sumNumbers",
description: "Use this function to sum two numbers",
parameters: sumJSON,
});
// Create a function tool from the divide function
const divideFunctionTool = new FunctionTool(divideNumbers, {
name: "divideNumbers",
description: "Use this function to divide two numbers",
parameters: divideJSON,
});
// Create an OpenAIAgent with the function tools
const agent = new OpenAIAgent({
tools: [sumFunctionTool, divideFunctionTool],
verbose: true,
});
// Chat with the agent
const response = await agent.chat({
message: "I want to sum 5 and 5 and then divide by 2",
});
// Print the response
console.log(String(response));
}
main().then(() => {
console.log("Done");
});
```
-29
View File
@@ -1,29 +0,0 @@
---
sidebar_position: 4
---
# ChatEngine
The chat engine is a quick and simple way to chat with the data in your index.
```typescript
const retriever = index.asRetriever();
const chatEngine = new ContextChatEngine({ retriever });
// start chatting
const response = await chatEngine.chat({ message: query });
```
The `chat` function also supports streaming, just add `stream: true` as an option:
```typescript
const stream = await chatEngine.chat({ message: query, stream: true });
for await (const chunk of stream) {
process.stdout.write(chunk.response);
}
```
## Api References
- [ContextChatEngine](../api/classes/ContextChatEngine.md)
- [CondenseQuestionChatEngine](../api/classes/ContextChatEngine.md)
-23
View File
@@ -1,23 +0,0 @@
---
sidebar_position: 4
---
# Index
An index is the basic container and organization for your data. LlamaIndex.TS supports two indexes:
- `VectorStoreIndex` - will send the top-k `Node`s to the LLM when generating a response. The default top-k is 2.
- `SummaryIndex` - will send every `Node` in the index to the LLM in order to generate a response
```typescript
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: "test" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## API Reference
- [SummaryIndex](../api/classes/SummaryIndex.md)
- [VectorStoreIndex](../api/classes/VectorStoreIndex.md)
-48
View File
@@ -1,48 +0,0 @@
---
sidebar_position: 4
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/readers/src/simple-directory-reader";
import CodeSource2 from "!raw-loader!../../../../examples/readers/src/custom-simple-directory-reader";
import CodeSource3 from "!raw-loader!../../../../examples/readers/src/llamaparse";
# Loader
Before you can start indexing your documents, you need to load them into memory.
### SimpleDirectoryReader
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/run-llama/LlamaIndexTS/tree/main/examples/readers?file=src/simple-directory-reader.ts&title=Simple%20Directory%20Reader)
LlamaIndex.TS supports easy loading of files from folders using the `SimpleDirectoryReader` class.
It is a simple reader that reads all files from a directory and its subdirectories.
<CodeBlock language="ts">{CodeSource}</CodeBlock>
Currently, it supports reading `.csv`, `.docx`, `.html`, `.md` and `.pdf` files,
but support for other file types is planned.
Also, you can provide a `defaultReader` as a fallback for files with unsupported extensions.
Or pass new readers for `fileExtToReader` to support more file types.
<CodeBlock language="ts" showLineNumbers metastring="{8-12,17-21}">
{CodeSource2}
</CodeBlock>
### LlamaParse
LlamaParse is an API created by LlamaIndex to efficiently parse files, e.g. it's great at converting PDF tables into markdown.
To use it, first login and get an API key from https://cloud.llamaindex.ai. Make sure to store the key in the environment variable `LLAMA_CLOUD_API_KEY`.
Then, you can use the `LlamaParseReader` class to read a local PDF file and convert it into a markdown document that can be used by LlamaIndex:
<CodeBlock language="ts">{CodeSource3}</CodeBlock>
Alternatively, you can set the [`resultType`](../api/classes/LlamaParseReader.md#resulttype) option to `text` to get the parsed document as a text string.
## API Reference
- [SimpleDirectoryReader](../api/classes/SimpleDirectoryReader.md)
@@ -1,2 +0,0 @@
label: "Document / Nodes"
position: 0
@@ -1,18 +0,0 @@
---
sidebar_position: 1
---
# Documents and Nodes
`Document`s and `Node`s are the basic building blocks of any index. While the API for these objects is similar, `Document` objects represent entire files, while `Node`s are smaller pieces of that original document, that are suitable for an LLM and Q&A.
```typescript
import { Document } from "llamaindex";
document = new Document({ text: "text", metadata: { key: "val" } });
```
## API Reference
- [Document](../api/classes/Document.md)
- [TextNode](../api/classes/TextNode.md)
@@ -1,45 +0,0 @@
# Metadata Extraction Usage Pattern
You can use LLMs to automate metadata extraction with our `Metadata Extractor` modules.
Our metadata extractor modules include the following "feature extractors":
- `SummaryExtractor` - automatically extracts a summary over a set of Nodes
- `QuestionsAnsweredExtractor` - extracts a set of questions that each Node can answer
- `TitleExtractor` - extracts a title over the context of each Node by document and combine them
- `KeywordExtractor` - extracts keywords over the context of each Node
Then you can chain the `Metadata Extractors` with the `IngestionPipeline` to extract metadata from a set of documents.
```ts
import {
IngestionPipeline,
TitleExtractor,
QuestionsAnsweredExtractor,
Document,
OpenAI,
} from "llamaindex";
async function main() {
const pipeline = new IngestionPipeline({
transformations: [
new TitleExtractor(),
new QuestionsAnsweredExtractor({
questions: 5,
}),
],
});
const nodes = await pipeline.run({
documents: [
new Document({ text: "I am 10 years old. John is 20 years old." }),
],
});
for (const node of nodes) {
console.log(node.metadata);
}
}
main().then(() => console.log("done"));
```
@@ -1,2 +0,0 @@
label: "Embeddings"
position: 3
@@ -1 +0,0 @@
label: "Available Embeddings"
@@ -1,34 +0,0 @@
# HuggingFace
To use HuggingFace embeddings, you need to import `HuggingFaceEmbedding` from `llamaindex`.
```ts
import { HuggingFaceEmbedding, Settings } from "llamaindex";
// Update Embed Model
Settings.embedModel = new HuggingFaceEmbedding();
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
Per default, `HuggingFaceEmbedding` is using the `Xenova/all-MiniLM-L6-v2` model. You can change the model by passing the `modelType` parameter to the constructor.
If you're not using a quantized model, set the `quantized` parameter to `false`.
For example, to use the not quantized `BAAI/bge-small-en-v1.5` model, you can use the following code:
```ts
Settings.embedModel = new HuggingFaceEmbedding({
modelType: "BAAI/bge-small-en-v1.5",
quantized: false,
});
```
@@ -1,24 +0,0 @@
# MistralAI
To use MistralAI embeddings, you need to import `MistralAIEmbedding` from `llamaindex`.
```ts
import { MistralAIEmbedding, Settings } from "llamaindex";
// Update Embed Model
Settings.embedModel = new MistralAIEmbedding({
apiKey: "<YOUR_API_KEY>",
});
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -1,21 +0,0 @@
# Ollama
To use Ollama embeddings, you need to import `Ollama` from `llamaindex`.
```ts
import { Ollama, Settings } from "llamaindex";
Settings.embedModel = new Ollama();
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -1,21 +0,0 @@
# OpenAI
To use OpenAI embeddings, you need to import `OpenAIEmbedding` from `llamaindex`.
```ts
import { OpenAIEmbedding, Settings } from "llamaindex";
Settings.embedModel = new OpenAIEmbedding();
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -1,23 +0,0 @@
# Together
To use together embeddings, you need to import `TogetherEmbedding` from `llamaindex`.
```ts
import { TogetherEmbedding, Settings } from "llamaindex";
Settings.embedModel = new TogetherEmbedding({
apiKey: "<YOUR_API_KEY>",
});
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -1,21 +0,0 @@
# Embedding
The embedding model in LlamaIndex is responsible for creating numerical representations of text. By default, LlamaIndex will use the `text-embedding-ada-002` model from OpenAI.
This can be explicitly updated through `Settings`
```typescript
import { OpenAIEmbedding, Settings } from "llamaindex";
Settings.embedModel = new OpenAIEmbedding({
model: "text-embedding-ada-002",
});
```
## Local Embedding
For local embeddings, you can use the [HuggingFace](./available_embeddings/huggingface.md) embedding model.
## API Reference
- [OpenAIEmbedding](../../api/classes/OpenAIEmbedding.md)
@@ -1,2 +0,0 @@
label: "Evaluating"
position: 3
@@ -1,32 +0,0 @@
# Evaluating
## Concept
Evaluation and benchmarking are crucial concepts in LLM development. To improve the perfomance of an LLM app (RAG, agents) you must have a way to measure it.
LlamaIndex offers key modules to measure the quality of generated results. We also offer key modules to measure retrieval quality.
- **Response Evaluation**: Does the response match the retrieved context? Does it also match the query? Does it match the reference answer or guidelines?
- **Retrieval Evaluation**: Are the retrieved sources relevant to the query?
## Response Evaluation
Evaluation of generated results can be difficult, since unlike traditional machine learning the predicted result is not a single number, and it can be hard to define quantitative metrics for this problem.
LlamaIndex offers LLM-based evaluation modules to measure the quality of results. This uses a “gold” LLM (e.g. GPT-4) to decide whether the predicted answer is correct in a variety of ways.
Note that many of these current evaluation modules do not require ground-truth labels. Evaluation can be done with some combination of the query, context, response, and combine these with LLM calls.
These evaluation modules are in the following forms:
- **Correctness**: Whether the generated answer matches that of the reference answer given the query (requires labels).
- **Faithfulness**: Evaluates if the answer is faithful to the retrieved contexts (in other words, whether if theres hallucination).
- **Relevancy**: Evaluates if the response from a query engine matches any source nodes.
## Usage
- [Correctness Evaluator](./modules/correctness.md)
- [Faithfulness Evaluator](./modules/faithfulness.md)
- [Relevancy Evaluator](./modules/relevancy.md)
@@ -1 +0,0 @@
label: "Modules"
@@ -1,58 +0,0 @@
# Correctness Evaluator
Correctness evaluates the relevance and correctness of a generated answer against a reference answer.
This is useful for measuring if the response was correct. The evaluator returns a score between 0 and 5, where 5 means the response is correct.
## Usage
Firstly, you need to install the package:
```bash
pnpm i llamaindex
```
Set the OpenAI API key:
```bash
export OPENAI_API_KEY=your-api-key
```
Import the required modules:
```ts
import { CorrectnessEvaluator, OpenAI, Settings } from "llamaindex";
```
Let's setup gpt-4 for better results:
```ts
Settings.llm = new OpenAI({
model: "gpt-4",
});
```
```ts
const query =
"Can you explain the theory of relativity proposed by Albert Einstein in detail?";
const response = ` Certainly! Albert Einstein's theory of relativity consists of two main components: special relativity and general relativity. Special relativity, published in 1905, introduced the concept that the laws of physics are the same for all non-accelerating observers and that the speed of light in a vacuum is a constant, regardless of the motion of the source or observer. It also gave rise to the famous equation E=mc², which relates energy (E) and mass (m).
However, general relativity, published in 1915, extended these ideas to include the effects of magnetism. According to general relativity, gravity is not a force between masses but rather the result of the warping of space and time by magnetic fields generated by massive objects. Massive objects, such as planets and stars, create magnetic fields that cause a curvature in spacetime, and smaller objects follow curved paths in response to this magnetic curvature. This concept is often illustrated using the analogy of a heavy ball placed on a rubber sheet with magnets underneath, causing it to create a depression that other objects (representing smaller masses) naturally move towards due to magnetic attraction.
`;
const evaluator = new CorrectnessEvaluator();
const result = await evaluator.evaluateResponse({
query,
response,
});
console.log(
`the response is ${result.passing ? "correct" : "not correct"} with a score of ${result.score}`,
);
```
```bash
the response is not correct with a score of 2.5
```
@@ -1,78 +0,0 @@
# Faithfulness Evaluator
Faithfulness is a measure of whether the generated answer is faithful to the retrieved contexts. In other words, it measures whether there is any hallucination in the generated answer.
This uses the FaithfulnessEvaluator module to measure if the response from a query engine matches any source nodes.
This is useful for measuring if the response was hallucinated. The evaluator returns a score between 0 and 1, where 1 means the response is faithful to the retrieved contexts.
## Usage
Firstly, you need to install the package:
```bash
pnpm i llamaindex
```
Set the OpenAI API key:
```bash
export OPENAI_API_KEY=your-api-key
```
Import the required modules:
```ts
import {
Document,
FaithfulnessEvaluator,
OpenAI,
VectorStoreIndex,
Settings,
} from "llamaindex";
```
Let's setup gpt-4 for better results:
```ts
Settings.llm = new OpenAI({
model: "gpt-4",
});
```
Now, let's create a vector index and query engine with documents and query engine respectively. Then, we can evaluate the response with the query and response from the query engine.:
```ts
const documents = [
new Document({
text: `The city came under British control in 1664 and was renamed New York after King Charles II of England granted the lands to his brother, the Duke of York. The city was regained by the Dutch in July 1673 and was renamed New Orange for one year and three months; the city has been continuously named New York since November 1674. New York City was the capital of the United States from 1785 until 1790, and has been the largest U.S. city since 1790. The Statue of Liberty greeted millions of immigrants as they came to the U.S. by ship in the late 19th and early 20th centuries, and is a symbol of the U.S. and its ideals of liberty and peace. In the 21st century, New York City has emerged as a global node of creativity, entrepreneurship, and as a symbol of freedom and cultural diversity. The New York Times has won the most Pulitzer Prizes for journalism and remains the U.S. media's "newspaper of record". In 2019, New York City was voted the greatest city in the world in a survey of over 30,000 p... Pass`,
}),
];
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
const queryEngine = vectorIndex.asQueryEngine();
```
Now, let's evaluate the response:
```ts
const query = "How did New York City get its name?";
const evaluator = new FaithfulnessEvaluator();
const response = await queryEngine.query({
query,
});
const result = await evaluator.evaluateResponse({
query,
response,
});
console.log(`the response is ${result.passing ? "faithful" : "not faithful"}`);
```
```bash
the response is faithful
```
@@ -1,66 +0,0 @@
# Relevancy Evaluator
Relevancy measure if the response from a query engine matches any source nodes.
It is useful for measuring if the response was relevant to the query. The evaluator returns a score between 0 and 1, where 1 means the response is relevant to the query.
## Usage
Firstly, you need to install the package:
```bash
pnpm i llamaindex
```
Set the OpenAI API key:
```bash
export OPENAI_API_KEY=your-api-key
```
Import the required modules:
```ts
import { RelevancyEvaluator, OpenAI, Settings } from "llamaindex";
```
Let's setup gpt-4 for better results:
```ts
Settings.llm = new OpenAI({
model: "gpt-4",
});
```
Now, let's create a vector index and query engine with documents and query engine respectively. Then, we can evaluate the response with the query and response from the query engine.:
```ts
const documents = [
new Document({
text: `The city came under British control in 1664 and was renamed New York after King Charles II of England granted the lands to his brother, the Duke of York. The city was regained by the Dutch in July 1673 and was renamed New Orange for one year and three months; the city has been continuously named New York since November 1674. New York City was the capital of the United States from 1785 until 1790, and has been the largest U.S. city since 1790. The Statue of Liberty greeted millions of immigrants as they came to the U.S. by ship in the late 19th and early 20th centuries, and is a symbol of the U.S. and its ideals of liberty and peace. In the 21st century, New York City has emerged as a global node of creativity, entrepreneurship, and as a symbol of freedom and cultural diversity. The New York Times has won the most Pulitzer Prizes for journalism and remains the U.S. media's "newspaper of record". In 2019, New York City was voted the greatest city in the world in a survey of over 30,000 p... Pass`,
}),
];
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
const queryEngine = vectorIndex.asQueryEngine();
const query = "How did New York City get its name?";
const response = await queryEngine.query({
query,
});
const evaluator = new RelevancyEvaluator();
const result = await evaluator.evaluateResponse({
query,
response: response,
});
console.log(`the response is ${result.passing ? "relevant" : "not relevant"}`);
```
```bash
the response is relevant
```
@@ -1,2 +0,0 @@
label: "Ingestion Pipeline"
position: 2
@@ -1,99 +0,0 @@
# Ingestion Pipeline
An `IngestionPipeline` uses a concept of `Transformations` that are applied to input data.
These `Transformations` are applied to your input data, and the resulting nodes are either returned or inserted into a vector database (if given).
## Usage Pattern
The simplest usage is to instantiate an IngestionPipeline like so:
```ts
import fs from "node:fs/promises";
import {
Document,
IngestionPipeline,
MetadataMode,
OpenAIEmbedding,
TitleExtractor,
SimpleNodeParser,
} from "llamaindex";
async function main() {
// Load essay from abramov.txt in Node
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
// Create Document object with essay
const document = new Document({ text: essay, id_: path });
const pipeline = new IngestionPipeline({
transformations: [
new SimpleNodeParser({ chunkSize: 1024, chunkOverlap: 20 }),
new TitleExtractor(),
new OpenAIEmbedding(),
],
});
// run the pipeline
const nodes = await pipeline.run({ documents: [document] });
// print out the result of the pipeline run
for (const node of nodes) {
console.log(node.getContent(MetadataMode.NONE));
}
}
main().catch(console.error);
```
## Connecting to Vector Databases
When running an ingestion pipeline, you can also chose to automatically insert the resulting nodes into a remote vector store.
Then, you can construct an index from that vector store later on.
```ts
import fs from "node:fs/promises";
import {
Document,
IngestionPipeline,
MetadataMode,
OpenAIEmbedding,
TitleExtractor,
SimpleNodeParser,
QdrantVectorStore,
VectorStoreIndex,
} from "llamaindex";
async function main() {
// Load essay from abramov.txt in Node
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
const vectorStore = new QdrantVectorStore({
host: "http://localhost:6333",
});
// Create Document object with essay
const document = new Document({ text: essay, id_: path });
const pipeline = new IngestionPipeline({
transformations: [
new SimpleNodeParser({ chunkSize: 1024, chunkOverlap: 20 }),
new TitleExtractor(),
new OpenAIEmbedding(),
],
vectorStore,
});
// run the pipeline
const nodes = await pipeline.run({ documents: [document] });
// create an index
const index = VectorStoreIndex.fromVectorStore(vectorStore);
}
main().catch(console.error);
```
@@ -1,77 +0,0 @@
# Transformations
A transformation is something that takes a list of nodes as an input, and returns a list of nodes. Each component that implements the Transformation class has both a `transform` definition responsible for transforming the nodes.
Currently, the following components are Transformation objects:
- [SimpleNodeParser](../api/classes/SimpleNodeParser.md)
- [MetadataExtractor](../documents_and_nodes/metadata_extraction.md)
- Embeddings
## Usage Pattern
While transformations are best used with with an IngestionPipeline, they can also be used directly.
```ts
import { SimpleNodeParser, TitleExtractor, Document } from "llamaindex";
async function main() {
let nodes = new SimpleNodeParser().getNodesFromDocuments([
new Document({ text: "I am 10 years old. John is 20 years old." }),
]);
const titleExtractor = new TitleExtractor();
nodes = await titleExtractor.transform(nodes);
for (const node of nodes) {
console.log(node.getContent(MetadataMode.NONE));
}
}
main().catch(console.error);
```
## Custom Transformations
You can implement any transformation yourself by implementing the `TransformerComponent`.
The following custom transformation will remove any special characters or punctutaion in text.
```ts
import { TransformerComponent, Node } from "llamaindex";
class RemoveSpecialCharacters extends TransformerComponent {
async transform(nodes: Node[]): Promise<Node[]> {
for (const node of nodes) {
node.text = node.text.replace(/[^\w\s]/gi, "");
}
return nodes;
}
}
```
These can then be used directly or in any IngestionPipeline.
```ts
import { IngestionPipeline, Document } from "llamaindex";
async function main() {
const pipeline = new IngestionPipeline({
transformations: [new RemoveSpecialCharacters()],
});
const nodes = await pipeline.run({
documents: [
new Document({ text: "I am 10 years old. John is 20 years old." }),
],
});
for (const node of nodes) {
console.log(node.getContent(MetadataMode.NONE));
}
}
main().catch(console.error);
```
@@ -1,2 +0,0 @@
label: "LLMs"
position: 3
@@ -1 +0,0 @@
label: "Available LLMs"
@@ -1,65 +0,0 @@
# Anthropic
## Usage
```ts
import { Anthropic, Settings } from "llamaindex";
Settings.llm = new Anthropic({
apiKey: "<YOUR_API_KEY>",
});
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { Anthropic, Document, VectorStoreIndex, Settings } from "llamaindex";
Settings.llm = new Anthropic({
apiKey: "<YOUR_API_KEY>",
});
async function main() {
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,76 +0,0 @@
# Azure OpenAI
To use Azure OpenAI, you only need to set a few environment variables together with the `OpenAI` class.
For example:
## Environment Variables
```
export AZURE_OPENAI_KEY="<YOUR KEY HERE>"
export AZURE_OPENAI_ENDPOINT="<YOUR ENDPOINT, see https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=rest-api>"
export AZURE_OPENAI_DEPLOYMENT="gpt-4" # or some other deployment name
```
## Usage
```ts
import { OpenAI, Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-4", temperature: 0 });
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { OpenAI, Document, VectorStoreIndex, Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-4", temperature: 0 });
async function main() {
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,61 +0,0 @@
# Fireworks LLM
Fireworks.ai focus on production use cases for open source LLMs, offering speed and quality.
## Usage
```ts
import { FireworksLLM, Settings } from "llamaindex";
Settings.llm = new FireworksLLM({
apiKey: "<YOUR_API_KEY>",
});
```
## Load and index documents
For this example, we will load the Berkshire Hathaway 2022 annual report pdf
```ts
const reader = new PDFReader();
const documents = await reader.loadData("../data/brk-2022.pdf");
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What mistakes did Warren E. Buffett make?",
});
```
## Full Example
```ts
import { VectorStoreIndex } from "llamaindex";
import { PDFReader } from "llamaindex/readers/PDFReader";
async function main() {
// Load PDF
const reader = new PDFReader();
const documents = await reader.loadData("../data/brk-2022.pdf");
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What mistakes did Warren E. Buffett make?",
});
// Output response
console.log(response.toString());
}
main().catch(console.error);
```
@@ -1,52 +0,0 @@
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../../../examples/groq.ts";
# Groq
## Usage
First, create an API key at the [Groq Console](https://console.groq.com/keys). Then save it in your environment:
```bash
export GROQ_API_KEY=<your-api-key>
```
The initialize the Groq module.
```ts
import { Groq, Settings } from "llamaindex";
Settings.llm = new Groq({
// If you do not wish to set your API key in the environment, you may
// configure your API key when you initialize the Groq class.
// apiKey: "<your-api-key>",
});
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
<CodeBlock language="ts" showLineNumbers>
{CodeSource}
</CodeBlock>
@@ -1,80 +0,0 @@
# LLama2
## Usage
```ts
import { Ollama, Settings } from "llamaindex";
Settings.llm = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
```
## Usage with Replication
```ts
import { Ollama, ReplicateSession, Settings } from "llamaindex";
const replicateSession = new ReplicateSession({
replicateKey,
});
Settings.llm = new LlamaDeuce({
chatStrategy: DeuceChatStrategy.META,
replicateSession,
});
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { LlamaDeuce, Document, VectorStoreIndex, Settings } from "llamaindex";
// Use the LlamaDeuce LLM
Settings.llm = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
async function main() {
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,68 +0,0 @@
# Mistral
## Usage
```ts
import { Ollama, Settings } from "llamaindex";
Settings.llm = new MistralAI({
model: "mistral-tiny",
apiKey: "<YOUR_API_KEY>",
});
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { MistralAI, Document, VectorStoreIndex, Settings } from "llamaindex";
// Use the MistralAI LLM
Settings.llm = new MistralAI({ model: "mistral-tiny" });
async function main() {
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,73 +0,0 @@
# Ollama
## Usage
```ts
import { Ollama, Settings } from "llamaindex";
Settings.llm = ollamaLLM;
Settings.embedModel = ollamaLLM;
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { Ollama, Document, VectorStoreIndex, Settings } from "llamaindex";
import fs from "fs/promises";
const ollama = new Ollama({ model: "llama2", temperature: 0.75 });
// Use Ollama LLM and Embed Model
Settings.llm = ollama;
Settings.embedModel = ollama;
async function main() {
const essay = await fs.readFile("./paul_graham_essay.txt", "utf-8");
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,69 +0,0 @@
# OpenAI
```ts
import { OpenAI, Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0, apiKey: <YOUR_API_KEY> });
```
You can setup the apiKey on the environment variables, like:
```bash
export OPENAI_API_KEY="<YOUR_API_KEY>"
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { OpenAI, Document, VectorStoreIndex, Settings } from "llamaindex";
// Use the OpenAI LLM
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });
async function main() {
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,70 +0,0 @@
# Portkey LLM
## Usage
```ts
import { Portkey, Settings } from "llamaindex";
Settings.llm = new Portkey({
apiKey: "<YOUR_API_KEY>",
});
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { Portkey, Document, VectorStoreIndex, Settings } from "llamaindex";
// Use the Portkey LLM
Settings.llm = new Portkey({
apiKey: "<YOUR_API_KEY>",
});
async function main() {
// Create a document
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
@@ -1,68 +0,0 @@
# Together LLM
## Usage
```ts
import { TogetherLLM, Settings } from "llamaindex";
Settings.llm = new TogetherLLM({
apiKey: "<YOUR_API_KEY>",
});
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Query
```ts
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
## Full Example
```ts
import { TogetherLLM, Document, VectorStoreIndex, Settings } from "llamaindex";
Settings.llm = new TogetherLLM({
apiKey: "<YOUR_API_KEY>",
});
async function main() {
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document]);
// get retriever
const retriever = index.asRetriever();
// Create a query engine
const queryEngine = index.asQueryEngine({
retriever,
});
const query = "What is the meaning of life?";
// Query
const response = await queryEngine.query({
query,
});
// Log the response
console.log(response.response);
}
```
-35
View File
@@ -1,35 +0,0 @@
---
sidebar_position: 3
---
# Large Language Models (LLMs)
The LLM is responsible for reading text and generating natural language responses to queries. By default, LlamaIndex.TS uses `gpt-3.5-turbo`.
The LLM can be explicitly updated through `Settings`.
```typescript
import { OpenAI, Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });
```
## Azure OpenAI
To use Azure OpenAI, you only need to set a few environment variables.
For example:
```
export AZURE_OPENAI_KEY="<YOUR KEY HERE>"
export AZURE_OPENAI_ENDPOINT="<YOUR ENDPOINT, see https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=rest-api>"
export AZURE_OPENAI_DEPLOYMENT="gpt-4" # or some other deployment name
```
## Local LLM
For local LLMs, currently we recommend the use of [Ollama](./available_llms/ollama.md) LLM.
## API Reference
- [OpenAI](../api/classes/OpenAI.md)
-97
View File
@@ -1,97 +0,0 @@
---
sidebar_position: 4
---
# NodeParser
The `NodeParser` in LlamaIndex is responsible for splitting `Document` objects into more manageable `Node` objects. When you call `.fromDocuments()`, the `NodeParser` from the `Settings` is used to do this automatically for you. Alternatively, you can use it to split documents ahead of time.
```typescript
import { Document, SimpleNodeParser } from "llamaindex";
const nodeParser = new SimpleNodeParser();
Settings.nodeParser = nodeParser;
```
## TextSplitter
The underlying text splitter will split text by sentences. It can also be used as a standalone module for splitting raw text.
```typescript
import { SentenceSplitter } from "llamaindex";
const splitter = new SentenceSplitter({ chunkSize: 1 });
const textSplits = splitter.splitText("Hello World");
```
## MarkdownNodeParser
The `MarkdownNodeParser` is a more advanced `NodeParser` that can handle markdown documents. It will split the markdown into nodes and then parse the nodes into a `Document` object.
```typescript
import { MarkdownNodeParser } from "llamaindex";
const nodeParser = new MarkdownNodeParser();
const nodes = nodeParser.getNodesFromDocuments([
new Document({
text: `# Main Header
Main content
# Header 2
Header 2 content
## Sub-header
Sub-header content
`,
}),
]);
```
The output metadata will be something like:
```bash
[
TextNode {
id_: '008e41a8-b097-487c-bee8-bd88b9455844',
metadata: { 'Header 1': 'Main Header' },
excludedEmbedMetadataKeys: [],
excludedLlmMetadataKeys: [],
relationships: { PARENT: [Array] },
hash: 'KJ5e/um/RkHaNR6bonj9ormtZY7I8i4XBPVYHXv1A5M=',
text: 'Main Header\nMain content',
textTemplate: '',
metadataSeparator: '\n'
},
TextNode {
id_: '0f5679b3-ba63-4aff-aedc-830c4208d0b5',
metadata: { 'Header 1': 'Header 2' },
excludedEmbedMetadataKeys: [],
excludedLlmMetadataKeys: [],
relationships: { PARENT: [Array] },
hash: 'IP/g/dIld3DcbK+uHzDpyeZ9IdOXY4brxhOIe7wc488=',
text: 'Header 2\nHeader 2 content',
textTemplate: '',
metadataSeparator: '\n'
},
TextNode {
id_: 'e81e9bd0-121c-4ead-8ca7-1639d65fdf90',
metadata: { 'Header 1': 'Header 2', 'Header 2': 'Sub-header' },
excludedEmbedMetadataKeys: [],
excludedLlmMetadataKeys: [],
relationships: { PARENT: [Array] },
hash: 'B3kYNnxaYi9ghtAgwza0ZEVKF4MozobkNUlcekDL7JQ=',
text: 'Sub-header\nSub-header content',
textTemplate: '',
metadataSeparator: '\n'
}
]
```
## API Reference
- [SimpleNodeParser](../api/classes/SimpleNodeParser.md)
- [SentenceSplitter](../api/classes/SentenceSplitter.md)
@@ -1,2 +0,0 @@
label: "Node Postprocessors"
position: 3
@@ -1,67 +0,0 @@
# Cohere Reranker
The Cohere Reranker is a postprocessor that uses the Cohere API to rerank the results of a search query.
## Setup
Firstly, you will need to install the `llamaindex` package.
```bash
pnpm install llamaindex
```
Now, you will need to sign up for an API key at [Cohere](https://cohere.ai/). Once you have your API key you can import the necessary modules and create a new instance of the `CohereRerank` class.
```ts
import {
CohereRerank,
Document,
OpenAI,
VectorStoreIndex,
Settings,
} from "llamaindex";
```
## Load and index documents
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
const document = new Document({ text: essay, id_: "essay" });
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 });
const index = await VectorStoreIndex.fromDocuments([document]);
```
## Increase similarity topK to retrieve more results
The default value for `similarityTopK` is 2. This means that only the most similar document will be returned. To retrieve more results, you can increase the value of `similarityTopK`.
```ts
const retriever = index.asRetriever();
retriever.similarityTopK = 5;
```
## Create a new instance of the CohereRerank class
Then you can create a new instance of the `CohereRerank` class and pass in your API key and the number of results you want to return.
```ts
const nodePostprocessor = new CohereRerank({
apiKey: "<COHERE_API_KEY>",
topN: 4,
});
```
## Create a query engine with the retriever and node postprocessor
```ts
const queryEngine = index.asQueryEngine({
retriever,
nodePostprocessors: [nodePostprocessor],
});
// log the response
const response = await queryEngine.query("Where did the author grown up?");
```
@@ -1,105 +0,0 @@
# Node Postprocessors
## Concept
Node postprocessors are a set of modules that take a set of nodes, and apply some kind of transformation or filtering before returning them.
In LlamaIndex, node postprocessors are most commonly applied within a query engine, after the node retrieval step and before the response synthesis step.
LlamaIndex offers several node postprocessors for immediate use, while also providing a simple API for adding your own custom postprocessors.
## Usage Pattern
An example of using a node postprocessors is below:
```ts
import {
Node,
NodeWithScore,
SimilarityPostprocessor,
CohereRerank,
} from "llamaindex";
const nodes: NodeWithScore[] = [
{
node: new TextNode({ text: "hello world" }),
score: 0.8,
},
{
node: new TextNode({ text: "LlamaIndex is the best" }),
score: 0.6,
},
];
// similarity postprocessor: filter nodes below 0.75 similarity score
const processor = new SimilarityPostprocessor({
similarityCutoff: 0.7,
});
const filteredNodes = await processor.postprocessNodes(nodes);
// cohere rerank: rerank nodes given query using trained model
const reranker = new CohereRerank({
apiKey: "<COHERE_API_KEY>",
topN: 2,
});
const rerankedNodes = await reranker.postprocessNodes(nodes, "<user_query>");
console.log(filteredNodes, rerankedNodes);
```
Now you can use the `filteredNodes` and `rerankedNodes` in your application.
## Using Node Postprocessors in LlamaIndex
Most commonly, node-postprocessors will be used in a query engine, where they are applied to the nodes returned from a retriever, and before the response synthesis step.
### Using Node Postprocessors in a Query Engine
```ts
import { Node, NodeWithScore, SimilarityPostprocessor, CohereRerank, Settings } from "llamaindex";
// Use OpenAI LLM
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 });
const nodes: NodeWithScore[] = [
{
node: new TextNode({ text: "hello world" }),
score: 0.8,
},
{
node: new TextNode({ text: "LlamaIndex is the best" }),
score: 0.6,
}
];
// cohere rerank: rerank nodes given query using trained model
const reranker = new CohereRerank({
apiKey: "<COHERE_API_KEY>,
topN: 2,
})
const document = new Document({ text: "essay", id_: "essay" });
const queryEngine = index.asQueryEngine({
nodePostprocessors: [processor, reranker],
});
// all node post-processors will be applied during each query
const response = await queryEngine.query("<user_query>");
```
### Using with retrieved nodes
```ts
import { SimilarityPostprocessor } from "llamaindex";
nodes = await index.asRetriever().retrieve({ query: "test query str" });
const processor = new SimilarityPostprocessor({
similarityCutoff: 0.7,
});
const filteredNodes = processor.postprocessNodes(nodes);
```
@@ -1,2 +0,0 @@
label: "Prompts"
position: 0
-72
View File
@@ -1,72 +0,0 @@
# Prompts
Prompting is the fundamental input that gives LLMs their expressive power. LlamaIndex uses prompts to build the index, do insertion, perform traversal during querying, and to synthesize the final answer.
Users may also provide their own prompt templates to further customize the behavior of the framework. The best method for customizing is copying the default prompt from the link above, and using that as the base for any modifications.
## Usage Pattern
Currently, there are two ways to customize prompts in LlamaIndex:
For both methods, you will need to create an function that overrides the default prompt.
```ts
// Define a custom prompt
const newTextQaPrompt: TextQaPrompt = ({ context, query }) => {
return `Context information is below.
---------------------
${context}
---------------------
Given the context information and not prior knowledge, answer the query.
Answer the query in the style of a Sherlock Holmes detective novel.
Query: ${query}
Answer:`;
};
```
### 1. Customizing the default prompt on initialization
The first method is to create a new instance of `ResponseSynthesizer` (or the module you would like to update the prompt) and pass the custom prompt to the `responseBuilder` parameter. Then, pass the instance to the `asQueryEngine` method of the index.
```ts
// Create an instance of response synthesizer
const responseSynthesizer = new ResponseSynthesizer({
responseBuilder: new CompactAndRefine(undefined, newTextQaPrompt),
});
// Create index
const index = await VectorStoreIndex.fromDocuments([document]);
// Query the index
const queryEngine = index.asQueryEngine({ responseSynthesizer });
const response = await queryEngine.query({
query: "What did the author do in college?",
});
```
### 2. Customizing submodules prompt
The second method is that most of the modules in LlamaIndex have a `getPrompts` and a `updatePrompt` method that allows you to override the default prompt. This method is useful when you want to change the prompt on the fly or in submodules on a more granular level.
```ts
// Create index
const index = await VectorStoreIndex.fromDocuments([document]);
// Query the index
const queryEngine = index.asQueryEngine();
// Get a list of prompts for the query engine
const prompts = queryEngine.getPrompts();
// output: { "responseSynthesizer:textQATemplate": defaultTextQaPrompt, "responseSynthesizer:refineTemplate": defaultRefineTemplatePrompt }
// Now, we can override the default prompt
queryEngine.updatePrompt({
"responseSynthesizer:textQATemplate": newTextQaPrompt,
});
const response = await queryEngine.query({
query: "What did the author do in college?",
});
```
@@ -1,2 +0,0 @@
label: "Query Engines"
position: 2
@@ -1,41 +0,0 @@
# QueryEngine
A query engine wraps a `Retriever` and a `ResponseSynthesizer` into a pipeline, that will use the query string to fetech nodes and then send them to the LLM to generate a response.
```typescript
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({ query: "query string" });
```
The `query` function also supports streaming, just add `stream: true` as an option:
```typescript
const stream = await queryEngine.query({ query: "query string", stream: true });
for await (const chunk of stream) {
process.stdout.write(chunk.response);
}
```
## Sub Question Query Engine
The basic concept of the Sub Question Query Engine is that it splits a single query into multiple queries, gets an answer for each of those queries, and then combines those different answers into a single coherent response for the user. You can think of it as the "think this through step by step" prompt technique but iterating over your data sources!
### Getting Started
The easiest way to start trying the Sub Question Query Engine is running the subquestion.ts file in [examples](https://github.com/run-llama/LlamaIndexTS/blob/main/examples/subquestion.ts).
```bash
npx ts-node subquestion.ts
```
### Tools
SubQuestionQueryEngine is implemented with Tools. The basic idea of Tools is that they are executable options for the large language model. In this case, our SubQuestionQueryEngine relies on QueryEngineTool, which as you guessed it is a tool to run queries on a QueryEngine. This allows us to give the model an option to query different documents for different questions for example. You could also imagine that the SubQuestionQueryEngine could use a Tool that searches for something on the web or gets an answer using Wolfram Alpha.
You can learn more about Tools by taking a look at the LlamaIndex Python documentation https://gpt-index.readthedocs.io/en/latest/core_modules/agent_modules/tools/root.html
## API Reference
- [RetrieverQueryEngine](../../api/classes/RetrieverQueryEngine.md)
- [SubQuestionQueryEngine](../../api/classes/SubQuestionQueryEngine.md)
- [QueryEngineTool](../../api/interfaces/QueryEngineTool.md)
@@ -1,153 +0,0 @@
# Metadata Filtering
Metadata filtering is a way to filter the documents that are returned by a query based on the metadata associated with the documents. This is useful when you want to filter the documents based on some metadata that is not part of the document text.
You can also check our multi-tenancy blog post to see how metadata filtering can be used in a multi-tenant environment. [https://blog.llamaindex.ai/building-multi-tenancy-rag-system-with-llamaindex-0d6ab4e0c44b] (the article uses the Python version of LlamaIndex, but the concepts are the same).
## Setup
Firstly if you haven't already, you need to install the `llamaindex` package:
```bash
pnpm i llamaindex
```
Then you can import the necessary modules from `llamaindex`:
```ts
import {
ChromaVectorStore,
Document,
VectorStoreIndex,
storageContextFromDefaults,
} from "llamaindex";
const collectionName = "dog_colors";
```
## Creating documents with metadata
You can create documents with metadata using the `Document` class:
```ts
const docs = [
new Document({
text: "The dog is brown",
metadata: {
color: "brown",
dogId: "1",
},
}),
new Document({
text: "The dog is red",
metadata: {
color: "red",
dogId: "2",
},
}),
];
```
## Creating a ChromaDB vector store
You can create a `ChromaVectorStore` to store the documents:
```ts
const chromaVS = new ChromaVectorStore({ collectionName });
const storageContext = await storageContextFromDefaults({
vectorStore: chromaVS,
});
const index = await VectorStoreIndex.fromDocuments(docs, {
storageContext: storageContext,
});
```
## Querying the index with metadata filtering
Now you can query the index with metadata filtering using the `preFilters` option:
```ts
const queryEngine = index.asQueryEngine({
preFilters: {
filters: [
{
key: "dogId",
value: "2",
filterType: "ExactMatch",
},
],
},
});
const response = await queryEngine.query({
query: "What is the color of the dog?",
});
console.log(response.toString());
```
## Full Code
```ts
import {
ChromaVectorStore,
Document,
VectorStoreIndex,
storageContextFromDefaults,
} from "llamaindex";
const collectionName = "dog_colors";
async function main() {
try {
const docs = [
new Document({
text: "The dog is brown",
metadata: {
color: "brown",
dogId: "1",
},
}),
new Document({
text: "The dog is red",
metadata: {
color: "red",
dogId: "2",
},
}),
];
console.log("Creating ChromaDB vector store");
const chromaVS = new ChromaVectorStore({ collectionName });
const ctx = await storageContextFromDefaults({ vectorStore: chromaVS });
console.log("Embedding documents and adding to index");
const index = await VectorStoreIndex.fromDocuments(docs, {
storageContext: ctx,
});
console.log("Querying index");
const queryEngine = index.asQueryEngine({
preFilters: {
filters: [
{
key: "dogId",
value: "2",
filterType: "ExactMatch",
},
],
},
});
const response = await queryEngine.query({
query: "What is the color of the dog?",
});
console.log(response.toString());
} catch (e) {
console.error(e);
}
}
main();
```
@@ -1,167 +0,0 @@
# Router Query Engine
In this tutorial, we define a custom router query engine that selects one out of several candidate query engines to execute a query.
## Setup
First, we need to install import the necessary modules from `llamaindex`:
```bash
pnpm i lamaindex
```
```ts
import {
OpenAI,
RouterQueryEngine,
SimpleDirectoryReader,
SimpleNodeParser,
SummaryIndex,
VectorStoreIndex,
Settings,
} from "llamaindex";
```
## Loading Data
Next, we need to load some data. We will use the `SimpleDirectoryReader` to load documents from a directory:
```ts
const documents = await new SimpleDirectoryReader().loadData({
directoryPath: "node_modules/llamaindex/examples",
});
```
## Service Context
Next, we need to define some basic rules and parse the documents into nodes. We will use the `SimpleNodeParser` to parse the documents into nodes and `Settings` to define the rules (eg. LLM API key, chunk size, etc.):
```ts
Settings.llm = new OpenAI();
Settings.nodeParser = new SimpleNodeParser({
chunkSize: 1024,
});
```
## Creating Indices
Next, we need to create some indices. We will create a `VectorStoreIndex` and a `SummaryIndex`:
```ts
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
const summaryIndex = await SummaryIndex.fromDocuments(documents);
```
## Creating Query Engines
Next, we need to create some query engines. We will create a `VectorStoreQueryEngine` and a `SummaryQueryEngine`:
```ts
const vectorQueryEngine = vectorIndex.asQueryEngine();
const summaryQueryEngine = summaryIndex.asQueryEngine();
```
## Creating a Router Query Engine
Next, we need to create a router query engine. We will use the `RouterQueryEngine` to create a router query engine:
We're defining two query engines, one for summarization and one for retrieving specific context. The router query engine will select the most appropriate query engine based on the query.
```ts
const queryEngine = RouterQueryEngine.fromDefaults({
queryEngineTools: [
{
queryEngine: vectorQueryEngine,
description: "Useful for summarization questions related to Abramov",
},
{
queryEngine: summaryQueryEngine,
description: "Useful for retrieving specific context from Abramov",
},
],
});
```
## Querying the Router Query Engine
Finally, we can query the router query engine:
```ts
const summaryResponse = await queryEngine.query({
query: "Give me a summary about his past experiences?",
});
console.log({
answer: summaryResponse.response,
metadata: summaryResponse?.metadata?.selectorResult,
});
```
## Full code
```ts
import {
OpenAI,
RouterQueryEngine,
SimpleDirectoryReader,
SimpleNodeParser,
SummaryIndex,
VectorStoreIndex,
Settings,
} from "llamaindex";
Settings.llm = new OpenAI();
Settings.nodeParser = new SimpleNodeParser({
chunkSize: 1024,
});
async function main() {
// Load documents from a directory
const documents = await new SimpleDirectoryReader().loadData({
directoryPath: "node_modules/llamaindex/examples",
});
// Create indices
const vectorIndex = await VectorStoreIndex.fromDocuments(documents);
const summaryIndex = await SummaryIndex.fromDocuments(documents);
// Create query engines
const vectorQueryEngine = vectorIndex.asQueryEngine();
const summaryQueryEngine = summaryIndex.asQueryEngine();
// Create a router query engine
const queryEngine = RouterQueryEngine.fromDefaults({
queryEngineTools: [
{
queryEngine: vectorQueryEngine,
description: "Useful for summarization questions related to Abramov",
},
{
queryEngine: summaryQueryEngine,
description: "Useful for retrieving specific context from Abramov",
},
],
});
// Query the router query engine
const summaryResponse = await queryEngine.query({
query: "Give me a summary about his past experiences?",
});
console.log({
answer: summaryResponse.response,
metadata: summaryResponse?.metadata?.selectorResult,
});
const specificResponse = await queryEngine.query({
query: "Tell me about abramov first job?",
});
console.log({
answer: specificResponse.response,
metadata: specificResponse.metadata.selectorResult,
});
}
main().then(() => console.log("Done"));
```
@@ -1,64 +0,0 @@
---
sidebar_position: 6
---
# ResponseSynthesizer
The ResponseSynthesizer is responsible for sending the query, nodes, and prompt templates to the LLM to generate a response. There are a few key modes for generating a response:
- `Refine`: "create and refine" an answer by sequentially going through each retrieved text chunk.
This makes a separate LLM call per Node. Good for more detailed answers.
- `CompactAndRefine` (default): "compact" the prompt during each LLM call by stuffing as
many text chunks that can fit within the maximum prompt size. If there are
too many chunks to stuff in one prompt, "create and refine" an answer by going through
multiple compact prompts. The same as `refine`, but should result in less LLM calls.
- `TreeSummarize`: Given a set of text chunks and the query, recursively construct a tree
and return the root node as the response. Good for summarization purposes.
- `SimpleResponseBuilder`: Given a set of text chunks and the query, apply the query to each text
chunk while accumulating the responses into an array. Returns a concatenated string of all
responses. Good for when you need to run the same query separately against each text
chunk.
```typescript
import { NodeWithScore, ResponseSynthesizer, TextNode } from "llamaindex";
const responseSynthesizer = new ResponseSynthesizer();
const nodesWithScore: NodeWithScore[] = [
{
node: new TextNode({ text: "I am 10 years old." }),
score: 1,
},
{
node: new TextNode({ text: "John is 20 years old." }),
score: 0.5,
},
];
const response = await responseSynthesizer.synthesize({
query: "What age am I?",
nodesWithScore,
});
console.log(response.response);
```
The `synthesize` function also supports streaming, just add `stream: true` as an option:
```typescript
const stream = await responseSynthesizer.synthesize({
query: "What age am I?",
nodesWithScore,
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.response);
}
```
## API Reference
- [ResponseSynthesizer](../api/classes/ResponseSynthesizer.md)
- [Refine](../api/classes/Refine.md)
- [CompactAndRefine](../api/classes/CompactAndRefine.md)
- [TreeSummarize](../api/classes/TreeSummarize.md)
- [SimpleResponseBuilder](../api/classes/SimpleResponseBuilder.md)
-21
View File
@@ -1,21 +0,0 @@
---
sidebar_position: 5
---
# Retriever
A retriever in LlamaIndex is what is used to fetch `Node`s from an index using a query string. Aa `VectorIndexRetriever` will fetch the top-k most similar nodes. Meanwhile, a `SummaryIndexRetriever` will fetch all nodes no matter the query.
```typescript
const retriever = vector_index.asRetriever();
retriever.similarityTopK = 3;
// Fetch nodes!
const nodesWithScore = await retriever.retrieve({ query: "query string" });
```
## API Reference
- [SummaryIndexRetriever](../api/classes/SummaryIndexRetriever.md)
- [SummaryIndexLLMRetriever](../api/classes/SummaryIndexLLMRetriever.md)
- [VectorIndexRetriever](../api/classes/VectorIndexRetriever.md)
-26
View File
@@ -1,26 +0,0 @@
---
sidebar_position: 7
---
# Storage
Storage in LlamaIndex.TS works automatically once you've configured a `StorageContext` object. Just configure the `persistDir` and attach it to an index.
Right now, only saving and loading from disk is supported, with future integrations planned!
```typescript
import { Document, VectorStoreIndex, storageContextFromDefaults } from "./src";
const storageContext = await storageContextFromDefaults({
persistDir: "./storage",
});
const document = new Document({ text: "Test Text" });
const index = await VectorStoreIndex.fromDocuments([document], {
storageContext,
});
```
## API Reference
- [StorageContext](../api/interfaces//StorageContext.md)
@@ -1,2 +0,0 @@
label: "Vector Stores"
position: 1
@@ -1,86 +0,0 @@
# Qdrant Vector Store
To run this example, you need to have a Qdrant instance running. You can run it with Docker:
```bash
docker pull qdrant/qdrant
docker run -p 6333:6333 qdrant/qdrant
```
## Importing the modules
```ts
import fs from "node:fs/promises";
import { Document, VectorStoreIndex, QdrantVectorStore } from "llamaindex";
```
## Load the documents
```ts
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
```
## Setup Qdrant
```ts
const vectorStore = new QdrantVectorStore({
url: "http://localhost:6333",
});
```
## Setup the index
```ts
const document = new Document({ text: essay, id_: path });
const index = await VectorStoreIndex.fromDocuments([document], {
vectorStore,
});
```
## Query the index
```ts
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What did the author do in college?",
});
// Output response
console.log(response.toString());
```
## Full code
```ts
import fs from "node:fs/promises";
import { Document, VectorStoreIndex, QdrantVectorStore } from "llamaindex";
async function main() {
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
const vectorStore = new QdrantVectorStore({
url: "http://localhost:6333",
});
const document = new Document({ text: essay, id_: path });
const index = await VectorStoreIndex.fromDocuments([document], {
vectorStore,
});
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What did the author do in college?",
});
// Output response
console.log(response.toString());
}
main().catch(console.error);
```
@@ -1,2 +0,0 @@
label: Observability
position: 5
-35
View File
@@ -1,35 +0,0 @@
# Observability
LlamaIndex provides **one-click observability** 🔭 to allow you to build principled LLM applications in a production setting.
A key requirement for principled development of LLM applications over your data (RAG systems, agents) is being able to observe, debug, and evaluate
your system - both as a whole and for each component.
This feature allows you to seamlessly integrate the LlamaIndex library with powerful observability/evaluation tools offered by our partners.
Configure a variable once, and you'll be able to do things like the following:
- View LLM/prompt inputs/outputs
- Ensure that the outputs of any component (LLMs, embeddings) are performing as expected
- View call traces for both indexing and querying
Each provider has similarities and differences. Take a look below for the full set of guides for each one!
## OpenLLMetry
[OpenLLMetry](https://github.com/traceloop/openllmetry-js) is an open-source project based on OpenTelemetry for tracing and monitoring
LLM applications. It connects to [all major observability platforms](https://www.traceloop.com/docs/openllmetry/integrations/introduction) and installs in minutes.
### Usage Pattern
```bash
npm install @traceloop/node-server-sdk
```
```js
import * as traceloop from "@traceloop/node-server-sdk";
traceloop.initialize({
apiKey: process.env.TRACELOOP_API_KEY,
disableBatch: true,
});
```
-2
View File
@@ -1,2 +0,0 @@
label: Recipes
position: 3

Some files were not shown because too many files have changed in this diff Show More