Compare commits

...

1034 Commits

Author SHA1 Message Date
Alex Yang 2ec6a529c7 RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.1.16
  @llamaindex/env@0.0.3

[skip ci]
2024-02-23 19:03:04 -06:00
Alex Yang e8e21a0e4e docs(changeset): build: set files in package.json 2024-02-23 19:02:42 -06:00
Alex Yang 88d243f145 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.15

[skip ci]
2024-02-23 18:57:10 -06:00
Alex Yang 3a6e287443 feat: enable verbatimModuleSyntax (#562) 2024-02-23 18:56:44 -06:00
Alex Yang beb3e5cd7f RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.1.14
  @llamaindex/env@0.0.2

[skip ci]
2024-02-23 18:09:31 -06:00
Alex Yang 7416a87e10 build: cjs file not found 2024-02-23 18:09:15 -06:00
Alex Yang 65b85b237e RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.13

[skip ci]
2024-02-23 17:59:06 -06:00
Alex Yang b17a80014a fix: unset private package 2024-02-23 17:58:46 -06:00
Alex Yang ff87f99807 fix: avoid publishing test package 2024-02-23 17:56:38 -06:00
Alex Yang 65d834615d docs(changeset): feat: abstract @llamaindex/env package 2024-02-23 17:45:43 -06:00
Alex Yang b8be4c09e2 docs(changeset): build: use ESM as default 2024-02-23 17:45:01 -06:00
Alex Yang e5fb332538 build: leave code as-is (#560)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-02-23 17:39:25 -06:00
Marcus Schiesser 491033d534 fix: lint errors 2024-02-23 14:55:45 +07:00
Marcus Schiesser 885fa316a5 chore: add prefer const lint 2024-02-23 14:45:17 +07:00
Marcus Schiesser b6ed679771 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.26

[skip ci]
2024-02-23 12:00:37 +07:00
Marcus Schiesser 68fc6e8b50 fix: don't need similarityTopK parameter for LlamaCloud 2024-02-23 11:43:22 +07:00
Marcus Schiesser ea0331ef5a refactor: simplify generated python code (#558)
Co-authored-by: leehuwuj <leehuwuj@gmail.com>
2024-02-23 11:14:02 +07:00
Marcus Schiesser 6827e245b8 fix: don't allow runApp for LlamaPacks 2024-02-22 16:20:57 +07:00
Huu Le (Lee) ef25d6960c Upgrade llama-index version to v0.10+ for create-llama (#556) 2024-02-22 13:50:53 +07:00
Marcus Schiesser f740f44cf2 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.12

[skip ci]
2024-02-22 12:02:35 +07:00
Marcus Schiesser a5e4e6d857 Add support for LlamaCloud (#554) 2024-02-22 11:59:32 +07:00
Thuc Pham cfdd6db530 feat: add pinecone support to create llama (#555) 2024-02-22 09:55:50 +07:00
Marcus Schiesser d4eda9f396 docs: add llamaparse docs (#553) 2024-02-21 14:37:13 +07:00
Alex Yang a433b107e0 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.11

[skip ci]
2024-02-20 12:58:54 -06:00
Yufei (Benny) Chen 59f9fb6c3f Add Fireworks to LlamaIndex (#539)
Co-authored-by: Emanuel Ferreira <contatoferreirads@gmail.com>
2024-02-20 10:53:09 -03:00
Thuc Pham 09d532ebcc feat(create-llama-pack): generate llama pack project from llama index (#549) 2024-02-20 08:22:54 +07:00
Emanuel Ferreira cfd6f3ca8c feat: prompt mixin (#543) 2024-02-18 18:44:08 -03:00
Emanuel Ferreira 95add73c38 feat: multi-document agents (#531) 2024-02-18 18:43:52 -03:00
Emanuel Ferreira 9ee036b160 docs: remove duplicate embedding (#545) 2024-02-13 23:21:13 -03:00
Erick Sosa Garcia c2b521199c fix: some errors in available llms examples (#544) 2024-02-13 21:16:47 -03:00
Emanuel Ferreira ee9f3f373a refactor: openai agent and utils (#542) 2024-02-11 20:24:36 -03:00
Emanuel Ferreira f205358587 feat: add markdown node parser (#541) 2024-02-11 20:23:49 -03:00
Emanuel Ferreira 255ae7dced fix: react agent history (#540) 2024-02-11 18:46:55 -03:00
Emanuel Ferreira b4c6d509a0 docs: available embeddings (#538) 2024-02-10 22:10:20 -03:00
Emanuel Ferreira 34cd57b639 feat(react): add react agent (#511) 2024-02-10 20:52:11 -03:00
yisding 50dfd7bf60 dep security vulns (#537) 2024-02-11 04:37:42 +08:00
Emanuel Ferreira 0b57187909 docs: add available LLMs (#536) 2024-02-10 13:54:13 -03:00
Emanuel Ferreira e78e9f4832 feat(reranker): cohere reranker (#535) 2024-02-10 12:07:14 -03:00
Marcus Schiesser 383933adb5 feat: Add reader for LlamaParse (#530) 2024-02-09 11:27:50 +07:00
Marcus Schiesser dd054137bf feat: use batching in vector store index (#524)
Co-authored-by: Alex Yang <himself65@outlook.com>
Co-authored-by: Emanuel Ferreira <contatoferreirads@gmail.com>
2024-02-08 08:59:56 -03:00
byteninja cf3b7571eb feat: add filtering of metadata to PGVectorStore (#525) 2024-02-08 10:54:52 +07:00
Alex Yang ae7a2c202a fix: add alias class OllamaEmbedding (#527) 2024-02-07 14:26:39 -06:00
Alex Yang 9b00d578bc feat: improve reader interfaces (#498) 2024-02-07 11:44:01 -06:00
Marcus Schiesser b8173e4c4e RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.25

[skip ci]
2024-02-07 16:53:46 +07:00
Marcus Schiesser 67b5445fb9 fix(cl): improved error messages for python installation 2024-02-07 16:16:06 +07:00
Marcus Schiesser 87419ef5d1 Revert "fix: add handle error from template installation (#522)"
This reverts commit ad218160d8.
2024-02-07 16:01:08 +07:00
Huu Le (Lee) ad218160d8 fix: add handle error from template installation (#522)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-02-07 15:30:26 +07:00
Marcus Schiesser eeb90d7991 fix(cl): add link to configure search tool 2024-02-07 14:07:57 +07:00
Marcus Schiesser 7b7329bd18 feat(cl): Added latest turbo models for GPT-3.5 and GPT 4 2024-02-07 12:46:19 +07:00
Alex Yang b3acbb06f4 docs: update CONTRIBUTING.md (#516) 2024-02-07 12:05:29 +07:00
Marcus Schiesser 7db7562841 fix(cl): just retrieve top-k 3 for context to prevent token exceed 2024-02-07 10:59:31 +07:00
yisding 0e75b124c3 minor update 2024-02-06 12:24:06 -08:00
yisding d79a0b76f3 update packages 2024-02-06 11:55:38 -08:00
yisding c3eb4933fb RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.10

[skip ci]
2024-02-06 11:50:39 -08:00
yisding e3a956aedd pnpm install 2024-02-06 11:48:12 -08:00
yisding e562e479dc Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2024-02-06 11:39:07 -08:00
Alex Yang 1900e019e3 build: fix build errors (#521) 2024-02-06 12:54:08 -06:00
Emanuel Ferreira 317f140822 fix: revert embed batch temporarily (#520) 2024-02-06 12:01:48 -03:00
Emanuel Ferreira cd829474d6 feat(queryEngineTool): add query engine tool to agents (#509) 2024-02-06 11:11:26 -03:00
Emanuel Ferreira b6c1500570 feat(embedding): add batch embed size (#407) 2024-02-06 10:19:14 -03:00
Huu Le (Lee) d06a85bd34 feat: Add support for llamahub tools (#517)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-02-06 17:34:03 +07:00
Ian Sinnott 6b9a2feac5 Consistent Document IDs in NotionReader.ts (#519) 2024-02-06 15:52:29 +07:00
Mike Fortman bd08004afe Update Astra DB Vectorstore to support namespaces (#485)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2024-02-06 11:31:08 +07:00
Emanuel Ferreira 0ecc4b2051 docs: minor fixes (#514) 2024-02-05 14:12:49 +07:00
metonym f9f351229a Fix typo in starter example (#512) 2024-02-05 14:11:26 +07:00
Mario Martinez 72659a237b Convert keys from snakecase to camelcase (#510) 2024-02-05 14:10:17 +07:00
Gavin Morgan 6cc3a36d44 fix: update VectorIndexRetriever constructor parameters' type. (#515)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-02-04 18:22:04 -06:00
TechPandaPro 6fe55d6e88 docs: fix broken relative links in docs (#513) 2024-02-04 06:20:17 -03:00
yisding 36f2903eb3 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.9

[skip ci]
2024-02-02 11:26:00 -08:00
yisding 09464e6da7 docs(changeset): add OpenAIAgent (thanks @EmanuelCampos) 2024-02-02 11:23:03 -08:00
Emanuel Ferreira 955e084cf3 feat: OpenAI agent (#416)
Co-authored-by: yisding <yi.s.ding@gmail.com>
2024-02-02 11:22:14 -08:00
yisding 46ee0c8765 Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2024-02-02 08:31:02 -08:00
Emanuel Ferreira da5391c018 docs(filtering): add metadata filtering (#508) 2024-02-02 11:41:44 -03:00
Mario Martinez ce732beece Fix typo in PineconeVectorStore.ts (#507) 2024-02-02 17:13:41 +07:00
TechPandaPro 889b70093c fix: update deprecated pnpx to pnpm dlx (#501) 2024-02-02 17:02:42 +07:00
Marcus Schiesser 7211a27f01 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.24

[skip ci]
2024-02-02 16:09:25 +07:00
Marcus Schiesser ba95ca3fb6 feat(cl): Use condense plus context chat engine for FastAPI as default 2024-02-02 15:46:11 +07:00
Marcus Schiesser ffdc507625 fix: upgrade ncc to fix template lookup 2024-02-02 15:34:46 +07:00
Marcus Schiesser 8aef0dece9 RELEASING: Releasing 2 package(s)
Releases:
  docs@0.0.2
  create-llama@0.0.23

[skip ci]
2024-02-02 11:45:10 +07:00
Marcus Schiesser c680af63ef docs(changeset): Fixed issues with locating templates path 2024-02-02 11:43:51 +07:00
Marcus Schiesser 4a7ac65184 fix: not finding templates path 2024-02-02 10:56:03 +07:00
yisding 4016c55604 RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.1.8
  docs@0.0.2

[skip ci]
2024-02-01 16:13:37 -08:00
Emanuel Ferreira 0f64084c20 docs: update API references (#502) 2024-02-01 14:13:33 -08:00
yisding 7af03d9205 more anthropic prompts (#504) 2024-02-01 14:12:57 -08:00
yisding d903da626f Allow simple response builder prompt change (#505) 2024-02-01 14:12:38 -08:00
Emanuel Ferreira 177b446229 chore: improve extractors prompt (#424) 2024-02-01 09:27:46 -03:00
Emanuel Ferreira ab9d941d15 fix(cyclic): remove cyclic structures from transform hash (#500) 2024-02-01 07:46:33 -03:00
Marcus Schiesser 66fd990624 fix: type-check 2024-02-01 16:03:13 +07:00
Marcus Schiesser f6dabd0d3e RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.22

[skip ci]
2024-02-01 15:51:44 +07:00
Marcus Schiesser 74caaa2bf7 fix: clarify CLI output for create-llama 2024-02-01 15:26:48 +07:00
Marcus Schiesser 552403b370 fix: don't create d.ts files for create-llama 2024-02-01 14:33:29 +07:00
Huu Le (Lee) a93d09d159 fix(create-llama): generate code option fail (#491) 2024-02-01 10:57:10 +07:00
Thuc Pham 0fb757f6c1 feat: use pnpm pack for e2e (#490) 2024-02-01 10:12:21 +07:00
Alex Yang a68053ca4e fix: remove as any type (#494) 2024-02-01 10:10:41 +07:00
Alex Yang 36d4f4027b RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.7

[skip ci]
2024-01-31 17:20:26 -06:00
Alex Yang 19d92507e3 chore: use the patch version 2024-01-31 17:20:17 -06:00
Emanuel Ferreira 664e92a3d6 chore: remove collapsed router query (#497) 2024-01-31 16:31:49 -06:00
Emanuel Ferreira d687c110e4 docs(changeset): feat(router): add router query engine (#496) 2024-01-31 14:24:51 -08:00
Emanuel Ferreira af5ae7054e feat(router): setup router query engine (#484) 2024-01-31 13:58:47 -08:00
Alex Yang dff1e7f552 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.6

[skip ci]
2024-01-31 12:50:40 -06:00
Alex Yang cf446401e5 fix: instanceof issue (#492) 2024-01-31 12:45:02 -06:00
Huu Le (Lee) e9b87ef09b feat(create-llama) add folder selection & support more context data types (#489) 2024-01-31 16:42:30 +07:00
yisding 7231ddb1b3 allow simpledirectoryreader to get a string (#488)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-01-31 11:11:57 +07:00
Alex Yang 1ead36f1bb RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.5

[skip ci]
2024-01-30 14:21:37 -06:00
Alex Yang 8a9b78a4ab docs(changeset): chore: split readers into different files 2024-01-30 14:21:17 -06:00
Motoki saito 569299724a add --vector-db option to create-llama (#473) 2024-01-30 15:24:35 +07:00
Huu Le (Lee) 6dd401e1c7 Feat: add + fix chat with web (#481) 2024-01-30 14:17:33 +07:00
Marcus Schiesser c4cb37786b fix: use Array not Float32Array (#482) 2024-01-30 11:28:14 +07:00
Alex Yang b757d9a94e chore: split readers into different files (#479) 2024-01-29 22:05:23 -06:00
Motoki saito 6cc083f370 define mergePoetryDependencies type (#465) 2024-01-30 10:47:41 +07:00
yisding c419027db9 add docs for azure openai (#480) 2024-01-30 10:41:05 +07:00
metonym 6a16b47406 Fix typo in node_parser.md (#475) 2024-01-30 10:34:53 +07:00
Alex Yang 4197ae8b9f RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.4

[skip ci]
2024-01-29 18:30:54 -06:00
Alex Yang 88696e1407 refactor: use pdf2json instead of pdfjs-dist (#477) 2024-01-29 18:28:20 -06:00
Marcus Schiesser 24cb48f195 RELEASING: Releasing 1 package(s)
Releases:
      create-llama@0.0.21

    [skip ci]
2024-01-29 17:38:57 +07:00
Marcus Schiesser 965cfd291e fix: use pipeline instead of nodeparser (#471) 2024-01-29 17:31:09 +07:00
Marcus Schiesser 873329c052 Revert "feat: Add chat with web data (#450)"
This reverts commit 27d55fde8c.
2024-01-29 17:28:16 +07:00
Marcus Schiesser 3d8023b9a9 feat: add ingestion pipeline cache (#442) 2024-01-29 16:45:09 +07:00
Marcus Schiesser 93d1450fc1 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.20

[skip ci]
2024-01-29 16:37:42 +07:00
Huu Le (Lee) 27d55fde8c feat: Add chat with web data (#450) 2024-01-29 14:16:57 +07:00
Marcus Schiesser 690399b04c feat: also test context template engine (#470) 2024-01-29 11:36:35 +07:00
hiepxanh 65b84f1ab3 docs: fix dead link (#452) 2024-01-28 12:11:40 -06:00
Ian Sinnott 835acb89d0 docs: remove unused arg in qdrant docs (#461) 2024-01-28 12:11:29 -06:00
Alex Yang d9df9ea75c RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.3

[skip ci]
2024-01-28 11:59:22 -06:00
Alex Yang 06874ffb69 fix: cannot run examples 2024-01-28 11:59:02 -06:00
Alex Yang f0898a3930 fix: ignore release examples 2024-01-28 11:57:16 -06:00
Alex Yang 7d50196d2f fix: output edge-light (#469) 2024-01-28 11:51:12 -06:00
Emanuel Ferreira f90f7fee64 docs: ingestion pipeline, transformations (#464) 2024-01-27 11:53:52 -03:00
Emanuel Ferreira 3d860df873 chore: update example (#463) 2024-01-27 10:11:50 -03:00
Emanuel Ferreira 2fe3a2b6a8 chore: enhancement optional args extractors (#462) 2024-01-27 09:18:17 -03:00
Emanuel Ferreira eb3d4af204 docs: usage metadata extraction (#460) 2024-01-27 08:37:24 -03:00
Alex Yang 0652352e92 chore: fix circular dependency (#459) 2024-01-27 00:46:04 -06:00
Alex Yang 103949513b chore: bump version (#458) 2024-01-26 22:46:00 -06:00
Emanuel Ferreira 9ba4547c4d fix: not overwrite metadata (#453) 2024-01-26 09:07:52 -03:00
Tyrone Avnit 4fea0adf43 Expose BaseExtractor Class (#454) 2024-01-26 09:07:36 -03:00
Marcus Schiesser de070dbfa7 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.19

[skip ci]
2024-01-26 16:33:12 +07:00
Marcus Schiesser 87eb72bdb2 fix: don't install root package for llamapack examples (as there isn't one) 2024-01-26 16:30:50 +07:00
Thuc Pham fe03aaae55 feat: generate llama pack example (#429) 2024-01-26 15:02:49 +07:00
yisding 9ce7d3d648 Update packages (#448) 2024-01-26 11:54:58 +07:00
Alex Yang 0471407761 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.2

[skip ci]
2024-01-25 22:26:59 -06:00
Alex Yang e4b807a018 fix(core): invalid package.json 2024-01-25 22:26:31 -06:00
Alex Yang 0a0ec37725 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.1.1

[skip ci]
2024-01-25 22:18:14 -06:00
Alex Yang 8abca5d818 build(core): release with node resolution compatibility (#451) 2024-01-25 22:12:15 -06:00
jess-render 3a29a8036b Add node_modules to gitignore in Express backends (#447)
Co-authored-by: Jess Lin <jesslin@Jesss-MBP.render.com>
2024-01-26 09:34:53 +07:00
yisding e2b9b66f71 RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.1.0
  docs@0.0.1

[skip ci]
2024-01-25 15:47:02 -08:00
yisding bb66cb7e36 Openai embeddings 3 (#445) 2024-01-25 15:45:21 -08:00
Alex Yang 2159e77c9d RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.0.51

[skip ci]
2024-01-25 14:59:22 -06:00
Emanuel Ferreira 3154f521d9 chore: add qdrant readme (#444) 2024-01-25 17:58:37 -03:00
Alex Yang fda8024607 revert: export conditions not working with moduleResolution node (#443) 2024-01-25 13:51:05 -06:00
Marcus Schiesser 89336e4ddf feat: add deno jupyter examples (#428) 2024-01-25 18:09:19 +07:00
Marcus Schiesser a94f747307 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.18

[skip ci]
2024-01-25 17:46:19 +07:00
Marcus Schiesser 88d3b41044 fix: create-llama packaging 2024-01-25 17:44:29 +07:00
Marcus Schiesser 7fd02ab8d1 RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.17

[skip ci]
2024-01-25 16:58:45 +07:00
Huu Le (Lee) 9e5d8e143e Feat: add local pdf file option (#441) 2024-01-25 15:20:42 +07:00
Huu Le (Lee) f0f7df29b3 remove chromadb override (as llamaindex is forcing now chromadb 1.7.3) 2024-01-25 14:24:01 +07:00
yisding 05ba70881c RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.0.50

[skip ci]
2024-01-24 23:00:50 -08:00
yisding 8a729cdd0d minor bug fixes with together AI (#440) 2024-01-24 22:59:09 -08:00
Marcus Schiesser ffe5fbcd51 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.0.49

[skip ci]
2024-01-25 11:09:36 +07:00
Marcus Schiesser 18cc545e16 chore: allow separate releases for create-llama and llamaindex 2024-01-25 11:09:22 +07:00
Emanuel Ferreira c818e90cfc refactor: restructure documentation (#420)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-01-25 10:22:35 +07:00
Alex Yang 570973b9d6 docs: add stackblitz playground (#439) 2024-01-24 21:00:47 -06:00
Alex Yang 09d19b99ba chore: bump docusaurus to v3 (#438) 2024-01-24 19:21:15 -06:00
Alex Yang 7ad30dc660 chore: abstract node:path (#435) 2024-01-24 17:09:52 -06:00
Alex Yang 5c1702c527 chore: remove unused package (#436) 2024-01-24 15:58:39 -06:00
Alex Yang f1063d58ae feat: abstract file system api (#433) 2024-01-24 14:58:40 -06:00
Emanuel Ferreira eee39221c4 feat(qdrant): Add Qdrant Vector DB (#408) 2024-01-24 17:49:49 +07:00
Marcus Schiesser 4303961948 fix changeset format 2024-01-24 17:37:28 +07:00
Marcus Schiesser e2790dabc8 Add ingestion pipeline with doc store strategies (#418) 2024-01-24 17:26:24 +07:00
Thuc Pham ba42aa592c fix: spawn run fail on window (#419) 2024-01-24 17:07:59 +07:00
Alex Yang e1deba1222 fix: abstract createHash (#427) 2024-01-23 20:59:55 -06:00
Alex Yang f9c2dd1b3a fix: abstract some node API (#426) 2024-01-23 20:03:22 -06:00
Alex Yang 8bf0a41926 fix: error when running examples (#425) 2024-01-23 11:27:32 -06:00
Alex Yang 5c89aa54c4 feat: abstract node:os (#422) 2024-01-23 15:34:28 +07:00
Nikolai Lehbrink 69484526e6 fix: typo in customized vector index section (#423) 2024-01-23 15:33:29 +07:00
Marcus Schiesser bfc84384ea fix: don't create new hash deserialization a node (#307) 2024-01-23 15:32:11 +07:00
Alex Yang cce3b792db revert: missing files (#421) 2024-01-22 22:36:40 -06:00
Alex Yang bff40f27c5 feat: use conditional exports (#401) 2024-01-22 15:52:20 -06:00
Emanuel Ferreira c3e3b598bb fix(metadataFiltering): prefilters not being passed to vector query (#412) 2024-01-22 17:30:29 +07:00
Huu Le (Lee) fa17f7e352 add run app option (#399) 2024-01-22 14:03:57 +07:00
Motoki saito 3aed922a3b readme sample code chnaged (#414) 2024-01-22 10:39:56 +07:00
Emanuel Ferreira 7c4e37c5cd fix(getCollection): getOrCreateCollection (#413) 2024-01-22 10:36:11 +07:00
Emanuel Ferreira 2d8845b084 feat(extractors): add keyword extractor and base extractor (#404)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-01-21 16:28:02 -06:00
Owen Craston 47f21796e0 fix: add root package name (#403) 2024-01-20 13:53:38 -06:00
yisding eb6de99fcb Merge pull request #406 from run-llama/new-prettier
New prettier version
2024-01-19 15:31:31 -08:00
yisding 2bfc8f3161 try adding a version to pnpm
I don't think it should make a difference...
2024-01-19 15:26:07 -08:00
yisding bcacf88e55 run prettier format:fix 2024-01-19 15:14:40 -08:00
yisding 13766a82b2 new prettier version 2024-01-19 15:11:59 -08:00
Marcus Schiesser 34d7ca66f5 improved publish scripts 2024-01-19 15:41:54 +07:00
Marcus Schiesser 17a803bb17 RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.0.48
  create-llama@0.0.16

[skip ci]
2024-01-19 14:53:34 +07:00
Marcus Schiesser 1bd47969b3 fix changesets 2024-01-19 14:21:09 +07:00
Marcus Schiesser 5fec0f1135 Feat: add example for SummaryChatHistory 2024-01-19 14:18:33 +07:00
Thuc Pham a73942ddea fix: should bundle mongo dependency (#402) 2024-01-19 14:17:03 +07:00
Marcus Schiesser 34a26e5e4d Use ChatHistory in all ChatEngines (#400)
* refactor: merge HistoryChatEngine and ContextChatEngine and use ChatHistory for all chat engines

* fix: add safeguard for tokensToSummarize

* refactor: unfold chat engines to own folder

* refactor: extract LLM types

* refactor: move multi-modal types to llm

* docs(changeset): Remove HistoryChatEngine and use ChatHistory for all chat engines

* dev: add debug launcher and don't lint generated code
2024-01-18 17:18:10 +07:00
Thuc Pham f74dea5fae feat(express): support showing image on chat message express backend (#380) 2024-01-18 14:24:48 +07:00
Marcus Schiesser ee3eb7d8e2 fix: update create-llama examples for new chat engine (#396)
---------

Co-authored-by: thucpn <thucsh2@gmail.com>
2024-01-18 12:10:37 +07:00
Marcus Schiesser 75f94eea1b fix: lint errors 2024-01-18 11:31:25 +07:00
Marcus Schiesser b737bda40d refactor: encourage using parameter objects for functions with more than 4 parameters (#398) 2024-01-18 08:46:08 +07:00
Marcus Schiesser d99b1d61d7 llamaindex@0.0.47 2024-01-17 15:39:17 +07:00
Marcus Schiesser 844029d8e5 feat: Add streaming support for QueryEngine (and unify streaming interface with ChatEngine) (#393) 2024-01-17 14:29:27 +07:00
Huu Le (Lee) 9492cc64b5 Added option to automatically install dependencies (for Python and TS) (#381) 2024-01-16 16:12:37 +07:00
Alex Yang 5773f97e88 feat: add together AI vector index example (#390) 2024-01-15 21:52:15 -06:00
Marcus Schiesser 0784dc3a0a fix: replace missing import * as (#392) 2024-01-15 21:37:01 -06:00
Alex Yang 7993be7d0d RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.0.46
  create-llama@0.0.15

[skip ci]
2024-01-15 14:21:18 -06:00
Alex Yang f22ce6e757 Revert "RELEASING: Releasing 2 package(s)"
This reverts commit 3c4347b247.
2024-01-15 14:21:18 -06:00
Alex Yang 3c4347b247 RELEASING: Releasing 2 package(s)
Releases:
  llamaindex@0.1.0
  create-llama@0.0.15

[skip ci]
2024-01-15 14:08:59 -06:00
Aziz Khoury 977f2840b9 fix: wrong import for path in SimpleKVStore.ts (#383)
Co-authored-by: Alex Yang <himself65@outlook.com>
2024-01-15 14:03:30 -06:00
Alex Yang 5d3bb6642e fix: default import (#386) 2024-01-15 13:59:31 -06:00
Marcus Schiesser 2001eb7ffb fix: format 2024-01-15 18:15:44 +07:00
Marcus Schiesser f18c9f69d4 refactor: update low-level streaming interface (#325) 2024-01-15 18:06:53 +07:00
Thuc Pham 8e124e5b63 feat: support showing image for chat message in NextJS (#368) 2024-01-15 17:57:20 +07:00
Nir Gazit 4ed5e544b0 docs: added openllmetry observability (#369) 2024-01-15 10:15:02 +07:00
Alex Yang b185bda5b1 RELEASING: Releasing 2 package(s)
Releases:
  create-llama@0.0.14
  llamaindex@0.0.45

[skip ci]
2024-01-14 18:14:55 -06:00
Alex Yang d79804e271 docs: update README.md (#376) 2024-01-14 18:10:55 -06:00
Alex Yang 2b356c8613 fix(create-llama): component choice (#377) 2024-01-14 18:10:33 -06:00
Alex Yang 2e6b36ef4b docs: update changelog (#374) 2024-01-12 18:49:53 -06:00
Alex Yang edd0f66234 feat: support Together AI (#373) 2024-01-12 18:41:48 -06:00
Alex Yang 2da407d66c fix: cover type check on all ts files (#372) 2024-01-12 15:36:04 -06:00
Alex Yang fa574f709e chore(core): use bunchee to bundle (#370) 2024-01-12 12:50:33 -06:00
Alex Yang 1e6171521b refactor: use crypto.randomUUID (#371)
Ref: https://nodejs.org/docs/latest/api/crypto.html#cryptorandomuuidoptions
2024-01-12 12:30:17 -06:00
Marcus Schiesser 3f3e4eca66 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.0.44

[skip ci]
2024-01-12 14:21:11 +07:00
Thuc Pham 648482b0f1 Feat: Add support for ChromaDB (#310)
Co-authored-by: Aarav Navani <38411399+oofmeister27@users.noreply.github.com>
2024-01-12 13:35:00 +07:00
Marcus Schiesser bb46afe33d RELEASING: Releasing 1 package(s)
Releases:
  create-llama@0.0.13

[skip ci]
2024-01-11 14:30:38 +07:00
Marcus Schiesser 80f5914abf fix: raise exception if PG_CONNECTION_STRING is empty (generated value) 2024-01-11 14:25:00 +07:00
Marcus Schiesser 1c4e7f9c3e chore: change release process 2024-01-11 13:22:54 +07:00
Marcus Schiesser e4ae6e9076 RELEASING: Releasing 1 package(s)
Releases:
  llamaindex@0.0.43

[skip ci]
2024-01-11 13:19:23 +07:00
Marcus Schiesser f93efa2ea1 fix: disabled sweep (was trying to work on a draft PR) 2024-01-11 11:02:24 +07:00
Thuc Pham 7d79365262 feat: add examples and docs for readers (#323) 2024-01-11 11:42:13 +08:00
Huu Le (Lee) 555692207e Feat[cl]: Add postgresql vector store for fastapi (#318) 2024-01-11 11:03:12 +08:00
Alex Yang fcc06b227a fix(perf): use regex to spilt texts (#364) 2024-01-10 17:27:50 -06:00
Thuc Pham 08a39790e4 fix: default separator not work for window os (#324) 2024-01-10 17:07:08 +08:00
Marcus Schiesser a8270082a0 fix: improve async handling in fastapi (#322) 2024-01-10 11:55:13 +08:00
Marcus Schiesser 85da798538 llamaindex@0.0.42 2024-01-08 17:06:22 +07:00
Marcus Schiesser b68d8697df fix: add missing metadata after node parsing (#317) 2024-01-08 17:48:44 +08:00
fatdoge 7704df5042 Update starter.md (#316)
Markdown link render error fix.
2024-01-08 17:03:46 +08:00
Marcus Schiesser 16f04c7e7e docs: add changeset 2024-01-08 15:58:58 +07:00
Marcus Schiesser 7c6b3117bf feat: use local embedding for sentence window example and log progress 2024-01-08 15:58:58 +07:00
Marcus Schiesser 7def68fb37 feat: added local embedding 2024-01-08 15:58:58 +07:00
Marcus Schiesser 03ed2b4129 feat: add sentenceWindow.ts example 2024-01-08 15:58:58 +07:00
Marcus Schiesser 733d62a699 feat: add MetadataReplacementPostProcessor 2024-01-08 15:58:58 +07:00
Marcus Schiesser f76e1d0796 feat: add sentence window node parser 2024-01-08 15:58:58 +07:00
Marcus Schiesser 88d42ccd8d refactor: move node parsers to own package 2024-01-08 15:58:58 +07:00
Thuc Pham a0686fb1f2 docs: remove serverComponentsExternalPackages config (#314) 2024-01-08 16:35:06 +08:00
Marcus Schiesser 3d198d94a6 llamaindex@0.0.41 2024-01-08 15:18:24 +07:00
Thuc Pham 036c00db73 Feat: add postgres vectordb (#308)
* feat: integrate create-llama with postgresql 
* fix: get data for verification before inserting
* feat: show available vector DBs based on framework
2024-01-05 14:13:52 +08:00
Alex Yang 548f0687f1 feat(core): init support for Ollama (#305) 2024-01-04 18:03:00 -06:00
Marcus Schiesser f85c042a94 refactor: encapsulate node serialization 2024-01-04 10:19:18 +07:00
yisding 40e892f813 Oops adding back Alex's crypto changes 2024-01-04 10:19:18 +07:00
yisding 2381025306 move clone outside of toJSON
I like structuredClone although we have an issue with AWS only
supporting Node 16
2024-01-04 10:19:18 +07:00
Marcus Schiesser a0909dc053 docs: updated how to create a mongodb vector index 2024-01-04 10:19:18 +07:00
Marcus Schiesser 853a14b7c7 fix: add test cases, ensure that a node's metadata is not modified and remove text if requested 2024-01-04 10:19:18 +07:00
yisding b31e2d42eb fixed recursive issue in metadataDictToNode 2024-01-04 10:19:18 +07:00
yisding 5b6ad9419f fix mongo example 2024-01-04 10:19:18 +07:00
Marcus Schiesser a60948a87e fix: add format check to pre-commit 2024-01-03 10:39:54 +07:00
Alex Yang 8b420da753 style: prettier format (#304) 2024-01-02 17:12:06 -06:00
Alex Yang 12c079b74a refactor: remove unused deps (#303) 2024-01-02 16:40:24 -06:00
Marcus Schiesser c835f78dd0 docs: added changesets for core 2024-01-02 16:07:12 +07:00
Marcus Schiesser d52eb9d4ee fix[docs]: installation link (#302) 2024-01-02 12:25:56 +08:00
Marcus Schiesser 0cfd9f60b5 create-llama@0.0.12 2024-01-02 11:02:34 +07:00
Marcus Schiesser 5ab65eb95a fix[cl]: naming bug and added release changeset 2023-12-29 17:58:43 +07:00
Marcus Schiesser b13fb36de0 Merge pull request #295 from run-llama/ms/cl-python-add-mongodb
Feat: Add MongoDB Vector DB support for Python projects in create-llama
2023-12-29 15:01:06 +07:00
Marcus Schiesser d8fe65a273 refactor: improved var naming 2023-12-29 14:26:29 +07:00
Marcus Schiesser ba1cb996cf refactor: separate python and typescript generators 2023-12-29 14:10:01 +07:00
thucpn 41f41d6543 feat: prepare python dependencies 2023-12-29 13:47:41 +07:00
thucpn e25fc44db9 Merge branch 'ms/cl-python-add-mongodb' of github.com:run-llama/LlamaIndexTS into ms/cl-python-add-mongodb 2023-12-28 14:53:22 +07:00
thucpn 2ea91dc94b docs: update packages 2023-12-28 14:52:12 +07:00
Marcus Schiesser b16419ad3e Update packages/create-llama/templates/index.ts 2023-12-28 15:12:03 +08:00
thucpn 1e3c05c408 feat: question to select vectordb for python template 2023-12-28 14:03:35 +07:00
Marcus Schiesser a7eb59f472 fix: update pnpm-lock.yaml 2023-12-28 13:58:11 +07:00
Marcus Schiesser e99448481c Merge pull request #296 from run-llama/add-pinecone-vector-store
Add pinecone vector store
2023-12-28 13:49:40 +07:00
Michael Tutty 83ab7622d9 Fix reference in examples/pinecone-vector-store 2023-12-28 13:44:35 +07:00
Michael Tutty d4312d504b Resolve PR issues for pinecone-vector-store 2023-12-28 13:44:35 +07:00
Michael Tutty 95742e7704 AddPineconeVectorStore to storage/index.ts 2023-12-28 13:44:35 +07:00
Michael Tutty a8845a33df Add apps/simple/pinecone-vector-store 2023-12-28 13:44:35 +07:00
Michael Tutty b3fd87f302 Add PineconeVectorStore 2023-12-28 13:44:34 +07:00
Marcus Schiesser 25ba970e09 feat: added python code for mongodb 2023-12-28 11:47:41 +07:00
Marcus Schiesser a67f9aaad7 Merge pull request #292 from run-llama/ms/cl-python-features
Feat: Bring Python templates with TS templates to feature parity
2023-12-28 11:31:11 +07:00
Marcus Schiesser 210ce35867 fix: remove cleaning the build assets (doesn't work as due to how ncc references the assets) 2023-12-28 10:38:21 +07:00
Marcus Schiesser 36905f6442 fix: CI not running on windows 2023-12-27 18:38:35 +07:00
Marcus Schiesser ed509db04a feat[e2e]: add simple check for fastapi (folder exists) 2023-12-27 18:05:44 +07:00
Marcus Schiesser 14413c0637 fix: produce clean create-llama builds 2023-12-27 17:59:29 +07:00
Marcus Schiesser 9682c95da8 fix: incorrect generation message 2023-12-27 15:21:38 +07:00
Marcus Schiesser 7c6eba90e5 fix: don't allow frontend for non-streaming 2023-12-27 15:21:38 +07:00
Marcus Schiesser c85bf225b9 fix: python packaging 2023-12-27 15:21:36 +07:00
Marcus Schiesser b51c2d66a5 fix: get embed_model from base model 2023-12-27 15:20:45 +07:00
Marcus Schiesser 935bc52239 fix: use base service context 2023-12-27 15:20:45 +07:00
thucpn 57ff51823c docs: update readme for simple template 2023-12-27 15:20:45 +07:00
thucpn 06b20a1772 fix: code review and bugs 2023-12-27 15:20:45 +07:00
thucpn 7a98255149 fix: path to typescript folder 2023-12-27 15:20:45 +07:00
thucpn 980038c711 refactor: typescript vectordb folder 2023-12-27 15:20:45 +07:00
thucpn 09d4e36200 feat: create chat engine folder for python 2023-12-27 15:20:45 +07:00
thucpn 8fb523bcef fix: use model env for all framework 2023-12-27 15:20:45 +07:00
thucpn e48a621d61 fix: use public model only for nextjs 2023-12-27 15:20:45 +07:00
thucpn 1f87787b05 refactor: context structure for simple python template 2023-12-27 15:20:45 +07:00
thucpn fb6cef8a0b docs: update env config 2023-12-27 15:20:45 +07:00
thucpn 21368f6218 feat: remove constants.ts in ts templates 2023-12-27 15:20:45 +07:00
Marcus Schiesser 116685017d feat[cl-fastapi]: test and document new fastapi structure 2023-12-27 15:20:45 +07:00
Marcus Schiesser 23082f2c5e feat[cl-fastapi]: draft for new fastapi structure (supporting engines) 2023-12-27 15:20:45 +07:00
Marcus Schiesser ff2b3ca727 fix[cl-fastapi]: use json for request content-type (and update llama-index) 2023-12-27 15:20:45 +07:00
Marcus Schiesser e55d41f5df fix: don't include python caches to npm 2023-12-22 16:22:34 +07:00
Marcus Schiesser 91fb5101d6 refactor: don't check in idea projects 2023-12-22 15:34:09 +07:00
Marcus Schiesser 9c5e22a656 docs: added changesets for create-llama 2023-12-22 15:34:09 +07:00
Marcus Schiesser 18f23b298e feat: add /api/chat e2e test (uses openai key) (#287)
* feat: allow custom external port

---------

Co-authored-by: thucpn <thucsh2@gmail.com>
2023-12-22 12:49:13 +07:00
Alex Yang ddf39ebeaa refactor: sentence split (#290)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2023-12-21 12:36:43 -06:00
Alex Yang 320b515e7d fix: align separator with llama_index (#289) 2023-12-20 13:15:14 -06:00
Marcus Schiesser 04c50ee946 Feat: Removed pdf-parse, and directly use latest pdf.js (#288) 2023-12-20 17:13:26 +08:00
Marcus Schiesser 3d626d68aa llamaindex@0.0.40 2023-12-18 17:50:12 +07:00
Marcus Schiesser 9c0442bdb5 filter docs for publishing package 2023-12-18 17:44:19 +07:00
Marcus Schiesser 606ffa40d1 docs: add astradb changeset 2023-12-18 17:29:28 +07:00
Marcus Schiesser e9f6de1238 feat: ensure retriever returns an image and send it to the LLM base64 encoded 2023-12-18 17:20:56 +07:00
Marcus Schiesser 8110ab98b6 feat: added mm-rag example and started the response synthesis for it 2023-12-18 17:20:56 +07:00
Marcus Schiesser b8c4bd70ae refactor: improve DX using image vector stores 2023-12-18 17:20:56 +07:00
Marcus Schiesser 2e49856621 refactor: moved multi-modal examples 2023-12-18 17:20:56 +07:00
Marcus Schiesser 2039509811 fix: bugs with persisting and loading image vector stores 2023-12-18 17:20:56 +07:00
Thuc Pham 420f2ddeb7 Fix: npm script does not run in window machine (#283) 2023-12-18 16:43:53 +08:00
Marcus Schiesser afc0516868 add RAG to mistral example 2023-12-18 14:52:37 +07:00
Marcus Schiesser 02a0f5e96c Feat: Add vector DB to create-llama (starting with MongoDB) (#279)
* feat: add selection for vector DB
* feat: add mongo datasource 
* fix: remove not implemented vector dbs

---------

Co-authored-by: Thuc Pham <51660321+thucpn@users.noreply.github.com>
2023-12-15 16:49:00 +08:00
Thuc Pham 2f7b05006b Fix/express app can not parse request json body (#17) 2023-12-14 14:16:25 +07:00
thucpn 314089b0a1 feat: option to select model for express 2023-12-14 14:16:25 +07:00
Mike Fortman 60e626d6d0 Update Astra client and associated type changes (#277) 2023-12-14 10:54:29 +08:00
yisding 5c2050ebcf 0.0.39 2023-12-12 18:22:29 -08:00
yisding 7fd2870d45 Merge pull request #274 from run-llama/ms/add-mistral 2023-12-12 07:27:06 -08:00
Logan 609e3339c0 Merge pull request #275 from run-llama/ms/set-max-tokens-512 2023-12-12 09:06:16 -06:00
Marcus Schiesser 0e01723aee fix: set max tokens to 512 for nextjs examples 2023-12-12 17:17:36 +07:00
Marcus Schiesser 25141b85f9 docs: added astradb changeset 2023-12-12 16:27:32 +07:00
Marcus Schiesser 21510bd664 docs: added changeset 2023-12-12 16:08:58 +07:00
Marcus Schiesser 696d1de19f fix: tests 2023-12-12 16:04:42 +07:00
Marcus Schiesser 56020b4bc3 docs: added mistral AI 2023-12-12 15:56:19 +07:00
Marcus Schiesser 62e29d5a51 fix: context window sizes 2023-12-12 15:41:39 +07:00
Marcus Schiesser 15c890a7b8 feat: add Mistral AI embeddings 2023-12-12 14:58:47 +07:00
Marcus Schiesser 43b33c558f feat: add support for mistral model 2023-12-12 13:55:57 +07:00
Niels Swimberghe be0661f156 Updated AssemblyAI SDK (#269) 2023-12-11 11:10:42 +08:00
yisding b9a5a0498a Merge pull request #268 from run-llama/seldo/add-ga
Including GA measurement ID
2023-12-07 17:56:02 -08:00
Laurie Voss 8c4261500c Including GA measurement ID 2023-12-07 17:47:00 -08:00
yisding 2254d98bcc Merge pull request #267 from run-llama/pierre/i18n-take-2
Add multiple languages translations
2023-12-07 08:50:14 -08:00
yisding 21f9096846 Merge pull request #262 from run-llama/ms/create-llama-add-e2e
Feat: added e2e for create-llama (thanks @himself65)
2023-12-07 08:43:51 -08:00
yisding 9830dc2962 Merge pull request #266 from run-llama/ms/add-json-extract
Feat: Added JSON extract example
2023-12-07 08:37:13 -08:00
Pierre c29a8cc63b Reduce number of language to 15 in the hope of allowing vertex to build the doc 2023-12-07 16:20:46 +01:00
Pierre ef7872eb4f Add multiple languages translations 2023-12-07 15:31:44 +01:00
Marcus Schiesser 3282223511 feat: added json extract example 2023-12-07 16:30:31 +07:00
Marcus Schiesser c99c5eb03f fix: disable windows for e2e tests 2023-12-07 11:28:37 +07:00
Marcus Schiesser 3b759c26c4 fix: running tests on windows 2023-12-07 11:28:37 +07:00
Marcus Schiesser 5038a1f351 fix: don't use frontend for backends of type non-streaming 2023-12-07 11:28:37 +07:00
Marcus Schiesser 0aa7552de6 fix: skip simple/nextjs combination 2023-12-07 11:28:37 +07:00
Marcus Schiesser 7fae7d2cde fix: unify OpenAI key naming 2023-12-07 11:28:37 +07:00
Marcus Schiesser f35d8e5b64 feat: set test permutations trade-off 2023-12-07 11:28:37 +07:00
Marcus Schiesser 63cc0a35d3 fix: use CJS for create-llama 2023-12-07 11:28:37 +07:00
Marcus Schiesser d159bdd50c refactor: cleaned e2e test code 2023-12-07 11:28:37 +07:00
Marcus Schiesser 0f2c609621 fix: e2e tests for nextjs and express 2023-12-07 11:28:37 +07:00
Marcus Schiesser 4e14952b24 feat: add PORT env to express templates 2023-12-07 11:28:37 +07:00
Marcus Schiesser b36d4b2723 fix: added model parameter to create-llama 2023-12-07 11:28:37 +07:00
Marcus Schiesser bf53cd3d3d feat: added e2e (thanks @himself65) 2023-12-07 11:28:37 +07:00
yisding f2e3935c0b Merge pull request #249 from mfortman11/astradb
Add AstraDB Vector Store
2023-12-06 14:31:01 -08:00
Mike Fortman 77f41f9356 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into astradb 2023-12-06 14:14:19 -06:00
Mike Fortman 042500dd55 Update constuctor and metadata handling 2023-12-06 14:10:45 -06:00
yisding f0be93313a publish 2023-12-05 21:40:00 -08:00
yisding bf9e26319c more changesets 2023-12-05 21:29:32 -08:00
yisding 5054eb3b10 package updates 2023-12-05 20:34:25 -08:00
yisding 9bea88c7b8 fix double dropdown in docs 2023-12-05 20:11:40 -08:00
yisding 786c25d342 changesets 2023-12-05 19:54:35 -08:00
yisding d00f18d567 Merge pull request #252 from run-llama/suo/cn
[WIP] chinese docs
2023-12-05 11:10:18 -08:00
yisding 0f363487e9 Merge branch 'main' into suo/cn 2023-12-05 10:52:07 -08:00
yisding b471da75d6 Merge pull request #260 from run-llama/fr
[WIP] French documentation
2023-12-05 10:51:33 -08:00
yisding e5937ff6f8 Merge pull request #244 from parhammmm/main
Handle Azure specific responses, where choices could be 0
2023-12-05 10:20:56 -08:00
yisding 08379e61bf Merge pull request #231 from himself65/himself65/deps
fix(create-llama): lock deps version
2023-12-05 10:20:19 -08:00
yisding 6c8a65b055 Merge branch 'main' into himself65/deps 2023-12-05 10:19:09 -08:00
Mike Fortman d059db62c3 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into astradb 2023-12-05 10:24:38 -06:00
yisding e4dd4a9036 Merge pull request #259 from run-llama/ms/create-llama-refactor-move-ui
Fixes for create-llama release
2023-12-05 07:59:37 -08:00
Pierre c0fc9f6e55 Copy api instead of linking it, as it was creating error with link following 2023-12-05 13:35:51 +01:00
Pierre 72d919566c French documentation 2023-12-05 13:32:27 +01:00
Marcus Schiesser 2aeb3415b1 doc: added changeset 2023-12-05 17:39:32 +07:00
Marcus Schiesser 680a12f87e fix: add minor/patch versions to be reproducable between pnpm and npm 2023-12-05 17:39:32 +07:00
Marcus Schiesser 7a83b34c16 fix: lower max tokens (so it works with gpt 3.5) 2023-12-05 17:39:32 +07:00
Marcus Schiesser ecd16f9fb0 refactor: swapped html and shadcn 2023-12-05 17:39:32 +07:00
yisding 54ca85d482 Merge pull request #229 from run-llama/feat/add-assemblyai
Feat: Re-Add AssemblyAIReader
2023-12-04 22:02:45 -08:00
yisding 65ef0be90c Merge pull request #255 from run-llama/ms/fix-pgvector
fix: paths in pgvector store example
2023-12-04 22:00:23 -08:00
yisding 57106affdf Merge pull request #256 from run-llama/ms/move-mongodb-example
Chore: move mongodb example
2023-12-04 21:59:55 -08:00
yisding d613bbd358 Merge pull request #257 from run-llama/ms/download-community-projects
Feat: Add support for installing templates from community repo
2023-12-04 09:08:01 -08:00
Mike Fortman d0bf2104dc Merge branch 'main' of github.com:run-llama/LlamaIndexTS into astradb 2023-12-04 10:54:03 -06:00
Mike Fortman e70413373f pr feedback: update import and constructor params 2023-12-04 10:53:31 -06:00
Marcus Schiesser 36f0af5a5d refactor: factor out questions and use strong-typing for question args 2023-12-04 17:07:49 +07:00
Marcus Schiesser 79d7076121 fix: only use community path for community templates 2023-12-04 17:02:53 +07:00
Marcus Schiesser 526b3e74bf fix: using correct path for readme link in terminal 2023-12-04 17:01:44 +07:00
thucpn d03dc21e8a feat: options to download community projects 2023-12-04 13:51:53 +07:00
Marcus Schiesser c31dfa4957 fix: move mongodb to examples/ 2023-12-04 11:40:03 +07:00
Marcus Schiesser c7e510723d fix: paths in pgvector store example 2023-12-04 11:31:20 +07:00
Gabriel Almeida 42093de872 Fix missing PGVectorStore export (#254) 2023-12-04 11:51:50 +08:00
Simon Suo 886e58828e use gpt-4 2023-12-02 17:39:44 -08:00
Simon Suo c8eaf1c9ac wip 2023-12-02 17:28:54 -08:00
Simon Suo 2169dadccc wip 2023-12-02 17:02:40 -08:00
Simon Suo 4bc8a7b733 wip 2023-12-02 16:58:39 -08:00
Simon Suo 61eb955921 wip 2023-12-02 15:23:17 -08:00
Simon Suo aa48a5d764 Merge pull request #251 from himself65/himself65-patch-1
docs: broken link on starter.md
2023-12-02 15:22:19 -08:00
Alex Yang 1dedca45ac docs: broken link on starter.md 2023-12-02 17:01:45 -06:00
Mike Fortman 9d90335a12 add function descriptions 2023-12-01 15:26:24 -06:00
Mike Fortman b577acb115 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into astradb 2023-12-01 14:53:07 -06:00
Mike Fortman 425e2bcccc Add docs 2023-12-01 14:52:16 -06:00
Mike Fortman 3766251891 Add Vector Store and Examples 2023-12-01 14:05:20 -06:00
yisding 3552de1b45 Merge pull request #234 from run-llama/ms/add-multi-modal-retriever
Feat: Adds multi modal retriever
2023-11-30 18:17:33 -08:00
Alex Yang 2b94e36df6 ci: update workflow version (#239) 2023-11-30 19:38:42 -06:00
yisding d1e1de4a8d Merge pull request #243 from run-llama/ms/add-create-llama-doc
doc: added create-llama
2023-11-30 17:28:08 -08:00
yisding 23587e17ad Merge pull request #247 from run-llama/ms/fix-docs
docs: fix links after moving examples
2023-11-30 17:23:19 -08:00
Marcus Schiesser 213f452f0b fix: bugs while testing the example 2023-11-30 17:11:25 +07:00
Marcus Schiesser 27a488539d feat: add multi-modal example and image reader 2023-11-30 11:17:59 +07:00
Marcus Schiesser 283da50d33 refactor: only use one class for multi-modal and normal 2023-11-30 11:17:59 +07:00
Marcus Schiesser a809085715 feat: add MultiModalVectorIndexRetriever 2023-11-30 11:17:59 +07:00
Marcus Schiesser 67321f1cba feat: add deleteDoc and creation of MultiModalVectorStoreIndex - cleaned VectorStoreIndex 2023-11-30 11:17:59 +07:00
Marcus Schiesser 7683186470 feat: added MultiModelVectorStoreIndex 2023-11-30 11:17:59 +07:00
Marcus Schiesser fded43b77e docs: fix links after moving examples 2023-11-30 11:11:38 +07:00
yisding 22ff7da4e0 Merge pull request #246 from run-llama/ms/move-examples
Unify apps/simple and examples - move everything to examples
2023-11-29 09:05:24 -08:00
Marcus Schiesser 844561b6cc chore: unified apps/simple and examples 2023-11-29 11:48:43 +07:00
Niels Swimberghe 1fe02a3067 update AssemblyAI reader to use new functions (#245) 2023-11-29 10:05:36 +08:00
Alex Yang 362d8ecb31 fix(create-llama): lock deps version 2023-11-28 10:53:26 -06:00
Parham Saidi 5f5f6389f9 Handle Azure specific responses, where choices could be 0 2023-11-28 17:49:00 +01:00
Marcus Schiesser 31cf3cde45 fix: default order error in package.json 2023-11-28 15:50:10 +07:00
Marcus Schiesser 11f0c2cab1 Revert "feat: remove AssemblyAIReader as it's not working with Next.JS"
This reverts commit c8bbc101cc.
2023-11-28 15:48:08 +07:00
Marcus Schiesser 52bc1d8387 doc: added create-llama 2023-11-28 13:52:14 +07:00
yisding 8a3ac0c338 Merge pull request #242 from run-llama/seldo-patch-1
Update link to python docs
2023-11-27 18:05:03 -08:00
yisding bb125d7d4f Merge pull request #240 from mtutty/add-pgvector-store
Minor fixes in PGVectorStore
2023-11-27 18:04:38 -08:00
yisding a405716847 Merge pull request #233 from run-llama/ms/create-llama-multi-modal
Feat: add GPT4 Vision support (and file upload) to create-llama
2023-11-27 18:03:29 -08:00
Laurie Voss bad6e03095 Update link to python docs 2023-11-27 17:26:50 -08:00
Michael Tutty 2330fddfbb Fix a field mapping in query method, handle empty embeddingResults in add method 2023-11-27 19:03:17 +00:00
Marcus Schiesser 61dfd74134 feat: removed non-streaming for nextjs 2023-11-24 18:04:14 +07:00
Marcus Schiesser 029ff83979 fix: set maxTokens to 4096 so vision model is not stopping too early (seems to have a lower default than other models) 2023-11-24 18:04:14 +07:00
Marcus Schiesser dbbc4cb2e1 feat: add multi-modal (file upload) and model selection to create-llama 2023-11-24 16:49:05 +07:00
Alex Yang 1cce21cdc2 feat: add loading indicator (#203) 2023-11-24 11:48:54 +08:00
yisding 8b786a51b3 create-llama 0.0.10 2023-11-23 10:56:43 -08:00
yisding ad7537dd84 llamaindex 0.0.37 2023-11-23 10:54:44 -08:00
yisding 3bab23172a changeset 2023-11-23 10:53:30 -08:00
yisding 18c132d494 Merge pull request #228 from run-llama/ms/create-llama-fixes
Several fixes for improving compatibility with Next.JS
2023-11-23 10:50:13 -08:00
Marcus Schiesser d072353e08 fix: copy pdf-parse test doc for npm build 2023-11-23 20:58:43 +07:00
Marcus Schiesser c8bbc101cc feat: remove AssemblyAIReader as it's not working with Next.JS 2023-11-23 18:23:24 +07:00
Marcus Schiesser b93f748998 fix: don't resolve mongodb for next.js 2023-11-23 18:20:15 +07:00
Marcus Schiesser ecb100448a fix: remove forceConsistentCasingInFileNames warning 2023-11-23 18:19:29 +07:00
Marcus Schiesser c749c856b5 fix: add missing clsx package 2023-11-23 18:18:35 +07:00
Marcus Schiesser 0baf278972 fix: transformers.js not working with nextjs 2023-11-23 16:46:18 +07:00
Marcus Schiesser ae7780266a fix: curl test for express (streaming) 2023-11-23 15:56:36 +07:00
Marcus Schiesser 587960aebe fix: use dotenv for npm run generate, use .env for NextJS, fix package versions for pnpm 2023-11-23 15:55:47 +07:00
Marcus Schiesser 4e1b6784f7 fix: pdfparse not working with in ESM version 2023-11-23 14:22:29 +07:00
yisding 8b381f2640 LITS 0.0.36 2023-11-21 22:33:14 -08:00
yisding 0dc7fa6c34 Merge pull request #170 from Swimburger/assemblyai
Add AssemblyAI integration
2023-11-21 21:46:08 -08:00
yisding 2a2bf682bf small fix in example 2023-11-21 21:44:58 -08:00
yisding 87526129fb Merge branch 'main' into assemblyai 2023-11-21 21:39:35 -08:00
yisding 8ed1b7aa46 Merge pull request #179 from mtutty/add-pgvector-store
Add PGVectorStore
2023-11-21 21:35:12 -08:00
yisding 4084bd0ecc Merge branch 'main' into add-pgvector-store 2023-11-21 21:33:41 -08:00
yisding d11eaceaf1 Merge pull request #223 from run-llama/claude-21
support for claude-2.1
2023-11-21 21:30:21 -08:00
yisding 1e6986fbc5 pnpm lockfile 2023-11-21 21:20:30 -08:00
yisding 11a19bdec7 make sweep optional in issues 2023-11-21 21:15:32 -08:00
yisding 51064f1b90 Merge pull request #221 from run-llama/ms/add-clip-embeddings
feat: add clip embedding to llamaindex
2023-11-21 21:04:01 -08:00
yisding 3385cd19e8 support for claude-2.1
Added custom RAG prompt for Claude.
Supporting system message format.
2023-11-21 21:01:54 -08:00
yisding 852f8517df Merge pull request #209 from run-llama/jerry/edit_readme
add .env instructions
2023-11-21 21:01:35 -08:00
Marcus Schiesser bb917f9818 refactor: moved embeddings to embeddings folder 2023-11-21 14:20:10 +07:00
Marcus Schiesser 10248fb29f chore: move clip example 2023-11-21 13:53:38 +07:00
Marcus Schiesser 446dc85bdd fix: usage of transformers.js as CJS 2023-11-21 13:42:40 +07:00
Marcus Schiesser 4aa2c226a9 feat: add clip embedding to llamaindex 2023-11-21 11:01:29 +07:00
Marcus Schiesser bf9ba8313a test clip embeddings 2023-11-21 10:59:37 +07:00
yisding 444b59c557 Merge pull request #218 from run-llama/ms/use-cryptojs
feat: use cryptojs instead of crypto
2023-11-20 18:25:31 -08:00
yisding b2e1df94db Merge remote-tracking branch 'origin/main' into ms/use-cryptojs 2023-11-20 18:24:30 -08:00
yisding b4963cabc8 Merge pull request #204 from run-llama/ms/add-mongodb-vector
Feat: added support for MongoDB as vector DB
2023-11-20 18:09:09 -08:00
Marcus Schiesser 2851024340 feat: use cryptojs instead of crypto (removes nodejs dep) 2023-11-20 13:56:04 +07:00
yisding 7f25a25729 create-llama 0.0.9 2023-11-19 18:30:32 -08:00
yisding acfe23265a changeset 2023-11-19 18:17:57 -08:00
yisding 2c6fbbd7dd Merge pull request #217 from run-llama/seldo/python-gitignore 2023-11-19 17:30:49 -08:00
Laurie Voss f84507f513 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into seldo/python-env 2023-11-19 17:26:50 -08:00
Laurie Voss be6a9e4a48 Default .gitignore should ignore .env 2023-11-19 17:26:25 -08:00
yisding 69e7634619 Merge pull request #216 from run-llama/seldo/python-env 2023-11-19 17:14:42 -08:00
Laurie Voss d18748aba4 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into seldo/deploy-fixes 2023-11-19 17:11:45 -08:00
yisding 27c4ef3410 Merge pull request #215 from run-llama/seldo/deploy-fixes 2023-11-19 16:21:19 -08:00
Laurie Voss a7ee392d3e dotenv must load before chat_router or .env isn't picked up in time 2023-11-19 16:15:41 -08:00
Laurie Voss 4415a6fdef next.config.js has to be different for express/python backends 2023-11-19 15:55:27 -08:00
Laurie Voss 1e1e6e96a1 Handle CORS in prod 2023-11-19 15:54:53 -08:00
Laurie Voss 461d1dfbcc Don't commit .env in the backend 2023-11-19 15:52:57 -08:00
Jerry Liu 3e8c923641 cr 2023-11-17 19:39:23 -08:00
yisding 5975fafefb Merge pull request #208 from run-llama/seldo/express-parsing-bug
fix: generated frontend is sending text/plain
2023-11-17 16:57:42 -08:00
Laurie Voss 71169fd545 fix: generated frontend is sending text/plain so handle that instead of JSON 2023-11-17 15:29:56 -08:00
Logan be895d564d Merge pull request #202 from run-llama/logan/fix_llm_def 2023-11-17 15:02:04 -06:00
yisding f36a27c218 create-llama 0.0.8 2023-11-17 09:06:00 -08:00
yisding 8cdb07f151 changeset 2023-11-17 09:05:24 -08:00
yisding ea403a0ffe Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-11-17 09:04:33 -08:00
yisding 7f0b4e66ae create-llama 0.0.7 2023-11-17 09:04:01 -08:00
yisding 3b226965ba Merge pull request #205 from run-llama/ms/copy-cache-folder
fix: copy cache folder for vercel deployments
2023-11-17 09:03:26 -08:00
Logan Markewich 63daf77412 remove accidental files 2023-11-17 09:57:43 -06:00
Marcus Schiesser df5cbe30a6 fix: missing JSON parsing and improved compatibility with Python 2023-11-17 15:06:31 +07:00
Marcus Schiesser 9e1a536778 docs: createIndex doesn't work 2023-11-17 14:58:20 +07:00
Marcus Schiesser a1db8833ef feat: sync'ed SimpleMongReader with Python 0.9 and tested/fixed mongodb scripts 2023-11-17 14:05:12 +07:00
Marcus Schiesser 95dd0e0158 feat: add mongo db vector support with example 2023-11-17 14:05:12 +07:00
Marcus Schiesser 079a1d5cc3 fix: copy cache folder for vercel deployments 2023-11-17 08:52:42 +07:00
Logan Markewich 2377d1a466 Fix LLM definitions 2023-11-16 15:55:38 -06:00
yisding 9f9f29391e changeset 2023-11-15 16:25:07 -08:00
yisding b64716d3f7 Merge pull request #197 from run-llama/seldo/create-llama-readme
Expanding README docs
2023-11-15 15:56:42 -08:00
Laurie Voss d7a47abe38 Lots of new docs 2023-11-15 15:52:56 -08:00
yisding 58b314a61e create-llama 0.0.6 2023-11-14 20:54:59 -08:00
yisding 4431ec7a5e changeset 2023-11-14 20:53:42 -08:00
yisding 9542026d70 Merge pull request #196 from run-llama/ms/fix-label-for-simple-chat
fix: label for simple chat
2023-11-14 20:49:27 -08:00
Marcus Schiesser cc4c5b64c0 fix: label for simple chat 2023-11-15 11:06:26 +07:00
yisding 82c2aac4a0 update replicate version 2023-11-14 16:41:57 -08:00
yisding a143e0f0f1 new replicate models 2023-11-14 16:40:36 -08:00
yisding db9775dc32 sync examples 2023-11-14 16:20:57 -08:00
yisding 538c0b0740 hopefully fix prettier issue 2023-11-14 16:17:53 -08:00
yisding 21cd88caf6 prettier 2023-11-14 16:06:18 -08:00
yisding 0660d9e2a5 create-llama 0.0.5 2023-11-14 15:04:41 -08:00
yisding 25257f49d7 changeset 2023-11-14 14:50:27 -08:00
yisding dd615f106d fix #182 (thanks @RayFernando1337)
add license
make contextchatengine the default
change git commit message
2023-11-14 14:48:08 -08:00
yisding 5db64d61e0 Merge pull request #155 from team-dev-docs/avb-is-me-patch-1
Add Interactive Tutorials Using Codespaces
2023-11-14 12:08:07 -08:00
yisding ee5e1f94e4 create-llama 0.0.4 2023-11-14 09:16:13 -08:00
yisding 031e926414 changeset 2023-11-14 09:14:30 -08:00
yisding 88b4b3143d Merge pull request #181 from run-llama/logan/update_create_llama_readme
create-llama readme update
2023-11-14 09:09:15 -08:00
yisding c1ce84ecec Update README.md 2023-11-14 09:06:56 -08:00
Logan Markewich d670011363 typo 2023-11-14 10:57:16 -06:00
Logan Markewich c88332366b readme update 2023-11-14 10:30:55 -06:00
yisding cfee282c28 create-llama 0.0.3 2023-11-13 20:19:43 -08:00
yisding 91b42a3539 changeset 2023-11-13 20:15:18 -08:00
yisding 02b1d176c5 Merge pull request #180 from run-llama/fix/create-llama-version
fix: use llamaindex version and not create-llama version
2023-11-13 20:00:05 -08:00
Marcus Schiesser 63d072b8cc fix: use llamaindex version and not create-llama version 2023-11-14 10:50:26 +07:00
yisding 256d44f255 create llama 0.0.2 and llamaindex 0.0.35 2023-11-13 18:10:18 -08:00
yisding e2a6805a31 changeset 2023-11-13 18:09:09 -08:00
yisding d46fc12079 packages 2023-11-13 18:08:30 -08:00
yisding 5ce88f107c Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-11-13 18:01:57 -08:00
yisding 683c4addd9 Merge pull request #153 from run-llama/add/create-llama
Add create-llama CLI tool
2023-11-13 17:58:58 -08:00
yisding db58cf2e68 Update README.md 2023-11-13 17:58:20 -08:00
yisding 1cf535865a Update packages/create-llama/create-app.ts
Co-authored-by: Alex Yang <himself65@outlook.com>
2023-11-13 17:48:15 -08:00
Marcus Schiesser 6042d2a3c7 fix: don't copy backend files for frontend-only 2023-11-13 17:38:40 +07:00
Marcus Schiesser df03819e12 feat: copy test PDF for TS projects and automatically call npm run generate 2023-11-13 16:59:49 +07:00
Marcus Schiesser 072354afb7 fix: remove pnpm-lock 2023-11-13 13:39:17 +07:00
Marcus Schiesser 57c7369aea fix: add cors to express app 2023-11-13 11:36:32 +07:00
Marcus Schiesser f92cdf335f fix: didn't copy UI readme 2023-11-13 10:08:25 +07:00
Michael Tutty 19f3c857d5 Add comment blocks and support for collection filtering 2023-11-11 18:13:41 +00:00
Michael Tutty 7f3da73aa4 Final cleanup, README for example scripts 2023-11-11 17:48:01 +00:00
Michael Tutty c384c2b610 Resolve upstream conflicts 2023-11-11 16:56:45 +00:00
Marcus Schiesser 16d7dd426a fix: align express port with fastapi port 2023-11-10 18:15:14 +07:00
Marcus Schiesser 787b6928d9 feat: updated package version and exchanged PDF for fastapi 2023-11-10 17:48:20 +07:00
Marcus Schiesser ddbdbc5fb5 fix: ensure that no HTML component files are copied if shadcn is selected 2023-11-10 17:38:15 +07:00
Marcus Schiesser d0edf9fb48 feat: add OpenAI key to create-llama 2023-11-10 16:56:35 +07:00
Marcus Schiesser 28d4446aa7 feat: add markdown, regenerate and stop 2023-11-10 16:56:35 +07:00
Marcus Schiesser ab3419ab09 fix: removed launch.json 2023-11-10 16:56:35 +07:00
Marcus Schiesser 457fe1535f fix: add linting for create-llama 2023-11-10 16:56:35 +07:00
Marcus Schiesser 6e90b02052 feat: generate fullstack app with fastapi or express 2023-11-10 16:56:35 +07:00
Marcus Schiesser fdc2680ae8 inline UI HTML components to simplify code generation 2023-11-10 16:56:35 +07:00
Marcus Schiesser 35a398443a inline simple chat engine as a default 2023-11-10 16:56:35 +07:00
Marcus Schiesser b55ce8aa93 remove bun 2023-11-10 16:56:35 +07:00
Marcus Schiesser 74e67ef702 separate template types and components in file system 2023-11-10 16:56:35 +07:00
Marcus Schiesser e689248919 fix: wrap non-streaming result for FastAPI in an result object 2023-11-10 16:56:35 +07:00
Marcus Schiesser 5a527b3fc9 feat: set custom api path for nextjs 2023-11-10 16:56:35 +07:00
Marcus Schiesser 565cc37912 fix: modify streaming fastapi to support vercel/ai 2023-11-10 16:56:35 +07:00
Marcus Schiesser 50e1864a85 added streaming fastapi template 2023-11-10 16:56:35 +07:00
Marcus Schiesser 37ac88fc1b added simple fastapi template 2023-11-10 16:56:35 +07:00
Marcus Schiesser 8ed98bcb07 feat: add streaming express example and align with non-streaming one 2023-11-10 16:56:35 +07:00
Marcus Schiesser b8609ec149 feat: select between HTML and shadcn components 2023-11-10 16:56:35 +07:00
Marcus Schiesser 96eb603bca add support for chat engines to express 2023-11-10 16:56:35 +07:00
Marcus Schiesser 20aaf35fc4 add ContextChatEngine and generator for different chat engines 2023-11-10 16:56:35 +07:00
Marcus Schiesser 151a63a118 unified streaming and non-streaming 2023-11-10 16:56:35 +07:00
Marcus Schiesser 9db2267445 moved components to ui folder (shadcn structure) 2023-11-10 16:56:35 +07:00
Marcus Schiesser 69a7ef063d added streaming for llamaindex 2023-11-10 16:56:35 +07:00
Marcus Schiesser 8527875f0a added support for generating streaming template 2023-11-10 16:56:35 +07:00
Marcus Schiesser 2244da07e6 added first draft of streaming nextjs template 2023-11-10 16:56:35 +07:00
Marcus Schiesser 18bf710549 feat: add simple chat for nextjs template 2023-11-10 16:56:34 +07:00
Marcus Schiesser 9e2e5a3f7f doc: update readmes 2023-11-10 16:56:34 +07:00
Marcus Schiesser 3df7fd6dd1 remove import alias and src folder rewrite 2023-11-10 16:56:34 +07:00
Marcus Schiesser 4371c46c4c add express example, framework selector and use existing package.json (just update it) 2023-11-10 16:56:34 +07:00
Marcus Schiesser fcf7c1275b use repos package version 2023-11-10 16:56:34 +07:00
Marcus Schiesser e6e62fa767 removed URL download 2023-11-10 16:56:34 +07:00
Marcus Schiesser 8e1cb8fb70 use prettier 2023-11-10 16:56:34 +07:00
Marcus Schiesser 00674686cb add test form for nextjs simple (and make generation work) 2023-11-10 16:56:34 +07:00
Marcus Schiesser b350bb2e7a add llama nextjs simple template 2023-11-10 16:56:34 +07:00
Marcus Schiesser e17c704a4b add async-sema 2023-11-10 16:56:34 +07:00
Marcus Schiesser 3259245780 add create-next-app v13.5.6 2023-11-10 16:56:34 +07:00
yisding 63f21084b6 changeset 2023-11-09 19:14:17 -08:00
yisding ced3555248 Merge pull request #178 from run-llama/ms/gpt4-vision
Add support for GPT4 Vision Model
2023-11-09 19:12:22 -08:00
Marcus Schiesser 27eef24611 feat: use context-generator for multi-modal messages 2023-11-10 10:02:51 +07:00
Michael Tutty dcf358f27d Resolve upstream updates/conflicts 2023-11-10 02:16:42 +00:00
Michael Tutty 40afc8c0e2 Add PGVectorStore, dependencies, example scripts 2023-11-10 02:04:35 +00:00
Marcus Schiesser 1dabdbf7d8 feat: allow any type for messages to support GPT-4 vision 2023-11-08 16:39:54 +07:00
yisding d65397a0ba change example to 4-turbo 2023-11-06 12:58:47 -08:00
yisding 8c72500070 0.0.34 2023-11-06 12:58:12 -08:00
yisding 2a27e21e00 changeset 2023-11-06 12:40:36 -08:00
yisding 3bc52a1f2c added 3.5 1106 2023-11-06 12:39:52 -08:00
yisding 9806b5a0a9 0.0.33 2023-11-06 10:59:52 -08:00
yisding 201cd0f5fc packages 2023-11-06 10:59:00 -08:00
yisding 5e2e92c11a changeset 2023-11-06 10:51:02 -08:00
yisding d57657599b new openai models from dev day 2023-11-06 10:50:22 -08:00
yisding 995db834b2 0.0.32 2023-11-02 18:05:56 -07:00
Niels Swimberghe b22bc8a799 Add AssemblyAI integration 2023-10-31 15:43:33 -04:00
yisding dfd22aac46 changeset 2023-10-30 14:00:54 -07:00
yisding 72f62718f1 Merge pull request #160 from mtutty/add-observable-reader
Add observer/callback feature to SimpleDirectoryReader
2023-10-30 13:59:16 -07:00
yisding e938a4d154 minor changes 2023-10-30 13:52:15 -07:00
Michael Tutty 641019262e Add observer/callback feature to SimpleDirectoryReader 2023-10-30 13:52:15 -07:00
yisding fe9056f081 Merge pull request #164 from v4n/main
replace tiktoken with js-tiktoken
2023-10-30 10:56:34 -07:00
V4N fba49b8088 replace tiktoken with js-tiktoken 2023-10-30 10:00:02 -03:00
avb-is-me a5ae1eea30 Update end_to_end.md
Adds interactive Dev-Docs Tutorials
2023-10-27 16:04:32 -07:00
yisding 6e0ee9ec32 pinning babel/traverse for security 2023-10-26 15:50:55 -07:00
yisding a5e3e10e84 dynamic import of string-strip-html 2023-10-26 15:42:25 -07:00
yisding 99afbdd606 Merge pull request #154 from mtutty/add-html-reader
Add HTMLReader, sample app and HTML file
2023-10-26 15:06:51 -07:00
yisding 90c0b83c34 changeset 2023-10-26 15:04:51 -07:00
yisding 68f9dd1ce1 prettier 2023-10-26 15:04:08 -07:00
yisding 51e4b1de99 add HTMLReader to SimpleDirectoryReader 2023-10-26 15:02:04 -07:00
Michael Tutty 08f091a889 Revert .vscode/settings.json changes 2023-10-26 21:04:55 +00:00
Michael Tutty 692e3cc56e Add HTMLReader to core/src/readers, apps/simple example, and apps/simple/data HTML file 2023-10-26 20:21:59 +00:00
yisding bcfbccc381 0.0.31 2023-10-25 16:52:00 -07:00
yisding 8aa8c65d0e changeset 2023-10-25 14:24:12 -07:00
yisding 635d485b69 Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-10-25 14:12:03 -07:00
yisding c0630eeebb Merge pull request #152 from TomPenguin/add-similarity-postprocessor
Add SimilarityPostprocessor
2023-10-25 12:54:14 -07:00
TomPenguin 8932be2d49 add preFilters option 2023-10-25 12:42:25 +09:00
TomPenguin 3905486240 remove logging 2023-10-25 12:39:09 +09:00
TomPenguin eedc14b13c fix 2023-10-25 12:36:03 +09:00
TomPenguin 44bb615eee update lock file 2023-10-25 12:23:59 +09:00
yisding 541d387143 packages 2023-10-24 16:34:26 -07:00
yisding a8ad9c10bd Merge pull request #146 from run-llama/fix/allow-readonly-indexes
fix: allow readonly indexes
2023-10-17 19:56:52 -07:00
yisding f1669224da update repository/license in package.json 2023-10-17 16:13:11 -07:00
Marcus Schiesser 2a27061891 fix: allow readonly indexes 2023-10-17 16:40:29 +07:00
yisding 6c55b2de58 changeset 2023-10-16 09:27:47 -07:00
yisding 9b99855c43 Merge pull request #145 from run-llama/feat/changes-for-unc
Feature: Extract ContextGenerator and make HistoryChatEngine pluggable
2023-10-16 09:23:08 -07:00
Marcus Schiesser 0269e88575 fix: added newMessages to SimpleChatHistory to unify interface with SummaryChatHistory 2023-10-16 17:48:29 +07:00
Marcus Schiesser 7fbd43283d fix: send context if there is no memory yet 2023-10-16 17:48:29 +07:00
Marcus Schiesser 226c123b77 fix: prevent context window overflow by including context messages to token calculation 2023-10-16 17:48:29 +07:00
Marcus Schiesser ac271d1006 feat: added StatelessChatEngine and extracted ContextGenerator 2023-10-16 17:48:29 +07:00
yisding af84425689 Merge pull request #144 from run-llama/feat/add-llm-metadata
Feature: Added `LLMMetadata` interface
2023-10-12 18:02:20 -07:00
Marcus Schiesser 512e9c947c fix: using LLM interface is sufficient 2023-10-12 14:16:24 +07:00
Marcus Schiesser e7319376a5 feat: add llm metadata interface 2023-10-11 17:24:46 +07:00
Marcus Schiesser 2a7b493769 fix: use globalshelper for tokenizer 2023-10-11 16:27:13 +07:00
Marcus Schiesser f516a0d2e4 feat: make usage of HistoryChatEngine similar to ContextChatEngine 2023-10-11 16:26:42 +07:00
Yi Ding 62f872122c docs for nextjs app router 2023-10-10 14:34:23 -07:00
yisding 89737d6e00 Merge pull request #140 from run-llama/feat/use-tokenizer-for-summarizer
Feat: Use tokenizer for chat history summarizer
2023-10-09 18:17:27 -07:00
Marcus Schiesser 6a81d54e53 Update packages/core/src/ChatHistory.ts 2023-10-09 18:18:38 +08:00
Marcus Schiesser c0062746eb feat: use tokenizer to ensure we're not running over the context window 2023-10-09 16:55:05 +07:00
Marcus Schiesser 809a904bc8 fix: summarizer issues 2023-10-09 11:51:28 +07:00
Yi Ding 602d27c7b0 0.0.30 2023-10-08 19:16:05 -07:00
yisding aad61e876f Merge pull request #139 from run-llama/esm
Esm
2023-10-07 15:59:50 -07:00
Yi Ding eb0e9947f2 changesets 2023-10-07 15:56:42 -07:00
Yi Ding 23a09cff1b export PromptHelper 2023-10-07 15:54:35 -07:00
Yi Ding ebe9041fdc esm module 2023-10-07 14:07:16 -07:00
Yi Ding f93ef09b58 upgrade packages 2023-10-07 13:48:44 -07:00
Yi Ding e74cfb93b5 package upgrades 2023-10-07 13:32:09 -07:00
yisding 4a44621f87 Merge pull request #138 from run-llama/feat/improve-chat-history-summarizer
feat: improved chat history summarizer
2023-10-05 18:37:35 -07:00
Yi Ding c7acaa2f5e fix test 2023-10-05 15:50:11 -07:00
Yi Ding 139abad1f4 changeset 2023-10-05 15:02:35 -07:00
Marcus Schiesser a3a5306f11 feat: improved chat history summarizer 2023-10-05 17:14:19 +07:00
yisding fb1c3bc446 Merge pull request #130 from Einsenhorn/einsenhorn/from_vector_store
VectorStore - Add Method "VectorStoreIndex.fromVectorStore" + Prefilters + Pinecone Demo
2023-10-03 14:48:39 -07:00
yisding aaf344a4dd Merge pull request #133 from noble-varghese/noble-varghese/portkey-integration
feat: Portkey integration with LLamaIndexTS
2023-10-03 14:48:16 -07:00
Yi Ding 62ca9c0ed2 fix lint errors and change spelling of organization 2023-10-03 11:57:07 -07:00
Louis de Courcel dc8be8740d impr: add a simple example to show pinecone query with prefilters 2023-10-03 11:23:44 -07:00
Louis de Courcel d9bcf4df92 impr: add fromVectorStore method 2023-10-03 11:22:17 -07:00
yisding 7ceb94f9c2 Merge pull request #131 from kkang2097/chat-queryengine-streaming
ChatEngine streaming [needs merge]
2023-10-03 11:12:12 -07:00
Elliot Kang 2e5becb4fb Update LLM.ts - anthropic comment 2023-09-30 15:17:03 -07:00
Elliot Kang 5e12f568bd formatting 2023-09-30 14:10:55 -07:00
Elliot Kang 80382c0bf9 fix example + bugfixes 2023-09-30 13:50:11 -07:00
Elliot Kang 91150d4150 Updated Anthropic Stream Token 2023-09-30 13:49:54 -07:00
Elliot Kang 6bfc38db53 pnpm run format 2023-09-30 12:20:11 -07:00
Elliot Kang 95b99db199 example fix 2023-09-30 12:18:31 -07:00
Elliot Kang 1b13395e65 Anthropic steaming support 2023-09-30 12:18:17 -07:00
Elliot Kang fe21904b53 added AnthropicStreamToken type 2023-09-30 12:18:02 -07:00
Elliot Kang ab0d666f03 fixed imports, moved llmStrem example 2023-09-30 11:46:54 -07:00
Elliot Kang 30add7a765 add chatEngine example 2023-09-29 12:00:39 -07:00
Elliot Kang 83971a1913 revert interface change 2023-09-28 16:27:28 -07:00
Elliot Kang 2f62081683 pnpm run format 2023-09-28 16:26:07 -07:00
Elliot Kang c7eb81dfa4 camelcase 2023-09-28 16:23:20 -07:00
Elliot Kang 9f35f526e0 Updated ChatEngine interface
- makes chatEngine auto-set return type like LLM.ts
- added streaming support for some chatEngines
2023-09-28 16:21:06 -07:00
Elliot Kang e755a63250 fixed example based on new interface 2023-09-28 16:11:30 -07:00
Elliot Kang 29c6b62ba1 Updated LLM interface
- auto-sets return types based on streaming flag
2023-09-28 16:11:13 -07:00
noble-varghese 9d69903c36 fix: fixing the baseURL param 2023-09-28 18:44:55 +05:30
noble-varghese 51475a9290 docs: Added more examples 2023-09-28 17:45:10 +05:30
noble-varghese a9e794bde9 feat: Portkey integration with LLamaIndexTs 2023-09-28 17:27:39 +05:30
Elliot Kang 5114a7aa27 type fix + stream_chat for ChatEngines
- fixed chatModel type for ContextChatEngine
- added stream_chat for severl ChatEngines
2023-09-26 17:10:28 -07:00
Elliot Kang d14042e536 added optional streaming for QueryEngine 2023-09-26 17:09:02 -07:00
Elliot Kang 7819fca349 make stream_chat optional, +streaming to basicChatEngine 2023-09-26 16:43:53 -07:00
Yi Ding 68d9cfb550 0.0.29 2023-09-26 15:34:36 -07:00
Yi Ding 1b7fd95214 changeset and fixed test case bug 2023-09-26 15:30:38 -07:00
yisding 0a1e6ccf9a Merge pull request #129 from kkang2097/streaming-support
Fixed Streaming Support for OpenAI LLM [Needs Review]
2023-09-26 15:25:33 -07:00
Yi Ding 0db3f415a8 changeset 2023-09-26 13:41:40 -07:00
Yi Ding 8a1385b9d0 migrated to tiktoken lite
Hopefully fixes the Windows issue
2023-09-26 13:40:37 -07:00
Yi Ding a52143b0ef changeset and package update 2023-09-26 12:42:13 -07:00
yisding 75ec41c85a Merge pull request #128 from jayantasamaddar/jayanta/docx-reader
Added DocxReader, adding support for reading .docx files.
2023-09-26 12:38:44 -07:00
Elliot Kang 827c8b3c48 remove spaghetti 2023-09-25 01:21:23 -07:00
Elliot Kang 194b35d889 move event creation out of loop 2023-09-24 22:24:26 -07:00
Elliot Kang 1b33523537 made events optional in stream_chat 2023-09-24 22:16:20 -07:00
Elliot Kang 807b95597a pnpm run format (prettier) 2023-09-24 21:02:49 -07:00
Elliot Kang 14b1ffa413 OpenAI LLM streaming + callbacks demo
- this makes it easy for people to add logging/token tracking
- "for await" logic becomes even more elegant
2023-09-24 21:00:11 -07:00
Elliot Kang d1db4d5534 Final fixes, sanity checks on types
- expanded LLM interface
- cleaned up OpenAI LLM stream
- simplified types in CallbackManager
-> CallbackResponse should require Token I think, we already have the StreamToken inside of the LLM's stream_chat anyways
2023-09-24 20:57:30 -07:00
Elliot Kang a45c0e537f Update LLM interface
standardizing streaming behavior for LLMs
2023-09-23 22:07:49 -07:00
Elliot Kang 4dab9b8fa3 Update LLM.ts 2023-09-23 21:56:32 -07:00
Elliot Kang a84f8ba5d6 Remove in re-factor 2023-09-23 21:56:24 -07:00
Elliot Kang f6f5cab661 Update llm_stream.ts 2023-09-23 21:56:06 -07:00
Elliot Kang 618f563ce9 LLM Stream example, need to flesh out more 2023-09-23 21:51:06 -07:00
Elliot Kang 5b49c90538 Fixed streaming for OpenAI
- stream support was actually broken
2023-09-23 21:49:26 -07:00
Elliot Kang 41be0003f1 Not every StreamResponse fits into StreamToken
- adds flexibility to our CallbackResponse interface
2023-09-23 21:47:58 -07:00
Jayanta Samaddar 8f8ee28ba0 Added DocxReader, adding support for reading .docx files. Made changes to relevant docs as well. 2023-09-23 06:23:17 +05:30
Yi Ding b3ae7fbb49 0.0.28 2023-09-14 10:47:13 -07:00
Yi Ding 837854de1e rolled back notion package and changeset 2023-09-14 10:41:00 -07:00
yisding 8cc1f0726f Merge pull request #112 from kkang2097/fix-output-parser
Create OutputParser.test.ts [Needs Merge]
2023-09-14 09:32:35 -07:00
yisding e1d617ef70 Merge pull request #122 from kevinlu1248/patch-1
Update sweep.yaml with newest sandbox format
2023-09-13 20:49:22 -07:00
Kevin Lu 5f199d68f9 Update sweep.yaml 2023-09-13 18:49:11 -07:00
Elliot Kang b8cca2db97 make parseJsonMarkdown exportable 2023-09-13 15:30:55 -07:00
Elliot Kang 35e959219d prettify OutputParser 2023-09-12 17:14:39 -07:00
Elliot Kang 08d466faee Ported Python _marshall_llm_to_json
From the Python side:
- output_parsers/utils

We'll still call this parseJsonMarkdown on the TS side
2023-09-12 17:13:02 -07:00
Yi Ding 0b5823f451 updated packages 2023-09-11 21:53:15 -07:00
Elliot Kang c77b150c28 hardcoding single JSON object case 2023-09-11 15:24:07 -07:00
Elliot Kang 3cf27bb838 Okay, should be final version. 2023-09-11 14:55:50 -07:00
Elliot Kang 26a90435c7 Revert "Simplified OutputParser"
This reverts commit ff0e831da9.
2023-09-11 14:55:07 -07:00
Elliot Kang f6efaba906 Update OutputParser.test.ts
- test cases are much simpler now.
2023-09-11 14:46:21 -07:00
Elliot Kang ff0e831da9 Simplified OutputParser 2023-09-11 14:46:01 -07:00
Yi Ding 96bb65723a changesets 2023-09-11 11:14:17 -07:00
Yi Ding 33ac4bc424 changelog typo 2023-09-11 10:45:27 -07:00
yisding 698503b467 Merge pull request #108 from run-llama/sweep/fix-broken-link-summary-index
Fix broken link to Summary Index in end_to_end.md: Typo correction
2023-09-11 10:33:52 -07:00
yisding 0657525d40 Merge pull request #99 from kkang2097/main
Add MongoReader [Needs merge]
2023-09-11 10:33:01 -07:00
Yi Ding 064d0de531 fix lint 2023-09-11 10:31:37 -07:00
Elliot Kang 471bf36a7b Delete MongoReader.ts 2023-09-11 10:19:40 -07:00
Elliot Kang cb7d2b4040 Revert "commit cleanup"
This reverts commit 3dd334c6db5b211080e7a0b269e58e160914acc2.
2023-09-11 10:19:38 -07:00
Elliot Kang 6032cbcf45 Fixed typing to be more restrictive
- Should have done this in the beginning, {Key:Value} objects should always be defined by Record<string, any>
2023-09-11 10:18:13 -07:00
Elliot Kang 73785d7552 Run Prettier, minor fixes
-changed .limit(Infinity) to .limit(0) in readers/SimpleMongoReader.ts
2023-09-11 10:18:13 -07:00
Elliot Kang 431b5ffa59 rename to simpleMongoReader 2023-09-11 10:18:13 -07:00
Elliot Kang c0500a0d4d SimpleMongoReader demo 2023-09-11 10:18:13 -07:00
Yi Ding 5300534188 commit cleanup 2023-09-11 10:17:49 -07:00
Elliot Kang 02192a5f53 Create MongoReader.ts 2023-09-11 10:15:55 -07:00
Elliot Kang 2a98d5b8ee Add MongoReader 2023-09-11 10:15:55 -07:00
yisding 4f495b5fc6 Merge pull request #110 from TomPenguin/extend-document-type
Enhancing Type Safety for metadata
2023-09-11 10:12:39 -07:00
Elliot Kang b75e2d23a2 re-ordering logic for parser
- previous iteration ran the computation twice if we had an unexpected output format
- added comment for future use
2023-09-11 01:16:31 -07:00
Elliot Kang 5261cdc794 Update OutputParser.test.ts
removing comment
2023-09-10 21:52:57 -07:00
Elliot Kang b179f61c6f Update OutputParser.ts
Essentially, we're giving OutputParser an option to parse List[JSON object] in case our LLM doesn't give us the exact output we want.
2023-09-10 21:39:41 -07:00
Elliot Kang 71b245ad6f Update OutputParser.test.ts
added new test cases, our LLM is not guaranteed to give us the exact formatted output.
2023-09-10 21:36:16 -07:00
Elliot Kang 5b070cf87a Add new test, this one fails
- fix this after adding all tests
2023-09-10 20:19:38 -07:00
Elliot Kang b8afe0b364 Update OutputParser.test.ts
- initial version of test script
2023-09-10 19:57:07 -07:00
Elliot Kang 92b4ec48f7 Create OutputParser.test.ts
- SubQuestionOutputParser is not working as expected, writing some tests to check it out.

QuestionGenerator outputs a list of objects in string format, which is unexpected.

In particular:
"[{prompt: "smth", response: "nothing"}]"
2023-09-10 05:00:09 -07:00
TomPenguin 6a69ac997d Type-safe Metadata 2023-09-09 12:02:33 +09:00
Yi Ding 8c542c30a9 0.0.27 2023-09-08 08:49:27 -07:00
Yi Ding 5c59f93138 copy over example 2023-09-08 08:46:31 -07:00
Yi Ding 4a5591be75 changeset 2023-09-08 08:45:58 -07:00
yisding e756764398 Merge pull request #100 from marcusschiesser/feat/summarize-chat-history
feat: added draft for a summarizer of the chat history
2023-09-08 08:43:39 -07:00
yisding 568b9c3a4c Merge pull request #98 from TomPenguin/add-support-notion-db
Add Notion database support to NotionReader
2023-09-08 06:50:38 -07:00
yisding 13a4aa5212 Merge pull request #92 from swk777/larry/keyword
support keyword index
2023-09-08 06:50:02 -07:00
sweep-ai[bot] a8388c841f Updated apps/docs/docs/end_to_end.md 2023-09-06 21:22:28 +00:00
Marcus Schiesser 87f1f59855 feat: added draft for a summarizer of the chat history 2023-09-05 14:00:47 +07:00
TomPenguin c8c67d2a3d add doc comments 2023-09-04 10:37:50 +09:00
TomPenguin a042fa0b9a add options 2023-09-04 10:14:50 +09:00
TomPenguin b68d870599 support notion db by using notion-md-crawler 2023-09-04 09:03:42 +09:00
Yi Ding 2c63f10dca 0.0.26 2023-09-02 12:17:31 -07:00
yisding 7b8e2d0dc7 Merge pull request #94 from TomPenguin/add-notion-reader
Add NotionReader
2023-09-02 12:16:16 -07:00
Yi Ding 5bb55bcc7d changeset and bug fix 2023-09-02 12:14:30 -07:00
Yi Ding 08c49b0d5f more demo work 2023-09-02 12:11:52 -07:00
Yi Ding 5b07c8adc6 beefed up notion example 2023-09-02 11:52:20 -07:00
TomPenguin ca7e61c701 Mod import bug 2023-09-01 16:21:39 +09:00
TomPenguin 6795df10bd Update md-utils-ts 2023-09-01 16:21:12 +09:00
swk777 1e98a35953 replace rake-pos 2023-09-01 15:08:19 +08:00
Yi Ding 2ab3fedf8f adding test script 2023-08-31 22:50:27 -07:00
TomPenguin 915fc33dd7 Add NotionReader 2023-08-31 17:06:49 -07:00
Yi Ding c79a5359b1 minor changes 2023-08-31 16:45:48 -07:00
swk777 632f176cdd fix error 2023-08-31 16:24:13 -07:00
swk777 99e7857ac8 remove comment 2023-08-31 16:24:13 -07:00
swk777 9ff3837e49 add test case 2023-08-31 16:24:13 -07:00
swk777 6c91d0da5a add example 2023-08-31 16:24:13 -07:00
swk777 12dd3c5eea add keyword index and retriever 2023-08-31 16:24:11 -07:00
Yi Ding 04da822826 0.0.25 2023-08-30 13:09:54 -07:00
Yi Ding 40a8f0775e updated exports for storage/index.ts 2023-08-30 12:06:58 -07:00
yisding 65aaebe2b5 Merge pull request #93 from andfk/patch-1
Update README.md for apps example
2023-08-30 06:20:40 -07:00
Andrés F 769559279f Update README.md
The commands should be inverted
2023-08-30 18:13:00 +08:00
Yi Ding bb7fd38c46 removing the newline to space embedding conversion
https://github.com/openai/openai-python/issues/418
2023-08-29 22:35:41 -07:00
Yi Ding a734927a42 upgrade prettier and prettiered 2023-08-29 20:30:02 -07:00
Yi Ding e21eca2a16 updated packages and README 2023-08-29 20:24:29 -07:00
Yi Ding 33c8c2fe47 documentation update for SummaryIndex 2023-08-29 14:06:12 -07:00
Yi Ding c3048858e9 0.0.24 2023-08-29 12:34:21 -07:00
Yi Ding 259fe63ceb strong types for prompts 2023-08-29 12:33:46 -07:00
Yi Ding d1aa3b7982 more changes for the summary index 2023-08-29 09:41:23 -07:00
Yi Ding e4af7b3a53 renamed listindex to summaryindex
Better aligns with what the index is used for
2023-08-29 09:32:04 -07:00
Yi Ding 51bd392fed 0.0.23 2023-08-25 12:28:06 -07:00
yisding 9bc4a2c564 Merge pull request #91 from TomPenguin/customizable-metadatamode
Added property to set MetadataMode to ResponseSynthesizer
2023-08-25 12:10:05 -07:00
yisding 550d28388a Merge branch 'main' into customizable-metadatamode 2023-08-25 09:49:44 -07:00
TomPenguin e073b4f81b fix 2023-08-25 15:29:36 +09:00
yisding fc0fdb5e37 Merge pull request #82 from swk777/larry/md
add markdown reader
2023-08-24 16:47:06 -07:00
Yi Ding 9d6b2ed937 changeset 2023-08-24 16:45:21 -07:00
Yi Ding 86468b9552 minor comment change 2023-08-24 16:31:58 -07:00
swk777 8c1b76f3c3 add example to simple 2023-08-24 16:22:53 -07:00
swk777 6fc6a499ec add markdown reader 2023-08-24 16:22:27 -07:00
Yi Ding 293b83c3df 0.0.22 2023-08-23 23:19:41 -07:00
Yi Ding 99df58f6d2 openai and anthropic upgrade 2023-08-23 23:19:10 -07:00
Yi Ding 454f3f84b2 changesets 2023-08-23 23:10:58 -07:00
Yi Ding 2d558c3963 stop splitting sentences by default 2023-08-23 23:06:25 -07:00
Yi Ding 055b49936a cjk support for text splitter (thanks @TomPenguin) 2023-08-23 23:06:25 -07:00
Yi Ding 48289c3c5a 0.0.21 2023-08-22 23:42:21 -07:00
Yi Ding 0a09de2ed7 OpenAI 4.1.0 2023-08-22 23:41:22 -07:00
Yi Ding f7a57ca3e2 fixed metadata deserialization
add changesets
2023-08-22 23:34:13 -07:00
Yi Ding cfa93a78a3 add chatgpt optimized prompts 2023-08-22 23:28:49 -07:00
Yi Ding e4e616ee56 add line number link 2023-08-22 22:44:00 -07:00
yisding 5cf2d243f0 Merge pull request #88 from run-llama/docs-work
Docs work
2023-08-22 22:30:41 -07:00
Yi Ding 0a35c4f1c7 removing the import of the README into API docs 2023-08-22 22:28:29 -07:00
Yi Ding 4b94ff7492 remove api docs from repo
It gets regenerated on build so removing them prevents thrashing
2023-08-22 21:58:31 -07:00
Yi Ding aacc0b47c0 0.20.0 2023-08-19 18:24:48 -07:00
Yi Ding b526a2d9cf openai updates (should allow proxy servers) 2023-08-19 18:22:37 -07:00
Yi Ding af32450eca 0.0.19 2023-08-16 18:15:25 -07:00
yisding 8664f73855 Merge pull request #80 from swk777/larry/reader
feat: add CSV loader
2023-08-16 18:03:55 -07:00
Yi Ding 8bfa53fe66 docs change 2023-08-16 18:01:44 -07:00
Yi Ding 16ad029335 updated example 2023-08-16 17:59:57 -07:00
Yi Ding 82bd6228b8 update docs 2023-08-16 17:10:27 -07:00
Yi Ding a747f28999 changeset 2023-08-16 17:08:11 -07:00
swk777 142310bd63 modify demo 2023-08-16 17:06:08 -07:00
swk777 67c8b6536a add papa config 2023-08-16 17:06:08 -07:00
swk777 efc0e2e0ae add csv loader 2023-08-16 17:06:06 -07:00
yisding 0aa0129be9 Merge pull request #81 from run-llama/remove-node-with-embedding
remove NodeWithEmbedding and upgrade to OpenAI v4
2023-08-16 17:01:54 -07:00
Yi Ding 355910bade changeset 2023-08-16 16:57:05 -07:00
Yi Ding 74ab63232b update docs 2023-08-16 16:57:05 -07:00
Yi Ding 90418fa4ec upgrade packages 2023-08-16 16:57:05 -07:00
Yi Ding 8983e9b0f0 remove package-lock.json from examples
So they always run on the latest lits release
2023-08-16 16:57:05 -07:00
Yi Ding cc4bac899e remove node with embedding 2023-08-16 16:57:05 -07:00
Yi Ding 82f30f5637 0.0.18 2023-08-15 09:23:44 -07:00
Yi Ding ade9d8fb8e changeset 2023-08-15 09:16:37 -07:00
yisding 402152f96b Merge pull request #70 from swk777/larry/session
Fix OpenAIEmbedding Fails to Retrieve Session from Parameters When No…
2023-08-15 09:13:34 -07:00
yisding a43d76d4a7 Merge pull request #79 from run-llama/vectorstore-doccompare
allow adding of nodes with hash comparisons
2023-08-15 09:04:01 -07:00
Yi Ding 824c13cb85 changesets 2023-08-15 08:51:26 -07:00
Yi Ding 0904d3dc5d allow adding of nodes with hash comparisons
Allows our scripts to be run repeatedly with vector store backing and
persistence without throwing an error.

This is rudimentary support which doesn't work if the document has
changed over time.

Also added the insert and delete functions so that documents can be
added manually.
2023-08-15 08:49:06 -07:00
swk777 978ef781e4 Fix OpenAIEmbedding Fails to Retrieve Session from Parameters When Not Using Azure 2023-08-14 15:13:29 +08:00
Yi Ding 18b8915f22 changeset 2023-08-09 15:20:09 -07:00
Yi Ding 9bbfc2414e example npm update 2023-08-09 14:50:38 -07:00
yisding 9487aa1ed5 Merge pull request #65 from TomPenguin/export-store
Export storage
2023-08-09 06:30:27 -07:00
TomPenguin fd74c52fe8 export storage 2023-08-09 18:13:27 +09:00
Yi Ding 0d2bf51a2e 0.0.17 2023-08-08 18:13:08 -07:00
yisding 551c0edadf Merge pull request #64 from run-llama/llama2-fixes
Llama2 4bit support
2023-08-08 18:10:26 -07:00
Yi Ding f80b06293b changed default temp to 0.1 2023-08-08 17:28:56 -07:00
Yi Ding b3fec86413 Llama2 fixes with 4 bit model support 2023-08-08 17:22:42 -07:00
Yi Ding ab886a34d7 add other @tyre PR to the CHANGELOG 2023-08-07 06:46:11 -07:00
Yi Ding 1ec9da120e 0.0.16 2023-08-07 06:30:23 -07:00
yisding 817178272d Merge pull request #59 from run-llama/azure
add azure OpenAI
2023-08-07 06:28:40 -07:00
Yi Ding 3316c6b41c add azure OpenAI
Update OpenAI v4 to latest beta and fixed a few bugs
2023-08-07 06:23:47 -07:00
Yi Ding 9214b0669d fix persistence bug 2023-08-04 23:33:16 -07:00
yisding b3d659b9af Merge pull request #58 from tyre/index-constructor
add constructor to index node so it keeps passed-in indexId
2023-08-02 14:37:25 -07:00
Chris Maddox 05b0fca610 add constructor to index node so it keeps passed-in indexId 2023-08-02 22:33:20 +02:00
yisding 64b909f436 Merge pull request #57 from tyre/typed-filters
add a filter type to exact match filters
2023-08-01 16:09:11 -07:00
Chris Maddox a2e6299aaa add a filter type to exact match filters 2023-08-02 01:04:28 +02:00
yisding 1fbfcab55e Merge pull request #55 from run-llama/repo-maintenance
Repo maintenance
2023-08-01 08:15:39 -07:00
Yi Ding 7db567ea74 remove unnecessary package-lock.json from docs
Also ran some upgrades on npm/pnpm
pnpm install should install the right packages without the
package-lock.json in the docs folder
2023-08-01 08:11:12 -07:00
Yi Ding 6354c16776 add the docs/api folder back in 2023-08-01 08:01:59 -07:00
Yi Ding eb4c3dd3c7 Revert "try replacing CONTRIBUTING and README with symlinks"
This reverts commit 8a4330132c.

Symlinks didn't quite work
2023-07-31 22:54:31 -07:00
Yi Ding 8a4330132c try replacing CONTRIBUTING and README with symlinks
Avoid duplication
2023-07-31 22:49:48 -07:00
Yi Ding f2d4f828d4 repo maintenance
upgrade packages
update docs
update README and CONTRIBUTING
2023-07-31 22:47:13 -07:00
Yi Ding fe8030a9ad updated docs and removed trim vuln
dependabot was complaining about the trim version in the docusaurus so
pinned it to a non-vuln version
2023-07-31 10:50:43 -07:00
Yi Ding ec12633ae0 changeset for #54 2023-07-31 10:30:16 -07:00
yisding 5e24733e41 Merge pull request #54 from tyre/async-vector-stores
make VectorStore function signatures unique, export VectorStore types
2023-07-31 10:23:12 -07:00
Chris Maddox a13911435f make VectorStore function signatures unique, export VectorStore types to allow for extensions 2023-07-31 19:15:50 +02:00
Yi Ding 857bb4596a 0.0.15 2023-07-31 00:29:57 -07:00
yisding 1359de75b5 Merge pull request #52 from run-llama/anthropic
Anthropic support
2023-07-31 00:28:51 -07:00
Yi Ding f9d1a6e013 add top P 2023-07-31 00:27:09 -07:00
Yi Ding b18e1228a8 have examples use snapshot build 2023-07-29 19:37:59 -07:00
Yi Ding b501eb5a19 anthropic support 2023-07-29 19:35:14 -07:00
Yi Ding bfab1d407b 0.0.14 2023-07-27 21:02:20 -07:00
Yi Ding 4ef334a70f changesets 2023-07-27 21:01:13 -07:00
yisding af60503115 Merge pull request #45 from run-llama/sweep/add-docstrings
Add missing docstrings to NodeParser.ts and handleOpenAIStream.ts
2023-07-27 20:59:07 -07:00
Yi Ding b3a7a9df2c slight update 2023-07-27 20:57:52 -07:00
Yi Ding 6b90e4c1b3 updated docs 2023-07-27 20:56:59 -07:00
sweep-ai[bot] 108634b94f Merge main into sweep/add-docstrings 2023-07-28 03:53:24 +00:00
yisding 4bb92be1e4 Merge pull request #47 from run-llama/better-deuce
add meta delimitation strategy for llama2
2023-07-27 20:53:21 -07:00
sweep-ai[bot] 7678d319f2 Merge main into sweep/add-docstrings 2023-07-28 03:45:48 +00:00
yisding aaff02bc4b Merge pull request #48 from ysak-y/modify_bug_of_vector_store_index
[BUG FIX] Use retriever from argument if exist in asQueryEngine of VectorStoreIndex
2023-07-27 20:45:45 -07:00
yoshiaki-yamada 34f5398f41 refactor: Integrate some module imports from BaseIndex 2023-07-28 11:43:17 +09:00
yoshiaki-yamada c06d1e5b09 fix: Use retriever from argument if exist in asQueryEngine 2023-07-28 11:42:01 +09:00
Yi Ding 0af7773c40 add meta delimitation strategy for llama2 2023-07-27 18:00:09 -07:00
sweep-ai[bot] a44ee19114 Merge main into sweep/add-docstrings 2023-07-27 23:46:24 +00:00
Yi Ding 2726e375ea remove storage from gitignore 2023-07-27 16:46:07 -07:00
sweep-ai[bot] b599813600 Merge main into sweep/add-docstrings 2023-07-27 15:25:52 +00:00
Yi Ding bea4af984f fix sentence splitter overlap logic 2023-07-27 08:24:38 -07:00
sweep-ai[bot] 5dbbb7d4c1 Update packages/core/src/NodeParser.ts 2023-07-27 08:23:43 +00:00
sweep-ai[bot] c8ea424c7a Update packages/core/src/callbacks/utility/handleOpenAIStream.ts 2023-07-27 07:52:49 +00:00
sweep-ai[bot] 8de110e577 Update packages/core/src/NodeParser.ts 2023-07-27 07:52:11 +00:00
yisding 7e82b89f36 Merge pull request #42 from run-llama/sweep/add-gha-workflow_1
[DRAFT] Add GitHub Actions workflow to run tests
2023-07-27 00:50:13 -07:00
sweep-ai[bot] 669483699f Merge main into sweep/add-gha-workflow_1 2023-07-27 07:42:26 +00:00
yisding 672dde6e58 Merge pull request #34 from run-llama/stop-thrashing-docs
set typedoc revision to main
2023-07-27 00:42:21 -07:00
sweep-ai[bot] 31a1a4b4d0 Merge main into sweep/add-gha-workflow_1 2023-07-27 07:39:27 +00:00
yisding f12a8d8006 Merge pull request #36 from run-llama/sweep/add-sweep-config
Configure Sweep
2023-07-27 00:39:23 -07:00
sweep-ai[bot] 03ea3af58c Merge main into sweep/add-gha-workflow_1 2023-07-27 07:38:44 +00:00
sweep-ai[bot] cc2585360b Merge main into sweep/add-sweep-config 2023-07-27 07:38:44 +00:00
yisding ff59660585 Merge pull request #40 from run-llama/sweep/add-gha-workflow
Add GitHub Actions workflow for linting on push/pull
2023-07-27 00:38:39 -07:00
sweep-ai[bot] 6063ce22fd sweep: Create .github/workflows/test.yml 2023-07-27 00:36:26 +00:00
sweep-ai[bot] bc7cf343cc Update .github/workflows/lint_on_push_or_pull.yml 2023-07-27 00:32:16 +00:00
sweep-ai[bot] 938eaf5d2d sweep: Create .github/workflows/lint_on_push_or_pull.yml 2023-07-27 00:30:59 +00:00
sweep-ai[bot] a0bf44addb Create refactor template 2023-07-26 23:25:54 +00:00
sweep-ai[bot] 8d7e1624c7 Create feature template 2023-07-26 23:25:54 +00:00
sweep-ai[bot] d1c9f30dfc Create bugfix template 2023-07-26 23:25:53 +00:00
sweep-ai[bot] e57eb0caa3 Create sweep.yaml config file 2023-07-26 23:25:53 +00:00
Yi Ding 7699f5432d set typedoc revision to main
In theory this will stop the API docs thrashing on every build.

Of course, there is a drawback in that if main changes but we haven't
released a new version of the docs yet the links will go out of date.

So longer term we might want to investigate some kind of variable where
we can continue to have up to date revs but keep the rev in a single
variable somewhere:

https://github.com/facebook/docusaurus/issues/395

In the meantime much smaller commits will be a relief
2023-07-25 23:06:44 -07:00
Yi Ding fe3b1f4f50 0.0.13 2023-07-25 22:57:08 -07:00
yisding 35f3030db6 Merge pull request #33 from run-llama/openaiv4
openai v4
2023-07-25 22:55:32 -07:00
Yi Ding c0f31bbef2 build docs 2023-07-25 22:53:16 -07:00
Yi Ding 0f654ae04b get response message role from OpenAI 2023-07-25 22:52:10 -07:00
Yi Ding be2dc5df28 upgraded packages in docs
docusaurus is causing a dependabot issue with trim 0.0.1. It's probably
not a real vuln but it's a bit annoying.

Unfortunately this didn't solve it.
2023-07-25 22:35:16 -07:00
Yi Ding d6aeedd0e3 fixed broken link in api docs
Also deleting LLM Predictor
2023-07-25 22:23:12 -07:00
Yi Ding dc91f5fdf7 correctly handle retries and timeout settings 2023-07-25 22:19:00 -07:00
Yi Ding 4f6f245006 changeset, packages, and cleanup 2023-07-25 21:25:41 -07:00
Yi Ding ac69adba7a openai v4 2023-07-25 21:04:54 -07:00
Yi Ding b0bb4108a8 bug fix: merge the indexStructs 2023-07-25 18:00:11 -07:00
yisding 6ff932a055 Merge pull request #29 from run-llama/jerry/add_link_fix
add link to starter guide to installation
2023-07-24 18:56:28 -07:00
Jerry Liu c850e7578b cr 2023-07-24 18:53:13 -07:00
yisding 577534813d Merge pull request #28 from run-llama/small-fixes
Small fixes
2023-07-24 18:18:31 -07:00
Yi Ding 7d2fe9c69f 0.0.12 2023-07-24 18:09:36 -07:00
Yi Ding 68bdaaa657 updated dependencies 2023-07-24 18:07:49 -07:00
Yi Ding 7db9bc0c63 updated npm lock in example/ 2023-07-24 18:05:58 -07:00
Yi Ding cd8d22b33f typo in README 2023-07-24 18:04:26 -07:00
Yi Ding 802860050f Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-07-24 14:50:01 -07:00
Yi Ding 3fda1deece 0.0.11 2023-07-24 14:48:15 -07:00
Yi Ding fb7fb760a0 add back PDF loader 2023-07-24 14:47:49 -07:00
Logan a4d6d7bc7d Merge pull request #27 from run-llama/immediate-docs 2023-07-24 13:29:54 -06:00
Yi Ding f7cc69b5ec have docs show up on the domain root 2023-07-24 10:55:57 -07:00
yisding 74b34a3730 Merge pull request #26 from run-llama/playground-docs
playground docs
2023-07-24 10:28:27 -07:00
Yi Ding fc2a1b527e playground docs 2023-07-24 09:40:25 -07:00
Logan 3e85a90b92 Merge pull request #25 from run-llama/logan/agolia_search 2023-07-24 09:41:49 -06:00
Logan Markewich 74ab98ddec add agolia search 2023-07-24 09:38:38 -06:00
Logan bff788b484 Merge pull request #24 from run-llama/logan/patch_storage_docs
fix storage example
2023-07-24 08:12:07 -06:00
Logan Markewich 3e1abd2c6c fix storage example 2023-07-24 08:11:27 -06:00
Yi Ding 79c76ea9d7 0.0.10 2023-07-24 06:03:35 -07:00
Yi Ding 6f2cb31d41 fixed tokenizer decoder 2023-07-24 06:02:16 -07:00
Yi Ding cc88141772 version 0.0.9 2023-07-24 05:29:42 -07:00
Yi Ding 02d9bb0518 the ESM export is causing issues with edge functions
Looks like there's another issue with axios. Will turn ESM bundles back
on once we fix it and the PDF issue
2023-07-24 05:22:14 -07:00
Yi Ding 5321fb3135 0.0.8 2023-07-24 05:19:46 -07:00
Yi Ding ea5038e4b7 disable PDF reader for now
Looks like it causes an issue with the esm package
2023-07-24 05:10:39 -07:00
Yi Ding b012207764 version 0.0.7
Also updated examples package.json to latest
2023-07-24 04:10:02 -07:00
Yi Ding 9fa6d4a8a7 make second arg in fromDocuments optional 2023-07-24 04:06:46 -07:00
yisding c77dd18f2d Merge pull request #22 from run-llama/logan/fix_persistance
fix persistance, align fromDocuments
2023-07-23 21:01:22 -07:00
Yi Ding bb7c0d7deb v0.0.6 2023-07-23 21:00:49 -07:00
Yi Ding 80d3fc9482 copy examples back to app/simple and tested them 2023-07-23 20:58:27 -07:00
Logan Markewich 79a721226d use proper camelCase for indexId 2023-07-23 21:22:10 -06:00
Logan Markewich ed36d41024 better type checking 2023-07-23 21:20:48 -06:00
Logan Markewich 9a15c8ece0 update storage example 2023-07-23 20:14:35 -06:00
Logan Markewich 9c5220ce75 fix tests 2023-07-23 19:28:14 -06:00
Logan Markewich 8c67635041 fix persistance, update fromDocuments 2023-07-23 19:26:17 -06:00
yisding fc7f35141a Merge pull request #21 from run-llama/logan/storage_demo
initial storage examples attempt
2023-07-21 15:54:26 -07:00
Logan Markewich fc65e6b97d initial storage examples attempt 2023-07-21 16:04:43 -06:00
Yi Ding 629bd3239a logan's fix 2023-07-21 11:48:49 -07:00
Yi Ding 31c99baf1c Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-07-21 11:47:56 -07:00
Yi Ding b2810777ef copied simple examples outside of the apps folder
Makes it easier to get started although now they have to use npm instead
of pnpm
2023-07-21 11:47:00 -07:00
Logan 805d6fb81d Merge pull request #20 from run-llama/logan/patch_llama2
patch import for llamaduece
2023-07-21 12:06:54 -06:00
Logan Markewich 9c566b0530 patch import 2023-07-21 12:06:22 -06:00
Yi Ding daa14b8a5f Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-07-21 11:03:29 -07:00
Yi Ding ed4fe4ac22 add pnpm install to the examples README 2023-07-21 11:02:48 -07:00
Simon Suo b76562061e Merge pull request #19 from run-llama/suo/update_docs_title_and_desc
Update docs title and meta description
2023-07-21 10:58:00 -07:00
Simon Suo baa91540cf wip 2023-07-21 10:57:08 -07:00
Simon Suo a594e22d2d Merge pull request #18 from run-llama/suo/update_github_link
Update Github link on docs
2023-07-21 10:50:28 -07:00
Simon Suo 91615a6602 update 2023-07-21 10:49:30 -07:00
Simon Suo 43144ae782 wip 2023-07-21 10:47:49 -07:00
Logan e927fc1800 Merge pull request #17 from run-llama/logan/starter_patch
replace -- chars
2023-07-21 11:31:14 -06:00
Logan Markewich a08e904834 replace -- chars 2023-07-21 11:30:30 -06:00
Logan 90429ab63d Merge pull request #16 from run-llama/logan/add_links_to_docs
patch various links
2023-07-21 11:24:55 -06:00
Logan Markewich abaab0caca patch links 2023-07-21 11:23:45 -06:00
Simon Suo bc5c2e5c7b Merge pull request #15 from run-llama/Disiok-patch-2
Update README.md
2023-07-21 10:17:09 -07:00
Simon Suo c3e4b37414 Update README.md 2023-07-21 10:16:59 -07:00
Simon Suo 63906798e8 Merge pull request #14 from run-llama/Disiok-patch-1
Update README.md
2023-07-21 10:12:17 -07:00
Simon Suo d7c2453c7d Update README.md 2023-07-21 10:11:40 -07:00
Yi Ding 6a61ea46bf publish 0.0.5 2023-07-21 09:33:00 -07:00
Yi Ding 5a765aa1d6 updated README 2023-07-21 09:32:23 -07:00
Yi Ding 3cab956f94 publish 0.0.4 2023-07-21 09:16:27 -07:00
Yi Ding c65d671ddb changeset 2023-07-21 09:15:39 -07:00
Yi Ding 985f3b52bb add README and CONTRIBUTING to dir and remove .turbo 2023-07-21 09:14:38 -07:00
Yi Ding 4636a763b0 removed gitignore from packages/core 2023-07-21 09:11:32 -07:00
Yi Ding f4ddf89b51 published 0.0.3 2023-07-21 09:08:30 -07:00
Yi Ding ca9410f702 try changeset 2023-07-21 09:07:38 -07:00
Yi Ding 50c0b04017 v0.0.2 2023-07-21 08:16:12 -07:00
Yi Ding 41464386d6 getting ready to publish 2023-07-21 08:13:09 -07:00
Yi Ding a07a94108d more persistence 2023-07-21 07:49:00 -07:00
Yi Ding a7cc8020db persistence and packaging 2023-07-21 07:32:36 -07:00
Yi Ding 761fa4d836 switch back to cjs default 2023-07-20 22:29:43 -07:00
Yi Ding ade5587a15 build stuff 2023-07-20 22:15:51 -07:00
Yi Ding 2db8a8c2e3 updated packages 2023-07-20 21:22:37 -07:00
Yi Ding 3ad826e358 doc build works thanks Logan! 2023-07-20 21:07:38 -07:00
Logan Markewich 87925a36e6 fix searchbar dependencies 2023-07-20 21:48:43 -06:00
Yi Ding fc6ff47fd2 replace all instances of yarn in docusaurus with pnpm 2023-07-20 20:37:49 -07:00
Yi Ding 17b22f4673 a few updates for the README 2023-07-20 19:48:55 -07:00
Yi Ding b033d0fbe9 Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-07-20 18:19:34 -07:00
Yi Ding 122ab88fa5 missed a chatRepl 2023-07-20 18:17:35 -07:00
Logan Markewich 73c188761f fix some docs usage 2023-07-20 19:08:59 -06:00
Logan Markewich 0fbf7b4ace update examples and docs 2023-07-20 19:08:59 -06:00
Yi Ding f9394ebb22 missing package in pnpm-lock 2023-07-20 17:29:24 -07:00
Yi Ding 05f2f388d9 Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-07-20 17:28:54 -07:00
Yi Ding d489a2120f allow asQueryEngine and asRetriever to take options 2023-07-20 17:15:11 -07:00
Logan Markewich 8954a80e04 add search bar 2023-07-20 17:06:39 -06:00
Logan Markewich f264211550 link to llama2 demo 2023-07-20 16:38:12 -06:00
Logan Markewich 4d990d012c remove some 'a' methods 2023-07-20 16:35:47 -06:00
Logan Markewich 2683121ee1 Update sidebar ordering, add storagecontext docs 2023-07-20 16:34:27 -06:00
Yi Ding 08c2d4620f removed ChatGPTLLMPredictor class 2023-07-19 21:25:51 -07:00
Yi Ding 643ad626cd deuce LLM class 2023-07-19 09:17:01 -07:00
Yi Ding 2619d4175d Fixed the context window issue.
Putting in a max tokens into the request was a mistake.
2023-07-18 23:17:44 -07:00
Yi Ding b00821dbe9 missing package in lockfile 2023-07-18 21:20:13 -07:00
Yi Ding b0a742c3e6 api docs updated with latest 2023-07-18 21:06:24 -07:00
yisding 9d0cadfc5f Merge pull request #13 from run-llama/logan/docs_finish
Finish Docs
2023-07-18 20:58:33 -07:00
Yi Ding 4ea034082b changed default response synthesizer to compact 2023-07-18 20:58:01 -07:00
Logan Markewich 2298f42c18 remove advanced concepts section 2023-07-18 20:35:37 -06:00
Logan Markewich a67bfe26ed fix link to node_parser 2023-07-18 19:58:34 -06:00
Logan Markewich d73ac8e718 Update high-level concetps 2023-07-18 19:54:06 -06:00
Logan Markewich 213a68bb0f round out low level modules 2023-07-18 19:13:05 -06:00
Logan Markewich 5bba0de1f3 reorder 2023-07-18 16:44:28 -06:00
Logan Markewich f1d609df5f docs re-generate 2023-07-18 13:57:05 -06:00
Logan Markewich f9f6dc6985 link in modules index 2023-07-18 13:13:42 -06:00
Logan Markewich 4ae690612a flesh out more 2023-07-18 13:09:07 -06:00
Logan Markewich dc74b40c7a add end-to-end examples 2023-07-18 11:48:53 -06:00
Logan Markewich b6b2598119 better org 2023-07-18 09:31:51 -06:00
Yi Ding 5cd54e2f98 few more fixes 2023-07-17 21:55:59 -07:00
Yi Ding 8b7a94f8c5 fix 2023-07-17 21:51:14 -07:00
Yi Ding 44ab4d838f no more a-prefix 2023-07-17 21:49:45 -07:00
Yi Ding 372ac1a24b move all indexes into indices folder 2023-07-17 21:32:29 -07:00
Yi Ding 09f02ff9b3 pnpm upgrade 2023-07-17 21:31:28 -07:00
yisding 9dc30f5385 Merge pull request #12 from run-llama/li_fix
ListIndex fix
2023-07-17 20:43:01 -07:00
Sourabh Desai 5871959c15 remove console log 2023-07-18 02:49:20 +00:00
Logan Markewich e108757255 add more structure 2023-07-17 20:48:48 -06:00
Logan Markewich 3cdc7e3feb re-org top level 2023-07-17 20:48:36 -06:00
Logan Markewich bc1a0fe651 undo organization 2023-07-17 20:48:27 -06:00
Logan Markewich 5752fb6921 organize modules 2023-07-17 20:48:19 -06:00
Logan Markewich f36f4b2dae Revert "organize modules"
This reverts commit 1a3940376a.
2023-07-17 20:46:37 -06:00
Logan Markewich 8ee5503505 Revert "undo organization"
This reverts commit abafa6014c.
2023-07-17 20:46:37 -06:00
Logan Markewich da7199b3e9 Revert "re-org top level"
This reverts commit 452b678450.
2023-07-17 20:46:37 -06:00
Logan Markewich 67be6f373a Revert "add more structure"
This reverts commit d5cbaa9ec7.
2023-07-17 20:46:37 -06:00
Logan Markewich d5cbaa9ec7 add more structure 2023-07-17 20:42:26 -06:00
Sourabh Desai e7206a7dea simplify test 2023-07-18 02:20:49 +00:00
Sourabh Desai 5cdab4e311 make ListIndex query engine use CompactAndRefine response builder by default 2023-07-18 02:08:22 +00:00
Sourabh Desai ee293da4f6 update test 2023-07-18 01:41:27 +00:00
Sourabh Desai 5a50ed2dfe udpate ListIndex.fromDocuments method signature 2023-07-18 01:39:20 +00:00
Logan Markewich 452b678450 re-org top level 2023-07-17 16:53:57 -06:00
Logan Markewich abafa6014c undo organization 2023-07-17 16:53:22 -06:00
Logan Markewich 1a3940376a organize modules 2023-07-17 16:30:32 -06:00
Yi Ding 775be4da64 add next as a dev dep on lint rules 2023-07-17 15:02:40 -07:00
yisding fcd70abc1f Merge pull request #11 from run-llama/docs
doc site
2023-07-17 10:43:26 -07:00
Yi Ding 737623443c add something about contributing to the docs 2023-07-17 10:38:34 -07:00
Yi Ding 07c5aeba13 built out the docs 2023-07-17 09:18:39 -07:00
Yi Ding d16113adbb Added JSDoc to our classes 2023-07-14 14:37:41 -07:00
Yi Ding 4649536f33 doc site 2023-07-12 20:53:17 -07:00
Yi Ding df4b1ad8a3 new LLM interface 2023-07-11 10:18:30 -07:00
Yi Ding 6eb44a4c13 Merge branch 'main' into llm 2023-07-10 07:34:04 -07:00
Yi Ding cdf1685f7c new llm abstraction from Simon 2023-07-10 07:24:59 -07:00
yisding 2f468ab132 Merge pull request #8 from run-llama/stream_responses
[Feature] CallbackManager with onLLMStream and onRetrieve
2023-07-10 07:19:15 -07:00
yisding 1e510093ef Merge pull request #10 from run-llama/listindex_fix
fix to get listindex script working
2023-07-10 07:12:20 -07:00
Sourabh Desai f9520d9374 small bugs 2023-07-10 08:14:32 +00:00
Sourabh Desai 2c141d2528 remove spammy console.log 2023-07-10 07:17:14 +00:00
Sourabh Desai bcca3b896c fix to get listindex script working 2023-07-10 06:58:18 +00:00
Abdul Jamjoom 0bec460937 clean-up 2023-07-09 16:46:34 -07:00
Abdul Jamjoom 5d8d344e1f updated tests 2023-07-09 16:42:58 -07:00
Abdul Jamjoom 81e22587eb add callback and event tracking 2023-07-09 16:31:04 -07:00
Yi Ding 539ec0fe3d try smaller chunks 2023-07-06 21:41:13 -07:00
Yi Ding ebf3bc19fd ContextChatEngine v1 2023-07-06 20:59:10 -07:00
Yi Ding 204b8f5316 chatengine 2023-07-06 08:53:09 -07:00
yisding 71dd461a47 Merge pull request #9 from run-llama/subquestion
SubQuestionQueryEngine
2023-07-05 19:39:11 -07:00
Abdul Jamjoom 35a6795559 polish 2023-07-04 22:34:49 -07:00
Abdul Jamjoom 968109455d Create the CallbackManager with onLLMStream and onRetrieve 2023-07-04 21:53:45 -07:00
Abdul Jamjoom 5487de8c37 Merge branch 'main' of github.com:run-llama/llamascript into stream_responses 2023-07-04 09:34:46 -07:00
Abdul Jamjoom 2a038c00ec unstable checkpoint 2023-07-04 09:27:54 -07:00
1866 changed files with 177056 additions and 5746 deletions
+8
View File
@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
+11
View File
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
+5
View File
@@ -7,4 +7,9 @@ module.exports = {
rootDir: ["apps/*/"],
},
},
rules: {
"max-params": ["error", 4],
"prefer-const": "error",
},
ignorePatterns: ["dist/", "lib/"],
};
+2
View File
@@ -0,0 +1,2 @@
examples/readers/data/** binary
examples/data/** binary
+10
View File
@@ -0,0 +1,10 @@
name: Bugfix
title: ""
description: Write something like "We notice ... behavior when ... happens instead of ..." If you would like to use sweep.dev prefix with "Sweep:"
body:
- type: textarea
id: description
attributes:
label: Details
description: More details about the bug
placeholder: The bug might be in ... file
+10
View File
@@ -0,0 +1,10 @@
name: Feature Request
title: ""
description: Write something like "Write an api endpoint that does "..." in the "..." file". If you would like to use sweep.dev prefix with "Sweep:"
body:
- type: textarea
id: description
attributes:
label: Details
description: More details
placeholder: The new endpoint should use the ... class from ... file because it contains ... logic
+10
View File
@@ -0,0 +1,10 @@
name: Refactor
title: ""
description: Write something like "Modify the ... api endpoint to use ... version and ... framework" If you would like to use sweep.dev prefix with "Sweep:"
body:
- type: textarea
id: description
attributes:
label: Details
description: More details
placeholder: We are migrating this function to ... version because ...
+68
View File
@@ -0,0 +1,68 @@
name: E2E Tests
on:
push:
branches: [main]
pull_request:
paths:
- "packages/create-llama/**"
- ".github/workflows/e2e.yml"
branches: [main]
env:
POETRY_VERSION: "1.6.1"
jobs:
e2e:
name: create-llama
timeout-minutes: 60
strategy:
fail-fast: true
matrix:
node-version: [18, 20]
python-version: ["3.11"]
os: [macos-latest, windows-latest]
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- uses: pnpm/action-setup@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
working-directory: ./packages/create-llama
- name: Build create-llama
run: pnpm run build
working-directory: ./packages/create-llama
- name: Pack
run: pnpm pack --pack-destination ./output
working-directory: ./packages/create-llama
- name: Extract Pack
run: tar -xvzf ./output/*.tgz -C ./output
working-directory: ./packages/create-llama
- name: Run Playwright tests
run: pnpm exec playwright test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
working-directory: ./packages/create-llama
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: ./packages/create-llama/playwright-report/
retention-days: 30
@@ -0,0 +1,29 @@
name: Lint on push or pull request
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run lint
run: pnpm run lint
- name: Run Prettier
run: pnpm run format
+75
View File
@@ -0,0 +1,75 @@
name: Run Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
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: Run tests
run: pnpm run test
typecheck:
runs-on: ubuntu-latest
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: Build
run: pnpm run build --filter llamaindex
- 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
typecheck-examples:
runs-on: ubuntu-latest
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: Build
run: pnpm run build --filter llamaindex
- 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: 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
+12 -1
View File
@@ -3,6 +3,7 @@
# dependencies
node_modules
.pnp
.pnpm-store
.pnp.js
# testing
@@ -35,4 +36,14 @@ yarn-error.log*
# vercel
.vercel
storage/
dist/
lib/
.cache
test-results/
playwright-report/
blob-report/
playwright/.cache/
# intellij
**/.idea
+2 -3
View File
@@ -1,4 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm format
pnpm lint
npx lint-staged
-3
View File
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm test
+1
View File
@@ -1 +1,2 @@
auto-install-peers = true
enable-pre-post-scripts = true
+1
View File
@@ -0,0 +1 @@
18
+6
View File
@@ -0,0 +1,6 @@
apps/docs/i18n
apps/docs/docs/api
pnpm-lock.yaml
lib/
dist/
.docusaurus/
+17
View File
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Example",
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "pnpm",
"cwd": "${workspaceFolder}/examples",
"runtimeArgs": ["ts-node", "${fileBasename}"]
}
]
}
+13 -1
View File
@@ -1,5 +1,17 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
+92
View File
@@ -0,0 +1,92 @@
# Contributing
## Structure
This is a monorepo built with Turborepo
Right now there are two packages of importance:
packages/core which is the main NPM library llamaindex
examples is where the demo code lives
### Turborepo docs
You can checkout how Turborepo works using the default [README-turborepo.md](/README-turborepo.md)
## Getting Started
Install NodeJS. Preferably v18 using nvm or n.
Inside the LlamaIndexTS directory:
```
npm i -g pnpm ts-node
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.
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]
```
### 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.
## Publishing
To publish a new version of the library, run
```shell
pnpm new-llamaindex
pnpm new-create-llama
pnpm release
git push # push to the main branch
git push --tags
```
+111 -37
View File
@@ -1,64 +1,138 @@
# LlamaScript: LlamaIndex for TS/JS
# LlamaIndex.TS
## Structure
[![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)
This is a monorepo built with Turborepo
LlamaIndex is a data framework for your LLM application.
Right now there are two packages of importance:
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in Typescript and Javascript.
packages/core which is the main NPM library @llamaindex/core
Documentation: https://ts.llamaindex.ai/
apps/simple is where the demo code lives
Try examples online:
### Turborepo docs
[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/run-llama/LlamaIndexTS/tree/main/examples)
You can checkout how Turborepo works using the built in [README-turborepo.md](README-turborepo.md)
## What is LlamaIndex.TS?
## Getting Started
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.
Install NodeJS. Preferably v18 using nvm or n.
## Getting started with an example:
Inside the llamascript directory:
LlamaIndex.TS requires Node v18 or higher. You can download it from https://nodejs.org or use https://nvm.sh (our preferred option).
```
npm i -g pnpm ts-node
pnpm install
In a new folder:
```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
pnpm install llamaindex
pnpm install @types/node
```
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.
Create the file example.ts
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).
```ts
// example.ts
import fs from "fs/promises";
import { Document, VectorStoreIndex } from "llamaindex";
### Running Typescript
async function main() {
// Load essay from abramov.txt in Node
const essay = await fs.readFile(
"node_modules/llamaindex/examples/abramov.txt",
"utf-8",
);
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.
// Create Document object with essay
const document = new Document({ text: essay });
### Test cases
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments([document]);
To run them, run
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What did the author do in college?",
});
```
pnpm run test
// Output response
console.log(response.toString());
}
main();
```
To write new test cases write them in packages/core/src/tests
Then you can run it using
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
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 simple]
```bash
pnpm dlx ts-node example.ts
```
To install packages for every package or application run
## Playground
Check out our NextJS playground at https://llama-playground.vercel.app/. The source is available at https://github.com/run-llama/ts-playground
## 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.
- [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.
- [Embedding](/packages/core/src/Embedding.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.
- [Indices](/packages/core/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/QueryEngine.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.
- [ChatEngine](/packages/core/src/ChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices.
- [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.
## Note: NextJS:
If you're using NextJS App Router, you'll need to use the NodeJS runtime (default) and add the following config to your next.config.js to have it use imports/exports in the same way Node does.
```js
export const runtime = "nodejs"; // default
```
pnpm add -w [NPM Package]
```js
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ["pdf2json"],
},
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
sharp$: false,
"onnxruntime-node$": false,
};
return config;
},
};
module.exports = nextConfig;
```
## Supported LLMs:
- OpenAI GPT-3.5-turbo and GPT-4
- Anthropic Claude Instant and Claude 2
- Llama2 Chat LLMs (70B, 13B, and 7B parameters)
- MistralAI Chat LLMs
- Fireworks Chat LLMs
## 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)
## Bugs? Questions?
Please join our Discord! https://discord.com/invite/eN6D2HQ4aX
-4
View File
@@ -1,4 +0,0 @@
module.exports = {
root: true,
extends: ["custom"],
};
+11 -24
View File
@@ -1,34 +1,21 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
# Dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
# Production
/build
# misc
# Generated files
.docusaurus
.cache-loader
lib
# Misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+13
View File
@@ -0,0 +1,13 @@
# docs
## 0.0.2
### Patch Changes
- 0f64084: docs: update API references
## 0.0.1
### Patch Changes
- 3154f52: chore: add qdrant readme
+47
View File
@@ -0,0 +1,47 @@
# 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.
-30
View File
@@ -1,30 +0,0 @@
## Getting Started
First, run the development server:
```bash
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
-11
View File
@@ -1,11 +0,0 @@
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
-10
View File
@@ -1,10 +0,0 @@
import { Button, Header } from "ui";
export default function Page() {
return (
<>
<Header text="Docs" />
<Button />
</>
);
}
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
+1
View File
@@ -0,0 +1 @@
api/
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

+2
View File
@@ -0,0 +1,2 @@
label: Examples
position: 2
+85
View File
@@ -0,0 +1,85 @@
# 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
@@ -0,0 +1,12 @@
---
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>
@@ -0,0 +1,7 @@
---
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.
@@ -0,0 +1,10 @@
---
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
@@ -0,0 +1,10 @@
---
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
@@ -0,0 +1,10 @@
---
sidebar_position: 2
---
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/vectorIndex";
# Vector Index
<CodeBlock language="ts">{CodeSource}</CodeBlock>
@@ -0,0 +1,2 @@
label: Getting Started
position: 1
@@ -0,0 +1,78 @@
---
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).
@@ -0,0 +1,15 @@
---
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
```
@@ -0,0 +1,63 @@
---
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.
+56
View File
@@ -0,0 +1,56 @@
---
sidebar_position: 1
---
# Starter Tutorial
Once you have [installed LlamaIndex.TS using NPM](installation) and set up your OpenAI key, you're ready to start your first app:
In a new folder:
```bash npm2yarn
npm install typescript
npm install @types/node
npx tsc --init # if needed
```
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.
```ts
// example.ts
import fs from "fs/promises";
import { Document, VectorStoreIndex } from "llamaindex";
async function main() {
// Load essay from abramov.txt in Node
const essay = await fs.readFile(
"node_modules/llamaindex/examples/abramov.txt",
"utf-8",
);
// Create Document object with essay
const document = new Document({ text: essay });
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments([document]);
// 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
npx ts-node example.ts
```
Ready to learn more? Check out our NextJS playground at https://llama-playground.vercel.app/. The source is available at https://github.com/run-llama/ts-playground
+56
View File
@@ -0,0 +1,56 @@
---
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.md) 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
@@ -0,0 +1,3 @@
label: "Modules"
collapsed: false
position: 5
@@ -0,0 +1,2 @@
label: "Agents"
position: 3
+14
View File
@@ -0,0 +1,14 @@
# 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)
@@ -0,0 +1,314 @@
# 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,
serviceContextFromDefaults,
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
const llm = new OpenAI({
model: "gpt-4",
});
const ctx = serviceContextFromDefaults({ llm });
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({
serviceContext: serviceContext,
storageContext: storageContext,
nodes,
});
// create the summary index for broader search
const summaryIndex = await SummaryIndex.init({
serviceContext: serviceContext,
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,
{
serviceContext,
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
@@ -0,0 +1,187 @@
---
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");
});
```
@@ -0,0 +1,132 @@
---
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");
});
```
@@ -0,0 +1,203 @@
# 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
@@ -0,0 +1,29 @@
---
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
@@ -0,0 +1,23 @@
---
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
@@ -0,0 +1,48 @@
---
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)
@@ -0,0 +1,2 @@
label: "Document / Nodes"
position: 0
@@ -0,0 +1,18 @@
---
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)
@@ -0,0 +1,45 @@
# 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"));
```
@@ -0,0 +1,2 @@
label: "Embeddings"
position: 3
@@ -0,0 +1 @@
label: "Available Embeddings"
@@ -0,0 +1,25 @@
# HuggingFace
To use HuggingFace embeddings, you need to import `HuggingFaceEmbedding` from `llamaindex`.
```ts
import { HuggingFaceEmbedding, serviceContextFromDefaults } from "llamaindex";
const huggingFaceEmbeds = new HuggingFaceEmbedding();
const serviceContext = serviceContextFromDefaults({ embedModel: openaiEmbeds });
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -0,0 +1,29 @@
# MistralAI
To use MistralAI embeddings, you need to import `MistralAIEmbedding` from `llamaindex`.
```ts
import { MistralAIEmbedding, serviceContextFromDefaults } from "llamaindex";
const mistralEmbedModel = new MistralAIEmbedding({
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({
embedModel: mistralEmbedModel,
});
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -0,0 +1,27 @@
# Ollama
To use Ollama embeddings, you need to import `Ollama` from `llamaindex`.
```ts
import { Ollama, serviceContextFromDefaults } from "llamaindex";
const ollamaEmbedModel = new Ollama();
const serviceContext = serviceContextFromDefaults({
embedModel: ollamaEmbedModel,
});
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -0,0 +1,27 @@
# OpenAI
To use OpenAI embeddings, you need to import `OpenAIEmbedding` from `llamaindex`.
```ts
import { OpenAIEmbedding, serviceContextFromDefaults } from "llamaindex";
const openaiEmbedModel = new OpenAIEmbedding();
const serviceContext = serviceContextFromDefaults({
embedModel: openaiEmbedModel,
});
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -0,0 +1,29 @@
# Together
To use together embeddings, you need to import `TogetherEmbedding` from `llamaindex`.
```ts
import { TogetherEmbedding, serviceContextFromDefaults } from "llamaindex";
const togetherEmbedModel = new TogetherEmbedding({
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({
embedModel: togetherEmbedModel,
});
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const queryEngine = index.asQueryEngine();
const query = "What is the meaning of life?";
const results = await queryEngine.query({
query,
});
```
@@ -0,0 +1,22 @@
# 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 set in the `ServiceContext` object.
```typescript
import { OpenAIEmbedding, serviceContextFromDefaults } from "llamaindex";
const openaiEmbeds = new OpenAIEmbedding();
const serviceContext = serviceContextFromDefaults({ embedModel: openaiEmbeds });
```
## Local Embedding
For local embeddings, you can use the [HuggingFace](./available_embeddings/huggingface.md) embedding model.
## API Reference
- [OpenAIEmbedding](../../api/classes/OpenAIEmbedding.md)
- [ServiceContext](../../api/interfaces//ServiceContext.md)
@@ -0,0 +1,2 @@
label: "Ingestion Pipeline"
position: 2
@@ -0,0 +1,99 @@
# 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);
```
@@ -0,0 +1,77 @@
# 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 Transformatio 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);
```
+32
View File
@@ -0,0 +1,32 @@
import CodeBlock from "@theme/CodeBlock";
import CodeSource from "!raw-loader!../../../../examples/cloud/chat.ts";
# LlamaCloud
LlamaCloud is a new generation of managed parsing, ingestion, and retrieval services, designed to bring production-grade context-augmentation to your LLM and RAG applications.
Currently, LlamaCloud supports
- Managed Ingestion API, handling parsing and document management
- Managed Retrieval API, configuring optimal retrieval for your RAG system
## Access
We are opening up a private beta to a limited set of enterprise partners for the managed ingestion and retrieval API. If youre interested in centralizing your data pipelines and spending more time working on your actual RAG use cases, come [talk to us.](https://www.llamaindex.ai/contact)
If you have access to LlamaCloud, you can visit [LlamaCloud](https://cloud.llamaindex.ai) to sign in and get an API key.
## Create a Managed Index
Currently, you can't create a managed index on LlamaCloud using LlamaIndexTS, but you can use an existing managed index for retrieval that was created by the Python version of LlamaIndex. See [the LlamaCloudIndex documentation](https://docs.llamaindex.ai/en/stable/module_guides/indexing/llama_cloud_index.html#usage) for more information on how to create a managed index.
## Use a Managed Index
Here's an example of how to use a managed index together with a chat engine:
<CodeBlock language="ts">{CodeSource}</CodeBlock>
## API Reference
- [LlamaCloudIndex](../api/classes/LlamaCloudIndex.md)
- [LlamaCloudRetriever](../api/classes/LlamaCloudRetriever.md)
@@ -0,0 +1,2 @@
label: "LLMs"
position: 3
@@ -0,0 +1 @@
label: "Available LLMs"
@@ -0,0 +1,80 @@
# Anthropic
## Usage
```ts
import { Anthropic, serviceContextFromDefaults } from "llamaindex";
const anthropicLLM = new Anthropic({
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({ llm: anthropicLLM });
```
## 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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the Anthropic LLM
const anthropicLLM = new Anthropic({
apiKey: "<YOUR_API_KEY>",
});
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: anthropicLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,91 @@
# 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, serviceContextFromDefaults } from "llamaindex";
const azureOpenaiLLM = new OpenAI({ model: "gpt-4", temperature: 0 });
const serviceContext = serviceContextFromDefaults({ llm: azureOpenaiLLM });
```
## 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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the LLM
const azureOpenaiLLM = new OpenAI({ model: "gpt-4", temperature: 0 });
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: azureOpenaiLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,65 @@
# Fireworks LLM
Fireworks.ai focus on production use cases for open source LLMs, offering speed and quality.
## Usage
```ts
import { FireworksLLM, serviceContextFromDefaults } from "llamaindex";
const fireworksLLM = new FireworksLLM({
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({ llm: fireworksLLM });
```
## 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, {
serviceContext,
});
```
## 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);
```
@@ -0,0 +1,100 @@
# LLama2
## Usage
```ts
import { Ollama, serviceContextFromDefaults } from "llamaindex";
const llama2LLM = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
const serviceContext = serviceContextFromDefaults({ llm: llama2LLM });
```
## Usage with Replication
```ts
import {
Ollama,
ReplicateSession,
serviceContextFromDefaults,
} from "llamaindex";
const replicateSession = new ReplicateSession({
replicateKey,
});
const llama2LLM = new LlamaDeuce({
chatStrategy: DeuceChatStrategy.META,
replicateSession,
});
const serviceContext = serviceContextFromDefaults({ llm: llama2LLM });
```
## 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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the LLM
const llama2LLM = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: mistralLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,82 @@
# Mistral
## Usage
```ts
import { Ollama, serviceContextFromDefaults } from "llamaindex";
const mistralLLM = new MistralAI({
model: "mistral-tiny",
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({ llm: mistralLLM });
```
## 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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the LLM
const mistralLLM = new MistralAI({ model: "mistral-tiny" });
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: mistralLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,89 @@
# Ollama
## Usage
```ts
import { Ollama, serviceContextFromDefaults } from "llamaindex";
const ollamaLLM = new Ollama({ model: "llama2", temperature: 0.75 });
const serviceContext = serviceContextFromDefaults({
llm: ollamaLLM,
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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
import fs from "fs/promises";
async function main() {
// Create an instance of the LLM
const ollamaLLM = new Ollama({ model: "llama2", temperature: 0.75 });
const essay = await fs.readFile("./paul_graham_essay.txt", "utf-8");
// Create a service context
const serviceContext = serviceContextFromDefaults({
embedModel: ollamaLLM, // prevent 'Set OpenAI Key in OPENAI_API_KEY env variable' error
llm: ollamaLLM,
});
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,83 @@
# OpenAI
```ts
import { OpenAI, serviceContextFromDefaults } from "llamaindex";
const openaiLLM = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0, apiKey: <YOUR_API_KEY> });
const serviceContext = serviceContextFromDefaults({ llm: openaiLLM });
```
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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the LLM
const openaiLLM = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: openaiLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,83 @@
# Portkey LLM
## Usage
```ts
import { Portkey, serviceContextFromDefaults } from "llamaindex";
const portkeyLLM = new Portkey({
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({ llm: portkeyLLM });
```
## 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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the LLM
const portkeyLLM = new Portkey({
apiKey: "<YOUR_API_KEY>",
});
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: portkeyLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
@@ -0,0 +1,83 @@
# Together LLM
## Usage
```ts
import { TogetherLLM, serviceContextFromDefaults } from "llamaindex";
const togetherLLM = new TogetherLLM({
apiKey: "<YOUR_API_KEY>",
});
const serviceContext = serviceContextFromDefaults({ llm: togetherLLM });
```
## 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], {
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Create an instance of the LLM
const togetherLLM = new TogetherLLM({
apiKey: "<YOUR_API_KEY>",
});
// Create a service context
const serviceContext = serviceContextFromDefaults({ llm: togetherLLM });
const document = new Document({ text: essay, id_: "essay" });
// Load and index documents
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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);
}
```
+38
View File
@@ -0,0 +1,38 @@
---
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 set in the `ServiceContext` object.
```typescript
import { OpenAI, serviceContextFromDefaults } from "llamaindex";
const openaiLLM = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });
const serviceContext = serviceContextFromDefaults({ llm: openaiLLM });
```
## 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)
- [ServiceContext](../api/interfaces//ServiceContext.md)
+98
View File
@@ -0,0 +1,98 @@
---
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 `ServiceContext` 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();
const nodes = nodeParser.getNodesFromDocuments([
new Document({ text: "I am 10 years old. John is 20 years old." }),
]);
```
## 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)
@@ -0,0 +1,2 @@
label: "Node Postprocessors"
position: 3
@@ -0,0 +1,71 @@
# 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,
serviceContextFromDefaults,
} 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" });
const serviceContext = serviceContextFromDefaults({
llm: new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 }),
});
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
```
## 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?");
```
@@ -0,0 +1,110 @@
# 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 = 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 } 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,
}
];
// 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 serviceContext = serviceContextFromDefaults({
llm: new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 }),
});
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
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("test query str");
const processor = new SimilarityPostprocessor({
similarityCutoff: 0.7,
});
const filteredNodes = processor.postprocessNodes(nodes);
```
@@ -0,0 +1,2 @@
label: "Prompts"
position: 0
+76
View File
@@ -0,0 +1,76 @@
# 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(serviceContext, newTextQaPrompt),
});
// Create index
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// 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], {
serviceContext,
});
// 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?",
});
```
@@ -0,0 +1,2 @@
label: "Query Engines"
position: 2
@@ -0,0 +1,41 @@
# 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)
@@ -0,0 +1,152 @@
# 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 serviceContext = await storageContextFromDefaults({
vectorStore: chromaVS,
});
const index = await VectorStoreIndex.fromDocuments(docs, {
storageContext: serviceContext,
});
```
## 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();
```
@@ -0,0 +1,189 @@
# 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,
serviceContextFromDefaults,
} 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 `ServiceContext` to define the rules (eg. LLM API key, chunk size, etc.):
```ts
const nodeParser = new SimpleNodeParser({
chunkSize: 1024,
});
const serviceContext = serviceContextFromDefaults({
nodeParser,
llm: new OpenAI(),
});
```
## Creating Indices
Next, we need to create some indices. We will create a `VectorStoreIndex` and a `SummaryIndex`:
```ts
const vectorIndex = await VectorStoreIndex.fromDocuments(documents, {
serviceContext,
});
const summaryIndex = await SummaryIndex.fromDocuments(documents, {
serviceContext,
});
```
## 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",
},
],
serviceContext,
});
```
## 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,
serviceContextFromDefaults,
} from "llamaindex";
async function main() {
// Load documents from a directory
const documents = await new SimpleDirectoryReader().loadData({
directoryPath: "node_modules/llamaindex/examples",
});
// Parse the documents into nodes
const nodeParser = new SimpleNodeParser({
chunkSize: 1024,
});
// Create a service context
const serviceContext = serviceContextFromDefaults({
nodeParser,
llm: new OpenAI(),
});
// Create indices
const vectorIndex = await VectorStoreIndex.fromDocuments(documents, {
serviceContext,
});
const summaryIndex = await SummaryIndex.fromDocuments(documents, {
serviceContext,
});
// 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",
},
],
serviceContext,
});
// 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"));
```
@@ -0,0 +1,64 @@
---
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
@@ -0,0 +1,21 @@
---
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 string");
```
## API Reference
- [SummaryIndexRetriever](../api/classes/SummaryIndexRetriever.md)
- [SummaryIndexLLMRetriever](../api/classes/SummaryIndexLLMRetriever.md)
- [VectorIndexRetriever](../api/classes/VectorIndexRetriever.md)
+26
View File
@@ -0,0 +1,26 @@
---
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)
@@ -0,0 +1,2 @@
label: "Vector Stores"
position: 1
@@ -0,0 +1,86 @@
# 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);
```
@@ -0,0 +1,2 @@
label: Observability
position: 5
+35
View File
@@ -0,0 +1,35 @@
# 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,
});
```
+181
View File
@@ -0,0 +1,181 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const renderer = require("prism-react-renderer");
const lightCodeTheme = renderer.themes.github;
const darkCodeTheme = renderer.themes.dracula;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "LlamaIndex.TS",
tagline: "Unleash the power of LLMs over your data in TypeScript",
favicon: "img/favicon.png",
// Set the production url of your site here
url: "https://ts.llamaindex.ai",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "run-llama", // Usually your GitHub org/user name.
projectName: "LlamaIndex.TS", // Usually your repo name.
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: [
"en",
"zh-Hans",
"es",
"fr",
"de",
"ja",
"ko",
"pt",
"ar",
"it",
"tr",
"pl",
"nl",
"vi",
"th",
], // "fa", "ru", "ro", "sv", "hu", "cs", "el", "da", "fi", "he", "no", "hi", "in", "sl", "se", "sk", "uk", "bg", "hr", "lt", "lv", "et", "cat"
},
presets: [
[
"@docusaurus/preset-classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: "docs",
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
// "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
remarkPlugins: [
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
],
},
blog: false,
gtag: {
trackingID: "G-NB9B8LW9W5",
anonymizeIP: true,
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: "img/favicon.png", // TODO change this
navbar: {
title: "LlamaIndex.TS",
logo: {
alt: "LlamaIndex.TS",
src: "img/favicon.png",
},
items: [
{
type: "docSidebar",
sidebarId: "mySidebar",
position: "left",
label: "Docs",
},
{
type: "localeDropdown",
position: "left",
},
{
href: "https://github.com/run-llama/LlamaIndexTS",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Docs",
items: [
{
label: "API",
to: "/api",
},
],
},
{
title: "Community",
items: [
{
label: "Discord",
href: "https://discord.com/invite/eN6D2HQ4aX",
},
{
label: "Twitter",
href: "https://twitter.com/LlamaIndex",
},
],
},
{
title: "More",
items: [
{
label: "GitHub",
href: "https://github.com/run-llama/LlamaIndexTS",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} LlamaIndex. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
algolia: {
// The application ID provided by Algolia
appId: "DYKPM6G4CX",
// Public API key: it is safe to commit it
apiKey: "c4ff3789f20bb72a5d735082aef17719",
indexName: "ts-llamaindex",
// Optional: see doc section below
contextualSearch: true,
},
}),
plugins: [
[
"docusaurus-plugin-typedoc",
{
entryPoints: ["../../packages/core/src/index.ts"],
tsconfig: "../../packages/core/tsconfig.json",
readme: "none",
sourceLinkTemplate:
"https://github.com/run-llama/LlamaIndexTS/blob/{gitRevision}/{path}#L{line}",
sidebar: {
position: 6,
},
},
],
],
markdown: {
format: "detect",
},
};
module.exports = config;

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