fix: node10 module resolution fail in sub llamaindex packages (#1900)

This commit is contained in:
Thuc Pham
2025-04-29 17:47:50 +07:00
committed by GitHub
parent fa66c9ca8e
commit 41953a3ef9
22 changed files with 185 additions and 1474 deletions
+6
View File
@@ -0,0 +1,6 @@
---
"@llamaindex/resolution-tests": patch
"llamaindex": patch
---
fix: node10 module resolution fail in sub llamaindex packages
-17
View File
@@ -1,17 +0,0 @@
# Run LlamaIndex Server with simple steps
1. Setup environment variables
```bash
export OPENAI_API_KEY=<your-openai-api-key>
```
2. Run the server
```bash
npx tsx llamaindex-server/simple-workflow/index.ts
```
3. Open the app at `http://localhost:4000` and start chatting with the agent
![Screenshot](./screenshot.png)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

@@ -1,19 +0,0 @@
import { OpenAI } from "@llamaindex/openai";
import { LlamaIndexServer } from "@llamaindex/server";
import { weather } from "@llamaindex/tools";
import "dotenv/config";
import { agent } from "llamaindex";
const weatherAgent = agent({
tools: [weather()],
llm: new OpenAI({ model: "gpt-4o-mini" }),
});
new LlamaIndexServer({
workflow: () => weatherAgent,
uiConfig: {
appTitle: "Weather Agent",
starterQuestions: ["Ho Chi Minh city weather", "New York weather"],
},
port: 4000,
}).start();
-1
View File
@@ -50,7 +50,6 @@
"@llamaindex/together": "^0.0.13",
"@llamaindex/jinaai": "^0.0.13",
"@llamaindex/perplexity": "^0.0.10",
"@llamaindex/server": "^0.1.6",
"@llamaindex/supabase": "^0.1.2",
"@llamaindex/tools": "^0.0.8",
"@notionhq/client": "^2.2.15",
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"private": true
}
+21 -1437
View File
File diff suppressed because it is too large Load Diff
+38
View File
@@ -3,6 +3,22 @@ import { ok } from "node:assert";
import { test } from "node:test";
import { z } from "zod";
import { VectorStoreIndex } from "llamaindex";
import { ReActAgent } from "llamaindex/agent";
import { LlamaCloudIndex } from "llamaindex/cloud";
import { BaseChatEngine } from "llamaindex/engines";
import { CorrectnessEvaluator } from "llamaindex/evaluation";
import { BaseExtractor } from "llamaindex/extractors";
import { BaseIndex } from "llamaindex/indices";
import { IngestionPipeline } from "llamaindex/ingestion";
import { NodeParser } from "llamaindex/node-parser";
import { ObjectIndex } from "llamaindex/objects";
import { SimilarityPostprocessor } from "llamaindex/postprocessors";
import { BaseSelector } from "llamaindex/selectors";
import { BaseChatStore } from "llamaindex/storage";
import { FunctionTool } from "llamaindex/tools";
import { FilterCondition } from "llamaindex/vector-store";
test("LlamaIndex module resolution test", async (t) => {
await t.test("works with Document class", () => {
const doc = new Document({ text: "This is a test document" });
@@ -40,4 +56,26 @@ test("LlamaIndex module resolution test", async (t) => {
const myAgent = mod.agent({ tools: [sumNumbers] });
ok(myAgent !== undefined);
});
await t.test("all imports work", () => {
const allImports = [
VectorStoreIndex,
ReActAgent,
LlamaCloudIndex,
BaseChatEngine,
CorrectnessEvaluator,
BaseExtractor,
BaseIndex,
IngestionPipeline,
ObjectIndex,
NodeParser,
SimilarityPostprocessor,
BaseSelector,
BaseChatStore,
FunctionTool,
FilterCondition,
];
ok(allImports.filter(Boolean).length === allImports.length);
});
});