@composio/llamaindex 0.3.4 → 0.5.0

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/dist/index.cjs CHANGED
@@ -1,74 +1,58 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ let _composio_core = require("@composio/core");
2
+ let llamaindex = require("llamaindex");
19
3
 
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- LlamaindexProvider: () => LlamaindexProvider
24
- });
25
- module.exports = __toCommonJS(index_exports);
26
- var import_core = require("@composio/core");
27
- var import_llamaindex = require("llamaindex");
28
- var LlamaindexProvider = class extends import_core.BaseAgenticProvider {
29
- name = "llamaindex";
30
- /**
31
- * Wrap a tool in the llamaindex format.
32
- * @param tool - The tool to wrap.
33
- * @returns The wrapped tool.
34
- */
35
- wrapTool(tool, executeTool) {
36
- const inputParams = tool.inputParameters;
37
- const inputParametersSchema = (0, import_core.jsonSchemaToZodSchema)(inputParams ?? {});
38
- return (0, import_llamaindex.tool)({
39
- name: tool.slug,
40
- description: tool.description ?? tool.name ?? "",
41
- parameters: inputParametersSchema,
42
- execute: async (input) => {
43
- const result = await executeTool(tool.slug, input);
44
- return JSON.stringify(result);
45
- }
46
- });
47
- }
48
- /**
49
- * Wrap a list of tools in the llamaindex format.
50
- * @param tools - The tools to wrap.
51
- * @returns The wrapped tools.
52
- */
53
- wrapTools(tools, executeTool) {
54
- return tools.map((tool) => this.wrapTool(tool, executeTool));
55
- }
56
- /**
57
- * Transform MCP URL response into Anthropic-specific format.
58
- * By default, Anthropic uses the standard format (same as default),
59
- * but this method is here to show providers can customize if needed.
60
- *
61
- * @param data - The MCP URL response data
62
- * @returns Standard MCP server response format
63
- */
64
- wrapMcpServerResponse(data) {
65
- return data.map((item) => ({
66
- url: new URL(item.url),
67
- name: item.name
68
- }));
69
- }
4
+ //#region src/index.ts
5
+ /**
6
+ * Llamaindex Provider
7
+ *
8
+ * This provider provides a set of tools for interacting with Llamaindex.
9
+ *
10
+ * @packageDocumentation
11
+ * @module providers/llamaindex
12
+ */
13
+ var LlamaindexProvider = class extends _composio_core.BaseAgenticProvider {
14
+ name = "llamaindex";
15
+ /**
16
+ * Wrap a tool in the llamaindex format.
17
+ * @param tool - The tool to wrap.
18
+ * @returns The wrapped tool.
19
+ */
20
+ wrapTool(tool, executeTool) {
21
+ const inputParams = tool.inputParameters;
22
+ const inputParametersSchema = (0, _composio_core.jsonSchemaToZodSchema)(inputParams ?? {});
23
+ return (0, llamaindex.tool)({
24
+ name: tool.slug,
25
+ description: tool.description ?? tool.name ?? "",
26
+ parameters: inputParametersSchema,
27
+ execute: async (input) => {
28
+ const result = await executeTool(tool.slug, input);
29
+ return JSON.stringify(result);
30
+ }
31
+ });
32
+ }
33
+ /**
34
+ * Wrap a list of tools in the llamaindex format.
35
+ * @param tools - The tools to wrap.
36
+ * @returns The wrapped tools.
37
+ */
38
+ wrapTools(tools, executeTool) {
39
+ return tools.map((tool) => this.wrapTool(tool, executeTool));
40
+ }
41
+ /**
42
+ * Transform MCP URL response into Anthropic-specific format.
43
+ * By default, Anthropic uses the standard format (same as default),
44
+ * but this method is here to show providers can customize if needed.
45
+ *
46
+ * @param data - The MCP URL response data
47
+ * @returns Standard MCP server response format
48
+ */
49
+ wrapMcpServerResponse(data) {
50
+ return data.map((item) => ({
51
+ url: new URL(item.url),
52
+ name: item.name
53
+ }));
54
+ }
70
55
  };
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- LlamaindexProvider
74
- });
56
+
57
+ //#endregion
58
+ exports.LlamaindexProvider = LlamaindexProvider;