Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Yang b145db3ff3 Update README.md 2024-01-24 20:58:55 -06:00
Alex Yang e8952f3753 docs: add stackblitz playground 2024-01-24 20:17:31 -06:00
11 changed files with 37 additions and 32 deletions
+4
View File
@@ -11,6 +11,10 @@ Use your own data with large language models (LLMs, OpenAI ChatGPT and others) i
Documentation: https://ts.llamaindex.ai/
Try examples online:
[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/run-llama/LlamaIndexTS/tree/main/examples)
## What is LlamaIndex.TS?
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.
+12 -22
View File
@@ -1,29 +1,19 @@
# Simple Examples
# LlamaIndexTS Examples
Before running any of the examples, make sure to set your OpenAI environment variable:
Before running any of the code examples,
make sure you have basic knowledge of the [LlamaIndexTS](https://ts.llamaindex.ai/).
```bash
## Usage
```shell
# export your API key
export OPENAI_API_KEY="sk-..."
npx ts-node ./chatEngine.ts
```
There are two ways to run the examples, using the latest published version of `llamaindex` or using a local build.
## Build your own RAG app
## Using the latest published version
Make sure to call `npm install` before running these examples:
```bash
npm install
```shell
npx create llama
```
Then run the examples with `ts-node`, for example `npx ts-node vectorIndex.ts`
## Using the local build
```bash
pnpm install
pnpm --filter llamaindex build
pnpm link ../packages/core
```
Then run the examples with `ts-node`, for example `pnpx ts-node vectorIndex.ts`
+1 -1
View File
@@ -10,7 +10,7 @@ import {
VectorStoreIndex,
} from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
async function main() {
const document = new Document({ text: essay });
+1 -1
View File
@@ -3,7 +3,7 @@ import {
KeywordTableIndex,
KeywordTableRetrieverMode,
} from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
async function main() {
const document = new Document({ text: essay, id_: "essay" });
+1 -2
View File
@@ -1,7 +1,6 @@
{
"version": "0.0.3",
"private": true,
"name": "examples",
"private": true,
"dependencies": {
"@datastax/astra-db-ts": "^0.1.2",
"@notionhq/client": "^2.2.14",
+1 -1
View File
@@ -6,7 +6,7 @@ import {
VectorStoreIndex,
serviceContextFromDefaults,
} from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
async function main() {
const document = new Document({ text: essay, id_: "essay" });
+1 -1
View File
@@ -3,7 +3,7 @@ import {
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
async function main() {
// Create Document object with essay
+1 -1
View File
@@ -1,6 +1,6 @@
import { Document, SubQuestionQueryEngine, VectorStoreIndex } from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
(async () => {
const document = new Document({ text: essay, id_: essay });
+1 -1
View File
@@ -5,7 +5,7 @@ import {
SummaryRetrieverMode,
serviceContextFromDefaults,
} from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
async function main() {
const serviceContext = serviceContextFromDefaults({
+13 -1
View File
@@ -1,5 +1,17 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "es2016",
"module": "esnext",
"moduleResolution": "bundler",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"outDir": "./lib",
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"incremental": true,
"composite": true,
},
"ts-node": {
"files": true,
"compilerOptions": {
+1 -1
View File
@@ -6,7 +6,7 @@ import {
SimilarityPostprocessor,
VectorStoreIndex,
} from "llamaindex";
import essay from "./essay.js";
import essay from "./essay";
// Customize retrieval and query args
async function main() {