@promptbook/core 0.35.1 → 0.36.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 +1 -1
- package/esm/index.es.js +126 -123
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/core.index.d.ts +8 -8
- package/esm/typings/_packages/remote-server.index.d.ts +2 -2
- package/esm/typings/_packages/types.index.d.ts +8 -8
- package/esm/typings/classes/PromptbookLibrary.d.ts +61 -0
- package/esm/typings/conversion/_importPromptbook.d.ts +12 -0
- package/esm/typings/conversion/promptbookStringToJson.d.ts +13 -0
- package/esm/typings/conversion/validatePromptbookJson.d.ts +26 -0
- package/{umd/typings/execution/PtpExecutor.d.ts → esm/typings/execution/PromptbookExecutor.d.ts} +5 -5
- package/esm/typings/execution/assertsExecutionSuccessful.d.ts +2 -2
- package/esm/typings/execution/createPromptbookExecutor.d.ts +40 -0
- package/esm/typings/execution/plugins/natural-execution-tools/mocked/joker.test.d.ts +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/mocked/mocked-chat.test.d.ts +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/mocked/mocked-completion.test.d.ts +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Error.d.ts → Promptbook_Server_Error.d.ts} +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Progress.d.ts → Promptbook_Server_Progress.d.ts} +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Request.d.ts → Promptbook_Server_Request.d.ts} +2 -2
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Response.d.ts → Promptbook_Server_Response.d.ts} +2 -2
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +3 -3
- package/{umd/typings/execution/plugins/natural-execution-tools/remote/runRemoteServer.d.ts → esm/typings/execution/plugins/natural-execution-tools/remote/startRemoteServer.d.ts} +2 -2
- package/esm/typings/types/Command.d.ts +12 -12
- package/esm/typings/types/Parameters.d.ts +3 -3
- package/esm/typings/types/Prompt.d.ts +5 -5
- package/{umd/typings/types/PromptTemplatePipelineJson → esm/typings/types/PromptbookJson}/PromptTemplateJson.d.ts +4 -4
- package/esm/typings/types/{PromptTemplatePipelineJson → PromptbookJson}/PromptTemplateParameterJson.d.ts +2 -2
- package/{umd/typings/types/PromptTemplatePipelineJson/PromptTemplatePipelineJson.d.ts → esm/typings/types/PromptbookJson/PromptbookJson.d.ts} +11 -15
- package/esm/typings/types/PromptbookString.d.ts +12 -0
- package/esm/typings/types/TaskProgress.d.ts +1 -1
- package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +10 -10
- package/esm/typings/types/typeAliases.d.ts +4 -4
- package/esm/typings/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/esm/typings/utils/expectation-counters/countLines.d.ts +1 -1
- package/esm/typings/utils/expectation-counters/countPages.d.ts +1 -1
- package/esm/typings/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/esm/typings/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/utils/expectation-counters/countWords.d.ts +1 -1
- package/esm/typings/utils/expectation-counters/index.d.ts +1 -1
- package/esm/typings/utils/isRunningInWhatever.d.ts +12 -0
- package/esm/typings/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +130 -127
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/core.index.d.ts +8 -8
- package/umd/typings/_packages/remote-server.index.d.ts +2 -2
- package/umd/typings/_packages/types.index.d.ts +8 -8
- package/umd/typings/classes/PromptbookLibrary.d.ts +61 -0
- package/umd/typings/conversion/_importPromptbook.d.ts +12 -0
- package/umd/typings/conversion/promptbookStringToJson.d.ts +13 -0
- package/umd/typings/conversion/validatePromptbookJson.d.ts +26 -0
- package/{esm/typings/execution/PtpExecutor.d.ts → umd/typings/execution/PromptbookExecutor.d.ts} +5 -5
- package/umd/typings/execution/assertsExecutionSuccessful.d.ts +2 -2
- package/umd/typings/execution/createPromptbookExecutor.d.ts +40 -0
- package/umd/typings/execution/plugins/natural-execution-tools/mocked/joker.test.d.ts +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/mocked/mocked-chat.test.d.ts +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/mocked/mocked-completion.test.d.ts +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Error.d.ts → Promptbook_Server_Error.d.ts} +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Progress.d.ts → Promptbook_Server_Progress.d.ts} +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Request.d.ts → Promptbook_Server_Request.d.ts} +2 -2
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/{Ptps_Response.d.ts → Promptbook_Server_Response.d.ts} +2 -2
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +3 -3
- package/{esm/typings/execution/plugins/natural-execution-tools/remote/runRemoteServer.d.ts → umd/typings/execution/plugins/natural-execution-tools/remote/startRemoteServer.d.ts} +2 -2
- package/umd/typings/types/Command.d.ts +12 -12
- package/umd/typings/types/Parameters.d.ts +3 -3
- package/umd/typings/types/Prompt.d.ts +5 -5
- package/{esm/typings/types/PromptTemplatePipelineJson → umd/typings/types/PromptbookJson}/PromptTemplateJson.d.ts +4 -4
- package/umd/typings/types/{PromptTemplatePipelineJson → PromptbookJson}/PromptTemplateParameterJson.d.ts +2 -2
- package/{esm/typings/types/PromptTemplatePipelineJson/PromptTemplatePipelineJson.d.ts → umd/typings/types/PromptbookJson/PromptbookJson.d.ts} +11 -15
- package/umd/typings/types/PromptbookString.d.ts +12 -0
- package/umd/typings/types/TaskProgress.d.ts +1 -1
- package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +10 -10
- package/umd/typings/types/typeAliases.d.ts +4 -4
- package/umd/typings/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/umd/typings/utils/expectation-counters/countLines.d.ts +1 -1
- package/umd/typings/utils/expectation-counters/countPages.d.ts +1 -1
- package/umd/typings/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/umd/typings/utils/expectation-counters/countSentences.d.ts +1 -1
- package/umd/typings/utils/expectation-counters/countWords.d.ts +1 -1
- package/umd/typings/utils/expectation-counters/index.d.ts +1 -1
- package/umd/typings/utils/isRunningInWhatever.d.ts +12 -0
- package/umd/typings/version.d.ts +1 -1
- package/esm/typings/classes/PromptTemplatePipelineLibrary.d.ts +0 -71
- package/esm/typings/config.d.ts +0 -12
- package/esm/typings/conversion/_importPtp.d.ts +0 -12
- package/esm/typings/conversion/promptTemplatePipelineStringToJson.d.ts +0 -13
- package/esm/typings/conversion/validatePromptTemplatePipelineJson.d.ts +0 -26
- package/esm/typings/execution/createPtpExecutor.d.ts +0 -40
- package/esm/typings/types/PromptTemplatePipelineString.d.ts +0 -16
- package/umd/typings/classes/PromptTemplatePipelineLibrary.d.ts +0 -71
- package/umd/typings/config.d.ts +0 -12
- package/umd/typings/conversion/_importPtp.d.ts +0 -12
- package/umd/typings/conversion/promptTemplatePipelineStringToJson.d.ts +0 -13
- package/umd/typings/conversion/validatePromptTemplatePipelineJson.d.ts +0 -26
- package/umd/typings/execution/createPtpExecutor.d.ts +0 -40
- package/umd/typings/types/PromptTemplatePipelineString.d.ts +0 -16
- /package/esm/typings/conversion/{promptTemplatePipelineStringToJson-syntaxErrors.test.d.ts → promptbookStringToJson-syntaxErrors.test.d.ts} +0 -0
- /package/esm/typings/conversion/{promptTemplatePipelineStringToJson.test.d.ts → promptbookStringToJson.test.d.ts} +0 -0
- /package/esm/typings/conversion/{validatePromptTemplatePipelineJson-logicErrors.test.d.ts → validatePromptbookJson-logicErrors.test.d.ts} +0 -0
- /package/esm/typings/conversion/{validatePromptTemplatePipelineJson.test.d.ts → validatePromptbookJson.test.d.ts} +0 -0
- /package/umd/typings/conversion/{promptTemplatePipelineStringToJson-syntaxErrors.test.d.ts → promptbookStringToJson-syntaxErrors.test.d.ts} +0 -0
- /package/umd/typings/conversion/{promptTemplatePipelineStringToJson.test.d.ts → promptbookStringToJson.test.d.ts} +0 -0
- /package/umd/typings/conversion/{validatePromptTemplatePipelineJson-logicErrors.test.d.ts → validatePromptbookJson-logicErrors.test.d.ts} +0 -0
- /package/umd/typings/conversion/{validatePromptTemplatePipelineJson.test.d.ts → validatePromptbookJson.test.d.ts} +0 -0
|
@@ -5,7 +5,7 @@ import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOption
|
|
|
5
5
|
*/
|
|
6
6
|
export interface RemoteNaturalExecutionToolsOptions extends CommonExecutionToolsOptions {
|
|
7
7
|
/**
|
|
8
|
-
* URL of the remote
|
|
8
|
+
* URL of the remote PROMPTBOOK server
|
|
9
9
|
* On this server will be connected to the socket.io server
|
|
10
10
|
*/
|
|
11
11
|
readonly remoteUrl: URL;
|
|
@@ -4,7 +4,7 @@ import { TaskProgress } from '../../../../../types/TaskProgress';
|
|
|
4
4
|
*
|
|
5
5
|
* This is sent from server to client arbitrarily and may be sent multiple times
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface Promptbook_Server_Progress {
|
|
8
8
|
/**
|
|
9
9
|
* The progress of text generation
|
|
10
10
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { client_id } from '
|
|
1
|
+
import type { client_id } from '../../../../../types/typeAliases';
|
|
2
2
|
import type { Prompt } from '../../../../../types/Prompt';
|
|
3
3
|
/**
|
|
4
4
|
* Socket.io progress for remote text generation
|
|
5
5
|
*
|
|
6
6
|
* This is a request from client to server
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface Promptbook_Server_Request {
|
|
9
9
|
/**
|
|
10
10
|
* Client responsible for the requests
|
|
11
11
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PromptResult } from '
|
|
1
|
+
import { PromptResult } from '../../../../PromptResult';
|
|
2
2
|
/**
|
|
3
3
|
* Socket.io error for remote text generation
|
|
4
4
|
*
|
|
5
5
|
* This is sent from server to client when the generated text is completed
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface Promptbook_Server_Response {
|
|
8
8
|
/**
|
|
9
9
|
* The result of the prompt
|
|
10
10
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PromptbookLibrary } from '../../../../../classes/PromptbookLibrary';
|
|
2
2
|
import type { client_id, string_uri } from '../../../../../types/typeAliases';
|
|
3
3
|
import type { CommonExecutionToolsOptions } from '../../../../CommonExecutionToolsOptions';
|
|
4
4
|
import type { NaturalExecutionTools } from '../../../../NaturalExecutionTools';
|
|
@@ -15,11 +15,11 @@ export interface RemoteServerOptions extends CommonExecutionToolsOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
readonly path: string_uri;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Promptbook library to use
|
|
19
19
|
*
|
|
20
20
|
* This is used to checkl validity of the prompt to prevent DDoS
|
|
21
21
|
*/
|
|
22
|
-
readonly
|
|
22
|
+
readonly library: PromptbookLibrary;
|
|
23
23
|
/**
|
|
24
24
|
* Creates natural execution tools for each client
|
|
25
25
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IDestroyable } from 'destroyable';
|
|
1
2
|
import { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
2
3
|
/**
|
|
3
4
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
@@ -7,9 +8,8 @@ import { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
7
8
|
*
|
|
8
9
|
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
9
10
|
*/
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
|
|
11
12
|
/**
|
|
12
|
-
* TODO: !!! This should be name runRemoteServer OR startRemoteServer and return Destroyable OR Promise<Destroyable>
|
|
13
13
|
* TODO: Handle progress - support streaming
|
|
14
14
|
* TODO: [🤹♂️] Do not hang up immediately but wait until client closes OR timeout
|
|
15
15
|
* TODO: [🤹♂️] Timeout on chat to free up resources
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import type { string_markdown_text, string_name, string_version } from '.././types/typeAliases';
|
|
2
2
|
import type { ExecutionType } from './ExecutionTypes';
|
|
3
3
|
import type { ModelRequirements } from './ModelRequirements';
|
|
4
|
-
import type { ExpectationAmount, ExpectationUnit } from './
|
|
4
|
+
import type { ExpectationAmount, ExpectationUnit } from './PromptbookJson/PromptTemplateJson';
|
|
5
5
|
/**
|
|
6
6
|
* Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline.
|
|
7
7
|
* It is parsed from the markdown from ul/ol items - one command per one item.
|
|
8
8
|
*/
|
|
9
|
-
export type Command =
|
|
9
|
+
export type Command = PromptbookUrlCommand | PromptbookVersionCommand | ExecuteCommand | ModelCommand | JokerCommand | ParameterCommand | PostprocessCommand | ExpectCommand;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* PromptbookVersion command tells which version is .promptbook file using
|
|
12
12
|
*
|
|
13
13
|
* - It is used for backward compatibility
|
|
14
|
-
* - It is defined per whole .
|
|
14
|
+
* - It is defined per whole .promptbook file in the header
|
|
15
15
|
*/
|
|
16
|
-
export interface
|
|
17
|
-
readonly type: '
|
|
18
|
-
readonly
|
|
16
|
+
export interface PromptbookUrlCommand {
|
|
17
|
+
readonly type: 'PROMPTBOOK_URL';
|
|
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
|
-
* - It is defined per whole .
|
|
24
|
+
* - It is defined per whole .promptbook file in the header
|
|
25
25
|
*/
|
|
26
|
-
export interface
|
|
27
|
-
readonly type: '
|
|
28
|
-
readonly
|
|
26
|
+
export interface PromptbookVersionCommand {
|
|
27
|
+
readonly type: 'PROMPTBOOK_VERSION';
|
|
28
|
+
readonly promptbookVersion: string_version;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Execute command tells how to execute the section
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Parameters of the prompt template (pipeline)
|
|
3
3
|
*
|
|
4
4
|
* There are three types of parameters:
|
|
5
|
-
* - **INPUT
|
|
6
|
-
* - **Intermediate parameters** are used internally in the
|
|
7
|
-
* - **OUTPUT PARAMETERs** are not used internally in the
|
|
5
|
+
* - **INPUT PARAMETERs** are required to execute the pipeline.
|
|
6
|
+
* - **Intermediate parameters** are used internally in the pipeline.
|
|
7
|
+
* - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
|
|
8
8
|
*
|
|
9
9
|
* @see https://github.com/webgptorg/promptbook#parameters
|
|
10
10
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_name, string_prompt,
|
|
1
|
+
import type { string_name, string_prompt, string_promptbook_url_with_hashtemplate, string_title } from '.././types/typeAliases';
|
|
2
2
|
import type { ModelRequirements } from './ModelRequirements';
|
|
3
3
|
/**
|
|
4
4
|
* Prompt in a text along with model requirements, but without any execution or templating logic.
|
|
@@ -24,15 +24,15 @@ export interface Prompt {
|
|
|
24
24
|
*/
|
|
25
25
|
readonly modelRequirements: ModelRequirements;
|
|
26
26
|
/**
|
|
27
|
-
* Unique identifier of the
|
|
27
|
+
* Unique identifier of the promptbook with specific template name as hash
|
|
28
28
|
*
|
|
29
|
-
* @example https://
|
|
29
|
+
* @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
|
|
30
30
|
*/
|
|
31
|
-
readonly
|
|
31
|
+
readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
|
|
32
32
|
/**
|
|
33
33
|
* Parameters used in the prompt
|
|
34
34
|
*
|
|
35
|
-
* Note: This is redundant (same information is in
|
|
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
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../.././types/typeAliases';
|
|
2
1
|
import { ExpectFormatCommand } from '../Command';
|
|
3
2
|
import { ExecutionType } from '../ExecutionTypes';
|
|
4
3
|
import { ModelRequirements } from '../ModelRequirements';
|
|
5
4
|
import { ScriptLanguage } from '../ScriptLanguage';
|
|
5
|
+
import { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
|
|
6
6
|
/**
|
|
7
|
-
* Describes one prompt template in the
|
|
7
|
+
* Describes one prompt template in the promptbook
|
|
8
8
|
*/
|
|
9
9
|
export type PromptTemplateJson = NaturalTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
|
|
10
10
|
/**
|
|
@@ -16,7 +16,7 @@ export interface NaturalTemplateJson extends PromptTemplateJsonCommon {
|
|
|
16
16
|
* Requirements for the model
|
|
17
17
|
* - This is required only for executionType PROMPT_TEMPLATE
|
|
18
18
|
*/
|
|
19
|
-
readonly modelRequirements
|
|
19
|
+
readonly modelRequirements: ModelRequirements;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Units of text measurement
|
|
@@ -62,7 +62,7 @@ interface PromptTemplateJsonCommon {
|
|
|
62
62
|
* Name of the template
|
|
63
63
|
* - It must be unique across the pipeline
|
|
64
64
|
* - It should start uppercase and contain letters and numbers
|
|
65
|
-
* - The
|
|
65
|
+
* - The promptbookUrl together with hash and name are used to identify the prompt template in the pipeline
|
|
66
66
|
*/
|
|
67
67
|
readonly name: string_name;
|
|
68
68
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { string_name } from '
|
|
1
|
+
import { string_name } from '../typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
* Describes one parameter of the
|
|
3
|
+
* Describes one parameter of the promptbook
|
|
4
4
|
*/
|
|
5
5
|
export interface PromptTemplateParameterJson {
|
|
6
6
|
/**
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { string_promptbook_url, string_version } from '../typeAliases';
|
|
2
2
|
import { PromptTemplateJson } from './PromptTemplateJson';
|
|
3
3
|
import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Promptbook is the **core concept of this library**.
|
|
6
6
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - **.ptbk.md file** in custom markdown format described above
|
|
10
|
-
* - _(this)_ **JSON** format, parsed from the .ptbk.md file
|
|
11
|
-
*
|
|
12
|
-
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
8
|
+
* @see https://github.com/webgptorg/promptbook#promptbook
|
|
13
9
|
*/
|
|
14
|
-
export interface
|
|
10
|
+
export interface PromptbookJson {
|
|
15
11
|
/**
|
|
16
|
-
* Unique identifier of the
|
|
12
|
+
* Unique identifier of the promptbook
|
|
17
13
|
*
|
|
18
|
-
* Note: It must be unique across all
|
|
14
|
+
* Note: It must be unique across all promptbooks libraries
|
|
19
15
|
* Note: It must use HTTPs URL
|
|
20
16
|
* Tip: You can do versioning in the URL
|
|
21
|
-
* For example: https://
|
|
17
|
+
* For example: https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@1.0.0
|
|
22
18
|
* Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
|
|
23
19
|
*/
|
|
24
|
-
readonly
|
|
20
|
+
readonly promptbookUrl?: string_promptbook_url;
|
|
25
21
|
/**
|
|
26
|
-
* Title of the
|
|
22
|
+
* Title of the promptbook
|
|
27
23
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
28
24
|
*/
|
|
29
25
|
readonly title: string;
|
|
30
26
|
/**
|
|
31
27
|
* Version of the .ptbk.json file
|
|
32
28
|
*/
|
|
33
|
-
readonly
|
|
29
|
+
readonly promptbookVersion: string_version;
|
|
34
30
|
/**
|
|
35
|
-
* Description of the
|
|
31
|
+
* Description of the promptbook
|
|
36
32
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
37
33
|
*/
|
|
38
34
|
readonly description?: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Promptbook is the **core concept of this library**.
|
|
3
|
+
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/webgptorg/promptbook#promptbook
|
|
6
|
+
*/
|
|
7
|
+
export type PromptbookString = string & {
|
|
8
|
+
readonly _type: 'Promptbook';
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* TODO: !! Better validation (validatePromptbookString) or remove branded type and make it just string
|
|
12
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExecutionType } from './ExecutionTypes';
|
|
2
2
|
import { string_markdown_text, string_name } from './typeAliases';
|
|
3
3
|
/**
|
|
4
|
-
* TaskProgress represents the progress of a
|
|
4
|
+
* TaskProgress represents the progress of a Promptbook execution.
|
|
5
5
|
*/
|
|
6
6
|
export interface TaskProgress {
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PromptResult } from '../../execution/PromptResult';
|
|
2
2
|
import type { Prompt } from '../Prompt';
|
|
3
|
-
import type {
|
|
3
|
+
import type { string_promptbook_url, string_version } from '../typeAliases';
|
|
4
4
|
/**
|
|
5
5
|
* ExecutionReport is result of executing one promptbook
|
|
6
6
|
* It is kind of a variant of the promptbook usefull for debugging, logging and transparency for users.
|
|
@@ -13,23 +13,23 @@ import type { string_ptbk_url, string_version } from '../typeAliases';
|
|
|
13
13
|
*/
|
|
14
14
|
export type ExecutionReportJson = {
|
|
15
15
|
/**
|
|
16
|
-
* Unique identifier of the
|
|
16
|
+
* Unique identifier of the promptbook from promptbook which was executed
|
|
17
17
|
*/
|
|
18
|
-
readonly
|
|
18
|
+
readonly promptbookUrl?: string_promptbook_url;
|
|
19
19
|
/**
|
|
20
|
-
* Title of from
|
|
20
|
+
* Title of from promptbook which was executed
|
|
21
21
|
*/
|
|
22
22
|
readonly title?: string;
|
|
23
23
|
/**
|
|
24
|
-
* Version from
|
|
24
|
+
* Version from promptbook which was executed
|
|
25
25
|
*/
|
|
26
|
-
readonly
|
|
26
|
+
readonly promptbookUsedVersion: string_version;
|
|
27
27
|
/**
|
|
28
|
-
* Version from
|
|
28
|
+
* Version from promptbook which was requested by promptbook
|
|
29
29
|
*/
|
|
30
|
-
readonly
|
|
30
|
+
readonly promptbookRequestedVersion?: string_version;
|
|
31
31
|
/**
|
|
32
|
-
* Description of the
|
|
32
|
+
* Description of the promptbook which was executed
|
|
33
33
|
*/
|
|
34
34
|
readonly description?: string;
|
|
35
35
|
/**
|
|
@@ -39,7 +39,7 @@ export type ExecutionReportJson = {
|
|
|
39
39
|
/**
|
|
40
40
|
* The prompt wich was executed
|
|
41
41
|
*/
|
|
42
|
-
prompt: Omit<Prompt, '
|
|
42
|
+
prompt: Omit<Prompt, 'promptbookUrl' | 'parameters'>;
|
|
43
43
|
/**
|
|
44
44
|
* Result of the prompt execution (if not failed during LLM execution)
|
|
45
45
|
*/
|
|
@@ -179,15 +179,15 @@ export type string_url = string;
|
|
|
179
179
|
/**
|
|
180
180
|
* Semantic helper
|
|
181
181
|
*
|
|
182
|
-
* For example `"https://
|
|
182
|
+
* For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
|
|
183
183
|
*/
|
|
184
|
-
export type
|
|
184
|
+
export type string_promptbook_url = string;
|
|
185
185
|
/**
|
|
186
186
|
* Semantic helper
|
|
187
187
|
*
|
|
188
|
-
* For example `"https://
|
|
188
|
+
* For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
|
|
189
189
|
*/
|
|
190
|
-
export type
|
|
190
|
+
export type string_promptbook_url_with_hashtemplate = string;
|
|
191
191
|
/**
|
|
192
192
|
* Semantic helper
|
|
193
193
|
*
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
3
|
+
*/
|
|
4
|
+
export declare const isRunningInBrowser: Function;
|
|
5
|
+
/**
|
|
6
|
+
* Detects if the code is running in a Node.js environment
|
|
7
|
+
*/
|
|
8
|
+
export declare const isRunningInNode: Function;
|
|
9
|
+
/**
|
|
10
|
+
* Detects if the code is running in a web worker
|
|
11
|
+
*/
|
|
12
|
+
export declare const isRunningInWebWorker: Function;
|
package/esm/typings/version.d.ts
CHANGED