@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
|
@@ -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';
|
|
@@ -12,7 +12,7 @@ import type { Expectations } from './Expectations';
|
|
|
12
12
|
/**
|
|
13
13
|
* Common properties of all prompt 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
|
|
@@ -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
88
|
* Name of the parameter that is the result of the prompt 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,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
|
*
|
|
@@ -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/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0-1",
|
|
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/node.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.
|
|
50
|
+
"@promptbook/core": "0.68.0-1"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|