@promptbook/node 0.67.9 → 0.68.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/README.md +2 -2
- package/esm/index.es.js +1204 -628
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +7 -16
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +20 -24
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +1 -1
- package/esm/typings/src/commands/BLOCK/blockCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +14 -6
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +9 -0
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +14 -0
- package/esm/typings/src/commands/{EXPECT/ExpectFormatCommand.d.ts → FORMAT/FormatCommand.d.ts} +2 -2
- package/esm/typings/src/commands/FORMAT/formatCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/URL/urlCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +6 -4
- package/esm/typings/src/commands/_common/parseCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +137 -30
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +14 -0
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.test.d.ts +1 -0
- package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -1
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/errors/{ParsingError.d.ts → ParseError.d.ts} +5 -2
- package/esm/typings/src/errors/index.d.ts +2 -2
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +5 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -0
- package/esm/typings/src/execution/PromptResultUsage.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -1
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +2 -2
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +3 -3
- package/esm/typings/src/prepare/prepareTemplates.d.ts +3 -4
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +1 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +13 -0
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/{PromptTemplateParameterJson.d.ts → ParameterJson.d.ts} +2 -2
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +10 -5
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +20 -9
- package/esm/typings/src/types/PipelineJson/{ScriptJson.d.ts → ScriptTemplateJson.d.ts} +4 -4
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +3 -3
- package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +11 -0
- package/esm/typings/src/types/PipelineJson/{PromptTemplateJsonCommon.d.ts → TemplateJsonCommon.d.ts} +3 -4
- package/esm/typings/src/types/Prompt.d.ts +4 -2
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/organization/___and___.d.ts +7 -0
- package/esm/typings/src/utils/organization/{___.d.ts → ___or___.d.ts} +1 -1
- package/esm/typings/src/utils/parseNumber.d.ts +1 -1
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +1204 -628
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +0 -17
- package/esm/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +0 -14
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +0 -27
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +0 -14
- /package/esm/typings/src/{conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts → commands/FOREACH/foreachCommand.test.d.ts} +0 -0
|
@@ -8,16 +8,13 @@ declare const _default: ({
|
|
|
8
8
|
isInput: boolean;
|
|
9
9
|
isOutput: boolean;
|
|
10
10
|
}[];
|
|
11
|
-
|
|
11
|
+
templates: {
|
|
12
12
|
blockType: string;
|
|
13
13
|
name: string;
|
|
14
14
|
title: string;
|
|
15
|
-
modelRequirements: {
|
|
16
|
-
modelVariant: string;
|
|
17
|
-
};
|
|
18
15
|
content: string;
|
|
19
|
-
dependentParameterNames: string[];
|
|
20
16
|
resultingParameterName: string;
|
|
17
|
+
dependentParameterNames: string[];
|
|
21
18
|
}[];
|
|
22
19
|
knowledgeSources: never[];
|
|
23
20
|
knowledgePieces: never[];
|
|
@@ -34,14 +31,12 @@ declare const _default: ({
|
|
|
34
31
|
isInput: boolean;
|
|
35
32
|
isOutput: boolean;
|
|
36
33
|
}[];
|
|
37
|
-
|
|
34
|
+
templates: {
|
|
38
35
|
blockType: string;
|
|
39
36
|
name: string;
|
|
40
37
|
title: string;
|
|
41
|
-
modelRequirements: {
|
|
42
|
-
modelVariant: string;
|
|
43
|
-
};
|
|
44
38
|
content: string;
|
|
39
|
+
resultingParameterName: string;
|
|
45
40
|
expectations: {
|
|
46
41
|
words: {
|
|
47
42
|
min: number;
|
|
@@ -49,7 +44,6 @@ declare const _default: ({
|
|
|
49
44
|
};
|
|
50
45
|
};
|
|
51
46
|
dependentParameterNames: string[];
|
|
52
|
-
resultingParameterName: string;
|
|
53
47
|
}[];
|
|
54
48
|
knowledgeSources: never[];
|
|
55
49
|
knowledgePieces: never[];
|
|
@@ -66,17 +60,14 @@ declare const _default: ({
|
|
|
66
60
|
isInput: boolean;
|
|
67
61
|
isOutput: boolean;
|
|
68
62
|
}[];
|
|
69
|
-
|
|
63
|
+
templates: {
|
|
70
64
|
blockType: string;
|
|
71
65
|
name: string;
|
|
72
66
|
title: string;
|
|
73
|
-
modelRequirements: {
|
|
74
|
-
modelVariant: string;
|
|
75
|
-
};
|
|
76
67
|
content: string;
|
|
77
|
-
expectFormat: string;
|
|
78
|
-
dependentParameterNames: string[];
|
|
79
68
|
resultingParameterName: string;
|
|
69
|
+
format: string;
|
|
70
|
+
dependentParameterNames: string[];
|
|
80
71
|
}[];
|
|
81
72
|
knowledgeSources: never[];
|
|
82
73
|
knowledgePieces: never[];
|
|
@@ -32,7 +32,7 @@ import { ERRORS } from '../errors/index';
|
|
|
32
32
|
import { LimitReachedError } from '../errors/LimitReachedError';
|
|
33
33
|
import { NotFoundError } from '../errors/NotFoundError';
|
|
34
34
|
import { NotYetImplementedError } from '../errors/NotYetImplementedError';
|
|
35
|
-
import {
|
|
35
|
+
import { ParseError } from '../errors/ParseError';
|
|
36
36
|
import { PipelineExecutionError } from '../errors/PipelineExecutionError';
|
|
37
37
|
import { PipelineLogicError } from '../errors/PipelineLogicError';
|
|
38
38
|
import { PipelineUrlError } from '../errors/PipelineUrlError';
|
|
@@ -105,7 +105,7 @@ export { ERRORS };
|
|
|
105
105
|
export { LimitReachedError };
|
|
106
106
|
export { NotFoundError };
|
|
107
107
|
export { NotYetImplementedError };
|
|
108
|
-
export {
|
|
108
|
+
export { ParseError };
|
|
109
109
|
export { PipelineExecutionError };
|
|
110
110
|
export { PipelineLogicError };
|
|
111
111
|
export { PipelineUrlError };
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { PipelineCollection } from '../collection/PipelineCollection';
|
|
2
2
|
import type { Command } from '../commands/_common/types/Command';
|
|
3
3
|
import type { CommandParser } from '../commands/_common/types/CommandParser';
|
|
4
|
+
import type { PipelineBothCommandParser } from '../commands/_common/types/CommandParser';
|
|
5
|
+
import type { PipelineHeadCommandParser } from '../commands/_common/types/CommandParser';
|
|
6
|
+
import type { PipelineTemplateCommandParser } from '../commands/_common/types/CommandParser';
|
|
4
7
|
import type { CommandParserInput } from '../commands/_common/types/CommandParser';
|
|
5
|
-
import type { ApplyToPipelineJsonSubjects } from '../commands/_common/types/CommandParser';
|
|
6
8
|
import type { CommandUsagePlace } from '../commands/_common/types/CommandUsagePlaces';
|
|
7
9
|
import type { BlockType } from '../commands/BLOCK/BlockTypes';
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
+
import type { ExpectCommand } from '../commands/EXPECT/ExpectCommand';
|
|
11
|
+
import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
|
|
10
12
|
import type { PipelineStringToJsonOptions } from '../conversion/pipelineStringToJson';
|
|
11
13
|
import type { PrettifyOptions } from '../conversion/prettify/PrettifyOptions';
|
|
12
14
|
import type { renderPipelineMermaidOptions } from '../conversion/prettify/renderPipelineMermaidOptions';
|
|
13
15
|
import type { ErrorJson } from '../errors/utils/ErrorJson';
|
|
14
16
|
import type { AvailableModel } from '../execution/AvailableModel';
|
|
15
|
-
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
16
17
|
import type { EmbeddingVector } from '../execution/EmbeddingVector';
|
|
17
18
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
18
19
|
import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
@@ -23,7 +24,6 @@ import type { PromptResult } from '../execution/PromptResult';
|
|
|
23
24
|
import type { CompletionPromptResult } from '../execution/PromptResult';
|
|
24
25
|
import type { ChatPromptResult } from '../execution/PromptResult';
|
|
25
26
|
import type { EmbeddingPromptResult } from '../execution/PromptResult';
|
|
26
|
-
import type { CommonPromptResult } from '../execution/PromptResult';
|
|
27
27
|
import type { PromptResultUsage } from '../execution/PromptResultUsage';
|
|
28
28
|
import type { PromptResultUsageCounts } from '../execution/PromptResultUsage';
|
|
29
29
|
import type { ScriptExecutionTools } from '../execution/ScriptExecutionTools';
|
|
@@ -72,31 +72,29 @@ import type { ModelRequirements } from '../types/ModelRequirements';
|
|
|
72
72
|
import type { CompletionModelRequirements } from '../types/ModelRequirements';
|
|
73
73
|
import type { ChatModelRequirements } from '../types/ModelRequirements';
|
|
74
74
|
import type { EmbeddingModelRequirements } from '../types/ModelRequirements';
|
|
75
|
-
import type { CommonModelRequirements } from '../types/ModelRequirements';
|
|
76
75
|
import type { ModelVariant } from '../types/ModelVariant';
|
|
76
|
+
import type { DialogTemplateJson } from '../types/PipelineJson/DialogTemplateJson';
|
|
77
77
|
import type { Expectations } from '../types/PipelineJson/Expectations';
|
|
78
78
|
import type { ExpectationUnit } from '../types/PipelineJson/Expectations';
|
|
79
79
|
import type { ExpectationAmount } from '../types/PipelineJson/Expectations';
|
|
80
80
|
import type { KnowledgePiecePreparedJson } from '../types/PipelineJson/KnowledgePieceJson';
|
|
81
81
|
import type { KnowledgeSourceJson } from '../types/PipelineJson/KnowledgeSourceJson';
|
|
82
82
|
import type { KnowledgeSourcePreparedJson } from '../types/PipelineJson/KnowledgeSourceJson';
|
|
83
|
-
import type {
|
|
83
|
+
import type { ParameterJson } from '../types/PipelineJson/ParameterJson';
|
|
84
84
|
import type { PersonaJson } from '../types/PipelineJson/PersonaJson';
|
|
85
85
|
import type { PersonaPreparedJson } from '../types/PipelineJson/PersonaJson';
|
|
86
86
|
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
87
87
|
import type { PreparationJson } from '../types/PipelineJson/PreparationJson';
|
|
88
|
-
import type { PromptDialogJson } from '../types/PipelineJson/PromptDialogJson';
|
|
89
88
|
import type { PromptTemplateJson } from '../types/PipelineJson/PromptTemplateJson';
|
|
90
|
-
import type {
|
|
91
|
-
import type { PromptTemplateParameterJson } from '../types/PipelineJson/PromptTemplateParameterJson';
|
|
92
|
-
import type { ScriptJson } from '../types/PipelineJson/ScriptJson';
|
|
89
|
+
import type { ScriptTemplateJson } from '../types/PipelineJson/ScriptTemplateJson';
|
|
93
90
|
import type { SimpleTemplateJson } from '../types/PipelineJson/SimpleTemplateJson';
|
|
91
|
+
import type { TemplateJson } from '../types/PipelineJson/TemplateJson';
|
|
92
|
+
import type { TemplateJsonCommon } from '../types/PipelineJson/TemplateJsonCommon';
|
|
94
93
|
import type { PipelineString } from '../types/PipelineString';
|
|
95
94
|
import type { Prompt } from '../types/Prompt';
|
|
96
95
|
import type { CompletionPrompt } from '../types/Prompt';
|
|
97
96
|
import type { ChatPrompt } from '../types/Prompt';
|
|
98
97
|
import type { EmbeddingPrompt } from '../types/Prompt';
|
|
99
|
-
import type { CommonPrompt } from '../types/Prompt';
|
|
100
98
|
import type { ScriptLanguage } from '../types/ScriptLanguage';
|
|
101
99
|
import type { TaskProgress } from '../types/TaskProgress';
|
|
102
100
|
import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
@@ -227,18 +225,19 @@ import type { string_promptbook_version } from '../version';
|
|
|
227
225
|
export type { PipelineCollection };
|
|
228
226
|
export type { Command };
|
|
229
227
|
export type { CommandParser };
|
|
228
|
+
export type { PipelineBothCommandParser };
|
|
229
|
+
export type { PipelineHeadCommandParser };
|
|
230
|
+
export type { PipelineTemplateCommandParser };
|
|
230
231
|
export type { CommandParserInput };
|
|
231
|
-
export type { ApplyToPipelineJsonSubjects };
|
|
232
232
|
export type { CommandUsagePlace };
|
|
233
233
|
export type { BlockType };
|
|
234
|
-
export type {
|
|
235
|
-
export type {
|
|
234
|
+
export type { ExpectCommand };
|
|
235
|
+
export type { FormatCommand };
|
|
236
236
|
export type { PipelineStringToJsonOptions };
|
|
237
237
|
export type { PrettifyOptions };
|
|
238
238
|
export type { renderPipelineMermaidOptions };
|
|
239
239
|
export type { ErrorJson };
|
|
240
240
|
export type { AvailableModel };
|
|
241
|
-
export type { CommonExecutionToolsOptions };
|
|
242
241
|
export type { EmbeddingVector };
|
|
243
242
|
export type { ExecutionTools };
|
|
244
243
|
export type { LlmExecutionTools };
|
|
@@ -249,7 +248,6 @@ export type { PromptResult };
|
|
|
249
248
|
export type { CompletionPromptResult };
|
|
250
249
|
export type { ChatPromptResult };
|
|
251
250
|
export type { EmbeddingPromptResult };
|
|
252
|
-
export type { CommonPromptResult };
|
|
253
251
|
export type { PromptResultUsage };
|
|
254
252
|
export type { PromptResultUsageCounts };
|
|
255
253
|
export type { ScriptExecutionTools };
|
|
@@ -298,31 +296,29 @@ export type { ModelRequirements };
|
|
|
298
296
|
export type { CompletionModelRequirements };
|
|
299
297
|
export type { ChatModelRequirements };
|
|
300
298
|
export type { EmbeddingModelRequirements };
|
|
301
|
-
export type { CommonModelRequirements };
|
|
302
299
|
export type { ModelVariant };
|
|
300
|
+
export type { DialogTemplateJson };
|
|
303
301
|
export type { Expectations };
|
|
304
302
|
export type { ExpectationUnit };
|
|
305
303
|
export type { ExpectationAmount };
|
|
306
304
|
export type { KnowledgePiecePreparedJson };
|
|
307
305
|
export type { KnowledgeSourceJson };
|
|
308
306
|
export type { KnowledgeSourcePreparedJson };
|
|
309
|
-
export type {
|
|
307
|
+
export type { ParameterJson };
|
|
310
308
|
export type { PersonaJson };
|
|
311
309
|
export type { PersonaPreparedJson };
|
|
312
310
|
export type { PipelineJson };
|
|
313
311
|
export type { PreparationJson };
|
|
314
|
-
export type { PromptDialogJson };
|
|
315
312
|
export type { PromptTemplateJson };
|
|
316
|
-
export type {
|
|
317
|
-
export type { PromptTemplateParameterJson };
|
|
318
|
-
export type { ScriptJson };
|
|
313
|
+
export type { ScriptTemplateJson };
|
|
319
314
|
export type { SimpleTemplateJson };
|
|
315
|
+
export type { TemplateJson };
|
|
316
|
+
export type { TemplateJsonCommon };
|
|
320
317
|
export type { PipelineString };
|
|
321
318
|
export type { Prompt };
|
|
322
319
|
export type { CompletionPrompt };
|
|
323
320
|
export type { ChatPrompt };
|
|
324
321
|
export type { EmbeddingPrompt };
|
|
325
|
-
export type { CommonPrompt };
|
|
326
322
|
export type { ScriptLanguage };
|
|
327
323
|
export type { TaskProgress };
|
|
328
324
|
export type { string_char_emoji };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
2
2
|
import { renderPromptbookMermaid } from '../conversion/prettify/renderPipelineMermaidOptions';
|
|
3
|
-
import {
|
|
3
|
+
import { extractParameterNamesFromTemplate } from '../conversion/utils/extractParameterNamesFromTemplate';
|
|
4
4
|
import { extractVariables } from '../conversion/utils/extractVariables';
|
|
5
5
|
import { renameParameter } from '../conversion/utils/renameParameter';
|
|
6
6
|
import { titleToName } from '../conversion/utils/titleToName';
|
|
@@ -71,7 +71,7 @@ import { isValidUrl } from '../utils/validators/url/isValidUrl';
|
|
|
71
71
|
import { isValidUuid } from '../utils/validators/uuid/isValidUuid';
|
|
72
72
|
export { PROMPTBOOK_VERSION };
|
|
73
73
|
export { renderPromptbookMermaid };
|
|
74
|
-
export {
|
|
74
|
+
export { extractParameterNamesFromTemplate };
|
|
75
75
|
export { extractVariables };
|
|
76
76
|
export { renameParameter };
|
|
77
77
|
export { titleToName };
|
|
@@ -12,4 +12,4 @@ export type BlockType = TupleToUnion<typeof BlockTypes>;
|
|
|
12
12
|
* @see https://github.com/webgptorg/promptbook#block-type
|
|
13
13
|
* @public exported from `@promptbook/core`
|
|
14
14
|
*/
|
|
15
|
-
export declare const BlockTypes: readonly ["PROMPT_TEMPLATE", "SIMPLE_TEMPLATE", "
|
|
15
|
+
export declare const BlockTypes: readonly ["PROMPT_TEMPLATE", "SIMPLE_TEMPLATE", "SCRIPT_TEMPLATE", "DIALOG_TEMPLATE", "SAMPLE", "KNOWLEDGE", "INSTRUMENT", "ACTION"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineTemplateCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { BlockCommand } from './BlockCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the block command
|
|
@@ -6,4 +6,4 @@ import type { BlockCommand } from './BlockCommand';
|
|
|
6
6
|
* @see ./BLOCK-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const blockCommandParser:
|
|
9
|
+
export declare const blockCommandParser: PipelineTemplateCommandParser<BlockCommand>;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ExpectationAmount } from '../../types/PipelineJson/Expectations';
|
|
2
|
+
import type { ExpectationUnit } from '../../types/PipelineJson/Expectations';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Expect amount command describes the desired output of the prompt template (after post-processing)
|
|
5
|
+
* It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs,...
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
|
|
7
|
+
* Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units.
|
|
8
|
+
*/
|
|
9
|
+
export type ExpectCommand = {
|
|
10
|
+
readonly type: 'EXPECT';
|
|
11
|
+
readonly sign: 'EXACTLY' | 'MINIMUM' | 'MAXIMUM';
|
|
12
|
+
readonly unit: ExpectationUnit;
|
|
13
|
+
readonly amount: ExpectationAmount;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* TODO: [🍋] Allow to `EXPECT` relative amounts like `EXPECT MAX 130% {foo} Words`
|
|
8
17
|
*/
|
|
9
|
-
export type ExpectCommand = ExpectAmountCommand | ExpectFormatCommand;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineTemplateCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { ExpectCommand } from './ExpectCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the expect command
|
|
@@ -6,4 +6,4 @@ import type { ExpectCommand } from './ExpectCommand';
|
|
|
6
6
|
* @see ./EXPECT-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const expectCommandParser:
|
|
9
|
+
export declare const expectCommandParser: PipelineTemplateCommandParser<ExpectCommand>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PipelineTemplateCommandParser } from '../_common/types/CommandParser';
|
|
2
|
+
import type { ForeachCommand } from './ForeachCommand';
|
|
3
|
+
/**
|
|
4
|
+
* Parses the foreach command
|
|
5
|
+
*
|
|
6
|
+
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.ptbk.md` file
|
|
7
|
+
*
|
|
8
|
+
* @see ./FOREACH-README.md for more details <- TODO: @@@ Write theese README files OR remove this link + add annotation here (to all commands)
|
|
9
|
+
* @private within the commands folder
|
|
10
|
+
*/
|
|
11
|
+
export declare const foreachCommandParser: PipelineTemplateCommandParser<ForeachCommand>;
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🍭] Make .ptbk.md file with examples of the FOREACH command and also with wrong syntax and logic
|
|
14
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PipelineTemplateCommandParser } from '../_common/types/CommandParser';
|
|
2
|
+
import type { FormatCommand } from './FormatCommand';
|
|
3
|
+
/**
|
|
4
|
+
* Parses the format command
|
|
5
|
+
*
|
|
6
|
+
* @see ./FORMAT-README.md for more details
|
|
7
|
+
* @private within the commands folder
|
|
8
|
+
*/
|
|
9
|
+
export declare const formatCommandParser: PipelineTemplateCommandParser<FormatCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineTemplateCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { JokerCommand } from './JokerCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the joker command
|
|
@@ -6,4 +6,4 @@ import type { JokerCommand } from './JokerCommand';
|
|
|
6
6
|
* @see ./JOKER-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const jokerCommandParser:
|
|
9
|
+
export declare const jokerCommandParser: PipelineTemplateCommandParser<JokerCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineHeadCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { KnowledgeCommand } from './KnowledgeCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the knowledge command
|
|
@@ -6,4 +6,4 @@ import type { KnowledgeCommand } from './KnowledgeCommand';
|
|
|
6
6
|
* @see ./KNOWLEDGE-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const knowledgeCommandParser:
|
|
9
|
+
export declare const knowledgeCommandParser: PipelineHeadCommandParser<KnowledgeCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineBothCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { ModelCommand } from './ModelCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the model command
|
|
@@ -6,4 +6,4 @@ import type { ModelCommand } from './ModelCommand';
|
|
|
6
6
|
* @see ./MODEL-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const modelCommandParser:
|
|
9
|
+
export declare const modelCommandParser: PipelineBothCommandParser<ModelCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineBothCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { ParameterCommand } from './ParameterCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the parameter command
|
|
@@ -6,4 +6,4 @@ import type { ParameterCommand } from './ParameterCommand';
|
|
|
6
6
|
* @see ./PARAMETER-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const parameterCommandParser:
|
|
9
|
+
export declare const parameterCommandParser: PipelineBothCommandParser<ParameterCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineBothCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { PersonaCommand } from './PersonaCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the persona command
|
|
@@ -6,4 +6,4 @@ import type { PersonaCommand } from './PersonaCommand';
|
|
|
6
6
|
* @see ./PERSONA-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const personaCommandParser:
|
|
9
|
+
export declare const personaCommandParser: PipelineBothCommandParser<PersonaCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineTemplateCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { PostprocessCommand } from './PostprocessCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the postprocess command
|
|
@@ -6,4 +6,4 @@ import type { PostprocessCommand } from './PostprocessCommand';
|
|
|
6
6
|
* @see ./POSTPROCESS-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const postprocessCommandParser:
|
|
9
|
+
export declare const postprocessCommandParser: PipelineTemplateCommandParser<PostprocessCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineHeadCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { PromptbookVersionCommand } from './PromptbookVersionCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the PROMPTBOOK_VERSION command
|
|
@@ -6,4 +6,4 @@ import type { PromptbookVersionCommand } from './PromptbookVersionCommand';
|
|
|
6
6
|
* @see ./PROMPTBOOK_VERSION-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const promptbookVersionCommandParser:
|
|
9
|
+
export declare const promptbookVersionCommandParser: PipelineHeadCommandParser<PromptbookVersionCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineHeadCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { UrlCommand } from './UrlCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the url command
|
|
@@ -6,4 +6,4 @@ import type { UrlCommand } from './UrlCommand';
|
|
|
6
6
|
* @see ./URL-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const urlCommandParser:
|
|
9
|
+
export declare const urlCommandParser: PipelineHeadCommandParser<UrlCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineHeadCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { ActionCommand } from './ActionCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the action command
|
|
@@ -6,4 +6,4 @@ import type { ActionCommand } from './ActionCommand';
|
|
|
6
6
|
* @see ./ACTION-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const actionCommandParser:
|
|
9
|
+
export declare const actionCommandParser: PipelineHeadCommandParser<ActionCommand>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineHeadCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { InstrumentCommand } from './InstrumentCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the instrument command
|
|
@@ -6,4 +6,4 @@ import type { InstrumentCommand } from './InstrumentCommand';
|
|
|
6
6
|
* @see ./INSTRUMENT-README.md for more details
|
|
7
7
|
* @private within the commands folder
|
|
8
8
|
*/
|
|
9
|
-
export declare const instrumentCommandParser:
|
|
9
|
+
export declare const instrumentCommandParser: PipelineHeadCommandParser<InstrumentCommand>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineBothCommandParser } from '../_common/types/CommandParser';
|
|
2
2
|
import type { BoilerplateCommand } from './BoilerplateCommand';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the boilerplate command
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.ptbk.md` file
|
|
7
|
+
*
|
|
8
|
+
* @see ./BOILERPLATE-README.md for more details <- TODO: @@@ Write theese README files OR remove this link + add annotation here (to all commands)
|
|
7
9
|
* @private within the commands folder
|
|
8
10
|
*/
|
|
9
|
-
export declare const boilerplateCommandParser:
|
|
11
|
+
export declare const boilerplateCommandParser: PipelineBothCommandParser<BoilerplateCommand>;
|
|
10
12
|
/**
|
|
11
|
-
* TODO:
|
|
13
|
+
* TODO: !!!!!! Make .ptbk.md file with examples of the BOILERPLATE command and fail
|
|
12
14
|
*/
|
|
@@ -5,7 +5,7 @@ import type { CommandUsagePlace } from './types/CommandUsagePlaces';
|
|
|
5
5
|
* Parses one line of ul/ol to command
|
|
6
6
|
*
|
|
7
7
|
* @returns parsed command object
|
|
8
|
-
* @throws {
|
|
8
|
+
* @throws {ParseError} if the command is invalid
|
|
9
9
|
*
|
|
10
10
|
* @private within the pipelineStringToJson
|
|
11
11
|
*/
|