Compare commits

...

11 Commits

Author SHA1 Message Date
github-actions[bot] c70d7b9930 Release 0.9.14 (#1799)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marcusschiesser <17126+marcusschiesser@users.noreply.github.com>
2025-04-01 12:59:10 +02:00
Marcus Schiesser 1b6f368a3f feat: Support loading from URLs for all readers extending FileReader (#1805) 2025-04-01 17:39:59 +07:00
Thuc Pham 9d951b288f feat: support llamacloud in @llamaindex/server (#1796) 2025-04-01 17:39:39 +07:00
dependabot[bot] 5fe16697a2 chore(deps-dev): bump vite from 5.4.15 to 5.4.16 (#1804)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-01 16:49:36 +07:00
Marcus Schiesser 189d8a83ac chore: use node 20 for examples (#1803) 2025-03-31 17:21:19 +07:00
ANKIT VARSHNEY 648cfb5cb5 feat: supbase vector store (#1790) 2025-03-29 15:14:28 +07:00
Marcus Schiesser eaf326ee90 fix: passing right llm setting from SimpleChatEngine to ChatMemoryBuffer (#1798) 2025-03-28 18:20:52 +07:00
github-actions[bot] fc1bedf438 Release (#1794)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-28 15:22:44 +07:00
Thuc Pham 164cf7a6df fix: custom next server start fail (#1795) 2025-03-28 15:09:57 +07:00
Zhanghao e98033e2cc docs: correct the number of indexes (#1793) 2025-03-27 16:33:52 +02:00
dependabot[bot] c0ffc7b434 chore(deps-dev): bump vite from 5.4.14 to 5.4.15 (#1787)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-26 20:43:49 +07:00
153 changed files with 2253 additions and 278 deletions
+23
View File
@@ -1,5 +1,28 @@
# @llamaindex/doc
## 0.2.3
### Patch Changes
- 648cfb5: Add support for supabase vector store
Added doc for the supbase vector store
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- Updated dependencies [9d951b2]
- @llamaindex/core@0.6.1
- llamaindex@0.9.14
- @llamaindex/cloud@4.0.1
- @llamaindex/node-parser@2.0.1
- @llamaindex/openai@0.2.1
- @llamaindex/readers@3.0.1
- @llamaindex/workflow@1.0.1
## 0.2.2
### Patch Changes
- e98033e: docs: correct the number of indexes
## 0.2.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.2.1",
"version": "0.2.3",
"private": true,
"scripts": {
"postinstall": "fumadocs-mdx",
@@ -2,7 +2,7 @@
title: Index
---
An index is the basic container and organization for your data. LlamaIndex.TS supports two indexes:
An index is the basic container and organization for your data. LlamaIndex.TS supports three indexes:
- `VectorStoreIndex` - will send the top-k `Node`s to the LLM when generating a response. The default top-k is 2.
- `SummaryIndex` - will send every `Node` in the index to the LLM in order to generate a response
@@ -0,0 +1,166 @@
---
title: Supabase Vector Store
---
[supabase.com](https://supabase.com/)
To use this vector store, you need a Supabase project. You can create one at [supabase.com](https://supabase.com/).
## Installation
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
<Tabs groupId="install" items={["npm", "yarn", "pnpm"]} persist>
```shell tab="npm"
npm install llamaindex @llamaindex/supabase
```
```shell tab="yarn"
yarn add llamaindex @llamaindex/supabase
```
```shell tab="pnpm"
pnpm add llamaindex @llamaindex/supabase
```
</Tabs>
## Database Setup
Before using the vector store, you need to:
1. Enable the `pgvector` extension
2. Create a table for storing vectors
3. Create a vector similarity search function
```sql
create table documents (
id uuid primary key,
content text,
metadata jsonb,
embedding vector(1536)
);
```
-- Create a function for similarity search
```sql
create function match_documents (
query_embedding vector(1536),
match_count int
) returns table (
id uuid,
content text,
metadata jsonb,
embedding vector(1536),
similarity float
)
language plpgsql
as $$
begin
return query
select
id,
content,
metadata,
embedding,
1 - (embedding <=> query_embedding) as similarity
from documents
order by embedding <=> query_embedding
limit match_count;
end;
$$;
```
## Importing the modules
```ts
import { Document, VectorStoreIndex } from "llamaindex";
import { SupabaseVectorStore } from "@llamaindex/supabase";
```
## Setup Supabase
```ts
const vectorStore = new SupabaseVectorStore({
supabaseUrl: process.env.SUPABASE_URL,
supabaseKey: process.env.SUPABASE_KEY,
table: "documents",
});
```
## Setup the index
```ts
const documents = [
new Document({
text: "Sample document text",
metadata: { source: "example" }
})
];
const storageContext = await storageContextFromDefaults({ vectorStore });
const index = await VectorStoreIndex.fromDocuments(documents, {
storageContext,
});
```
## Query the index
```ts
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What is in the document?",
});
// Output response
console.log(response.toString());
```
## Full code
```ts
import { Document, VectorStoreIndex, storageContextFromDefaults } from "llamaindex";
import { SupabaseVectorStore } from "@llamaindex/supabase";
async function main() {
// Initialize the vector store
const vectorStore = new SupabaseVectorStore({
supabaseUrl: process.env.SUPABASE_URL,
supabaseKey: process.env.SUPABASE_KEY,
table: "documents",
});
// Create sample documents
const documents = [
new Document({
text: "Vector search enables semantic similarity search",
metadata: {
source: "research_paper",
author: "Jane Smith",
},
}),
];
// Create storage context
const storageContext = await storageContextFromDefaults({ vectorStore });
// Create and store embeddings
const index = await VectorStoreIndex.fromDocuments(documents, {
storageContext,
});
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query({
query: "What is vector search?",
});
// Output response
console.log(response.toString());
}
main().catch(console.error);
```
## API Reference
- [SupabaseVectorStore](/docs/api/classes/SupabaseVectorStore)
@@ -1,5 +1,12 @@
# @llamaindex/cloudflare-worker-agent-test
## 0.0.148
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 0.0.147
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloudflare-worker-agent-test",
"version": "0.0.147",
"version": "0.0.148",
"type": "module",
"private": true,
"scripts": {
@@ -1,5 +1,11 @@
# @llamaindex/llama-parse-browser-test
## 0.0.56
### Patch Changes
- @llamaindex/cloud@4.0.1
## 0.0.55
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/llama-parse-browser-test",
"private": true,
"version": "0.0.55",
"version": "0.0.56",
"type": "module",
"scripts": {
"dev": "vite",
@@ -10,7 +10,7 @@
},
"devDependencies": {
"typescript": "^5.7.3",
"vite": "^5.4.12",
"vite": "^5.4.16",
"vite-plugin-wasm": "^3.3.0"
},
"dependencies": {
+7
View File
@@ -1,5 +1,12 @@
# @llamaindex/next-agent-test
## 0.1.148
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 0.1.147
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-agent-test",
"version": "0.1.147",
"version": "0.1.148",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,12 @@
# test-edge-runtime
## 0.1.147
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 0.1.146
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/nextjs-edge-runtime-test",
"version": "0.1.146",
"version": "0.1.147",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,14 @@
# @llamaindex/next-node-runtime
## 0.1.14
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
- @llamaindex/huggingface@0.1.1
- @llamaindex/readers@3.0.1
## 0.1.13
### Patch Changes
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/next-node-runtime-test",
"version": "0.1.13",
"version": "0.1.14",
"private": true,
"scripts": {
"dev": "next dev",
@@ -1,5 +1,12 @@
# vite-import-llamaindex
## 0.0.14
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 0.0.13
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "vite-import-llamaindex",
"private": true,
"version": "0.0.13",
"version": "0.0.14",
"type": "module",
"scripts": {
"build": "vite build",
@@ -16,7 +16,7 @@
"@size-limit/preset-big-lib": "^11.1.6",
"size-limit": "^11.1.6",
"typescript": "^5.7.3",
"vite": "^6.1.0"
"vite": "^5.4.16"
},
"dependencies": {
"llamaindex": "workspace:*"
@@ -1,5 +1,12 @@
# @llamaindex/waku-query-engine-test
## 0.0.148
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 0.0.147
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/waku-query-engine-test",
"version": "0.0.147",
"version": "0.0.148",
"type": "module",
"private": true,
"scripts": {
+1
View File
@@ -0,0 +1 @@
20
+52
View File
@@ -1,5 +1,57 @@
# examples
## 0.3.1
### Patch Changes
- 648cfb5: Add support for supabase vector store
Added doc for the supbase vector store
- Updated dependencies [648cfb5]
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- Updated dependencies [9d951b2]
- @llamaindex/supabase@0.1.0
- @llamaindex/core@0.6.1
- llamaindex@0.9.14
- @llamaindex/tools@0.0.3
- @llamaindex/cloud@4.0.1
- @llamaindex/node-parser@2.0.1
- @llamaindex/anthropic@0.3.1
- @llamaindex/clip@0.0.47
- @llamaindex/cohere@0.0.15
- @llamaindex/deepinfra@0.0.47
- @llamaindex/google@0.2.1
- @llamaindex/huggingface@0.1.1
- @llamaindex/jinaai@0.0.7
- @llamaindex/mistral@0.1.1
- @llamaindex/mixedbread@0.0.15
- @llamaindex/ollama@0.1.1
- @llamaindex/openai@0.2.1
- @llamaindex/perplexity@0.0.4
- @llamaindex/portkey-ai@0.0.43
- @llamaindex/replicate@0.0.43
- @llamaindex/astra@0.0.15
- @llamaindex/azure@0.1.10
- @llamaindex/chroma@0.0.15
- @llamaindex/elastic-search@0.1.1
- @llamaindex/firestore@1.0.8
- @llamaindex/milvus@0.1.10
- @llamaindex/mongodb@0.0.15
- @llamaindex/pinecone@0.1.1
- @llamaindex/postgres@0.0.43
- @llamaindex/qdrant@0.1.10
- @llamaindex/upstash@0.0.15
- @llamaindex/weaviate@0.0.15
- @llamaindex/vercel@0.1.1
- @llamaindex/voyage-ai@1.0.7
- @llamaindex/readers@3.0.1
- @llamaindex/workflow@1.0.1
- @llamaindex/deepseek@0.0.7
- @llamaindex/fireworks@0.0.7
- @llamaindex/groq@0.0.62
- @llamaindex/together@0.0.7
- @llamaindex/vllm@0.0.33
## 0.3.0
### Minor Changes
+42 -41
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/examples",
"version": "0.3.0",
"version": "0.3.1",
"private": true,
"scripts": {
"lint": "eslint .",
@@ -11,46 +11,47 @@
"@azure/cosmos": "^4.1.1",
"@azure/identity": "^4.4.1",
"@azure/search-documents": "^12.1.0",
"@llamaindex/anthropic": "^0.3.0",
"@llamaindex/astra": "^0.0.14",
"@llamaindex/azure": "^0.1.9",
"@llamaindex/chroma": "^0.0.14",
"@llamaindex/clip": "^0.0.46",
"@llamaindex/cloud": "^4.0.0",
"@llamaindex/cohere": "^0.0.14",
"@llamaindex/core": "^0.6.0",
"@llamaindex/deepinfra": "^0.0.46",
"@llamaindex/anthropic": "^0.3.1",
"@llamaindex/astra": "^0.0.15",
"@llamaindex/azure": "^0.1.10",
"@llamaindex/chroma": "^0.0.15",
"@llamaindex/clip": "^0.0.47",
"@llamaindex/cloud": "^4.0.1",
"@llamaindex/cohere": "^0.0.15",
"@llamaindex/core": "^0.6.1",
"@llamaindex/deepinfra": "^0.0.47",
"@llamaindex/env": "^0.1.29",
"@llamaindex/firestore": "^1.0.7",
"@llamaindex/google": "^0.2.0",
"@llamaindex/groq": "^0.0.61",
"@llamaindex/huggingface": "^0.1.0",
"@llamaindex/milvus": "^0.1.9",
"@llamaindex/mistral": "^0.1.0",
"@llamaindex/mixedbread": "^0.0.14",
"@llamaindex/mongodb": "^0.0.14",
"@llamaindex/elastic-search": "^0.1.0",
"@llamaindex/node-parser": "^2.0.0",
"@llamaindex/ollama": "^0.1.0",
"@llamaindex/openai": "^0.2.0",
"@llamaindex/pinecone": "^0.1.0",
"@llamaindex/portkey-ai": "^0.0.42",
"@llamaindex/postgres": "^0.0.42",
"@llamaindex/qdrant": "^0.1.9",
"@llamaindex/readers": "^3.0.0",
"@llamaindex/replicate": "^0.0.42",
"@llamaindex/upstash": "^0.0.14",
"@llamaindex/vercel": "^0.1.0",
"@llamaindex/vllm": "^0.0.32",
"@llamaindex/voyage-ai": "^1.0.6",
"@llamaindex/weaviate": "^0.0.14",
"@llamaindex/workflow": "^1.0.0",
"@llamaindex/deepseek": "^0.0.6",
"@llamaindex/fireworks": "^0.0.6",
"@llamaindex/together": "^0.0.6",
"@llamaindex/jinaai": "^0.0.6",
"@llamaindex/perplexity": "^0.0.3",
"@llamaindex/tools": "^0.0.2",
"@llamaindex/firestore": "^1.0.8",
"@llamaindex/google": "^0.2.1",
"@llamaindex/groq": "^0.0.62",
"@llamaindex/huggingface": "^0.1.1",
"@llamaindex/milvus": "^0.1.10",
"@llamaindex/mistral": "^0.1.1",
"@llamaindex/mixedbread": "^0.0.15",
"@llamaindex/mongodb": "^0.0.15",
"@llamaindex/elastic-search": "^0.1.1",
"@llamaindex/node-parser": "^2.0.1",
"@llamaindex/ollama": "^0.1.1",
"@llamaindex/openai": "^0.2.1",
"@llamaindex/pinecone": "^0.1.1",
"@llamaindex/portkey-ai": "^0.0.43",
"@llamaindex/postgres": "^0.0.43",
"@llamaindex/qdrant": "^0.1.10",
"@llamaindex/readers": "^3.0.1",
"@llamaindex/replicate": "^0.0.43",
"@llamaindex/upstash": "^0.0.15",
"@llamaindex/vercel": "^0.1.1",
"@llamaindex/vllm": "^0.0.33",
"@llamaindex/voyage-ai": "^1.0.7",
"@llamaindex/weaviate": "^0.0.15",
"@llamaindex/workflow": "^1.0.1",
"@llamaindex/deepseek": "^0.0.7",
"@llamaindex/fireworks": "^0.0.7",
"@llamaindex/together": "^0.0.7",
"@llamaindex/jinaai": "^0.0.7",
"@llamaindex/perplexity": "^0.0.4",
"@llamaindex/supabase": "^0.1.0",
"@llamaindex/tools": "^0.0.3",
"@notionhq/client": "^2.2.15",
"@pinecone-database/pinecone": "^4.0.0",
"@vercel/postgres": "^0.10.0",
@@ -59,7 +60,7 @@
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"js-tiktoken": "^1.0.14",
"llamaindex": "^0.9.12",
"llamaindex": "^0.9.14",
"mongodb": "6.7.0",
"postgres": "^3.4.4",
"wikipedia": "^2.1.2",
+75
View File
@@ -0,0 +1,75 @@
import {
gemini,
GEMINI_EMBEDDING_MODEL,
GEMINI_MODEL,
GeminiEmbedding,
} from "@llamaindex/google";
import { SupabaseVectorStore } from "@llamaindex/supabase";
import {
Document,
Settings,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
async function main() {
Settings.embedModel = new GeminiEmbedding({
model: GEMINI_EMBEDDING_MODEL.TEXT_EMBEDDING_004,
});
Settings.llm = gemini({
model: GEMINI_MODEL.GEMINI_PRO_1_5_FLASH,
});
// Create sample documents
const documents = [
new Document({
text: "Supbase is a powerful Database engine",
metadata: {
source: "tech_docs",
author: "John Doe",
},
}),
new Document({
text: "Vector search enables semantic similarity search",
metadata: {
source: "research_paper",
author: "Jane Smith",
},
}),
new Document({
text: "Supbase vector store supports various distance metrics for vector search",
metadata: {
source: "tech_docs",
author: "Bob Wilson",
},
}),
];
// Initialize ElasticSearch Vector Store
const vectorStore = new SupabaseVectorStore({
supabaseUrl: process.env.SUPABASE_URL,
supabaseKey: process.env.SUPABASE_KEY,
table: "document",
});
// await vectorStore.delete("fc079c38-2af4-4782-96e4-955c28608fcf");
// Create storage context with the vector store
const storageContext = await storageContextFromDefaults({
vectorStore,
});
// Create and store embeddings in ElasticSearch
const index = await VectorStoreIndex.fromDocuments(documents, {
storageContext,
});
// Query the index
const queryEngine = index.asQueryEngine();
// Simple query
const response = await queryEngine.query({
query: "What is vector search?",
});
console.log("Basic Query Response:", response.toString());
}
main().catch(console.error);
@@ -0,0 +1,8 @@
{
"name": "vector-store-supabase",
"type": "module",
"private": true,
"scripts": {
"start": "npx tsx index.ts"
}
}
+7
View File
@@ -1,5 +1,12 @@
# @llamaindex/autotool
## 6.0.14
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 6.0.13
### Patch Changes
@@ -1,5 +1,13 @@
# @llamaindex/autotool-01-node-example
## 0.0.95
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
- @llamaindex/autotool@6.0.14
## 0.0.94
### Patch Changes
@@ -13,5 +13,5 @@
"scripts": {
"start": "node --import tsx --import @llamaindex/autotool/node ./src/index.ts"
},
"version": "0.0.94"
"version": "0.0.95"
}
+1 -1
View File
@@ -6,7 +6,7 @@
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
"directory": "packages/autotool"
},
"version": "6.0.13",
"version": "6.0.14",
"description": "auto transpile your JS function to LLM Agent compatible",
"files": [
"dist",
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/cloud
## 4.0.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 4.0.0
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/cloud",
"version": "4.0.0",
"version": "4.0.1",
"type": "module",
"license": "MIT",
"scripts": {
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/community
## 0.0.93
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.92
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/community",
"description": "Community package for LlamaIndexTS",
"version": "0.0.92",
"version": "0.0.93",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
+7
View File
@@ -1,5 +1,12 @@
# @llamaindex/core
## 0.6.1
### Patch Changes
- 1b6f368: Support loading from URLs for all readers extending FileReader
- eaf326e: Fix passing right llm setting from SimpleChatEngine to ChatMemoryBuffer
## 0.6.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/core",
"type": "module",
"version": "0.6.0",
"version": "0.6.1",
"description": "LlamaIndex Core Module",
"exports": {
"./agent": {
@@ -24,8 +24,12 @@ export class SimpleChatEngine implements BaseChatEngine {
}
constructor(init?: Partial<SimpleChatEngine>) {
this.memory = init?.memory ?? new ChatMemoryBuffer();
this.llm = init?.llm ?? Settings.llm;
this.memory =
init?.memory ??
new ChatMemoryBuffer({
llm: this.llm,
});
}
chat(params: NonStreamingChatEngineParams): Promise<EngineResponse>;
@@ -40,6 +44,7 @@ export class SimpleChatEngine implements BaseChatEngine {
const chatHistory = params.chatHistory
? new ChatMemoryBuffer({
llm: this.llm,
chatHistory:
params.chatHistory instanceof BaseMemory
? await params.chatHistory.getMessages()
+23 -2
View File
@@ -63,8 +63,29 @@ export abstract class FileReader<T extends BaseNode = Document>
): Promise<T[]>;
async loadData(filePath: string): Promise<T[]> {
const fileContent = await fs.readFile(filePath);
const filename = path.basename(filePath);
let fileContent: Uint8Array;
let filename: string;
// Check if filePath is a URL
if (filePath.startsWith("http://") || filePath.startsWith("https://")) {
// Handle URL
const response = await fetch(filePath);
if (!response.ok) {
throw new Error(
`Failed to fetch URL: ${filePath}, status: ${response.status}`,
);
}
const buffer = await response.arrayBuffer();
fileContent = new Uint8Array(buffer);
// Extract filename from URL
const url = new URL(filePath);
filename = path.basename(url.pathname) || "url_document";
} else {
// Handle local file
fileContent = await fs.readFile(filePath);
filename = path.basename(filePath);
}
const docs = await this.loadDataAsContent(fileContent, filename);
docs.forEach(FileReader.addMetaData(filePath));
return docs;
+91
View File
@@ -0,0 +1,91 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Document, FileReader } from "@llamaindex/core/schema";
import { fs, path } from "@llamaindex/env";
import { TextDecoder, TextEncoder } from "util";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
// Mock implementation of FileReader for testing
class TestFileReader extends FileReader<Document> {
async loadDataAsContent(
fileContent: Uint8Array,
filename?: string,
): Promise<Document[]> {
const text = new TextDecoder().decode(fileContent);
return [new Document({ text, metadata: { filename } })];
}
}
describe("FileReader", () => {
let reader: TestFileReader;
let mockFetch: any;
let mockFsReadFile: any;
beforeEach(() => {
reader = new TestFileReader();
// Mock fetch for URL tests
mockFetch = vi.fn();
global.fetch = mockFetch;
// Mock fs.readFile for local file tests
mockFsReadFile = vi.spyOn(fs, "readFile");
});
afterEach(() => {
vi.restoreAllMocks();
});
test("loadData should load content from a local file", async () => {
const testFilePath = "/path/to/test.txt";
const testContent = "Test file content";
const testContentBuffer = new TextEncoder().encode(testContent);
mockFsReadFile.mockResolvedValue(testContentBuffer);
const result = await reader.loadData(testFilePath);
expect(mockFsReadFile).toHaveBeenCalledWith(testFilePath);
expect(result).toHaveLength(1);
expect(result[0]).toBeInstanceOf(Document);
expect(result[0]?.getText()).toBe(testContent);
expect(result[0]?.metadata.file_path).toBe(path.resolve(testFilePath));
expect(result[0]?.metadata.file_name).toBe("test.txt");
});
test("loadData should load content from a URL", async () => {
const testUrl = "https://example.com/test.txt";
const testContent = "Test URL content";
const testContentBuffer = new TextEncoder().encode(testContent);
// Mock fetch response
mockFetch.mockResolvedValue({
ok: true,
arrayBuffer: () => Promise.resolve(testContentBuffer.buffer),
});
const result = await reader.loadData(testUrl);
expect(mockFetch).toHaveBeenCalledWith(testUrl);
expect(result).toHaveLength(1);
expect(result[0]).toBeInstanceOf(Document);
expect(result[0]?.getText()).toBe(testContent);
expect(result[0]?.metadata.file_path).toBe(path.resolve(testUrl));
expect(result[0]?.metadata.file_name).toBe("test.txt");
});
test("loadData should throw an error for failed URL fetch", async () => {
const testUrl = "https://example.com/not-found.txt";
// Mock failed fetch response
mockFetch.mockResolvedValue({
ok: false,
status: 404,
});
await expect(reader.loadData(testUrl)).rejects.toThrow(
`Failed to fetch URL: ${testUrl}, status: 404`,
);
expect(mockFetch).toHaveBeenCalledWith(testUrl);
});
});
@@ -0,0 +1,14 @@
import { SimpleChatEngine } from "@llamaindex/core/chat-engine";
import { ChatMemoryBuffer } from "@llamaindex/core/memory";
import { MockLLM } from "@llamaindex/core/utils";
import { describe, expect, test } from "vitest";
describe("SimpleChatEngine", () => {
test("constructor initializes with provided LLM", () => {
const llm = new MockLLM();
const engine = new SimpleChatEngine({ llm });
expect(engine.llm).toBe(llm);
expect(engine.memory).toBeInstanceOf(ChatMemoryBuffer);
expect((engine.memory as ChatMemoryBuffer).tokenLimit).toBe(768);
});
});
+7
View File
@@ -1,5 +1,12 @@
# @llamaindex/experimental
## 0.0.164
### Patch Changes
- Updated dependencies [9d951b2]
- llamaindex@0.9.14
## 0.0.163
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/experimental",
"description": "Experimental package for LlamaIndexTS",
"version": "0.0.163",
"version": "0.0.164",
"type": "module",
"types": "dist/type/index.d.ts",
"main": "dist/cjs/index.js",
+13
View File
@@ -1,5 +1,18 @@
# llamaindex
## 0.9.14
### Patch Changes
- 9d951b2: feat: support llamacloud in @llamaindex/server
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
- @llamaindex/cloud@4.0.1
- @llamaindex/node-parser@2.0.1
- @llamaindex/openai@0.2.1
- @llamaindex/workflow@1.0.1
## 0.9.13
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "llamaindex",
"version": "0.9.13",
"version": "0.9.14",
"license": "MIT",
"type": "module",
"keywords": [
@@ -25,7 +25,9 @@ import {
} from "@llamaindex/cloud/api";
import type { BaseRetriever } from "@llamaindex/core/retriever";
import { getEnv } from "@llamaindex/env";
import type { QueryToolParams } from "../indices/BaseIndex.js";
import { Settings } from "../Settings.js";
import { QueryEngineTool } from "../tools/QueryEngineTool.js";
export class LlamaCloudIndex {
params: CloudConstructorParams;
@@ -272,6 +274,22 @@ export class LlamaCloudIndex {
);
}
asQueryTool(params: QueryToolParams): QueryEngineTool {
if (params.options) {
params.retriever = this.asRetriever(params.options);
}
return new QueryEngineTool({
queryEngine: this.asQueryEngine(params),
metadata: params?.metadata,
includeSourceNodes: params?.includeSourceNodes ?? false,
});
}
queryTool(params: QueryToolParams): QueryEngineTool {
return this.asQueryTool(params);
}
async insert(document: Document) {
const pipelineId = await this.getPipelineId();
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/node-parser
## 2.0.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 2.0.0
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/node-parser",
"version": "2.0.0",
"version": "2.0.1",
"description": "Node parser for LlamaIndex",
"type": "module",
"exports": {
@@ -1,5 +1,13 @@
# @llamaindex/anthropic
## 0.3.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.3.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/anthropic",
"description": "Anthropic Adapter for LlamaIndex",
"version": "0.3.0",
"version": "0.3.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+9
View File
@@ -1,5 +1,14 @@
# @llamaindex/clip
## 0.0.47
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
- @llamaindex/openai@0.2.1
## 0.0.46
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/clip",
"description": "Clip Embedding Adapter for LlamaIndex",
"version": "0.0.46",
"version": "0.0.47",
"type": "module",
"types": "dist/index.d.ts",
"main": "dist/index.cjs",
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/cohere
## 0.0.15
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.14
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/cohere",
"description": "Cohere Adapter for LlamaIndex",
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,14 @@
# @llamaindex/deepinfra
## 0.0.47
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
- @llamaindex/openai@0.2.1
## 0.0.46
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/deepinfra",
"description": "Deepinfra Adapter for LlamaIndex",
"version": "0.0.46",
"version": "0.0.47",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/deepseek
## 0.0.7
### Patch Changes
- @llamaindex/openai@0.2.1
## 0.0.6
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/deepseek",
"description": "DeepSeek Adapter for LlamaIndex",
"version": "0.0.6",
"version": "0.0.7",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,11 @@
# @llamaindex/fireworks
## 0.0.7
### Patch Changes
- @llamaindex/openai@0.2.1
## 0.0.6
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/fireworks",
"description": "Fireworks Adapter for LlamaIndex",
"version": "0.0.6",
"version": "0.0.7",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/google
## 0.2.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.2.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/google",
"description": "Google Adapter for LlamaIndex",
"version": "0.2.0",
"version": "0.2.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/groq
## 0.0.62
### Patch Changes
- @llamaindex/openai@0.2.1
## 0.0.61
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/groq",
"description": "Groq Adapter for LlamaIndex",
"version": "0.0.61",
"version": "0.0.62",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,14 @@
# @llamaindex/huggingface
## 0.1.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
- @llamaindex/openai@0.2.1
## 0.1.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/huggingface",
"description": "Huggingface Adapter for LlamaIndex",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"types": "dist/index.d.ts",
"main": "dist/index.cjs",
+9
View File
@@ -1,5 +1,14 @@
# @llamaindex/jinaai
## 0.0.7
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
- @llamaindex/openai@0.2.1
## 0.0.6
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/jinaai",
"description": "JinaAI Adapter for LlamaIndex",
"version": "0.0.6",
"version": "0.0.7",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/mistral
## 0.1.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/mistral",
"description": "Mistral Adapter for LlamaIndex",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/mixedbread
## 0.0.15
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.14
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/mixedbread",
"description": "Mixedbread Adapter for LlamaIndex",
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/ollama
## 0.1.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/ollama",
"description": "Ollama Adapter for LlamaIndex",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
+8
View File
@@ -1,5 +1,13 @@
# @llamaindex/openai
## 0.2.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.2.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/openai",
"description": "OpenAI Adapter for LlamaIndex",
"version": "0.2.0",
"version": "0.2.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,14 @@
# @llamaindex/perplexity
## 0.0.4
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
- @llamaindex/openai@0.2.1
## 0.0.3
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/perplexity",
"description": "Perplexity Adapter for LlamaIndex",
"version": "0.0.3",
"version": "0.0.4",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/portkey-ai
## 0.0.43
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.42
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/portkey-ai",
"description": "Portkey Adapter for LlamaIndex",
"version": "0.0.42",
"version": "0.0.43",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/replicate
## 0.0.43
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.42
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/replicate",
"description": "Replicate Adapter for LlamaIndex",
"version": "0.0.42",
"version": "0.0.43",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/astra
## 0.0.15
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.14
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/astra",
"description": "Astra Storage for LlamaIndex",
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/azure
## 0.1.10
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.9
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/azure",
"description": "Azure Storage for LlamaIndex",
"version": "0.1.9",
"version": "0.1.10",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/chroma
## 0.0.15
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.14
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/chroma",
"description": "Chroma Storage for LlamaIndex",
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/elastic-search
## 0.1.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.0
### Minor Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/elastic-search",
"description": "Elastic Search Storage for LlamaIndex",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/firestore
## 1.0.8
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 1.0.7
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/firestore",
"description": "Firestore Storage for LlamaIndex",
"version": "1.0.7",
"version": "1.0.8",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/milvus
## 0.1.10
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.9
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/milvus",
"description": "Milvus Storage for LlamaIndex",
"version": "0.1.9",
"version": "0.1.10",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/mongodb
## 0.0.15
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.14
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/mongodb",
"description": "MongoDB Storage for LlamaIndex",
"version": "0.0.14",
"version": "0.0.15",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/pinecone
## 0.1.1
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.0
### Minor Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/pinecone",
"description": "Pinecone Storage for LlamaIndex",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/postgres
## 0.0.43
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.0.42
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/postgres",
"description": "PostgreSQL Storage for LlamaIndex",
"version": "0.0.42",
"version": "0.0.43",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -1,5 +1,13 @@
# @llamaindex/qdrant
## 0.1.10
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
## 0.1.9
### Patch Changes
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/qdrant",
"description": "Qdrant Storage for LlamaIndex",
"version": "0.1.9",
"version": "0.1.10",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -0,0 +1,14 @@
# @llamaindex/supabase
## 0.1.0
### Minor Changes
- 648cfb5: Add support for supabase vector store
Added doc for the supbase vector store
### Patch Changes
- Updated dependencies [1b6f368]
- Updated dependencies [eaf326e]
- @llamaindex/core@0.6.1
@@ -0,0 +1,51 @@
{
"name": "@llamaindex/supabase",
"description": "Supabase Storage for LlamaIndex",
"version": "0.1.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"exports": {
".": {
"edge-light": {
"types": "./dist/index.edge-light.d.ts",
"default": "./dist/index.edge-light.js"
},
"workerd": {
"types": "./dist/index.edge-light.d.ts",
"default": "./dist/index.edge-light.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
},
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git+https://github.com/run-llama/LlamaIndexTS.git",
"directory": "packages/providers/storage/supabase"
},
"scripts": {
"build": "bunchee",
"dev": "bunchee --watch",
"test": "vitest"
},
"devDependencies": {
"bunchee": "6.4.0",
"vitest": "2.1.0",
"@llamaindex/openai": "workspace:*"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@supabase/supabase-js": "^2.30.0"
}
}

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