llm-exe 1.0.2 → 2.0.0-beta.10

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 (209) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.mts +1224 -0
  3. package/dist/index.d.ts +1207 -46
  4. package/dist/index.js +4188 -80
  5. package/dist/index.mjs +4150 -0
  6. package/package.json +35 -29
  7. package/readme.md +79 -2
  8. package/dist/embedding/base.d.ts +0 -8
  9. package/dist/embedding/base.js +0 -43
  10. package/dist/embedding/base.js.map +0 -1
  11. package/dist/embedding/openai.d.ts +0 -11
  12. package/dist/embedding/openai.js +0 -73
  13. package/dist/embedding/openai.js.map +0 -1
  14. package/dist/executor/_base.d.ts +0 -68
  15. package/dist/executor/_base.js +0 -229
  16. package/dist/executor/_base.js.map +0 -1
  17. package/dist/executor/_functions.d.ts +0 -25
  18. package/dist/executor/_functions.js +0 -30
  19. package/dist/executor/_functions.js.map +0 -1
  20. package/dist/executor/_metadata.d.ts +0 -8
  21. package/dist/executor/_metadata.js +0 -59
  22. package/dist/executor/_metadata.js.map +0 -1
  23. package/dist/executor/core.d.ts +0 -10
  24. package/dist/executor/core.js +0 -28
  25. package/dist/executor/core.js.map +0 -1
  26. package/dist/executor/index.d.ts +0 -5
  27. package/dist/executor/index.js +0 -15
  28. package/dist/executor/index.js.map +0 -1
  29. package/dist/executor/llm-openai-function.d.ts +0 -13
  30. package/dist/executor/llm-openai-function.js +0 -23
  31. package/dist/executor/llm-openai-function.js.map +0 -1
  32. package/dist/executor/llm.d.ts +0 -32
  33. package/dist/executor/llm.js +0 -82
  34. package/dist/executor/llm.js.map +0 -1
  35. package/dist/index.js.map +0 -1
  36. package/dist/interfaces/chat.d.ts +0 -74
  37. package/dist/interfaces/chat.js +0 -3
  38. package/dist/interfaces/chat.js.map +0 -1
  39. package/dist/interfaces/functions.d.ts +0 -67
  40. package/dist/interfaces/functions.js +0 -4
  41. package/dist/interfaces/functions.js.map +0 -1
  42. package/dist/interfaces/index.d.ts +0 -7
  43. package/dist/interfaces/index.js +0 -23
  44. package/dist/interfaces/index.js.map +0 -1
  45. package/dist/interfaces/openai.d.ts +0 -46
  46. package/dist/interfaces/openai.js +0 -3
  47. package/dist/interfaces/openai.js.map +0 -1
  48. package/dist/interfaces/parser.d.ts +0 -8
  49. package/dist/interfaces/parser.js +0 -3
  50. package/dist/interfaces/parser.js.map +0 -1
  51. package/dist/interfaces/prompt.d.ts +0 -22
  52. package/dist/interfaces/prompt.js +0 -3
  53. package/dist/interfaces/prompt.js.map +0 -1
  54. package/dist/interfaces/utils.d.ts +0 -18
  55. package/dist/interfaces/utils.js +0 -3
  56. package/dist/interfaces/utils.js.map +0 -1
  57. package/dist/llm/_base.d.ts +0 -84
  58. package/dist/llm/_base.js +0 -184
  59. package/dist/llm/_base.js.map +0 -1
  60. package/dist/llm/index.d.ts +0 -2
  61. package/dist/llm/index.js +0 -9
  62. package/dist/llm/index.js.map +0 -1
  63. package/dist/llm/openai.d.ts +0 -96
  64. package/dist/llm/openai.js +0 -259
  65. package/dist/llm/openai.js.map +0 -1
  66. package/dist/llm/output/base.d.ts +0 -12
  67. package/dist/llm/output/base.js +0 -45
  68. package/dist/llm/output/base.js.map +0 -1
  69. package/dist/llm/output/index.d.ts +0 -9
  70. package/dist/llm/output/index.js +0 -30
  71. package/dist/llm/output/index.js.map +0 -1
  72. package/dist/llm/output/openai.d.ts +0 -17
  73. package/dist/llm/output/openai.js +0 -58
  74. package/dist/llm/output/openai.js.map +0 -1
  75. package/dist/parser/_base.d.ts +0 -33
  76. package/dist/parser/_base.js +0 -62
  77. package/dist/parser/_base.js.map +0 -1
  78. package/dist/parser/_functions.d.ts +0 -109
  79. package/dist/parser/_functions.js +0 -55
  80. package/dist/parser/_functions.js.map +0 -1
  81. package/dist/parser/_utils.d.ts +0 -3
  82. package/dist/parser/_utils.js +0 -24
  83. package/dist/parser/_utils.js.map +0 -1
  84. package/dist/parser/index.d.ts +0 -15
  85. package/dist/parser/index.js +0 -34
  86. package/dist/parser/index.js.map +0 -1
  87. package/dist/parser/parsers/BooleanParser.d.ts +0 -8
  88. package/dist/parser/parsers/BooleanParser.js +0 -20
  89. package/dist/parser/parsers/BooleanParser.js.map +0 -1
  90. package/dist/parser/parsers/CustomParser.d.ts +0 -28
  91. package/dist/parser/parsers/CustomParser.js +0 -42
  92. package/dist/parser/parsers/CustomParser.js.map +0 -1
  93. package/dist/parser/parsers/JsonParser.d.ts +0 -7
  94. package/dist/parser/parsers/JsonParser.js +0 -27
  95. package/dist/parser/parsers/JsonParser.js.map +0 -1
  96. package/dist/parser/parsers/ListToArrayParser.d.ts +0 -5
  97. package/dist/parser/parsers/ListToArrayParser.js +0 -17
  98. package/dist/parser/parsers/ListToArrayParser.js.map +0 -1
  99. package/dist/parser/parsers/ListToJsonParser.d.ts +0 -7
  100. package/dist/parser/parsers/ListToJsonParser.js +0 -34
  101. package/dist/parser/parsers/ListToJsonParser.js.map +0 -1
  102. package/dist/parser/parsers/ListToKeyValueParser.d.ts +0 -14
  103. package/dist/parser/parsers/ListToKeyValueParser.js +0 -24
  104. package/dist/parser/parsers/ListToKeyValueParser.js.map +0 -1
  105. package/dist/parser/parsers/MarkdownCodeBlock.d.ts +0 -14
  106. package/dist/parser/parsers/MarkdownCodeBlock.js +0 -16
  107. package/dist/parser/parsers/MarkdownCodeBlock.js.map +0 -1
  108. package/dist/parser/parsers/MarkdownCodeBlocks.d.ts +0 -14
  109. package/dist/parser/parsers/MarkdownCodeBlocks.js +0 -25
  110. package/dist/parser/parsers/MarkdownCodeBlocks.js.map +0 -1
  111. package/dist/parser/parsers/NumberParser.d.ts +0 -8
  112. package/dist/parser/parsers/NumberParser.js +0 -16
  113. package/dist/parser/parsers/NumberParser.js.map +0 -1
  114. package/dist/parser/parsers/OpenAiFunctionParser.d.ts +0 -16
  115. package/dist/parser/parsers/OpenAiFunctionParser.js +0 -32
  116. package/dist/parser/parsers/OpenAiFunctionParser.js.map +0 -1
  117. package/dist/parser/parsers/ReplaceStringTemplateParser.d.ts +0 -8
  118. package/dist/parser/parsers/ReplaceStringTemplateParser.js +0 -15
  119. package/dist/parser/parsers/ReplaceStringTemplateParser.js.map +0 -1
  120. package/dist/parser/parsers/StringExtractParser.d.ts +0 -12
  121. package/dist/parser/parsers/StringExtractParser.js +0 -42
  122. package/dist/parser/parsers/StringExtractParser.js.map +0 -1
  123. package/dist/parser/parsers/StringParser.d.ts +0 -8
  124. package/dist/parser/parsers/StringParser.js +0 -17
  125. package/dist/parser/parsers/StringParser.js.map +0 -1
  126. package/dist/plugins/callable/callable.d.ts +0 -87
  127. package/dist/plugins/callable/callable.js +0 -149
  128. package/dist/plugins/callable/callable.js.map +0 -1
  129. package/dist/plugins/callable/index.d.ts +0 -21
  130. package/dist/plugins/callable/index.js +0 -29
  131. package/dist/plugins/callable/index.js.map +0 -1
  132. package/dist/prompt/_base.d.ts +0 -61
  133. package/dist/prompt/_base.js +0 -164
  134. package/dist/prompt/_base.js.map +0 -1
  135. package/dist/prompt/_functions.d.ts +0 -19
  136. package/dist/prompt/_functions.js +0 -24
  137. package/dist/prompt/_functions.js.map +0 -1
  138. package/dist/prompt/chat.d.ts +0 -103
  139. package/dist/prompt/chat.js +0 -328
  140. package/dist/prompt/chat.js.map +0 -1
  141. package/dist/prompt/index.d.ts +0 -4
  142. package/dist/prompt/index.js +0 -13
  143. package/dist/prompt/index.js.map +0 -1
  144. package/dist/prompt/text.d.ts +0 -10
  145. package/dist/prompt/text.js +0 -16
  146. package/dist/prompt/text.js.map +0 -1
  147. package/dist/state/_base.d.ts +0 -29
  148. package/dist/state/_base.js +0 -96
  149. package/dist/state/_base.js.map +0 -1
  150. package/dist/state/_functions.d.ts +0 -7
  151. package/dist/state/_functions.js +0 -34
  152. package/dist/state/_functions.js.map +0 -1
  153. package/dist/state/dialogue.d.ts +0 -24
  154. package/dist/state/dialogue.js +0 -111
  155. package/dist/state/dialogue.js.map +0 -1
  156. package/dist/state/index.d.ts +0 -4
  157. package/dist/state/index.js +0 -16
  158. package/dist/state/index.js.map +0 -1
  159. package/dist/state/item.d.ts +0 -22
  160. package/dist/state/item.js +0 -63
  161. package/dist/state/item.js.map +0 -1
  162. package/dist/types/index.d.ts +0 -1
  163. package/dist/types/index.js +0 -18
  164. package/dist/types/index.js.map +0 -1
  165. package/dist/utils/const.d.ts +0 -16
  166. package/dist/utils/const.js +0 -20
  167. package/dist/utils/const.js.map +0 -1
  168. package/dist/utils/index.d.ts +0 -1
  169. package/dist/utils/index.js +0 -18
  170. package/dist/utils/index.js.map +0 -1
  171. package/dist/utils/modules/asyncCallWithTimeout.d.ts +0 -1
  172. package/dist/utils/modules/asyncCallWithTimeout.js +0 -17
  173. package/dist/utils/modules/asyncCallWithTimeout.js.map +0 -1
  174. package/dist/utils/modules/handlebars/hbs.d.ts +0 -11
  175. package/dist/utils/modules/handlebars/hbs.js +0 -65
  176. package/dist/utils/modules/handlebars/hbs.js.map +0 -1
  177. package/dist/utils/modules/handlebars/helpers/index.d.ts +0 -11
  178. package/dist/utils/modules/handlebars/helpers/index.js +0 -108
  179. package/dist/utils/modules/handlebars/helpers/index.js.map +0 -1
  180. package/dist/utils/modules/handlebars/index.d.ts +0 -2
  181. package/dist/utils/modules/handlebars/index.js +0 -79
  182. package/dist/utils/modules/handlebars/index.js.map +0 -1
  183. package/dist/utils/modules/handlebars/templates/index.d.ts +0 -12
  184. package/dist/utils/modules/handlebars/templates/index.js +0 -46
  185. package/dist/utils/modules/handlebars/templates/index.js.map +0 -1
  186. package/dist/utils/modules/index.d.ts +0 -73
  187. package/dist/utils/modules/index.js +0 -190
  188. package/dist/utils/modules/index.js.map +0 -1
  189. package/dist/utils/modules/json-schema-filter.d.ts +0 -2
  190. package/dist/utils/modules/json-schema-filter.js +0 -90
  191. package/dist/utils/modules/json-schema-filter.js.map +0 -1
  192. package/dist/utils/modules/json.d.ts +0 -3
  193. package/dist/utils/modules/json.js +0 -57
  194. package/dist/utils/modules/json.js.map +0 -1
  195. package/dist/utils/modules/openai.d.ts +0 -12
  196. package/dist/utils/modules/openai.js +0 -31
  197. package/dist/utils/modules/openai.js.map +0 -1
  198. package/dist/utils/modules/replaceTemplateString.d.ts +0 -2
  199. package/dist/utils/modules/replaceTemplateString.js +0 -21
  200. package/dist/utils/modules/replaceTemplateString.js.map +0 -1
  201. package/dist/vector/base.d.ts +0 -11
  202. package/dist/vector/base.js +0 -23
  203. package/dist/vector/base.js.map +0 -1
  204. package/dist/vector/index.d.ts +0 -2
  205. package/dist/vector/index.js +0 -8
  206. package/dist/vector/index.js.map +0 -1
  207. package/dist/vector/pinecone.d.ts +0 -6
  208. package/dist/vector/pinecone.js +0 -23
  209. package/dist/vector/pinecone.js.map +0 -1
