@arvo-tools/agentic 0.2.0 → 0.4.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.
Files changed (49) hide show
  1. package/dist/Agent/AgentDefaults.d.ts +28 -0
  2. package/dist/Agent/AgentDefaults.d.ts.map +1 -0
  3. package/dist/Agent/AgentDefaults.js +154 -0
  4. package/dist/Agent/AgentDefaults.js.map +1 -0
  5. package/dist/Agent/agentLoop.d.ts +109 -0
  6. package/dist/Agent/agentLoop.d.ts.map +1 -0
  7. package/dist/Agent/agentLoop.js +391 -0
  8. package/dist/Agent/agentLoop.js.map +1 -0
  9. package/dist/Agent/agentTool.d.ts +4 -0
  10. package/dist/Agent/agentTool.d.ts.map +1 -0
  11. package/dist/Agent/agentTool.js +111 -0
  12. package/dist/Agent/agentTool.js.map +1 -0
  13. package/dist/Agent/index.d.ts +18 -0
  14. package/dist/Agent/index.d.ts.map +1 -0
  15. package/dist/Agent/index.js +293 -0
  16. package/dist/Agent/index.js.map +1 -0
  17. package/dist/Agent/schema.d.ts +363 -0
  18. package/dist/Agent/schema.d.ts.map +1 -0
  19. package/dist/Agent/schema.js +51 -0
  20. package/dist/Agent/schema.js.map +1 -0
  21. package/dist/Agent/types.d.ts +135 -0
  22. package/dist/Agent/types.d.ts.map +1 -0
  23. package/dist/Agent/types.js +3 -0
  24. package/dist/Agent/types.js.map +1 -0
  25. package/dist/Agent/utils.d.ts +31 -0
  26. package/dist/Agent/utils.d.ts.map +1 -0
  27. package/dist/Agent/utils.js +345 -0
  28. package/dist/Agent/utils.js.map +1 -0
  29. package/dist/Integrations/MCPClient.d.ts +80 -0
  30. package/dist/Integrations/MCPClient.d.ts.map +1 -0
  31. package/dist/Integrations/MCPClient.js +292 -0
  32. package/dist/Integrations/MCPClient.js.map +1 -0
  33. package/dist/Integrations/openai.d.ts +10 -0
  34. package/dist/Integrations/openai.d.ts.map +1 -0
  35. package/dist/Integrations/openai.js +353 -0
  36. package/dist/Integrations/openai.js.map +1 -0
  37. package/dist/index.d.ts +10 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +24 -3
  40. package/dist/index.js.map +1 -1
  41. package/dist/interfaces.mcp.d.ts +26 -0
  42. package/dist/interfaces.mcp.d.ts.map +1 -0
  43. package/dist/interfaces.mcp.js +3 -0
  44. package/dist/interfaces.mcp.js.map +1 -0
  45. package/dist/types.d.ts +7 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +3 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +9 -2
