medpromptjs 0.2.2 → 0.2.3

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.
@@ -20,7 +20,7 @@ import { DynamicStructuredTool } from 'langchain/tools';
20
20
  */
21
21
  var mydi = function mydi(c, m, b) {
22
22
  try {
23
- return c.resolve(m + "_" + b);
23
+ return c.resolve(m + '_' + b);
24
24
  } catch (e) {
25
25
  return c.resolve(b);
26
26
  }
@@ -51,11 +51,11 @@ var BaseChain = /*#__PURE__*/function () {
51
51
  this.llm = void 0;
52
52
  this.template = "\n Summarize the following text:\n {input}\n ";
53
53
  this.container = container;
54
- this.name = name === "" ? this.camelize(this.constructor.name) : name;
55
- this.description = description === "" ? this.snake_case(this.constructor.name) : description;
56
- this.tools = this.resolve("tools");
57
- this.prompt = this.resolve("prompt") !== "" ? this.resolve("prompt") : PromptTemplate.fromTemplate(this.template);
58
- this.llm = this.resolve("main-llm");
54
+ this.name = name === '' ? this.camelize(this.constructor.name) : name;
55
+ this.description = description === '' ? this.snake_case(this.constructor.name) : description;
56
+ this.tools = this.resolve('tools');
57
+ this.prompt = this.resolve('prompt') !== '' ? this.resolve('prompt') : PromptTemplate.fromTemplate(this.template);
58
+ this.llm = this.resolve('main-llm');
59
59
  }
60
60
  var _proto = BaseChain.prototype;
61
61
  _proto.resolve = function resolve(name) {
@@ -68,7 +68,7 @@ var BaseChain = /*#__PURE__*/function () {
68
68
  };
69
69
  _proto.snake_case = function snake_case(str) {
70
70
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
71
- return index === 0 ? word.toLowerCase() : "_" + word.toLowerCase();
71
+ return index === 0 ? word.toLowerCase() : '_' + word.toLowerCase();
72
72
  }).replace(/\s+/g, '');
73
73
  }
74
74
  // https://js.langchain.com/v0.1/docs/expression_language/how_to/routing/
@@ -111,47 +111,77 @@ function _inheritsLoose(t, o) {
111
111
  }
