@composio/llamaindex 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.mjs +13 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ const result = await myAgent.run(
|
|
|
40
40
|
console.log(result.data.result);
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
The provider
|
|
43
|
+
The provider gives LlamaIndex each tool's JSON Schema as the parameters the model sees, with internal `$ref`s inlined, and validates tool-call arguments with a Zod schema built from the same JSON Schema. Execution is wired through Composio, so LlamaIndex can call the tools directly.
|
|
44
44
|
|
|
45
45
|
## Links
|
|
46
46
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseAgenticProvider, dereferenceJsonSchema, jsonSchemaToZodSchema, normalizeToolArguments } from "@composio/core";
|
|
2
|
-
import {
|
|
1
|
+
import { BaseAgenticProvider, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, jsonSchemaToZodSchema, normalizeToolArguments } from "@composio/core";
|
|
2
|
+
import { FunctionTool } from "llamaindex";
|
|
3
3
|
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
/**
|
|
@@ -17,18 +17,17 @@ var LlamaindexProvider = class extends BaseAgenticProvider {
|
|
|
17
17
|
* @param tool - The tool to wrap.
|
|
18
18
|
* @returns The wrapped tool.
|
|
19
19
|
*/
|
|
20
|
-
wrapTool(tool
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
20
|
+
wrapTool(tool, executeTool) {
|
|
21
|
+
const parameters = deduplicateJsonSchemaRequiredArrays(dereferenceJsonSchema(tool.inputParameters ?? {}, { onUnresolved: "sentinel" }));
|
|
22
|
+
const execute = async (input) => {
|
|
23
|
+
const result = await executeTool(tool.slug, normalizeToolArguments(input, tool.slug));
|
|
24
|
+
return JSON.stringify(result);
|
|
25
|
+
};
|
|
26
|
+
return new FunctionTool(execute, {
|
|
27
|
+
name: tool.slug,
|
|
28
|
+
description: tool.description ?? tool.name ?? "",
|
|
29
|
+
parameters
|
|
30
|
+
}, jsonSchemaToZodSchema(parameters));
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* Wrap a list of tools in the llamaindex format.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/llamaindex",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Agentic Provider for llamaindex in Composio SDK",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"llamaindex": "^0.12.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"tsdown": "^0.23.
|
|
44
|
+
"tsdown": "^0.23.1",
|
|
45
45
|
"typescript": "^7.0.2",
|
|
46
|
-
"@composio/core": "0.
|
|
46
|
+
"@composio/core": "0.26.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsdown",
|