@@ -0,0 +1,80 @@
1
+ import type { IMCPClient } from '../interfaces.mcp.js';
2
+ import type { OtelInfoType } from '../types.js';
3
+ /**
4
+ * Model Context Protocol (MCP) client implementation for connecting to and interacting with MCP servers.
5
+ *
6
+ * This client provides a robust interface for establishing connections to MCP servers,
7
+ * discovering available tools, invoking those tools with arguments, and managing the
8
+ * connection lifecycle. It supports both Server-Sent Events (SSE) and streamable HTTP
9
+ * transport protocols, automatically selecting the appropriate transport based on the URL.
10
+ */
11
+ export declare class MCPClient implements IMCPClient {
12
+ private client;
13
+ private isConnected;
14
+ private availableTools;
15
+ private readonly url;
16
+ private readonly requestInit;
17
+ constructor(param: {
18
+ url: string;
19
+ requestInit?: RequestInit;
20
+ } | (() => {
21
+ url: string;
22
+ requestInit?: RequestInit;
23
+ }));
24
+ /**
25
+ * Establishes a connection to the MCP server and discovers available tools.
26
+ *
27
+ * This method performs the following operations:
28
+ * 1. Selects the appropriate transport (SSE or HTTP streaming) based on URL
29
+ * 2. Creates and configures the MCP client with capabilities
30
+ * 3. Establishes the connection to the server
31
+ * 4. Retrieves and caches the list of available tools
32
+ * 5. Logs all operations to the provided OpenTelemetry span
33
+ *
34
+ * @returns Promise that resolves when connection is established and tools are discovered
35
+ * @throws {Error} Throws an error if connection fails, with details logged to the span
36
+ */
37
+ connect(config: {
38
+ otelInfo: OtelInfoType;
39
+ }): Promise<void>;
40
+ /**
41
+ * Retrieves the list of available tool definitions from the connected MCP server.
42
+ *
43
+ * Transforms the cached MCP tools into the AgentToolDefinition format required
44
+ * by the agent system. Tools listed in restrictedTools will have requires_approval set to true.
45
+ * This method returns an empty array if not connected.
46
+ */
47
+ getTools(config: {
48
+ otelInfo: OtelInfoType;
49
+ }): Promise<{
50
+ name: string;
51
+ description: string;
52
+ inputSchema: Record<string, any>;
53
+ }[]>;
54
+ /**
55
+ * Invokes a specific tool on the MCP server with the provided arguments.
56
+ *
57
+ * This method sends a tool invocation request to the connected MCP server and
58
+ * returns the result. All operations are logged to the OpenTelemetry span for
59
+ * observability. If an error occurs during invocation, it returns an error message
60
+ * rather than throwing, allowing the agent to handle tool failures gracefully.
61
+ */
62
+ invokeTool(param: {
63
+ name: string;
64
+ arguments?: Record<string, unknown> | null;
65
+ }, config: {
66
+ otelInfo: OtelInfoType;
67
+ }): Promise<string>;
68
+ /**
69
+ * Gracefully disconnects from the MCP server and cleans up resources.
70
+ *
71
+ * This method safely closes the connection to the MCP server if one exists,
72
+ * resets the connection state, and clears cached data. It's safe to call
73
+ * multiple times - subsequent calls will be no-ops if already disconnected.
74
+ */
75
+ disconnect(config: {
76
+ otelInfo: OtelInfoType;
77
+ }): Promise<void>;
78
+ getToolPriority(): Promise<{}>;
79
+ }
80
+ //# sourceMappingURL=MCPClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCPClient.d.ts","sourceRoot":"","sources":["../../src/Integrations/MCPClient.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,SAAU,YAAW,UAAU;IAC1C,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;gBAG9C,KAAK,EACD;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GAC1C,CAAC,MAAM;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC;IASxD;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA4ChE;;;;;;OAMG;IACG,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,GAAG,OAAO,CACzD;QACE,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QAEpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAClC,EAAE,CACJ;IAsCD;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;KAAE,EACnE,MAAM,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,GACjC,OAAO,CAAC,MAAM,CAAC;IA6DlB;;;;;;OAMG;IACG,UAAU,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D,eAAe;CAGtB"}
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __values = (this && this.__values) || function(o) {
39
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
40
+ if (m) return m.call(o);
41
+ if (o && typeof o.length === "number") return {
42
+ next: function () {
43
+ if (o && i >= o.length) o = void 0;
44
+ return { value: o && o[i++], done: !o };
45
+ }
46
+ };
47
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.MCPClient = void 0;
51
+ var index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
52
+ var sse_js_1 = require("@modelcontextprotocol/sdk/client/sse.js");
53
+ var streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
54
+ var api_1 = require("@opentelemetry/api");
55
+ var arvo_core_1 = require("arvo-core");
56
+ /**
57
+ * Model Context Protocol (MCP) client implementation for connecting to and interacting with MCP servers.
58
+ *
59
+ * This client provides a robust interface for establishing connections to MCP servers,
60
+ * discovering available tools, invoking those tools with arguments, and managing the
61
+ * connection lifecycle. It supports both Server-Sent Events (SSE) and streamable HTTP
62
+ * transport protocols, automatically selecting the appropriate transport based on the URL.
63
+ */
64
+ var MCPClient = /** @class */ (function () {
65
+ function MCPClient(param) {
66
+ this.client = null;
67
+ this.isConnected = false;
68
+ this.availableTools = [];
69
+ this.url = function () { return (typeof param === 'function' ? param() : param).url; };
70
+ this.requestInit = function () { var _a; return (_a = (typeof param === 'function' ? param() : param).requestInit) !== null && _a !== void 0 ? _a : {}; };
71
+ }
72
+ /**
73
+ * Establishes a connection to the MCP server and discovers available tools.
74
+ *
75
+ * This method performs the following operations:
76
+ * 1. Selects the appropriate transport (SSE or HTTP streaming) based on URL
77
+ * 2. Creates and configures the MCP client with capabilities
78
+ * 3. Establishes the connection to the server
79
+ * 4. Retrieves and caches the list of available tools
80
+ * 5. Logs all operations to the provided OpenTelemetry span
81
+ *
82
+ * @returns Promise that resolves when connection is established and tools are discovered
83
+ * @throws {Error} Throws an error if connection fails, with details logged to the span
84
+ */
85
+ MCPClient.prototype.connect = function (config) {
86
+ return __awaiter(this, void 0, void 0, function () {
87
+ var url, requestInit, transport, tools, error_1;
88
+ return __generator(this, function (_a) {
89
+ switch (_a.label) {
90
+ case 0:
91
+ _a.trys.push([0, 3, , 4]);
92
+ url = this.url();
93
+ requestInit = this.requestInit();
94
+ transport = url.includes('/mcp')
95
+ ? new streamableHttp_js_1.StreamableHTTPClientTransport(new URL(url), { requestInit: requestInit })
96
+ : new sse_js_1.SSEClientTransport(new URL(url), { requestInit: requestInit });
97
+ this.client = new index_js_1.Client({
98
+ name: 'arvo-tools-agentic-mcp-client',
99
+ version: '1.0.0',
100
+ });
101
+ return [4 /*yield*/, this.client.connect(transport)];
102
+ case 1:
103
+ _a.sent();
104
+ (0, arvo_core_1.logToSpan)({
105
+ level: 'INFO',
106
+ message: "Connected to MCP Server@".concat(url),
107
+ }, config.otelInfo.span);
108
+ return [4 /*yield*/, this.client.listTools()];
109
+ case 2:
110
+ tools = _a.sent();
111
+ this.availableTools = tools.tools;
112
+ this.isConnected = true;
113
+ (0, arvo_core_1.logToSpan)({
114
+ level: 'INFO',
115
+ message: 'Available MCP tools:',
116
+ tools: JSON.stringify(this.availableTools.map(function (t) { return ({ name: t.name, description: t.description }); })),
117
+ }, config.otelInfo.span);
118
+ return [3 /*break*/, 4];
119
+ case 3:
120
+ error_1 = _a.sent();
121
+ (0, arvo_core_1.exceptionToSpan)(error_1, config.otelInfo.span);
122
+ this.isConnected = false;
123
+ throw new Error("Unable to connect to the MCP Server@".concat(this.url()));
124
+ case 4: return [2 /*return*/];
125
+ }
126
+ });
127
+ });
128
+ };
129
+ /**
130
+ * Retrieves the list of available tool definitions from the connected MCP server.
131
+ *
132
+ * Transforms the cached MCP tools into the AgentToolDefinition format required
133
+ * by the agent system. Tools listed in restrictedTools will have requires_approval set to true.
134
+ * This method returns an empty array if not connected.
135
+ */
136
+ MCPClient.prototype.getTools = function (config) {
137
+ return __awaiter(this, void 0, void 0, function () {
138
+ var toolDef, _a, _b, item;
139
+ var e_1, _c;
140
+ var _d;
141
+ return __generator(this, function (_e) {
142
+ toolDef = [];
143
+ if (!this.isConnected) {
144
+ (0, arvo_core_1.logToSpan)({
145
+ level: 'WARNING',
146
+ message: "Cannot get tools - not connected to MCP Server@".concat(this.url()),
147
+ }, config.otelInfo.span);
148
+ return [2 /*return*/, toolDef];
149
+ }
150
+ try {
151
+ for (_a = __values(this.availableTools), _b = _a.next(); !_b.done; _b = _a.next()) {
152
+ item = _b.value;
153
+ toolDef.push({
154
+ name: item.name,
155
+ description: (_d = item.description) !== null && _d !== void 0 ? _d : '',
156
+ inputSchema: item.inputSchema,
157
+ });
158
+ }
159
+ }
160
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
161
+ finally {
162
+ try {
163
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
164
+ }
165
+ finally { if (e_1) throw e_1.error; }
166
+ }
167
+ (0, arvo_core_1.logToSpan)({
168
+ level: 'INFO',
169
+ message: "Retrieved ".concat(toolDef.length, " tool definitions from MCP Server@").concat(this.url()),
170
+ }, config.otelInfo.span);
171
+ return [2 /*return*/, toolDef];
172
+ });
173
+ });
174
+ };
175
+ /**
176
+ * Invokes a specific tool on the MCP server with the provided arguments.
177
+ *
178
+ * This method sends a tool invocation request to the connected MCP server and
179
+ * returns the result. All operations are logged to the OpenTelemetry span for
180
+ * observability. If an error occurs during invocation, it returns an error message
181
+ * rather than throwing, allowing the agent to handle tool failures gracefully.
182
+ */
183
+ MCPClient.prototype.invokeTool = function (param, config) {
184
+ return __awaiter(this, void 0, void 0, function () {
185
+ var _this = this;
186
+ return __generator(this, function (_a) {
187
+ switch (_a.label) {
188
+ case 0: return [4 /*yield*/, arvo_core_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
189
+ name: "MCP.invoke<".concat(param.name, ">"),
190
+ disableSpanManagement: true,
191
+ context: {
192
+ inheritFrom: 'TRACE_HEADERS',
193
+ traceHeaders: config.otelInfo.headers,
194
+ },
195
+ fn: function (span) { return __awaiter(_this, void 0, void 0, function () {
196
+ var result, error_2, err;
197
+ var _a, _b;
198
+ return __generator(this, function (_c) {
199
+ switch (_c.label) {
200
+ case 0:
201
+ _c.trys.push([0, 2, 3, 4]);
202
+ span.setAttribute(arvo_core_1.OpenInference.ATTR_SPAN_KIND, arvo_core_1.OpenInferenceSpanKind.TOOL);
203
+ span.setStatus({
204
+ code: api_1.SpanStatusCode.OK,
205
+ });
206
+ (0, arvo_core_1.logToSpan)({
207
+ level: 'INFO',
208
+ message: "Invoking tool<".concat(param.name, "> with arguments on MCP Server@").concat(this.url()),
209
+ param: JSON.stringify(param),
210
+ }, span);
211
+ if (!this.isConnected || !this.client) {
212
+ throw new Error("MCP Server@".concat(this.url(), " not connected"));
213
+ }
214
+ return [4 /*yield*/, this.client.callTool({
215
+ name: param.name,
216
+ arguments: (_a = param.arguments) !== null && _a !== void 0 ? _a : undefined,
217
+ })];
218
+ case 1:
219
+ result = _c.sent();
220
+ (0, arvo_core_1.logToSpan)({
221
+ level: 'INFO',
222
+ message: "Successfully invoked tool<".concat(param.name, "> on MCP Server@").concat(this.url()),
223
+ }, span);
224
+ return [2 /*return*/, JSON.stringify(result)];
225
+ case 2:
226
+ error_2 = _c.sent();
227
+ err = new Error("Error occurred while invoking MCP tool <".concat(param.name, "@").concat(this.url(), "> -> ").concat((_b = error_2 === null || error_2 === void 0 ? void 0 : error_2.message) !== null && _b !== void 0 ? _b : 'Something went wrong'));
228
+ (0, arvo_core_1.exceptionToSpan)(err, span);
229
+ span.setStatus({
230
+ code: api_1.SpanStatusCode.ERROR,
231
+ message: err.message,
232
+ });
233
+ return [2 /*return*/, err.message];
234
+ case 3:
235
+ span.end();
236
+ return [7 /*endfinally*/];
237
+ case 4: return [2 /*return*/];
238
+ }
239
+ });
240
+ }); },
241
+ })];
242
+ case 1: return [2 /*return*/, _a.sent()];
243
+ }
244
+ });
245
+ });
246
+ };
247
+ /**
248
+ * Gracefully disconnects from the MCP server and cleans up resources.
249
+ *
250
+ * This method safely closes the connection to the MCP server if one exists,
251
+ * resets the connection state, and clears cached data. It's safe to call
252
+ * multiple times - subsequent calls will be no-ops if already disconnected.
253
+ */
254
+ MCPClient.prototype.disconnect = function (config) {
255
+ return __awaiter(this, void 0, void 0, function () {
256
+ return __generator(this, function (_a) {
257
+ switch (_a.label) {
258
+ case 0:
259
+ if (!(this.client && this.isConnected)) return [3 /*break*/, 2];
260
+ return [4 /*yield*/, this.client.close()];
261
+ case 1:
262
+ _a.sent();
263
+ this.isConnected = false;
264
+ this.availableTools = [];
265
+ this.client = null;
266
+ (0, arvo_core_1.logToSpan)({
267
+ level: 'INFO',
268
+ message: "Disconnected from MCP Server@".concat(this.url()),
269
+ }, config.otelInfo.span);
270
+ return [3 /*break*/, 3];
271
+ case 2:
272
+ (0, arvo_core_1.logToSpan)({
273
+ level: 'INFO',
274
+ message: "MCP Server@".concat(this.url(), " already disconnected"),
275
+ }, config.otelInfo.span);
276
+ _a.label = 3;
277
+ case 3: return [2 /*return*/];
278
+ }
279
+ });
280
+ });
281
+ };
282
+ MCPClient.prototype.getToolPriority = function () {
283
+ return __awaiter(this, void 0, void 0, function () {
284
+ return __generator(this, function (_a) {
285
+ return [2 /*return*/, {}];
286
+ });
287
+ });
288
+ };
289
+ return MCPClient;
290
+ }());
291
+ exports.MCPClient = MCPClient;
292
+ //# sourceMappingURL=MCPClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCPClient.js","sourceRoot":"","sources":["../../src/Integrations/MCPClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAmE;AACnE,kEAA6E;AAC7E,wFAAmG;AAEnG,0CAAoD;AACpD,uCAMmB;AAInB;;;;;;;GAOG;AACH;IAOE,mBACE,KAEsD;QAEtD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB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AAE,CAAC;wBACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;wBAEnB,IAAA,qBAAS,EACP;4BACE,KAAK,EAAE,MAAM;4BACb,OAAO,EAAE,uCAAgC,IAAI,CAAC,GAAG,EAAE,CAAE;yBACtD,EACD,MAAM,CAAC,QAAQ,CAAC,IAAI,CACrB,CAAC;;;wBAEF,IAAA,qBAAS,EACP;4BACE,KAAK,EAAE,MAAM;4BACb,OAAO,EAAE,qBAAc,IAAI,CAAC,GAAG,EAAE,0BAAuB;yBACzD,EACD,MAAM,CAAC,QAAQ,CAAC,IAAI,CACrB,CAAC;;;;;;KAEL;IACK,mCAAe,GAArB;;;gBACE,sBAAO,EAAE,EAAC;;;KACX;IACH,gBAAC;AAAD,CAAC,AA1OD,IA0OC;AA1OY,8BAAS"}
@@ -0,0 +1,10 @@
1
+ import type OpenAI from 'openai';
2
+ import type { ChatModel } from 'openai/resources/shared.mjs';
3
+ import type { AgentLLMIntegration } from '../Agent/types';
4
+ export declare const openaiLLMIntegration: (client: OpenAI, config?: {
5
+ model: ChatModel;
6
+ temperature?: number;
7
+ maxTokens?: number;
8
+ executionunits?: (prompt: number, completion: number) => number;
9
+ }) => AgentLLMIntegration;
10
+ //# sourceMappingURL=openai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/Integrations/openai.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EACV,mBAAmB,EAMpB,MAAM,gBAAgB,CAAC;AA+FxB,eAAO,MAAM,oBAAoB,GAE7B,QAAQ,MAAM,EACd,SAAS;IACP,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CACjE,KACA,mBA8KC,CAAC"}