mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-02 20:13:52 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9e01c3aaa |
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"llamaindex": patch
|
||||
---
|
||||
|
||||
Update storage exports (thanks @TomPenguin)
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true
|
||||
},
|
||||
"target": "esnext",
|
||||
"transform": {
|
||||
"decoratorVersion": "2022-03"
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs",
|
||||
"ignoreDynamic": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
// This tells ESLint to load the config from the package `eslint-config-custom`
|
||||
extends: ["custom"],
|
||||
settings: {
|
||||
next: {
|
||||
rootDir: ["apps/*/"],
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
examples/readers/data/** binary
|
||||
examples/data/** binary
|
||||
@@ -1,46 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ""
|
||||
labels: bug
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Code to reproduce the behavior:
|
||||
|
||||
```ts
|
||||
// paste the code here
|
||||
```
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
|
||||
- OS: [e.g. macOS, Linux]
|
||||
- JS Runtime / Framework / Bundler (select all applicable)
|
||||
- [ ] Node.js
|
||||
- [ ] Deno
|
||||
- [ ] Bun
|
||||
- [ ] Next.js
|
||||
- [ ] ESBuild
|
||||
- [ ] Rollup
|
||||
- [ ] Webpack
|
||||
- [ ] Turbopack
|
||||
- [ ] Vite
|
||||
- [ ] Waku
|
||||
- [ ] Edge Runtime
|
||||
- [ ] AWS Lambda
|
||||
- [ ] Cloudflare Worker
|
||||
- [ ] Others (please elaborate on this)
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,10 +1,11 @@
|
||||
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:"
|
||||
title: 'Sweep: '
|
||||
description: Write something like "We notice ... behavior when ... happens instead of ...""
|
||||
labels: sweep
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Details
|
||||
description: More details about the bug
|
||||
placeholder: The bug might be in ... file
|
||||
placeholder: The bug might be in ... file
|
||||
@@ -1,10 +1,11 @@
|
||||
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:"
|
||||
title: 'Sweep: '
|
||||
description: Write something like "Write an api endpoint that does "..." in the "..." file"
|
||||
labels: 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
|
||||
description: More details for Sweep
|
||||
placeholder: The new endpoint should use the ... class from ... file because it contains ... logic
|
||||
@@ -1,10 +1,11 @@
|
||||
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:"
|
||||
title: 'Sweep: '
|
||||
description: Write something like "Modify the ... api endpoint to use ... version and ... framework"
|
||||
labels: sweep
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Details
|
||||
description: More details
|
||||
placeholder: We are migrating this function to ... version because ...
|
||||
description: More details for Sweep
|
||||
placeholder: We are migrating this function to ... version because ...
|
||||
@@ -8,25 +8,18 @@ on:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
TURBO_REMOTE_ONLY: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Run lint
|
||||
run: pnpm run lint
|
||||
- name: Run Prettier
|
||||
run: pnpm run format
|
||||
run: pnpm run lint
|
||||
@@ -1,33 +0,0 @@
|
||||
name: Publish Preview
|
||||
on: [pull_request]
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
TURBO_REMOTE_ONLY: true
|
||||
|
||||
jobs:
|
||||
pre_release:
|
||||
name: Pre Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Pre Release
|
||||
run: pnpx pkg-pr-new publish --pnpm ./packages/* ./packages/providers/* ./packages/providers/storage/*
|
||||
@@ -1,37 +0,0 @@
|
||||
name: Publish to GitHub Releases
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "llamaindex@*"
|
||||
|
||||
jobs:
|
||||
build-and-publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build tarball
|
||||
run: |
|
||||
pnpm pack
|
||||
working-directory: packages/llamaindex
|
||||
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "packages/llamaindex/llamaindex-*.tgz"
|
||||
name: Release ${{ github.ref }}
|
||||
bodyFile: "packages/llamaindex/CHANGELOG.md"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,70 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Add auth token to .npmrc file
|
||||
run: |
|
||||
cat << EOF >> ".npmrc"
|
||||
//registry.npmjs.org/:_authToken=$NPM_TOKEN
|
||||
EOF
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Get changeset status
|
||||
id: get-changeset-status
|
||||
run: |
|
||||
pnpm changeset status --output .changeset/status.json
|
||||
new_version=$(jq -r '.releases[] | select(.name == "llamaindex") | .newVersion' < .changeset/status.json)
|
||||
rm -v .changeset/status.json
|
||||
echo "new-version=${new_version}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create Release Pull Request or Publish to npm
|
||||
id: changesets
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
commit: Release ${{ steps.get-changeset-status.outputs.new-version }}
|
||||
title: Release ${{ steps.get-changeset-status.outputs.new-version }}
|
||||
# update version PR with the latest changesets
|
||||
version: pnpm new-version
|
||||
# build package and call changeset publish
|
||||
publish: pnpm release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
# Refs: https://github.com/changesets/changesets/issues/421
|
||||
- name: Update lock file
|
||||
continue-on-error: true
|
||||
run: pnpm install --lockfile-only
|
||||
|
||||
- name: Commit lock file
|
||||
continue-on-error: true
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "chore: update lock file"
|
||||
branch: changeset-release/main
|
||||
file_pattern: "pnpm-lock.yaml"
|
||||
+13
-182
@@ -1,193 +1,24 @@
|
||||
name: Run Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
TURBO_REMOTE_ONLY: true
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: [18.x, 20.x, 22.x, 23.x]
|
||||
name: E2E on Node.js ${{ matrix.node-version }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ankane/setup-postgres@v1
|
||||
with:
|
||||
database: llamaindex_node_test
|
||||
dev-files: true
|
||||
- run: |
|
||||
cd /tmp
|
||||
git clone --branch v0.7.0 https://github.com/pgvector/pgvector.git
|
||||
cd pgvector
|
||||
make
|
||||
sudo make install
|
||||
- uses: pnpm/action-setup@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: "pnpm"
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Run E2E Tests
|
||||
run: pnpm run e2e
|
||||
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: [18.x, 20.x, 22.x, 23.x]
|
||||
name: Test on Node.js ${{ matrix.node-version }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
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@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
- name: Run Type Check
|
||||
run: pnpm run type-check
|
||||
- name: Run Circular Dependency Check
|
||||
run: pnpm run circular-check
|
||||
e2e-llamaindex-examples:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
packages:
|
||||
- cloudflare-worker-agent
|
||||
- nextjs-agent
|
||||
- nextjs-edge-runtime
|
||||
- nextjs-node-runtime
|
||||
- waku-query-engine
|
||||
- llama-parse-browser
|
||||
- vite-import-llamaindex
|
||||
runs-on: ubuntu-latest
|
||||
name: Build LlamaIndex Example (${{ matrix.packages }})
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Build llamaindex
|
||||
run: pnpm run build
|
||||
- name: Build ${{ matrix.packages }}
|
||||
run: pnpm run build
|
||||
working-directory: e2e/examples/${{ matrix.packages }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
size-limit:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
name: Size Limit
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Build llamaindex
|
||||
run: pnpm run build
|
||||
- uses: andresz1/size-limit-action@94bc357df29c36c8f8d50ea497c3e225c3c95d1d
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
directory: e2e/examples/vite-import-llamaindex
|
||||
skip_step: "install"
|
||||
build_script: build
|
||||
package_manager: pnpm
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
typecheck-examples:
|
||||
runs-on: ubuntu-latest
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm i -g pnpm
|
||||
pnpm install
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
- name: Copy examples
|
||||
run: rsync -rv --exclude=node_modules ./examples ${{ runner.temp }}
|
||||
- name: Pack packages
|
||||
run: |
|
||||
for dir in packages/*; do
|
||||
if [ -d "$dir" ] && [ -f "$dir/package.json" ] && [[ ! "$dir" =~ autotool ]]; then
|
||||
echo "Packing $dir"
|
||||
pnpm pack --pack-destination ${{ runner.temp }} -C $dir
|
||||
else
|
||||
echo "Skipping $dir, no package.json found"
|
||||
fi
|
||||
done
|
||||
- name: Pack provider packages
|
||||
run: |
|
||||
for dir in packages/providers/* packages/providers/storage/*; do
|
||||
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
|
||||
echo "Packing $dir"
|
||||
pnpm pack --pack-destination ${{ runner.temp }} -C $dir
|
||||
else
|
||||
echo "Skipping $dir, no package.json found"
|
||||
fi
|
||||
done
|
||||
- name: Install
|
||||
run: npm add ${{ runner.temp }}/*.tgz
|
||||
working-directory: ${{ runner.temp }}/examples
|
||||
- name: Run Type Check
|
||||
run: npx tsc --project ./tsconfig.json
|
||||
working-directory: ${{ runner.temp }}/examples
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: build-dist
|
||||
path: |
|
||||
${{ runner.temp }}/*.tgz
|
||||
if-no-files-found: error
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
-15
@@ -3,7 +3,6 @@
|
||||
# dependencies
|
||||
node_modules
|
||||
.pnp
|
||||
.pnpm-store
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
@@ -37,17 +36,3 @@ yarn-error.log*
|
||||
.vercel
|
||||
|
||||
dist/
|
||||
lib/
|
||||
|
||||
.cache
|
||||
test-results/
|
||||
playwright-report/
|
||||
blob-report/
|
||||
playwright/.cache/
|
||||
.tsbuildinfo
|
||||
|
||||
# intellij
|
||||
**/.idea
|
||||
|
||||
# generated API
|
||||
packages/cloud/src/client
|
||||
|
||||
+4
-1
@@ -1 +1,4 @@
|
||||
pnpm run lint-staged
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm lint
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm test
|
||||
@@ -1,5 +1 @@
|
||||
auto-install-peers = true
|
||||
enable-pre-post-scripts = true
|
||||
prefer-workspace-packages = true
|
||||
save-workspace-protocol = true
|
||||
link-workspace-packages = true
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
apps/docs/i18n
|
||||
apps/docs/docs/api
|
||||
pnpm-lock.yaml
|
||||
lib/
|
||||
dist/
|
||||
.docusaurus/
|
||||
.source/
|
||||
# prttier doesn't support mdx3 we are using
|
||||
*.mdx
|
||||
packages/server/server/
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true
|
||||
},
|
||||
"target": "esnext",
|
||||
"transform": {
|
||||
"decoratorVersion": "2022-03"
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
{
|
||||
// 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",
|
||||
"console": "integratedTerminal",
|
||||
"cwd": "${workspaceFolder}/examples",
|
||||
"runtimeArgs": ["npx", "tsx", "${file}"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
LlamaIndexTS
|
||||
Vendored
+1
-12
@@ -4,16 +4,5 @@
|
||||
"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"
|
||||
},
|
||||
"prettier.prettierPath": "./node_modules/prettier",
|
||||
"prettier.configPath": "prettier.config.mjs"
|
||||
}
|
||||
}
|
||||
|
||||
+47
-79
@@ -2,111 +2,79 @@
|
||||
|
||||
## Structure
|
||||
|
||||
LlamaIndex.TS uses pnpm monorepo.
|
||||
This is a monorepo built with Turborepo
|
||||
|
||||
We recommend you to understand the basics of Node.js, TypeScript, pnpm, and of course, LLM before contributing.
|
||||
Right now there are two packages of importance:
|
||||
|
||||
There are some important folders in the repository:
|
||||
packages/core which is the main NPM library llamaindex
|
||||
|
||||
- `packages/*`: Contains the source code of the packages. Each package is a separate npm package.
|
||||
- `llamaindex`: The starter package for LlamaIndex.TS, which contains the all sub-packages.
|
||||
- `core`: The core package of LlamaIndex.TS, which contains the abstract classes and interfaces. It is designed for
|
||||
all JS runtime environments.
|
||||
- `env`: The environment package of LlamaIndex.TS, which contains the environment-specific classes and interfaces. It
|
||||
includes compatibility layers for Node.js, Deno, Vercel Edge Runtime, Cloudflare Workers...
|
||||
- `providers/*`: The providers package of LlamaIndex.TS, which contains the providers for LLM and other services.
|
||||
- `apps/*`: The applications based on LlamaIndex.TS.
|
||||
- `next`: Our documentation website based on Next.js.
|
||||
- `examples`: The code examples of LlamaIndex.TS using Node.js.
|
||||
apps/simple 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
|
||||
|
||||
Make sure you have Node.js LTS (Long-term Support) installed. You can check your Node.js version by running:
|
||||
Install NodeJS. Preferably v18 using nvm or n.
|
||||
|
||||
Inside the LlamaIndexTS directory:
|
||||
|
||||
```shell
|
||||
node -v
|
||||
# v20.x.x
|
||||
```
|
||||
|
||||
### Use pnpm
|
||||
|
||||
```shell
|
||||
npm install -g pnpm
|
||||
```
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```shell
|
||||
npm i -g pnpm ts-node
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### Build the packages
|
||||
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.
|
||||
|
||||
To build all packages, run:
|
||||
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).
|
||||
|
||||
```shell
|
||||
pnpm build
|
||||
### 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
|
||||
```
|
||||
|
||||
### Run tests
|
||||
To write new test cases write them in [packages/core/src/tests](/packages/core/src/tests)
|
||||
|
||||
#### Unit 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
|
||||
|
||||
After build, to run all unit tests, call:
|
||||
### Demo applications
|
||||
|
||||
```shell
|
||||
pnpm test
|
||||
There is an existing ["simple"](/apps/simple/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 simple]
|
||||
```
|
||||
|
||||
Unit tests are located in the `tests` folder of each package. They are using their own package (e.g. `@llamaindex/core-tests` for `@llamaindex/core`). The tests are importing the package under test and the test package is not published.
|
||||
To install packages for every package or application run
|
||||
|
||||
#### E2E tests
|
||||
|
||||
To run all E2E tests, call:
|
||||
|
||||
```shell
|
||||
pnpm e2e
|
||||
```
|
||||
|
||||
All E2E tests are in the `e2e` folder.
|
||||
pnpm add -w [NPM Package]
|
||||
```
|
||||
|
||||
### Docs
|
||||
|
||||
See the [docs](./apps/next/README.md) for more information.
|
||||
To contribute to the docs, go to the docs website folder and run the Docusaurus instance.
|
||||
|
||||
## Adding a new package
|
||||
|
||||
Please follow these steps to add a new package:
|
||||
|
||||
1. Only add new packages to the `packages/providers` folder.
|
||||
2. Use the `package.json` and `tsconfig.json` of an existing packages as template.
|
||||
3. Reference your new package in the root `tsconfig.json` file
|
||||
4. Add your package to the `examples/package.json` file if you add a new example.
|
||||
|
||||
## Before sending a PR
|
||||
|
||||
Before sending a PR, make sure of the following:
|
||||
|
||||
1. Tests are all running and you added meaningful tests for your change.
|
||||
2. If you have a new feature, document it in the `apps/next` docs folder.
|
||||
3. If you have a new feature, add a new example in the `examples` folder.
|
||||
4. You have a descriptive changeset for each PR:
|
||||
|
||||
### Changesets
|
||||
|
||||
We use [changesets](https://github.com/changesets/changesets) for managing versions and changelogs. To create a new
|
||||
changeset, run in the root folder:
|
||||
|
||||
```shell
|
||||
pnpm changeset
|
||||
```bash
|
||||
cd apps/docs
|
||||
pnpm install
|
||||
pnpm start
|
||||
```
|
||||
|
||||
## Publishing (maintainers only)
|
||||
That should start a webserver which will serve the docs on https://localhost:3000
|
||||
|
||||
The [Release Github Action](.github/workflows/release.yml) is automatically generating and updating a
|
||||
PR called "Release {version}".
|
||||
|
||||
This PR will update the `package.json` and `CHANGELOG.md` files of each package according to
|
||||
the current changesets in the [.changeset](.changeset) folder.
|
||||
|
||||
If this PR is merged it will automatically add version tags to the repository and publish the updated packages to NPM.
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# Turborepo starter
|
||||
|
||||
This is an official starter Turborepo.
|
||||
|
||||
## Using this example
|
||||
|
||||
Run the following command:
|
||||
|
||||
```sh
|
||||
npx create-turbo@latest
|
||||
```
|
||||
|
||||
## What's inside?
|
||||
|
||||
This Turborepo includes the following packages/apps:
|
||||
|
||||
### Apps and Packages
|
||||
|
||||
- `docs`: a [Next.js](https://nextjs.org/) app
|
||||
- `web`: another [Next.js](https://nextjs.org/) app
|
||||
- `ui`: a stub React component library shared by both `web` and `docs` applications
|
||||
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
|
||||
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
|
||||
|
||||
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
|
||||
|
||||
### Utilities
|
||||
|
||||
This Turborepo has some additional tools already setup for you:
|
||||
|
||||
- [TypeScript](https://www.typescriptlang.org/) for static type checking
|
||||
- [ESLint](https://eslint.org/) for code linting
|
||||
- [Prettier](https://prettier.io) for code formatting
|
||||
|
||||
### Build
|
||||
|
||||
To build all apps and packages, run the following command:
|
||||
|
||||
```
|
||||
cd my-turborepo
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### Develop
|
||||
|
||||
To develop all apps and packages, run the following command:
|
||||
|
||||
```
|
||||
cd my-turborepo
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
### Remote Caching
|
||||
|
||||
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
|
||||
|
||||
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
|
||||
|
||||
```
|
||||
cd my-turborepo
|
||||
npx turbo login
|
||||
```
|
||||
|
||||
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
|
||||
|
||||
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
|
||||
|
||||
```
|
||||
npx turbo link
|
||||
```
|
||||
|
||||
## Useful Links
|
||||
|
||||
Learn more about the power of Turborepo:
|
||||
|
||||
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
|
||||
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
|
||||
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
|
||||
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
|
||||
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
|
||||
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
|
||||
@@ -1,80 +1,67 @@
|
||||
<p align="center">
|
||||
<img height="100" width="100" alt="LlamaIndex logo" src="https://ts.llamaindex.ai/square.svg" />
|
||||
</p>
|
||||
<h1 align="center">LlamaIndex.TS</h1>
|
||||
<h3 align="center">
|
||||
Data framework for your LLM application.
|
||||
</h3>
|
||||
# LlamaIndex.TS
|
||||
|
||||
[](https://www.npmjs.com/package/llamaindex)
|
||||
[](https://www.npmjs.com/package/llamaindex)
|
||||
[](https://www.npmjs.com/package/llamaindex)
|
||||
[](https://discord.com/invite/eN6D2HQ4aX)
|
||||
LlamaIndex is a data framework for your LLM application.
|
||||
|
||||
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in JS runtime environments with TypeScript support.
|
||||
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in Typescript and Javascript.
|
||||
|
||||
Documentation: https://ts.llamaindex.ai/
|
||||
|
||||
Try examples online:
|
||||
|
||||
[](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.
|
||||
|
||||
## Compatibility
|
||||
## Getting started with an example:
|
||||
|
||||
### Multiple JS Environment Support
|
||||
LlamaIndex.TS requries Node v18 or higher. You can download it from https://nodejs.org or use https://nvm.sh (our preferred option).
|
||||
|
||||
LlamaIndex.TS supports multiple JS environments, including:
|
||||
In a new folder:
|
||||
|
||||
- Node.js >= 20 ✅
|
||||
- Deno ✅
|
||||
- Bun ✅
|
||||
- Nitro ✅
|
||||
- Vercel Edge Runtime ✅ (with some limitations)
|
||||
- Cloudflare Workers ✅ (with some limitations)
|
||||
|
||||
For now, browser support is limited due to the lack of support for [AsyncLocalStorage-like APIs](https://github.com/tc39/proposal-async-context)
|
||||
|
||||
### Supported LLMs:
|
||||
|
||||
- OpenAI LLms
|
||||
- Anthropic LLms
|
||||
- Groq LLMs
|
||||
- Llama2, Llama3, Llama3.1 LLMs
|
||||
- MistralAI LLMs
|
||||
- Fireworks LLMs
|
||||
- DeepSeek LLMs
|
||||
- ReplicateAI LLMs
|
||||
- TogetherAI LLMs
|
||||
- HuggingFace LLms
|
||||
- DeepInfra LLMs
|
||||
- Gemini LLMs
|
||||
|
||||
## Getting started
|
||||
|
||||
```shell
|
||||
npm install llamaindex
|
||||
```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
|
||||
yarn add llamaindex
|
||||
pnpm install @types/node
|
||||
```
|
||||
|
||||
### Setup in Node.js, Deno, Bun, TypeScript...?
|
||||
Create the file example.ts
|
||||
|
||||
See our official document: <https://ts.llamaindex.ai/docs/llamaindex/getting_started/>
|
||||
```ts
|
||||
// example.ts
|
||||
import fs from "fs/promises";
|
||||
import { Document, VectorStoreIndex } from "llamaindex";
|
||||
|
||||
### Adding provider packages
|
||||
async function main() {
|
||||
// Load essay from abramov.txt in Node
|
||||
const essay = await fs.readFile(
|
||||
"node_modules/llamaindex/examples/abramov.txt",
|
||||
"utf-8"
|
||||
);
|
||||
|
||||
In most cases, you'll also need to install provider packages to use LlamaIndexTS. These are for adding AI models, file readers for ingestion or storing documents, e.g. in vector databases.
|
||||
// Create Document object with essay
|
||||
const document = new Document({ text: essay });
|
||||
|
||||
For example, to use the OpenAI LLM, you would install the following package:
|
||||
// Split text and create embeddings. Store them in a VectorStoreIndex
|
||||
const index = await VectorStoreIndex.fromDocuments([document]);
|
||||
|
||||
```shell
|
||||
npm install @llamaindex/openai
|
||||
pnpm install @llamaindex/openai
|
||||
yarn add @llamaindex/openai
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
const response = await queryEngine.query(
|
||||
"What did the author do in college?"
|
||||
);
|
||||
|
||||
// Output response
|
||||
console.log(response.toString());
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
|
||||
Then you can run it using
|
||||
|
||||
```bash
|
||||
pnpm dlx ts-node example.ts
|
||||
```
|
||||
|
||||
## Playground
|
||||
@@ -83,25 +70,30 @@ Check out our NextJS playground at https://llama-playground.vercel.app/. The sou
|
||||
|
||||
## Core concepts for getting started:
|
||||
|
||||
- [Document](/packages/llamaindex/src/Node.ts): A document represents a text file, PDF file or other contiguous piece of data.
|
||||
- [Document](/packages/core/src/Node.ts): A document represents a text file, PDF file or other contiguous piece of data.
|
||||
|
||||
- [Node](/packages/llamaindex/src/Node.ts): The basic data building block. Most commonly, these are parts of the document split into manageable pieces that are small enough to be fed into an embedding model and LLM.
|
||||
- [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/llamaindex/src/embeddings/OpenAIEmbedding.ts): Embeddings are sets of floating point numbers which represent the data in a Node. By comparing the similarity of embeddings, we can derive an understanding of the similarity of two pieces of data. One use case is to compare the embedding of a question with the embeddings of our Nodes to see which Nodes may contain the data needed to answer that question. Because the default service context is OpenAI, the default embedding is `OpenAIEmbedding`. If using different models, say through Ollama, use this [Embedding](/packages/llamaindex/src/embeddings/OllamaEmbedding.ts) (see all [here](/packages/llamaindex/src/embeddings)).
|
||||
- [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/llamaindex/src/indices/): Indices store the Nodes and the embeddings of those nodes. QueryEngines retrieve Nodes from these Indices using embedding similarity.
|
||||
- [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/llamaindex/src/engines/query/RetrieverQueryEngine.ts): Query engines are what generate the query you put in and give you back the result. Query engines generally combine a pre-built prompt with selected Nodes from your Index to give the LLM the context it needs to answer your query. To build a query engine from your Index (recommended), use the [`asQueryEngine`](/packages/llamaindex/src/indices/BaseIndex.ts) method on your Index. See all query engines [here](/packages/llamaindex/src/engines/query).
|
||||
- [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/llamaindex/src/engines/chat/SimpleChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices. See all chat engines [here](/packages/llamaindex/src/engines/chat).
|
||||
- [ChatEngine](/packages/core/src/ChatEngine.ts): A ChatEngine helps you build a chatbot that will interact with your Indices.
|
||||
|
||||
- [SimplePrompt](/packages/llamaindex/src/Prompt.ts): A simple standardized function call definition that takes in inputs and formats them in a template literal. SimplePrompts can be specialized using currying and combined using other SimplePrompt functions.
|
||||
- [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.
|
||||
|
||||
## Supported LLMs:
|
||||
|
||||
- OpenAI GPT-3.5-turbo and GPT-4
|
||||
- Anthropic Claude Instant and Claude 2
|
||||
- Llama2 Chat LLMs (70B, 13B, and 7B parameters)
|
||||
|
||||
## Contributing:
|
||||
|
||||
Please see our [contributing guide](CONTRIBUTING.md) for more information.
|
||||
You are highly encouraged to contribute to LlamaIndex.TS!
|
||||
We are in the very early days of LlamaIndex.TS. If you’re interested in hacking on it with us check out our [contributing guide](/CONTRIBUTING.md)
|
||||
|
||||
## Community
|
||||
## Bugs? Questions?
|
||||
|
||||
Please join our Discord! https://discord.com/invite/eN6D2HQ4aX
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Dependencies
|
||||
/node_modules
|
||||
|
||||
# Production
|
||||
/build
|
||||
|
||||
# Generated files
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
@@ -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.
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
Vendored
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Vendored
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@@ -0,0 +1,2 @@
|
||||
label: "API"
|
||||
position: 6
|
||||
@@ -0,0 +1,193 @@
|
||||
---
|
||||
id: "Anthropic"
|
||||
title: "Class: Anthropic"
|
||||
sidebar_label: "Anthropic"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Anthropic LLM implementation
|
||||
|
||||
## Implements
|
||||
|
||||
- [`LLM`](../interfaces/LLM.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Anthropic**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`Anthropic`](Anthropic.md)\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:387](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L387)
|
||||
|
||||
## Properties
|
||||
|
||||
### apiKey
|
||||
|
||||
• `Optional` **apiKey**: `string` = `undefined`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:380](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L380)
|
||||
|
||||
___
|
||||
|
||||
### callbackManager
|
||||
|
||||
• `Optional` **callbackManager**: [`CallbackManager`](CallbackManager.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:385](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L385)
|
||||
|
||||
___
|
||||
|
||||
### maxRetries
|
||||
|
||||
• **maxRetries**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:381](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L381)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• `Optional` **maxTokens**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:377](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L377)
|
||||
|
||||
___
|
||||
|
||||
### model
|
||||
|
||||
• **model**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:374](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L374)
|
||||
|
||||
___
|
||||
|
||||
### session
|
||||
|
||||
• **session**: `AnthropicSession`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:383](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L383)
|
||||
|
||||
___
|
||||
|
||||
### temperature
|
||||
|
||||
• **temperature**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:375](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L375)
|
||||
|
||||
___
|
||||
|
||||
### timeout
|
||||
|
||||
• `Optional` **timeout**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:382](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L382)
|
||||
|
||||
___
|
||||
|
||||
### topP
|
||||
|
||||
• **topP**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:376](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L376)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`messages`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
Get a chat response from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[LLM](../interfaces/LLM.md).[chat](../interfaces/LLM.md#chat)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:422](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L422)
|
||||
|
||||
___
|
||||
|
||||
### complete
|
||||
|
||||
▸ **complete**(`prompt`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
Get a prompt completion from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `prompt` | `string` | the prompt to complete |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[LLM](../interfaces/LLM.md).[complete](../interfaces/LLM.md#complete)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:440](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L440)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPrompt
|
||||
|
||||
▸ **mapMessagesToPrompt**(`messages`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:407](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L407)
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
id: "BaseEmbedding"
|
||||
title: "Class: BaseEmbedding"
|
||||
sidebar_label: "BaseEmbedding"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`BaseEmbedding`**
|
||||
|
||||
↳ [`OpenAIEmbedding`](OpenAIEmbedding.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new BaseEmbedding**()
|
||||
|
||||
## Methods
|
||||
|
||||
### getQueryEmbedding
|
||||
|
||||
▸ `Abstract` **getQueryEmbedding**(`query`): `Promise`<`number`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:213](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
### getTextEmbedding
|
||||
|
||||
▸ `Abstract` **getTextEmbedding**(`text`): `Promise`<`number`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `text` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:212](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L212)
|
||||
|
||||
___
|
||||
|
||||
### similarity
|
||||
|
||||
▸ **similarity**(`embedding1`, `embedding2`, `mode?`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `embedding1` | `number`[] | `undefined` |
|
||||
| `embedding2` | `number`[] | `undefined` |
|
||||
| `mode` | [`SimilarityType`](../enums/SimilarityType.md) | `SimilarityType.DEFAULT` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:204](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L204)
|
||||
@@ -0,0 +1,153 @@
|
||||
---
|
||||
id: "BaseIndex"
|
||||
title: "Class: BaseIndex<T>"
|
||||
sidebar_label: "BaseIndex"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Indexes are the data structure that we store our nodes and embeddings in so
|
||||
they can be retrieved for our queries.
|
||||
|
||||
## Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`BaseIndex`**
|
||||
|
||||
↳ [`ListIndex`](ListIndex.md)
|
||||
|
||||
↳ [`VectorStoreIndex`](VectorStoreIndex.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new BaseIndex**<`T`\>(`init`)
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | [`BaseIndexInit`](../interfaces/BaseIndexInit.md)<`T`\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:127](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L127)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `BaseDocumentStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:122](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L122)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: `T`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:125](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:120](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L120)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](../interfaces/StorageContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• `Optional` **vectorStore**: [`VectorStore`](../interfaces/VectorStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:123](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L123)
|
||||
|
||||
## Methods
|
||||
|
||||
### asQueryEngine
|
||||
|
||||
▸ `Abstract` **asQueryEngine**(`options?`): [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
Create a new query engine from the index. It will also create a retriever
|
||||
and response synthezier if they are not provided.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `options?` | `Object` | you can supply your own custom Retriever and ResponseSynthesizer |
|
||||
| `options.responseSynthesizer?` | [`ResponseSynthesizer`](ResponseSynthesizer.md) | - |
|
||||
| `options.retriever?` | [`BaseRetriever`](../interfaces/BaseRetriever.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:147](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### asRetriever
|
||||
|
||||
▸ `Abstract` **asRetriever**(`options?`): [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
Create a new retriever from the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:140](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L140)
|
||||
@@ -0,0 +1,303 @@
|
||||
---
|
||||
id: "BaseNode"
|
||||
title: "Class: BaseNode"
|
||||
sidebar_label: "BaseNode"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Generic abstract class for retrievable nodes
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`BaseNode`**
|
||||
|
||||
↳ [`TextNode`](TextNode.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new BaseNode**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`BaseNode`](BaseNode.md)\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:48](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L48)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:39](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:43](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:44](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:38](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### relationships
|
||||
|
||||
• **relationships**: `Partial`<`Record`<[`NodeRelationship`](../enums/NodeRelationship.md), [`RelatedNodeType`](../modules.md#relatednodetype)\>\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:104](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:84](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### nodeId
|
||||
|
||||
• `get` **nodeId**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:58](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:94](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:72](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L62)
|
||||
|
||||
## Methods
|
||||
|
||||
### asRelatedNodeInfo
|
||||
|
||||
▸ **asRelatedNodeInfo**(): [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### getContent
|
||||
|
||||
▸ `Abstract` **getContent**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:54](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:116](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### getMetadataStr
|
||||
|
||||
▸ `Abstract` **getMetadataStr**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:55](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ `Abstract` **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:52](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ `Abstract` **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:56](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### toJSON
|
||||
|
||||
▸ **toJSON**(): `Record`<`string`, `any`\>
|
||||
|
||||
Used with built in JSON.stringify
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:136](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L136)
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
id: "CallbackManager"
|
||||
title: "Class: CallbackManager"
|
||||
sidebar_label: "CallbackManager"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Implements
|
||||
|
||||
- `CallbackManagerMethods`
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new CallbackManager**(`handlers?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `handlers?` | `CallbackManagerMethods` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:67](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L67)
|
||||
|
||||
## Properties
|
||||
|
||||
### onLLMStream
|
||||
|
||||
• `Optional` **onLLMStream**: (`params`: [`StreamCallbackResponse`](../interfaces/StreamCallbackResponse.md)) => `void` \| `Promise`<`void`\>
|
||||
|
||||
#### Type declaration
|
||||
|
||||
▸ (`params`): `void` \| `Promise`<`void`\>
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `params` | [`StreamCallbackResponse`](../interfaces/StreamCallbackResponse.md) |
|
||||
|
||||
##### Returns
|
||||
|
||||
`void` \| `Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
CallbackManagerMethods.onLLMStream
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:64](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### onRetrieve
|
||||
|
||||
• `Optional` **onRetrieve**: (`params`: [`RetrievalCallbackResponse`](../interfaces/RetrievalCallbackResponse.md)) => `void` \| `Promise`<`void`\>
|
||||
|
||||
#### Type declaration
|
||||
|
||||
▸ (`params`): `void` \| `Promise`<`void`\>
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `params` | [`RetrievalCallbackResponse`](../interfaces/RetrievalCallbackResponse.md) |
|
||||
|
||||
##### Returns
|
||||
|
||||
`void` \| `Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
CallbackManagerMethods.onRetrieve
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L65)
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
id: "CompactAndRefine"
|
||||
title: "Class: CompactAndRefine"
|
||||
sidebar_label: "CompactAndRefine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
CompactAndRefine is a slight variation of Refine that first compacts the text chunks into the smallest possible number of chunks.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`Refine`](Refine.md)
|
||||
|
||||
↳ **`CompactAndRefine`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new CompactAndRefine**(`serviceContext`, `textQATemplate?`, `refineTemplate?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `serviceContext` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
| `textQATemplate?` | [`SimplePrompt`](../modules.md#simpleprompt) |
|
||||
| `refineTemplate?` | [`SimplePrompt`](../modules.md#simpleprompt) |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[Refine](Refine.md).[constructor](Refine.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:78](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L78)
|
||||
|
||||
## Properties
|
||||
|
||||
### refineTemplate
|
||||
|
||||
• **refineTemplate**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[Refine](Refine.md).[refineTemplate](Refine.md#refinetemplate)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:76](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L76)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[Refine](Refine.md).[serviceContext](Refine.md#servicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:74](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### textQATemplate
|
||||
|
||||
• **textQATemplate**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[Refine](Refine.md).[textQATemplate](Refine.md#textqatemplate)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L75)
|
||||
|
||||
## Methods
|
||||
|
||||
### getResponse
|
||||
|
||||
▸ **getResponse**(`query`, `textChunks`, `parentEvent?`, `prevResponse?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `textChunks` | `string`[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
| `prevResponse?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[Refine](Refine.md).[getResponse](Refine.md#getresponse)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:181](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L181)
|
||||
@@ -0,0 +1,148 @@
|
||||
---
|
||||
id: "CondenseQuestionChatEngine"
|
||||
title: "Class: CondenseQuestionChatEngine"
|
||||
sidebar_label: "CondenseQuestionChatEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
CondenseQuestionChatEngine is used in conjunction with a Index (for example VectorStoreIndex).
|
||||
It does two steps on taking a user's chat message: first, it condenses the chat message
|
||||
with the previous chat history into a question with more context.
|
||||
Then, it queries the underlying Index using the new question with context and returns
|
||||
the response.
|
||||
CondenseQuestionChatEngine performs well when the input is primarily questions about the
|
||||
underlying data. It performs less well when the chat messages are not questions about the
|
||||
data, or are very referential to previous context.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`ChatEngine`](../interfaces/ChatEngine.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new CondenseQuestionChatEngine**(`init`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | `Object` |
|
||||
| `init.chatHistory` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `init.condenseMessagePrompt?` | [`SimplePrompt`](../modules.md#simpleprompt) |
|
||||
| `init.queryEngine` | [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md) |
|
||||
| `init.serviceContext?` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L75)
|
||||
|
||||
## Properties
|
||||
|
||||
### chatHistory
|
||||
|
||||
• **chatHistory**: [`ChatMessage`](../interfaces/ChatMessage.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:71](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L71)
|
||||
|
||||
___
|
||||
|
||||
### condenseMessagePrompt
|
||||
|
||||
• **condenseMessagePrompt**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:73](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
### queryEngine
|
||||
|
||||
• **queryEngine**: [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:70](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:72](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L72)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`message`, `chatHistory?`): `Promise`<[`Response`](Response.md)\>
|
||||
|
||||
Send message along with the class's current chat history to the LLM.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `message` | `string` | |
|
||||
| `chatHistory?` | [`ChatMessage`](../interfaces/ChatMessage.md)[] | optional chat history if you want to customize the chat history |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[ChatEngine](../interfaces/ChatEngine.md).[chat](../interfaces/ChatEngine.md#chat)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:100](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L100)
|
||||
|
||||
___
|
||||
|
||||
### condenseQuestion
|
||||
|
||||
▸ `Private` **condenseQuestion**(`chatHistory`, `question`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `chatHistory` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `question` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:89](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L89)
|
||||
|
||||
___
|
||||
|
||||
### reset
|
||||
|
||||
▸ **reset**(): `void`
|
||||
|
||||
Resets the chat history so that it's empty.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[ChatEngine](../interfaces/ChatEngine.md).[reset](../interfaces/ChatEngine.md#reset)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:118](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L118)
|
||||
@@ -0,0 +1,111 @@
|
||||
---
|
||||
id: "ContextChatEngine"
|
||||
title: "Class: ContextChatEngine"
|
||||
sidebar_label: "ContextChatEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
ContextChatEngine uses the Index to get the appropriate context for each query.
|
||||
The context is stored in the system prompt, and the chat history is preserved,
|
||||
ideally allowing the appropriate context to be surfaced for each query.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`ChatEngine`](../interfaces/ChatEngine.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new ContextChatEngine**(`init`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | `Object` |
|
||||
| `init.chatHistory?` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `init.chatModel?` | [`OpenAI`](OpenAI.md) |
|
||||
| `init.retriever` | [`BaseRetriever`](../interfaces/BaseRetriever.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:133](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L133)
|
||||
|
||||
## Properties
|
||||
|
||||
### chatHistory
|
||||
|
||||
• **chatHistory**: [`ChatMessage`](../interfaces/ChatMessage.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:131](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L131)
|
||||
|
||||
___
|
||||
|
||||
### chatModel
|
||||
|
||||
• **chatModel**: [`OpenAI`](OpenAI.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:130](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L130)
|
||||
|
||||
___
|
||||
|
||||
### retriever
|
||||
|
||||
• **retriever**: [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:129](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L129)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`message`, `chatHistory?`): `Promise`<[`Response`](Response.md)\>
|
||||
|
||||
Send message along with the class's current chat history to the LLM.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `message` | `string` | |
|
||||
| `chatHistory?` | [`ChatMessage`](../interfaces/ChatMessage.md)[] | optional chat history if you want to customize the chat history |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[ChatEngine](../interfaces/ChatEngine.md).[chat](../interfaces/ChatEngine.md#chat)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:144](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L144)
|
||||
|
||||
___
|
||||
|
||||
### reset
|
||||
|
||||
▸ **reset**(): `void`
|
||||
|
||||
Resets the chat history so that it's empty.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[ChatEngine](../interfaces/ChatEngine.md).[reset](../interfaces/ChatEngine.md#reset)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:182](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L182)
|
||||
@@ -0,0 +1,516 @@
|
||||
---
|
||||
id: "Document"
|
||||
title: "Class: Document"
|
||||
sidebar_label: "Document"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A document is just a special text node with a docId.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`TextNode`](TextNode.md)
|
||||
|
||||
↳ **`Document`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Document**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`Document`](Document.md)\> |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[TextNode](TextNode.md).[constructor](TextNode.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:229](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L229)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[embedding](TextNode.md#embedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:39](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### endCharIdx
|
||||
|
||||
• `Optional` **endCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[endCharIdx](TextNode.md#endcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:147](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedEmbedMetadataKeys](TextNode.md#excludedembedmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:43](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedLlmMetadataKeys](TextNode.md#excludedllmmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:44](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[hash](TextNode.md#hash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[id_](TextNode.md#id_)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:38](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadata](TextNode.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### metadataSeparator
|
||||
|
||||
• **metadataSeparator**: `string` = `"\n"`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadataSeparator](TextNode.md#metadataseparator)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L150)
|
||||
|
||||
___
|
||||
|
||||
### relationships
|
||||
|
||||
• **relationships**: `Partial`<`Record`<[`NodeRelationship`](../enums/NodeRelationship.md), [`RelatedNodeType`](../modules.md#relatednodetype)\>\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[relationships](TextNode.md#relationships)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### startCharIdx
|
||||
|
||||
• `Optional` **startCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[startCharIdx](TextNode.md#startcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:146](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L146)
|
||||
|
||||
___
|
||||
|
||||
### text
|
||||
|
||||
• **text**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[text](TextNode.md#text)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:145](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L145)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.childNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:104](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### docId
|
||||
|
||||
• `get` **docId**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:238](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L238)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.nextNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:84](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### nodeId
|
||||
|
||||
• `get` **nodeId**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.nodeId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:58](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.parentNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:94](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.prevNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:72](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.sourceNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L62)
|
||||
|
||||
## Methods
|
||||
|
||||
### asRelatedNodeInfo
|
||||
|
||||
▸ **asRelatedNodeInfo**(): [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[asRelatedNodeInfo](TextNode.md#asrelatednodeinfo)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ **generateHash**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[generateHash](TextNode.md#generatehash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:157](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L157)
|
||||
|
||||
___
|
||||
|
||||
### getContent
|
||||
|
||||
▸ **getContent**(`metadataMode?`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) | `MetadataMode.NONE` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getContent](TextNode.md#getcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:165](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L165)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getEmbedding](TextNode.md#getembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:116](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### getMetadataStr
|
||||
|
||||
▸ **getMetadataStr**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getMetadataStr](TextNode.md#getmetadatastr)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:170](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L170)
|
||||
|
||||
___
|
||||
|
||||
### getNodeInfo
|
||||
|
||||
▸ **getNodeInfo**(): `Object`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `end` | `undefined` \| `number` |
|
||||
| `start` | `undefined` \| `number` |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getNodeInfo](TextNode.md#getnodeinfo)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:195](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L195)
|
||||
|
||||
___
|
||||
|
||||
### getText
|
||||
|
||||
▸ **getText**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getText](TextNode.md#gettext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:199](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L199)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[TextNode](TextNode.md).[getType](TextNode.md#gettype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:234](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L234)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[setContent](TextNode.md#setcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:191](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L191)
|
||||
|
||||
___
|
||||
|
||||
### toJSON
|
||||
|
||||
▸ **toJSON**(): `Record`<`string`, `any`\>
|
||||
|
||||
Used with built in JSON.stringify
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `any`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[toJSON](TextNode.md#tojson)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:136](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L136)
|
||||
@@ -0,0 +1,129 @@
|
||||
---
|
||||
id: "InMemoryFileSystem"
|
||||
title: "Class: InMemoryFileSystem"
|
||||
sidebar_label: "InMemoryFileSystem"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A filesystem implementation that stores files in memory.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`GenericFileSystem`](../interfaces/GenericFileSystem.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new InMemoryFileSystem**()
|
||||
|
||||
## Properties
|
||||
|
||||
### files
|
||||
|
||||
• `Private` **files**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:25](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L25)
|
||||
|
||||
## Methods
|
||||
|
||||
### access
|
||||
|
||||
▸ **access**(`path`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[GenericFileSystem](../interfaces/GenericFileSystem.md).[access](../interfaces/GenericFileSystem.md#access)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:38](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### mkdir
|
||||
|
||||
▸ **mkdir**(`path`, `options?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[GenericFileSystem](../interfaces/GenericFileSystem.md).[mkdir](../interfaces/GenericFileSystem.md#mkdir)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:44](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### readFile
|
||||
|
||||
▸ **readFile**(`path`, `options?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[GenericFileSystem](../interfaces/GenericFileSystem.md).[readFile](../interfaces/GenericFileSystem.md#readfile)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:31](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### writeFile
|
||||
|
||||
▸ **writeFile**(`path`, `content`, `options?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
| `content` | `string` |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[GenericFileSystem](../interfaces/GenericFileSystem.md).[writeFile](../interfaces/GenericFileSystem.md#writefile)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:27](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L27)
|
||||
@@ -0,0 +1,151 @@
|
||||
---
|
||||
id: "IndexDict"
|
||||
title: "Class: IndexDict"
|
||||
sidebar_label: "IndexDict"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
The underlying structure of each index.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`IndexStruct`](IndexStruct.md)
|
||||
|
||||
↳ **`IndexDict`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new IndexDict**(`indexId?`, `summary?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `indexId` | `string` | `undefined` |
|
||||
| `summary` | `undefined` | `undefined` |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[constructor](IndexStruct.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L19)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `Record`<`string`, [`Document`](Document.md)\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### indexId
|
||||
|
||||
• **indexId**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[indexId](IndexStruct.md#indexid)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### nodesDict
|
||||
|
||||
• **nodesDict**: `Record`<`string`, [`BaseNode`](BaseNode.md)\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### summary
|
||||
|
||||
• `Optional` **summary**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[summary](IndexStruct.md#summary)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: [`IndexStructType`](../enums/IndexStructType.md) = `IndexStructType.SIMPLE_DICT`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:47](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L47)
|
||||
|
||||
## Methods
|
||||
|
||||
### addNode
|
||||
|
||||
▸ **addNode**(`node`, `textId?`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `node` | [`BaseNode`](BaseNode.md) |
|
||||
| `textId?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:56](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### getSummary
|
||||
|
||||
▸ **getSummary**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[IndexStruct](IndexStruct.md).[getSummary](IndexStruct.md#getsummary)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### toJson
|
||||
|
||||
▸ **toJson**(): `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `unknown`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[IndexStruct](IndexStruct.md).[toJson](IndexStruct.md#tojson)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:61](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L61)
|
||||
@@ -0,0 +1,140 @@
|
||||
---
|
||||
id: "IndexList"
|
||||
title: "Class: IndexList"
|
||||
sidebar_label: "IndexList"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
The underlying structure of each index.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`IndexStruct`](IndexStruct.md)
|
||||
|
||||
↳ **`IndexList`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new IndexList**(`indexId?`, `summary?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `indexId` | `string` | `undefined` |
|
||||
| `summary` | `undefined` | `undefined` |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[constructor](IndexStruct.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L19)
|
||||
|
||||
## Properties
|
||||
|
||||
### indexId
|
||||
|
||||
• **indexId**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[indexId](IndexStruct.md#indexid)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### nodes
|
||||
|
||||
• **nodes**: `string`[] = `[]`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:90](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L90)
|
||||
|
||||
___
|
||||
|
||||
### summary
|
||||
|
||||
• `Optional` **summary**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[summary](IndexStruct.md#summary)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: [`IndexStructType`](../enums/IndexStructType.md) = `IndexStructType.LIST`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:91](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L91)
|
||||
|
||||
## Methods
|
||||
|
||||
### addNode
|
||||
|
||||
▸ **addNode**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `node` | [`BaseNode`](BaseNode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:93](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L93)
|
||||
|
||||
___
|
||||
|
||||
### getSummary
|
||||
|
||||
▸ **getSummary**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[IndexStruct](IndexStruct.md).[getSummary](IndexStruct.md#getsummary)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:31](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### toJson
|
||||
|
||||
▸ **toJson**(): `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `unknown`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[IndexStruct](IndexStruct.md).[toJson](IndexStruct.md#tojson)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:97](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L97)
|
||||
@@ -0,0 +1,512 @@
|
||||
---
|
||||
id: "IndexNode"
|
||||
title: "Class: IndexNode"
|
||||
sidebar_label: "IndexNode"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
TextNode is the default node type for text. Most common node type in LlamaIndex.TS
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`TextNode`](TextNode.md)
|
||||
|
||||
↳ **`IndexNode`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new IndexNode**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`IndexNode`](IndexNode.md)\> |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[TextNode](TextNode.md).[constructor](TextNode.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:215](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L215)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[embedding](TextNode.md#embedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:39](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### endCharIdx
|
||||
|
||||
• `Optional` **endCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[endCharIdx](TextNode.md#endcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:147](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedEmbedMetadataKeys](TextNode.md#excludedembedmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:43](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedLlmMetadataKeys](TextNode.md#excludedllmmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:44](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[hash](TextNode.md#hash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[id_](TextNode.md#id_)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:38](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### indexId
|
||||
|
||||
• **indexId**: `string` = `""`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:213](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadata](TextNode.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### metadataSeparator
|
||||
|
||||
• **metadataSeparator**: `string` = `"\n"`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadataSeparator](TextNode.md#metadataseparator)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L150)
|
||||
|
||||
___
|
||||
|
||||
### relationships
|
||||
|
||||
• **relationships**: `Partial`<`Record`<[`NodeRelationship`](../enums/NodeRelationship.md), [`RelatedNodeType`](../modules.md#relatednodetype)\>\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[relationships](TextNode.md#relationships)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### startCharIdx
|
||||
|
||||
• `Optional` **startCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[startCharIdx](TextNode.md#startcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:146](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L146)
|
||||
|
||||
___
|
||||
|
||||
### text
|
||||
|
||||
• **text**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[text](TextNode.md#text)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:145](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L145)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.childNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:104](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.nextNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:84](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### nodeId
|
||||
|
||||
• `get` **nodeId**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.nodeId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:58](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.parentNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:94](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.prevNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:72](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.sourceNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L62)
|
||||
|
||||
## Methods
|
||||
|
||||
### asRelatedNodeInfo
|
||||
|
||||
▸ **asRelatedNodeInfo**(): [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[asRelatedNodeInfo](TextNode.md#asrelatednodeinfo)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ **generateHash**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[generateHash](TextNode.md#generatehash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:157](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L157)
|
||||
|
||||
___
|
||||
|
||||
### getContent
|
||||
|
||||
▸ **getContent**(`metadataMode?`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) | `MetadataMode.NONE` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getContent](TextNode.md#getcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:165](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L165)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getEmbedding](TextNode.md#getembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:116](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### getMetadataStr
|
||||
|
||||
▸ **getMetadataStr**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getMetadataStr](TextNode.md#getmetadatastr)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:170](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L170)
|
||||
|
||||
___
|
||||
|
||||
### getNodeInfo
|
||||
|
||||
▸ **getNodeInfo**(): `Object`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `end` | `undefined` \| `number` |
|
||||
| `start` | `undefined` \| `number` |
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getNodeInfo](TextNode.md#getnodeinfo)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:195](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L195)
|
||||
|
||||
___
|
||||
|
||||
### getText
|
||||
|
||||
▸ **getText**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getText](TextNode.md#gettext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:199](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L199)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[TextNode](TextNode.md).[getType](TextNode.md#gettype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:220](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L220)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[setContent](TextNode.md#setcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:191](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L191)
|
||||
|
||||
___
|
||||
|
||||
### toJSON
|
||||
|
||||
▸ **toJSON**(): `Record`<`string`, `any`\>
|
||||
|
||||
Used with built in JSON.stringify
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `any`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[toJSON](TextNode.md#tojson)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:136](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L136)
|
||||
@@ -0,0 +1,82 @@
|
||||
---
|
||||
id: "IndexStruct"
|
||||
title: "Class: IndexStruct"
|
||||
sidebar_label: "IndexStruct"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
The underlying structure of each index.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`IndexStruct`**
|
||||
|
||||
↳ [`IndexDict`](IndexDict.md)
|
||||
|
||||
↳ [`IndexList`](IndexList.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new IndexStruct**(`indexId?`, `summary?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `indexId` | `string` | `undefined` |
|
||||
| `summary` | `undefined` | `undefined` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L19)
|
||||
|
||||
## Properties
|
||||
|
||||
### indexId
|
||||
|
||||
• **indexId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### summary
|
||||
|
||||
• `Optional` **summary**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L17)
|
||||
|
||||
## Methods
|
||||
|
||||
### getSummary
|
||||
|
||||
▸ **getSummary**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:31](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### toJson
|
||||
|
||||
▸ **toJson**(): `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `unknown`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:24](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L24)
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
id: "LLMQuestionGenerator"
|
||||
title: "Class: LLMQuestionGenerator"
|
||||
sidebar_label: "LLMQuestionGenerator"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
LLMQuestionGenerator uses the LLM to generate new questions for the LLM using tools and a user query.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseQuestionGenerator`](../interfaces/BaseQuestionGenerator.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new LLMQuestionGenerator**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`LLMQuestionGenerator`](LLMQuestionGenerator.md)\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QuestionGenerator.ts:34](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QuestionGenerator.ts#L34)
|
||||
|
||||
## Properties
|
||||
|
||||
### llm
|
||||
|
||||
• **llm**: [`LLM`](../interfaces/LLM.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QuestionGenerator.ts:30](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QuestionGenerator.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### outputParser
|
||||
|
||||
• **outputParser**: [`BaseOutputParser`](../interfaces/BaseOutputParser.md)<[`StructuredOutput`](../interfaces/StructuredOutput.md)<[`SubQuestion`](../interfaces/SubQuestion.md)[]\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QuestionGenerator.ts:32](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QuestionGenerator.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### prompt
|
||||
|
||||
• **prompt**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QuestionGenerator.ts:31](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QuestionGenerator.ts#L31)
|
||||
|
||||
## Methods
|
||||
|
||||
### generate
|
||||
|
||||
▸ **generate**(`tools`, `query`): `Promise`<[`SubQuestion`](../interfaces/SubQuestion.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `tools` | [`ToolMetadata`](../interfaces/ToolMetadata.md)[] |
|
||||
| `query` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SubQuestion`](../interfaces/SubQuestion.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseQuestionGenerator](../interfaces/BaseQuestionGenerator.md).[generate](../interfaces/BaseQuestionGenerator.md#generate)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QuestionGenerator.ts:40](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QuestionGenerator.ts#L40)
|
||||
@@ -0,0 +1,294 @@
|
||||
---
|
||||
id: "ListIndex"
|
||||
title: "Class: ListIndex"
|
||||
sidebar_label: "ListIndex"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A ListIndex keeps nodes in a sequential list structure
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`BaseIndex`](BaseIndex.md)<[`IndexList`](IndexList.md)\>
|
||||
|
||||
↳ **`ListIndex`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new ListIndex**(`init`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | [`BaseIndexInit`](../interfaces/BaseIndexInit.md)<[`IndexList`](IndexList.md)\> |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[constructor](BaseIndex.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:43](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L43)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `BaseDocumentStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[docStore](BaseIndex.md#docstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:122](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L122)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStore](BaseIndex.md#indexstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: [`IndexList`](IndexList.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStruct](BaseIndex.md#indexstruct)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:125](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[serviceContext](BaseIndex.md#servicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:120](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L120)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](../interfaces/StorageContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[storageContext](BaseIndex.md#storagecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• `Optional` **vectorStore**: [`VectorStore`](../interfaces/VectorStore.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[vectorStore](BaseIndex.md#vectorstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:123](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L123)
|
||||
|
||||
## Methods
|
||||
|
||||
### \_deleteNode
|
||||
|
||||
▸ `Protected` **_deleteNode**(`nodeId`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodeId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:193](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L193)
|
||||
|
||||
___
|
||||
|
||||
### \_insert
|
||||
|
||||
▸ `Protected` **_insert**(`nodes`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:187](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L187)
|
||||
|
||||
___
|
||||
|
||||
### asQueryEngine
|
||||
|
||||
▸ **asQueryEngine**(`options?`): [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
Create a new query engine from the index. It will also create a retriever
|
||||
and response synthezier if they are not provided.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `options?` | `Object` | you can supply your own custom Retriever and ResponseSynthesizer |
|
||||
| `options.responseSynthesizer?` | [`ResponseSynthesizer`](ResponseSynthesizer.md) | - |
|
||||
| `options.retriever?` | [`BaseRetriever`](../interfaces/BaseRetriever.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[asQueryEngine](BaseIndex.md#asqueryengine)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:151](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L151)
|
||||
|
||||
___
|
||||
|
||||
### asRetriever
|
||||
|
||||
▸ **asRetriever**(`options?`): [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
Create a new retriever from the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `options?` | `Object` |
|
||||
| `options.mode` | [`ListRetrieverMode`](../enums/ListRetrieverMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[asRetriever](BaseIndex.md#asretriever)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:138](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L138)
|
||||
|
||||
___
|
||||
|
||||
### getRefDocInfo
|
||||
|
||||
▸ **getRefDocInfo**(): `Promise`<`Record`<`string`, `RefDocInfo`\>\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`string`, `RefDocInfo`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:199](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L199)
|
||||
|
||||
___
|
||||
|
||||
### \_buildIndexFromNodes
|
||||
|
||||
▸ `Static` **_buildIndexFromNodes**(`nodes`, `docStore`, `indexStruct?`): `Promise`<[`IndexList`](IndexList.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] |
|
||||
| `docStore` | `BaseDocumentStore` |
|
||||
| `indexStruct?` | [`IndexList`](IndexList.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IndexList`](IndexList.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:172](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L172)
|
||||
|
||||
___
|
||||
|
||||
### fromDocuments
|
||||
|
||||
▸ `Static` **fromDocuments**(`documents`, `args?`): `Promise`<[`ListIndex`](ListIndex.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `documents` | [`Document`](Document.md)[] |
|
||||
| `args` | `Object` |
|
||||
| `args.serviceContext?` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
| `args.storageContext?` | [`StorageContext`](../interfaces/StorageContext.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ListIndex`](ListIndex.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:112](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L112)
|
||||
|
||||
___
|
||||
|
||||
### init
|
||||
|
||||
▸ `Static` **init**(`options`): `Promise`<[`ListIndex`](ListIndex.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `options` | `ListIndexOptions` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ListIndex`](ListIndex.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:47](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L47)
|
||||
@@ -0,0 +1,137 @@
|
||||
---
|
||||
id: "ListIndexLLMRetriever"
|
||||
title: "Class: ListIndexLLMRetriever"
|
||||
sidebar_label: "ListIndexLLMRetriever"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
LLM retriever for ListIndex.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new ListIndexLLMRetriever**(`index`, `choiceSelectPrompt?`, `choiceBatchSize?`, `formatNodeBatchFn?`, `parseChoiceSelectAnswerFn?`, `serviceContext?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `index` | [`ListIndex`](ListIndex.md) | `undefined` |
|
||||
| `choiceSelectPrompt?` | [`SimplePrompt`](../modules.md#simpleprompt) | `undefined` |
|
||||
| `choiceBatchSize` | `number` | `10` |
|
||||
| `formatNodeBatchFn?` | `NodeFormatterFunction` | `undefined` |
|
||||
| `parseChoiceSelectAnswerFn?` | `ChoiceSelectParserFunction` | `undefined` |
|
||||
| `serviceContext?` | [`ServiceContext`](../interfaces/ServiceContext.md) | `undefined` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:64](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L64)
|
||||
|
||||
## Properties
|
||||
|
||||
### choiceBatchSize
|
||||
|
||||
• **choiceBatchSize**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:59](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L59)
|
||||
|
||||
___
|
||||
|
||||
### choiceSelectPrompt
|
||||
|
||||
• **choiceSelectPrompt**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:58](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### formatNodeBatchFn
|
||||
|
||||
• **formatNodeBatchFn**: `NodeFormatterFunction`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:60](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L60)
|
||||
|
||||
___
|
||||
|
||||
### index
|
||||
|
||||
• **index**: [`ListIndex`](ListIndex.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:57](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### parseChoiceSelectAnswerFn
|
||||
|
||||
• **parseChoiceSelectAnswerFn**: `ChoiceSelectParserFunction`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:61](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L61)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L62)
|
||||
|
||||
## Methods
|
||||
|
||||
### getServiceContext
|
||||
|
||||
▸ **getServiceContext**(): [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseRetriever](../interfaces/BaseRetriever.md).[getServiceContext](../interfaces/BaseRetriever.md#getservicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:127](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`query`, `parentEvent?`): `Promise`<[`NodeWithScore`](../interfaces/NodeWithScore.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`NodeWithScore`](../interfaces/NodeWithScore.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseRetriever](../interfaces/BaseRetriever.md).[retrieve](../interfaces/BaseRetriever.md#retrieve)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:81](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L81)
|
||||
@@ -0,0 +1,82 @@
|
||||
---
|
||||
id: "ListIndexRetriever"
|
||||
title: "Class: ListIndexRetriever"
|
||||
sidebar_label: "ListIndexRetriever"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Simple retriever for ListIndex that returns all nodes
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new ListIndexRetriever**(`index`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `index` | [`ListIndex`](ListIndex.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:22](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L22)
|
||||
|
||||
## Properties
|
||||
|
||||
### index
|
||||
|
||||
• **index**: [`ListIndex`](ListIndex.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:20](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L20)
|
||||
|
||||
## Methods
|
||||
|
||||
### getServiceContext
|
||||
|
||||
▸ **getServiceContext**(): [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseRetriever](../interfaces/BaseRetriever.md).[getServiceContext](../interfaces/BaseRetriever.md#getservicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:48](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`query`, `parentEvent?`): `Promise`<[`NodeWithScore`](../interfaces/NodeWithScore.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`NodeWithScore`](../interfaces/NodeWithScore.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseRetriever](../interfaces/BaseRetriever.md).[retrieve](../interfaces/BaseRetriever.md#retrieve)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndexRetriever.ts:26](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndexRetriever.ts#L26)
|
||||
@@ -0,0 +1,224 @@
|
||||
---
|
||||
id: "LlamaDeuce"
|
||||
title: "Class: LlamaDeuce"
|
||||
sidebar_label: "LlamaDeuce"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Llama2 LLM implementation
|
||||
|
||||
## Implements
|
||||
|
||||
- [`LLM`](../interfaces/LLM.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new LlamaDeuce**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`LlamaDeuce`](LlamaDeuce.md)\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:242](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L242)
|
||||
|
||||
## Properties
|
||||
|
||||
### chatStrategy
|
||||
|
||||
• **chatStrategy**: [`DeuceChatStrategy`](../enums/DeuceChatStrategy.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:236](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L236)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• `Optional` **maxTokens**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:239](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L239)
|
||||
|
||||
___
|
||||
|
||||
### model
|
||||
|
||||
• **model**: ``"Llama-2-70b-chat"`` \| ``"Llama-2-13b-chat"`` \| ``"Llama-2-7b-chat"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:235](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L235)
|
||||
|
||||
___
|
||||
|
||||
### replicateSession
|
||||
|
||||
• **replicateSession**: `ReplicateSession`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:240](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L240)
|
||||
|
||||
___
|
||||
|
||||
### temperature
|
||||
|
||||
• **temperature**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:237](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L237)
|
||||
|
||||
___
|
||||
|
||||
### topP
|
||||
|
||||
• **topP**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:238](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L238)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`messages`, `_parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
Get a chat response from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `_parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[LLM](../interfaces/LLM.md).[chat](../interfaces/LLM.md#chat)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:333](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L333)
|
||||
|
||||
___
|
||||
|
||||
### complete
|
||||
|
||||
▸ **complete**(`prompt`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
Get a prompt completion from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `prompt` | `string` | the prompt to complete |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[LLM](../interfaces/LLM.md).[complete](../interfaces/LLM.md#complete)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:360](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L360)
|
||||
|
||||
___
|
||||
|
||||
### mapMessageTypeA16Z
|
||||
|
||||
▸ **mapMessageTypeA16Z**(`messageType`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messageType` | [`MessageType`](../modules.md#messagetype) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:274](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L274)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPrompt
|
||||
|
||||
▸ **mapMessagesToPrompt**(`messages`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:251](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L251)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPromptA16Z
|
||||
|
||||
▸ **mapMessagesToPromptA16Z**(`messages`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:263](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L263)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPromptMeta
|
||||
|
||||
▸ **mapMessagesToPromptMeta**(`messages`, `withBos?`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] | `undefined` |
|
||||
| `withBos` | `boolean` | `false` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:287](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L287)
|
||||
@@ -0,0 +1,193 @@
|
||||
---
|
||||
id: "OpenAI"
|
||||
title: "Class: OpenAI"
|
||||
sidebar_label: "OpenAI"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
OpenAI LLM implementation
|
||||
|
||||
## Implements
|
||||
|
||||
- [`LLM`](../interfaces/LLM.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new OpenAI**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`OpenAI`](OpenAI.md)\> & { `azure?`: `AzureOpenAIConfig` } |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:94](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L94)
|
||||
|
||||
## Properties
|
||||
|
||||
### apiKey
|
||||
|
||||
• `Optional` **apiKey**: `string` = `undefined`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:87](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### callbackManager
|
||||
|
||||
• `Optional` **callbackManager**: [`CallbackManager`](CallbackManager.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:92](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L92)
|
||||
|
||||
___
|
||||
|
||||
### maxRetries
|
||||
|
||||
• **maxRetries**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:88](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• `Optional` **maxTokens**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:84](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### model
|
||||
|
||||
• **model**: ``"gpt-3.5-turbo"`` \| ``"gpt-3.5-turbo-16k"`` \| ``"gpt-4"`` \| ``"gpt-4-32k"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:81](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L81)
|
||||
|
||||
___
|
||||
|
||||
### session
|
||||
|
||||
• **session**: `OpenAISession`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:90](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L90)
|
||||
|
||||
___
|
||||
|
||||
### temperature
|
||||
|
||||
• **temperature**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:82](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L82)
|
||||
|
||||
___
|
||||
|
||||
### timeout
|
||||
|
||||
• `Optional` **timeout**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:89](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L89)
|
||||
|
||||
___
|
||||
|
||||
### topP
|
||||
|
||||
• **topP**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:83](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L83)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`messages`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
Get a chat response from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[LLM](../interfaces/LLM.md).[chat](../interfaces/LLM.md#chat)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:157](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L157)
|
||||
|
||||
___
|
||||
|
||||
### complete
|
||||
|
||||
▸ **complete**(`prompt`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
Get a prompt completion from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `prompt` | `string` | the prompt to complete |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[LLM](../interfaces/LLM.md).[complete](../interfaces/LLM.md#complete)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:197](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L197)
|
||||
|
||||
___
|
||||
|
||||
### mapMessageType
|
||||
|
||||
▸ **mapMessageType**(`messageType`): ``"function"`` \| ``"user"`` \| ``"assistant"`` \| ``"system"``
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messageType` | [`MessageType`](../modules.md#messagetype) |
|
||||
|
||||
#### Returns
|
||||
|
||||
``"function"`` \| ``"user"`` \| ``"assistant"`` \| ``"system"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:140](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L140)
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
id: "OpenAIEmbedding"
|
||||
title: "Class: OpenAIEmbedding"
|
||||
sidebar_label: "OpenAIEmbedding"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`BaseEmbedding`](BaseEmbedding.md)
|
||||
|
||||
↳ **`OpenAIEmbedding`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new OpenAIEmbedding**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`OpenAIEmbedding`](OpenAIEmbedding.md)\> & { `azure?`: `AzureOpenAIConfig` } |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseEmbedding](BaseEmbedding.md).[constructor](BaseEmbedding.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:229](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L229)
|
||||
|
||||
## Properties
|
||||
|
||||
### apiKey
|
||||
|
||||
• `Optional` **apiKey**: `string` = `undefined`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:224](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L224)
|
||||
|
||||
___
|
||||
|
||||
### maxRetries
|
||||
|
||||
• **maxRetries**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:225](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L225)
|
||||
|
||||
___
|
||||
|
||||
### model
|
||||
|
||||
• **model**: `TEXT_EMBED_ADA_002`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:221](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L221)
|
||||
|
||||
___
|
||||
|
||||
### session
|
||||
|
||||
• **session**: `OpenAISession`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:227](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L227)
|
||||
|
||||
___
|
||||
|
||||
### timeout
|
||||
|
||||
• `Optional` **timeout**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:226](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L226)
|
||||
|
||||
## Methods
|
||||
|
||||
### getOpenAIEmbedding
|
||||
|
||||
▸ `Private` **getOpenAIEmbedding**(`input`): `Promise`<`number`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `input` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:270](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L270)
|
||||
|
||||
___
|
||||
|
||||
### getQueryEmbedding
|
||||
|
||||
▸ **getQueryEmbedding**(`query`): `Promise`<`number`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[]\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseEmbedding](BaseEmbedding.md).[getQueryEmbedding](BaseEmbedding.md#getqueryembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:286](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L286)
|
||||
|
||||
___
|
||||
|
||||
### getTextEmbedding
|
||||
|
||||
▸ **getTextEmbedding**(`text`): `Promise`<`number`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `text` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[]\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseEmbedding](BaseEmbedding.md).[getTextEmbedding](BaseEmbedding.md#gettextembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:282](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L282)
|
||||
|
||||
___
|
||||
|
||||
### similarity
|
||||
|
||||
▸ **similarity**(`embedding1`, `embedding2`, `mode?`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `embedding1` | `number`[] | `undefined` |
|
||||
| `embedding2` | `number`[] | `undefined` |
|
||||
| `mode` | [`SimilarityType`](../enums/SimilarityType.md) | `SimilarityType.DEFAULT` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseEmbedding](BaseEmbedding.md).[similarity](BaseEmbedding.md#similarity)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:204](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L204)
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
id: "PDFReader"
|
||||
title: "Class: PDFReader"
|
||||
sidebar_label: "PDFReader"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Read the text of a PDF
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseReader`](../interfaces/BaseReader.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new PDFReader**()
|
||||
|
||||
## Methods
|
||||
|
||||
### loadData
|
||||
|
||||
▸ **loadData**(`file`, `fs?`): `Promise`<[`Document`](Document.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `file` | `string` | `undefined` |
|
||||
| `fs` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) | `DEFAULT_FS` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Document`](Document.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseReader](../interfaces/BaseReader.md).[loadData](../interfaces/BaseReader.md#loaddata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[readers/PDFReader.ts:11](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/readers/PDFReader.ts#L11)
|
||||
@@ -0,0 +1,139 @@
|
||||
---
|
||||
id: "Refine"
|
||||
title: "Class: Refine"
|
||||
sidebar_label: "Refine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A response builder that uses the query to ask the LLM generate a better response using multiple text chunks.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`Refine`**
|
||||
|
||||
↳ [`CompactAndRefine`](CompactAndRefine.md)
|
||||
|
||||
## Implements
|
||||
|
||||
- `BaseResponseBuilder`
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Refine**(`serviceContext`, `textQATemplate?`, `refineTemplate?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `serviceContext` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
| `textQATemplate?` | [`SimplePrompt`](../modules.md#simpleprompt) |
|
||||
| `refineTemplate?` | [`SimplePrompt`](../modules.md#simpleprompt) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:78](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L78)
|
||||
|
||||
## Properties
|
||||
|
||||
### refineTemplate
|
||||
|
||||
• **refineTemplate**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:76](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L76)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:74](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### textQATemplate
|
||||
|
||||
• **textQATemplate**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L75)
|
||||
|
||||
## Methods
|
||||
|
||||
### getResponse
|
||||
|
||||
▸ **getResponse**(`query`, `textChunks`, `parentEvent?`, `prevResponse?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `textChunks` | `string`[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
| `prevResponse?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
BaseResponseBuilder.getResponse
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:88](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
### giveResponseSingle
|
||||
|
||||
▸ `Private` **giveResponseSingle**(`queryStr`, `textChunk`, `parentEvent?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `queryStr` | `string` |
|
||||
| `textChunk` | `string` |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:113](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
### refineResponseSingle
|
||||
|
||||
▸ `Private` **refineResponseSingle**(`response`, `queryStr`, `textChunk`, `parentEvent?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `response` | `string` |
|
||||
| `queryStr` | `string` |
|
||||
| `textChunk` | `string` |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:149](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L149)
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
id: "Response"
|
||||
title: "Class: Response"
|
||||
sidebar_label: "Response"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Respone is the output of a LLM
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new Response**(`response`, `sourceNodes?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `response` | `string` |
|
||||
| `sourceNodes?` | [`BaseNode`](BaseNode.md)[] |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Response.ts:10](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Response.ts#L10)
|
||||
|
||||
## Properties
|
||||
|
||||
### response
|
||||
|
||||
• **response**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Response.ts:7](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Response.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### sourceNodes
|
||||
|
||||
• `Optional` **sourceNodes**: [`BaseNode`](BaseNode.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Response.ts:8](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Response.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### getFormattedSources
|
||||
|
||||
▸ **getFormattedSources**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Response.ts:15](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Response.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### toString
|
||||
|
||||
▸ **toString**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Response.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Response.ts#L19)
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
id: "ResponseSynthesizer"
|
||||
title: "Class: ResponseSynthesizer"
|
||||
sidebar_label: "ResponseSynthesizer"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A ResponseSynthesizer is used to generate a response from a query and a list of nodes.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new ResponseSynthesizer**(`«destructured»?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `«destructured»` | `Object` |
|
||||
| › `responseBuilder?` | `BaseResponseBuilder` |
|
||||
| › `serviceContext?` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:285](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L285)
|
||||
|
||||
## Properties
|
||||
|
||||
### responseBuilder
|
||||
|
||||
• **responseBuilder**: `BaseResponseBuilder`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:282](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L282)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:283](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L283)
|
||||
|
||||
## Methods
|
||||
|
||||
### synthesize
|
||||
|
||||
▸ **synthesize**(`query`, `nodes`, `parentEvent?`): `Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `nodes` | [`NodeWithScore`](../interfaces/NodeWithScore.md)[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:297](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L297)
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
id: "RetrieverQueryEngine"
|
||||
title: "Class: RetrieverQueryEngine"
|
||||
sidebar_label: "RetrieverQueryEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A query engine that uses a retriever to query an index and then synthesizes the response.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new RetrieverQueryEngine**(`retriever`, `responseSynthesizer?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `retriever` | [`BaseRetriever`](../interfaces/BaseRetriever.md) |
|
||||
| `responseSynthesizer?` | [`ResponseSynthesizer`](ResponseSynthesizer.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:34](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L34)
|
||||
|
||||
## Properties
|
||||
|
||||
### responseSynthesizer
|
||||
|
||||
• **responseSynthesizer**: [`ResponseSynthesizer`](ResponseSynthesizer.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:32](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### retriever
|
||||
|
||||
• **retriever**: [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:31](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L31)
|
||||
|
||||
## Methods
|
||||
|
||||
### query
|
||||
|
||||
▸ **query**(`query`, `parentEvent?`): `Promise`<[`Response`](Response.md)\>
|
||||
|
||||
Query the query engine and get a response.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseQueryEngine](../interfaces/BaseQueryEngine.md).[query](../interfaces/BaseQueryEngine.md#query)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L45)
|
||||
@@ -0,0 +1,238 @@
|
||||
---
|
||||
id: "SentenceSplitter"
|
||||
title: "Class: SentenceSplitter"
|
||||
sidebar_label: "SentenceSplitter"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
SentenceSplitter is our default text splitter that supports splitting into sentences, paragraphs, or fixed length chunks with overlap.
|
||||
|
||||
One of the advantages of SentenceSplitter is that even in the fixed length chunks it will try to keep sentences together.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SentenceSplitter**(`chunkSize?`, `chunkOverlap?`, `tokenizer?`, `tokenizerDecoder?`, `paragraphSeparator?`, `chunkingTokenizerFn?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `chunkSize` | `number` | `DEFAULT_CHUNK_SIZE` |
|
||||
| `chunkOverlap` | `number` | `DEFAULT_CHUNK_OVERLAP` |
|
||||
| `tokenizer` | `any` | `null` |
|
||||
| `tokenizerDecoder` | `any` | `null` |
|
||||
| `paragraphSeparator` | `string` | `"\n\n\n"` |
|
||||
| `chunkingTokenizerFn` | `any` | `undefined` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:35](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L35)
|
||||
|
||||
## Properties
|
||||
|
||||
### chunkOverlap
|
||||
|
||||
• `Private` **chunkOverlap**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:28](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### chunkSize
|
||||
|
||||
• `Private` **chunkSize**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:27](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### chunkingTokenizerFn
|
||||
|
||||
• `Private` **chunkingTokenizerFn**: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:32](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### paragraphSeparator
|
||||
|
||||
• `Private` **paragraphSeparator**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:31](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### tokenizer
|
||||
|
||||
• `Private` **tokenizer**: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:29](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### tokenizerDecoder
|
||||
|
||||
• `Private` **tokenizerDecoder**: `any`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:30](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L30)
|
||||
|
||||
## Methods
|
||||
|
||||
### combineTextSplits
|
||||
|
||||
▸ **combineTextSplits**(`newSentenceSplits`, `effectiveChunkSize`): `TextSplit`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `newSentenceSplits` | `SplitRep`[] |
|
||||
| `effectiveChunkSize` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`TextSplit`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:155](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### getEffectiveChunkSize
|
||||
|
||||
▸ `Private` **getEffectiveChunkSize**(`extraInfoStr?`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `extraInfoStr?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:74](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### getParagraphSplits
|
||||
|
||||
▸ **getParagraphSplits**(`text`, `effectiveChunkSize?`): `string`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `text` | `string` |
|
||||
| `effectiveChunkSize?` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:91](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L91)
|
||||
|
||||
___
|
||||
|
||||
### getSentenceSplits
|
||||
|
||||
▸ **getSentenceSplits**(`text`, `effectiveChunkSize?`): `string`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `text` | `string` |
|
||||
| `effectiveChunkSize?` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:117](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L117)
|
||||
|
||||
___
|
||||
|
||||
### processSentenceSplits
|
||||
|
||||
▸ `Private` **processSentenceSplits**(`sentenceSplits`, `effectiveChunkSize`): `SplitRep`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `sentenceSplits` | `string`[] |
|
||||
| `effectiveChunkSize` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`SplitRep`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:130](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L130)
|
||||
|
||||
___
|
||||
|
||||
### splitText
|
||||
|
||||
▸ **splitText**(`text`, `extraInfoStr?`): `string`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `text` | `string` |
|
||||
| `extraInfoStr?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:247](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L247)
|
||||
|
||||
___
|
||||
|
||||
### splitTextWithOverlaps
|
||||
|
||||
▸ **splitTextWithOverlaps**(`text`, `extraInfoStr?`): `TextSplit`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `text` | `string` |
|
||||
| `extraInfoStr?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`TextSplit`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[TextSplitter.ts:219](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/TextSplitter.ts#L219)
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
id: "SimpleChatEngine"
|
||||
title: "Class: SimpleChatEngine"
|
||||
sidebar_label: "SimpleChatEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
SimpleChatEngine is the simplest possible chat engine. Useful for using your own custom prompts.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`ChatEngine`](../interfaces/ChatEngine.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleChatEngine**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`SimpleChatEngine`](SimpleChatEngine.md)\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:40](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L40)
|
||||
|
||||
## Properties
|
||||
|
||||
### chatHistory
|
||||
|
||||
• **chatHistory**: [`ChatMessage`](../interfaces/ChatMessage.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:37](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### llm
|
||||
|
||||
• **llm**: [`LLM`](../interfaces/LLM.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:38](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L38)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`message`, `chatHistory?`): `Promise`<[`Response`](Response.md)\>
|
||||
|
||||
Send message along with the class's current chat history to the LLM.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `message` | `string` | |
|
||||
| `chatHistory?` | [`ChatMessage`](../interfaces/ChatMessage.md)[] | optional chat history if you want to customize the chat history |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[ChatEngine](../interfaces/ChatEngine.md).[chat](../interfaces/ChatEngine.md#chat)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### reset
|
||||
|
||||
▸ **reset**(): `void`
|
||||
|
||||
Resets the chat history so that it's empty.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[ChatEngine](../interfaces/ChatEngine.md).[reset](../interfaces/ChatEngine.md#reset)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:54](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L54)
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: "SimpleDirectoryReader"
|
||||
title: "Class: SimpleDirectoryReader"
|
||||
sidebar_label: "SimpleDirectoryReader"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Read all of the documents in a directory. Currently supports PDF and TXT files.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseReader`](../interfaces/BaseReader.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleDirectoryReader**()
|
||||
|
||||
## Methods
|
||||
|
||||
### loadData
|
||||
|
||||
▸ **loadData**(`«destructured»`): `Promise`<[`Document`](Document.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `«destructured»` | [`SimpleDirectoryReaderLoadDataProps`](../modules.md#simpledirectoryreaderloaddataprops) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Document`](Document.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseReader](../interfaces/BaseReader.md).[loadData](../interfaces/BaseReader.md#loaddata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[readers/SimpleDirectoryReader.ts:37](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/readers/SimpleDirectoryReader.ts#L37)
|
||||
@@ -0,0 +1,120 @@
|
||||
---
|
||||
id: "SimpleNodeParser"
|
||||
title: "Class: SimpleNodeParser"
|
||||
sidebar_label: "SimpleNodeParser"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
SimpleNodeParser is the default NodeParser. It splits documents into TextNodes using a splitter, by default SentenceSplitter
|
||||
|
||||
## Implements
|
||||
|
||||
- [`NodeParser`](../interfaces/NodeParser.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleNodeParser**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Object` |
|
||||
| `init.chunkOverlap?` | `number` |
|
||||
| `init.chunkSize?` | `number` |
|
||||
| `init.includeMetadata?` | `boolean` |
|
||||
| `init.includePrevNextRel?` | `boolean` |
|
||||
| `init.textSplitter?` | [`SentenceSplitter`](SentenceSplitter.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:93](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L93)
|
||||
|
||||
## Properties
|
||||
|
||||
### includeMetadata
|
||||
|
||||
• **includeMetadata**: `boolean`
|
||||
|
||||
Whether to include metadata in the nodes.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:87](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### includePrevNextRel
|
||||
|
||||
• **includePrevNextRel**: `boolean`
|
||||
|
||||
Whether to include previous and next relationships in the nodes.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:91](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L91)
|
||||
|
||||
___
|
||||
|
||||
### textSplitter
|
||||
|
||||
• **textSplitter**: [`SentenceSplitter`](SentenceSplitter.md)
|
||||
|
||||
The text splitter to use.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:83](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L83)
|
||||
|
||||
## Methods
|
||||
|
||||
### getNodesFromDocuments
|
||||
|
||||
▸ **getNodesFromDocuments**(`documents`): [`TextNode`](TextNode.md)[]
|
||||
|
||||
Generate Node objects from documents
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `documents` | [`Document`](Document.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TextNode`](TextNode.md)[]
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[NodeParser](../interfaces/NodeParser.md).[getNodesFromDocuments](../interfaces/NodeParser.md#getnodesfromdocuments)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### fromDefaults
|
||||
|
||||
▸ `Static` **fromDefaults**(`init?`): [`SimpleNodeParser`](SimpleNodeParser.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Object` |
|
||||
| `init.chunkOverlap?` | `number` |
|
||||
| `init.chunkSize?` | `number` |
|
||||
| `init.includeMetadata?` | `boolean` |
|
||||
| `init.includePrevNextRel?` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SimpleNodeParser`](SimpleNodeParser.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:111](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L111)
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
id: "SimpleResponseBuilder"
|
||||
title: "Class: SimpleResponseBuilder"
|
||||
sidebar_label: "SimpleResponseBuilder"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A response builder that just concatenates responses.
|
||||
|
||||
## Implements
|
||||
|
||||
- `BaseResponseBuilder`
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleResponseBuilder**(`serviceContext`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `serviceContext` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L49)
|
||||
|
||||
## Properties
|
||||
|
||||
### llm
|
||||
|
||||
• **llm**: [`LLM`](../interfaces/LLM.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### textQATemplate
|
||||
|
||||
• **textQATemplate**: [`SimplePrompt`](../modules.md#simpleprompt)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:47](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L47)
|
||||
|
||||
## Methods
|
||||
|
||||
### getResponse
|
||||
|
||||
▸ **getResponse**(`query`, `textChunks`, `parentEvent?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `textChunks` | `string`[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
BaseResponseBuilder.getResponse
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:54](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L54)
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
id: "SubQuestionOutputParser"
|
||||
title: "Class: SubQuestionOutputParser"
|
||||
sidebar_label: "SubQuestionOutputParser"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
SubQuestionOutputParser is used to parse the output of the SubQuestionGenerator.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseOutputParser`](../interfaces/BaseOutputParser.md)<[`StructuredOutput`](../interfaces/StructuredOutput.md)<[`SubQuestion`](../interfaces/SubQuestion.md)[]\>\>
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SubQuestionOutputParser**()
|
||||
|
||||
## Methods
|
||||
|
||||
### format
|
||||
|
||||
▸ **format**(`output`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `output` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseOutputParser](../interfaces/BaseOutputParser.md).[format](../interfaces/BaseOutputParser.md#format)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[OutputParser.ts:97](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/OutputParser.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### parse
|
||||
|
||||
▸ **parse**(`output`): [`StructuredOutput`](../interfaces/StructuredOutput.md)<[`SubQuestion`](../interfaces/SubQuestion.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `output` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`StructuredOutput`](../interfaces/StructuredOutput.md)<[`SubQuestion`](../interfaces/SubQuestion.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseOutputParser](../interfaces/BaseOutputParser.md).[parse](../interfaces/BaseOutputParser.md#parse)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[OutputParser.ts:89](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/OutputParser.ts#L89)
|
||||
@@ -0,0 +1,143 @@
|
||||
---
|
||||
id: "SubQuestionQueryEngine"
|
||||
title: "Class: SubQuestionQueryEngine"
|
||||
sidebar_label: "SubQuestionQueryEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
SubQuestionQueryEngine decomposes a question into subquestions and then
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SubQuestionQueryEngine**(`init`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | `Object` |
|
||||
| `init.queryEngineTools` | [`QueryEngineTool`](../interfaces/QueryEngineTool.md)[] |
|
||||
| `init.questionGen` | [`BaseQuestionGenerator`](../interfaces/BaseQuestionGenerator.md) |
|
||||
| `init.responseSynthesizer` | [`ResponseSynthesizer`](ResponseSynthesizer.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L65)
|
||||
|
||||
## Properties
|
||||
|
||||
### metadatas
|
||||
|
||||
• **metadatas**: [`ToolMetadata`](../interfaces/ToolMetadata.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:63](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### queryEngines
|
||||
|
||||
• **queryEngines**: `Record`<`string`, [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L62)
|
||||
|
||||
___
|
||||
|
||||
### questionGen
|
||||
|
||||
• **questionGen**: [`BaseQuestionGenerator`](../interfaces/BaseQuestionGenerator.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:61](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L61)
|
||||
|
||||
___
|
||||
|
||||
### responseSynthesizer
|
||||
|
||||
• **responseSynthesizer**: [`ResponseSynthesizer`](ResponseSynthesizer.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:60](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L60)
|
||||
|
||||
## Methods
|
||||
|
||||
### query
|
||||
|
||||
▸ **query**(`query`): `Promise`<[`Response`](Response.md)\>
|
||||
|
||||
Query the query engine and get a response.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](Response.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseQueryEngine](../interfaces/BaseQueryEngine.md).[query](../interfaces/BaseQueryEngine.md#query)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:106](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L106)
|
||||
|
||||
___
|
||||
|
||||
### querySubQ
|
||||
|
||||
▸ `Private` **querySubQ**(`subQ`, `parentEvent?`): `Promise`<``null`` \| [`NodeWithScore`](../interfaces/NodeWithScore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `subQ` | [`SubQuestion`](../interfaces/SubQuestion.md) |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<``null`` \| [`NodeWithScore`](../interfaces/NodeWithScore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:134](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L134)
|
||||
|
||||
___
|
||||
|
||||
### fromDefaults
|
||||
|
||||
▸ `Static` **fromDefaults**(`init`): [`SubQuestionQueryEngine`](SubQuestionQueryEngine.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | `Object` |
|
||||
| `init.queryEngineTools` | [`QueryEngineTool`](../interfaces/QueryEngineTool.md)[] |
|
||||
| `init.questionGen?` | [`BaseQuestionGenerator`](../interfaces/BaseQuestionGenerator.md) |
|
||||
| `init.responseSynthesizer?` | [`ResponseSynthesizer`](ResponseSynthesizer.md) |
|
||||
| `init.serviceContext?` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SubQuestionQueryEngine`](SubQuestionQueryEngine.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:82](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L82)
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
id: "TextFileReader"
|
||||
title: "Class: TextFileReader"
|
||||
sidebar_label: "TextFileReader"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Read a .txt file
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseReader`](../interfaces/BaseReader.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new TextFileReader**()
|
||||
|
||||
## Methods
|
||||
|
||||
### loadData
|
||||
|
||||
▸ **loadData**(`file`, `fs?`): `Promise`<[`Document`](Document.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `file` | `string` |
|
||||
| `fs` | [`CompleteFileSystem`](../modules.md#completefilesystem) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Document`](Document.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseReader](../interfaces/BaseReader.md).[loadData](../interfaces/BaseReader.md#loaddata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[readers/SimpleDirectoryReader.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/readers/SimpleDirectoryReader.ts#L12)
|
||||
@@ -0,0 +1,478 @@
|
||||
---
|
||||
id: "TextNode"
|
||||
title: "Class: TextNode"
|
||||
sidebar_label: "TextNode"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
TextNode is the default node type for text. Most common node type in LlamaIndex.TS
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`BaseNode`](BaseNode.md)
|
||||
|
||||
↳ **`TextNode`**
|
||||
|
||||
↳↳ [`IndexNode`](IndexNode.md)
|
||||
|
||||
↳↳ [`Document`](Document.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new TextNode**(`init?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init?` | `Partial`<[`TextNode`](TextNode.md)\> |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[constructor](BaseNode.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:152](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L152)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[embedding](BaseNode.md#embedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:39](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### endCharIdx
|
||||
|
||||
• `Optional` **endCharIdx**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:147](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[excludedEmbedMetadataKeys](BaseNode.md#excludedembedmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:43](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[excludedLlmMetadataKeys](BaseNode.md#excludedllmmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:44](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[hash](BaseNode.md#hash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[id_](BaseNode.md#id_)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:38](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[metadata](BaseNode.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### metadataSeparator
|
||||
|
||||
• **metadataSeparator**: `string` = `"\n"`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L150)
|
||||
|
||||
___
|
||||
|
||||
### relationships
|
||||
|
||||
• **relationships**: `Partial`<`Record`<[`NodeRelationship`](../enums/NodeRelationship.md), [`RelatedNodeType`](../modules.md#relatednodetype)\>\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[relationships](BaseNode.md#relationships)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### startCharIdx
|
||||
|
||||
• `Optional` **startCharIdx**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:146](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L146)
|
||||
|
||||
___
|
||||
|
||||
### text
|
||||
|
||||
• **text**: `string` = `""`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:145](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L145)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.childNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:104](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.nextNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:84](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### nodeId
|
||||
|
||||
• `get` **nodeId**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.nodeId
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:58](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.parentNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:94](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.prevNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:72](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.sourceNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L62)
|
||||
|
||||
## Methods
|
||||
|
||||
### asRelatedNodeInfo
|
||||
|
||||
▸ **asRelatedNodeInfo**(): [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[asRelatedNodeInfo](BaseNode.md#asrelatednodeinfo)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ **generateHash**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:157](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L157)
|
||||
|
||||
___
|
||||
|
||||
### getContent
|
||||
|
||||
▸ **getContent**(`metadataMode?`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) | `MetadataMode.NONE` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[getContent](BaseNode.md#getcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:165](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L165)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[getEmbedding](BaseNode.md#getembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:116](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### getMetadataStr
|
||||
|
||||
▸ **getMetadataStr**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[getMetadataStr](BaseNode.md#getmetadatastr)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:170](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L170)
|
||||
|
||||
___
|
||||
|
||||
### getNodeInfo
|
||||
|
||||
▸ **getNodeInfo**(): `Object`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `end` | `undefined` \| `number` |
|
||||
| `start` | `undefined` \| `number` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:195](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L195)
|
||||
|
||||
___
|
||||
|
||||
### getText
|
||||
|
||||
▸ **getText**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:199](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L199)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[getType](BaseNode.md#gettype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:161](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L161)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[setContent](BaseNode.md#setcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:191](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L191)
|
||||
|
||||
___
|
||||
|
||||
### toJSON
|
||||
|
||||
▸ **toJSON**(): `Record`<`string`, `any`\>
|
||||
|
||||
Used with built in JSON.stringify
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `any`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[toJSON](BaseNode.md#tojson)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:136](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L136)
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
id: "TreeSummarize"
|
||||
title: "Class: TreeSummarize"
|
||||
sidebar_label: "TreeSummarize"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
TreeSummarize repacks the text chunks into the smallest possible number of chunks and then summarizes them, then recursively does so until there's one chunk left.
|
||||
|
||||
## Implements
|
||||
|
||||
- `BaseResponseBuilder`
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new TreeSummarize**(`serviceContext`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `serviceContext` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:212](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L212)
|
||||
|
||||
## Properties
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:210](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L210)
|
||||
|
||||
## Methods
|
||||
|
||||
### getResponse
|
||||
|
||||
▸ **getResponse**(`query`, `textChunks`, `parentEvent?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `textChunks` | `string`[] |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
BaseResponseBuilder.getResponse
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ResponseSynthesizer.ts:216](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ResponseSynthesizer.ts#L216)
|
||||
@@ -0,0 +1,104 @@
|
||||
---
|
||||
id: "VectorIndexRetriever"
|
||||
title: "Class: VectorIndexRetriever"
|
||||
sidebar_label: "VectorIndexRetriever"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
VectorIndexRetriever retrieves nodes from a VectorIndex.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`BaseRetriever`](../interfaces/BaseRetriever.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new VectorIndexRetriever**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `«destructured»` | `Object` |
|
||||
| › `index` | [`VectorStoreIndex`](VectorStoreIndex.md) |
|
||||
| › `similarityTopK?` | `number` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorIndexRetriever.ts:22](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorIndexRetriever.ts#L22)
|
||||
|
||||
## Properties
|
||||
|
||||
### index
|
||||
|
||||
• **index**: [`VectorStoreIndex`](VectorStoreIndex.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorIndexRetriever.ts:18](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorIndexRetriever.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• `Private` **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorIndexRetriever.ts:20](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorIndexRetriever.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### similarityTopK
|
||||
|
||||
• **similarityTopK**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorIndexRetriever.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorIndexRetriever.ts#L19)
|
||||
|
||||
## Methods
|
||||
|
||||
### getServiceContext
|
||||
|
||||
▸ **getServiceContext**(): [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseRetriever](../interfaces/BaseRetriever.md).[getServiceContext](../interfaces/BaseRetriever.md#getservicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorIndexRetriever.ts:69](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorIndexRetriever.ts#L69)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`query`, `parentEvent?`): `Promise`<[`NodeWithScore`](../interfaces/NodeWithScore.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `parentEvent?` | [`Event`](../interfaces/Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`NodeWithScore`](../interfaces/NodeWithScore.md)[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[BaseRetriever](../interfaces/BaseRetriever.md).[retrieve](../interfaces/BaseRetriever.md#retrieve)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorIndexRetriever.ts:35](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorIndexRetriever.ts#L35)
|
||||
@@ -0,0 +1,271 @@
|
||||
---
|
||||
id: "VectorStoreIndex"
|
||||
title: "Class: VectorStoreIndex"
|
||||
sidebar_label: "VectorStoreIndex"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
The VectorStoreIndex, an index that stores the nodes only according to their vector embedings.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`BaseIndex`](BaseIndex.md)<[`IndexDict`](IndexDict.md)\>
|
||||
|
||||
↳ **`VectorStoreIndex`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• `Private` **new VectorStoreIndex**(`init`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `init` | [`VectorIndexConstructorProps`](../interfaces/VectorIndexConstructorProps.md) |
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[constructor](BaseIndex.md#constructor)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:36](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L36)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `BaseDocumentStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[docStore](BaseIndex.md#docstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:122](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L122)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStore](BaseIndex.md#indexstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: [`IndexDict`](IndexDict.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStruct](BaseIndex.md#indexstruct)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:125](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[serviceContext](BaseIndex.md#servicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:120](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L120)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](../interfaces/StorageContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[storageContext](BaseIndex.md#storagecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• **vectorStore**: [`VectorStore`](../interfaces/VectorStore.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[vectorStore](BaseIndex.md#vectorstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:34](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L34)
|
||||
|
||||
## Methods
|
||||
|
||||
### asQueryEngine
|
||||
|
||||
▸ **asQueryEngine**(`options?`): [`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
Create a new query engine from the index. It will also create a retriever
|
||||
and response synthezier if they are not provided.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `options?` | `Object` | you can supply your own custom Retriever and ResponseSynthesizer |
|
||||
| `options.responseSynthesizer?` | [`ResponseSynthesizer`](ResponseSynthesizer.md) | - |
|
||||
| `options.retriever?` | [`BaseRetriever`](../interfaces/BaseRetriever.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BaseQueryEngine`](../interfaces/BaseQueryEngine.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[asQueryEngine](BaseIndex.md#asqueryengine)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:215](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L215)
|
||||
|
||||
___
|
||||
|
||||
### asRetriever
|
||||
|
||||
▸ **asRetriever**(`options?`): [`VectorIndexRetriever`](VectorIndexRetriever.md)
|
||||
|
||||
Create a new retriever from the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`VectorIndexRetriever`](VectorIndexRetriever.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[asRetriever](BaseIndex.md#asretriever)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:211](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L211)
|
||||
|
||||
___
|
||||
|
||||
### buildIndexFromNodes
|
||||
|
||||
▸ `Static` **buildIndexFromNodes**(`nodes`, `serviceContext`, `vectorStore`, `docStore`): `Promise`<[`IndexDict`](IndexDict.md)\>
|
||||
|
||||
Get embeddings for nodes and place them into the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] |
|
||||
| `serviceContext` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
| `vectorStore` | [`VectorStore`](../interfaces/VectorStore.md) |
|
||||
| `docStore` | `BaseDocumentStore` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IndexDict`](IndexDict.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:151](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L151)
|
||||
|
||||
___
|
||||
|
||||
### fromDocuments
|
||||
|
||||
▸ `Static` **fromDocuments**(`documents`, `args?`): `Promise`<[`VectorStoreIndex`](VectorStoreIndex.md)\>
|
||||
|
||||
High level API: split documents, get embeddings, and build index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `documents` | [`Document`](Document.md)[] |
|
||||
| `args` | `Object` |
|
||||
| `args.serviceContext?` | [`ServiceContext`](../interfaces/ServiceContext.md) |
|
||||
| `args.storageContext?` | [`StorageContext`](../interfaces/StorageContext.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`VectorStoreIndex`](VectorStoreIndex.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:186](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L186)
|
||||
|
||||
___
|
||||
|
||||
### getNodeEmbeddingResults
|
||||
|
||||
▸ `Static` **getNodeEmbeddingResults**(`nodes`, `serviceContext`, `logProgress?`): `Promise`<[`NodeWithEmbedding`](../interfaces/NodeWithEmbedding.md)[]\>
|
||||
|
||||
Get the embeddings for nodes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] | `undefined` | |
|
||||
| `serviceContext` | [`ServiceContext`](../interfaces/ServiceContext.md) | `undefined` | |
|
||||
| `logProgress` | `boolean` | `false` | log progress to console (useful for debugging) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`NodeWithEmbedding`](../interfaces/NodeWithEmbedding.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:123](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L123)
|
||||
|
||||
___
|
||||
|
||||
### init
|
||||
|
||||
▸ `Static` **init**(`options`): `Promise`<[`VectorStoreIndex`](VectorStoreIndex.md)\>
|
||||
|
||||
The async init function should be called after the constructor.
|
||||
This is needed to handle persistence.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `options` | [`VectorIndexOptions`](../interfaces/VectorIndexOptions.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`VectorStoreIndex`](VectorStoreIndex.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:47](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L47)
|
||||
@@ -0,0 +1,2 @@
|
||||
label: "Classes"
|
||||
position: 3
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: "DeuceChatStrategy"
|
||||
title: "Enumeration: DeuceChatStrategy"
|
||||
sidebar_label: "DeuceChatStrategy"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### A16Z
|
||||
|
||||
• **A16Z** = ``"a16z"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:224](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L224)
|
||||
|
||||
___
|
||||
|
||||
### META
|
||||
|
||||
• **META** = ``"meta"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:225](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L225)
|
||||
|
||||
___
|
||||
|
||||
### METAWBOS
|
||||
|
||||
• **METAWBOS** = ``"metawbos"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:226](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L226)
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
id: "IndexStructType"
|
||||
title: "Enumeration: IndexStructType"
|
||||
sidebar_label: "IndexStructType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### LIST
|
||||
|
||||
• **LIST** = ``"list"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:41](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### SIMPLE\_DICT
|
||||
|
||||
• **SIMPLE\_DICT** = ``"simple_dict"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:40](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L40)
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
id: "ListRetrieverMode"
|
||||
title: "Enumeration: ListRetrieverMode"
|
||||
sidebar_label: "ListRetrieverMode"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### DEFAULT
|
||||
|
||||
• **DEFAULT** = ``"default"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:26](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### LLM
|
||||
|
||||
• **LLM** = ``"llm"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:28](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L28)
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "MetadataMode"
|
||||
title: "Enumeration: MetadataMode"
|
||||
sidebar_label: "MetadataMode"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### ALL
|
||||
|
||||
• **ALL** = ``"ALL"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### EMBED
|
||||
|
||||
• **EMBED** = ``"EMBED"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:20](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### LLM
|
||||
|
||||
• **LLM** = ``"LLM"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:21](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### NONE
|
||||
|
||||
• **NONE** = ``"NONE"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:22](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L22)
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
id: "NodeRelationship"
|
||||
title: "Enumeration: NodeRelationship"
|
||||
sidebar_label: "NodeRelationship"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### CHILD
|
||||
|
||||
• **CHILD** = ``"CHILD"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:8](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### NEXT
|
||||
|
||||
• **NEXT** = ``"NEXT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:6](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### PARENT
|
||||
|
||||
• **PARENT** = ``"PARENT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:7](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### PREVIOUS
|
||||
|
||||
• **PREVIOUS** = ``"PREVIOUS"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:5](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### SOURCE
|
||||
|
||||
• **SOURCE** = ``"SOURCE"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:4](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L4)
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "ObjectType"
|
||||
title: "Enumeration: ObjectType"
|
||||
sidebar_label: "ObjectType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### DOCUMENT
|
||||
|
||||
• **DOCUMENT** = ``"DOCUMENT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:15](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### IMAGE
|
||||
|
||||
• **IMAGE** = ``"IMAGE"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:13](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### INDEX
|
||||
|
||||
• **INDEX** = ``"INDEX"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:14](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### TEXT
|
||||
|
||||
• **TEXT** = ``"TEXT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L12)
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
id: "SimilarityType"
|
||||
title: "Enumeration: SimilarityType"
|
||||
sidebar_label: "SimilarityType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Similarity type
|
||||
Default is cosine similarity. Dot product and negative Euclidean distance are also supported.
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### DEFAULT
|
||||
|
||||
• **DEFAULT** = ``"cosine"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### DOT\_PRODUCT
|
||||
|
||||
• **DOT\_PRODUCT** = ``"dot_product"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:18](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### EUCLIDEAN
|
||||
|
||||
• **EUCLIDEAN** = ``"euclidean"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Embedding.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Embedding.ts#L19)
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
id: "VectorStoreQueryMode"
|
||||
title: "Enumeration: VectorStoreQueryMode"
|
||||
sidebar_label: "VectorStoreQueryMode"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### DEFAULT
|
||||
|
||||
• **DEFAULT** = ``"default"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### HYBRID
|
||||
|
||||
• **HYBRID** = ``"hybrid"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:14](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### LINEAR\_REGRESSION
|
||||
|
||||
• **LINEAR\_REGRESSION** = ``"linear_regression"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:18](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### LOGISTIC\_REGRESSION
|
||||
|
||||
• **LOGISTIC\_REGRESSION** = ``"logistic_regression"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### MMR
|
||||
|
||||
• **MMR** = ``"mmr"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:20](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### SPARSE
|
||||
|
||||
• **SPARSE** = ``"sparse"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:13](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### SVM
|
||||
|
||||
• **SVM** = ``"svm"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L16)
|
||||
@@ -0,0 +1,2 @@
|
||||
label: "Enumerations"
|
||||
position: 2
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
id: "index"
|
||||
title: "llamaindex"
|
||||
sidebar_label: "Readme"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
# LlamaIndex.TS
|
||||
|
||||
LlamaIndex is a data framework for your LLM application.
|
||||
|
||||
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in Typescript and Javascript.
|
||||
|
||||
Documentation: https://ts.llamaindex.ai/
|
||||
|
||||
## 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.
|
||||
|
||||
## Getting started with an example:
|
||||
|
||||
LlamaIndex.TS requries Node v18 or higher. You can download it from https://nodejs.org or use https://nvm.sh (our preferred option).
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Create the file example.ts
|
||||
|
||||
```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(
|
||||
"What did the author do in college?"
|
||||
);
|
||||
|
||||
// Output response
|
||||
console.log(response.toString());
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
|
||||
Then you can run it using
|
||||
|
||||
```bash
|
||||
pnpm dlx ts-node example.ts
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
## Supported LLMs:
|
||||
|
||||
- OpenAI GPT-3.5-turbo and GPT-4
|
||||
- Anthropic Claude Instant and Claude 2
|
||||
- Llama2 Chat LLMs (70B, 13B, and 7B parameters)
|
||||
|
||||
## Contributing:
|
||||
|
||||
We are in the very early days of LlamaIndex.TS. If you’re 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
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
id: "BaseIndexInit"
|
||||
title: "Interface: BaseIndexInit<T>"
|
||||
sidebar_label: "BaseIndexInit"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`BaseIndexInit`**
|
||||
|
||||
↳ [`VectorIndexConstructorProps`](VectorIndexConstructorProps.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `BaseDocumentStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:109](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L109)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:111](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: `T`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:112](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L112)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:107](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](StorageContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:108](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L108)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• `Optional` **vectorStore**: [`VectorStore`](VectorStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:110](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L110)
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
id: "BaseOutputParser"
|
||||
title: "Interface: BaseOutputParser<T>"
|
||||
sidebar_label: "BaseOutputParser"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
An OutputParser is used to extract structured data from the raw output of the LLM.
|
||||
|
||||
## Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`SubQuestionOutputParser`](../classes/SubQuestionOutputParser.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### format
|
||||
|
||||
▸ **format**(`output`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `output` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[OutputParser.ts:8](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/OutputParser.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### parse
|
||||
|
||||
▸ **parse**(`output`): `T`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `output` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`T`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[OutputParser.ts:7](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/OutputParser.ts#L7)
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: "BaseQueryEngine"
|
||||
title: "Interface: BaseQueryEngine"
|
||||
sidebar_label: "BaseQueryEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A query engine is a question answerer that can use one or more steps.
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`RetrieverQueryEngine`](../classes/RetrieverQueryEngine.md)
|
||||
- [`SubQuestionQueryEngine`](../classes/SubQuestionQueryEngine.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### query
|
||||
|
||||
▸ **query**(`query`, `parentEvent?`): `Promise`<[`Response`](../classes/Response.md)\>
|
||||
|
||||
Query the query engine and get a response.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `parentEvent?` | [`Event`](Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](../classes/Response.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QueryEngine.ts:24](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QueryEngine.ts#L24)
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
id: "BaseQuestionGenerator"
|
||||
title: "Interface: BaseQuestionGenerator"
|
||||
sidebar_label: "BaseQuestionGenerator"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
QuestionGenerators generate new questions for the LLM using tools and a user query.
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`LLMQuestionGenerator`](../classes/LLMQuestionGenerator.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### generate
|
||||
|
||||
▸ **generate**(`tools`, `query`): `Promise`<[`SubQuestion`](SubQuestion.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `tools` | [`ToolMetadata`](ToolMetadata.md)[] |
|
||||
| `query` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SubQuestion`](SubQuestion.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[QuestionGenerator.ts:23](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/QuestionGenerator.ts#L23)
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
id: "BaseReader"
|
||||
title: "Interface: BaseReader"
|
||||
sidebar_label: "BaseReader"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A reader takes imports data into Document objects.
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`PDFReader`](../classes/PDFReader.md)
|
||||
- [`SimpleDirectoryReader`](../classes/SimpleDirectoryReader.md)
|
||||
- [`TextFileReader`](../classes/TextFileReader.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### loadData
|
||||
|
||||
▸ **loadData**(`...args`): `Promise`<[`Document`](../classes/Document.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `...args` | `any`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Document`](../classes/Document.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[readers/base.ts:7](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/readers/base.ts#L7)
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
id: "BaseRetriever"
|
||||
title: "Interface: BaseRetriever"
|
||||
sidebar_label: "BaseRetriever"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Retrievers retrieve the nodes that most closely match our query in similarity.
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`ListIndexLLMRetriever`](../classes/ListIndexLLMRetriever.md)
|
||||
- [`ListIndexRetriever`](../classes/ListIndexRetriever.md)
|
||||
- [`VectorIndexRetriever`](../classes/VectorIndexRetriever.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### getServiceContext
|
||||
|
||||
▸ **getServiceContext**(): [`ServiceContext`](ServiceContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ServiceContext`](ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Retriever.ts:10](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Retriever.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`query`, `parentEvent?`): `Promise`<[`NodeWithScore`](NodeWithScore.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | `string` |
|
||||
| `parentEvent?` | [`Event`](Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`NodeWithScore`](NodeWithScore.md)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Retriever.ts:9](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Retriever.ts#L9)
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
id: "BaseTool"
|
||||
title: "Interface: BaseTool"
|
||||
sidebar_label: "BaseTool"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Simple Tool interface. Likely to change.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- **`BaseTool`**
|
||||
|
||||
↳ [`QueryEngineTool`](QueryEngineTool.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: [`ToolMetadata`](ToolMetadata.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Tool.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Tool.ts#L12)
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
id: "ChatEngine"
|
||||
title: "Interface: ChatEngine"
|
||||
sidebar_label: "ChatEngine"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A ChatEngine is used to handle back and forth chats between the application and the LLM.
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`CondenseQuestionChatEngine`](../classes/CondenseQuestionChatEngine.md)
|
||||
- [`ContextChatEngine`](../classes/ContextChatEngine.md)
|
||||
- [`SimpleChatEngine`](../classes/SimpleChatEngine.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`message`, `chatHistory?`): `Promise`<[`Response`](../classes/Response.md)\>
|
||||
|
||||
Send message along with the class's current chat history to the LLM.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `message` | `string` | |
|
||||
| `chatHistory?` | [`ChatMessage`](ChatMessage.md)[] | optional chat history if you want to customize the chat history |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Response`](../classes/Response.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:25](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### reset
|
||||
|
||||
▸ **reset**(): `void`
|
||||
|
||||
Resets the chat history so that it's empty.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ChatEngine.ts:30](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ChatEngine.ts#L30)
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
id: "ChatMessage"
|
||||
title: "Interface: ChatMessage"
|
||||
sidebar_label: "ChatMessage"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### content
|
||||
|
||||
• **content**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:28](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### role
|
||||
|
||||
• **role**: [`MessageType`](../modules.md#messagetype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:29](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L29)
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: "ChatResponse"
|
||||
title: "Interface: ChatResponse"
|
||||
sidebar_label: "ChatResponse"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### delta
|
||||
|
||||
• `Optional` **delta**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:35](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### message
|
||||
|
||||
• **message**: [`ChatMessage`](ChatMessage.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:33](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### raw
|
||||
|
||||
• `Optional` **raw**: `Record`<`string`, `any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:34](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L34)
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "Event"
|
||||
title: "Interface: Event"
|
||||
sidebar_label: "Event"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### id
|
||||
|
||||
• **id**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:13](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### parentId
|
||||
|
||||
• `Optional` **parentId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### tags
|
||||
|
||||
• `Optional` **tags**: [`EventTag`](../modules.md#eventtag)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:15](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: [`EventType`](../modules.md#eventtype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:14](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L14)
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: "ExactMatchFilter"
|
||||
title: "Interface: ExactMatchFilter"
|
||||
sidebar_label: "ExactMatchFilter"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### filterType
|
||||
|
||||
• **filterType**: ``"ExactMatch"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:24](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### key
|
||||
|
||||
• **key**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:25](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### value
|
||||
|
||||
• **value**: `string` \| `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:26](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L26)
|
||||
@@ -0,0 +1,100 @@
|
||||
---
|
||||
id: "GenericFileSystem"
|
||||
title: "Interface: GenericFileSystem"
|
||||
sidebar_label: "GenericFileSystem"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A filesystem interface that is meant to be compatible with
|
||||
the 'fs' module from Node.js.
|
||||
Allows for the use of similar inteface implementation on
|
||||
browsers.
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`InMemoryFileSystem`](../classes/InMemoryFileSystem.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### access
|
||||
|
||||
▸ **access**(`path`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### mkdir
|
||||
|
||||
▸ **mkdir**(`path`, `options?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:13](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### readFile
|
||||
|
||||
▸ **readFile**(`path`, `options?`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:11](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### writeFile
|
||||
|
||||
▸ **writeFile**(`path`, `content`, `options?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `path` | `string` |
|
||||
| `content` | `string` |
|
||||
| `options?` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/FileSystem.ts:10](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/FileSystem.ts#L10)
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
id: "LLM"
|
||||
title: "Interface: LLM"
|
||||
sidebar_label: "LLM"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Unified language model interface
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`Anthropic`](../classes/Anthropic.md)
|
||||
- [`LlamaDeuce`](../classes/LlamaDeuce.md)
|
||||
- [`OpenAI`](../classes/OpenAI.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### chat
|
||||
|
||||
▸ **chat**(`messages`, `parentEvent?`): `Promise`<[`ChatResponse`](ChatResponse.md)\>
|
||||
|
||||
Get a chat response from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](ChatMessage.md)[] |
|
||||
| `parentEvent?` | [`Event`](Event.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](ChatResponse.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### complete
|
||||
|
||||
▸ **complete**(`prompt`, `parentEvent?`): `Promise`<[`ChatResponse`](ChatResponse.md)\>
|
||||
|
||||
Get a prompt completion from the LLM
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `prompt` | `string` | the prompt to complete |
|
||||
| `parentEvent?` | [`Event`](Event.md) | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ChatResponse`](ChatResponse.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:55](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L55)
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
id: "MetadataFilters"
|
||||
title: "Interface: MetadataFilters"
|
||||
sidebar_label: "MetadataFilters"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### filters
|
||||
|
||||
• **filters**: [`ExactMatchFilter`](ExactMatchFilter.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:30](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L30)
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: "MetadataInfo"
|
||||
title: "Interface: MetadataInfo"
|
||||
sidebar_label: "MetadataInfo"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### description
|
||||
|
||||
• **description**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### name
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:40](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### type
|
||||
|
||||
• **type**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/types.ts:41](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/types.ts#L41)
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: "NodeParser"
|
||||
title: "Interface: NodeParser"
|
||||
sidebar_label: "NodeParser"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A NodeParser generates TextNodes from Documents
|
||||
|
||||
## Implemented by
|
||||
|
||||
- [`SimpleNodeParser`](../classes/SimpleNodeParser.md)
|
||||
|
||||
## Methods
|
||||
|
||||
### getNodesFromDocuments
|
||||
|
||||
▸ **getNodesFromDocuments**(`documents`): [`TextNode`](../classes/TextNode.md)[]
|
||||
|
||||
Generates an array of nodes from an array of documents.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `documents` | [`Document`](../classes/Document.md)[] | The documents to generate nodes from. |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TextNode`](../classes/TextNode.md)[]
|
||||
|
||||
An array of nodes.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[NodeParser.ts:73](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/NodeParser.ts#L73)
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
id: "NodeWithEmbedding"
|
||||
title: "Interface: NodeWithEmbedding"
|
||||
sidebar_label: "NodeWithEmbedding"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A node with an embedding
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• **embedding**: `number`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:277](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L277)
|
||||
|
||||
___
|
||||
|
||||
### node
|
||||
|
||||
• **node**: [`BaseNode`](../classes/BaseNode.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:276](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L276)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user