Compare commits

...

16 Commits

Author SHA1 Message Date
github-actions[bot] 83cff1277c Release 0.8.37 (#1642)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-11 12:48:58 +07:00
Marcus Schiesser 1c908fd852 Revert "fix: bundle output incorrect (#1638)" (#1641) 2025-02-11 12:27:11 +07:00
github-actions[bot] 56f367f08d Release 0.8.36 (#1639)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: himself65 <14026360+himself65@users.noreply.github.com>
2025-02-10 21:49:19 +08:00
Alex Yang cb608b5d01 fix: bundle output incorrect (#1638) 2025-02-10 21:30:36 +08:00
github-actions[bot] bd55bcffff Release 0.8.35 (#1633)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-10 16:45:42 +07:00
Thuc Pham 6d4d96f8fe chore: update import to workspace pages for examples and docs (#1626)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-10 15:43:29 +07:00
Thuc Pham b6ea2bf964 fix(gemini): use function role for message contains tool-result (#1634) 2025-02-10 12:57:45 +07:00
Parham Saidi 15563a0f70 fix: delete temp competely from params when calling openai o3 (#1629) 2025-02-10 11:07:21 +07:00
github-actions[bot] bd940d1d43 Release 0.8.34 (#1630)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-07 16:02:27 +07:00
Thuc Pham 9f8ad37b79 fix: missing peer deps in llamaindex (#1631) 2025-02-07 15:06:41 +07:00
Peter Goldstein 7265f74c24 Add reasoning_effort for o1 and o3 (#1628) 2025-02-07 12:01:48 +07:00
github-actions[bot] e3f1b85846 Release 0.8.33 (#1619)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-02-06 15:53:47 +07:00
Peter Goldstein e38e474f86 Add Gemini 2.0 models (#1625) 2025-02-06 15:41:20 +07:00
Parham Saidi 2019a041f7 fix: o3 calls do not support temperature param (#1622) 2025-02-06 10:23:23 +07:00
Thuc Pham 067a4894fe fix: missing condition to stringify tool input (#1620) 2025-02-05 17:25:37 +07:00
clean99 21769c8ad9 Fix: update deprecated response property in examples (#1614)
Co-authored-by: Marcus Schiesser <mail@marcusschiesser.de>
2025-02-05 11:28:32 +07:00
267 changed files with 3048 additions and 814 deletions
+52
View File
@@ -1,5 +1,57 @@
# @llamaindex/doc
## 0.0.41
### Patch Changes
- Updated dependencies [1c908fd]
- @llamaindex/openai@0.1.51
- @llamaindex/node-parser@0.0.24
- @llamaindex/workflow@0.0.10
- @llamaindex/readers@1.0.25
- @llamaindex/cloud@2.0.24
- @llamaindex/core@0.4.23
- llamaindex@0.8.37
## 0.0.40
### Patch Changes
- Updated dependencies [cb608b5]
- @llamaindex/openai@0.1.50
- @llamaindex/node-parser@0.0.23
- @llamaindex/workflow@0.0.9
- @llamaindex/readers@1.0.24
- @llamaindex/cloud@2.0.23
- @llamaindex/core@0.4.22
- llamaindex@0.8.36
## 0.0.39
### Patch Changes
- 6d4d96f: chore: update examples and docs to use unified imports
- Updated dependencies [15563a0]
- @llamaindex/openai@0.1.49
- llamaindex@0.8.35
## 0.0.38
### Patch Changes
- Updated dependencies [9f8ad37]
- Updated dependencies [7265f74]
- llamaindex@0.8.34
- @llamaindex/openai@0.1.48
## 0.0.37
### Patch Changes
- Updated dependencies [2019a04]
- @llamaindex/openai@0.1.47
- llamaindex@0.8.33
## 0.0.36
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.0.36",
"version": "0.0.41",
"private": true,
"scripts": {
"build": "pnpm run build:docs && next build",
+10 -4
View File
@@ -76,15 +76,19 @@ export default function HomePage() {
>
<MagicMove
code={[
`import { OpenAI } from "llamaindex";
`import { OpenAI } from "@llamaindex/openai";
const llm = new OpenAI();
const response = await llm.complete({ prompt: "How are you?" });`,
`import { OpenAI } from "llamaindex";
`import { OpenAI } from "@llamaindex/openai";
const llm = new OpenAI();
const response = await llm.chat({
messages: [{ content: "Tell me a joke.", role: "user" }],
});`,
`import { OpenAI, ChatMemoryBuffer } from "llamaindex";
`import { ChatMemoryBuffer } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
const llm = new OpenAI({ model: 'gpt4o-turbo' });
const buffer = new ChatMemoryBuffer({
tokenLimit: 128_000,
@@ -94,7 +98,9 @@ const response = await llm.chat({
messages: buffer.getMessages(),
stream: true
});`,
`import { OpenAIAgent, ChatMemoryBuffer } from "llamaindex";
`import { ChatMemoryBuffer } from "llamaindex";
import { OpenAIAgent } from "@llamaindex/openai";
const agent = new OpenAIAgent({
llm,
tools: [...myTools]
@@ -5,4 +5,24 @@ title: Gemini Agent
import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';
import CodeSourceGemini from "!raw-loader!../../../../../../../examples/gemini/agent.ts";
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/google
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/google
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/google
```
</Tabs>
## Source
<DynamicCodeBlock lang="ts" code={CodeSourceGemini} />
@@ -12,9 +12,8 @@ Here's a simple example of how to use the Context-Aware Agent:
import {
Document,
VectorStoreIndex,
OpenAIContextAwareAgent,
OpenAI,
} from "llamaindex";
import { OpenAI, OpenAIContextAwareAgent } from "@llamaindex/openai";
async function createContextAwareAgent() {
// Create and index some documents
@@ -7,14 +7,36 @@ import CodeSource from "!raw-loader!../../../../../../../examples/mistral";
By default LlamaIndex.TS uses OpenAI's LLMs and embedding models, but we support [lots of other LLMs](../modules/llms) including models from Mistral (Mistral, Mixtral), Anthropic (Claude) and Google (Gemini).
If you don't want to use an API at all you can [run a local model](../../examples/local_llm)
If you don't want to use an API at all you can [run a local model](../../examples/local_llm).
This example runs you through the process of setting up a Mistral model:
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/mistral
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/mistral
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/mistral
```
</Tabs>
## Using another LLM
You can specify what LLM LlamaIndex.TS will use on the `Settings` object, like this:
```typescript
import { MistralAI, Settings } from "llamaindex";
import { MistralAI } from "@llamaindex/mistral";
import { Settings } from "llamaindex";
Settings.llm = new MistralAI({
model: "mistral-tiny",
@@ -29,7 +51,8 @@ You can see examples of other APIs we support by checking out "Available LLMs" i
A frequent gotcha when trying to use a different API as your LLM is that LlamaIndex will also by default index and embed your data using OpenAI's embeddings. To completely switch away from OpenAI you will need to set your embedding model as well, for example:
```typescript
import { MistralAIEmbedding, Settings } from "llamaindex";
import { MistralAIEmbedding } from "@llamaindex/mistral";
import { Settings } from "llamaindex";
Settings.embedModel = new MistralAIEmbedding();
```
@@ -5,6 +5,8 @@ description: Install llamaindex by running a single command.
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
To install llamaindex, run the following command:
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex
@@ -19,6 +21,25 @@ import { Tab, Tabs } from "fumadocs-ui/components/tabs";
```
</Tabs>
In most cases, you'll also need an LLM package to use LlamaIndex. For example, to use the OpenAI LLM, you would install the following:
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install @llamaindex/openai
```
```shell tab="yarn"
yarn add @llamaindex/openai
```
```shell tab="pnpm"
pnpm add @llamaindex/openai
```
</Tabs>
Go to [Using other LLM APIs](/docs/llamaindex/examples/other_llms) to find out how to use other LLMs.
## What's next?
<Cards>
@@ -9,7 +9,7 @@ LlamaIndex.TS is written in TypeScript and designed to be used in TypeScript pro
We do lots of work on strong typing to make sure you have a great typing experience with LlamaIndex.TS.
```ts twoslash
import { PromptTemplate } from '@llamaindex/core/prompts'
import { PromptTemplate } from 'llamaindex'
const promptTemplate = new PromptTemplate({
template: `Context information from multiple sources is below.
---------------------
@@ -29,7 +29,7 @@ promptTemplate.format({
```
```ts twoslash
import { FunctionTool } from '@llamaindex/core/tools'
import { FunctionTool } from 'llamaindex'
import { z } from 'zod'
// ---cut-before---
@@ -31,7 +31,8 @@ First we'll need to pull in our dependencies. These are:
- Dotenv to load our API key from the .env file
```javascript
import { OpenAI, FunctionTool, OpenAIAgent, Settings } from "llamaindex";
import { FunctionTool, Settings } from "llamaindex";
import { OpenAI, OpenAIAgent } from "@llamaindex/openai";
import "dotenv/config";
```
@@ -13,22 +13,34 @@ To learn more about RAG, we recommend this [introduction](https://docs.llamainde
We're going to start with the same agent we [built in step 1](https://github.com/run-llama/ts-agents/blob/main/1_agent/agent.ts), but make a few changes. You can find the finished version [in the repository](https://github.com/run-llama/ts-agents/blob/main/2_agentic_rag/agent.ts).
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai @llamaindex/huggingface
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai @llamaindex/huggingface
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai @llamaindex/huggingface
```
</Tabs>
### New dependencies
We'll be bringing in `SimpleDirectoryReader`, `HuggingFaceEmbedding`, `VectorStoreIndex`, and `QueryEngineTool`, `OpenAIContextAwareAgent` from LlamaIndex.TS, as well as the dependencies we previously used.
```javascript
import {
OpenAI,
FunctionTool,
OpenAIAgent,
OpenAIContextAwareAgent,
Settings,
SimpleDirectoryReader,
HuggingFaceEmbedding,
VectorStoreIndex,
QueryEngineTool,
} from "llamaindex";
import { FunctionTool, QueryEngineTool, Settings, VectorStoreIndex } from "llamaindex";
import { OpenAI, OpenAIAgent } from "@llamaindex/openai";
import { HuggingFaceEmbedding } from "@llamaindex/huggingface";
import { SimpleDirectoryReader } from "llamaindex";
```
### Add an embedding model
@@ -33,11 +33,11 @@ We offer readers for different file formats.
<Tabs groupId="llamaindex-or-readers" items={["llamaindex", "@llamaindex/readers"]} persist>
```ts twoslash tab="llamaindex"
import { CSVReader } from 'llamaindex'
import { PDFReader } from 'llamaindex'
import { JSONReader } from 'llamaindex'
import { MarkdownReader } from 'llamaindex'
import { HTMLReader } from 'llamaindex'
import { CSVReader } from '@llamaindex/readers/csv'
import { PDFReader } from '@llamaindex/readers/pdf'
import { JSONReader } from '@llamaindex/readers/json'
import { MarkdownReader } from '@llamaindex/readers/markdown'
import { HTMLReader } from '@llamaindex/readers/html'
// you can find more readers in the documentation
```
@@ -71,7 +71,7 @@ We offer readers for different file formats.
```
```ts twoslash tab="@llamaindex/readers"
import { SimpleDirectoryReader } from "@llamaindex/readers/directory";
import { SimpleDirectoryReader } from "llamaindex";
const reader = new SimpleDirectoryReader()
const documents = await reader.loadData("./data")
@@ -15,7 +15,7 @@ By default, we will use `Settings.nodeParser` to split the document into nodes.
```ts twoslash
import { TextFileReader } from '@llamaindex/readers/text'
import { SentenceSplitter } from '@llamaindex/core/node-parser';
import { SentenceSplitter } from 'llamaindex';
import { Settings } from 'llamaindex';
const nodeParser = new SentenceSplitter();
@@ -28,7 +28,7 @@ Settings.nodeParser = nodeParser;
The underlying text splitter will split text by sentences. It can also be used as a standalone module for splitting raw text.
```ts twoslash
import { SentenceSplitter } from "@llamaindex/core/node-parser";
import { SentenceSplitter } from "llamaindex";
const splitter = new SentenceSplitter({ chunkSize: 1 });
@@ -42,7 +42,7 @@ The `MarkdownNodeParser` is a more advanced `NodeParser` that can handle markdow
<Tabs items={["with reader", "with node:fs"]}>
```ts twoslash tab="with reader"
import { MarkdownNodeParser } from "@llamaindex/core/node-parser";
import { MarkdownNodeParser } from "llamaindex";
import { MarkdownReader } from '@llamaindex/readers/markdown'
const reader = new MarkdownReader();
@@ -56,8 +56,7 @@ The `MarkdownNodeParser` is a more advanced `NodeParser` that can handle markdow
```ts twoslash tab="with node:fs"
import fs from 'node:fs/promises';
import { MarkdownNodeParser } from "@llamaindex/core/node-parser";
import { Document } from '@llamaindex/core/schema';
import { MarkdownNodeParser, Document } from "llamaindex";
const markdownNodeParser = new MarkdownNodeParser();
const text = await fs.readFile('path/to/file.md', 'utf-8');
@@ -69,7 +69,7 @@ streamText({
For production deployments, you can use LlamaCloud to store and manage your documents:
```typescript
import { LlamaCloudIndex } from "llamaindex";
import { LlamaCloudIndex } from "@llamaindex/cloud";
// Create a LlamaCloud index
const index = await LlamaCloudIndex.fromDocuments({
@@ -6,10 +6,28 @@ A simple JSON data loader with various options.
Either parses the entire string, cleaning it and treat each line as an embedding or performs a recursive depth-first traversal yielding JSON paths.
Supports streaming of large JSON data using [@discoveryjs/json-ext](https://github.com/discoveryjs/json-ext)
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/readers
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/readers
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/readers
```
</Tabs>
## Usage
```ts
import { JSONReader } from "llamaindex";
import { JSONReader } from "@llamaindex/readers/json";
const file = "../../PATH/TO/FILE";
const content = new TextEncoder().encode("JSON_CONTENT");
@@ -4,6 +4,24 @@ title: Image Retrieval
LlamaParse `json` mode supports extracting any images found in a page object by using the `getImages` function. They are downloaded to a local folder and can then be sent to a multimodal LLM for further processing.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/cloud @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/cloud @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/cloud @llamaindex/openai
```
</Tabs>
## Usage
We use the `getImages` method to input our array of JSON objects, download the images to a specified folder and get a list of ImageNodes.
@@ -19,14 +37,10 @@ const imageDicts = await reader.getImages(jsonObjs, "images");
You can create an index across both text and image nodes by requesting alternative text for the image from a multimodal LLM.
```ts
import {
Document,
ImageNode,
LlamaParseReader,
OpenAI,
VectorStoreIndex,
} from "llamaindex";
import { createMessageContent } from "llamaindex/synthesizers/utils";
import { Document, ImageNode, VectorStoreIndex } from "llamaindex";
import { LlamaParseReader } from "@llamaindex/cloud";
import { OpenAI } from "@llamaindex/openai";
import { createMessageContent } from "llamaindex";
const reader = new LlamaParseReader();
async function main() {
@@ -4,12 +4,32 @@ title: JSON Mode
In JSON mode, LlamaParse will return a data structure representing the parsed object.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/cloud
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/cloud
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/cloud
```
</Tabs>
## Usage
For Json mode, you need to use `loadJson`. The `resultType` is automatically set with this method.
More information about indexing the results on the next page.
```ts
import { LlamaParseReader } from "@llamaindex/cloud";
const reader = new LlamaParseReader();
async function main() {
// Load the file and return an array of json objects
@@ -59,7 +79,8 @@ All Readers share a `loadData` method with `SimpleDirectoryReader` that promises
However, a simple work around is to create a new reader class that extends `LlamaParseReader` and adds a new method or overrides `loadData`, wrapping around JSON mode, extracting the required values, and returning a Document object.
```ts
import { LlamaParseReader, Document } from "llamaindex";
import { Document } from "llamaindex";
import { LlamaParseReader } from "@llamaindex/cloud";
class LlamaParseReaderWithJson extends LlamaParseReader {
// Override the loadData method
@@ -11,6 +11,38 @@ Document stores contain ingested document chunks, i.e. [Node](/docs/llamaindex/m
Check the [LlamaIndexTS Github](https://github.com/run-llama/LlamaIndexTS) for the most up to date overview of integrations.
## Using PostgreSQL as Document Store
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/postgres
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/postgres
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/postgres
```
</Tabs>
You can configure the `schemaName`, `tableName`, `namespace`, and
`connectionString`. If a `connectionString` is not
provided, it will use the environment variables `PGHOST`, `PGUSER`,
`PGPASSWORD`, `PGDATABASE` and `PGPORT`.
```typescript
import { Document, VectorStoreIndex, storageContextFromDefaults } from "llamaindex";
import { PostgresDocumentStore } from "@llamaindex/postgres";
const storageContext = await storageContextFromDefaults({
docStore: new PostgresDocumentStore(),
});
```
## API Reference
- [BaseDocumentStore](/docs/api/classes/BaseDocumentStore)
@@ -5,9 +5,13 @@ title: Storage
Storage in LlamaIndex.TS works automatically once you've configured a
`StorageContext` object.
Per default a local directory is used for storage. Depening on the storage type (i.e. doc stores, index stores or vector stores), you can configure a different persistence layer.
Most commonly a vector database is used as vector store.
## Local Storage
You can configure the `persistDir` and attach it to an index.
You can configure the `persistDir` to define where to store the data locally.
```typescript
import {
@@ -26,33 +30,6 @@ const index = await VectorStoreIndex.fromDocuments([document], {
});
```
## PostgreSQL Storage
You can configure the `schemaName`, `tableName`, `namespace`, and
`connectionString`. If a `connectionString` is not
provided, it will use the environment variables `PGHOST`, `PGUSER`,
`PGPASSWORD`, `PGDATABASE` and `PGPORT`.
```typescript
import {
Document,
VectorStoreIndex,
PostgresDocumentStore,
PostgresIndexStore,
storageContextFromDefaults,
} from "llamaindex";
const storageContext = await storageContextFromDefaults({
docStore: new PostgresDocumentStore(),
indexStore: new PostgresIndexStore(),
});
const document = new Document({ text: "Test Text" });
const index = await VectorStoreIndex.fromDocuments([document], {
storageContext,
});
```
## API Reference
- [StorageContext](/docs/api/interfaces/StorageContext)
@@ -11,6 +11,38 @@ Index stores are underlying storage components that contain metadata(i.e. inform
Check the [LlamaIndexTS Github](https://github.com/run-llama/LlamaIndexTS) for the most up to date overview of integrations.
## Using PostgreSQL as Index Store
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/postgres
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/postgres
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/postgres
```
</Tabs>
You can configure the `schemaName`, `tableName`, `namespace`, and
`connectionString`. If a `connectionString` is not
provided, it will use the environment variables `PGHOST`, `PGUSER`,
`PGPASSWORD`, `PGDATABASE` and `PGPORT`.
```typescript
import { Document, VectorStoreIndex, storageContextFromDefaults } from "llamaindex";
import { PostgresIndexStore } from "@llamaindex/postgres";
const storageContext = await storageContextFromDefaults({
indexStore: new PostgresIndexStore(),
});
```
## API Reference
- [BaseIndexStore](/docs/api/classes/BaseIndexStore)
@@ -21,4 +21,4 @@ Check the [LlamaIndexTS Github](https://github.com/run-llama/LlamaIndexTS) for t
## API Reference
- [VectorStoreBase](/docs/api/classes/VectorStoreBase)
- [BaseVectorStore](/docs/api/classes/BaseVectorStore)
@@ -11,11 +11,30 @@ docker pull qdrant/qdrant
docker run -p 6333:6333 qdrant/qdrant
```
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/qdrant
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/qdrant
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/qdrant
```
</Tabs>
## Importing the modules
```ts
import fs from "node:fs/promises";
import { Document, VectorStoreIndex, QdrantVectorStore } from "llamaindex";
import { Document, VectorStoreIndex } from "llamaindex";
import { QdrantVectorStore } from "@llamaindex/qdrant";
```
## Load the documents
@@ -60,7 +79,8 @@ console.log(response.toString());
```ts
import fs from "node:fs/promises";
import { Document, VectorStoreIndex, QdrantVectorStore } from "llamaindex";
import { Document, VectorStoreIndex } from "llamaindex";
import { QdrantVectorStore } from "@llamaindex/qdrant";
async function main() {
const path = "node_modules/llamaindex/examples/abramov.txt";
@@ -14,13 +14,8 @@ Our metadata extractor modules include the following "feature extractors":
Then you can chain the `Metadata Extractors` with the `IngestionPipeline` to extract metadata from a set of documents.
```ts
import {
IngestionPipeline,
TitleExtractor,
QuestionsAnsweredExtractor,
Document,
OpenAI,
} from "llamaindex";
import { Document, IngestionPipeline, TitleExtractor, QuestionsAnsweredExtractor } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
async function main() {
const pipeline = new IngestionPipeline({
@@ -5,13 +5,27 @@ title: DeepInfra
To use DeepInfra embeddings, you need to import `DeepInfraEmbedding` from llamaindex.
Check out available embedding models [here](https://deepinfra.com/models/embeddings).
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/deepinfra
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/deepinfra
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/deepinfra
```
</Tabs>
```ts
import {
DeepInfraEmbedding,
Settings,
Document,
VectorStoreIndex,
} from "llamaindex";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
import { DeepInfraEmbedding } from "@llamaindex/deepinfra";
// Update Embed Model
Settings.embedModel = new DeepInfraEmbedding();
@@ -33,7 +47,7 @@ By default, DeepInfraEmbedding is using the sentence-transformers/clip-ViT-B-32
For example:
```ts
import { DeepInfraEmbedding } from "llamaindex";
import { DeepInfraEmbedding } from "@llamaindex/deepinfra";
const model = "intfloat/e5-large-v2";
Settings.embedModel = new DeepInfraEmbedding({
@@ -46,7 +60,8 @@ You can also set the `maxRetries` and `timeout` parameters when initializing `De
For example:
```ts
import { DeepInfraEmbedding, Settings } from "llamaindex";
import { Settings } from "llamaindex";
import { DeepInfraEmbedding } from "@llamaindex/deepinfra";
const model = "intfloat/e5-large-v2";
const maxRetries = 5;
@@ -62,7 +77,7 @@ Settings.embedModel = new DeepInfraEmbedding({
Standalone usage:
```ts
import { DeepInfraEmbedding } from "llamaindex";
import { DeepInfraEmbedding } from "@llamaindex/deepinfra";
import { config } from "dotenv";
// For standalone usage, you need to configure DEEPINFRA_API_TOKEN in .env file
config();
@@ -2,10 +2,29 @@
title: Gemini
---
To use Gemini embeddings, you need to import `GeminiEmbedding` from `llamaindex`.
To use Gemini embeddings, you need to import `GeminiEmbedding` from `@llamaindex/google`.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/google
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/google
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/google
```
</Tabs>
```ts
import { GeminiEmbedding, Settings } from "llamaindex";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
import { GeminiEmbedding, GEMINI_MODEL } from "@llamaindex/google";
// Update Embed Model
Settings.embedModel = new GeminiEmbedding();
@@ -27,7 +46,7 @@ Per default, `GeminiEmbedding` is using the `gemini-pro` model. You can change t
For example:
```ts
import { GEMINI_MODEL, GeminiEmbedding } from "llamaindex";
import { GEMINI_MODEL, GeminiEmbedding } from "@llamaindex/google";
Settings.embedModel = new GeminiEmbedding({
model: GEMINI_MODEL.GEMINI_PRO_LATEST,
@@ -2,10 +2,29 @@
title: HuggingFace
---
To use HuggingFace embeddings, you need to import `HuggingFaceEmbedding` from `llamaindex`.
To use HuggingFace embeddings, you need to import `HuggingFaceEmbedding` from `@llamaindex/huggingface`.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/huggingface
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/huggingface
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/huggingface
```
</Tabs>
```ts
import { HuggingFaceEmbedding, Settings } from "llamaindex";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
import { HuggingFaceEmbedding } from "@llamaindex/huggingface";
// Update Embed Model
Settings.embedModel = new HuggingFaceEmbedding();
@@ -29,6 +48,8 @@ If you're not using a quantized model, set the `quantized` parameter to `false`.
For example, to use the not quantized `BAAI/bge-small-en-v1.5` model, you can use the following code:
```ts
import { HuggingFaceEmbedding } from "@llamaindex/huggingface";
Settings.embedModel = new HuggingFaceEmbedding({
modelType: "BAAI/bge-small-en-v1.5",
quantized: false,
@@ -2,10 +2,29 @@
title: MistralAI
---
To use MistralAI embeddings, you need to import `MistralAIEmbedding` from `llamaindex`.
To use MistralAI embeddings, you need to import `MistralAIEmbedding` from `@llamaindex/mistral`.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/mistral
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/mistral
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/mistral
```
</Tabs>
```ts
import { MistralAIEmbedding, Settings } from "llamaindex";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
import { MistralAIEmbedding } from "@llamaindex/mistral";
// Update Embed Model
Settings.embedModel = new MistralAIEmbedding({
@@ -14,16 +14,28 @@ To find out more about the latest features, updates, and available models, visit
## Setup
First, you will need to install the `llamaindex` package.
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/mixedbread
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/mixedbread
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/mixedbread
```
</Tabs>
```bash
pnpm install llamaindex
```
Next, sign up for an API key at [mixedbread.ai](https://mixedbread.ai/). Once you have your API key, you can import the necessary modules and create a new instance of the `MixedbreadAIEmbeddings` class.
```ts
import { MixedbreadAIEmbeddings, Document, Settings } from "llamaindex";
import { MixedbreadAIEmbeddings } from "@llamaindex/mixedbread";
import { Document, Settings } from "llamaindex";
```
## Usage with LlamaIndex
@@ -2,7 +2,7 @@
title: Ollama
---
To use Ollama embeddings, you need to import `OllamaEmbedding` from `llamaindex`.
To use Ollama embeddings, you need to import `OllamaEmbedding` from `@llamaindex/ollama`.
Note that you need to pull the embedding model first before using it.
@@ -12,8 +12,27 @@ In the example below, we're using the [`nomic-embed-text`](https://ollama.com/li
ollama pull nomic-embed-text
```
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/ollama
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/ollama
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/ollama
```
</Tabs>
```ts
import { OllamaEmbedding, Settings } from "llamaindex";
import { OllamaEmbedding } from "@llamaindex/ollama";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
Settings.embedModel = new OllamaEmbedding({ model: "nomic-embed-text" });
@@ -2,10 +2,29 @@
title: OpenAI
---
To use OpenAI embeddings, you need to import `OpenAIEmbedding` from `llamaindex`.
To use OpenAI embeddings, you need to import `OpenAIEmbedding` from `@llamaindex/openai`.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
```ts
import { OpenAIEmbedding, Settings } from "llamaindex";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
Settings.embedModel = new OpenAIEmbedding();
@@ -6,8 +6,27 @@ The embedding model in LlamaIndex is responsible for creating numerical represen
This can be explicitly updated through `Settings`
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
```typescript
import { OpenAIEmbedding, Settings } from "llamaindex";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { Settings } from "llamaindex";
Settings.embedModel = new OpenAIEmbedding({
model: "text-embedding-ada-002",
@@ -10,9 +10,21 @@ This is useful for measuring if the response was correct. The evaluator returns
Firstly, you need to install the package:
```bash
pnpm i llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
Set the OpenAI API key:
@@ -23,7 +35,8 @@ export OPENAI_API_KEY=your-api-key
Import the required modules:
```ts
import { CorrectnessEvaluator, OpenAI, Settings, Response } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { CorrectnessEvaluator, Settings, Response } from "llamaindex";
```
Let's setup gpt-4 for better results:
@@ -12,9 +12,22 @@ This is useful for measuring if the response was hallucinated. The evaluator ret
Firstly, you need to install the package:
```bash
pnpm i llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
Set the OpenAI API key:
@@ -25,12 +38,12 @@ export OPENAI_API_KEY=your-api-key
Import the required modules:
```ts
import { OpenAI } from "@llamaindex/openai";
import {
Document,
FaithfulnessEvaluator,
OpenAI,
VectorStoreIndex,
Settings,
VectorStoreIndex,
} from "llamaindex";
```
@@ -10,9 +10,22 @@ It is useful for measuring if the response was relevant to the query. The evalua
Firstly, you need to install the package:
```bash
pnpm i llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
Set the OpenAI API key:
@@ -23,11 +36,11 @@ export OPENAI_API_KEY=your-api-key
Import the required modules:
```ts
import { OpenAI } from "@llamaindex/openai";
import {
RelevancyEvaluator,
OpenAI,
Settings,
Document,
RelevancyEvaluator,
Settings,
VectorStoreIndex,
} from "llamaindex";
```
@@ -5,18 +5,35 @@ title: Ingestion Pipeline
An `IngestionPipeline` uses a concept of `Transformations` that are applied to input data.
These `Transformations` are applied to your input data, and the resulting nodes are either returned or inserted into a vector database (if given).
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai @llamaindex/qdrant
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai @llamaindex/qdrant
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai @llamaindex/qdrant
```
</Tabs>
## Usage Pattern
The simplest usage is to instantiate an IngestionPipeline like so:
```ts
import fs from "node:fs/promises";
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai";
import {
Document,
IngestionPipeline,
MetadataMode,
OpenAIEmbedding,
TitleExtractor,
SentenceSplitter,
} from "llamaindex";
@@ -58,14 +75,14 @@ Then, you can construct an index from that vector store later on.
```ts
import fs from "node:fs/promises";
import { OpenAIEmbedding } from "@llamaindex/openai";
import { QdrantVectorStore } from "@llamaindex/qdrant";
import {
Document,
IngestionPipeline,
MetadataMode,
OpenAIEmbedding,
TitleExtractor,
SentenceSplitter,
QdrantVectorStore,
VectorStoreIndex,
} from "llamaindex";
@@ -2,10 +2,29 @@
title: Anthropic
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/anthropic
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/anthropic
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/anthropic
```
</Tabs>
## Usage
```ts
import { Anthropic, Settings } from "llamaindex";
import { Settings } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
Settings.llm = new Anthropic({
apiKey: "<YOUR_API_KEY>",
@@ -37,7 +56,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { Anthropic, Document, VectorStoreIndex, Settings } from "llamaindex";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
Settings.llm = new Anthropic({
apiKey: "<YOUR_API_KEY>",
@@ -14,10 +14,29 @@ export AZURE_OPENAI_ENDPOINT="<YOUR ENDPOINT, see https://learn.microsoft.com/en
export AZURE_OPENAI_DEPLOYMENT="gpt-4" # or some other deployment name
```
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
## Usage
```ts
import { OpenAI, Settings } from "llamaindex";
import { Settings } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
Settings.llm = new OpenAI({ model: "gpt-4", temperature: 0 });
```
@@ -47,7 +66,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { OpenAI, Document, VectorStoreIndex, Settings } from "llamaindex";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
Settings.llm = new OpenAI({ model: "gpt-4", temperature: 0 });
@@ -2,6 +2,24 @@
title: Bedrock
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/community
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/community
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/community
```
</Tabs>
## Usage
```ts
@@ -4,8 +4,27 @@ title: DeepInfra
Check out available LLMs [here](https://deepinfra.com/models/text-generation).
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/deepinfra
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/deepinfra
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/deepinfra
```
</Tabs>
```ts
import { DeepInfra, Settings } from "llamaindex";
import { DeepInfra } from "@llamaindex/deepinfra";
import { Settings } from "llamaindex";
// Get the API key from `DEEPINFRA_API_TOKEN` environment variable
import { config } from "dotenv";
@@ -28,6 +47,8 @@ export DEEPINFRA_API_TOKEN="<YOUR_API_KEY>"
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -48,7 +69,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { DeepInfra, Document, VectorStoreIndex, Settings } from "llamaindex";
import { DeepInfra } from "@llamaindex/deepinfra";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
// Use custom LLM
const model = "meta-llama/Meta-Llama-3-8B-Instruct";
@@ -2,10 +2,29 @@
title: Gemini
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/google
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/google
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/google
```
</Tabs>
## Usage
```ts
import { Gemini, Settings, GEMINI_MODEL } from "llamaindex";
import { Gemini, GEMINI_MODEL } from "@llamaindex/google";
import { Settings } from "llamaindex";
Settings.llm = new Gemini({
model: GEMINI_MODEL.GEMINI_PRO,
@@ -19,7 +38,7 @@ To use Gemini via Vertex AI you can use `GeminiVertexSession`.
GeminiVertexSession accepts the env variables: `GOOGLE_VERTEX_LOCATION` and `GOOGLE_VERTEX_PROJECT`
```ts
import { Gemini, GEMINI_MODEL, GeminiVertexSession } from "llamaindex";
import { Gemini, GEMINI_MODEL, GeminiVertexSession } from "@llamaindex/google";
const gemini = new Gemini({
model: GEMINI_MODEL.GEMINI_PRO,
@@ -47,6 +66,8 @@ To authenticate for production you'll have to use a [service account](https://cl
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -67,13 +88,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import {
Gemini,
Document,
VectorStoreIndex,
Settings,
GEMINI_MODEL,
} from "llamaindex";
import { Gemini, GEMINI_MODEL } from "@llamaindex/google";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
Settings.llm = new Gemini({
model: GEMINI_MODEL.GEMINI_PRO,
@@ -5,6 +5,24 @@ title: Groq
import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';
import CodeSource from "!raw-loader!../../../../../../../../../examples/groq.ts";
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/groq
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/groq
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/groq
```
</Tabs>
## Usage
First, create an API key at the [Groq Console](https://console.groq.com/keys). Then save it in your environment:
@@ -16,7 +34,8 @@ export GROQ_API_KEY=<your-api-key>
The initialize the Groq module.
```ts
import { Groq, Settings } from "llamaindex";
import { Groq } from "@llamaindex/groq";
import { Settings } from "llamaindex";
Settings.llm = new Groq({
// If you do not wish to set your API key in the environment, you may
@@ -30,6 +49,8 @@ Settings.llm = new Groq({
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -2,10 +2,29 @@
title: LLama2
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/replicate
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/replicate
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/replicate
```
</Tabs>
## Usage
```ts
import { Ollama, Settings, DeuceChatStrategy } from "llamaindex";
import { LlamaDeuce, DeuceChatStrategy } from "@llamaindex/replicate";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
Settings.llm = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
```
@@ -13,12 +32,8 @@ Settings.llm = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
## Usage with Replication
```ts
import {
Ollama,
ReplicateSession,
Settings,
DeuceChatStrategy,
} from "llamaindex";
import { Settings } from "llamaindex";
import { LlamaDeuce, DeuceChatStrategy, ReplicateSession } from "@llamaindex/replicate";
const replicateSession = new ReplicateSession({
replicateKey,
@@ -55,13 +70,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import {
LlamaDeuce,
Document,
VectorStoreIndex,
Settings,
DeuceChatStrategy,
} from "llamaindex";
import { LlamaDeuce, DeuceChatStrategy } from "@llamaindex/replicate";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
// Use the LlamaDeuce LLM
Settings.llm = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
@@ -2,10 +2,29 @@
title: Mistral
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/mistral
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/mistral
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/mistral
```
</Tabs>
## Usage
```ts
import { MistralAI, Settings } from "llamaindex";
import { MistralAI } from "@llamaindex/mistral";
import { Settings } from "llamaindex";
Settings.llm = new MistralAI({
model: "mistral-tiny",
@@ -18,6 +37,8 @@ Settings.llm = new MistralAI({
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -38,7 +59,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { MistralAI, Document, VectorStoreIndex, Settings } from "llamaindex";
import { MistralAI } from "@llamaindex/mistral";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
// Use the MistralAI LLM
Settings.llm = new MistralAI({ model: "mistral-tiny" });
@@ -2,10 +2,30 @@
title: Ollama
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/ollama
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/ollama
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/ollama
```
</Tabs>
## Usage
```ts
import { Ollama, Settings } from "llamaindex";
import { Ollama } from "@llamaindex/ollama";
import { Settings } from "llamaindex";
Settings.llm = ollamaLLM;
Settings.embedModel = ollamaLLM;
@@ -16,6 +36,8 @@ Settings.embedModel = ollamaLLM;
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -36,7 +58,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { Ollama, Document, VectorStoreIndex, Settings } from "llamaindex";
import { Ollama } from "@llamaindex/ollama";
import { Document, VectorStoreIndex, Settings } from "llamaindex";
import fs from "fs/promises";
@@ -2,8 +2,28 @@
title: OpenAI
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
```ts
import { OpenAI, Settings } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0, apiKey: <YOUR_API_KEY> });
```
@@ -19,6 +39,8 @@ export OPENAI_API_KEY="<YOUR_API_KEY>"
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -39,7 +61,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { OpenAI, Document, VectorStoreIndex, Settings } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
// Use the OpenAI LLM
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });
@@ -2,10 +2,30 @@
title: Portkey LLM
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/portkey-ai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/portkey-ai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/portkey-ai
```
</Tabs>
## Usage
```ts
import { Portkey, Settings } from "llamaindex";
import { Portkey } from "@llamaindex/portkey-ai";
import { Settings } from "llamaindex";
Settings.llm = new Portkey({
apiKey: "<YOUR_API_KEY>",
@@ -17,6 +37,8 @@ Settings.llm = new Portkey({
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -37,7 +59,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { Portkey, Document, VectorStoreIndex, Settings } from "llamaindex";
import { Portkey } from "@llamaindex/portkey-ai";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
// Use the Portkey LLM
Settings.llm = new Portkey({
@@ -2,10 +2,28 @@
title: Together LLM
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex
```
```shell tab="yarn"
yarn add llamaindex
```
```shell tab="pnpm"
pnpm add llamaindex
```
</Tabs>
## Usage
```ts
import { TogetherLLM, Settings } from "llamaindex";
import { Settings, TogetherLLM } from "llamaindex";
Settings.llm = new TogetherLLM({
apiKey: "<YOUR_API_KEY>",
@@ -17,6 +35,8 @@ Settings.llm = new TogetherLLM({
For this example, we will use a single document. In a real-world scenario, you would have multiple documents to index.
```ts
import { Document, VectorStoreIndex } from "llamaindex";
const document = new Document({ text: essay, id_: "essay" });
const index = await VectorStoreIndex.fromDocuments([document]);
@@ -37,7 +57,8 @@ const results = await queryEngine.query({
## Full Example
```ts
import { TogetherLLM, Document, VectorStoreIndex, Settings } from "llamaindex";
import { TogetherLLM } from "@llamaindex/together";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
Settings.llm = new TogetherLLM({
apiKey: "<YOUR_API_KEY>",
@@ -2,12 +2,31 @@
title: Large Language Models (LLMs)
---
The LLM is responsible for reading text and generating natural language responses to queries. By default, LlamaIndex.TS uses `gpt-3.5-turbo`.
The LLM is responsible for reading text and generating natural language responses to queries. By default, LlamaIndex.TS uses `gpt-4o`.
The LLM can be explicitly updated through `Settings`.
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
```typescript
import { OpenAI, Settings } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });
```
@@ -5,7 +5,8 @@ title: NodeParser
The `NodeParser` in LlamaIndex is responsible for splitting `Document` objects into more manageable `Node` objects. When you call `.fromDocuments()`, the `NodeParser` from the `Settings` is used to do this automatically for you. Alternatively, you can use it to split documents ahead of time.
```typescript
import { Document, SentenceSplitter } from "llamaindex";
import { Document } from "llamaindex";
import { SentenceSplitter } from "llamaindex";
const nodeParser = new SentenceSplitter();
@@ -30,6 +31,7 @@ The `MarkdownNodeParser` is a more advanced `NodeParser` that can handle markdow
```typescript
import { MarkdownNodeParser } from "llamaindex";
import { Document } from "llamaindex";
const nodeParser = new MarkdownNodeParser();
@@ -8,20 +8,28 @@ The Cohere Reranker is a postprocessor that uses the Cohere API to rerank the re
Firstly, you will need to install the `llamaindex` package.
```bash
pnpm install llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/cohere @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/cohere @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/cohere @llamaindex/openai
```
</Tabs>
Now, you will need to sign up for an API key at [Cohere](https://cohere.ai/). Once you have your API key you can import the necessary modules and create a new instance of the `CohereRerank` class.
```ts
import {
CohereRerank,
Document,
OpenAI,
VectorStoreIndex,
Settings,
} from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { CohereRerank } from "@llamaindex/cohere";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
```
## Load and index documents
@@ -2,6 +2,24 @@
title: Node Postprocessors
---
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/cohere @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/cohere @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/cohere @llamaindex/openai
```
</Tabs>
## Concept
Node postprocessors are a set of modules that take a set of nodes, and apply some kind of transformation or filtering before returning them.
@@ -15,12 +33,8 @@ LlamaIndex offers several node postprocessors for immediate use, while also prov
An example of using a node postprocessors is below:
```ts
import {
Node,
NodeWithScore,
SimilarityPostprocessor,
CohereRerank,
} from "llamaindex";
import { CohereRerank } from "@llamaindex/cohere";
import { Node, NodeWithScore, SimilarityPostprocessor, TextNode } from "llamaindex";
const nodes: NodeWithScore[] = [
{
@@ -60,7 +74,9 @@ Most commonly, node-postprocessors will be used in a query engine, where they ar
### Using Node Postprocessors in a Query Engine
```ts
import { Node, NodeWithScore, SimilarityPostprocessor, CohereRerank, Settings } from "llamaindex";
import { CohereRerank } from "@llamaindex/cohere";
import { OpenAI } from "@llamaindex/openai";
import { Node, NodeWithScore, SimilarityPostprocessor, Settings, TextNode } from "llamaindex";
// Use OpenAI LLM
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 });
@@ -78,9 +94,9 @@ const nodes: NodeWithScore[] = [
// cohere rerank: rerank nodes given query using trained model
const reranker = new CohereRerank({
apiKey: "<COHERE_API_KEY>,
apiKey: "<COHERE_API_KEY>",
topN: 2,
})
});
const document = new Document({ text: "essay", id_: "essay" });
@@ -8,20 +8,28 @@ The Jina AI Reranker is a postprocessor that uses the Jina AI Reranker API to re
Firstly, you will need to install the `llamaindex` package.
```bash
pnpm install llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai
```
</Tabs>
Now, you will need to sign up for an API key at [Jina AI](https://jina.ai/reranker). Once you have your API key you can import the necessary modules and create a new instance of the `JinaAIReranker` class.
```ts
import {
JinaAIReranker,
Document,
OpenAI,
VectorStoreIndex,
Settings,
} from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { Document, Settings, VectorStoreIndex, JinaAIReranker } from "llamaindex";
```
## Load and index documents
@@ -17,20 +17,33 @@ To find out more about the latest features and updates, visit the [mixedbread.ai
First, you will need to install the `llamaindex` package.
```bash
pnpm install llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai @llamaindex/mixedbread
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai @llamaindex/mixedbread
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai @llamaindex/mixedbread
```
</Tabs>
Next, sign up for an API key at [mixedbread.ai](https://mixedbread.ai/). Once you have your API key, you can import the necessary modules and create a new instance of the `MixedbreadAIReranker` class.
```ts
import {
MixedbreadAIReranker,
Document,
OpenAI,
VectorStoreIndex,
Settings,
} from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { MixedbreadAIReranker } from "@llamaindex/mixedbread";
```
## Usage with LlamaIndex
@@ -10,19 +10,27 @@ You can also check our multi-tenancy blog post to see how metadata filtering can
Firstly if you haven't already, you need to install the `llamaindex` package:
```bash
pnpm i llamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai @llamaindex/chroma
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai @llamaindex/chroma
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai @llamaindex/chroma
```
</Tabs>
Then you can import the necessary modules from `llamaindex`:
```ts
import {
ChromaVectorStore,
Document,
VectorStoreIndex,
storageContextFromDefaults,
} from "llamaindex";
import { Document, VectorStoreIndex, storageContextFromDefaults } from "llamaindex";
import { ChromaVectorStore } from "@llamaindex/chroma";
const collectionName = "dog_colors";
```
@@ -95,12 +103,8 @@ Besides using the equal operator (`==`), you can also use a whole set of differe
## Full Code
```ts
import {
ChromaVectorStore,
Document,
VectorStoreIndex,
storageContextFromDefaults,
} from "llamaindex";
import { Document, VectorStoreIndex, storageContextFromDefaults } from "llamaindex";
import { ChromaVectorStore } from "@llamaindex/chroma";
const collectionName = "dog_colors";
@@ -8,13 +8,24 @@ In this tutorial, we define a custom router query engine that selects one out of
First, we need to install import the necessary modules from `llamaindex`:
```bash
pnpm i lamaindex
```
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/openai @llamaindex/readers
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/openai @llamaindex/readers
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/openai @llamaindex/readers
```
</Tabs>
```ts
import {
OpenAI,
RouterQueryEngine,
SimpleDirectoryReader,
SentenceSplitter,
@@ -22,6 +33,8 @@ import {
VectorStoreIndex,
Settings,
} from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { SimpleDirectoryReader } from "llamaindex";
```
## Loading Data
@@ -103,7 +116,6 @@ console.log({
```ts
import {
OpenAI,
RouterQueryEngine,
SimpleDirectoryReader,
SentenceSplitter,
@@ -111,6 +123,8 @@ import {
VectorStoreIndex,
Settings,
} from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { SimpleDirectoryReader } from "llamaindex";
Settings.llm = new OpenAI();
Settings.nodeParser = new SentenceSplitter({
@@ -18,7 +18,7 @@ The ResponseSynthesizer is responsible for sending the query, nodes, and prompt
chunk.
```typescript
import { NodeWithScore, ResponseSynthesizer, TextNode } from "llamaindex";
import { NodeWithScore, TextNode, ResponseSynthesizer } from "llamaindex";
const responseSynthesizer = new ResponseSynthesizer();
@@ -116,7 +116,7 @@ const jokeFlow = new Workflow({ verbose: true, validate: true });
Optionally, you can choose to use global context between steps. For example, maybe multiple steps access the original `query` input from the user. You can store this in global context so that every step has access.
```typescript
import { Context } from "@llamaindex/core/workflow";
import { Context } from "llamaindex";
const query = async (context: Context, ev: MyEvent) => {
// get the query from the context
@@ -1,5 +1,37 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.133
### Patch Changes
- llamaindex@0.8.37
## 0.0.132
### Patch Changes
- Updated dependencies [cb608b5]
- llamaindex@0.8.36
## 0.0.131
### Patch Changes
- llamaindex@0.8.35
## 0.0.130
### Patch Changes
- Updated dependencies [9f8ad37]
- llamaindex@0.8.34
## 0.0.129
### Patch Changes
- llamaindex@0.8.33
## 0.0.128
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.128",
"version": "0.0.133",
"type": "module",
"private": true,
"scripts": {
@@ -1,5 +1,19 @@
# @llamaindex/llama-parse-browser-test
## 0.0.44
### Patch Changes
- Updated dependencies [1c908fd]
- @llamaindex/cloud@2.0.24
## 0.0.43
### Patch Changes
- Updated dependencies [cb608b5]
- @llamaindex/cloud@2.0.23
## 0.0.42
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/llama-parse-browser-test",
"private": true,
"version": "0.0.42",
"version": "0.0.44",
"type": "module",
"scripts": {
"dev": "vite",
+1 -1
View File
@@ -1,4 +1,4 @@
import { LlamaParseReader } from "@llamaindex/cloud/reader";
import { LlamaParseReader } from "@llamaindex/cloud";
import "./style.css";
new LlamaParseReader();
+32
View File
@@ -1,5 +1,37 @@
# @llamaindex/next-agent-test
## 0.1.133
### Patch Changes
- llamaindex@0.8.37
## 0.1.132
### Patch Changes
- Updated dependencies [cb608b5]
- llamaindex@0.8.36
## 0.1.131
### Patch Changes
- llamaindex@0.8.35
## 0.1.130
### Patch Changes
- Updated dependencies [9f8ad37]
- llamaindex@0.8.34
## 0.1.129
### Patch Changes
- llamaindex@0.8.33
## 0.1.128
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.128",
"version": "0.1.133",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,37 @@
# test-edge-runtime
## 0.1.132
### Patch Changes
- llamaindex@0.8.37
## 0.1.131
### Patch Changes
- Updated dependencies [cb608b5]
- llamaindex@0.8.36
## 0.1.130
### Patch Changes
- llamaindex@0.8.35
## 0.1.129
### Patch Changes
- Updated dependencies [9f8ad37]
- llamaindex@0.8.34
## 0.1.128
### Patch Changes
- llamaindex@0.8.33
## 0.1.127
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.127",
"version": "0.1.132",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,37 @@
# @llamaindex/next-node-runtime
## 0.0.114
### Patch Changes
- llamaindex@0.8.37
## 0.0.113
### Patch Changes
- Updated dependencies [cb608b5]
- llamaindex@0.8.36
## 0.0.112
### Patch Changes
- llamaindex@0.8.35
## 0.0.111
### Patch Changes
- Updated dependencies [9f8ad37]
- llamaindex@0.8.34
## 0.0.110
### Patch Changes
- llamaindex@0.8.33
## 0.0.109
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-node-runtime-test",
"version": "0.0.109",
"version": "0.0.114",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,37 @@
# @llamaindex/waku-query-engine-test
## 0.0.133
### Patch Changes
- llamaindex@0.8.37
## 0.0.132
### Patch Changes
- Updated dependencies [cb608b5]
- llamaindex@0.8.36
## 0.0.131
### Patch Changes
- llamaindex@0.8.35
## 0.0.130
### Patch Changes
- Updated dependencies [9f8ad37]
- llamaindex@0.8.34
## 0.0.129
### Patch Changes
- llamaindex@0.8.33
## 0.0.128
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.128",
"version": "0.0.133",
"type": "module",
"private": true,
"scripts": {
+97
View File
@@ -1,5 +1,102 @@
# examples
## 0.1.3
### Patch Changes
- Updated dependencies [1c908fd]
- @llamaindex/pinecone@0.0.4
- @llamaindex/postgres@0.0.32
- @llamaindex/weaviate@0.0.4
- @llamaindex/mongodb@0.0.4
- @llamaindex/upstash@0.0.4
- @llamaindex/chroma@0.0.4
- @llamaindex/milvus@0.0.4
- @llamaindex/qdrant@0.0.4
- @llamaindex/astra@0.0.4
- @llamaindex/azure@0.0.4
- @llamaindex/huggingface@0.0.35
- @llamaindex/mixedbread@0.0.4
- @llamaindex/portkey-ai@0.0.32
- @llamaindex/anthropic@0.0.33
- @llamaindex/deepinfra@0.0.35
- @llamaindex/replicate@0.0.32
- @llamaindex/mistral@0.0.4
- @llamaindex/cohere@0.0.4
- @llamaindex/google@0.0.6
- @llamaindex/ollama@0.0.39
- @llamaindex/openai@0.1.51
- @llamaindex/vercel@0.0.10
- @llamaindex/clip@0.0.35
- @llamaindex/groq@0.0.50
- @llamaindex/vllm@0.0.21
- @llamaindex/node-parser@0.0.24
- @llamaindex/workflow@0.0.10
- @llamaindex/readers@1.0.25
- @llamaindex/cloud@2.0.24
- llamaindex@0.8.37
## 0.1.2
### Patch Changes
- Updated dependencies [cb608b5]
- @llamaindex/pinecone@0.0.3
- @llamaindex/postgres@0.0.31
- @llamaindex/weaviate@0.0.3
- @llamaindex/mongodb@0.0.3
- @llamaindex/upstash@0.0.3
- @llamaindex/chroma@0.0.3
- @llamaindex/milvus@0.0.3
- @llamaindex/qdrant@0.0.3
- @llamaindex/astra@0.0.3
- @llamaindex/azure@0.0.3
- @llamaindex/huggingface@0.0.34
- @llamaindex/mixedbread@0.0.3
- @llamaindex/portkey-ai@0.0.31
- @llamaindex/anthropic@0.0.32
- @llamaindex/deepinfra@0.0.34
- @llamaindex/replicate@0.0.31
- @llamaindex/mistral@0.0.3
- @llamaindex/cohere@0.0.3
- @llamaindex/google@0.0.5
- @llamaindex/ollama@0.0.38
- @llamaindex/openai@0.1.50
- @llamaindex/vercel@0.0.9
- @llamaindex/clip@0.0.34
- @llamaindex/groq@0.0.49
- @llamaindex/vllm@0.0.20
- @llamaindex/node-parser@0.0.23
- @llamaindex/workflow@0.0.9
- @llamaindex/readers@1.0.24
- @llamaindex/cloud@2.0.23
- llamaindex@0.8.36
## 0.1.1
### Patch Changes
- Updated dependencies [b6ea2bf]
- Updated dependencies [15563a0]
- @llamaindex/google@0.0.4
- @llamaindex/openai@0.1.49
- llamaindex@0.8.35
- @llamaindex/clip@0.0.33
- @llamaindex/deepinfra@0.0.33
- @llamaindex/groq@0.0.48
- @llamaindex/huggingface@0.0.33
- @llamaindex/vllm@0.0.19
## 0.1.0
### Minor Changes
- 21769c8: Update deprecated response property of query engine to message.content propery
### Patch Changes
- llamaindex@0.8.33
## 0.0.23
### Patch Changes
+2 -1
View File
@@ -1,6 +1,7 @@
import fs from "node:fs/promises";
import { Document, OpenAI, Settings, VectorStoreIndex } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { Document, Settings, VectorStoreIndex } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-4" });
+2 -1
View File
@@ -1,4 +1,5 @@
import { FunctionTool, OpenAI, OpenAIAgent } from "llamaindex";
import { OpenAI, OpenAIAgent } from "@llamaindex/openai";
import { FunctionTool } from "llamaindex";
const csvData =
"TITLE,RELEASE_YEAR,SCORE,NUMBER_OF_VOTES,DURATION,MAIN_GENRE,MAIN_PRODUCTION\nDavid Attenborough: A Life on Our Planet,2020,9,31180,83,documentary,GB\nInception,2010,8.8,2268288,148,scifi,GB\nForrest Gump,1994,8.8,1994599,142,drama,US\nAnbe Sivam,2003,8.7,20595,160,comedy,IN\nBo Burnham: Inside,2021,8.7,44074,87,comedy,US\nSaving Private Ryan,1998,8.6,1346020,169,drama,US\nDjango Unchained,2012,8.4,1472668,165,western,US\nDangal,2016,8.4,180247,161,action,IN\nBo Burnham: Make Happy,2016,8.4,14356,60,comedy,US\nLouis C.K.: Hilarious,2010,8.4,11973,84,comedy,US\nDave Chappelle: Sticks & Stones,2019,8.4,25687,65,comedy,US\n3 Idiots,2009,8.4,385782,170,comedy,IN\nBlack Friday,2004,8.4,20611,143,crime,IN\nSuper Deluxe,2019,8.4,13680,176,thriller,IN\nWinter on Fire: Ukraine's Fight for Freedom,2015,8.3,17710,98,documentary,UA\nOnce Upon a Time in America,1984,8.3,342335,229,drama,US\nTaxi Driver,1976,8.3,795222,113,crime,US\nLike Stars on Earth,2007,8.3,188234,165,drama,IN\nBo Burnham: What.,2013,8.3,11488,60,comedy,US\nFull Metal Jacket,1987,8.3,723306,116,drama,GB\nWarrior,2011,8.2,463276,140,drama,US\nDrishyam,2015,8.2,79075,163,thriller,IN\nQueen,2014,8.2,64805,146,drama,IN\nPaan Singh Tomar,2012,8.2,35888,135,drama,IN";
+2 -1
View File
@@ -1,4 +1,5 @@
import { FunctionTool, OpenAI, ToolCallOptions } from "llamaindex";
import { OpenAI } from "@llamaindex/openai";
import { FunctionTool, ToolCallOptions } from "llamaindex";
(async () => {
// The tool call will generate a partial JSON for `gpt-4-turbo`
+1 -2
View File
@@ -1,10 +1,9 @@
import fs from "node:fs/promises";
import { OpenAI, OpenAIAgent } from "@llamaindex/openai";
import {
Document,
ObjectIndex,
OpenAI,
OpenAIAgent,
QueryEngineTool,
SentenceSplitter,
Settings,
+2 -1
View File
@@ -1,4 +1,5 @@
import { ChatResponseChunk, OpenAIAgent } from "llamaindex";
import { OpenAIAgent } from "@llamaindex/openai";
import { ChatResponseChunk } from "llamaindex";
import {
getCurrentIDTool,
getUserInfoTool,
+2 -1
View File
@@ -1,4 +1,5 @@
import { FunctionTool, OpenAIAgent } from "llamaindex";
import { OpenAIAgent } from "@llamaindex/openai";
import { FunctionTool } from "llamaindex";
const sumNumbers = FunctionTool.from(
({ a, b }: { a: number; b: number }) => `${a + b}`,
+3 -3
View File
@@ -1,5 +1,5 @@
import { OpenAIAgent } from "@llamaindex/openai";
import {
OpenAIAgent,
QueryEngineTool,
SimpleDirectoryReader,
VectorStoreIndex,
@@ -33,12 +33,12 @@ async function main() {
});
// Chat with the agent
const response = await agent.chat({
const { message } = await agent.chat({
message: "What was his first salary?",
});
// Print the response
console.log(response.response);
console.log(message.content);
}
void main().then(() => {
+2 -1
View File
@@ -1,4 +1,5 @@
import { Anthropic, FunctionTool, ReActAgent } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
import { FunctionTool, ReActAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }) {
+3 -3
View File
@@ -1,8 +1,8 @@
import { OpenAIAgent } from "@llamaindex/openai";
import {
FunctionTool,
MetadataMode,
NodeWithScore,
OpenAIAgent,
SimpleDirectoryReader,
VectorStoreIndex,
} from "llamaindex";
@@ -52,12 +52,12 @@ async function main() {
});
// Chat with the agent
const response = await agent.chat({
const { message } = await agent.chat({
message: "What was his first salary?",
});
// Print the response
console.log(response.response);
console.log(message.content);
}
void main().then(() => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { OpenAIAgent } from "@llamaindex/openai";
import {
OpenAIAgent,
QueryEngineTool,
SimpleDirectoryReader,
VectorStoreIndex,
+2 -1
View File
@@ -1,4 +1,5 @@
import { Anthropic, FunctionTool, ReActAgent } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
import { FunctionTool, ReActAgent } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }) {
+2 -1
View File
@@ -1,4 +1,5 @@
import { FunctionTool, OpenAIAgent } from "llamaindex";
import { OpenAIAgent } from "@llamaindex/openai";
import { FunctionTool } from "llamaindex";
// Define a function to sum two numbers
function sumNumbers({ a, b }: { a: number; b: number }) {
+1 -1
View File
@@ -1,4 +1,4 @@
import { OpenAI, OpenAIAgent } from "llamaindex";
import { OpenAI, OpenAIAgent } from "@llamaindex/openai";
import { WikipediaTool } from "../wiki";
async function main() {
+4 -4
View File
@@ -1,5 +1,5 @@
import { Anthropic, FunctionTool, Settings } from "llamaindex";
import { AnthropicAgent } from "llamaindex/agent/anthropic";
import { Anthropic, AnthropicAgent } from "@llamaindex/anthropic";
import { FunctionTool, Settings } from "llamaindex";
import { WikipediaTool } from "../wiki";
Settings.callbackManager.on("llm-tool-call", (event) => {
@@ -38,12 +38,12 @@ const agent = new AnthropicAgent({
});
async function main() {
const { response } = await agent.chat({
const { message } = await agent.chat({
message:
"What is the weather in New York? What's the history of New York from Wikipedia in 3 sentences?",
});
console.log(response);
console.log(message.content);
}
void main();
+1 -1
View File
@@ -1,4 +1,4 @@
import { Anthropic } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
(async () => {
const anthropic = new Anthropic({
+2 -1
View File
@@ -1,4 +1,5 @@
import { Anthropic, ChatMemoryBuffer, SimpleChatEngine } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
import { ChatMemoryBuffer, SimpleChatEngine } from "llamaindex";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
+1 -1
View File
@@ -1,4 +1,4 @@
import { Anthropic } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
(async () => {
const anthropic = new Anthropic({
+1 -1
View File
@@ -1,4 +1,4 @@
import { Anthropic } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
async function main() {
const anthropic = new Anthropic({
+1 -1
View File
@@ -1,4 +1,4 @@
import { Anthropic } from "llamaindex";
import { Anthropic } from "@llamaindex/anthropic";
(async () => {
const anthropic = new Anthropic({
+1 -1
View File
@@ -1,5 +1,5 @@
import { AstraDBVectorStore } from "@llamaindex/astra";
import {
AstraDBVectorStore,
Document,
MetadataFilters,
storageContextFromDefaults,
+3 -6
View File
@@ -1,9 +1,6 @@
import {
AstraDBVectorStore,
CSVReader,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import { AstraDBVectorStore } from "@llamaindex/astra";
import { CSVReader } from "@llamaindex/readers/csv";
import { storageContextFromDefaults, VectorStoreIndex } from "llamaindex";
const collectionName = "movie_reviews";
+2 -5
View File
@@ -1,8 +1,5 @@
import {
AstraDBVectorStore,
VectorStoreIndex,
serviceContextFromDefaults,
} from "llamaindex";
import { AstraDBVectorStore } from "@llamaindex/astra";
import { VectorStoreIndex, serviceContextFromDefaults } from "llamaindex";
const collectionName = "movie_reviews";
+4 -2
View File
@@ -8,13 +8,15 @@ import {
AzureCosmosDBNoSqlVectorStore,
AzureCosmosNoSqlDocumentStore,
AzureCosmosNoSqlIndexStore,
} from "@llamaindex/azure";
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai";
import {
Document,
OpenAI,
OpenAIEmbedding,
Settings,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
/**
* This example demonstrates how to use Azure CosmosDB with LlamaIndex.
* It uses Azure CosmosDB as IndexStore, DocumentStore, and VectorStore.
+1 -1
View File
@@ -2,8 +2,8 @@ import {
DefaultAzureCredential,
getBearerTokenProvider,
} from "@azure/identity";
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai";
import "dotenv/config";
import { OpenAI, OpenAIEmbedding } from "llamaindex";
const AZURE_COGNITIVE_SERVICES_SCOPE =
"https://cognitiveservices.azure.com/.default";
+3 -1
View File
@@ -4,7 +4,9 @@ import {
DefaultAzureCredential,
getBearerTokenProvider,
} from "@azure/identity";
import { AzureDynamicSessionTool, OpenAI, ReActAgent } from "llamaindex";
import { AzureDynamicSessionTool } from "@llamaindex/azure";
import { OpenAI } from "@llamaindex/openai";
import { ReActAgent } from "llamaindex";
async function main() {
const credential = new DefaultAzureCredential();
+1 -1
View File
@@ -1,9 +1,9 @@
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
import { OpenAI } from "@llamaindex/openai";
import {
ChatSummaryMemoryBuffer,
OpenAI,
Settings,
SimpleChatEngine,
} from "llamaindex";
+1 -1
View File
@@ -1,5 +1,5 @@
import { ChromaVectorStore } from "@llamaindex/chroma";
import {
ChromaVectorStore,
Document,
MetadataFilters,
VectorStoreIndex,
+3 -6
View File
@@ -1,9 +1,6 @@
import {
ChromaVectorStore,
CSVReader,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import { ChromaVectorStore } from "@llamaindex/chroma";
import { CSVReader } from "@llamaindex/readers/csv";
import { storageContextFromDefaults, VectorStoreIndex } from "llamaindex";
const collectionName = "movie_reviews";
+2 -3
View File
@@ -1,14 +1,13 @@
import { CosmosClient } from "@azure/cosmos";
import { DefaultAzureCredential } from "@azure/identity";
import { AzureCosmosDBNoSQLConfig } from "@llamaindex/azure";
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai";
import {
SimpleCosmosDBReader,
SimpleCosmosDBReaderLoaderConfig,
} from "@llamaindex/readers/cosmosdb";
import * as dotenv from "dotenv";
import {
AzureCosmosDBNoSQLConfig,
OpenAI,
OpenAIEmbedding,
Settings,
storageContextFromDefaults,
VectorStoreIndex,
+2 -3
View File
@@ -1,10 +1,9 @@
import { CosmosClient } from "@azure/cosmos";
import { DefaultAzureCredential } from "@azure/identity";
import { AzureCosmosDBNoSQLConfig } from "@llamaindex/azure";
import { OpenAI, OpenAIEmbedding } from "@llamaindex/openai";
import * as dotenv from "dotenv";
import {
AzureCosmosDBNoSQLConfig,
OpenAI,
OpenAIEmbedding,
Settings,
storageContextFromDefaults,
VectorStoreIndex,

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