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,164 +0,0 @@
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
- Object.defineProperty(this, "filters", {
39
- enumerable: true,
40
- configurable: true,
41
- writable: true,
42
- value: {
43
- pre: [],
44
- post: [],
45
- }
46
- });
47
- if (initialPromptMessage) {
48
- this.addToPrompt(initialPromptMessage, "system");
49
- }
50
- if (options) {
51
- if (options.partials) {
52
- this.registerPartial(options.partials);
53
- }
54
- if (options.helpers) {
55
- this.registerHelpers(options.helpers);
56
- }
57
- if (options.preFilters && Array.isArray(options.preFilters)) {
58
- this.filters.pre.push(...options.preFilters);
59
- }
60
- if (options.postFilters && Array.isArray(options.postFilters)) {
61
- this.filters.post.push(...options.postFilters);
62
- }
63
- }
64
- }
65
- /**
66
- * addToPrompt description
67
- * @param content The message content
68
- * @param role The role of the user. Defaults to system for base text prompt.
69
- * @return instance of BasePrompt.
70
- */
71
- addToPrompt(content, role = "system") {
72
- if (content) {
73
- switch (role) {
74
- case "system":
75
- default:
76
- this.addSystemMessage(content);
77
- break;
78
- }
79
- }
80
- return this;
81
- }
82
- /**
83
- * addSystemMessage description
84
- * @param content The message content
85
- * @return returns BasePrompt so it can be chained.
86
- */
87
- addSystemMessage(content) {
88
- this.messages.push({
89
- role: "system",
90
- content,
91
- });
92
- return this;
93
- }
94
- /**
95
- * registerPartial description
96
- * @param partialOrPartials Additional partials that can be made available to the template parser.
97
- * @return BasePrompt so it can be chained.
98
- */
99
- registerPartial(partialOrPartials) {
100
- const partials = Array.isArray(partialOrPartials)
101
- ? partialOrPartials
102
- : [partialOrPartials];
103
- this.partials.push(...partials);
104
- return this;
105
- }
106
- /**
107
- * registerHelpers description
108
- * @param helperOrHelpers Additional helper functions that can be made available to the template parser.
109
- * @return BasePrompt so it can be chained.
110
- */
111
- registerHelpers(helperOrHelpers) {
112
- const helpers = Array.isArray(helperOrHelpers)
113
- ? helperOrHelpers
114
- : [helperOrHelpers];
115
- this.helpers.push(...helpers);
116
- return this;
117
- }
118
- /**
119
- * format description
120
- * @param values The message content
121
- * @param separator The separator between messages. defaults to "\n\n"
122
- * @return returns messages formatted with template replacement
123
- */
124
- format(values, separator = "\n\n") {
125
- const replacements = this.getReplacements(values);
126
- /* istanbul ignore next */
127
- const messages = this.messages
128
- .map((message) => {
129
- return message.content
130
- ? (0, utils_1.replaceTemplateString)(this.runPromptFilter(message.content, this.filters.pre, values), replacements, {
131
- partials: this.partials,
132
- helpers: this.helpers,
133
- })
134
- : "";
135
- })
136
- .join(separator);
137
- return this.runPromptFilter(messages, this.filters.post, values);
138
- }
139
- runPromptFilter(prompt, filters, values) {
140
- let promptValue = prompt;
141
- for (const filter of filters) {
142
- promptValue = filter(promptValue, values);
143
- }
144
- return promptValue;
145
- }
146
- getReplacements(values) {
147
- const { input = "", ...restOfValues } = values;
148
- const replacements = Object.assign({}, { ...restOfValues }, {
149
- input: input,
150
- _input: input,
151
- });
152
- return replacements;
153
- }
154
- /**
155
- * validate description
156
- * @return {boolean} Returns false if the template is not valid.
157
- */
158
- validate() {
159
- // add validation for missing tokens, etc
160
- return true;
161
- }
162
- }
163
- exports.BasePrompt = BasePrompt;
164
- //# sourceMappingURL=_base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_base.js","sourceRoot":"src/","sources":["prompt/_base.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAWhD;;GAEG;AACH,MAAsB,UAAU;IAgB9B;;;OAGG;IACH,YAAY,oBAA6B,EAAE,OAAuB;QAnBlE;;;;mBAA4B,MAAM;WAAC;QAEnC;;;;mBAAyD,EAAE;WAAC;QAE5D;;;;mBAAmC,EAAE;WAAC;QACtC;;;;mBAAiC,EAAE;WAAC;QAEpC;;;;mBAGI;gBACA,GAAG,EAAE,EAAE;gBACP,IAAI,EAAE,EAAE;aACT;WAAC;QAOF,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;SAClD;QAED,IAAI,OAAO,EAAE;YACX,IAAI,OAAO,CAAC,QAAQ,EAAE;gBACpB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;aACxC;YACD,IAAI,OAAO,CAAC,OAAO,EAAE;gBACnB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aACvC;YACD,IAAI,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBAC3D,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,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,yCAAyC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9JD,gCA8JC"}
@@ -1,19 +0,0 @@
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>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createChatPrompt = exports.createPrompt = void 0;
4
- const text_1 = require("./text");
5
- const chat_1 = require("./chat");
6
- function createPrompt(type, initialPromptMessage, options) {
7
- switch (type) {
8
- case "chat":
9
- return new chat_1.ChatPrompt(initialPromptMessage, options);
10
- default:
11
- return new text_1.TextPrompt(initialPromptMessage);
12
- }
13
- }
14
- exports.createPrompt = createPrompt;
15
- /**
16
- * `createChatPrompt` Creates a new instance of a chat prompt.
17
- *
18
- * @param initialSystemPromptMessage (optional) A message to use for an initial system message.
19
- */
20
- function createChatPrompt(initialSystemPromptMessage, options) {
21
- return new chat_1.ChatPrompt(initialSystemPromptMessage, options);
22
- }
23
- exports.createChatPrompt = createChatPrompt;
24
- //# sourceMappingURL=_functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_functions.js","sourceRoot":"src/","sources":["prompt/_functions.ts"],"names":[],"mappings":";;;AAEA,iCAAoC;AACpC,iCAAoC;AAwBpC,SAAgB,YAAY,CAC1B,IAAiB,EACjB,oBAA6B,EAC7B,OAA2C;IAE3C,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,OAAO,IAAI,iBAAU,CAAI,oBAAoB,EAAE,OAAO,CAAC,CAAC;QAC1D;YACE,OAAO,IAAI,iBAAU,CAAI,oBAAoB,CAAC,CAAC;KAClD;AACH,CAAC;AAXD,oCAWC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,0BAAmC,EACnC,OAA2B;IAE3B,OAAO,IAAI,iBAAU,CAAI,0BAA0B,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AALD,4CAKC"}
@@ -1,103 +0,0 @@
1
- import { BasePrompt } from "./_base";
2
- import { IChatMessages, IChatMessageRole, ChatPromptType, ChatPromptOptions, IPromptChatMessages } from "../types";
3
- export interface ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
4
- messages: IPromptChatMessages;
5
- }
6
- /**
7
- * `ChatPrompt` provides a conversation-style prompt enabling various roles.
8
- * The chat prompt can be used with models such as gpt-3.5.turbo and gpt-4.
9
- * @extends BasePrompt
10
- */
11
- export declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
12
- /**
13
- * @property type - Prompt type (chat)
14
- */
15
- readonly type: ChatPromptType;
16
- /**
17
- * @property parseUserTemplates - Whether or not to allow parsing
18
- * user messages with the template engine. This could be a risk,
19
- * so we only parse user messages if explicitly set.
20
- */
21
- private parseUserTemplates;
22
- /**
23
- * new `ChatPrompt`
24
- * @param initialSystemPromptMessage (optional) An initial system message to add to the new prompt.
25
- * @param options (optional) Options to pass in when creating the prompt.
26
- */
27
- constructor(initialSystemPromptMessage?: string, options?: ChatPromptOptions);
28
- /**
29
- * addToPrompt Adds a message to the prompt based on role.
30
- * @param content The message content.
31
- * @param role The role of the chat user. Must be one of: assistant, system, user.
32
- * @param name (optional) The name of the user. Only accepted if role is `user`.
33
- * @return instance of ChatPrompt.
34
- */
35
- addToPrompt(content: string, role: Extract<IChatMessageRole, "assistant">, name?: undefined): ChatPrompt<I>;
36
- addToPrompt(content: string, role: Extract<IChatMessageRole, "system">, name?: undefined): ChatPrompt<I>;
37
- addToPrompt(content: string, role: Extract<IChatMessageRole, "user">, name?: string): ChatPrompt<I>;
38
- addToPrompt(content: string, role: Extract<IChatMessageRole, "function">, name: string): ChatPrompt<I>;
39
- addToPrompt(content: string, role: Extract<IChatMessageRole, "function_call">, name: string): ChatPrompt<I>;
40
- /**
41
- * addUserMessage Helper to add a user message to the prompt.
42
- * @param content The message content.
43
- * @param name (optional) The name of the user.
44
- * @return instance of ChatPrompt.
45
- */
46
- addUserMessage(content: string, name?: string): ChatPrompt<I>;
47
- /**
48
- * addAssistantMessage Helper to add an assistant message to the prompt.
49
- * @param content The message content.
50
- * @return ChatPrompt so it can be chained.
51
- */
52
- addAssistantMessage(content: string): ChatPrompt<I>;
53
- /**
54
- * addFunctionMessage Helper to add an assistant message to the prompt.
55
- * @param content The message content.
56
- * @return ChatPrompt so it can be chained.
57
- */
58
- addFunctionMessage(content: string, name: string): ChatPrompt<I>;
59
- /**
60
- * addFunctionCallMessage Helper to add an assistant message to the prompt.
61
- * @param content The message content.
62
- * @return ChatPrompt so it can be chained.
63
- */
64
- addFunctionCallMessage(function_call?: {
65
- name: string;
66
- arguments: string;
67
- }): this;
68
- /**
69
- * addFromHistory Adds multiple messages at one time.
70
- * @param history History of chat messages.
71
- * @return ChatPrompt so it can be chained.
72
- */
73
- addFromHistory(history: IChatMessages): ChatPrompt<I>;
74
- /**
75
- * addPlaceholder description
76
- * @param content The message content
77
- * @return returns ChatPrompt so it can be chained.
78
- */
79
- addChatHistoryPlaceholder(key: keyof I, options?: {
80
- assistant?: string;
81
- user?: string;
82
- }): ChatPrompt<I>;
83
- /**
84
- * addTokenPlaceholder description
85
- * @param content The message content
86
- * @return returns ChatPrompt so it can be chained.
87
- */
88
- addMessagePlaceholder(content: string, role?: IChatMessageRole, name?: string): this;
89
- /**
90
- * format formats the stored prompt based on input values.
91
- * Uses template engine.
92
- * Output is intended for LLM.
93
- * @param values input values.
94
- * @return formatted prompt.
95
- */
96
- format(values: I): IChatMessages;
97
- /**
98
- * validate Ensures there are not unresolved tokens in prompt.
99
- * @TODO Make this work!
100
- * @return Returns false if the template is not valid.
101
- */
102
- validate(): boolean;
103
- }
@@ -1,328 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChatPrompt = void 0;
4
- const utils_1 = require("../utils");
5
- const _base_1 = require("./_base");
6
- /**
7
- * `ChatPrompt` provides a conversation-style prompt enabling various roles.
8
- * The chat prompt can be used with models such as gpt-3.5.turbo and gpt-4.
9
- * @extends BasePrompt
10
- */
11
- class ChatPrompt extends _base_1.BasePrompt {
12
- /**
13
- * new `ChatPrompt`
14
- * @param initialSystemPromptMessage (optional) An initial system message to add to the new prompt.
15
- * @param options (optional) Options to pass in when creating the prompt.
16
- */
17
- constructor(initialSystemPromptMessage, options) {
18
- super(initialSystemPromptMessage, options);
19
- /**
20
- * @property type - Prompt type (chat)
21
- */
22
- Object.defineProperty(this, "type", {
23
- enumerable: true,
24
- configurable: true,
25
- writable: true,
26
- value: "chat"
27
- });
28
- /**
29
- * @property parseUserTemplates - Whether or not to allow parsing
30
- * user messages with the template engine. This could be a risk,
31
- * so we only parse user messages if explicitly set.
32
- */
33
- Object.defineProperty(this, "parseUserTemplates", {
34
- enumerable: true,
35
- configurable: true,
36
- writable: true,
37
- value: false
38
- });
39
- if (options?.allowUnsafeUserTemplate) {
40
- this.parseUserTemplates = true;
41
- }
42
- }
43
- addToPrompt(content, role, name) {
44
- if (content) {
45
- switch (role) {
46
- case "system":
47
- this.addSystemMessage(content);
48
- break;
49
- case "user":
50
- this.addUserMessage(content, name);
51
- break;
52
- case "assistant":
53
- this.addAssistantMessage(content);
54
- break;
55
- case "function":
56
- (0, utils_1.assert)(name, "Function message requires name");
57
- this.addFunctionMessage(content, name);
58
- break;
59
- case "function_call":
60
- (0, utils_1.assert)(name, "Function message requires name");
61
- this.addFunctionCallMessage({ name: name, arguments: content });
62
- break;
63
- }
64
- }
65
- return this;
66
- }
67
- /**
68
- * addUserMessage Helper to add a user message to the prompt.
69
- * @param content The message content.
70
- * @param name (optional) The name of the user.
71
- * @return instance of ChatPrompt.
72
- */
73
- addUserMessage(content, name) {
74
- const message = {
75
- role: "user",
76
- content,
77
- };
78
- if (name) {
79
- message.name = name;
80
- }
81
- this.messages.push(message);
82
- return this;
83
- }
84
- /**
85
- * addAssistantMessage Helper to add an assistant message to the prompt.
86
- * @param content The message content.
87
- * @return ChatPrompt so it can be chained.
88
- */
89
- addAssistantMessage(content) {
90
- this.messages.push({
91
- role: "assistant",
92
- content,
93
- });
94
- return this;
95
- }
96
- /**
97
- * addFunctionMessage Helper to add an assistant message to the prompt.
98
- * @param content The message content.
99
- * @return ChatPrompt so it can be chained.
100
- */
101
- addFunctionMessage(content, name) {
102
- this.messages.push({
103
- role: "function",
104
- name,
105
- content,
106
- });
107
- return this;
108
- }
109
- /**
110
- * addFunctionCallMessage Helper to add an assistant message to the prompt.
111
- * @param content The message content.
112
- * @return ChatPrompt so it can be chained.
113
- */
114
- addFunctionCallMessage(function_call) {
115
- if (function_call) {
116
- this.messages.push({
117
- role: "assistant",
118
- function_call: {
119
- name: function_call.name,
120
- arguments: (0, utils_1.maybeStringifyJSON)(function_call.arguments),
121
- },
122
- content: null,
123
- });
124
- }
125
- return this;
126
- }
127
- /**
128
- * addFromHistory Adds multiple messages at one time.
129
- * @param history History of chat messages.
130
- * @return ChatPrompt so it can be chained.
131
- */
132
- addFromHistory(history) {
133
- if (history && Array.isArray(history)) {
134
- for (const message of history) {
135
- switch (message.role) {
136
- case "user":
137
- this.addUserMessage(message.content, message?.name);
138
- break;
139
- case "assistant":
140
- if (message.function_call) {
141
- this.addFunctionCallMessage(message.function_call);
142
- }
143
- else if (message?.content) {
144
- this.addAssistantMessage(message?.content);
145
- }
146
- break;
147
- case "system":
148
- this.addSystemMessage(message.content);
149
- break;
150
- case "function":
151
- this.addFunctionMessage(message.content, message.name);
152
- break;
153
- }
154
- }
155
- }
156
- return this;
157
- }
158
- /**
159
- * addPlaceholder description
160
- * @param content The message content
161
- * @return returns ChatPrompt so it can be chained.
162
- */
163
- addChatHistoryPlaceholder(key, options) {
164
- const start = `{{> DialogueHistory `;
165
- const params = [`key='${String(key)}'`];
166
- const end = `}}`;
167
- if (options?.assistant) {
168
- params.push(`assistant='${options.assistant}'`);
169
- }
170
- if (options?.user) {
171
- params.push(`user='${options.user}'`);
172
- }
173
- this.messages.push({
174
- role: "placeholder",
175
- content: `${start}${params.join(" ")}${end}`,
176
- });
177
- return this;
178
- }
179
- /**
180
- * addTokenPlaceholder description
181
- * @param content The message content
182
- * @return returns ChatPrompt so it can be chained.
183
- */
184
- addMessagePlaceholder(content, role = "user", name) {
185
- if (content) {
186
- const start = `{{> SingleChatMessage `;
187
- const params = [`role='${role}'`, `content='${(0, utils_1.escape)(content)}'`];
188
- const end = `}}`;
189
- if (name) {
190
- params.push(`name='${name}'`);
191
- }
192
- this.messages.push({
193
- role: "placeholder",
194
- content: `${start}${params.join(" ")}${end}`,
195
- });
196
- }
197
- return this;
198
- }
199
- /**
200
- * format formats the stored prompt based on input values.
201
- * Uses template engine.
202
- * Output is intended for LLM.
203
- * @param values input values.
204
- * @return formatted prompt.
205
- */
206
- format(values) {
207
- const messagesOut = [];
208
- const replacements = this.getReplacements(values);
209
- const safeToParseTemplate = ["assistant", "system"];
210
- if (this.parseUserTemplates) {
211
- safeToParseTemplate.push("user");
212
- }
213
- for (const message of this.messages) {
214
- if (message.role === "placeholder") {
215
- const { token, ...data } = (0, utils_1.extractPromptPlaceholderToken)(message.content);
216
- switch (token) {
217
- case ">DialogueHistory": {
218
- /* istanbul ignore next */
219
- const { key = "", user } = data;
220
- const history = (0, utils_1.get)(replacements, key, []);
221
- if (history && Array.isArray(history)) {
222
- for (const message of history) {
223
- switch (message.role) {
224
- case "user": {
225
- const m = (0, utils_1.pick)(message, ["role", "content", "name"]);
226
- if (user) {
227
- m["name"] = user;
228
- }
229
- messagesOut.push(m);
230
- break;
231
- }
232
- case "assistant": {
233
- if (message.function_call) {
234
- messagesOut.push({
235
- role: "assistant",
236
- content: null,
237
- function_call: message.function_call,
238
- });
239
- }
240
- else if (message?.content) {
241
- messagesOut.push({
242
- role: "assistant",
243
- content: message.content,
244
- });
245
- }
246
- break;
247
- }
248
- case "function":
249
- messagesOut.push({
250
- role: "function",
251
- name: message.name,
252
- content: message.content,
253
- });
254
- break;
255
- case "system":
256
- messagesOut.push({
257
- role: "system",
258
- content: message.content,
259
- });
260
- break;
261
- }
262
- }
263
- }
264
- break;
265
- }
266
- case ">SingleChatMessage": {
267
- const { name, content, role } = data;
268
- if (role && content) {
269
- const message = {
270
- role,
271
- name,
272
- content: (0, utils_1.replaceTemplateString)(content, replacements, {
273
- partials: this.partials,
274
- helpers: this.helpers,
275
- }),
276
- };
277
- if (!name || role !== "user") {
278
- delete message.name;
279
- }
280
- messagesOut.push(message);
281
- }
282
- break;
283
- }
284
- }
285
- }
286
- else if (message.role === "function") {
287
- messagesOut.push(Object.assign({}, message, {
288
- content: (0, utils_1.replaceTemplateString)(message.content, replacements, {
289
- partials: this.partials,
290
- helpers: this.helpers,
291
- }),
292
- }));
293
- }
294
- else {
295
- if (safeToParseTemplate.includes(message.role)) {
296
- messagesOut.push(Object.assign({}, message, {
297
- content: message.content
298
- ? this.runPromptFilter((0, utils_1.replaceTemplateString)(this.runPromptFilter(message.content, this.filters.pre, values), replacements, {
299
- partials: this.partials,
300
- helpers: this.helpers,
301
- }), this.filters.post, values)
302
- : null,
303
- }));
304
- }
305
- else {
306
- /* istanbul ignore next */
307
- messagesOut.push(Object.assign({}, message, {
308
- content: message.content
309
- ? this.runPromptFilter(this.runPromptFilter(message.content, this.filters.pre, values), this.filters.post, values)
310
- : null,
311
- }));
312
- }
313
- }
314
- }
315
- return messagesOut;
316
- }
317
- /**
318
- * validate Ensures there are not unresolved tokens in prompt.
319
- * @TODO Make this work!
320
- * @return Returns false if the template is not valid.
321
- */
322
- validate() {
323
- // add validation for missing tokens, etc.
324
- return true;
325
- }
326
- }
327
- exports.ChatPrompt = ChatPrompt;
328
- //# sourceMappingURL=chat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"src/","sources":["prompt/chat.ts"],"names":[],"mappings":";;;AAAA,mCAQiB;AACjB,mCAAqC;AAgBrC;;;;GAIG;AACH,MAAa,UAA0C,SAAQ,kBAAa;IAa1E;;;;OAIG;IACH,YACE,0BAAmC,EACnC,OAA2B;QAE3B,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;QArB7C;;WAEG;QACH;;;;mBAAgC,MAAM;WAAC;QAEvC;;;;WAIG;QACH;;;;mBAA6B,KAAK;WAAC;QAYjC,IAAI,OAAO,EAAE,uBAAuB,EAAE;YACpC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;SAChC;IACH,CAAC;IAkCD,WAAW,CACT,OAAe,EACf,IAAsB,EACtB,IAAa;QAEb,IAAI,OAAO,EAAE;YACX,QAAQ,IAAI,EAAE;gBACZ,KAAK,QAAQ;oBACX,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;oBAC/B,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBACnC,MAAM;gBACR,KAAK,WAAW;oBACd,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;oBAClC,MAAM;gBACR,KAAK,UAAU;oBACb,IAAA,cAAM,EAAC,IA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AAC,CACH,CAAC;aACH;iBAAM;gBACL,IAAI,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBAC9C,WAAW,CAAC,IAAI,CACd,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;wBACzB,OAAO,EAAE,OAAO,CAAC,OAAO;4BACtB,CAAC,CAAC,IAAI,CAAC,eAAe,CAClB,IAAA,6BAAqB,EACnB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,EAC/D,YAAY,EACZ;gCACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;gCACvB,OAAO,EAAE,IAAI,CAAC,OAAO;6BACtB,CACF,EACD,IAAI,CAAC,OAAO,CAAC,IAAI,EACjB,MAAM,CACP;4BACH,CAAC,CAAC,IAAI;qBACT,CAAC,CACH,CAAC;iBACH;qBAAM;oBACL,0BAA0B;oBAC1B,WAAW,CAAC,IAAI,CACd,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;wBACzB,OAAO,EAAE,OAAO,CAAC,OAAO;4BACtB,CAAC,CAAC,IAAI,CAAC,eAAe,CAClB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,EAC/D,IAAI,CAAC,OAAO,CAAC,IAAI,EACjB,MAAM,CACP;4BACH,CAAC,CAAC,IAAI;qBACT,CAAC,CACH,CAAC;iBACH;aACF;SACF;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,0CAA0C;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/XD,gCA+XC"}
@@ -1,4 +0,0 @@
1
- export { BasePrompt } from "./_base";
2
- export { TextPrompt } from "./text";
3
- export { ChatPrompt } from "./chat";
4
- export { createPrompt, createChatPrompt } from "./_functions";