mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-01 22:14:03 -04:00
Compare commits
249 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 824c13cb85 | |||
| 0904d3dc5d | |||
| 18b8915f22 | |||
| 9bbfc2414e | |||
| 9487aa1ed5 | |||
| fd74c52fe8 | |||
| 0d2bf51a2e | |||
| 551c0edadf | |||
| f80b06293b | |||
| b3fec86413 | |||
| ab886a34d7 | |||
| 1ec9da120e | |||
| 817178272d | |||
| 3316c6b41c | |||
| 9214b0669d | |||
| b3d659b9af | |||
| 05b0fca610 | |||
| 64b909f436 | |||
| a2e6299aaa | |||
| 1fbfcab55e | |||
| 7db567ea74 | |||
| 6354c16776 | |||
| eb4c3dd3c7 | |||
| 8a4330132c | |||
| f2d4f828d4 | |||
| fe8030a9ad | |||
| ec12633ae0 | |||
| 5e24733e41 | |||
| a13911435f | |||
| 857bb4596a | |||
| 1359de75b5 | |||
| f9d1a6e013 | |||
| b18e1228a8 | |||
| b501eb5a19 | |||
| bfab1d407b | |||
| 4ef334a70f | |||
| af60503115 | |||
| b3a7a9df2c | |||
| 6b90e4c1b3 | |||
| 108634b94f | |||
| 4bb92be1e4 | |||
| 7678d319f2 | |||
| aaff02bc4b | |||
| 34f5398f41 | |||
| c06d1e5b09 | |||
| 0af7773c40 | |||
| a44ee19114 | |||
| 2726e375ea | |||
| b599813600 | |||
| bea4af984f | |||
| 5dbbb7d4c1 | |||
| c8ea424c7a | |||
| 8de110e577 | |||
| 7e82b89f36 | |||
| 669483699f | |||
| 672dde6e58 | |||
| 31a1a4b4d0 | |||
| f12a8d8006 | |||
| 03ea3af58c | |||
| cc2585360b | |||
| ff59660585 | |||
| 6063ce22fd | |||
| bc7cf343cc | |||
| 938eaf5d2d | |||
| a0bf44addb | |||
| 8d7e1624c7 | |||
| d1c9f30dfc | |||
| e57eb0caa3 | |||
| 7699f5432d | |||
| fe3b1f4f50 | |||
| 35f3030db6 | |||
| c0f31bbef2 | |||
| 0f654ae04b | |||
| be2dc5df28 | |||
| d6aeedd0e3 | |||
| dc91f5fdf7 | |||
| 4f6f245006 | |||
| ac69adba7a | |||
| b0bb4108a8 | |||
| 6ff932a055 | |||
| c850e7578b | |||
| 577534813d | |||
| 7d2fe9c69f | |||
| 68bdaaa657 | |||
| 7db9bc0c63 | |||
| cd8d22b33f | |||
| 802860050f | |||
| 3fda1deece | |||
| fb7fb760a0 | |||
| a4d6d7bc7d | |||
| f7cc69b5ec | |||
| 74b34a3730 | |||
| fc2a1b527e | |||
| 3e85a90b92 | |||
| 74ab98ddec | |||
| bff788b484 | |||
| 3e1abd2c6c | |||
| 79c76ea9d7 | |||
| 6f2cb31d41 | |||
| cc88141772 | |||
| 02d9bb0518 | |||
| 5321fb3135 | |||
| ea5038e4b7 | |||
| b012207764 | |||
| 9fa6d4a8a7 | |||
| c77dd18f2d | |||
| bb7c0d7deb | |||
| 80d3fc9482 | |||
| 79a721226d | |||
| ed36d41024 | |||
| 9a15c8ece0 | |||
| 9c5220ce75 | |||
| 8c67635041 | |||
| fc7f35141a | |||
| fc65e6b97d | |||
| 629bd3239a | |||
| 31c99baf1c | |||
| b2810777ef | |||
| 805d6fb81d | |||
| 9c566b0530 | |||
| daa14b8a5f | |||
| ed4fe4ac22 | |||
| b76562061e | |||
| baa91540cf | |||
| a594e22d2d | |||
| 91615a6602 | |||
| 43144ae782 | |||
| e927fc1800 | |||
| a08e904834 | |||
| 90429ab63d | |||
| abaab0caca | |||
| bc5c2e5c7b | |||
| c3e4b37414 | |||
| 63906798e8 | |||
| d7c2453c7d | |||
| 6a61ea46bf | |||
| 5a765aa1d6 | |||
| 3cab956f94 | |||
| c65d671ddb | |||
| 985f3b52bb | |||
| 4636a763b0 | |||
| f4ddf89b51 | |||
| ca9410f702 | |||
| 50c0b04017 | |||
| 41464386d6 | |||
| a07a94108d | |||
| a7cc8020db | |||
| 761fa4d836 | |||
| ade5587a15 | |||
| 2db8a8c2e3 | |||
| 3ad826e358 | |||
| 87925a36e6 | |||
| fc6ff47fd2 | |||
| 17b22f4673 | |||
| b033d0fbe9 | |||
| 122ab88fa5 | |||
| 73c188761f | |||
| 0fbf7b4ace | |||
| f9394ebb22 | |||
| 05f2f388d9 | |||
| d489a2120f | |||
| 8954a80e04 | |||
| f264211550 | |||
| 4d990d012c | |||
| 2683121ee1 | |||
| 08c2d4620f | |||
| 643ad626cd | |||
| 2619d4175d | |||
| b00821dbe9 | |||
| b0a742c3e6 | |||
| 9d0cadfc5f | |||
| 4ea034082b | |||
| 2298f42c18 | |||
| a67bfe26ed | |||
| d73ac8e718 | |||
| 213a68bb0f | |||
| 5bba0de1f3 | |||
| f1d609df5f | |||
| f9f6dc6985 | |||
| 4ae690612a | |||
| dc74b40c7a | |||
| b6b2598119 | |||
| 5cd54e2f98 | |||
| 8b7a94f8c5 | |||
| 44ab4d838f | |||
| 372ac1a24b | |||
| 09f02ff9b3 | |||
| 9dc30f5385 | |||
| 5871959c15 | |||
| e108757255 | |||
| 3cdc7e3feb | |||
| bc1a0fe651 | |||
| 5752fb6921 | |||
| f36f4b2dae | |||
| 8ee5503505 | |||
| da7199b3e9 | |||
| 67be6f373a | |||
| d5cbaa9ec7 | |||
| e7206a7dea | |||
| 5cdab4e311 | |||
| ee293da4f6 | |||
| 5a50ed2dfe | |||
| 452b678450 | |||
| abafa6014c | |||
| 1a3940376a | |||
| 775be4da64 | |||
| fcd70abc1f | |||
| 737623443c | |||
| 07c5aeba13 | |||
| d16113adbb | |||
| 4649536f33 | |||
| df4b1ad8a3 | |||
| 6eb44a4c13 | |||
| cdf1685f7c | |||
| 2f468ab132 | |||
| 1e510093ef | |||
| f9520d9374 | |||
| 2c141d2528 | |||
| bcca3b896c | |||
| 0bec460937 | |||
| 5d8d344e1f | |||
| 81e22587eb | |||
| 539ec0fe3d | |||
| ebf3bc19fd | |||
| 204b8f5316 | |||
| 71dd461a47 | |||
| 0c881c8fde | |||
| 35a6795559 | |||
| 968109455d | |||
| 815a3416f2 | |||
| 407069ca27 | |||
| 29d042175e | |||
| bbf936e9b4 | |||
| 2212793420 | |||
| 5487de8c37 | |||
| 2a038c00ec | |||
| d6c6aefd0d | |||
| 4516363097 | |||
| 69dd6d4efa | |||
| 9ea840142b | |||
| a1c45294b3 | |||
| c2ef5057b3 | |||
| b87e6d9ced | |||
| 8d618a6bc3 | |||
| 8d8bee5263 | |||
| ed924641ca | |||
| ce61f9660b | |||
| 072b13cff0 | |||
| ff274dde1d |
@@ -0,0 +1,8 @@
|
||||
# Changesets
|
||||
|
||||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
||||
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
||||
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
||||
|
||||
We have a quick list of common questions to get you started engaging with this project in
|
||||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"llamaindex": patch
|
||||
---
|
||||
|
||||
Breaking: allow documents to be reimported with hash checking.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"llamaindex": patch
|
||||
---
|
||||
|
||||
Update storage exports (thanks @TomPenguin)
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
|
||||
"changelog": "@changesets/cli/changelog",
|
||||
"commit": false,
|
||||
"fixed": [],
|
||||
"linked": [],
|
||||
"access": "public",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"llamaindex": patch
|
||||
---
|
||||
|
||||
Breaking: removed nodeId and docId. Just use id\_
|
||||
@@ -0,0 +1,11 @@
|
||||
name: Bugfix
|
||||
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
|
||||
@@ -0,0 +1,11 @@
|
||||
name: Feature Request
|
||||
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 for Sweep
|
||||
placeholder: The new endpoint should use the ... class from ... file because it contains ... logic
|
||||
@@ -0,0 +1,11 @@
|
||||
name: Refactor
|
||||
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 for Sweep
|
||||
placeholder: We are migrating this function to ... version because ...
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Lint on push or pull request
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Run Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm i -g pnpm
|
||||
pnpm install
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
@@ -34,3 +34,5 @@ yarn-error.log*
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
dist/
|
||||
|
||||
Vendored
+4
-1
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"[xml]": {
|
||||
"editor.defaultFormatter": "redhat.vscode-xml"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
# Contributing
|
||||
|
||||
## Structure
|
||||
|
||||
This is a monorepo built with Turborepo
|
||||
|
||||
Right now there are two packages of importance:
|
||||
|
||||
packages/core which is the main NPM library llamaindex
|
||||
|
||||
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
|
||||
|
||||
Install NodeJS. Preferably v18 using nvm or n.
|
||||
|
||||
Inside the LlamaIndexTS directory:
|
||||
|
||||
```
|
||||
npm i -g pnpm ts-node
|
||||
pnpm install
|
||||
```
|
||||
|
||||
Note: we use pnpm in this repo, which has a lot of the same functionality and CLI options as npm but it does do some things better in a monorepo, like centralizing dependencies and caching.
|
||||
|
||||
PNPM's has documentation on its [workspace feature](https://pnpm.io/workspaces) and Turborepo had some [useful documentation also](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks).
|
||||
|
||||
### Running Typescript
|
||||
|
||||
When we publish to NPM we will have a tsc compiled version of the library in JS. For now, the easiest thing to do is use ts-node.
|
||||
|
||||
### Test cases
|
||||
|
||||
To run them, run
|
||||
|
||||
```
|
||||
pnpm run test
|
||||
```
|
||||
|
||||
To write new test cases write them in [packages/core/src/tests](/packages/core/src/tests)
|
||||
|
||||
We use Jest https://jestjs.io/ to write our test cases. Jest comes with a bunch of built in assertions using the expect function: https://jestjs.io/docs/expect
|
||||
|
||||
### Demo applications
|
||||
|
||||
There is an existing ["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]
|
||||
```
|
||||
|
||||
To install packages for every package or application run
|
||||
|
||||
```
|
||||
pnpm add -w [NPM Package]
|
||||
```
|
||||
|
||||
### Docs
|
||||
|
||||
To contribute to the docs, go to the docs website folder and run the Docusaurus instance.
|
||||
|
||||
```bash
|
||||
cd apps/docs
|
||||
pnpm install
|
||||
pnpm start
|
||||
```
|
||||
|
||||
That should start a webserver which will serve the docs on https://localhost:3000
|
||||
|
||||
Any changes you make should be reflected in the browser. If you need to regenerate the API docs and find that your TSDoc isn't getting the updates, feel free to remove apps/docs/api. It will automatically regenerate itself when you run pnpm start again.
|
||||
@@ -1,64 +1,99 @@
|
||||
# LlamaScript: LlamaIndex for TS/JS
|
||||
# LlamaIndex.TS
|
||||
|
||||
## Structure
|
||||
LlamaIndex is a data framework for your LLM application.
|
||||
|
||||
This is a monorepo built with Turborepo
|
||||
Use your own data with large language models (LLMs, OpenAI ChatGPT and others) in Typescript and Javascript.
|
||||
|
||||
Right now there are two packages of importance:
|
||||
Documentation: https://ts.llamaindex.ai/
|
||||
|
||||
packages/core which is the main NPM library @llamaindex/core
|
||||
## What is LlamaIndex.TS?
|
||||
|
||||
apps/simple is where the demo code lives
|
||||
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.
|
||||
|
||||
### Turborepo docs
|
||||
## Getting started with an example:
|
||||
|
||||
You can checkout how Turborepo works using the built in [README-turborepo.md](README-turborepo.md)
|
||||
LlamaIndex.TS requries Node v18 or higher. You can download it from https://nodejs.org or use https://nvm.sh (our preferred option).
|
||||
|
||||
## Getting Started
|
||||
In a new folder:
|
||||
|
||||
Install NodeJS. Preferably v18 using nvm or n.
|
||||
|
||||
Inside the llamascript directory:
|
||||
|
||||
```
|
||||
npm i -g pnpm ts-node
|
||||
pnpm install
|
||||
```bash
|
||||
export OPENAI_API_KEY="sk-......" # Replace with your key from https://platform.openai.com/account/api-keys
|
||||
pnpm init
|
||||
pnpm install typescript
|
||||
pnpm exec tsc –-init # if needed
|
||||
pnpm install llamaindex
|
||||
pnpm install @types/node
|
||||
```
|
||||
|
||||
Note: we use pnpm in this repo, which has a lot of the same functionality and CLI options as npm but it does do some things better in a monorepo, like centralizing dependencies and caching.
|
||||
Create the file example.ts
|
||||
|
||||
PNPM's has documentation on its [workspace feature](https://pnpm.io/workspaces) and Turborepo had some [useful documentation also](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks).
|
||||
```ts
|
||||
// example.ts
|
||||
import fs from "fs/promises";
|
||||
import { Document, VectorStoreIndex } from "llamaindex";
|
||||
|
||||
### Running Typescript
|
||||
async function main() {
|
||||
// Load essay from abramov.txt in Node
|
||||
const essay = await fs.readFile(
|
||||
"node_modules/llamaindex/examples/abramov.txt",
|
||||
"utf-8"
|
||||
);
|
||||
|
||||
When we publish to NPM we will have a tsc compiled version of the library in JS. For now, the easiest thing to do is use ts-node.
|
||||
// Create Document object with essay
|
||||
const document = new Document({ text: essay });
|
||||
|
||||
### Test cases
|
||||
// Split text and create embeddings. Store them in a VectorStoreIndex
|
||||
const index = await VectorStoreIndex.fromDocuments([document]);
|
||||
|
||||
To run them, run
|
||||
// Query the index
|
||||
const queryEngine = index.asQueryEngine();
|
||||
const response = await queryEngine.query(
|
||||
"What did the author do in college?"
|
||||
);
|
||||
|
||||
```
|
||||
pnpm run test
|
||||
// Output response
|
||||
console.log(response.toString());
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
|
||||
To write new test cases write them in packages/core/src/tests
|
||||
Then you can run it using
|
||||
|
||||
We use Jest https://jestjs.io/ to write our test cases. Jest comes with a bunch of built in assertions using the expect function: https://jestjs.io/docs/expect
|
||||
|
||||
### Demo applications
|
||||
|
||||
You can create new demo applications in the apps folder. Just run pnpm init in the folder after you create it to create its own package.json
|
||||
|
||||
### Installing packages
|
||||
|
||||
To install packages for a specific package or demo application, run
|
||||
|
||||
```
|
||||
pnpm add [NPM Package] --filter [package or application i.e. core or simple]
|
||||
```bash
|
||||
pnpm dlx ts-node example.ts
|
||||
```
|
||||
|
||||
To install packages for every package or application run
|
||||
## Playground
|
||||
|
||||
```
|
||||
pnpm add -w [NPM Package]
|
||||
```
|
||||
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
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["custom"],
|
||||
};
|
||||
+10
-24
@@ -1,34 +1,20 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
# Dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
# Production
|
||||
/build
|
||||
|
||||
# misc
|
||||
# Generated files
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
@@ -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.
|
||||
@@ -1,30 +0,0 @@
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
||||
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
@@ -1,11 +0,0 @@
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { Button, Header } from "ui";
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<>
|
||||
<Header text="Docs" />
|
||||
<Button />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
BIN
Binary file not shown.
|
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:449](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L449)
|
||||
|
||||
## Properties
|
||||
|
||||
### apiKey
|
||||
|
||||
• `Optional` **apiKey**: `string` = `undefined`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:442](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L442)
|
||||
|
||||
___
|
||||
|
||||
### callbackManager
|
||||
|
||||
• `Optional` **callbackManager**: [`CallbackManager`](CallbackManager.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:447](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L447)
|
||||
|
||||
___
|
||||
|
||||
### maxRetries
|
||||
|
||||
• **maxRetries**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:443](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L443)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• `Optional` **maxTokens**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:439](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L439)
|
||||
|
||||
___
|
||||
|
||||
### model
|
||||
|
||||
• **model**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:436](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L436)
|
||||
|
||||
___
|
||||
|
||||
### session
|
||||
|
||||
• **session**: `AnthropicSession`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:445](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L445)
|
||||
|
||||
___
|
||||
|
||||
### temperature
|
||||
|
||||
• **temperature**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:437](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L437)
|
||||
|
||||
___
|
||||
|
||||
### timeout
|
||||
|
||||
• `Optional` **timeout**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:444](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L444)
|
||||
|
||||
___
|
||||
|
||||
### topP
|
||||
|
||||
• **topP**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:438](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L438)
|
||||
|
||||
## 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:484](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L484)
|
||||
|
||||
___
|
||||
|
||||
### 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:502](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L502)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPrompt
|
||||
|
||||
▸ **mapMessagesToPrompt**(`messages`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:469](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L469)
|
||||
@@ -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,216 @@
|
||||
---
|
||||
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:130](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L130)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `BaseDocumentStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:125](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:127](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: `T`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:128](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L128)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:123](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L123)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](../interfaces/StorageContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• `Optional` **vectorStore**: [`VectorStore`](../interfaces/VectorStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:126](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L126)
|
||||
|
||||
## 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:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L150)
|
||||
|
||||
___
|
||||
|
||||
### 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:143](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
### deleteRefDoc
|
||||
|
||||
▸ `Abstract` **deleteRefDoc**(`refDocId`, `deleteFromDocStore?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `refDocId` | `string` |
|
||||
| `deleteFromDocStore?` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:168](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L168)
|
||||
|
||||
___
|
||||
|
||||
### insert
|
||||
|
||||
▸ **insert**(`document`): `Promise`<`void`\>
|
||||
|
||||
Insert a document into the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `document` | [`Document`](Document.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:159](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L159)
|
||||
|
||||
___
|
||||
|
||||
### insertNodes
|
||||
|
||||
▸ `Abstract` **insertNodes**(`nodes`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:167](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L167)
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
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:55](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L55)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:50](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:51](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:53](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
The unique ID of the Node/Document. The trailing underscore is here
|
||||
to avoid collisions with the id keyword in Python.
|
||||
|
||||
Set to a UUID by default.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### relationships
|
||||
|
||||
• **relationships**: `Partial`<`Record`<[`NodeRelationship`](../enums/NodeRelationship.md), [`RelatedNodeType`](../modules.md#relatednodetype)\>\> = `{}`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:52](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L52)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:107](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:87](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:97](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L65)
|
||||
|
||||
## Methods
|
||||
|
||||
### asRelatedNodeInfo
|
||||
|
||||
▸ **asRelatedNodeInfo**(): [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:129](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ `Abstract` **generateHash**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:119](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L119)
|
||||
|
||||
___
|
||||
|
||||
### getContent
|
||||
|
||||
▸ `Abstract` **getContent**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:61](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L61)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### getMetadataStr
|
||||
|
||||
▸ `Abstract` **getMetadataStr**(`metadataMode`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `metadataMode` | [`MetadataMode`](../enums/MetadataMode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:62](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L62)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ `Abstract` **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:59](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L59)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ `Abstract` **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:63](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### toJSON
|
||||
|
||||
▸ **toJSON**(): `Record`<`string`, `any`\>
|
||||
|
||||
Used with built in JSON.stringify
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:141](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L141)
|
||||
@@ -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,492 @@
|
||||
---
|
||||
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:257](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L257)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[embedding](TextNode.md#embedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### endCharIdx
|
||||
|
||||
• `Optional` **endCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[endCharIdx](TextNode.md#endcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:152](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L152)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedEmbedMetadataKeys](TextNode.md#excludedembedmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:50](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedLlmMetadataKeys](TextNode.md#excludedllmmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:51](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[hash](TextNode.md#hash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:53](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
The unique ID of the Node/Document. The trailing underscore is here
|
||||
to avoid collisions with the id keyword in Python.
|
||||
|
||||
Set to a UUID by default.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[id_](TextNode.md#id_)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadata](TextNode.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### metadataSeparator
|
||||
|
||||
• **metadataSeparator**: `string` = `"\n"`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadataSeparator](TextNode.md#metadataseparator)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:155](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### 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:52](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### startCharIdx
|
||||
|
||||
• `Optional` **startCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[startCharIdx](TextNode.md#startcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:151](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L151)
|
||||
|
||||
___
|
||||
|
||||
### text
|
||||
|
||||
• **text**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[text](TextNode.md#text)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L150)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.childNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:107](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.nextNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:87](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.parentNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:97](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.prevNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.sourceNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L65)
|
||||
|
||||
## 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:129](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ **generateHash**(): `string`
|
||||
|
||||
Generate a hash of the text node.
|
||||
The ID is not part of the hash as it can change independent of content.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[generateHash](TextNode.md#generatehash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:173](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L173)
|
||||
|
||||
___
|
||||
|
||||
### 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:187](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L187)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getEmbedding](TextNode.md#getembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### 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:192](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L192)
|
||||
|
||||
___
|
||||
|
||||
### 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:219](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L219)
|
||||
|
||||
___
|
||||
|
||||
### getText
|
||||
|
||||
▸ **getText**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getText](TextNode.md#gettext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:223](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L223)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[TextNode](TextNode.md).[getType](TextNode.md#gettype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:266](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L266)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[setContent](TextNode.md#setcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:213](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
### 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:141](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L141)
|
||||
@@ -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,161 @@
|
||||
---
|
||||
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
|
||||
|
||||
### 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:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L46)
|
||||
|
||||
## Methods
|
||||
|
||||
### addNode
|
||||
|
||||
▸ **addNode**(`node`, `textId?`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `node` | [`BaseNode`](BaseNode.md) |
|
||||
| `textId?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:55](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
▸ **delete**(`nodeId`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodeId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:68](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### getSummary
|
||||
|
||||
▸ **getSummary**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[IndexStruct](IndexStruct.md).[getSummary](IndexStruct.md#getsummary)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:48](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### toJson
|
||||
|
||||
▸ **toJson**(): `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `unknown`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[IndexStruct](IndexStruct.md).[toJson](IndexStruct.md#tojson)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:60](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L60)
|
||||
@@ -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:93](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L93)
|
||||
|
||||
___
|
||||
|
||||
### 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:94](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L94)
|
||||
|
||||
## Methods
|
||||
|
||||
### addNode
|
||||
|
||||
▸ **addNode**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `node` | [`BaseNode`](BaseNode.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:96](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L96)
|
||||
|
||||
___
|
||||
|
||||
### 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:100](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L100)
|
||||
@@ -0,0 +1,502 @@
|
||||
---
|
||||
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:239](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L239)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[embedding](TextNode.md#embedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### endCharIdx
|
||||
|
||||
• `Optional` **endCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[endCharIdx](TextNode.md#endcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:152](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L152)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedEmbedMetadataKeys](TextNode.md#excludedembedmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:50](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[excludedLlmMetadataKeys](TextNode.md#excludedllmmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:51](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[hash](TextNode.md#hash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:53](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
The unique ID of the Node/Document. The trailing underscore is here
|
||||
to avoid collisions with the id keyword in Python.
|
||||
|
||||
Set to a UUID by default.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[id_](TextNode.md#id_)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### indexId
|
||||
|
||||
• **indexId**: `string` = `""`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:237](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L237)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadata](TextNode.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### metadataSeparator
|
||||
|
||||
• **metadataSeparator**: `string` = `"\n"`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[metadataSeparator](TextNode.md#metadataseparator)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:155](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### 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:52](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### startCharIdx
|
||||
|
||||
• `Optional` **startCharIdx**: `number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[startCharIdx](TextNode.md#startcharidx)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:151](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L151)
|
||||
|
||||
___
|
||||
|
||||
### text
|
||||
|
||||
• **text**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[text](TextNode.md#text)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L150)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.childNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:107](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.nextNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:87](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.parentNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:97](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.prevNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TextNode.sourceNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L65)
|
||||
|
||||
## 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:129](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ **generateHash**(): `string`
|
||||
|
||||
Generate a hash of the text node.
|
||||
The ID is not part of the hash as it can change independent of content.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[generateHash](TextNode.md#generatehash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:173](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L173)
|
||||
|
||||
___
|
||||
|
||||
### 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:187](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L187)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getEmbedding](TextNode.md#getembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### 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:192](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L192)
|
||||
|
||||
___
|
||||
|
||||
### 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:219](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L219)
|
||||
|
||||
___
|
||||
|
||||
### getText
|
||||
|
||||
▸ **getText**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[getText](TextNode.md#gettext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:223](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L223)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[TextNode](TextNode.md).[getType](TextNode.md#gettype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:248](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L248)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[TextNode](TextNode.md).[setContent](TextNode.md#setcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:213](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
### 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:141](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L141)
|
||||
@@ -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,350 @@
|
||||
---
|
||||
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:47](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L47)
|
||||
|
||||
## Properties
|
||||
|
||||
### docStore
|
||||
|
||||
• **docStore**: `BaseDocumentStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[docStore](BaseIndex.md#docstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:125](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStore](BaseIndex.md#indexstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:127](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: [`IndexList`](IndexList.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStruct](BaseIndex.md#indexstruct)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:128](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L128)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[serviceContext](BaseIndex.md#servicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:123](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L123)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](../interfaces/StorageContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[storageContext](BaseIndex.md#storagecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• `Optional` **vectorStore**: [`VectorStore`](../interfaces/VectorStore.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[vectorStore](BaseIndex.md#vectorstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:126](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L126)
|
||||
|
||||
## 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/list/ListIndex.ts:155](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### 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:142](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L142)
|
||||
|
||||
___
|
||||
|
||||
### deleteNodes
|
||||
|
||||
▸ **deleteNodes**(`nodeIds`, `deleteFromDocStore`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodeIds` | `string`[] |
|
||||
| `deleteFromDocStore` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:216](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L216)
|
||||
|
||||
___
|
||||
|
||||
### deleteRefDoc
|
||||
|
||||
▸ **deleteRefDoc**(`refDocId`, `deleteFromDocStore?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `refDocId` | `string` |
|
||||
| `deleteFromDocStore?` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[deleteRefDoc](BaseIndex.md#deleterefdoc)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:197](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L197)
|
||||
|
||||
___
|
||||
|
||||
### getRefDocInfo
|
||||
|
||||
▸ **getRefDocInfo**(): `Promise`<`Record`<`string`, `RefDocInfo`\>\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`string`, `RefDocInfo`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:230](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L230)
|
||||
|
||||
___
|
||||
|
||||
### insert
|
||||
|
||||
▸ **insert**(`document`): `Promise`<`void`\>
|
||||
|
||||
Insert a document into the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `document` | [`Document`](Document.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[insert](BaseIndex.md#insert)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:159](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L159)
|
||||
|
||||
___
|
||||
|
||||
### insertNodes
|
||||
|
||||
▸ **insertNodes**(`nodes`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[insertNodes](BaseIndex.md#insertnodes)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:191](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L191)
|
||||
|
||||
___
|
||||
|
||||
### 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:176](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L176)
|
||||
|
||||
___
|
||||
|
||||
### 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:116](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### init
|
||||
|
||||
▸ `Static` **init**(`options`): `Promise`<[`ListIndex`](ListIndex.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `options` | `ListIndexOptions` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ListIndex`](ListIndex.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:51](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L51)
|
||||
@@ -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,241 @@
|
||||
---
|
||||
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:266](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L266)
|
||||
|
||||
## Properties
|
||||
|
||||
### chatStrategy
|
||||
|
||||
• **chatStrategy**: [`DeuceChatStrategy`](../enums/DeuceChatStrategy.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:260](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L260)
|
||||
|
||||
___
|
||||
|
||||
### maxTokens
|
||||
|
||||
• `Optional` **maxTokens**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:263](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L263)
|
||||
|
||||
___
|
||||
|
||||
### model
|
||||
|
||||
• **model**: ``"Llama-2-70b-chat-old"`` \| ``"Llama-2-70b-chat-4bit"`` \| ``"Llama-2-13b-chat"`` \| ``"Llama-2-13b-chat-4bit"`` \| ``"Llama-2-7b-chat"`` \| ``"Llama-2-7b-chat-4bit"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:259](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L259)
|
||||
|
||||
___
|
||||
|
||||
### replicateSession
|
||||
|
||||
• **replicateSession**: `ReplicateSession`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:264](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L264)
|
||||
|
||||
___
|
||||
|
||||
### temperature
|
||||
|
||||
• **temperature**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:261](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L261)
|
||||
|
||||
___
|
||||
|
||||
### topP
|
||||
|
||||
• **topP**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:262](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L262)
|
||||
|
||||
## 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:385](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L385)
|
||||
|
||||
___
|
||||
|
||||
### 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:422](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L422)
|
||||
|
||||
___
|
||||
|
||||
### mapMessageTypeA16Z
|
||||
|
||||
▸ **mapMessageTypeA16Z**(`messageType`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messageType` | [`MessageType`](../modules.md#messagetype) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:309](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L309)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPrompt
|
||||
|
||||
▸ **mapMessagesToPrompt**(`messages`): `Object`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `prompt` | `string` |
|
||||
| `systemPrompt` | `undefined` \| `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:281](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L281)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPromptA16Z
|
||||
|
||||
▸ **mapMessagesToPromptA16Z**(`messages`): `Object`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `prompt` | `string` |
|
||||
| `systemPrompt` | `undefined` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:295](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L295)
|
||||
|
||||
___
|
||||
|
||||
### mapMessagesToPromptMeta
|
||||
|
||||
▸ **mapMessagesToPromptMeta**(`messages`, `opts?`): `Object`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
|
||||
| `opts?` | `Object` |
|
||||
| `opts.replicate4Bit?` | `boolean` |
|
||||
| `opts.withBos?` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `prompt` | `string` |
|
||||
| `systemPrompt` | `undefined` \| `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:322](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L322)
|
||||
@@ -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,480 @@
|
||||
---
|
||||
id: "SimpleDocumentStore"
|
||||
title: "Class: SimpleDocumentStore"
|
||||
sidebar_label: "SimpleDocumentStore"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `KVDocumentStore`
|
||||
|
||||
↳ **`SimpleDocumentStore`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleDocumentStore**(`kvStore?`, `namespace?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `kvStore?` | `SimpleKVStore` |
|
||||
| `namespace?` | `string` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
KVDocumentStore.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L19)
|
||||
|
||||
## Properties
|
||||
|
||||
### kvStore
|
||||
|
||||
• `Private` **kvStore**: `SimpleKVStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L17)
|
||||
|
||||
## Methods
|
||||
|
||||
### addDocuments
|
||||
|
||||
▸ **addDocuments**(`docs`, `allowUpdate?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `docs` | [`BaseNode`](BaseNode.md)[] | `undefined` |
|
||||
| `allowUpdate` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.addDocuments
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:33](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### deleteDocument
|
||||
|
||||
▸ **deleteDocument**(`docId`, `raiseError?`, `removeRefDocNode?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `docId` | `string` | `undefined` |
|
||||
| `raiseError` | `boolean` | `true` |
|
||||
| `removeRefDocNode` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.deleteDocument
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:131](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L131)
|
||||
|
||||
___
|
||||
|
||||
### deleteRefDoc
|
||||
|
||||
▸ **deleteRefDoc**(`refDocId`, `raiseError?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `refDocId` | `string` | `undefined` |
|
||||
| `raiseError` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.deleteRefDoc
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:148](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L148)
|
||||
|
||||
___
|
||||
|
||||
### docs
|
||||
|
||||
▸ **docs**(): `Promise`<`Record`<`string`, [`BaseNode`](BaseNode.md)\>\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`string`, [`BaseNode`](BaseNode.md)\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.docs
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:24](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### documentExists
|
||||
|
||||
▸ **documentExists**(`docId`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `docId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.documentExists
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:105](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L105)
|
||||
|
||||
___
|
||||
|
||||
### getAllRefDocInfo
|
||||
|
||||
▸ **getAllRefDocInfo**(): `Promise`<`undefined` \| `Record`<`string`, `RefDocInfo`\>\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `Record`<`string`, `RefDocInfo`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getAllRefDocInfo
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:93](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L93)
|
||||
|
||||
___
|
||||
|
||||
### getDocument
|
||||
|
||||
▸ **getDocument**(`docId`, `raiseError?`): `Promise`<`undefined` \| [`BaseNode`](BaseNode.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `docId` | `string` | `undefined` |
|
||||
| `raiseError` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| [`BaseNode`](BaseNode.md)\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getDocument
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:73](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
### getDocumentHash
|
||||
|
||||
▸ **getDocumentHash**(`docId`): `Promise`<`undefined` \| `string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `docId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `string`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getDocumentHash
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:174](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L174)
|
||||
|
||||
___
|
||||
|
||||
### getNode
|
||||
|
||||
▸ **getNode**(`nodeId`, `raiseError?`): `Promise`<[`BaseNode`](BaseNode.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `nodeId` | `string` | `undefined` |
|
||||
| `raiseError` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BaseNode`](BaseNode.md)\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/types.ts:57](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/types.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### getNodeDict
|
||||
|
||||
▸ **getNodeDict**(`nodeIdDict`): `Promise`<`Record`<`number`, [`BaseNode`](BaseNode.md)\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodeIdDict` | `Object` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`number`, [`BaseNode`](BaseNode.md)\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getNodeDict
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/types.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/types.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### getNodes
|
||||
|
||||
▸ **getNodes**(`nodeIds`, `raiseError?`): `Promise`<[`BaseNode`](BaseNode.md)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `nodeIds` | `string`[] | `undefined` |
|
||||
| `raiseError` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BaseNode`](BaseNode.md)[]\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/types.ts:51](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/types.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### getRefDocInfo
|
||||
|
||||
▸ **getRefDocInfo**(`refDocId`): `Promise`<`undefined` \| `RefDocInfo`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `refDocId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `RefDocInfo`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.getRefDocInfo
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:88](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
### persist
|
||||
|
||||
▸ **persist**(`persistPath?`, `fs?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `persistPath` | `string` |
|
||||
| `fs?` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
KVDocumentStore.persist
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:52](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### refDocExists
|
||||
|
||||
▸ **refDocExists**(`refDocId`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `refDocId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.refDocExists
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:101](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L101)
|
||||
|
||||
___
|
||||
|
||||
### setDocumentHash
|
||||
|
||||
▸ **setDocumentHash**(`docId`, `docHash`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `docId` | `string` |
|
||||
| `docHash` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVDocumentStore.setDocumentHash
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/KVDocumentStore.ts:169](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/KVDocumentStore.ts#L169)
|
||||
|
||||
___
|
||||
|
||||
### toDict
|
||||
|
||||
▸ **toDict**(): `SaveDict`
|
||||
|
||||
#### Returns
|
||||
|
||||
`SaveDict`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:73](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
### fromDict
|
||||
|
||||
▸ `Static` **fromDict**(`saveDict`, `namespace?`): [`SimpleDocumentStore`](SimpleDocumentStore.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `saveDict` | `SaveDict` |
|
||||
| `namespace?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SimpleDocumentStore`](SimpleDocumentStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:68](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### fromPersistDir
|
||||
|
||||
▸ `Static` **fromPersistDir**(`persistDir?`, `namespace?`, `fsModule?`): `Promise`<[`SimpleDocumentStore`](SimpleDocumentStore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `persistDir` | `string` | `DEFAULT_PERSIST_DIR` |
|
||||
| `namespace?` | `string` | `undefined` |
|
||||
| `fsModule?` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) | `undefined` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SimpleDocumentStore`](SimpleDocumentStore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:26](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### fromPersistPath
|
||||
|
||||
▸ `Static` **fromPersistPath**(`persistPath`, `namespace?`, `fs?`): `Promise`<[`SimpleDocumentStore`](SimpleDocumentStore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `persistPath` | `string` |
|
||||
| `namespace?` | `string` |
|
||||
| `fs?` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SimpleDocumentStore`](SimpleDocumentStore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/docStore/SimpleDocumentStore.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/docStore/SimpleDocumentStore.ts#L42)
|
||||
@@ -0,0 +1,234 @@
|
||||
---
|
||||
id: "SimpleIndexStore"
|
||||
title: "Class: SimpleIndexStore"
|
||||
sidebar_label: "SimpleIndexStore"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `KVIndexStore`
|
||||
|
||||
↳ **`SimpleIndexStore`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleIndexStore**(`kvStore?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `kvStore?` | `BaseInMemoryKVStore` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
KVIndexStore.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L16)
|
||||
|
||||
## Properties
|
||||
|
||||
### kvStore
|
||||
|
||||
• `Private` **kvStore**: `BaseInMemoryKVStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:14](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L14)
|
||||
|
||||
## Methods
|
||||
|
||||
### addIndexStruct
|
||||
|
||||
▸ **addIndexStruct**(`indexStruct`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `indexStruct` | [`IndexStruct`](IndexStruct.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVIndexStore.addIndexStruct
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/KVIndexStore.ts:17](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/KVIndexStore.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### deleteIndexStruct
|
||||
|
||||
▸ **deleteIndexStruct**(`key`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `key` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVIndexStore.deleteIndexStruct
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/KVIndexStore.ts:23](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/KVIndexStore.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### getIndexStruct
|
||||
|
||||
▸ **getIndexStruct**(`structId?`): `Promise`<`undefined` \| [`IndexStruct`](IndexStruct.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `structId?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| [`IndexStruct`](IndexStruct.md)\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVIndexStore.getIndexStruct
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/KVIndexStore.ts:27](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/KVIndexStore.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### getIndexStructs
|
||||
|
||||
▸ **getIndexStructs**(): `Promise`<[`IndexStruct`](IndexStruct.md)[]\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IndexStruct`](IndexStruct.md)[]\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
KVIndexStore.getIndexStructs
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/KVIndexStore.ts:43](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/KVIndexStore.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### persist
|
||||
|
||||
▸ **persist**(`persistPath?`, `fs?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `persistPath` | `string` | `DEFAULT_PERSIST_DIR` |
|
||||
| `fs` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) | `DEFAULT_FS` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
KVIndexStore.persist
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:41](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### toDict
|
||||
|
||||
▸ **toDict**(): `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `unknown`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:53](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### fromDict
|
||||
|
||||
▸ `Static` **fromDict**(`saveDict`): [`SimpleIndexStore`](SimpleIndexStore.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `saveDict` | `DataType` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SimpleIndexStore`](SimpleIndexStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:48](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### fromPersistDir
|
||||
|
||||
▸ `Static` **fromPersistDir**(`persistDir?`, `fs?`): `Promise`<[`SimpleIndexStore`](SimpleIndexStore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `persistDir` | `string` | `DEFAULT_PERSIST_DIR` |
|
||||
| `fs` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) | `DEFAULT_FS` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SimpleIndexStore`](SimpleIndexStore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:22](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### fromPersistPath
|
||||
|
||||
▸ `Static` **fromPersistPath**(`persistPath`, `fs?`): `Promise`<[`SimpleIndexStore`](SimpleIndexStore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `persistPath` | `string` | `undefined` |
|
||||
| `fs` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) | `DEFAULT_FS` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SimpleIndexStore`](SimpleIndexStore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/indexStore/SimpleIndexStore.ts:33](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/indexStore/SimpleIndexStore.ts#L33)
|
||||
@@ -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,283 @@
|
||||
---
|
||||
id: "SimpleVectorStore"
|
||||
title: "Class: SimpleVectorStore"
|
||||
sidebar_label: "SimpleVectorStore"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Implements
|
||||
|
||||
- [`VectorStore`](../interfaces/VectorStore.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SimpleVectorStore**(`data?`, `fs?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `data?` | `SimpleVectorStoreData` |
|
||||
| `fs?` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:37](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L37)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
• `Private` **data**: `SimpleVectorStoreData`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:33](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### fs
|
||||
|
||||
• `Private` **fs**: [`GenericFileSystem`](../interfaces/GenericFileSystem.md) = `DEFAULT_FS`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:34](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### persistPath
|
||||
|
||||
• `Private` **persistPath**: `undefined` \| `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:35](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### storesText
|
||||
|
||||
• **storesText**: `boolean` = `false`
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[VectorStore](../interfaces/VectorStore.md).[storesText](../interfaces/VectorStore.md#storestext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:32](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L32)
|
||||
|
||||
## Accessors
|
||||
|
||||
### client
|
||||
|
||||
• `get` **client**(): `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
#### Implementation of
|
||||
|
||||
VectorStore.client
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:50](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L50)
|
||||
|
||||
## Methods
|
||||
|
||||
### add
|
||||
|
||||
▸ **add**(`embeddingResults`): `Promise`<`string`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `embeddingResults` | [`NodeWithEmbedding`](../interfaces/NodeWithEmbedding.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`[]\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[VectorStore](../interfaces/VectorStore.md).[add](../interfaces/VectorStore.md#add)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:58](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
▸ **delete**(`refDocId`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `refDocId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[VectorStore](../interfaces/VectorStore.md).[delete](../interfaces/VectorStore.md#delete)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:78](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L78)
|
||||
|
||||
___
|
||||
|
||||
### get
|
||||
|
||||
▸ **get**(`textId`): `Promise`<`number`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `textId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:54](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
### persist
|
||||
|
||||
▸ **persist**(`persistPath?`, `fs?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `persistPath` | `string` |
|
||||
| `fs?` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[VectorStore](../interfaces/VectorStore.md).[persist](../interfaces/VectorStore.md#persist)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:147](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### query
|
||||
|
||||
▸ **query**(`query`): `Promise`<[`VectorStoreQueryResult`](../interfaces/VectorStoreQueryResult.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `query` | [`VectorStoreQuery`](../interfaces/VectorStoreQuery.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`VectorStoreQueryResult`](../interfaces/VectorStoreQueryResult.md)\>
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[VectorStore](../interfaces/VectorStore.md).[query](../interfaces/VectorStore.md#query)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:89](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L89)
|
||||
|
||||
___
|
||||
|
||||
### toDict
|
||||
|
||||
▸ **toDict**(): `SimpleVectorStoreData`
|
||||
|
||||
#### Returns
|
||||
|
||||
`SimpleVectorStoreData`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:197](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L197)
|
||||
|
||||
___
|
||||
|
||||
### fromDict
|
||||
|
||||
▸ `Static` **fromDict**(`saveDict`): [`SimpleVectorStore`](SimpleVectorStore.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `saveDict` | `SimpleVectorStoreData` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SimpleVectorStore`](SimpleVectorStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:190](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L190)
|
||||
|
||||
___
|
||||
|
||||
### fromPersistDir
|
||||
|
||||
▸ `Static` **fromPersistDir**(`persistDir?`, `fs?`): `Promise`<[`SimpleVectorStore`](SimpleVectorStore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `persistDir` | `string` | `DEFAULT_PERSIST_DIR` |
|
||||
| `fs` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) | `DEFAULT_FS` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SimpleVectorStore`](SimpleVectorStore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:42](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### fromPersistPath
|
||||
|
||||
▸ `Static` **fromPersistPath**(`persistPath`, `fs?`): `Promise`<[`SimpleVectorStore`](SimpleVectorStore.md)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `persistPath` | `string` |
|
||||
| `fs?` | [`GenericFileSystem`](../interfaces/GenericFileSystem.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SimpleVectorStore`](SimpleVectorStore.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[storage/vectorStore/SimpleVectorStore.ts:160](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/storage/vectorStore/SimpleVectorStore.ts#L160)
|
||||
@@ -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,472 @@
|
||||
---
|
||||
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:157](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L157)
|
||||
|
||||
## Properties
|
||||
|
||||
### embedding
|
||||
|
||||
• `Optional` **embedding**: `number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[embedding](BaseNode.md#embedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### endCharIdx
|
||||
|
||||
• `Optional` **endCharIdx**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:152](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L152)
|
||||
|
||||
___
|
||||
|
||||
### excludedEmbedMetadataKeys
|
||||
|
||||
• **excludedEmbedMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[excludedEmbedMetadataKeys](BaseNode.md#excludedembedmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:50](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### excludedLlmMetadataKeys
|
||||
|
||||
• **excludedLlmMetadataKeys**: `string`[] = `[]`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[excludedLlmMetadataKeys](BaseNode.md#excludedllmmetadatakeys)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:51](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### hash
|
||||
|
||||
• **hash**: `string` = `""`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[hash](BaseNode.md#hash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:53](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### id\_
|
||||
|
||||
• **id\_**: `string`
|
||||
|
||||
The unique ID of the Node/Document. The trailing underscore is here
|
||||
to avoid collisions with the id keyword in Python.
|
||||
|
||||
Set to a UUID by default.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[id_](BaseNode.md#id_)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\> = `{}`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[metadata](BaseNode.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:49](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### metadataSeparator
|
||||
|
||||
• **metadataSeparator**: `string` = `"\n"`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:155](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
### 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:52](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### startCharIdx
|
||||
|
||||
• `Optional` **startCharIdx**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:151](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L151)
|
||||
|
||||
___
|
||||
|
||||
### text
|
||||
|
||||
• **text**: `string` = `""`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:150](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L150)
|
||||
|
||||
## Accessors
|
||||
|
||||
### childNodes
|
||||
|
||||
• `get` **childNodes**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.childNodes
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:107](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### nextNode
|
||||
|
||||
• `get` **nextNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.nextNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:87](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### parentNode
|
||||
|
||||
• `get` **parentNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.parentNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:97](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### prevNode
|
||||
|
||||
• `get` **prevNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.prevNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
### sourceNode
|
||||
|
||||
• `get` **sourceNode**(): `undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| [`RelatedNodeInfo`](../interfaces/RelatedNodeInfo.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseNode.sourceNode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:65](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L65)
|
||||
|
||||
## 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:129](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### generateHash
|
||||
|
||||
▸ **generateHash**(): `string`
|
||||
|
||||
Generate a hash of the text node.
|
||||
The ID is not part of the hash as it can change independent of content.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[generateHash](BaseNode.md#generatehash)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:173](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L173)
|
||||
|
||||
___
|
||||
|
||||
### 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:187](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L187)
|
||||
|
||||
___
|
||||
|
||||
### getEmbedding
|
||||
|
||||
▸ **getEmbedding**(): `number`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseNode](BaseNode.md).[getEmbedding](BaseNode.md#getembedding)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:121](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
### 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:192](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L192)
|
||||
|
||||
___
|
||||
|
||||
### getNodeInfo
|
||||
|
||||
▸ **getNodeInfo**(): `Object`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `end` | `undefined` \| `number` |
|
||||
| `start` | `undefined` \| `number` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:219](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L219)
|
||||
|
||||
___
|
||||
|
||||
### getText
|
||||
|
||||
▸ **getText**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:223](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L223)
|
||||
|
||||
___
|
||||
|
||||
### getType
|
||||
|
||||
▸ **getType**(): [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[getType](BaseNode.md#gettype)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:183](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L183)
|
||||
|
||||
___
|
||||
|
||||
### setContent
|
||||
|
||||
▸ **setContent**(`value`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `value` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseNode](BaseNode.md).[setContent](BaseNode.md#setcontent)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:213](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
### 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:141](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L141)
|
||||
@@ -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,347 @@
|
||||
---
|
||||
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:125](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStore](BaseIndex.md#indexstore)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:127](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: [`IndexDict`](IndexDict.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[indexStruct](BaseIndex.md#indexstruct)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:128](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L128)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](../interfaces/ServiceContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[serviceContext](BaseIndex.md#servicecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:123](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L123)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](../interfaces/StorageContext.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[storageContext](BaseIndex.md#storagecontext)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:124](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L124)
|
||||
|
||||
___
|
||||
|
||||
### 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:223](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L223)
|
||||
|
||||
___
|
||||
|
||||
### 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:219](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L219)
|
||||
|
||||
___
|
||||
|
||||
### deleteRefDoc
|
||||
|
||||
▸ **deleteRefDoc**(`refDocId`, `deleteFromDocStore?`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `refDocId` | `string` | `undefined` |
|
||||
| `deleteFromDocStore` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[deleteRefDoc](BaseIndex.md#deleterefdoc)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:259](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L259)
|
||||
|
||||
___
|
||||
|
||||
### insert
|
||||
|
||||
▸ **insert**(`document`): `Promise`<`void`\>
|
||||
|
||||
Insert a document into the index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `document` | [`Document`](Document.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseIndex](BaseIndex.md).[insert](BaseIndex.md#insert)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:159](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L159)
|
||||
|
||||
___
|
||||
|
||||
### insertNodes
|
||||
|
||||
▸ **insertNodes**(`nodes`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `nodes` | [`BaseNode`](BaseNode.md)[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[BaseIndex](BaseIndex.md).[insertNodes](BaseIndex.md#insertnodes)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:234](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L234)
|
||||
|
||||
___
|
||||
|
||||
### buildIndexFromNodes
|
||||
|
||||
▸ `Static` **buildIndexFromNodes**(`nodes`, `serviceContext`, `vectorStore`, `docStore`, `indexDict?`): `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` |
|
||||
| `indexDict?` | [`IndexDict`](IndexDict.md) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IndexDict`](IndexDict.md)\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/vectorStore/VectorStoreIndex.ts:147](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### 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:194](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L194)
|
||||
|
||||
___
|
||||
|
||||
### 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:119](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/vectorStore/VectorStoreIndex.ts#L119)
|
||||
|
||||
___
|
||||
|
||||
### 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,47 @@
|
||||
---
|
||||
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:246](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L246)
|
||||
|
||||
___
|
||||
|
||||
### META
|
||||
|
||||
• **META** = ``"meta"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:247](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L247)
|
||||
|
||||
___
|
||||
|
||||
### METAWBOS
|
||||
|
||||
• **METAWBOS** = ``"metawbos"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:248](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L248)
|
||||
|
||||
___
|
||||
|
||||
### REPLICATE4BIT
|
||||
|
||||
• **REPLICATE4BIT** = ``"replicate4bit"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[llm/LLM.ts:251](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L251)
|
||||
@@ -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:30](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### LLM
|
||||
|
||||
• **LLM** = ``"llm"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/list/ListIndex.ts:32](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/list/ListIndex.ts#L32)
|
||||
@@ -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:20](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### EMBED
|
||||
|
||||
• **EMBED** = ``"EMBED"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:21](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### LLM
|
||||
|
||||
• **LLM** = ``"LLM"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:22](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### NONE
|
||||
|
||||
• **NONE** = ``"NONE"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:23](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L23)
|
||||
@@ -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:9](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L9)
|
||||
|
||||
___
|
||||
|
||||
### NEXT
|
||||
|
||||
• **NEXT** = ``"NEXT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:7](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### PARENT
|
||||
|
||||
• **PARENT** = ``"PARENT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:8](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L8)
|
||||
|
||||
___
|
||||
|
||||
### PREVIOUS
|
||||
|
||||
• **PREVIOUS** = ``"PREVIOUS"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:6](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### SOURCE
|
||||
|
||||
• **SOURCE** = ``"SOURCE"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:5](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L5)
|
||||
@@ -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:16](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### IMAGE
|
||||
|
||||
• **IMAGE** = ``"IMAGE"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:14](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### INDEX
|
||||
|
||||
• **INDEX** = ``"INDEX"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:15](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### TEXT
|
||||
|
||||
• **TEXT** = ``"TEXT"``
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:13](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L13)
|
||||
@@ -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:112](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L112)
|
||||
|
||||
___
|
||||
|
||||
### indexStore
|
||||
|
||||
• `Optional` **indexStore**: `BaseIndexStore`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:114](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L114)
|
||||
|
||||
___
|
||||
|
||||
### indexStruct
|
||||
|
||||
• **indexStruct**: `T`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:115](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L115)
|
||||
|
||||
___
|
||||
|
||||
### serviceContext
|
||||
|
||||
• **serviceContext**: [`ServiceContext`](ServiceContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:110](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L110)
|
||||
|
||||
___
|
||||
|
||||
### storageContext
|
||||
|
||||
• **storageContext**: [`StorageContext`](StorageContext.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:111](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### vectorStore
|
||||
|
||||
• `Optional` **vectorStore**: [`VectorStore`](VectorStore.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[indices/BaseIndex.ts:113](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/indices/BaseIndex.ts#L113)
|
||||
@@ -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:305](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L305)
|
||||
|
||||
___
|
||||
|
||||
### node
|
||||
|
||||
• **node**: [`BaseNode`](../classes/BaseNode.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:304](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L304)
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
id: "NodeWithScore"
|
||||
title: "Interface: NodeWithScore"
|
||||
sidebar_label: "NodeWithScore"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A node with a similarity score
|
||||
|
||||
## Properties
|
||||
|
||||
### node
|
||||
|
||||
• **node**: [`BaseNode`](../classes/BaseNode.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:296](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L296)
|
||||
|
||||
___
|
||||
|
||||
### score
|
||||
|
||||
• **score**: `number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:297](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L297)
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
id: "QueryEngineTool"
|
||||
title: "Interface: QueryEngineTool"
|
||||
sidebar_label: "QueryEngineTool"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
A Tool that uses a QueryEngine.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- [`BaseTool`](BaseTool.md)
|
||||
|
||||
↳ **`QueryEngineTool`**
|
||||
|
||||
## Properties
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: [`ToolMetadata`](ToolMetadata.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[BaseTool](BaseTool.md).[metadata](BaseTool.md#metadata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Tool.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Tool.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### queryEngine
|
||||
|
||||
• **queryEngine**: [`BaseQueryEngine`](BaseQueryEngine.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Tool.ts:19](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Tool.ts#L19)
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "RelatedNodeInfo"
|
||||
title: "Interface: RelatedNodeInfo"
|
||||
sidebar_label: "RelatedNodeInfo"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### hash
|
||||
|
||||
• `Optional` **hash**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:30](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### metadata
|
||||
|
||||
• **metadata**: `Record`<`string`, `any`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:29](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### nodeId
|
||||
|
||||
• **nodeId**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:27](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### nodeType
|
||||
|
||||
• `Optional` **nodeType**: [`ObjectType`](../enums/ObjectType.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[Node.ts:28](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/Node.ts#L28)
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "RetrievalCallbackResponse"
|
||||
title: "Interface: RetrievalCallbackResponse"
|
||||
sidebar_label: "RetrievalCallbackResponse"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `BaseCallbackResponse`
|
||||
|
||||
↳ **`RetrievalCallbackResponse`**
|
||||
|
||||
## Properties
|
||||
|
||||
### event
|
||||
|
||||
• **event**: [`Event`](Event.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseCallbackResponse.event
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:20](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### nodes
|
||||
|
||||
• **nodes**: [`NodeWithScore`](NodeWithScore.md)[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:46](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### query
|
||||
|
||||
• **query**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[callbacks/CallbackManager.ts:45](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/callbacks/CallbackManager.ts#L45)
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
id: "ServiceContext"
|
||||
title: "Interface: ServiceContext"
|
||||
sidebar_label: "ServiceContext"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
The ServiceContext is a collection of components that are used in different parts of the application.
|
||||
|
||||
## Properties
|
||||
|
||||
### callbackManager
|
||||
|
||||
• **callbackManager**: [`CallbackManager`](../classes/CallbackManager.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ServiceContext.ts:15](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ServiceContext.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### embedModel
|
||||
|
||||
• **embedModel**: [`BaseEmbedding`](../classes/BaseEmbedding.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ServiceContext.ts:13](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ServiceContext.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### llm
|
||||
|
||||
• **llm**: [`LLM`](LLM.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ServiceContext.ts:11](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ServiceContext.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### nodeParser
|
||||
|
||||
• **nodeParser**: [`NodeParser`](NodeParser.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ServiceContext.ts:14](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ServiceContext.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### promptHelper
|
||||
|
||||
• **promptHelper**: `PromptHelper`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[ServiceContext.ts:12](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/ServiceContext.ts#L12)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user