@promptbook/node 0.75.0-0 → 0.75.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.
- package/esm/index.es.js +125 -35
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +4 -0
- package/esm/typings/src/formfactors/index.d.ts +26 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +2 -2
- package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +9 -0
- package/esm/typings/src/utils/expectation-counters/{config.d.ts → constants.d.ts} +3 -0
- package/package.json +2 -2
- package/umd/index.umd.js +125 -35
- package/umd/index.umd.js.map +1 -1
|
@@ -59,9 +59,12 @@ import { CsvFormatDefinition } from '../formats/csv/CsvFormatDefinition';
|
|
|
59
59
|
import { CsvFormatError } from '../formats/csv/CsvFormatError';
|
|
60
60
|
import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings';
|
|
61
61
|
import { TextFormatDefinition } from '../formats/text/TextFormatDefinition';
|
|
62
|
+
import { BoilerplateFormfactorDefinition } from '../formfactors/_boilerplate/BoilerplateFormfactorDefinition';
|
|
62
63
|
import { ChatFormfactorDefinition } from '../formfactors/chat/ChatFormfactorDefinition';
|
|
63
64
|
import { GenericFormfactorDefinition } from '../formfactors/generic/GenericFormfactorDefinition';
|
|
64
65
|
import { FORMFACTOR_DEFINITIONS } from '../formfactors/index';
|
|
66
|
+
import { SheetsFormfactorDefinition } from '../formfactors/sheets/SheetsFormfactorDefinition';
|
|
67
|
+
import { TranslatorFormfactorDefinition } from '../formfactors/translator/TranslatorFormfactorDefinition';
|
|
65
68
|
import { $llmToolsMetadataRegister } from '../llm-providers/_common/register/$llmToolsMetadataRegister';
|
|
66
69
|
import { $llmToolsRegister } from '../llm-providers/_common/register/$llmToolsRegister';
|
|
67
70
|
import { createLlmToolsFromConfiguration } from '../llm-providers/_common/register/createLlmToolsFromConfiguration';
|
|
@@ -75,6 +78,7 @@ import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlm
|
|
|
75
78
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
76
79
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
77
80
|
import { preparePersona } from '../personas/preparePersona';
|
|
81
|
+
import { GENERIC_PIPELINE_INTERFACE } from '../pipeline/pipeline-interface/constants';
|
|
78
82
|
import { getPipelineInterface } from '../pipeline/pipeline-interface/getPipelineInterface';
|
|
79
83
|
import { isPipelineImplementingInterface } from '../pipeline/pipeline-interface/isPipelineImplementingInterface';
|
|
80
84
|
import { isPipelineInterfacesEqual } from '../pipeline/pipeline-interface/isPipelineInterfacesEqual';
|
|
@@ -160,9 +164,12 @@ export { CsvFormatDefinition };
|
|
|
160
164
|
export { CsvFormatError };
|
|
161
165
|
export { MANDATORY_CSV_SETTINGS };
|
|
162
166
|
export { TextFormatDefinition };
|
|
167
|
+
export { BoilerplateFormfactorDefinition };
|
|
163
168
|
export { ChatFormfactorDefinition };
|
|
164
169
|
export { GenericFormfactorDefinition };
|
|
165
170
|
export { FORMFACTOR_DEFINITIONS };
|
|
171
|
+
export { SheetsFormfactorDefinition };
|
|
172
|
+
export { TranslatorFormfactorDefinition };
|
|
166
173
|
export { $llmToolsMetadataRegister };
|
|
167
174
|
export { $llmToolsRegister };
|
|
168
175
|
export { createLlmToolsFromConfiguration };
|
|
@@ -176,6 +183,7 @@ export { MultipleLlmExecutionTools };
|
|
|
176
183
|
export { _OpenAiMetadataRegistration };
|
|
177
184
|
export { _OpenAiAssistantMetadataRegistration };
|
|
178
185
|
export { preparePersona };
|
|
186
|
+
export { GENERIC_PIPELINE_INTERFACE };
|
|
179
187
|
export { getPipelineInterface };
|
|
180
188
|
export { isPipelineImplementingInterface };
|
|
181
189
|
export { isPipelineInterfacesEqual };
|
|
@@ -12,8 +12,8 @@ import { $currentDate } from '../utils/$currentDate';
|
|
|
12
12
|
import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
|
|
13
13
|
import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
|
|
14
14
|
import { $isRunningInWebWorker } from '../utils/environment/$isRunningInWebWorker';
|
|
15
|
-
import { CHARACTERS_PER_STANDARD_LINE } from '../utils/expectation-counters/
|
|
16
|
-
import { LINES_PER_STANDARD_PAGE } from '../utils/expectation-counters/
|
|
15
|
+
import { CHARACTERS_PER_STANDARD_LINE } from '../utils/expectation-counters/constants';
|
|
16
|
+
import { LINES_PER_STANDARD_PAGE } from '../utils/expectation-counters/constants';
|
|
17
17
|
import { countCharacters } from '../utils/expectation-counters/countCharacters';
|
|
18
18
|
import { countLines } from '../utils/expectation-counters/countLines';
|
|
19
19
|
import { countPages } from '../utils/expectation-counters/countPages';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boilerplate is form of app that @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const BoilerplateFormfactorDefinition: {
|
|
7
|
+
readonly name: "BOILERPLATE";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly [];
|
|
12
|
+
readonly outputParameterNames: readonly [];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineInterface } from '../../pipeline/pipeline-interface/PipelineInterface';
|
|
2
2
|
import type { string_markdown_text } from '../../types/typeAliases';
|
|
3
3
|
import type { string_name } from '../../types/typeAliases';
|
|
4
4
|
import type { string_promptbook_documentation_url } from '../../types/typeAliases';
|
|
5
|
+
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
6
|
/**
|
|
6
7
|
* @@@
|
|
7
8
|
*/
|
|
@@ -26,4 +27,8 @@ export type AbstractFormfactorDefinition = {
|
|
|
26
27
|
* @@@
|
|
27
28
|
*/
|
|
28
29
|
readonly documentationUrl: string_promptbook_documentation_url;
|
|
30
|
+
/**
|
|
31
|
+
* @@@
|
|
32
|
+
*/
|
|
33
|
+
readonly pipelineInterface: PipelineInterface;
|
|
29
34
|
};
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* @public exported from `@promptbook/core`
|
|
5
5
|
*/
|
|
6
6
|
export declare const ChatFormfactorDefinition: {
|
|
7
|
-
readonly name: "
|
|
7
|
+
readonly name: "CHATBOT";
|
|
8
|
+
readonly aliasNames: readonly ["CHAT"];
|
|
8
9
|
readonly description: "@@@";
|
|
9
10
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
11
|
+
readonly pipelineInterface: {
|
|
12
|
+
readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
|
|
13
|
+
readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
|
|
14
|
+
};
|
|
10
15
|
};
|
|
@@ -7,4 +7,8 @@ export declare const GenericFormfactorDefinition: {
|
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
8
|
readonly description: "@@@";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly [];
|
|
12
|
+
readonly outputParameterNames: readonly [];
|
|
13
|
+
};
|
|
10
14
|
};
|
|
@@ -7,8 +7,33 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
8
|
readonly description: "@@@";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly [];
|
|
12
|
+
readonly outputParameterNames: readonly [];
|
|
13
|
+
};
|
|
10
14
|
}, {
|
|
11
|
-
readonly name: "
|
|
15
|
+
readonly name: "CHATBOT";
|
|
16
|
+
readonly aliasNames: readonly ["CHAT"];
|
|
12
17
|
readonly description: "@@@";
|
|
13
18
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
19
|
+
readonly pipelineInterface: {
|
|
20
|
+
readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
|
|
21
|
+
readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "TRANSLATOR";
|
|
25
|
+
readonly description: "@@@";
|
|
26
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
27
|
+
readonly pipelineInterface: {
|
|
28
|
+
readonly inputParameterNames: readonly ["inputMessage"];
|
|
29
|
+
readonly outputParameterNames: readonly ["outputMessage"];
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "SHEETS";
|
|
33
|
+
readonly description: "@@@";
|
|
34
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
35
|
+
readonly pipelineInterface: {
|
|
36
|
+
readonly inputParameterNames: readonly ["inputSheet"];
|
|
37
|
+
readonly outputParameterNames: readonly ["outputSheet"];
|
|
38
|
+
};
|
|
14
39
|
}];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sheets is form of app that @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const SheetsFormfactorDefinition: {
|
|
7
|
+
readonly name: "SHEETS";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly ["inputSheet"];
|
|
12
|
+
readonly outputParameterNames: readonly ["outputSheet"];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translator is form of app that @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const TranslatorFormfactorDefinition: {
|
|
7
|
+
readonly name: "TRANSLATOR";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly ["inputMessage"];
|
|
12
|
+
readonly outputParameterNames: readonly ["outputMessage"];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -8,13 +8,13 @@ export type PipelineInterface = {
|
|
|
8
8
|
*
|
|
9
9
|
* Note: Sorted alphabetically
|
|
10
10
|
*/
|
|
11
|
-
inputParameterNames:
|
|
11
|
+
readonly inputParameterNames: ReadonlyArray<string_parameter_name>;
|
|
12
12
|
/**
|
|
13
13
|
* @@@
|
|
14
14
|
*
|
|
15
15
|
* Note: Sorted alphabetically
|
|
16
16
|
*/
|
|
17
|
-
outputParameterNames:
|
|
17
|
+
readonly outputParameterNames: ReadonlyArray<string_parameter_name>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* TODO: !!!!!! Change inputParameterNames to inputParameters<InputParameter>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.75.0-
|
|
3
|
+
"version": "0.75.0-1",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"module": "./esm/index.es.js",
|
|
54
54
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@promptbook/core": "0.75.0-
|
|
56
|
+
"@promptbook/core": "0.75.0-1"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
*
|
|
44
44
|
* @see https://github.com/webgptorg/promptbook
|
|
45
45
|
*/
|
|
46
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
46
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
47
47
|
/**
|
|
48
48
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
49
49
|
*/
|
|
@@ -487,6 +487,7 @@
|
|
|
487
487
|
// Note: In normal situations, we check the pipeline logic:
|
|
488
488
|
true);
|
|
489
489
|
/**
|
|
490
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
490
491
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
491
492
|
*/
|
|
492
493
|
|
|
@@ -1297,8 +1298,8 @@
|
|
|
1297
1298
|
else if (errors.length > 1) {
|
|
1298
1299
|
throw new PipelineExecutionError(
|
|
1299
1300
|
// TODO: Tell which execution tools failed like
|
|
1300
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
1301
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
1301
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
1302
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
1302
1303
|
// 3) ...
|
|
1303
1304
|
spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
1304
1305
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -1633,18 +1634,18 @@
|
|
|
1633
1634
|
}
|
|
1634
1635
|
var _loop_1 = function (parameter) {
|
|
1635
1636
|
if (parameter.isInput && parameter.isOutput) {
|
|
1636
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1637
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1637
1638
|
}
|
|
1638
1639
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1639
1640
|
if (!parameter.isInput &&
|
|
1640
1641
|
!parameter.isOutput &&
|
|
1641
1642
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1642
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1643
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1643
1644
|
}
|
|
1644
1645
|
// Note: Testing that parameter is either input or result of some template
|
|
1645
1646
|
if (!parameter.isInput &&
|
|
1646
1647
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1647
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}
|
|
1648
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add template that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1648
1649
|
}
|
|
1649
1650
|
};
|
|
1650
1651
|
try {
|
|
@@ -1672,7 +1673,7 @@
|
|
|
1672
1673
|
var _loop_2 = function (template) {
|
|
1673
1674
|
var e_4, _h, e_5, _j;
|
|
1674
1675
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1675
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1676
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1676
1677
|
}
|
|
1677
1678
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1678
1679
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1685,7 +1686,7 @@
|
|
|
1685
1686
|
}
|
|
1686
1687
|
var _loop_4 = function (joker) {
|
|
1687
1688
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1688
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1689
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1689
1690
|
}
|
|
1690
1691
|
};
|
|
1691
1692
|
try {
|
|
@@ -1780,14 +1781,24 @@
|
|
|
1780
1781
|
if (currentlyResovedTemplates.length === 0) {
|
|
1781
1782
|
throw new PipelineLogicError(
|
|
1782
1783
|
// TODO: [🐎] DRY
|
|
1783
|
-
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
1784
|
+
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
|
|
1784
1785
|
.map(function (_a) {
|
|
1785
1786
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1786
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1787
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1787
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1788
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1788
1789
|
.join(' and '));
|
|
1789
1790
|
})
|
|
1790
|
-
.join('\n')), "\n\n Resolved
|
|
1791
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1792
|
+
.filter(function (name) {
|
|
1793
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1794
|
+
})
|
|
1795
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1796
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1797
|
+
.filter(function (name) {
|
|
1798
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1799
|
+
})
|
|
1800
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1801
|
+
.join('\n')), "\n\n\n "); }));
|
|
1791
1802
|
}
|
|
1792
1803
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1793
1804
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1798,6 +1809,7 @@
|
|
|
1798
1809
|
while (unresovedTemplates.length > 0) {
|
|
1799
1810
|
_loop_3();
|
|
1800
1811
|
}
|
|
1812
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1801
1813
|
}
|
|
1802
1814
|
/**
|
|
1803
1815
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -2933,11 +2945,11 @@
|
|
|
2933
2945
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2934
2946
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
2935
2947
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
2936
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
2948
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
2937
2949
|
}
|
|
2938
2950
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
2939
2951
|
// TODO: [🍵]
|
|
2940
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
2952
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
2941
2953
|
}
|
|
2942
2954
|
}
|
|
2943
2955
|
}
|
|
@@ -2964,11 +2976,11 @@
|
|
|
2964
2976
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
2965
2977
|
}
|
|
2966
2978
|
if (parameters[parameterName] === undefined) {
|
|
2967
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
2979
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
2968
2980
|
}
|
|
2969
2981
|
var parameterValue = parameters[parameterName];
|
|
2970
2982
|
if (parameterValue === undefined) {
|
|
2971
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
2983
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
2972
2984
|
}
|
|
2973
2985
|
parameterValue = parameterValue.toString();
|
|
2974
2986
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -3024,6 +3036,9 @@
|
|
|
3024
3036
|
* @public exported from `@promptbook/utils`
|
|
3025
3037
|
*/
|
|
3026
3038
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
3039
|
+
/**
|
|
3040
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
3041
|
+
*/
|
|
3027
3042
|
|
|
3028
3043
|
/**
|
|
3029
3044
|
* Counts number of lines in the text
|
|
@@ -4016,7 +4031,7 @@
|
|
|
4016
4031
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4017
4032
|
// Houston, we have a problem
|
|
4018
4033
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
4019
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4034
|
+
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4020
4035
|
}
|
|
4021
4036
|
};
|
|
4022
4037
|
try {
|
|
@@ -4095,7 +4110,7 @@
|
|
|
4095
4110
|
var _loop_1 = function (parameter) {
|
|
4096
4111
|
if (parametersToPass[parameter.name] === undefined) {
|
|
4097
4112
|
// [4]
|
|
4098
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
4113
|
+
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
4099
4114
|
return "continue";
|
|
4100
4115
|
}
|
|
4101
4116
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -4182,7 +4197,7 @@
|
|
|
4182
4197
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
4183
4198
|
isSuccessful: false,
|
|
4184
4199
|
errors: __spreadArray([
|
|
4185
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
4200
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
4186
4201
|
], __read(errors), false).map(serializeError),
|
|
4187
4202
|
warnings: [],
|
|
4188
4203
|
executionReport: executionReport,
|
|
@@ -4230,7 +4245,7 @@
|
|
|
4230
4245
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
4231
4246
|
isSuccessful: false,
|
|
4232
4247
|
errors: __spreadArray([
|
|
4233
|
-
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
4248
|
+
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
4234
4249
|
], __read(errors), false).map(serializeError),
|
|
4235
4250
|
warnings: warnings.map(serializeError),
|
|
4236
4251
|
executionReport: executionReport,
|
|
@@ -4304,14 +4319,24 @@
|
|
|
4304
4319
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
4305
4320
|
throw new UnexpectedError(
|
|
4306
4321
|
// TODO: [🐎] DRY
|
|
4307
|
-
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
4322
|
+
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates_1
|
|
4308
4323
|
.map(function (_a) {
|
|
4309
4324
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
4310
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
4311
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
4325
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
4326
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
4312
4327
|
.join(' and '));
|
|
4313
4328
|
})
|
|
4314
|
-
.join('\n')), "\n\n Resolved
|
|
4329
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
4330
|
+
.filter(function (name) {
|
|
4331
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
4332
|
+
})
|
|
4333
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4334
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
4335
|
+
.filter(function (name) {
|
|
4336
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
4337
|
+
})
|
|
4338
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4339
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
4315
4340
|
case 1:
|
|
4316
4341
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
4317
4342
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -6528,9 +6553,35 @@
|
|
|
6528
6553
|
* @public exported from `@promptbook/core`
|
|
6529
6554
|
*/
|
|
6530
6555
|
var ChatFormfactorDefinition = {
|
|
6531
|
-
name: '
|
|
6556
|
+
name: 'CHATBOT',
|
|
6557
|
+
aliasNames: ['CHAT'],
|
|
6532
6558
|
description: "@@@",
|
|
6533
6559
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6560
|
+
pipelineInterface: {
|
|
6561
|
+
inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
|
|
6562
|
+
outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
|
|
6563
|
+
/*
|
|
6564
|
+
<- TODO: !!!!!! Change to
|
|
6565
|
+
|
|
6566
|
+
- INPUT PARAMETER `{previousTitle}` Previous title of the conversation
|
|
6567
|
+
- INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
|
|
6568
|
+
- INPUT PARAMETER `{userMessage}` User message
|
|
6569
|
+
- OUTPUT PARAMETER `{title}` Title of the conversation
|
|
6570
|
+
- OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
|
|
6571
|
+
- OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
|
|
6572
|
+
|
|
6573
|
+
*/
|
|
6574
|
+
},
|
|
6575
|
+
};
|
|
6576
|
+
|
|
6577
|
+
/**
|
|
6578
|
+
* @@@
|
|
6579
|
+
*
|
|
6580
|
+
* @public exported from `@promptbook/core`
|
|
6581
|
+
*/
|
|
6582
|
+
var GENERIC_PIPELINE_INTERFACE = {
|
|
6583
|
+
inputParameterNames: [],
|
|
6584
|
+
outputParameterNames: [],
|
|
6534
6585
|
};
|
|
6535
6586
|
|
|
6536
6587
|
/**
|
|
@@ -6542,6 +6593,37 @@
|
|
|
6542
6593
|
name: 'GENERIC',
|
|
6543
6594
|
description: "@@@",
|
|
6544
6595
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6596
|
+
pipelineInterface: GENERIC_PIPELINE_INTERFACE,
|
|
6597
|
+
};
|
|
6598
|
+
|
|
6599
|
+
/**
|
|
6600
|
+
* Sheets is form of app that @@@
|
|
6601
|
+
*
|
|
6602
|
+
* @public exported from `@promptbook/core`
|
|
6603
|
+
*/
|
|
6604
|
+
var SheetsFormfactorDefinition = {
|
|
6605
|
+
name: 'SHEETS',
|
|
6606
|
+
description: "@@@",
|
|
6607
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6608
|
+
pipelineInterface: {
|
|
6609
|
+
inputParameterNames: ['inputSheet'],
|
|
6610
|
+
outputParameterNames: ['outputSheet'],
|
|
6611
|
+
},
|
|
6612
|
+
};
|
|
6613
|
+
|
|
6614
|
+
/**
|
|
6615
|
+
* Translator is form of app that @@@
|
|
6616
|
+
*
|
|
6617
|
+
* @public exported from `@promptbook/core`
|
|
6618
|
+
*/
|
|
6619
|
+
var TranslatorFormfactorDefinition = {
|
|
6620
|
+
name: 'TRANSLATOR',
|
|
6621
|
+
description: "@@@",
|
|
6622
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6623
|
+
pipelineInterface: {
|
|
6624
|
+
inputParameterNames: ['inputMessage'],
|
|
6625
|
+
outputParameterNames: ['outputMessage'],
|
|
6626
|
+
},
|
|
6545
6627
|
};
|
|
6546
6628
|
|
|
6547
6629
|
/**
|
|
@@ -6549,7 +6631,12 @@
|
|
|
6549
6631
|
*
|
|
6550
6632
|
* @public exported from `@promptbook/core`
|
|
6551
6633
|
*/
|
|
6552
|
-
var FORMFACTOR_DEFINITIONS = [
|
|
6634
|
+
var FORMFACTOR_DEFINITIONS = [
|
|
6635
|
+
GenericFormfactorDefinition,
|
|
6636
|
+
ChatFormfactorDefinition,
|
|
6637
|
+
TranslatorFormfactorDefinition,
|
|
6638
|
+
SheetsFormfactorDefinition,
|
|
6639
|
+
];
|
|
6553
6640
|
|
|
6554
6641
|
/**
|
|
6555
6642
|
* Parses the formfactor command
|
|
@@ -6584,7 +6671,7 @@
|
|
|
6584
6671
|
/**
|
|
6585
6672
|
* Example usages of the FORMFACTOR command
|
|
6586
6673
|
*/
|
|
6587
|
-
examples: ['FORMFACTOR
|
|
6674
|
+
examples: ['FORMFACTOR Chatbot', 'FF Chat'],
|
|
6588
6675
|
/**
|
|
6589
6676
|
* Parses the FORMFACTOR command
|
|
6590
6677
|
*/
|
|
@@ -6593,16 +6680,19 @@
|
|
|
6593
6680
|
if (args.length !== 1) {
|
|
6594
6681
|
throw new ParseError("FORMFACTOR command requires exactly one argument");
|
|
6595
6682
|
}
|
|
6596
|
-
var
|
|
6597
|
-
|
|
6598
|
-
|
|
6683
|
+
var formfactorNameCandidate = args[0].toUpperCase();
|
|
6684
|
+
var formfactor = FORMFACTOR_DEFINITIONS.find(function (definition) {
|
|
6685
|
+
return __spreadArray([definition.name], __read(__assign({ aliasNames: [] }, definition).aliasNames), false).includes(formfactorNameCandidate);
|
|
6686
|
+
});
|
|
6687
|
+
if (formfactor === undefined) {
|
|
6688
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown formfactor name \"".concat(formfactorNameCandidate, "\"\n\n Available formfactors:\n ").concat(block(FORMFACTOR_DEFINITIONS.map(function (_a) {
|
|
6599
6689
|
var name = _a.name;
|
|
6600
6690
|
return "- ".concat(name);
|
|
6601
6691
|
}).join('\n')), "\n "); }));
|
|
6602
6692
|
}
|
|
6603
6693
|
return {
|
|
6604
6694
|
type: 'FORMFACTOR',
|
|
6605
|
-
formfactorName:
|
|
6695
|
+
formfactorName: formfactor.name,
|
|
6606
6696
|
};
|
|
6607
6697
|
},
|
|
6608
6698
|
/**
|
|
@@ -6902,7 +6992,7 @@
|
|
|
6902
6992
|
// <- TODO: When [🥶] fixed, change to:
|
|
6903
6993
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
6904
6994
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
6905
|
-
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Parameter {".concat(parameterNameRaw, "} can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
6995
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Parameter `{".concat(parameterNameRaw, "}` can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
6906
6996
|
}
|
|
6907
6997
|
var isInput = normalized.startsWith('INPUT');
|
|
6908
6998
|
var isOutput = normalized.startsWith('OUTPUT');
|
|
@@ -7948,7 +8038,7 @@
|
|
|
7948
8038
|
existingParameter.description &&
|
|
7949
8039
|
existingParameter.description !== parameterDescription &&
|
|
7950
8040
|
parameterDescription) {
|
|
7951
|
-
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description:\n\n ").concat(block(getPipelineIdentification()), "\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
|
|
8041
|
+
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is defined multiple times with different description:\n\n ").concat(block(getPipelineIdentification()), "\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
|
|
7952
8042
|
}
|
|
7953
8043
|
if (existingParameter) {
|
|
7954
8044
|
if (parameterDescription) {
|
|
@@ -9333,10 +9423,10 @@
|
|
|
9333
9423
|
/*
|
|
9334
9424
|
Note: Remapping error
|
|
9335
9425
|
From: [PipelineUrlError: thing is not defined],
|
|
9336
|
-
To: [PipelineExecutionError: Parameter {thing} is not defined],
|
|
9426
|
+
To: [PipelineExecutionError: Parameter `{thing}` is not defined],
|
|
9337
9427
|
*/
|
|
9338
9428
|
if (!statementToEvaluate.includes(undefinedName_1 + '(')) {
|
|
9339
|
-
throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n\n Parameter {".concat(undefinedName_1, "} is not defined\n\n This happen during evaluation of the javascript, which has access to the following parameters as javascript variables:\n\n ").concat(block(Object.keys(parameters)
|
|
9429
|
+
throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n\n Parameter `{".concat(undefinedName_1, "}` is not defined\n\n This happen during evaluation of the javascript, which has access to the following parameters as javascript variables:\n\n ").concat(block(Object.keys(parameters)
|
|
9340
9430
|
.map(function (key) { return " - ".concat(key, "\n"); })
|
|
9341
9431
|
.join('')), "\n\n The script is:\n ```javascript\n ").concat(block(script), "\n ```\n\n Original error message:\n ").concat(block(error_1.message), "\n\n\n "); }));
|
|
9342
9432
|
}
|