Skip to content
Snippets Groups Projects
Commit 7225e916 authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

fix: use new ToolsFactory

parent 897feb99
No related branches found
No related tags found
No related merge requests found
import { import { BaseTool, OpenAIAgent, QueryEngineTool } from "llamaindex";
BaseTool, import { ToolsFactory } from "llamaindex/tools/ToolsFactory";
OpenAIAgent,
QueryEngineTool,
Settings,
ToolFactory,
} from "llamaindex";
import fs from "node:fs/promises"; import fs from "node:fs/promises";
import path from "node:path"; import path from "node:path";
import { getDataSource } from "./index"; import { getDataSource } from "./index";
...@@ -33,12 +28,10 @@ export async function createChatEngine() { ...@@ -33,12 +28,10 @@ export async function createChatEngine() {
const config = JSON.parse( const config = JSON.parse(
await fs.readFile(path.join("config", "tools.json"), "utf8"), await fs.readFile(path.join("config", "tools.json"), "utf8"),
); );
tools = tools.concat(await ToolFactory.createTools(config)); tools = tools.concat(await ToolsFactory.createTools(config));
} catch {} } catch {}
return new OpenAIAgent({ return new OpenAIAgent({
tools, tools,
llm: Settings.llm,
verbose: true,
}); });
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment