@composio/llamaindex 0.11.0 → 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.d.mts +4 -5
- package/dist/index.mjs +13 -14
- package/package.json +4 -4
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.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseAgenticProvider, ExecuteToolFn, McpServerGetResponse, McpUrlResponse, Tool } from "@composio/core";
|
|
2
2
|
import { tool } from "llamaindex";
|
|
3
3
|
//#region src/index.d.ts
|
|
4
|
-
type LlamaindexTool = ReturnType<typeof tool>;
|
|
5
|
-
type LlamaindexToolCollection = Array<LlamaindexTool>;
|
|
6
|
-
declare class LlamaindexProvider extends BaseAgenticProvider<Array<LlamaindexTool>, LlamaindexTool, McpServerGetResponse> {
|
|
4
|
+
export type LlamaindexTool = ReturnType<typeof tool>;
|
|
5
|
+
export type LlamaindexToolCollection = Array<LlamaindexTool>;
|
|
6
|
+
export declare class LlamaindexProvider extends BaseAgenticProvider<Array<LlamaindexTool>, LlamaindexTool, McpServerGetResponse> {
|
|
7
7
|
readonly name = "llamaindex";
|
|
8
8
|
/**
|
|
9
9
|
* Wrap a tool in the llamaindex format.
|
|
@@ -27,5 +27,4 @@ declare class LlamaindexProvider extends BaseAgenticProvider<Array<LlamaindexToo
|
|
|
27
27
|
*/
|
|
28
28
|
wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse;
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { LlamaindexProvider, LlamaindexTool, LlamaindexToolCollection };
|
|
30
|
+
//#endregion
|
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",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"author": "",
|
|
38
38
|
"license": "ISC",
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@composio/core": ">=0.10.0 <1.0.0",
|
|
40
|
+
"@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
|
|
41
41
|
"llamaindex": "^0.12.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"tsdown": "^0.
|
|
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",
|