@promptbook/remote-server 0.68.0-0 → 0.68.0-2
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 +4 -4
- package/esm/index.es.js +11 -8
- 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/Command.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 +3 -3
- 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/renameParameter.d.ts +2 -2
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.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 +4 -5
- 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 +13 -8
- 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} +12 -13
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +4 -2
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
- 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 +11 -8
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TemplateJson } from '../types/PipelineJson/TemplateJson';
|
|
3
3
|
import type { PrepareOptions } from './PrepareOptions';
|
|
4
|
-
type PrepareTemplateInput = Pick<PipelineJson, '
|
|
4
|
+
type PrepareTemplateInput = Pick<PipelineJson, 'templates' | 'parameters'> & {
|
|
5
5
|
/**
|
|
6
6
|
* @@@
|
|
7
7
|
*/
|
|
@@ -9,9 +9,9 @@ type PrepareTemplateInput = Pick<PipelineJson, 'promptTemplates' | 'parameters'>
|
|
|
9
9
|
};
|
|
10
10
|
type PreparedTemplates = {
|
|
11
11
|
/**
|
|
12
|
-
* @@@ Sequence of
|
|
12
|
+
* @@@ Sequence of templates that are chained together to form a pipeline
|
|
13
13
|
*/
|
|
14
|
-
readonly
|
|
14
|
+
readonly templatesPrepared: Array<TemplateJson>;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* @@@
|
|
@@ -28,5 +28,4 @@ export {};
|
|
|
28
28
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
29
29
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
30
30
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
31
|
-
* TODO: [🧠][🥜]
|
|
32
31
|
*/
|
|
@@ -8,5 +8,5 @@ export declare function unpreparePipeline(pipeline: PipelineJson): PipelineJson;
|
|
|
8
8
|
/**
|
|
9
9
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
10
10
|
* TODO: Write tests for `preparePipeline`
|
|
11
|
-
* TODO: [🍙] Make some
|
|
11
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
12
12
|
*/
|
|
@@ -52,6 +52,8 @@ export type EmbeddingModelRequirements = CommonModelRequirements & {
|
|
|
52
52
|
* Common properties for all model requirements variants
|
|
53
53
|
*
|
|
54
54
|
* Note: [🚉] This is fully serializable as JSON
|
|
55
|
+
*
|
|
56
|
+
* @private just abstract the common properties of the model requirements
|
|
55
57
|
*/
|
|
56
58
|
export type CommonModelRequirements = {
|
|
57
59
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
2
|
+
/**
|
|
3
|
+
* Template for prompt to user
|
|
4
|
+
*
|
|
5
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
6
|
+
* @see https://github.com/webgptorg/promptbook/discussions/76
|
|
7
|
+
*/
|
|
8
|
+
export type DialogTemplateJson = TemplateJsonCommon & {
|
|
9
|
+
readonly blockType: 'DIALOG_TEMPLATE';
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
13
|
+
*/
|
|
@@ -36,5 +36,5 @@ export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTEN
|
|
|
36
36
|
*/
|
|
37
37
|
export type ExpectationAmount = number_integer & (number_positive | 0);
|
|
38
38
|
/**
|
|
39
|
-
* TODO: [💝] Unite object for expecting amount and format - remove
|
|
39
|
+
* TODO: [💝] Unite object for expecting amount and format - remove format
|
|
40
40
|
*/
|
package/esm/typings/src/types/PipelineJson/{PromptTemplateParameterJson.d.ts → ParameterJson.d.ts}
RENAMED
|
@@ -6,7 +6,7 @@ import type { string_parameter_value } from '../typeAliases';
|
|
|
6
6
|
*
|
|
7
7
|
* Note: [🚉] This is fully serializable as JSON
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type ParameterJson = {
|
|
10
10
|
/**
|
|
11
11
|
* Name of the parameter
|
|
12
12
|
* - It must be unique across the pipeline
|
|
@@ -34,5 +34,5 @@ export type PromptTemplateParameterJson = {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
37
|
-
* TODO: [🍙] Make some
|
|
37
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
38
38
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModelRequirements } from '../ModelRequirements';
|
|
1
2
|
import type { string_file_path } from '../typeAliases';
|
|
2
3
|
import type { string_markdown_text } from '../typeAliases';
|
|
3
4
|
import type { string_pipeline_url } from '../typeAliases';
|
|
@@ -5,14 +6,14 @@ import type { string_semantic_version } from '../typeAliases';
|
|
|
5
6
|
import type { KnowledgePiecePreparedJson } from './KnowledgePieceJson';
|
|
6
7
|
import type { KnowledgeSourceJson } from './KnowledgeSourceJson';
|
|
7
8
|
import type { KnowledgeSourcePreparedJson } from './KnowledgeSourceJson';
|
|
9
|
+
import type { ParameterJson } from './ParameterJson';
|
|
8
10
|
import type { PersonaJson } from './PersonaJson';
|
|
9
11
|
import type { PersonaPreparedJson } from './PersonaJson';
|
|
10
12
|
import type { PreparationJson } from './PreparationJson';
|
|
11
|
-
import type {
|
|
12
|
-
import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
13
|
+
import type { TemplateJson } from './TemplateJson';
|
|
13
14
|
/**
|
|
14
15
|
* Promptbook is the **core concept of this package**.
|
|
15
|
-
* It represents a series of
|
|
16
|
+
* It represents a series of templates chained together to form a pipeline / one big template with input and result parameters.
|
|
16
17
|
*
|
|
17
18
|
* Note: [🚉] This is fully serializable as JSON
|
|
18
19
|
*
|
|
@@ -26,7 +27,7 @@ export type PipelineJson = {
|
|
|
26
27
|
* Note: It must use HTTPs URL
|
|
27
28
|
* Tip: You can do versioning in the URL
|
|
28
29
|
* For example: https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md@1.0.0
|
|
29
|
-
* Warning: Do not hash part of the URL, hash part is used for identification of the
|
|
30
|
+
* Warning: Do not hash part of the URL, hash part is used for identification of the template in the pipeline
|
|
30
31
|
*/
|
|
31
32
|
readonly pipelineUrl?: string_pipeline_url;
|
|
32
33
|
/**
|
|
@@ -50,11 +51,15 @@ export type PipelineJson = {
|
|
|
50
51
|
/**
|
|
51
52
|
* Set of variables that are used across the pipeline
|
|
52
53
|
*/
|
|
53
|
-
readonly parameters: Array<
|
|
54
|
+
readonly parameters: Array<ParameterJson>;
|
|
54
55
|
/**
|
|
55
|
-
*
|
|
56
|
+
* Default model requirements for the model for all `templates`
|
|
56
57
|
*/
|
|
57
|
-
readonly
|
|
58
|
+
readonly defaultModelRequirements?: Partial<ModelRequirements>;
|
|
59
|
+
/**
|
|
60
|
+
* Sequence of templates that are chained together to form a pipeline
|
|
61
|
+
*/
|
|
62
|
+
readonly templates: Array<TemplateJson>;
|
|
58
63
|
/**
|
|
59
64
|
* Set of information that are used as external knowledge in the pipeline
|
|
60
65
|
*
|
|
@@ -81,7 +86,7 @@ export type PipelineJson = {
|
|
|
81
86
|
readonly preparations: Array<PreparationJson>;
|
|
82
87
|
};
|
|
83
88
|
/**
|
|
84
|
-
* TODO: [🍙] Make some
|
|
89
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
85
90
|
* TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
|
|
86
91
|
* Note: [💼] There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
|
|
87
92
|
* But then immediately reverted back to the single type
|
|
@@ -16,7 +16,7 @@ export type PreparationJson = {
|
|
|
16
16
|
readonly usage: PromptResultUsage;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* TODO: [🍙] Make some
|
|
19
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
20
20
|
* TODO: Maybe put here used `modelName`
|
|
21
21
|
* TODO: [🍥] When using `date` it changes all samples .ptbk.json files each time so until some more elegant solution omit the time from prepared pipeline
|
|
22
22
|
*/
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { ScriptJson } from './ScriptJson';
|
|
5
|
-
import type { SimpleTemplateJson } from './SimpleTemplateJson';
|
|
1
|
+
import type { ModelRequirements } from '../ModelRequirements';
|
|
2
|
+
import type { string_name } from '../typeAliases';
|
|
3
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
5
|
+
* Template for prompt to LLM
|
|
8
6
|
*
|
|
9
7
|
* Note: [🚉] This is fully serializable as JSON
|
|
10
8
|
*/
|
|
11
|
-
export type PromptTemplateJson =
|
|
9
|
+
export type PromptTemplateJson = TemplateJsonCommon & {
|
|
10
|
+
readonly blockType: 'PROMPT_TEMPLATE';
|
|
11
|
+
/**
|
|
12
|
+
* Name of the persona who will be responding to this prompt
|
|
13
|
+
*/
|
|
14
|
+
readonly personaName?: string_name;
|
|
15
|
+
/**
|
|
16
|
+
* Requirements for the model
|
|
17
|
+
* - This is required only for blockType PROMPT_TEMPLATE
|
|
18
|
+
*/
|
|
19
|
+
readonly modelRequirements?: Partial<ModelRequirements>;
|
|
20
|
+
};
|
|
12
21
|
/**
|
|
13
|
-
* TODO: [
|
|
14
|
-
*
|
|
22
|
+
* TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
|
|
23
|
+
* @see https://github.com/webgptorg/promptbook/discussions/79
|
|
24
|
+
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
25
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
15
26
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ScriptLanguage } from '../ScriptLanguage';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
3
3
|
/**
|
|
4
4
|
* Template for script execution
|
|
5
5
|
*
|
|
6
6
|
* Note: [🚉] This is fully serializable as JSON
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/77
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
10
|
-
readonly blockType: '
|
|
9
|
+
export type ScriptTemplateJson = TemplateJsonCommon & {
|
|
10
|
+
readonly blockType: 'SCRIPT_TEMPLATE';
|
|
11
11
|
/**
|
|
12
12
|
* Language of the script
|
|
13
13
|
* - This is required only for blockType SCRIPT
|
|
@@ -16,5 +16,5 @@ export type ScriptJson = PromptTemplateJsonCommon & {
|
|
|
16
16
|
readonly contentLanguage?: ScriptLanguage;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* TODO: [🍙] Make some
|
|
19
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
20
20
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
2
2
|
/**
|
|
3
3
|
* Template for simple concatenation of strings
|
|
4
4
|
*
|
|
5
5
|
* Note: [🚉] This is fully serializable as JSON
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook/discussions/17
|
|
7
7
|
*/
|
|
8
|
-
export type SimpleTemplateJson =
|
|
8
|
+
export type SimpleTemplateJson = TemplateJsonCommon & {
|
|
9
9
|
readonly blockType: 'SIMPLE_TEMPLATE';
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🍙] Make some
|
|
12
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
13
13
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ___or___ } from '../../utils/organization/___or___';
|
|
2
|
+
import type { DialogTemplateJson } from './DialogTemplateJson';
|
|
3
|
+
import type { PromptTemplateJson } from './PromptTemplateJson';
|
|
4
|
+
import type { ScriptTemplateJson } from './ScriptTemplateJson';
|
|
5
|
+
import type { SimpleTemplateJson } from './SimpleTemplateJson';
|
|
6
|
+
/**
|
|
7
|
+
* Describes one (prompt) template in the promptbook
|
|
8
|
+
*
|
|
9
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
10
|
+
*/
|
|
11
|
+
export type TemplateJson = PromptTemplateJson | SimpleTemplateJson | ScriptTemplateJson | DialogTemplateJson | ___or___ | ___or___;
|
package/esm/typings/src/types/PipelineJson/{PromptTemplateJsonCommon.d.ts → TemplateJsonCommon.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlockType } from '../../commands/BLOCK/BlockTypes';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
|
|
3
3
|
import type { string_javascript } from '../typeAliases';
|
|
4
4
|
import type { string_markdown } from '../typeAliases';
|
|
5
5
|
import type { string_markdown_text } from '../typeAliases';
|
|
@@ -10,41 +10,41 @@ import type { string_prompt } from '../typeAliases';
|
|
|
10
10
|
import type { string_template } from '../typeAliases';
|
|
11
11
|
import type { Expectations } from './Expectations';
|
|
12
12
|
/**
|
|
13
|
-
* Common properties of all
|
|
13
|
+
* Common properties of all templates
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface TemplateJsonCommon {
|
|
16
16
|
/**
|
|
17
17
|
* Name of the template
|
|
18
18
|
* - It must be unique across the pipeline
|
|
19
19
|
* - It should start uppercase and can contain letters and numbers
|
|
20
|
-
* - The pipelineUrl together with hash and name are used to identify the
|
|
20
|
+
* - The pipelineUrl together with hash and name are used to identify the template in the pipeline
|
|
21
21
|
*/
|
|
22
22
|
readonly name: string_name;
|
|
23
23
|
/**
|
|
24
|
-
* Title of the
|
|
24
|
+
* Title of the template
|
|
25
25
|
* It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
26
26
|
*/
|
|
27
27
|
readonly title: string;
|
|
28
28
|
/**
|
|
29
|
-
* Description of the
|
|
29
|
+
* Description of the template
|
|
30
30
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
31
31
|
*/
|
|
32
32
|
readonly description?: string_markdown_text;
|
|
33
33
|
/**
|
|
34
|
-
* List of parameter names that are used in the
|
|
34
|
+
* List of parameter names that are used in the template and must be defined before the template is executed
|
|
35
35
|
*
|
|
36
36
|
* Note: Joker is one of the dependent parameters
|
|
37
37
|
*/
|
|
38
38
|
readonly dependentParameterNames: Array<string_parameter_name>;
|
|
39
39
|
/**
|
|
40
|
-
* If theese parameters meet the expectations requirements, they are used instead of executing this
|
|
40
|
+
* If theese parameters meet the expectations requirements, they are used instead of executing this template
|
|
41
41
|
*
|
|
42
42
|
* @see https://github.com/webgptorg/promptbook/discussions/66
|
|
43
43
|
*/
|
|
44
44
|
readonly jokerParameterNames?: Array<string_parameter_name>;
|
|
45
45
|
/**
|
|
46
46
|
* Type of the execution
|
|
47
|
-
* This determines if the
|
|
47
|
+
* This determines if the template is send to LLM, user or some scripting evaluation
|
|
48
48
|
*/
|
|
49
49
|
readonly blockType: BlockType;
|
|
50
50
|
/**
|
|
@@ -62,7 +62,7 @@ export interface PromptTemplateJsonCommon {
|
|
|
62
62
|
*/
|
|
63
63
|
readonly preparedContent?: (string_prompt | string_javascript | string_markdown) & string_template;
|
|
64
64
|
/**
|
|
65
|
-
* List of postprocessing steps that are executed after the
|
|
65
|
+
* List of postprocessing steps that are executed after the template
|
|
66
66
|
*
|
|
67
67
|
* @see https://github.com/webgptorg/promptbook/discussions/31
|
|
68
68
|
*/
|
|
@@ -83,14 +83,13 @@ export interface PromptTemplateJsonCommon {
|
|
|
83
83
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
84
84
|
* @deprecated [💝]
|
|
85
85
|
*/
|
|
86
|
-
readonly
|
|
86
|
+
readonly format?: FormatCommand['format'];
|
|
87
87
|
/**
|
|
88
|
-
* Name of the parameter that is the result of the
|
|
88
|
+
* Name of the parameter that is the result of the template
|
|
89
89
|
*/
|
|
90
90
|
readonly resultingParameterName: string_name;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* TODO: [🧠][🥜]
|
|
94
93
|
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
95
94
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
96
95
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Promptbook is the **core concept of this package**.
|
|
3
|
-
* It represents a series of
|
|
3
|
+
* It represents a series of templates chained together to form a pipeline / one big template with input and result parameters.
|
|
4
4
|
*
|
|
5
5
|
* @see @@@ https://github.com/webgptorg/promptbook#promptbook
|
|
6
6
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
|
|
2
2
|
import type { ChatModelRequirements } from './ModelRequirements';
|
|
3
3
|
import type { CompletionModelRequirements } from './ModelRequirements';
|
|
4
4
|
import type { EmbeddingModelRequirements } from './ModelRequirements';
|
|
@@ -54,6 +54,8 @@ export type EmbeddingPrompt = CommonPrompt & {
|
|
|
54
54
|
* Common properties for all prompt results
|
|
55
55
|
*
|
|
56
56
|
* Note: [🚉] This is fully serializable as JSON
|
|
57
|
+
*
|
|
58
|
+
* @private just abstract the common properties of the prompts
|
|
57
59
|
*/
|
|
58
60
|
export type CommonPrompt = {
|
|
59
61
|
/**
|
|
@@ -89,7 +91,7 @@ export type CommonPrompt = {
|
|
|
89
91
|
* Note: Expectations are performed after all postprocessing steps
|
|
90
92
|
* @deprecated [💝]
|
|
91
93
|
*/
|
|
92
|
-
readonly
|
|
94
|
+
readonly format?: FormatCommand['format'];
|
|
93
95
|
/**
|
|
94
96
|
* Unique identifier of the pipeline with specific template name as hash
|
|
95
97
|
*
|
|
@@ -35,7 +35,7 @@ export type ExecutionReportJson = {
|
|
|
35
35
|
*/
|
|
36
36
|
readonly description?: string_markdown_text;
|
|
37
37
|
/**
|
|
38
|
-
* Sequence of
|
|
38
|
+
* Sequence of templates in order which were executed
|
|
39
39
|
*/
|
|
40
40
|
readonly promptExecutions: Array<ExecutionPromptReportJson>;
|
|
41
41
|
};
|
|
@@ -10,5 +10,6 @@ export declare function addAutoGeneratedSection(content: string_markdown, option
|
|
|
10
10
|
readonly sectionContent: string_markdown;
|
|
11
11
|
}): string_markdown;
|
|
12
12
|
/**
|
|
13
|
+
* TODO: !!!!!! Somw way how to connect this with commands
|
|
13
14
|
* TODO: [🏛] This can be part of markdown builder
|
|
14
15
|
*/
|
|
@@ -27,7 +27,7 @@ export type CodeBlock = {
|
|
|
27
27
|
*
|
|
28
28
|
* @param markdown any valid markdown
|
|
29
29
|
* @returns code blocks with language and content
|
|
30
|
-
* @throws {
|
|
30
|
+
* @throws {ParseError} if block is not closed properly
|
|
31
31
|
* @public exported from `@promptbook/markdown-utils`
|
|
32
32
|
*/
|
|
33
33
|
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>;
|
|
@@ -3,7 +3,7 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
3
3
|
/**
|
|
4
4
|
* Extracts exactly ONE code block from markdown.
|
|
5
5
|
*
|
|
6
|
-
* - When there are multiple or no code blocks the function throws a `
|
|
6
|
+
* - When there are multiple or no code blocks the function throws a `ParseError`
|
|
7
7
|
*
|
|
8
8
|
* Note: There are multiple simmilar function:
|
|
9
9
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
@@ -14,7 +14,7 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
14
14
|
* @param markdown any valid markdown
|
|
15
15
|
* @returns code block with language and content
|
|
16
16
|
* @public exported from `@promptbook/markdown-utils`
|
|
17
|
-
* @throws {
|
|
17
|
+
* @throws {ParseError} if there is not exactly one code block in the markdown
|
|
18
18
|
*/
|
|
19
19
|
export declare function extractOneBlockFromMarkdown(markdown: string_markdown): CodeBlock;
|
|
20
20
|
/***
|
|
@@ -9,5 +9,5 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function clonePipeline(pipeline: PipelineJson): PipelineJson;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🍙] Make some
|
|
12
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
13
13
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.68.0-
|
|
3
|
+
"version": "0.68.0-2",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.68.0-
|
|
50
|
+
"@promptbook/core": "0.68.0-2"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.68.0-1';
|
|
18
18
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
@@ -495,16 +495,19 @@
|
|
|
495
495
|
*
|
|
496
496
|
* @public exported from `@promptbook/core`
|
|
497
497
|
*/
|
|
498
|
-
var
|
|
499
|
-
__extends(
|
|
500
|
-
function
|
|
498
|
+
var ParseError = /** @class */ (function (_super) {
|
|
499
|
+
__extends(ParseError, _super);
|
|
500
|
+
function ParseError(message) {
|
|
501
501
|
var _this = _super.call(this, message) || this;
|
|
502
|
-
_this.name = '
|
|
503
|
-
Object.setPrototypeOf(_this,
|
|
502
|
+
_this.name = 'ParseError';
|
|
503
|
+
Object.setPrototypeOf(_this, ParseError.prototype);
|
|
504
504
|
return _this;
|
|
505
505
|
}
|
|
506
|
-
return
|
|
506
|
+
return ParseError;
|
|
507
507
|
}(Error));
|
|
508
|
+
/**
|
|
509
|
+
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
510
|
+
*/
|
|
508
511
|
|
|
509
512
|
/**
|
|
510
513
|
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
@@ -550,7 +553,7 @@
|
|
|
550
553
|
LimitReachedError: LimitReachedError,
|
|
551
554
|
NotFoundError: NotFoundError,
|
|
552
555
|
NotYetImplementedError: NotYetImplementedError,
|
|
553
|
-
|
|
556
|
+
ParseError: ParseError,
|
|
554
557
|
PipelineExecutionError: PipelineExecutionError,
|
|
555
558
|
PipelineLogicError: PipelineLogicError,
|
|
556
559
|
PipelineUrlError: PipelineUrlError,
|