112
112
  function _regeneratorRuntime() {
113
113
  _regeneratorRuntime = function () {
114
- return e;
114
+ return r;
115
115
  };
116
116
  var t,
117
- e = {},
118
- r = Object.prototype,
119
- n = r.hasOwnProperty,
120
- o = Object.defineProperty || function (t, e, r) {
121
- t[e] = r.value;
122
- },
123
- i = "function" == typeof Symbol ? Symbol : {},
124
- a = i.iterator || "@@iterator",
125
- c = i.asyncIterator || "@@asyncIterator",
126
- u = i.toStringTag || "@@toStringTag";
127
- function define(t, e, r) {
128
- return Object.defineProperty(t, e, {
129
- value: r,
130
- enumerable: !0,
131
- configurable: !0,
132
- writable: !0
133
- }), t[e];
117
+ r = {},
118
+ e = Object.prototype,
119
+ n = e.hasOwnProperty,
120
+ o = "function" == typeof Symbol ? Symbol : {},
121
+ i = o.iterator || "@@iterator",
122
+ a = o.asyncIterator || "@@asyncIterator",
123
+ u = o.toStringTag || "@@toStringTag";
124
+ function c(t, r, e, n) {
125
+ return Object.defineProperty(t, r, {
126
+ value: e,
127
+ enumerable: !n,
128
+ configurable: !n,
129
+ writable: !n
130
+ });
134
131
  }
135
132
  try {
136
- define({}, "");
133
+ c({}, "");
137
134
  } catch (t) {
138
- define = function (t, e, r) {
139
- return t[e] = r;
135
+ c = function (t, r, e) {
136
+ return t[r] = e;
140
137
  };
141
138
  }
142
- function wrap(t, e, r, n) {
139
+ function h(r, e, n, o) {
143
140
  var i = e && e.prototype instanceof Generator ? e : Generator,
144
- a = Object.create(i.prototype),
145
- c = new Context(n || []);
146
- return o(a, "_invoke", {
147
- value: makeInvokeMethod(t, r, c)
148
- }), a;
141
+ a = Object.create(i.prototype);
142
+ return c(a, "_invoke", function (r, e, n) {
143
+ var o = 1;
144
+ return function (i, a) {
145
+ if (3 === o) throw Error("Generator is already running");
146
+ if (4 === o) {
147
+ if ("throw" === i) throw a;
148
+ return {
149
+ value: t,
150
+ done: !0
151
+ };
152
+ }
153
+ for (n.method = i, n.arg = a;;) {
154
+ var u = n.delegate;
155
+ if (u) {
156
+ var c = d(u, n);
157
+ if (c) {
158
+ if (c === f) continue;
159
+ return c;
160
+ }
161
+ }
162
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
163
+ if (1 === o) throw o = 4, n.arg;
164
+ n.dispatchException(n.arg);
165
+ } else "return" === n.method && n.abrupt("return", n.arg);
166
+ o = 3;
167
+ var h = s(r, e, n);
168
+ if ("normal" === h.type) {
169
+ if (o = n.done ? 4 : 2, h.arg === f) continue;
170
+ return {
171
+ value: h.arg,
172
+ done: n.done
173
+ };
174
+ }
175
+ "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
176
+ }
177
+ };
178
+ }(r, n, new Context(o || [])), !0), a;
149
179
  }
150
- function tryCatch(t, e, r) {
180
+ function s(t, r, e) {
151
181
  try {
152
182
  return {
153
183
  type: "normal",
154
- arg: t.call(e, r)
184
+ arg: t.call(r, e)
155
185
  };
156
186
  } catch (t) {
157
187
  return {
@@ -160,255 +190,193 @@ function _regeneratorRuntime() {
160
190
  };
161
191
  }
162
192
  }
163
- e.wrap = wrap;
164
- var h = "suspendedStart",
165
- l = "suspendedYield",
166
- f = "executing",
167
- s = "completed",
168
- y = {};
193
+ r.wrap = h;
194
+ var f = {};
169
195
  function Generator() {}
170
196
  function GeneratorFunction() {}
171
197
  function GeneratorFunctionPrototype() {}
172
- var p = {};
173
- define(p, a, function () {
198
+ var l = {};
199
+ c(l, i, function () {
174
200
  return this;
175
201
  });
176
- var d = Object.getPrototypeOf,
177
- v = d && d(d(values([])));
178
- v && v !== r && n.call(v, a) && (p = v);
179
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
180
- function defineIteratorMethods(t) {
181
- ["next", "throw", "return"].forEach(function (e) {
182
- define(t, e, function (t) {
183
- return this._invoke(e, t);
202
+ var p = Object.getPrototypeOf,
203
+ y = p && p(p(x([])));
204
+ y && y !== e && n.call(y, i) && (l = y);
205
+ var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
206
+ function g(t) {
207
+ ["next", "throw", "return"].forEach(function (r) {
208
+ c(t, r, function (t) {
209
+ return this._invoke(r, t);
184
210
  });
185
211
  });
186
212
  }
187
- function AsyncIterator(t, e) {
188
- function invoke(r, o, i, a) {
189
- var c = tryCatch(t[r], t, o);
213
+ function AsyncIterator(t, r) {
214
+ function e(o, i, a, u) {
215
+ var c = s(t[o], t, i);
190
216
  if ("throw" !== c.type) {
191
- var u = c.arg,
192
- h = u.value;
193
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
194
- invoke("next", t, i, a);
217
+ var h = c.arg,
218
+ f = h.value;
219
+ return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
220
+ e("next", t, a, u);
195
221
  }, function (t) {
196
- invoke("throw", t, i, a);
197
- }) : e.resolve(h).then(function (t) {
198
- u.value = t, i(u);
222
+ e("throw", t, a, u);
223
+ }) : r.resolve(f).then(function (t) {
224
+ h.value = t, a(h);
199
225
  }, function (t) {
200
- return invoke("throw", t, i, a);
226
+ return e("throw", t, a, u);
201
227
  });
202
228
  }
203
- a(c.arg);
229
+ u(c.arg);
204
230
  }
205
- var r;
206
- o(this, "_invoke", {
207
- value: function (t, n) {
208
- function callInvokeWithMethodAndArg() {
209
- return new e(function (e, r) {
210
- invoke(t, n, e, r);
211
- });
212
- }
213
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
214
- }
215
- });
216
- }
217
- function makeInvokeMethod(e, r, n) {
218
- var o = h;
219
- return function (i, a) {
220
- if (o === f) throw Error("Generator is already running");
221
- if (o === s) {
222
- if ("throw" === i) throw a;
223
- return {
224
- value: t,
225
- done: !0
226
- };
227
- }
228
- for (n.method = i, n.arg = a;;) {
229
- var c = n.delegate;
230
- if (c) {
231
- var u = maybeInvokeDelegate(c, n);
232
- if (u) {
233
- if (u === y) continue;
234
- return u;
235
- }
236
- }
237
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
238
- if (o === h) throw o = s, n.arg;
239
- n.dispatchException(n.arg);
240
- } else "return" === n.method && n.abrupt("return", n.arg);
241
- o = f;
242
- var p = tryCatch(e, r, n);
243
- if ("normal" === p.type) {
244
- if (o = n.done ? s : l, p.arg === y) continue;
245
- return {
246
- value: p.arg,
247
- done: n.done
248
- };
249
- }
250
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
231
+ var o;
232
+ c(this, "_invoke", function (t, n) {
233
+ function i() {
234
+ return new r(function (r, o) {
235
+ e(t, n, r, o);
236
+ });
251
237
  }
252
- };
238
+ return o = o ? o.then(i, i) : i();
239
+ }, !0);
253
240
  }
254
- function maybeInvokeDelegate(e, r) {
255
- var n = r.method,
256
- o = e.iterator[n];
257
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
258
- var i = tryCatch(o, e.iterator, r.arg);
259
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
241
+ function d(r, e) {
242
+ var n = e.method,
243
+ o = r.i[n];
244
+ if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f;
245
+ var i = s(o, r.i, e.arg);
246
+ if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
260
247
  var a = i.arg;
261
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
248
+ return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f);
262
249
  }
263
- function pushTryEntry(t) {
264
- var e = {
265
- tryLoc: t[0]
266
- };
267
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
250
+ function w(t) {
251
+ this.tryEntries.push(t);
268
252
  }
269
- function resetTryEntry(t) {
270
- var e = t.completion || {};
271
- e.type = "normal", delete e.arg, t.completion = e;
253
+ function m(r) {
254
+ var e = r[4] || {};
255
+ e.type = "normal", e.arg = t, r[4] = e;
272
256
  }
273
257
  function Context(t) {
274
- this.tryEntries = [{
275
- tryLoc: "root"
276
- }], t.forEach(pushTryEntry, this), this.reset(!0);
258
+ this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);
277
259
  }
278
- function values(e) {
279
- if (e || "" === e) {
280
- var r = e[a];
281
- if (r) return r.call(e);
282
- if ("function" == typeof e.next) return e;
283
- if (!isNaN(e.length)) {
260
+ function x(r) {
261
+ if (null != r) {
262
+ var e = r[i];
263
+ if (e) return e.call(r);
264
+ if ("function" == typeof r.next) return r;
265
+ if (!isNaN(r.length)) {
284
266
  var o = -1,
285
- i = function next() {
286
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
287
- return next.value = t, next.done = !0, next;
267
+ a = function e() {
268
+ for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;
269
+ return e.value = t, e.done = !0, e;
288
270
  };
289
- return i.next = i;
271
+ return a.next = a;
290
272
  }
291
273
  }
292
- throw new TypeError(typeof e + " is not iterable");
274
+ throw new TypeError(typeof r + " is not iterable");
293
275
  }
294
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
295
- value: GeneratorFunctionPrototype,
296
- configurable: !0
297
- }), o(GeneratorFunctionPrototype, "constructor", {
298
- value: GeneratorFunction,
299
- configurable: !0
300
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
301
- var e = "function" == typeof t && t.constructor;
302
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
303
- }, e.mark = function (t) {
304
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
305
- }, e.awrap = function (t) {
276
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) {
277
+ var r = "function" == typeof t && t.constructor;
278
+ return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
279
+ }, r.mark = function (t) {
280
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
281
+ }, r.awrap = function (t) {
306
282
  return {
307
283
  __await: t
308
284
  };
309
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
285
+ }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
310
286
  return this;
311
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
287
+ }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
312
288
  void 0 === i && (i = Promise);
313
- var a = new AsyncIterator(wrap(t, r, n, o), i);
314
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
289
+ var a = new AsyncIterator(h(t, e, n, o), i);
290
+ return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
315
291
  return t.done ? t.value : a.next();
316
292
  });
317
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
293
+ }, g(v), c(v, u, "Generator"), c(v, i, function () {
318
294
  return this;
319
- }), define(g, "toString", function () {
295
+ }), c(v, "toString", function () {
320
296
  return "[object Generator]";
321
- }), e.keys = function (t) {
322
- var e = Object(t),
323
- r = [];
324
- for (var n in e) r.push(n);
325
- return r.reverse(), function next() {
326
- for (; r.length;) {
327
- var t = r.pop();
328
- if (t in e) return next.value = t, next.done = !1, next;
329
- }
330
- return next.done = !0, next;
297
+ }), r.keys = function (t) {
298
+ var r = Object(t),
299
+ e = [];
300
+ for (var n in r) e.unshift(n);
301
+ return function t() {
302
+ for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;
303
+ return t.done = !0, t;
331
304
  };
332
- }, e.values = values, Context.prototype = {
305
+ }, r.values = x, Context.prototype = {
333
306
  constructor: Context,
334
- reset: function (e) {
335
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
307
+ reset: function (r) {
308
+ if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);
336
309
  },
337
310
  stop: function () {
338
311
  this.done = !0;
339
- var t = this.tryEntries[0].completion;
312
+ var t = this.tryEntries[0][4];
340
313
  if ("throw" === t.type) throw t.arg;
341
314
  return this.rval;
342
315
  },
343
- dispatchException: function (e) {
344
- if (this.done) throw e;
345
- var r = this;
346
- function handle(n, o) {
347
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
316
+ dispatchException: function (r) {
317
+ if (this.done) throw r;
318
+ var e = this;
319
+ function n(t) {
320
+ a.type = "throw", a.arg = r, e.next = t;
348
321
  }
349
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
322
+ for (var o = e.tryEntries.length - 1; o >= 0; --o) {
350
323
  var i = this.tryEntries[o],
351
- a = i.completion;
352
- if ("root" === i.tryLoc) return handle("end");
353
- if (i.tryLoc <= this.prev) {
354
- var c = n.call(i, "catchLoc"),
355
- u = n.call(i, "finallyLoc");
356
- if (c && u) {
357
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
358
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
359
- } else if (c) {
360
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
361
- } else {
362
- if (!u) throw Error("try statement without catch or finally");
363
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
364
- }
324
+ a = i[4],
325
+ u = this.prev,
326
+ c = i[1],
327
+ h = i[2];
328
+ if (-1 === i[0]) return n("end"), !1;
329
+ if (!c && !h) throw Error("try statement without catch or finally");
330
+ if (null != i[0] && i[0] <= u) {
331
+ if (u < c) return this.method = "next", this.arg = t, n(c), !0;
332
+ if (u < h) return n(h), !1;
365
333
  }
366
334
  }
367
335
  },
368
- abrupt: function (t, e) {
369
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
370
- var o = this.tryEntries[r];
371
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
372
- var i = o;
336
+ abrupt: function (t, r) {
337
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
338
+ var n = this.tryEntries[e];
339
+ if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
340
+ var o = n;
373
341
  break;
374
342
  }
375
343
  }
376
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
377
- var a = i ? i.completion : {};
378
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
344
+ o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
345
+ var i = o ? o[4] : {};
346
+ return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
379
347
  },
380
- complete: function (t, e) {
348
+ complete: function (t, r) {
381
349
  if ("throw" === t.type) throw t.arg;
382
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
350
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f;
383
351
  },
384
352
  finish: function (t) {
385
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
386
- var r = this.tryEntries[e];
387
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
353
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
354
+ var e = this.tryEntries[r];
355
+ if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
388
356
  }
389
357
  },
390
358
  catch: function (t) {
391
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
392
- var r = this.tryEntries[e];
393
- if (r.tryLoc === t) {
394
- var n = r.completion;
359
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
360
+ var e = this.tryEntries[r];
361
+ if (e[0] === t) {
362
+ var n = e[4];
395
363
  if ("throw" === n.type) {
396
364
  var o = n.arg;
397
- resetTryEntry(r);
365
+ m(e);
398
366
  }
399
367
  return o;
400
368
  }
401
369
  }
402
370
  throw Error("illegal catch attempt");
403
371
  },
404
- delegateYield: function (e, r, n) {
372
+ delegateYield: function (r, e, n) {
405
373
  return this.delegate = {
406
- iterator: values(e),
407
- resultName: r,
408
- nextLoc: n
409
- }, "next" === this.method && (this.arg = t), y;
374
+ i: x(r),
375
+ r: e,
376
+ n: n
377
+ }, "next" === this.method && (this.arg = t), f;
410
378
  }
411
- }, e;
379
+ }, r;
412
380
  }
413
381
  function _setPrototypeOf(t, e) {
414
382
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
@@ -426,9 +394,9 @@ var BaseAgent = /*#__PURE__*/function () {
426
394
  this.template = "\n ## Question: {question}\n ## Answer: {answer}\n Given the above question and answer, generate a chain of thought explanation for the answer.\n First, start with the model generated chain of thought explanation.\n End the chain of though explanation with:\n Therefore, the answer is {answer}.\n ";
427
395
  this.container = container;
428
396
  this.name = this.camelize(this.constructor.name);
429
- this.tools = this.resolve("tools");
430
- this.prompt = this.resolve("prompt") !== "" ? this.resolve("prompt") : PromptTemplate.fromTemplate(this.template);
431
- this.llm = this.resolve("main-llm");
397
+ this.tools = this.resolve('tools');
398
+ this.prompt = this.resolve('prompt') !== '' ? this.resolve('prompt') : PromptTemplate.fromTemplate(this.template);
399
+ this.llm = this.resolve('main-llm');
432
400
  }
433
401
  var _proto = BaseAgent.prototype;
434
402
  _proto.resolve = function resolve(name) {
@@ -441,11 +409,11 @@ var BaseAgent = /*#__PURE__*/function () {
441
409
  };
442
410
  _proto.snake_case = function snake_case(str) {
443
411
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
444
- return index === 0 ? word.toLowerCase() : "_" + word.toLowerCase();
412
+ return index === 0 ? word.toLowerCase() : '_' + word.toLowerCase();
445
413
  }).replace(/\s+/g, '');
446
414
  };
447
415
  _proto.run = /*#__PURE__*/function () {
448
- var _run = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {
416
+ var _run = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {
449
417
  var agent, agentExecutor;
450
418
  return _regeneratorRuntime().wrap(function _callee$(_context) {
451
419
  while (1) switch (_context.prev = _context.next) {
@@ -462,7 +430,7 @@ var BaseAgent = /*#__PURE__*/function () {
462
430
  agent: agent,
463
431
  tools: this.tools,
464
432
  // verbose: true,
465
- handleParsingErrors: "Please try again, paying close attention to the final answer"
433
+ handleParsingErrors: 'Please try again, paying close attention to the final answer'
466
434
  });
467
435
  _context.next = 6;
468
436
  return agentExecutor.invoke(input);
@@ -499,11 +467,11 @@ var BaseTool = /*#__PURE__*/function (_DynamicStructuredToo) {
499
467
  _this.description = void 0;
500
468
  _this.schema = void 0;
501
469
  _this.func = /*#__PURE__*/function () {
502
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args) {
470
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(args) {
503
471
  return _regeneratorRuntime().wrap(function _callee$(_context) {
504
472
  while (1) switch (_context.prev = _context.next) {
505
473
  case 0:
506
- return _context.abrupt("return", "override this");
474
+ return _context.abrupt("return", 'override this');
507
475
  case 1:
508
476
  case "end":
509
477
  return _context.stop();
@@ -515,8 +483,8 @@ var BaseTool = /*#__PURE__*/function (_DynamicStructuredToo) {
515
483
  };
516
484
  }();
517
485
  _this.container = container;
518
- _this.name = name === "" ? _this.camelize(_this.constructor.name) : name;
519
- _this.description = description === "" ? _this.snake_case(_this.constructor.name) : description;
486
+ _this.name = name === '' ? _this.camelize(_this.constructor.name) : name;
487
+ _this.description = description === '' ? _this.snake_case(_this.constructor.name) : description;
520
488
  _this.schema = schema;
521
489
  return _this;
522
490
  }
@@ -532,7 +500,7 @@ var BaseTool = /*#__PURE__*/function (_DynamicStructuredToo) {
532
500
  };
533
501
  _proto.snake_case = function snake_case(str) {
534
502
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
535
- return index === 0 ? word.toLowerCase() : "_" + word.toLowerCase();
503
+ return index === 0 ? word.toLowerCase() : '_' + word.toLowerCase();
536
504
  }).replace(/\s+/g, '');
537
505
  };
538
506
  return BaseTool;