llm-exe 0.0.1

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 (185) hide show
  1. package/dist/embedding/base.d.ts +8 -0
  2. package/dist/embedding/base.js +43 -0
  3. package/dist/embedding/base.js.map +1 -0
  4. package/dist/embedding/openai.d.ts +11 -0
  5. package/dist/embedding/openai.js +72 -0
  6. package/dist/embedding/openai.js.map +1 -0
  7. package/dist/executor/_base.d.ts +54 -0
  8. package/dist/executor/_base.js +173 -0
  9. package/dist/executor/_base.js.map +1 -0
  10. package/dist/executor/_functions.d.ts +25 -0
  11. package/dist/executor/_functions.js +30 -0
  12. package/dist/executor/_functions.js.map +1 -0
  13. package/dist/executor/_metadata.d.ts +8 -0
  14. package/dist/executor/_metadata.js +69 -0
  15. package/dist/executor/_metadata.js.map +1 -0
  16. package/dist/executor/core.d.ts +10 -0
  17. package/dist/executor/core.js +28 -0
  18. package/dist/executor/core.js.map +1 -0
  19. package/dist/executor/index.d.ts +4 -0
  20. package/dist/executor/index.js +13 -0
  21. package/dist/executor/index.js.map +1 -0
  22. package/dist/executor/llm.d.ts +29 -0
  23. package/dist/executor/llm.js +73 -0
  24. package/dist/executor/llm.js.map +1 -0
  25. package/dist/index.d.ts +61 -0
  26. package/dist/index.js +88 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/interfaces/chat.d.ts +19 -0
  29. package/dist/interfaces/chat.js +3 -0
  30. package/dist/interfaces/chat.js.map +1 -0
  31. package/dist/interfaces/functions.d.ts +72 -0
  32. package/dist/interfaces/functions.js +3 -0
  33. package/dist/interfaces/functions.js.map +1 -0
  34. package/dist/interfaces/index.d.ts +6 -0
  35. package/dist/interfaces/index.js +23 -0
  36. package/dist/interfaces/index.js.map +1 -0
  37. package/dist/interfaces/openai.d.ts +33 -0
  38. package/dist/interfaces/openai.js +3 -0
  39. package/dist/interfaces/openai.js.map +1 -0
  40. package/dist/interfaces/parser.d.ts +11 -0
  41. package/dist/interfaces/parser.js +3 -0
  42. package/dist/interfaces/parser.js.map +1 -0
  43. package/dist/interfaces/prompt.d.ts +20 -0
  44. package/dist/interfaces/prompt.js +3 -0
  45. package/dist/interfaces/prompt.js.map +1 -0
  46. package/dist/interfaces/utils.d.ts +15 -0
  47. package/dist/interfaces/utils.js +3 -0
  48. package/dist/interfaces/utils.js.map +1 -0
  49. package/dist/llm/_base.d.ts +78 -0
  50. package/dist/llm/_base.js +164 -0
  51. package/dist/llm/_base.js.map +1 -0
  52. package/dist/llm/index.d.ts +2 -0
  53. package/dist/llm/index.js +9 -0
  54. package/dist/llm/index.js.map +1 -0
  55. package/dist/llm/openai.d.ts +95 -0
  56. package/dist/llm/openai.js +274 -0
  57. package/dist/llm/openai.js.map +1 -0
  58. package/dist/llm/output/base.d.ts +12 -0
  59. package/dist/llm/output/base.js +45 -0
  60. package/dist/llm/output/base.js.map +1 -0
  61. package/dist/llm/output/index.d.ts +9 -0
  62. package/dist/llm/output/index.js +29 -0
  63. package/dist/llm/output/index.js.map +1 -0
  64. package/dist/llm/output/openai-chat.d.ts +13 -0
  65. package/dist/llm/output/openai-chat.js +51 -0
  66. package/dist/llm/output/openai-chat.js.map +1 -0
  67. package/dist/parser/_base.d.ts +33 -0
  68. package/dist/parser/_base.js +64 -0
  69. package/dist/parser/_base.js.map +1 -0
  70. package/dist/parser/_functions.d.ts +94 -0
  71. package/dist/parser/_functions.js +52 -0
  72. package/dist/parser/_functions.js.map +1 -0
  73. package/dist/parser/index.d.ts +14 -0
  74. package/dist/parser/index.js +31 -0
  75. package/dist/parser/index.js.map +1 -0
  76. package/dist/parser/parsers/BooleanParser.d.ts +8 -0
  77. package/dist/parser/parsers/BooleanParser.js +20 -0
  78. package/dist/parser/parsers/BooleanParser.js.map +1 -0
  79. package/dist/parser/parsers/CustomParser.d.ts +27 -0
  80. package/dist/parser/parsers/CustomParser.js +41 -0
  81. package/dist/parser/parsers/CustomParser.js.map +1 -0
  82. package/dist/parser/parsers/JsonParser.d.ts +7 -0
  83. package/dist/parser/parsers/JsonParser.js +15 -0
  84. package/dist/parser/parsers/JsonParser.js.map +1 -0
  85. package/dist/parser/parsers/ListToArrayParser.d.ts +5 -0
  86. package/dist/parser/parsers/ListToArrayParser.js +17 -0
  87. package/dist/parser/parsers/ListToArrayParser.js.map +1 -0
  88. package/dist/parser/parsers/ListToJsonParser.d.ts +7 -0
  89. package/dist/parser/parsers/ListToJsonParser.js +25 -0
  90. package/dist/parser/parsers/ListToJsonParser.js.map +1 -0
  91. package/dist/parser/parsers/ListToKeyValueParser.d.ts +14 -0
  92. package/dist/parser/parsers/ListToKeyValueParser.js +24 -0
  93. package/dist/parser/parsers/ListToKeyValueParser.js.map +1 -0
  94. package/dist/parser/parsers/MarkdownCodeBlock.d.ts +14 -0
  95. package/dist/parser/parsers/MarkdownCodeBlock.js +16 -0
  96. package/dist/parser/parsers/MarkdownCodeBlock.js.map +1 -0
  97. package/dist/parser/parsers/MarkdownCodeBlocks.d.ts +14 -0
  98. package/dist/parser/parsers/MarkdownCodeBlocks.js +25 -0
  99. package/dist/parser/parsers/MarkdownCodeBlocks.js.map +1 -0
  100. package/dist/parser/parsers/NumberParser.d.ts +8 -0
  101. package/dist/parser/parsers/NumberParser.js +16 -0
  102. package/dist/parser/parsers/NumberParser.js.map +1 -0
  103. package/dist/parser/parsers/ReplaceStringTemplateParser.d.ts +8 -0
  104. package/dist/parser/parsers/ReplaceStringTemplateParser.js +15 -0
  105. package/dist/parser/parsers/ReplaceStringTemplateParser.js.map +1 -0
  106. package/dist/parser/parsers/StringParser.d.ts +8 -0
  107. package/dist/parser/parsers/StringParser.js +17 -0
  108. package/dist/parser/parsers/StringParser.js.map +1 -0
  109. package/dist/plugins/callable/callable.d.ts +72 -0
  110. package/dist/plugins/callable/callable.js +107 -0
  111. package/dist/plugins/callable/callable.js.map +1 -0
  112. package/dist/plugins/callable/index.d.ts +26 -0
  113. package/dist/plugins/callable/index.js +28 -0
  114. package/dist/plugins/callable/index.js.map +1 -0
  115. package/dist/prompt/_base.d.ts +56 -0
  116. package/dist/prompt/_base.js +139 -0
  117. package/dist/prompt/_base.js.map +1 -0
  118. package/dist/prompt/_functions.d.ts +19 -0
  119. package/dist/prompt/_functions.js +24 -0
  120. package/dist/prompt/_functions.js.map +1 -0
  121. package/dist/prompt/chat.d.ts +68 -0
  122. package/dist/prompt/chat.js +136 -0
  123. package/dist/prompt/chat.js.map +1 -0
  124. package/dist/prompt/index.d.ts +4 -0
  125. package/dist/prompt/index.js +13 -0
  126. package/dist/prompt/index.js.map +1 -0
  127. package/dist/prompt/text.d.ts +9 -0
  128. package/dist/prompt/text.js +16 -0
  129. package/dist/prompt/text.js.map +1 -0
  130. package/dist/state/_base.d.ts +29 -0
  131. package/dist/state/_base.js +92 -0
  132. package/dist/state/_base.js.map +1 -0
  133. package/dist/state/_functions.d.ts +6 -0
  134. package/dist/state/_functions.js +19 -0
  135. package/dist/state/_functions.js.map +1 -0
  136. package/dist/state/dialogue.d.ts +17 -0
  137. package/dist/state/dialogue.js +66 -0
  138. package/dist/state/dialogue.js.map +1 -0
  139. package/dist/state/index.d.ts +4 -0
  140. package/dist/state/index.js +16 -0
  141. package/dist/state/index.js.map +1 -0
  142. package/dist/state/item.d.ts +23 -0
  143. package/dist/state/item.js +64 -0
  144. package/dist/state/item.js.map +1 -0
  145. package/dist/types/index.d.ts +1 -0
  146. package/dist/types/index.js +18 -0
  147. package/dist/types/index.js.map +1 -0
  148. package/dist/utils/index.d.ts +1 -0
  149. package/dist/utils/index.js +18 -0
  150. package/dist/utils/index.js.map +1 -0
  151. package/dist/utils/modules/asyncCallWithTimeout.d.ts +1 -0
  152. package/dist/utils/modules/asyncCallWithTimeout.js +17 -0
  153. package/dist/utils/modules/asyncCallWithTimeout.js.map +1 -0
  154. package/dist/utils/modules/handlebars/helpers/index.d.ts +7 -0
  155. package/dist/utils/modules/handlebars/helpers/index.js +71 -0
  156. package/dist/utils/modules/handlebars/helpers/index.js.map +1 -0
  157. package/dist/utils/modules/handlebars/index.d.ts +2 -0
  158. package/dist/utils/modules/handlebars/index.js +105 -0
  159. package/dist/utils/modules/handlebars/index.js.map +1 -0
  160. package/dist/utils/modules/handlebars/templates/index.d.ts +9 -0
  161. package/dist/utils/modules/handlebars/templates/index.js +34 -0
  162. package/dist/utils/modules/handlebars/templates/index.js.map +1 -0
  163. package/dist/utils/modules/index.d.ts +42 -0
  164. package/dist/utils/modules/index.js +133 -0
  165. package/dist/utils/modules/index.js.map +1 -0
  166. package/dist/utils/modules/json-schema-filter.d.ts +1 -0
  167. package/dist/utils/modules/json-schema-filter.js +69 -0
  168. package/dist/utils/modules/json-schema-filter.js.map +1 -0
  169. package/dist/utils/modules/json.d.ts +3 -0
  170. package/dist/utils/modules/json.js +57 -0
  171. package/dist/utils/modules/json.js.map +1 -0
  172. package/dist/utils/modules/replaceTemplateString.d.ts +2 -0
  173. package/dist/utils/modules/replaceTemplateString.js +21 -0
  174. package/dist/utils/modules/replaceTemplateString.js.map +1 -0
  175. package/dist/vector/base.d.ts +11 -0
  176. package/dist/vector/base.js +23 -0
  177. package/dist/vector/base.js.map +1 -0
  178. package/dist/vector/index.d.ts +2 -0
  179. package/dist/vector/index.js +8 -0
  180. package/dist/vector/index.js.map +1 -0
  181. package/dist/vector/pinecone.d.ts +6 -0
  182. package/dist/vector/pinecone.js +22 -0
  183. package/dist/vector/pinecone.js.map +1 -0
  184. package/package.json +67 -0
  185. package/readme.md +12 -0
