forked from run-llama/LlamaIndexTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.test.ts
32 lines (31 loc) · 1010 Bytes
/
tools.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { ToolsFactory } from "llamaindex/tools/ToolsFactory";
import { WikipediaTool } from "llamaindex/tools/WikipediaTool";
import { assertType, describe, test } from "vitest";
describe("ToolsFactory", async () => {
test("createTool", async () => {
await ToolsFactory.createTool(ToolsFactory.Tools.Wikipedia, {
metadata: {
name: "wikipedia_tool",
description: "A tool that uses a query engine to search Wikipedia.",
},
});
});
test("createTools", async () => {
await ToolsFactory.createTools({
[ToolsFactory.Tools.Wikipedia]: {
metadata: {
name: "wikipedia_tool",
description: "A tool that uses a query engine to search Wikipedia.",
},
},
});
});
test("type", () => {
assertType<
(
key: ToolsFactory.Tools.Wikipedia,
params: ConstructorParameters<typeof WikipediaTool>[0],
) => Promise<WikipediaTool>
>(ToolsFactory.createTool<ToolsFactory.Tools.Wikipedia>);
});
});