@promptbook/core 0.36.4 → 0.38.0
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 +116 -61
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/wizzard.index.d.ts +3 -0
- package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/execution/ExecutionTools.d.ts +2 -2
- package/esm/typings/execution/NaturalExecutionTools.d.ts +2 -2
- package/esm/typings/execution/PromptResult.d.ts +3 -4
- package/esm/typings/execution/PromptbookExecutor.d.ts +2 -2
- package/esm/typings/execution/ScriptExecutionTools.d.ts +5 -5
- package/esm/typings/execution/UserInterfaceTools.d.ts +4 -4
- package/esm/typings/execution/createPromptbookExecutor.d.ts +3 -2
- package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/{IAutomaticTranslator.d.ts → AutomaticTranslator.d.ts} +2 -2
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +3 -3
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +2 -2
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +5 -5
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
- package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +4 -4
- package/esm/typings/types/Command.d.ts +20 -19
- package/esm/typings/types/ModelRequirements.d.ts +3 -3
- package/esm/typings/types/Prompt.d.ts +2 -2
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
- package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +6 -4
- package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -2
- package/esm/typings/types/TaskProgress.d.ts +2 -2
- package/esm/typings/types/typeAliases.d.ts +0 -26
- package/esm/typings/utils/markdown-json/MarkdownStructure.d.ts +2 -2
- package/esm/typings/wizzard/Wizzard.d.ts +3 -0
- package/esm/typings/wizzard/sample.d.ts +1 -0
- package/package.json +1 -1
- package/umd/index.umd.js +116 -61
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/wizzard.index.d.ts +3 -0
- package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +2 -2
- package/umd/typings/execution/ExecutionTools.d.ts +2 -2
- package/umd/typings/execution/NaturalExecutionTools.d.ts +2 -2
- package/umd/typings/execution/PromptResult.d.ts +3 -4
- package/umd/typings/execution/PromptbookExecutor.d.ts +2 -2
- package/umd/typings/execution/ScriptExecutionTools.d.ts +5 -5
- package/umd/typings/execution/UserInterfaceTools.d.ts +4 -4
- package/umd/typings/execution/createPromptbookExecutor.d.ts +3 -2
- package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +2 -2
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/{IAutomaticTranslator.d.ts → AutomaticTranslator.d.ts} +2 -2
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +3 -3
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +2 -2
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +5 -5
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
- package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +4 -4
- package/umd/typings/types/Command.d.ts +20 -19
- package/umd/typings/types/ModelRequirements.d.ts +3 -3
- package/umd/typings/types/Prompt.d.ts +2 -2
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
- package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +6 -4
- package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -2
- package/umd/typings/types/TaskProgress.d.ts +2 -2
- package/umd/typings/types/typeAliases.d.ts +0 -26
- package/umd/typings/utils/markdown-json/MarkdownStructure.d.ts +2 -2
- package/umd/typings/wizzard/Wizzard.d.ts +3 -0
- package/umd/typings/wizzard/sample.d.ts +1 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/ITranslatorOptions.d.ts +0 -4
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/ITranslatorOptions.d.ts +0 -4
|
@@ -13,43 +13,43 @@ export type Command = PromptbookUrlCommand | PromptbookVersionCommand | ExecuteC
|
|
|
13
13
|
* - It is used for backward compatibility
|
|
14
14
|
* - It is defined per whole .promptbook file in the header
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type PromptbookUrlCommand = {
|
|
17
17
|
readonly type: 'PROMPTBOOK_URL';
|
|
18
18
|
readonly promptbookUrl: URL;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
/**
|
|
21
21
|
* PromptbookVersion command tells which version is .promptbook file using
|
|
22
22
|
*
|
|
23
23
|
* - It is used for backward compatibility
|
|
24
24
|
* - It is defined per whole .promptbook file in the header
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type PromptbookVersionCommand = {
|
|
27
27
|
readonly type: 'PROMPTBOOK_VERSION';
|
|
28
28
|
readonly promptbookVersion: string_version;
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
/**
|
|
31
31
|
* Execute command tells how to execute the section
|
|
32
32
|
* It can be either prompt template, script or SIMPLE TEMPLATE etc.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type ExecuteCommand = {
|
|
35
35
|
readonly type: 'EXECUTE';
|
|
36
36
|
readonly executionType: ExecutionType;
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
39
|
* Model command tells which model and modelRequirements to use for the prompt template. execution
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export type ModelCommand = {
|
|
42
42
|
readonly type: 'MODEL';
|
|
43
43
|
readonly key: keyof ModelRequirements;
|
|
44
44
|
readonly value: any;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
/**
|
|
47
47
|
* Joker parameter is used instead of executing the prompt template if it meet the expectations requirements
|
|
48
48
|
*/
|
|
49
|
-
export
|
|
49
|
+
export type JokerCommand = {
|
|
50
50
|
readonly type: 'JOKER';
|
|
51
51
|
readonly parameterName: string_name;
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
/**
|
|
54
54
|
* Parameter command describes one parameter of the prompt template
|
|
55
55
|
*
|
|
@@ -57,20 +57,21 @@ export interface JokerCommand {
|
|
|
57
57
|
* - It can have description
|
|
58
58
|
* - In description it can have simple formatting BUT not markdown structure or reference to other parameters
|
|
59
59
|
*/
|
|
60
|
-
export
|
|
60
|
+
export type ParameterCommand = {
|
|
61
61
|
readonly type: 'PARAMETER';
|
|
62
|
-
readonly
|
|
62
|
+
readonly isInput: boolean;
|
|
63
|
+
readonly isOutput: boolean;
|
|
63
64
|
readonly parameterName: string_name;
|
|
64
65
|
readonly parameterDescription: string_markdown_text | null;
|
|
65
|
-
}
|
|
66
|
+
};
|
|
66
67
|
/**
|
|
67
68
|
* Postprocess command describes which function to use for postprocessing
|
|
68
69
|
* This will be created as separate EXECUTE SCRIPT block bellow
|
|
69
70
|
*/
|
|
70
|
-
export
|
|
71
|
+
export type PostprocessCommand = {
|
|
71
72
|
readonly type: 'POSTPROCESS';
|
|
72
73
|
readonly functionName: string_name;
|
|
73
|
-
}
|
|
74
|
+
};
|
|
74
75
|
/**
|
|
75
76
|
* Expect command describes the desired output of the prompt template (after post-processing)
|
|
76
77
|
* It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
@@ -82,16 +83,16 @@ export type ExpectCommand = ExpectAmountCommand | ExpectFormatCommand;
|
|
|
82
83
|
*
|
|
83
84
|
* Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units.
|
|
84
85
|
*/
|
|
85
|
-
export
|
|
86
|
+
export type ExpectAmountCommand = {
|
|
86
87
|
readonly type: 'EXPECT_AMOUNT';
|
|
87
88
|
readonly sign: 'EXACTLY' | 'MINIMUM' | 'MAXIMUM';
|
|
88
89
|
readonly unit: ExpectationUnit;
|
|
89
90
|
readonly amount: ExpectationAmount;
|
|
90
|
-
}
|
|
91
|
+
};
|
|
91
92
|
/**
|
|
92
93
|
* Represents a command that expects a specific format.
|
|
93
94
|
*/
|
|
94
|
-
export
|
|
95
|
+
export type ExpectFormatCommand = {
|
|
95
96
|
readonly type: 'EXPECT_FORMAT';
|
|
96
97
|
readonly format: 'JSON';
|
|
97
|
-
}
|
|
98
|
+
};
|
|
@@ -7,13 +7,13 @@ export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT"];
|
|
|
7
7
|
* - **COMPLETION** - model that takes prompt and writes the rest of the text
|
|
8
8
|
* - **CHAT** - model that takes prompt and previous messages and returns response
|
|
9
9
|
*/
|
|
10
|
-
export type ModelVariant =
|
|
10
|
+
export type ModelVariant = typeof MODEL_VARIANTS[number];
|
|
11
11
|
/**
|
|
12
12
|
* Abstract way to specify the LLM. It does not specify the LLM with concrete version itself, only the requirements for the LLM.
|
|
13
13
|
*
|
|
14
14
|
* @see https://github.com/webgptorg/promptbook#model-requirements
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type ModelRequirements = {
|
|
17
17
|
/**
|
|
18
18
|
* Model variant describes the very general type of the model
|
|
19
19
|
*
|
|
@@ -34,7 +34,7 @@ export interface ModelRequirements {
|
|
|
34
34
|
* Maximum number of tokens that can be generated by the model
|
|
35
35
|
*/
|
|
36
36
|
readonly maxTokens?: number;
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
39
|
* TODO: Maybe figure out better word than "variant"
|
|
40
40
|
* TODO: Add here more requirement options like max context size, max tokens, etc.
|
|
@@ -5,7 +5,7 @@ import type { ModelRequirements } from './ModelRequirements';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook#prompt
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type Prompt = {
|
|
9
9
|
/**
|
|
10
10
|
* The title of the prompt
|
|
11
11
|
*
|
|
@@ -35,7 +35,7 @@ export interface Prompt {
|
|
|
35
35
|
* Note: This is redundant (same information is in promptbookUrl+content) but useful for logging and debugging
|
|
36
36
|
*/
|
|
37
37
|
readonly parameters: Record<string_name, string>;
|
|
38
|
-
}
|
|
38
|
+
};
|
|
39
39
|
/**
|
|
40
40
|
* TODO: [✔] Check ModelRequirements in runtime
|
|
41
41
|
*/
|
|
@@ -10,14 +10,14 @@ export type PromptTemplateJson = NaturalTemplateJson | SimpleTemplateJson | Scri
|
|
|
10
10
|
/**
|
|
11
11
|
* Template for prompt to LLM
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type NaturalTemplateJson = PromptTemplateJsonCommon & {
|
|
14
14
|
readonly executionType: 'PROMPT_TEMPLATE';
|
|
15
15
|
/**
|
|
16
16
|
* Requirements for the model
|
|
17
17
|
* - This is required only for executionType PROMPT_TEMPLATE
|
|
18
18
|
*/
|
|
19
19
|
readonly modelRequirements: ModelRequirements;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
/**
|
|
22
22
|
* Units of text measurement
|
|
23
23
|
*/
|
|
@@ -2,7 +2,7 @@ import { string_name } from '../typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Describes one parameter of the promptbook
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type PromptTemplateParameterJson = {
|
|
6
6
|
/**
|
|
7
7
|
* Name of the parameter
|
|
8
8
|
* - It must be unique across the pipeline
|
|
@@ -11,13 +11,15 @@ export interface PromptTemplateParameterJson {
|
|
|
11
11
|
readonly name: string_name;
|
|
12
12
|
/**
|
|
13
13
|
* The parameter is input of the pipeline
|
|
14
|
-
*
|
|
15
|
-
* Note: OUTPUT PARAMETER is every parameter including input one
|
|
16
14
|
*/
|
|
17
15
|
readonly isInput: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The parameter is output of the pipeline
|
|
18
|
+
*/
|
|
19
|
+
readonly isOutput: boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Description of the parameter
|
|
20
22
|
* - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
21
23
|
*/
|
|
22
24
|
readonly description?: string;
|
|
23
|
-
}
|
|
25
|
+
};
|
|
@@ -7,7 +7,7 @@ import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
|
7
7
|
*
|
|
8
8
|
* @see https://github.com/webgptorg/promptbook#promptbook
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type PromptbookJson = {
|
|
11
11
|
/**
|
|
12
12
|
* Unique identifier of the promptbook
|
|
13
13
|
*
|
|
@@ -40,7 +40,7 @@ export interface PromptbookJson {
|
|
|
40
40
|
* Sequence of prompt templates that are chained together to form a pipeline
|
|
41
41
|
*/
|
|
42
42
|
readonly promptTemplates: Array<PromptTemplateJson>;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
/**
|
|
45
45
|
* TODO: [🧠] Best format of this code?
|
|
46
46
|
* There must be possible to make
|
|
@@ -3,7 +3,7 @@ import { string_markdown_text, string_name } from './typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* TaskProgress represents the progress of a Promptbook execution.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type TaskProgress = {
|
|
7
7
|
/**
|
|
8
8
|
* The unique name of the task.
|
|
9
9
|
*
|
|
@@ -39,4 +39,4 @@ export interface TaskProgress {
|
|
|
39
39
|
* The parameter value or null if the parameter is not yet processed.
|
|
40
40
|
*/
|
|
41
41
|
readonly parameterValue: string | null;
|
|
42
|
-
}
|
|
42
|
+
};
|
|
@@ -325,37 +325,12 @@ export type string_person_fullname = string;
|
|
|
325
325
|
* For example `"Pavol Hejný <pavol@hejny.org> (https://pavolhejny.com)"`
|
|
326
326
|
*/
|
|
327
327
|
export type string_person_profile = string;
|
|
328
|
-
/**
|
|
329
|
-
* Full profile of the person with his email and web (like in package.json)
|
|
330
|
-
*/
|
|
331
|
-
export interface IPersonProfile {
|
|
332
|
-
readonly name?: string_person_fullname;
|
|
333
|
-
/**
|
|
334
|
-
* Note: Photos are taken from Gravatar by email
|
|
335
|
-
*/
|
|
336
|
-
readonly email?: string_email;
|
|
337
|
-
readonly url?: string_url;
|
|
338
|
-
}
|
|
339
328
|
/**
|
|
340
329
|
* Semantic helper
|
|
341
330
|
*
|
|
342
331
|
* For example `"MIT"`
|
|
343
332
|
*/
|
|
344
333
|
export type string_license = string;
|
|
345
|
-
/**
|
|
346
|
-
* License with its type and url like in package.json
|
|
347
|
-
*/
|
|
348
|
-
export interface ILicense {
|
|
349
|
-
readonly type?: string_license;
|
|
350
|
-
readonly url?: string;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Repository with its type and url like in package.json
|
|
354
|
-
*/
|
|
355
|
-
export interface IRepository {
|
|
356
|
-
readonly type?: string | 'git';
|
|
357
|
-
readonly url?: string;
|
|
358
|
-
}
|
|
359
334
|
/**
|
|
360
335
|
* Semantic helper for attributes
|
|
361
336
|
*
|
|
@@ -392,7 +367,6 @@ export type string_translate_name_not_normalized = string;
|
|
|
392
367
|
* Implementing ISO 639-1
|
|
393
368
|
*
|
|
394
369
|
* TODO: Probably use enum
|
|
395
|
-
* TODO: Rename - remove string_ prefix like ITranslateLanguageCode
|
|
396
370
|
*/
|
|
397
371
|
export type string_translate_language = 'en' | 'cs';
|
|
398
372
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @private within the library
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type MarkdownStructure = {
|
|
7
7
|
/**
|
|
8
8
|
* The section level of the markdown file.
|
|
9
9
|
* h1 is level 1, h2 is level 2, etc.
|
|
@@ -22,4 +22,4 @@ export interface MarkdownStructure {
|
|
|
22
22
|
* The sub-sections of current section which are recursively structured.
|
|
23
23
|
*/
|
|
24
24
|
sections: MarkdownStructure[];
|
|
25
|
-
}
|
|
25
|
+
};
|