@@ -0,0 +1,14 @@
1
+ import { BaseParserOptions } from "../../types";
2
+ import { BaseParser } from "../_base";
3
+ export interface MarkdownCodeBlockParserOptions extends BaseParserOptions {
4
+ }
5
+ export declare class MarkdownCodeBlockParser extends BaseParser<{
6
+ language: string;
7
+ code: string;
8
+ }> {
9
+ constructor(options?: MarkdownCodeBlockParserOptions);
10
+ parse(input: string): {
11
+ code: string;
12
+ language: string;
13
+ };
14
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkdownCodeBlockParser = void 0;
4
+ const MarkdownCodeBlocks_1 = require("./MarkdownCodeBlocks");
5
+ const _base_1 = require("../_base");
6
+ class MarkdownCodeBlockParser extends _base_1.BaseParser {
7
+ constructor(options) {
8
+ super("markdownCodeBlock", options);
9
+ }
10
+ parse(input) {
11
+ const [block] = new MarkdownCodeBlocks_1.MarkdownCodeBlocksParser().parse(input);
12
+ return block;
13
+ }
14
+ }
15
+ exports.MarkdownCodeBlockParser = MarkdownCodeBlockParser;
16
+ //# sourceMappingURL=MarkdownCodeBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownCodeBlock.js","sourceRoot":"src/","sources":["parser/parsers/MarkdownCodeBlock.ts"],"names":[],"mappings":";;;AACA,6DAAgE;AAChE,oCAAsC;AAItC,MAAa,uBAAwB,SAAQ,kBAG3C;IACA,YAAY,OAAwC;QAClD,KAAK,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,KAAK,CAAC,KAAa;QACjB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,6CAAwB,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAXD,0DAWC"}
@@ -0,0 +1,14 @@
1
+ import { BaseParserOptions } from "../../types";
2
+ import { BaseParser } from "../_base";
3
+ export interface MarkdownCodeBlocksParserOptions extends BaseParserOptions {
4
+ }
5
+ export declare class MarkdownCodeBlocksParser extends BaseParser<{
6
+ language: string;
7
+ code: string;
8
+ }[]> {
9
+ constructor(options?: MarkdownCodeBlocksParserOptions);
10
+ parse(input: string): {
11
+ code: string;
12
+ language: string;
13
+ }[];
14
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkdownCodeBlocksParser = void 0;
4
+ const _base_1 = require("../_base");
5
+ class MarkdownCodeBlocksParser extends _base_1.BaseParser {
6
+ constructor(options) {
7
+ super("markdownCodeBlocks", options);
8
+ }
9
+ parse(input) {
10
+ const out = [];
11
+ const regex = input.matchAll(new RegExp(/`{3}([\w]*)\n([\S\s]+?)\n`{3}/, "g"));
12
+ for (const iterator of regex) {
13
+ if (iterator) {
14
+ const [_input, language, code] = iterator;
15
+ out.push({
16
+ language,
17
+ code,
18
+ });
19
+ }
20
+ }
21
+ return out;
22
+ }
23
+ }
24
+ exports.MarkdownCodeBlocksParser = MarkdownCodeBlocksParser;
25
+ //# sourceMappingURL=MarkdownCodeBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownCodeBlocks.js","sourceRoot":"src/","sources":["parser/parsers/MarkdownCodeBlocks.ts"],"names":[],"mappings":";;;AACA,oCAAsC;AAItC,MAAa,wBAAyB,SAAQ,kBAE7C;IACC,YAAY,OAAyC;QACnD,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,KAAa;QACjB,MAAM,GAAG,GAAyC,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAC1B,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,CAAC,CACjD,CAAC;QACF,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC5B,IAAI,QAAQ,EAAE;gBACZ,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC;gBAC1C,GAAG,CAAC,IAAI,CAAC;oBACP,QAAQ;oBACR,IAAI;iBACL,CAAC,CAAC;aACJ;SACF;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAtBD,4DAsBC"}
@@ -0,0 +1,8 @@
1
+ import { BaseParserOptions } from "../../types";
2
+ import { BaseParser } from "../_base";
3
+ export interface NumberParserOptions extends BaseParserOptions {
4
+ }
5
+ export declare class NumberParser extends BaseParser<number> {
6
+ constructor(options?: NumberParserOptions);
7
+ parse(text: string): number;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberParser = void 0;
4
+ const _base_1 = require("../_base");
5
+ const utils_1 = require("../../utils");
6
+ class NumberParser extends _base_1.BaseParser {
7
+ constructor(options) {
8
+ super("number", options);
9
+ }
10
+ parse(text) {
11
+ const match = text.match(/\d/g);
12
+ return match && (0, utils_1.isFinite)((0, utils_1.toNumber)(match[0])) ? (0, utils_1.toNumber)(match[0]) : -1;
13
+ }
14
+ }
15
+ exports.NumberParser = NumberParser;
16
+ //# sourceMappingURL=NumberParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberParser.js","sourceRoot":"src/","sources":["parser/parsers/NumberParser.ts"],"names":[],"mappings":";;;AACA,oCAAsC;AACtC,mCAA6C;AAI7C,MAAa,YAAa,SAAQ,kBAAkB;IAClD,YAAY,OAA6B;QACvC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,IAAY;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,KAAK,IAAI,IAAA,gBAAQ,EAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;CACF;AARD,oCAQC"}
@@ -0,0 +1,8 @@
1
+ import { BaseParser } from "../_base";
2
+ import { BaseParserOptions } from "../../types";
3
+ export interface ReplaceStringTemplateParserOptions extends BaseParserOptions {
4
+ }
5
+ export declare class ReplaceStringTemplateParser extends BaseParser<string> {
6
+ constructor(options?: ReplaceStringTemplateParserOptions);
7
+ parse(text: string, attributes?: Record<string, any>): string;
8
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReplaceStringTemplateParser = void 0;
4
+ const utils_1 = require("../../utils");
5
+ const _base_1 = require("../_base");
6
+ class ReplaceStringTemplateParser extends _base_1.BaseParser {
7
+ constructor(options) {
8
+ super("replaceStringTemplate", options);
9
+ }
10
+ parse(text, attributes) {
11
+ return (0, utils_1.replaceTemplateString)(text, attributes);
12
+ }
13
+ }
14
+ exports.ReplaceStringTemplateParser = ReplaceStringTemplateParser;
15
+ //# sourceMappingURL=ReplaceStringTemplateParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReplaceStringTemplateParser.js","sourceRoot":"src/","sources":["parser/parsers/ReplaceStringTemplateParser.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAChD,oCAAsC;AAItC,MAAa,2BAA4B,SAAQ,kBAAkB;IACjE,YAAY,OAA4C;QACtD,KAAK,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,KAAK,CAAC,IAAY,EAAE,UAAgC;QAClD,OAAO,IAAA,6BAAqB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC;CACF;AAPD,kEAOC"}
@@ -0,0 +1,8 @@
1
+ import { BaseParser } from "../_base";
2
+ import { BaseParserOptions } from "../../types";
3
+ export interface StringParserOptions extends BaseParserOptions {
4
+ }
5
+ export declare class StringParser extends BaseParser<string> {
6
+ constructor(options?: StringParserOptions);
7
+ parse(text: string): string;
8
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringParser = void 0;
4
+ const utils_1 = require("../../utils");
5
+ const _base_1 = require("../_base");
6
+ class StringParser extends _base_1.BaseParser {
7
+ constructor(options) {
8
+ super("string", options);
9
+ }
10
+ parse(text) {
11
+ (0, utils_1.assert)(typeof text === "string", `Invalid input. Expected string. Received ${typeof text}.`);
12
+ const parsed = text.toString();
13
+ return parsed;
14
+ }
15
+ }
16
+ exports.StringParser = StringParser;
17
+ //# sourceMappingURL=StringParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringParser.js","sourceRoot":"src/","sources":["parser/parsers/StringParser.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AACjC,oCAAsC;AAKtC,MAAa,YAAa,SAAQ,kBAAkB;IAClD,YAAY,OAA6B;QACvC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,IAAY;QAChB,IAAA,cAAM,EACJ,OAAO,IAAI,KAAK,QAAQ,EACxB,4CAA4C,OAAO,IAAI,GAAG,CAC3D,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAZD,oCAYC"}
@@ -0,0 +1,72 @@
1
+ import { FunctionOrExecutor, PlainObject } from "../../types";
2
+ import { BaseExecutor } from "../../executor";
3
+ /**
4
+ * Represents the input for a CallableExecutor.
5
+ * @interface CallableExecutorInput
6
+ * @property name - The name of the callable function.
7
+ * @property key - The key for the callable function. Defaults to the name if not provided.
8
+ * @property description - A description of the callable function.
9
+ * @property input - The input for the callable function.
10
+ * @property visibilityHandler - An optional visibility handler for the callable function.
11
+ * @property handler - An optional handler for the callable function.
12
+ */
13
+ export interface CallableExecutorInput<I extends PlainObject | {
14
+ input: string;
15
+ }, O> {
16
+ name: string;
17
+ key?: string;
18
+ description: string;
19
+ input: string;
20
+ visibilityHandler?(input: any, attributes: any, state: any): boolean;
21
+ handler?: FunctionOrExecutor<I, O>;
22
+ }
23
+ /**
24
+ * Represents a CallableExecutor.
25
+ * @interface CallableExecutor
26
+ * @property name - The name of the callable core function.
27
+ * @property key - The key for the callable core function.
28
+ * @property description - A description of the callable core function.
29
+ * @property input - The input for the callable core function.
30
+ * @property visibilityHandler - The visibility handler for the callable core function.
31
+ * @property - The handler for the callable core function.
32
+ */
33
+ export interface CallableExecutor<I, O> {
34
+ name: string;
35
+ key: string;
36
+ description: string;
37
+ input: string;
38
+ visibilityHandler(input: any, attributes: any, state: any): boolean;
39
+ _handler: BaseExecutor<I, O>;
40
+ }
41
+ /**
42
+ * A class representing a CallableExecutor.
43
+ * @class CallableExecutor
44
+ */
45
+ export declare class CallableExecutor<I extends PlainObject | {
46
+ input: string;
47
+ }, O> {
48
+ name: string;
49
+ key: string;
50
+ description: string;
51
+ input: string;
52
+ _handler: BaseExecutor<I, O>;
53
+ constructor(options: CallableExecutorInput<I, O>);
54
+ execute(input: I): Promise<{
55
+ result: O;
56
+ attributes: any;
57
+ }>;
58
+ }
59
+ export declare abstract class UseExecutorsBase<I extends PlainObject | {
60
+ input: string;
61
+ }, O> {
62
+ handlers: CallableExecutor<I, O>[];
63
+ constructor(handlers: CallableExecutor<I, O>[]);
64
+ hasFunction(name: string): boolean;
65
+ getFunction(name: string): CallableExecutor<I, O> | undefined;
66
+ getFunctions(): CallableExecutor<I, O>[];
67
+ getVisibleFunctions(_input: any, _attributes?: any): CallableExecutor<I, O>[];
68
+ callFunction(name: string, input: string): Promise<{
69
+ result: any;
70
+ attributes: any;
71
+ }>;
72
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UseExecutorsBase = exports.CallableExecutor = void 0;
4
+ const _functions_1 = require("../../executor/_functions");
5
+ const utils_1 = require("../../utils");
6
+ const executor_1 = require("../../executor");
7
+ /**
8
+ * A class representing a CallableExecutor.
9
+ * @class CallableExecutor
10
+ */
11
+ class CallableExecutor {
12
+ constructor(options) {
13
+ Object.defineProperty(this, "name", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: void 0
18
+ });
19
+ Object.defineProperty(this, "key", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: void 0
24
+ });
25
+ Object.defineProperty(this, "description", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ Object.defineProperty(this, "input", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "_handler", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: void 0
42
+ });
43
+ const defaults = {
44
+ key: options.name,
45
+ visibilityHandler: (_input, _attributes, _state) => true,
46
+ };
47
+ this.name = options.name;
48
+ this.key = options?.key || defaults.key;
49
+ this.description = options.description;
50
+ this.input = options.input;
51
+ this.visibilityHandler =
52
+ options?.visibilityHandler || defaults.visibilityHandler;
53
+ if (options.handler instanceof executor_1.BaseExecutor) {
54
+ this._handler = options.handler;
55
+ }
56
+ else if (typeof options.handler === "function") {
57
+ this._handler = (0, _functions_1.createCoreExecutor)(options.handler);
58
+ }
59
+ else {
60
+ throw new Error("Invalid handler");
61
+ }
62
+ }
63
+ async execute(input) {
64
+ const response = await this._handler.execute((0, utils_1.ensureInputIsObject)(input));
65
+ return (0, utils_1.enforceResultAttributes)(response);
66
+ }
67
+ }
68
+ exports.CallableExecutor = CallableExecutor;
69
+ class UseExecutorsBase {
70
+ constructor(handlers) {
71
+ Object.defineProperty(this, "handlers", {
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true,
75
+ value: []
76
+ });
77
+ this.handlers = handlers;
78
+ }
79
+ hasFunction(name) {
80
+ return !!this.getFunction(name);
81
+ }
82
+ getFunction(name) {
83
+ return this.handlers.find((a) => a.name === name);
84
+ }
85
+ getFunctions() {
86
+ return [...this.handlers];
87
+ }
88
+ getVisibleFunctions(_input, _attributes) {
89
+ const handlers = this.getFunctions();
90
+ return handlers.filter((a) => typeof a.visibilityHandler === "undefined" ||
91
+ (typeof a.visibilityHandler === "function" &&
92
+ a.visibilityHandler(_input, _attributes, {})));
93
+ }
94
+ async callFunction(name, input) {
95
+ try {
96
+ const handler = this.getFunction(name);
97
+ (0, utils_1.assert)(handler, `[invalid handler] The handler (${name}) does not exist.`);
98
+ const result = await handler.execute((0, utils_1.ensureInputIsObject)(input));
99
+ return result;
100
+ }
101
+ catch (error) {
102
+ return error.message;
103
+ }
104
+ }
105
+ }
106
+ exports.UseExecutorsBase = UseExecutorsBase;
107
+ //# sourceMappingURL=callable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callable.js","sourceRoot":"src/","sources":["plugins/callable/callable.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,26 @@
1
+ import { PlainObject } from "../../types";
2
+ import { CallableExecutor, CallableExecutorInput } from "./callable";
3
+ /**
4
+ * Creates a new CallableExecutor instance.
5
+ * @function createCallableExecutor
6
+ * @param options - The input options for the callable core function.
7
+ * @returns A new CallableExecutor instance.
8
+ */
9
+ export declare function createCallableExecutor<I extends PlainObject | {
10
+ input: string;
11
+ }, O>(options: CallableExecutorInput<I, O>): CallableExecutor<I, O>;
12
+ export declare function useExecutors<I extends PlainObject | {
13
+ input: string;
14
+ }, O extends any>(executors: [
15
+ ...(CallableExecutor<any, any> | CallableExecutorInput<any, any>)[]
16
+ ]): {
17
+ handlers: CallableExecutor<I, O>[];
18
+ hasFunction(name: string): boolean;
19
+ getFunction(name: string): CallableExecutor<I, O> | undefined;
20
+ getFunctions(): CallableExecutor<I, O>[];
21
+ getVisibleFunctions(_input: any, _attributes?: any): CallableExecutor<I, O>[];
22
+ callFunction(name: string, input: string): Promise<{
23
+ result: any;
24
+ attributes: any;
25
+ }>;
26
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useExecutors = exports.createCallableExecutor = void 0;
4
+ const callable_1 = require("./callable");
5
+ /**
6
+ * Creates a new CallableExecutor instance.
7
+ * @function createCallableExecutor
8
+ * @param options - The input options for the callable core function.
9
+ * @returns A new CallableExecutor instance.
10
+ */
11
+ function createCallableExecutor(options) {
12
+ return new callable_1.CallableExecutor(options);
13
+ }
14
+ exports.createCallableExecutor = createCallableExecutor;
15
+ function useExecutors(executors) {
16
+ class UseExecutors extends callable_1.UseExecutorsBase {
17
+ constructor(handlers) {
18
+ super(handlers);
19
+ }
20
+ }
21
+ return new UseExecutors(executors.map((e) => {
22
+ if (e instanceof callable_1.CallableExecutor)
23
+ return e;
24
+ return createCallableExecutor(e);
25
+ }));
26
+ }
27
+ exports.useExecutors = useExecutors;
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["plugins/callable/index.ts"],"names":[],"mappings":";;;AACA,yCAIoB;AAEpB;;;;;GAKG;AACH,SAAgB,sBAAsB,CAGpC,OAAoC;IACpC,OAAO,IAAI,2BAAgB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AALD,wDAKC;AAED,SAAgB,YAAY,CAI1B,SAEC;IAED,MAAM,YAAa,SAAQ,2BAAsB;QAC/C,YAAY,QAAkC;YAC5C,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClB,CAAC;KACF;IACD,OAAO,IAAI,YAAY,CACrB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAClB,IAAI,CAAC,YAAY,2BAAgB;YAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAnBD,oCAmBC"}
@@ -0,0 +1,56 @@
1
+ import { IChatMessages, PromptOptions, PromptType, PromptPartial, PromptHelper } from "../types";
2
+ /**
3
+ * BasePrompt should be extended.
4
+ */
5
+ export declare abstract class BasePrompt<I extends Record<string, any>> {
6
+ readonly type: PromptType;
7
+ messages: IChatMessages;
8
+ partials: PromptPartial[];
9
+ helpers: PromptHelper[];
10
+ /**
11
+ * constructor description
12
+ * @param initialPromptMessage An initial message to add to the prompt.
13
+ */
14
+ constructor(initialPromptMessage?: string, options?: PromptOptions);
15
+ /**
16
+ * addToPrompt description
17
+ * @param content The message content
18
+ * @param role The role of the user. Defaults to system for base text prompt.
19
+ * @return instance of BasePrompt.
20
+ */
21
+ addToPrompt(content: string, role?: string): BasePrompt<I>;
22
+ /**
23
+ * addSystemMessage description
24
+ * @param content The message content
25
+ * @return returns BasePrompt so it can be chained.
26
+ */
27
+ addSystemMessage(content: string): BasePrompt<I>;
28
+ /**
29
+ * registerPartial description
30
+ * @param partialOrPartials Additional partials that can be made available to the template parser.
31
+ * @return BasePrompt so it can be chained.
32
+ */
33
+ registerPartial(partialOrPartials: PromptPartial | PromptPartial[]): BasePrompt<I>;
34
+ /**
35
+ * registerHelpers description
36
+ * @param helperOrHelpers Additional helper functions that can be made available to the template parser.
37
+ * @return BasePrompt so it can be chained.
38
+ */
39
+ registerHelpers(helperOrHelpers: PromptHelper | PromptHelper[]): BasePrompt<I>;
40
+ /**
41
+ * format description
42
+ * @param values The message content
43
+ * @param separator The separator between messages. defaults to "\n\n"
44
+ * @return returns messages formatted with template replacement
45
+ */
46
+ format(values: I, separator?: string): string | IChatMessages;
47
+ getReplacements(values: I): Omit<I, "input"> & {
48
+ input: any;
49
+ _input: any;
50
+ };
51
+ /**
52
+ * validate description
53
+ * @return {boolean} Returns false if the template is not valid.
54
+ */
55
+ validate(): boolean;
56
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasePrompt = void 0;
4
+ const utils_1 = require("../utils");
5
+ /**
6
+ * BasePrompt should be extended.
7
+ */
8
+ class BasePrompt {
9
+ /**
10
+ * constructor description
11
+ * @param initialPromptMessage An initial message to add to the prompt.
12
+ */
13
+ constructor(initialPromptMessage, options) {
14
+ Object.defineProperty(this, "type", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: "text"
19
+ });
20
+ Object.defineProperty(this, "messages", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: []
25
+ });
26
+ Object.defineProperty(this, "partials", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: []
31
+ });
32
+ Object.defineProperty(this, "helpers", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: []
37
+ });
38
+ if (initialPromptMessage) {
39
+ this.addToPrompt(initialPromptMessage, "system");
40
+ }
41
+ if (options) {
42
+ if (options.partials) {
43
+ this.registerPartial(options.partials);
44
+ }
45
+ if (options.helpers) {
46
+ this.registerHelpers(options.helpers);
47
+ }
48
+ }
49
+ }
50
+ /**
51
+ * addToPrompt description
52
+ * @param content The message content
53
+ * @param role The role of the user. Defaults to system for base text prompt.
54
+ * @return instance of BasePrompt.
55
+ */
56
+ addToPrompt(content, role = "system") {
57
+ if (content) {
58
+ switch (role) {
59
+ case "system":
60
+ default:
61
+ this.addSystemMessage(content);
62
+ break;
63
+ }
64
+ }
65
+ return this;
66
+ }
67
+ /**
68
+ * addSystemMessage description
69
+ * @param content The message content
70
+ * @return returns BasePrompt so it can be chained.
71
+ */
72
+ addSystemMessage(content) {
73
+ this.messages.push({
74
+ role: "system",
75
+ content,
76
+ });
77
+ return this;
78
+ }
79
+ /**
80
+ * registerPartial description
81
+ * @param partialOrPartials Additional partials that can be made available to the template parser.
82
+ * @return BasePrompt so it can be chained.
83
+ */
84
+ registerPartial(partialOrPartials) {
85
+ const partials = Array.isArray(partialOrPartials)
86
+ ? partialOrPartials
87
+ : [partialOrPartials];
88
+ this.partials.push(...partials);
89
+ return this;
90
+ }
91
+ /**
92
+ * registerHelpers description
93
+ * @param helperOrHelpers Additional helper functions that can be made available to the template parser.
94
+ * @return BasePrompt so it can be chained.
95
+ */
96
+ registerHelpers(helperOrHelpers) {
97
+ const helpers = Array.isArray(helperOrHelpers)
98
+ ? helperOrHelpers
99
+ : [helperOrHelpers];
100
+ this.helpers.push(...helpers);
101
+ return this;
102
+ }
103
+ /**
104
+ * format description
105
+ * @param values The message content
106
+ * @param separator The separator between messages. defaults to "\n\n"
107
+ * @return returns messages formatted with template replacement
108
+ */
109
+ format(values, separator = "\n\n") {
110
+ const replacements = this.getReplacements(values);
111
+ /* istanbul ignore next */
112
+ return this.messages
113
+ .map((message) => {
114
+ return (0, utils_1.replaceTemplateString)(message.content, replacements, {
115
+ partials: this.partials,
116
+ helpers: this.helpers,
117
+ });
118
+ })
119
+ .join(separator);
120
+ }
121
+ getReplacements(values) {
122
+ const { input = "", ...restOfValues } = values;
123
+ const replacements = Object.assign({}, { ...restOfValues }, {
124
+ input: input,
125
+ _input: input,
126
+ });
127
+ return replacements;
128
+ }
129
+ /**
130
+ * validate description
131
+ * @return {boolean} Returns false if the template is not valid.
132
+ */
133
+ validate() {
134
+ // add validation for missing tokens, etc
135
+ return true;
136
+ }
137
+ }
138
+ exports.BasePrompt = BasePrompt;
139
+ //# sourceMappingURL=_base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_base.js","sourceRoot":"src/","sources":["prompt/_base.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,19 @@
1
+ import { PromptOptions } from "./../interfaces/prompt";
2
+ import { PromptType, ChatPromptOptions } from "../types";
3
+ import { TextPrompt } from "./text";
4
+ import { ChatPrompt } from "./chat";
5
+ /**
6
+ * `createPrompt` Creates a new instance of a prompt.
7
+ *
8
+ * @param type Define whether using chat or string prompt
9
+ * @param initialPromptMessage (optional) A message to use for an initial system message.
10
+ */
11
+ export declare function createPrompt<I extends Record<string, any>>(type: Extract<PromptType, "text">, initialPromptMessage?: string, options?: PromptOptions): TextPrompt<I>;
12
+ export declare function createPrompt<I extends Record<string, any>>(type: Extract<PromptType, "chat">, initialPromptMessage?: string, options?: ChatPromptOptions): ChatPrompt<I>;
13
+ export declare function createPrompt<I extends Record<string, any>>(type?: PromptType, initialPromptMessage?: string, options?: PromptOptions | ChatPromptOptions): TextPrompt<I>;
14
+ /**
15
+ * `createChatPrompt` Creates a new instance of a chat prompt.
16
+ *
17
+ * @param initialSystemPromptMessage (optional) A message to use for an initial system message.
18
+ */
19
+ export declare function createChatPrompt<I extends Record<string, any>>(initialSystemPromptMessage?: string, options?: ChatPromptOptions): ChatPrompt<I>;