@@ -1,25 +0,0 @@
1
- import { PlainObject, ExecutorWithLlmOptions, CoreExecutorExecuteOptions, LlmExecutorHooks } from "../types";
2
- import { BaseLlm } from "../llm";
3
- import { BaseParser } from "../parser";
4
- import { BasePrompt } from "../prompt";
5
- import { BaseState } from "../state";
6
- import { CoreExecutor } from "./core";
7
- import { LlmExecutor } from "./llm";
8
- /**
9
- * Function to create a core executor.
10
- * @template I - Input type.
11
- * @template O - Output type.
12
- * @param handler - The handler function.
13
- * @returns - A new CoreExecutor instance.
14
- */
15
- export declare function createCoreExecutor<I extends PlainObject, O>(handler: (input: I) => Promise<O> | O, options?: CoreExecutorExecuteOptions): CoreExecutor<I, O>;
16
- /**
17
- * Function to create a core executor with Llm.
18
- * @template Llm - Llm type.
19
- * @template Prompt - Prompt type.
20
- * @template Parser - Parser type.
21
- * @template State - State type.
22
- * @param options - Options for BaseExecutorV3.
23
- * @returns - A new LlmExecutor instance.
24
- */
25
- export declare function createLlmExecutor<Llm extends BaseLlm<any>, Prompt extends BasePrompt<any>, Parser extends BaseParser, State extends BaseState>(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>): LlmExecutor<Llm, Prompt, Parser, State>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLlmExecutor = exports.createCoreExecutor = void 0;
4
- const core_1 = require("./core");
5
- const llm_1 = require("./llm");
6
- /**
7
- * Function to create a core executor.
8
- * @template I - Input type.
9
- * @template O - Output type.
10
- * @param handler - The handler function.
11
- * @returns - A new CoreExecutor instance.
12
- */
13
- function createCoreExecutor(handler, options) {
14
- return new core_1.CoreExecutor({ handler }, options);
15
- }
16
- exports.createCoreExecutor = createCoreExecutor;
17
- /**
18
- * Function to create a core executor with Llm.
19
- * @template Llm - Llm type.
20
- * @template Prompt - Prompt type.
21
- * @template Parser - Parser type.
22
- * @template State - State type.
23
- * @param options - Options for BaseExecutorV3.
24
- * @returns - A new LlmExecutor instance.
25
- */
26
- function createLlmExecutor(llmConfiguration, options) {
27
- return new llm_1.LlmExecutor(llmConfiguration, options);
28
- }
29
- exports.createLlmExecutor = createLlmExecutor;
30
- //# sourceMappingURL=_functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_functions.js","sourceRoot":"src/","sources":["executor/_functions.ts"],"names":[],"mappings":";;;AAUA,iCAAsC;AACtC,+BAAoC;AAGpC;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,OAAqC,EACrC,OAAoC;IAEpC,OAAO,IAAI,mBAAY,CAAO,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AALD,gDAKC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAM/B,gBAAoE,EACpE,OAAsD;IAEtD,OAAO,IAAI,iBAAW,CAA6B,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAChF,CAAC;AAVD,8CAUC"}
@@ -1,8 +0,0 @@
1
- import { ExecutorExecutionMetadata, ExecutorExecutionMetadataProperties } from "../interfaces";
2
- export declare class ExecutorExecutionMetadataState<I, O> {
3
- #private;
4
- constructor(items?: Pick<ExecutorExecutionMetadataProperties, "start"> & Partial<ExecutorExecutionMetadataProperties>);
5
- setItem(items: Partial<ExecutorExecutionMetadataProperties>): this;
6
- asPlainObject(): Readonly<ExecutorExecutionMetadata<I, O>>;
7
- }
8
- export declare function createMetadataState(items?: Pick<ExecutorExecutionMetadataProperties, "start"> & Partial<ExecutorExecutionMetadataProperties>): ExecutorExecutionMetadataState<any, any>;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var _ExecutorExecutionMetadataState_state;
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createMetadataState = exports.ExecutorExecutionMetadataState = void 0;
10
- class ExecutorExecutionMetadataState {
11
- constructor(items) {
12
- _ExecutorExecutionMetadataState_state.set(this, {
13
- start: null,
14
- end: null,
15
- input: undefined,
16
- handlerInput: undefined,
17
- handlerOutput: undefined,
18
- output: undefined,
19
- errorMessage: undefined,
20
- error: undefined,
21
- metadata: null,
22
- });
23
- if (items) {
24
- this.setItem(items);
25
- }
26
- }
27
- setItem(items) {
28
- // if invalid, do nothing
29
- if (!items || typeof items !== "object" || Array.isArray(items)) {
30
- return this;
31
- }
32
- const keys = Object.keys(items);
33
- for (const key of keys) {
34
- const value = items[key];
35
- __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f")[key] = value;
36
- }
37
- return this;
38
- }
39
- asPlainObject() {
40
- return Object.freeze({
41
- start: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").start,
42
- end: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").end,
43
- input: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").input,
44
- handlerInput: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").handlerInput,
45
- handlerOutput: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").handlerOutput,
46
- output: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").output,
47
- errorMessage: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").errorMessage,
48
- error: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").error,
49
- metadata: __classPrivateFieldGet(this, _ExecutorExecutionMetadataState_state, "f").metadata,
50
- });
51
- }
52
- }
53
- exports.ExecutorExecutionMetadataState = ExecutorExecutionMetadataState;
54
- _ExecutorExecutionMetadataState_state = new WeakMap();
55
- function createMetadataState(items) {
56
- return new ExecutorExecutionMetadataState(items);
57
- }
58
- exports.createMetadataState = createMetadataState;
59
- //# sourceMappingURL=_metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_metadata.js","sourceRoot":"src/","sources":["executor/_metadata.ts"],"names":[],"mappings":";;;;;;;;;AAKA,MAAa,8BAA8B;IAazC,YACE,KAC8C;QAdhD,gDAAoC;YAClC,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,IAAI;YACT,KAAK,EAAE,SAAS;YAChB,YAAY,EAAE,SAAS;YACvB,aAAa,EAAE,SAAS;YACxB,MAAM,EAAE,SAAS;YACjB,YAAY,EAAE,SAAS;YACvB,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;SACf,EAAC;QAMA,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SACrB;IACH,CAAC;IAED,OAAO,CAAC,KAAmD;QACzD,yBAAyB;QACzB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC/D,OAAO,IAAI,CAAC;SACb;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAA2B,CAAC;QAC1D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,uBAAA,IAAI,6CAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAC1B;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,aAAa;QACX,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE,uBAAA,IAAI,6CAAO,CAAC,KAAK;YACxB,GAAG,EAAE,uBAAA,IAAI,6CAAO,CAAC,GAAG;YACpB,KAAK,EAAE,uBAAA,IAAI,6CAAO,CAAC,KAAK;YACxB,YAAY,EAAE,uBAAA,IAAI,6CAAO,CAAC,YAAY;YACtC,aAAa,EAAE,uBAAA,IAAI,6CAAO,CAAC,aAAa;YACxC,MAAM,EAAE,uBAAA,IAAI,6CAAO,CAAC,MAAM;YAC1B,YAAY,EAAE,uBAAA,IAAI,6CAAO,CAAC,YAAY;YACtC,KAAK,EAAE,uBAAA,IAAI,6CAAO,CAAC,KAAK;YACxB,QAAQ,EAAE,uBAAA,IAAI,6CAAO,CAAC,QAAQ;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAhDD,wEAgDC;;AAED,SAAgB,mBAAmB,CACjC,KAC8C;IAE9C,OAAO,IAAI,8BAA8B,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AALD,kDAKC"}
@@ -1,10 +0,0 @@
1
- import { PlainObject, CoreExecutorInput, CoreExecutorExecuteOptions } from "../types";
2
- import { BaseExecutor } from "./_base";
3
- /**
4
- * Core Function Executor
5
- */
6
- export declare class CoreExecutor<I extends PlainObject, O> extends BaseExecutor<I, O> {
7
- _handler: (input: I) => Promise<any> | any;
8
- constructor(fn: CoreExecutorInput<I, O>, options?: CoreExecutorExecuteOptions);
9
- handler(_input: I): Promise<O>;
10
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CoreExecutor = void 0;
4
- const _base_1 = require("./_base");
5
- const utils_1 = require("../utils");
6
- /**
7
- * Core Function Executor
8
- */
9
- class CoreExecutor extends _base_1.BaseExecutor {
10
- constructor(fn, options) {
11
- const name = fn?.name
12
- ? fn.name
13
- : (0, utils_1.inferFunctionName)(fn.handler, "anonymous-core-executor");
14
- super(name, "function-executor", options);
15
- Object.defineProperty(this, "_handler", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: void 0
20
- });
21
- this._handler = fn.handler.bind(null);
22
- }
23
- async handler(_input) {
24
- return this._handler.call(null, _input);
25
- }
26
- }
27
- exports.CoreExecutor = CoreExecutor;
28
- //# sourceMappingURL=core.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.js","sourceRoot":"src/","sources":["executor/core.ts"],"names":[],"mappings":";;;AAKA,mCAAuC;AACvC,mCAA4C;AAE5C;;GAEG;AACH,MAAa,YAAuC,SAAQ,oBAAkB;IAG5E,YACE,EAA2B,EAC3B,OAAoC;QAEpC,MAAM,IAAI,GAAG,EAAE,EAAE,IAAI;YACnB,CAAC,CAAC,EAAE,CAAC,IAAI;YACT,CAAC,CAAC,IAAA,yBAAiB,EAAC,EAAE,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;QAE7D,KAAK,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC;QAV5C;;;;;WAAkD;QAWhD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAS;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF;AAlBD,oCAkBC"}
@@ -1,5 +0,0 @@
1
- export { BaseExecutor } from "./_base";
2
- export { CoreExecutor } from "./core";
3
- export { LlmExecutor } from "./llm";
4
- export { LlmExecutorOpenAiFunctions } from "./llm-openai-function";
5
- export { createCoreExecutor, createLlmExecutor } from "./_functions";
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLlmExecutor = exports.createCoreExecutor = exports.LlmExecutorOpenAiFunctions = exports.LlmExecutor = exports.CoreExecutor = exports.BaseExecutor = void 0;
4
- var _base_1 = require("./_base");
5
- Object.defineProperty(exports, "BaseExecutor", { enumerable: true, get: function () { return _base_1.BaseExecutor; } });
6
- var core_1 = require("./core");
7
- Object.defineProperty(exports, "CoreExecutor", { enumerable: true, get: function () { return core_1.CoreExecutor; } });
8
- var llm_1 = require("./llm");
9
- Object.defineProperty(exports, "LlmExecutor", { enumerable: true, get: function () { return llm_1.LlmExecutor; } });
10
- var llm_openai_function_1 = require("./llm-openai-function");
11
- Object.defineProperty(exports, "LlmExecutorOpenAiFunctions", { enumerable: true, get: function () { return llm_openai_function_1.LlmExecutorOpenAiFunctions; } });
12
- var _functions_1 = require("./_functions");
13
- Object.defineProperty(exports, "createCoreExecutor", { enumerable: true, get: function () { return _functions_1.createCoreExecutor; } });
14
- Object.defineProperty(exports, "createLlmExecutor", { enumerable: true, get: function () { return _functions_1.createLlmExecutor; } });
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["executor/index.ts"],"names":[],"mappings":";;;AAAA,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AACrB,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,6BAAoC;AAA3B,kGAAA,WAAW,OAAA;AACpB,6DAAmE;AAA1D,iIAAA,0BAA0B,OAAA;AACnC,2CAAqE;AAA5D,gHAAA,kBAAkB,OAAA;AAAE,+GAAA,iBAAiB,OAAA"}
@@ -1,13 +0,0 @@
1
- import { PromptInput, ParserOutput, CoreExecutorExecuteOptions, ExecutorWithLlmOptions, LlmExecutorHooks, OpenAiLlmExecutorOptions, OpenAiFunctionCall } from "../types";
2
- import { OpenAI } from "../llm";
3
- import { BasePrompt } from "../prompt";
4
- import { BaseState } from "../state";
5
- import { BaseParser } from "../parser";
6
- import { LlmExecutor } from "./llm";
7
- /**
8
- * Core Executor With LLM
9
- */
10
- export declare class LlmExecutorOpenAiFunctions<Llm extends OpenAI, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends LlmExecutor<Llm, Prompt, Parser, State> {
11
- constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
12
- execute<T extends OpenAiFunctionCall>(_input: PromptInput<Prompt>, _options: OpenAiLlmExecutorOptions<T>): Promise<ParserOutput<Parser>>;
13
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LlmExecutorOpenAiFunctions = void 0;
4
- const OpenAiFunctionParser_1 = require("../parser/parsers/OpenAiFunctionParser");
5
- const parser_1 = require("../parser");
6
- const llm_1 = require("./llm");
7
- /**
8
- * Core Executor With LLM
9
- */
10
- class LlmExecutorOpenAiFunctions extends llm_1.LlmExecutor {
11
- constructor(llmConfiguration, options) {
12
- super(Object.assign({}, llmConfiguration, {
13
- parser: new OpenAiFunctionParser_1.OpenAiFunctionParser({
14
- parser: llmConfiguration.parser || new parser_1.StringParser(),
15
- }),
16
- }), options);
17
- }
18
- async execute(_input, _options) {
19
- return super.execute(_input, _options);
20
- }
21
- }
22
- exports.LlmExecutorOpenAiFunctions = LlmExecutorOpenAiFunctions;
23
- //# sourceMappingURL=llm-openai-function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-openai-function.js","sourceRoot":"src/","sources":["executor/llm-openai-function.ts"],"names":[],"mappings":";;;AAYA,gFAA6E;AAC7E,qCAAoD;AACpD,+BAAoC;AAEpC;;GAEG;AACH,MAAa,0BAKX,SAAQ,iBAAuC;IAC/C,YACE,gBAAoE,EACpE,OAAsD;QAEtD,KAAK,CACH,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,gBAAgB,EAAE;YAClC,MAAM,EAAE,IAAI,2CAAoB,CAAC;gBAC/B,MAAM,EAAE,gBAAgB,CAAC,MAAM,IAAI,IAAI,qBAAY,EAAE;aACtD,CAAC;SACH,CAAC,EACF,OAAO,CACR,CAAC;IACJ,CAAC;IAKD,KAAK,CAAC,OAAO,CACX,MAA2B,EAC3B,QAAqC;QAErC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IACxC,CAAC;CACF;AA7BD,gEA6BC"}
@@ -1,32 +0,0 @@
1
- import { PromptInput, ParserOutput, CoreExecutorExecuteOptions, ExecutorWithLlmOptions, ExecutorExecutionMetadata, LlmExecutorHooks, LlmExecutorExecuteOptions } from "../types";
2
- import { BaseLlm } from "../llm";
3
- import { BaseParser, StringParser } from "../parser";
4
- import { BasePrompt } from "../prompt";
5
- import { BaseState } from "../state";
6
- import { BaseExecutor } from "./_base";
7
- /**
8
- * Core Executor With LLM
9
- */
10
- export declare class LlmExecutor<Llm extends BaseLlm<any>, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends BaseExecutor<PromptInput<Prompt>, ParserOutput<Parser>, LlmExecutorHooks> {
11
- llm: Llm;
12
- prompt: Prompt | undefined;
13
- promptFn: any;
14
- parser: StringParser | Parser;
15
- constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
16
- execute(_input: PromptInput<Prompt>, _options?: LlmExecutorExecuteOptions): Promise<ParserOutput<Parser>>;
17
- handler(_input: PromptInput<Prompt>, ..._args: any[]): Promise<any>;
18
- getHandlerInput(_input: PromptInput<Prompt>): any;
19
- getHandlerOutput(out: any, _metadata: ExecutorExecutionMetadata<PromptInput<Prompt>, ParserOutput<Parser>>): ParserOutput<Parser>;
20
- metadata(): {
21
- llm: {
22
- traceId: string | null;
23
- promptType: import("../types").PromptType;
24
- timeout: number;
25
- jitter: "none" | "full";
26
- maxDelay: number;
27
- numOfAttempts: number;
28
- metrics: any;
29
- };
30
- };
31
- getTraceId(): string | null;
32
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LlmExecutor = void 0;
4
- const parser_1 = require("../parser");
5
- const _base_1 = require("./_base");
6
- /**
7
- * Core Executor With LLM
8
- */
9
- class LlmExecutor extends _base_1.BaseExecutor {
10
- constructor(llmConfiguration, options) {
11
- super(llmConfiguration.name || "anonymous-llm-executor", "llm-executor", options);
12
- Object.defineProperty(this, "llm", {
13
- enumerable: true,
14
- configurable: true,
15
- writable: true,
16
- value: void 0
17
- });
18
- Object.defineProperty(this, "prompt", {
19
- enumerable: true,
20
- configurable: true,
21
- writable: true,
22
- value: void 0
23
- });
24
- Object.defineProperty(this, "promptFn", {
25
- enumerable: true,
26
- configurable: true,
27
- writable: true,
28
- value: void 0
29
- });
30
- Object.defineProperty(this, "parser", {
31
- enumerable: true,
32
- configurable: true,
33
- writable: true,
34
- value: void 0
35
- });
36
- this.llm = llmConfiguration.llm;
37
- this.parser = llmConfiguration?.parser || new parser_1.StringParser();
38
- if (typeof llmConfiguration.prompt === "function") {
39
- this.prompt = undefined;
40
- this.promptFn = llmConfiguration.prompt;
41
- }
42
- else {
43
- this.prompt = llmConfiguration.prompt;
44
- this.promptFn = null;
45
- }
46
- }
47
- async execute(_input, _options) {
48
- return super.execute(_input, _options);
49
- }
50
- async handler(_input, ..._args) {
51
- const call = await this.llm.call(_input, ..._args);
52
- const result = call.getResultContent();
53
- return result;
54
- }
55
- getHandlerInput(_input) {
56
- if (this.prompt) {
57
- return this.prompt.format(_input);
58
- }
59
- if (this.promptFn) {
60
- const prompt = this.promptFn(_input);
61
- const promptFormatted = prompt.format(_input);
62
- return promptFormatted;
63
- }
64
- throw new Error("Missing prompt");
65
- }
66
- getHandlerOutput(out, _metadata) {
67
- return this.parser.parse(out, _metadata);
68
- }
69
- metadata() {
70
- return {
71
- llm: this.llm.getMetadata(),
72
- };
73
- }
74
- getTraceId() {
75
- if (this.traceId) {
76
- return this.traceId;
77
- }
78
- return this.llm.getTraceId();
79
- }
80
- }
81
- exports.LlmExecutor = LlmExecutor;
82
- //# sourceMappingURL=llm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm.js","sourceRoot":"src/","sources":["executor/llm.ts"],"names":[],"mappings":";;;AAUA,qCAAoD;AAGpD,mCAAuC;AAEvC;;GAEG;AACH,MAAa,WAKX,SAAQ,oBAIT;IAMC,YACE,gBAAoE,EACpE,OAAsD;QAEtD,KAAK,CACH,gBAAgB,CAAC,IAAI,IAAI,wBAAwB,EACjD,cAAc,EACd,OAAO,CACR,CAAC;QAbJ;;;;;WAAW;QACX;;;;;WAAc;QACd;;;;;WAAqB;QACrB;;;;;WAAc;QAYZ,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,gBAAgB,EAAE,MAAM,IAAI,IAAI,qBAAY,EAAE,CAAC;QAE7D,IAAI,OAAO,gBAAgB,CAAC,MAAM,KAAK,UAAU,EAAE;YACjD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC;SACzC;aAAM;YACL,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC;YACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACtB;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAA2B,EAC3B,QAAoC;QAEpC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAA2B,EAAE,GAAG,KAAY;QACxD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,eAAe,CAAC,MAA2B;QACzC,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACnC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,eAAe,CAAC;SACxB;QACD,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAED,gBAAgB,CACd,GAAQ,EACR,SAGC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ;QACN,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE;SAC5B,CAAC;IACJ,CAAC;IACD,UAAU;QACR,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,IAAI,CAAC,OAAO,CAAC;SACrB;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;CACF;AApFD,kCAoFC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,iDAA0E;AAC1E,sDAA8E;AAC9E,4CAAgD;AAChD,+CAAiC;AACjC,+BAAyD;AACzD,+CAAqD;AACrD,qCAA+C;AAE/C,qCAMkB;AAElB,qCAKkB;AAElB,mCAMiB;AAEjB,wEAA4E;AAE/D,QAAA,MAAM,GAAG;IACpB;;OAEG;IACH,KAAK;IACL;;OAEG;IACH,OAAO,EAAP,aAAO;IACP,MAAM,EAAN,YAAM;IACN,eAAe,EAAf,qBAAe;IACf;;OAEG;IACH,UAAU,EAAV,mBAAU;IACV,UAAU,EAAV,mBAAU;IACV,UAAU,EAAV,mBAAU;IACV,YAAY,EAAZ,qBAAY;IACZ,gBAAgB,EAAhB,yBAAgB;IAChB;;OAEG;IACH,UAAU,EAAV,mBAAU;IACV,YAAY,EAAZ,qBAAY;IACZ,YAAY,EAAZ,qBAAY;IACZ,kBAAkB,EAAlB,2BAAkB;IAClB;;OAEG;IACH,YAAY,EAAZ,oBAAY;IACZ,kBAAkB,EAAlB,+BAAkB;IAClB,iBAAiB,EAAjB,8BAAiB;IACjB,0BAA0B,EAA1B,gDAA0B;IAC1B;;OAEG;IACH,YAAY,EAAZ,uBAAY;IACZ,sBAAsB,EAAtB,iCAAsB;IACtB;;OAEG;IACH,eAAe,EAAf,wBAAe;IACf,mBAAmB,EAAnB,4BAAmB;IACnB;;OAEG;IACH,YAAY,EAAZ,oBAAY;IACZ,aAAa,EAAb,qBAAa;IACb,gBAAgB,EAAhB,wBAAgB;IAChB,WAAW,EAAX,mBAAW;IACX,eAAe,EAAf,uBAAe;CAChB,CAAC"}
@@ -1,74 +0,0 @@
1
- export type IChatMessageRole = "system" | "assistant" | "user" | "function" | "function_call";
2
- export type FinishReasons = "function_call" | "stop";
3
- export interface IChatMessageBase {
4
- role: IChatMessageRole;
5
- content: string | null;
6
- }
7
- export interface IChatUserMessage extends IChatMessageBase {
8
- role: Extract<IChatMessageRole, "user">;
9
- content: string;
10
- name?: string;
11
- }
12
- export interface IChatFunctionMessage extends IChatMessageBase {
13
- role: Extract<IChatMessageRole, "function">;
14
- content: string;
15
- name: string;
16
- }
17
- export interface IChatAssistantMessage extends IChatMessageBase {
18
- role: Extract<IChatMessageRole, "assistant">;
19
- content: string;
20
- function_call?: undefined;
21
- }
22
- export interface IChatAssistantFunctionCallMessage extends IChatMessageBase {
23
- role: Extract<IChatMessageRole, "assistant">;
24
- content: null;
25
- function_call?: {
26
- name: string;
27
- arguments: string;
28
- };
29
- }
30
- export interface IChatSystemMessage extends IChatMessageBase {
31
- role: Extract<IChatMessageRole, "system">;
32
- content: string;
33
- }
34
- export interface IChatMessagesPlaceholder {
35
- role: "placeholder";
36
- content: string;
37
- }
38
- export type IPromptMessages = (IChatSystemMessage | IChatMessagesPlaceholder)[];
39
- export type IPromptChatMessages = (IChatUserMessage | IChatAssistantMessage | IChatAssistantFunctionCallMessage | IChatSystemMessage | IChatMessagesPlaceholder | IChatFunctionMessage)[];
40
- export type IChatMessage = IChatUserMessage | IChatAssistantMessage | IChatAssistantFunctionCallMessage | IChatSystemMessage | IChatFunctionMessage;
41
- export type IChatMessages = IChatMessage[];
42
- export type PromptTemplateHistoryToken = `{{>DialogueHistory key='${string}'}}`;
43
- interface OutputOpenAIChatChoiceBase {
44
- message: {
45
- role: Extract<IChatMessageRole, "assistant">;
46
- content: string | null;
47
- function_call: null | {
48
- name: string;
49
- arguments: string;
50
- };
51
- };
52
- finish_reason: FinishReasons;
53
- }
54
- export interface OutputOpenAIChatChoiceFunction extends OutputOpenAIChatChoiceBase {
55
- message: {
56
- role: Extract<IChatMessageRole, "assistant">;
57
- content: null;
58
- function_call: {
59
- name: string;
60
- arguments: string;
61
- };
62
- };
63
- finish_reason: Extract<FinishReasons, "function_call">;
64
- }
65
- export interface OutputOpenAIChatChoiceMessage extends OutputOpenAIChatChoiceBase {
66
- message: {
67
- role: Extract<IChatMessageRole, "assistant">;
68
- content: string;
69
- function_call: null;
70
- };
71
- finish_reason: Exclude<FinishReasons, "function_call">;
72
- }
73
- export type OutputOpenAIChatChoice = OutputOpenAIChatChoiceFunction | OutputOpenAIChatChoiceMessage;
74
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=chat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"src/","sources":["interfaces/chat.ts"],"names":[],"mappings":""}
@@ -1,67 +0,0 @@
1
- import { BaseParser } from "../parser";
2
- import { BasePrompt } from "../prompt";
3
- import { PlainObject } from "./utils";
4
- import { BaseExecutor } from "../executor";
5
- import { hookOnComplete, hookOnError, hookOnSuccess } from "../utils/const";
6
- export type ListenerFunction = (...args: any[]) => void;
7
- export type ParserOutput<P> = P extends BaseParser<infer T> ? T : never;
8
- export type PromptInput<P> = P extends BasePrompt<infer T> ? T : never;
9
- export interface ExecutorWithLlmOptions<Llm, Prompt, Parser, State> {
10
- name?: string;
11
- llm: Llm;
12
- prompt: Prompt | ((values: PromptInput<Prompt>) => Prompt);
13
- parser?: Parser;
14
- state?: State;
15
- __mock_response_key__?: string;
16
- }
17
- export interface CoreExecutorInput<I, O> {
18
- name?: string;
19
- handler: (input: I) => Promise<O> | O;
20
- getHandlerInput?(input: I): any;
21
- getHandlerOutput?(out: any): O;
22
- }
23
- export type FunctionOrExecutor<I extends PlainObject | {
24
- input: string;
25
- }, O> = ((input: I) => Promise<O> | O) | BaseExecutor<I, O>;
26
- export interface ExecutorMetadata {
27
- id: string;
28
- type: string;
29
- name: string;
30
- created: number;
31
- executions: number;
32
- metadata?: Record<string, any>;
33
- }
34
- export interface ExecutorExecutionMetadata<I = any, O = any> {
35
- start: null | number;
36
- end: null | number;
37
- input: I;
38
- handlerInput?: any;
39
- handlerOutput?: any;
40
- output?: O;
41
- errorMessage?: string;
42
- error?: Error;
43
- metadata?: null | ExecutorMetadata;
44
- }
45
- export type ExecutorExecutionMetadataProperties = Pick<ExecutorExecutionMetadata, "start" | "end" | "input" | "handlerInput" | "handlerOutput" | "output" | "errorMessage" | "error" | "metadata">;
46
- export interface ExecutorContext<I = any, O = any, A = Record<string, any>> extends ExecutorExecutionMetadata<I, O> {
47
- metadata: ExecutorMetadata;
48
- attributes: A;
49
- }
50
- export interface BaseExecutorHooks {
51
- [hookOnError]: ListenerFunction[];
52
- [hookOnSuccess]: ListenerFunction[];
53
- [hookOnComplete]: ListenerFunction[];
54
- }
55
- export interface LlmExecutorHooks extends BaseExecutorHooks {
56
- }
57
- export type CoreExecutorHookInput<H = BaseExecutorHooks> = {
58
- [key in keyof H]?: ListenerFunction | ListenerFunction[];
59
- };
60
- export interface CoreExecutorExecuteOptions<T = BaseExecutorHooks> {
61
- hooks?: CoreExecutorHookInput<T>;
62
- }
63
- export interface CallableExecutorCore {
64
- name: string;
65
- description: string;
66
- parameters?: Record<string, any>;
67
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const const_1 = require("../utils/const");
4
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"src/","sources":["interfaces/functions.ts"],"names":[],"mappings":";;AAIA,yCAA2E"}
@@ -1,7 +0,0 @@
1
- export { FromSchema, JSONSchema } from 'json-schema-to-ts';
2
- export * from "./utils";
3
- export * from "./chat";
4
- export * from "./openai";
5
- export * from "./functions";
6
- export * from "./prompt";
7
- export * from "./parser";
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./utils"), exports);
18
- __exportStar(require("./chat"), exports);
19
- __exportStar(require("./openai"), exports);
20
- __exportStar(require("./functions"), exports);
21
- __exportStar(require("./prompt"), exports);
22
- __exportStar(require("./parser"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,2CAAyB"}
@@ -1,46 +0,0 @@
1
- import { CallableExecutorCore } from "./index";
2
- import { PromptType } from "./prompt";
3
- export interface BaseLlmOptions {
4
- traceId?: null | string;
5
- timeout?: number;
6
- maxDelay?: number;
7
- numOfAttempts?: number;
8
- jitter?: "none" | "full";
9
- promptType?: PromptType;
10
- }
11
- export type OpenAIChatModelName = "gpt-3.5-turbo" | "gpt-3.5-turbo-0613" | "gpt-3.5-turbo-16k" | "gpt-4-0613" | "gpt-4" | "gpt-4-0613" | "gpt-4-32k-0613";
12
- export type OpenAIConversationModelName = "davinci" | "text-curie-001" | "text-babbage-001" | "text-ada-001";
13
- export type OpenAIEmbeddingModelName = "text-embedding-ada-002";
14
- export type OpenAIModelName = OpenAIChatModelName | OpenAIConversationModelName | OpenAIEmbeddingModelName;
15
- export interface OpenAIOptions extends BaseLlmOptions {
16
- openAIApiKey?: string;
17
- modelName: OpenAIModelName;
18
- maxTokens?: number;
19
- temperature?: number;
20
- topP?: number | null;
21
- n?: number | null;
22
- stream?: boolean | null;
23
- stop?: any;
24
- max_tokens?: number;
25
- presencePenalty?: number | null;
26
- frequencyPenalty?: number | null;
27
- logitBias?: object | null;
28
- user?: string;
29
- function_call?: OpenAiFunctionCall;
30
- functions?: CallableExecutorCore[];
31
- }
32
- export interface EmbedOpenAIOptions extends OpenAIOptions {
33
- openAIApiKey: string;
34
- modelName: OpenAIModelName;
35
- batchSize?: number;
36
- stripNewLines?: boolean;
37
- }
38
- export type OpenAiFunctionCall = "auto" | "none" | {
39
- name: string;
40
- };
41
- export interface LlmExecutorExecuteOptions {
42
- }
43
- export interface OpenAiLlmExecutorOptions<T extends OpenAiFunctionCall = "auto"> extends LlmExecutorExecuteOptions {
44
- functions: CallableExecutorCore[];
45
- function_call: T;
46
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=openai.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openai.js","sourceRoot":"src/","sources":["interfaces/openai.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { JSONSchema7 } from "json-schema-to-ts";
2
- export type CreateParserType = "json" | "string" | "boolean" | "number" | "stringExtract" | "listToArray" | "listToJson" | "listToKeyValue" | "replaceStringTemplate" | "markdownCodeBlocks" | "markdownCodeBlock";
3
- export interface BaseParserOptions {
4
- }
5
- export interface BaseParserOptionsWithSchema<S extends JSONSchema7 | undefined = undefined> extends BaseParserOptions {
6
- schema?: S;
7
- validateSchema?: boolean;
8
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=parser.js.map