@promptbook/remote-client 0.8.0 → 0.10.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/typings/_packages/core.index.d.ts +2 -2
- package/esm/typings/_packages/types.index.d.ts +2 -2
- package/esm/typings/classes/PromptTemplatePipeline.d.ts +9 -9
- package/esm/typings/classes/PromptTemplatePipelineLibrary.d.ts +5 -4
- package/esm/typings/config.d.ts +1 -1
- package/esm/typings/conversion/_importPtp.d.ts +2 -2
- package/esm/typings/conversion/validatePromptTemplatePipelineJson.d.ts +1 -1
- package/esm/typings/execution/plugins/natural-execution-tools/remote/createRemoteServer.d.ts +1 -0
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- package/esm/typings/types/Command.d.ts +7 -7
- package/esm/typings/types/ModelRequirements.d.ts +4 -0
- package/esm/typings/types/Prompt.d.ts +4 -4
- package/esm/typings/types/PromptTemplatePipelineJson/PromptTemplateJson.d.ts +1 -1
- package/esm/typings/types/PromptTemplatePipelineJson/PromptTemplatePipelineJson.d.ts +7 -7
- package/esm/typings/types/PromptTemplatePipelineString.d.ts +2 -2
- package/esm/typings/types/typeAliases.d.ts +4 -20
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/typings/_packages/core.index.d.ts +2 -2
- package/umd/typings/_packages/types.index.d.ts +2 -2
- package/umd/typings/classes/PromptTemplatePipeline.d.ts +9 -9
- package/umd/typings/classes/PromptTemplatePipelineLibrary.d.ts +5 -4
- package/umd/typings/config.d.ts +1 -1
- package/umd/typings/conversion/_importPtp.d.ts +2 -2
- package/umd/typings/conversion/validatePromptTemplatePipelineJson.d.ts +1 -1
- package/umd/typings/execution/plugins/natural-execution-tools/remote/createRemoteServer.d.ts +1 -0
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- package/umd/typings/types/Command.d.ts +7 -7
- package/umd/typings/types/ModelRequirements.d.ts +4 -0
- package/umd/typings/types/Prompt.d.ts +4 -4
- package/umd/typings/types/PromptTemplatePipelineJson/PromptTemplateJson.d.ts +1 -1
- package/umd/typings/types/PromptTemplatePipelineJson/PromptTemplatePipelineJson.d.ts +7 -7
- package/umd/typings/types/PromptTemplatePipelineString.d.ts +2 -2
- package/umd/typings/types/typeAliases.d.ts +4 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PromptTemplatePipeline } from '../classes/PromptTemplatePipeline';
|
|
2
2
|
import { PromptTemplatePipelineLibrary } from '../classes/PromptTemplatePipelineLibrary';
|
|
3
|
-
import {
|
|
3
|
+
import { PTBK_VERSION } from '../config';
|
|
4
4
|
import { promptTemplatePipelineStringToJson } from '../conversion/promptTemplatePipelineStringToJson';
|
|
5
5
|
import { validatePromptTemplatePipelineJson } from '../conversion/validatePromptTemplatePipelineJson';
|
|
6
6
|
import { createPtpExecutor } from '../execution/createPtpExecutor';
|
|
@@ -9,7 +9,7 @@ import { CallbackInterfaceTools } from '../execution/plugins/user-interface-exec
|
|
|
9
9
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
10
10
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
11
11
|
import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
12
|
-
export { ExecutionTypes,
|
|
12
|
+
export { ExecutionTypes, PTBK_VERSION, PromptTemplatePipeline, PromptTemplatePipelineLibrary };
|
|
13
13
|
export { SimplePromptInterfaceTools };
|
|
14
14
|
export { promptTemplatePipelineStringToJson, validatePromptTemplatePipelineJson };
|
|
15
15
|
export { MockedEchoNaturalExecutionTools };
|
|
@@ -16,5 +16,5 @@ import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineStr
|
|
|
16
16
|
import { ScriptLanguage } from '../types/ScriptLanguage';
|
|
17
17
|
import { DoneTaskProgress, PendingTaskProgress, TaskProgress } from '../types/TaskProgress';
|
|
18
18
|
import { string_char_emoji } from '../types/typeAliasEmoji';
|
|
19
|
-
import { ILicense, IPersonProfile, IRepository, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class,
|
|
20
|
-
export { CommonExecutionToolsOptions, DoneTaskProgress, ExecutionTools, ExecutionType, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, PendingTaskProgress, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class,
|
|
19
|
+
import { ILicense, IPersonProfile, IRepository, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_wallpaper_id, string_xml, uuid, uuid_first_segment } from '../types/typeAliases';
|
|
20
|
+
export { CommonExecutionToolsOptions, DoneTaskProgress, ExecutionTools, ExecutionType, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, PendingTaskProgress, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_wallpaper_id, string_xml, uuid, uuid_first_segment, };
|
|
@@ -8,14 +8,14 @@ import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineStr
|
|
|
8
8
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
9
9
|
*
|
|
10
10
|
* It can have 3 formats:
|
|
11
|
-
* - **.
|
|
12
|
-
* - **JSON** format, parsed from the .
|
|
11
|
+
* - **.ptbk.md file** in custom markdown format described above
|
|
12
|
+
* - **JSON** format, parsed from the .ptbk.md file
|
|
13
13
|
* - _(this)_ **Object** which is created from JSON format and bound with tools around (but not the execution logic)
|
|
14
14
|
*
|
|
15
15
|
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
16
16
|
*/
|
|
17
17
|
export declare class PromptTemplatePipeline {
|
|
18
|
-
readonly
|
|
18
|
+
readonly ptbkUrl: URL | null;
|
|
19
19
|
readonly parameters: Record<string_name, PromptTemplateParameterJson>;
|
|
20
20
|
readonly promptTemplates: Array<PromptTemplateJson>;
|
|
21
21
|
/**
|
|
@@ -23,28 +23,28 @@ export declare class PromptTemplatePipeline {
|
|
|
23
23
|
*
|
|
24
24
|
* Note: During the construction syntax and logic of source is validated
|
|
25
25
|
*
|
|
26
|
-
* @param source content of .
|
|
26
|
+
* @param source content of .ptbk.md or .ptbk.json file
|
|
27
27
|
* @returns PromptTemplatePipeline
|
|
28
28
|
*/
|
|
29
|
-
static fromSource(
|
|
29
|
+
static fromSource(ptbkSource: PromptTemplatePipelineString | PromptTemplatePipelineJson): PromptTemplatePipeline;
|
|
30
30
|
/**
|
|
31
31
|
* Constructs PromptTemplatePipeline from markdown source
|
|
32
32
|
*
|
|
33
33
|
* Note: During the construction syntax and logic of source is validated
|
|
34
34
|
*
|
|
35
|
-
* @param
|
|
35
|
+
* @param ptbkString content of .ptbk.md file
|
|
36
36
|
* @returns PromptTemplatePipeline
|
|
37
37
|
*/
|
|
38
|
-
static fromString(
|
|
38
|
+
static fromString(ptbkString: PromptTemplatePipelineString): PromptTemplatePipeline;
|
|
39
39
|
/**
|
|
40
40
|
* Constructs PromptTemplatePipeline from JSON source
|
|
41
41
|
*
|
|
42
42
|
* Note: During the construction the source is logic validated
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param ptbkjson content of .ptbk.json file parsed into JSON
|
|
45
45
|
* @returns PromptTemplatePipeline
|
|
46
46
|
*/
|
|
47
|
-
static fromJson(
|
|
47
|
+
static fromJson(ptbkjson: PromptTemplatePipelineJson): PromptTemplatePipeline;
|
|
48
48
|
private constructor();
|
|
49
49
|
/**
|
|
50
50
|
* Returns the first prompt template in the pipeline
|
|
@@ -20,12 +20,12 @@ export declare class PromptTemplatePipelineLibrary {
|
|
|
20
20
|
* Constructs PromptTemplatePipeline from any sources
|
|
21
21
|
*
|
|
22
22
|
* Note: During the construction syntax and logic of all sources are validated
|
|
23
|
-
* Note: You can combine .
|
|
23
|
+
* Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
|
|
24
24
|
*
|
|
25
|
-
* @param
|
|
25
|
+
* @param ptbkSources contents of .ptbk.md or .ptbk.json files
|
|
26
26
|
* @returns PromptTemplatePipelineLibrary
|
|
27
27
|
*/
|
|
28
|
-
static fromSources(
|
|
28
|
+
static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>): PromptTemplatePipelineLibrary;
|
|
29
29
|
private constructor();
|
|
30
30
|
/**
|
|
31
31
|
* Gets prompt template pipeline by name
|
|
@@ -41,13 +41,14 @@ export declare class PromptTemplatePipelineLibrary {
|
|
|
41
41
|
createExecutor(name: string_name, tools: ExecutionTools): PtpExecutor;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
+
* TODO: !!! This should be renamed to Promptbook
|
|
44
45
|
* TODO: !! [👐][🧠] Split of PromptTemplatePipeline,PromptTemplatePipelineLibrary between interface and class
|
|
45
46
|
* TODO: !! [👐] Make promptTemplatePipelines private WHEN split between interface and class
|
|
46
47
|
* TODO: [🧠] Maybe isPromptInLibrary should be separate utility function
|
|
47
48
|
* TODO: [🧠] Maybe createExecutor should be separate utility function
|
|
48
49
|
* TODO: Static method fromDirectory
|
|
49
50
|
* TODO: [🤜] Add generic type for entry and result parameters
|
|
50
|
-
* TODO: [🧠] Is it better to
|
|
51
|
+
* TODO: [🧠] Is it better to ptbkLibrary.executePtp('writeXyz',{...}) OR ptbkLibrary.createExecutor('writeXyz')({...}) OR createExecutor(ptbkLibrary.getPtp('writeXyz'))
|
|
51
52
|
* TODO: [🧠] Formarly (before commit 62229afce7668a5b85077cc18becf798b583bf8d) there were two classes PromptTemplatePipelineLibrary+PtpLibraryExecutor (maybe it was better?)
|
|
52
53
|
* TODO: [🧠] Is it better to pass tools into getExecutor or into constructor
|
|
53
54
|
* Maybe it is not a good idea to cache executors when they are can be created with different tools
|
package/esm/typings/config.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineStr
|
|
|
8
8
|
*
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
|
-
export declare function importPtp(path: `${string}.
|
|
12
|
-
export declare function importPtp(path: `${string}.
|
|
11
|
+
export declare function importPtp(path: `${string}.ptbk.md`): PromptTemplatePipelineString;
|
|
12
|
+
export declare function importPtp(path: `${string}.ptbk.json`): PromptTemplatePipelineJson;
|
|
@@ -14,7 +14,7 @@ import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function validatePromptTemplatePipelineJson(ptp: PromptTemplatePipelineJson): void;
|
|
16
16
|
/**
|
|
17
|
-
* TODO: [🧠] Work with
|
|
17
|
+
* TODO: [🧠] Work with ptbkVersion
|
|
18
18
|
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
19
19
|
* > /**
|
|
20
20
|
* > * Validates PromptTemplatePipelineJson if it is logically valid.
|
package/esm/typings/execution/plugins/natural-execution-tools/remote/createRemoteServer.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function createRemoteServer(options: RemoteServerOptions): void;
|
|
11
11
|
/**
|
|
12
|
+
* TODO: !!! This should be name runRemoteServer OR startRemoteServer and return Destroyable OR Promise<Destroyable>
|
|
12
13
|
* TODO: Handle progress - support streaming
|
|
13
14
|
* TODO: [🤹♂️] Do not hang up immediately but wait until client closes OR timeout
|
|
14
15
|
* TODO: [🤹♂️] Timeout on chat to free up resources
|
|
@@ -12,7 +12,7 @@ export interface RemoteServerOptions extends CommonExecutionToolsOptions {
|
|
|
12
12
|
*
|
|
13
13
|
* This is used to checkl validity of the prompt to prevent DDoS
|
|
14
14
|
*/
|
|
15
|
-
readonly
|
|
15
|
+
readonly ptbkLibrary: PromptTemplatePipelineLibrary;
|
|
16
16
|
/**
|
|
17
17
|
* Creates natural execution tools for each client
|
|
18
18
|
*/
|
|
@@ -5,16 +5,16 @@ import { ModelRequirements } from './ModelRequirements';
|
|
|
5
5
|
* Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline.
|
|
6
6
|
* It is parsed from the markdown from ul/ol items - one command per one item.
|
|
7
7
|
*/
|
|
8
|
-
export type Command =
|
|
8
|
+
export type Command = PtbkUrlCommand | PtbkVersionCommand | ExecuteCommand | UseCommand | ParameterCommand | PostprocessCommand;
|
|
9
9
|
/**
|
|
10
10
|
* PtpVersion command tells which version is .ptp file using
|
|
11
11
|
*
|
|
12
12
|
* - It is used for backward compatibility
|
|
13
13
|
* - It is defined per whole .ptp file in the header
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
16
|
-
readonly type: '
|
|
17
|
-
readonly
|
|
15
|
+
export interface PtbkUrlCommand {
|
|
16
|
+
readonly type: 'PTBK_URL';
|
|
17
|
+
readonly ptbkUrl: URL;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* PtpVersion command tells which version is .ptp file using
|
|
@@ -22,9 +22,9 @@ export interface PtpUrlCommand {
|
|
|
22
22
|
* - It is used for backward compatibility
|
|
23
23
|
* - It is defined per whole .ptp file in the header
|
|
24
24
|
*/
|
|
25
|
-
export interface
|
|
26
|
-
readonly type: '
|
|
27
|
-
readonly
|
|
25
|
+
export interface PtbkVersionCommand {
|
|
26
|
+
readonly type: 'PTBK_VERSION';
|
|
27
|
+
readonly ptbkVersion: string_version;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Execute command tells how to execute the section
|
|
@@ -21,6 +21,10 @@ export interface ModelRequirements {
|
|
|
21
21
|
* - **CHAT** - model that takes prompt and previous messages and returns response
|
|
22
22
|
*/
|
|
23
23
|
readonly variant: ModelVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of tokens that can be generated by the model
|
|
26
|
+
*/
|
|
27
|
+
readonly maxTokens?: number;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* TODO: Maybe figure out better word than "variant"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { string_name, string_prompt,
|
|
1
|
+
import { string_name, string_prompt, string_ptbk_url_with_hashtemplate } from '.././types/typeAliases';
|
|
2
2
|
import { ModelRequirements } from './ModelRequirements';
|
|
3
3
|
/**
|
|
4
4
|
* Prompt in a text along with model requirements, but without any execution or templating logic.
|
|
@@ -20,13 +20,13 @@ export interface Prompt {
|
|
|
20
20
|
/**
|
|
21
21
|
* Unique identifier of the prompt template pipeline with specific template name as hash
|
|
22
22
|
*
|
|
23
|
-
* @example https://
|
|
23
|
+
* @example https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
|
|
24
24
|
*/
|
|
25
|
-
readonly
|
|
25
|
+
readonly ptbkUrl: string_ptbk_url_with_hashtemplate;
|
|
26
26
|
/**
|
|
27
27
|
* Parameters used in the prompt
|
|
28
28
|
*
|
|
29
|
-
* Note: This is redundant (same information is in
|
|
29
|
+
* Note: This is redundant (same information is in ptbkUrl+content) but useful for logging and debugging
|
|
30
30
|
*/
|
|
31
31
|
readonly parameters: Record<string_name, string>;
|
|
32
32
|
}
|
|
@@ -49,7 +49,7 @@ interface PromptTemplateJsonCommon {
|
|
|
49
49
|
* Name of the template
|
|
50
50
|
* - It must be unique across the pipeline
|
|
51
51
|
* - It should start uppercase and contain letters and numbers
|
|
52
|
-
* - The
|
|
52
|
+
* - The ptbkUrl together with hash and name are used to identify the prompt template in the pipeline
|
|
53
53
|
*/
|
|
54
54
|
readonly name: string_name;
|
|
55
55
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { string_ptbk_url, string_version } from '../.././types/typeAliases';
|
|
2
2
|
import { PromptTemplateJson } from './PromptTemplateJson';
|
|
3
3
|
import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
4
4
|
/**
|
|
@@ -6,8 +6,8 @@ import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
|
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
8
|
* It can have 3 formats:
|
|
9
|
-
* - **.
|
|
10
|
-
* - _(this)_ **JSON** format, parsed from the .
|
|
9
|
+
* - **.ptbk.md file** in custom markdown format described above
|
|
10
|
+
* - _(this)_ **JSON** format, parsed from the .ptbk.md file
|
|
11
11
|
* - **Object** which is created from JSON format and bound with tools around (but not the execution logic)
|
|
12
12
|
*
|
|
13
13
|
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
@@ -19,19 +19,19 @@ export interface PromptTemplatePipelineJson {
|
|
|
19
19
|
* Note: It must be unique across all prompt template pipelines
|
|
20
20
|
* Note: It must use HTTPs URL
|
|
21
21
|
* Tip: You can do versioning in the URL
|
|
22
|
-
* For example: https://
|
|
22
|
+
* For example: https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@1.0.0
|
|
23
23
|
* Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
|
|
24
24
|
*/
|
|
25
|
-
readonly
|
|
25
|
+
readonly ptbkUrl?: string_ptbk_url;
|
|
26
26
|
/**
|
|
27
27
|
* Title of the prompt template pipeline
|
|
28
28
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
29
29
|
*/
|
|
30
30
|
readonly title: string;
|
|
31
31
|
/**
|
|
32
|
-
* Version of the .
|
|
32
|
+
* Version of the .ptbk.json file
|
|
33
33
|
*/
|
|
34
|
-
readonly
|
|
34
|
+
readonly ptbkVersion: string_version;
|
|
35
35
|
/**
|
|
36
36
|
* Description of the prompt template pipeline
|
|
37
37
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
4
4
|
*
|
|
5
5
|
* It can have 3 formats:
|
|
6
|
-
* - _(this)_ **.
|
|
7
|
-
* - **JSON** format, parsed from the .
|
|
6
|
+
* - _(this)_ **.ptbk.md file** in custom markdown format described above
|
|
7
|
+
* - **JSON** format, parsed from the .ptbk.md file
|
|
8
8
|
* - **Object** which is created from JSON format and bound with tools around (but not the execution logic)
|
|
9
9
|
*
|
|
10
10
|
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
@@ -20,18 +20,6 @@ export type string_prompt = string;
|
|
|
20
20
|
* For example `"A cat wearing a {ITEM}"`
|
|
21
21
|
*/
|
|
22
22
|
export type string_template = string;
|
|
23
|
-
/**
|
|
24
|
-
* Semantic helper
|
|
25
|
-
*
|
|
26
|
-
* For example `"A cat wearing a hat"`
|
|
27
|
-
*/
|
|
28
|
-
export type string_image_prompt = string_prompt;
|
|
29
|
-
/**
|
|
30
|
-
* Semantic helper
|
|
31
|
-
*
|
|
32
|
-
* For example `"A cat wearing a hat --wallpaper --v 5.2"`
|
|
33
|
-
*/
|
|
34
|
-
export type string_midjourney_prompt = string_image_prompt;
|
|
35
23
|
/**
|
|
36
24
|
* Semantic helper
|
|
37
25
|
*
|
|
@@ -191,15 +179,15 @@ export type string_url = string;
|
|
|
191
179
|
/**
|
|
192
180
|
* Semantic helper
|
|
193
181
|
*
|
|
194
|
-
* For example `"https://
|
|
182
|
+
* For example `"https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
|
|
195
183
|
*/
|
|
196
|
-
export type
|
|
184
|
+
export type string_ptbk_url = string;
|
|
197
185
|
/**
|
|
198
186
|
* Semantic helper
|
|
199
187
|
*
|
|
200
|
-
* For example `"https://
|
|
188
|
+
* For example `"https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
|
|
201
189
|
*/
|
|
202
|
-
export type
|
|
190
|
+
export type string_ptbk_url_with_hashtemplate = string;
|
|
203
191
|
/**
|
|
204
192
|
* Semantic helper
|
|
205
193
|
*
|
|
@@ -389,10 +377,6 @@ export interface IRepository {
|
|
|
389
377
|
readonly type?: string | 'git';
|
|
390
378
|
readonly url?: string;
|
|
391
379
|
}
|
|
392
|
-
/**
|
|
393
|
-
* CSS cursor type
|
|
394
|
-
*/
|
|
395
|
-
export type string_css_cursor = 'alias' | 'all-scroll' | 'auto' | 'cell' | 'context-menu' | 'col-resize' | 'copy' | 'crosshair' | 'default' | 'e-resize' | 'ew-resize' | 'grab' | 'grabbing' | 'help' | 'move' | 'n-resize' | 'ne-resize' | 'nesw-resize' | 'ns-resize' | 'nw-resize' | 'nwse-resize' | 'no-drop' | 'none' | 'not-allowed' | 'pointer' | 'progress' | 'row-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'text' | 'w-resize' | 'wait' | 'zoom-in' | 'zoom-out';
|
|
396
380
|
/**
|
|
397
381
|
* Semantic helper for attributes
|
|
398
382
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"socket.io-client": "4.7.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@promptbook/core": "0.
|
|
40
|
+
"@promptbook/core": "0.10.0"
|
|
41
41
|
},
|
|
42
42
|
"main": "./umd/index.umd.js",
|
|
43
43
|
"module": "./esm/index.es.js",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('socket.io-client')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'socket.io-client'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.socket_ioClient));
|
|
5
5
|
})(this, (function (exports, socket_ioClient) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PromptTemplatePipeline } from '../classes/PromptTemplatePipeline';
|
|
2
2
|
import { PromptTemplatePipelineLibrary } from '../classes/PromptTemplatePipelineLibrary';
|
|
3
|
-
import {
|
|
3
|
+
import { PTBK_VERSION } from '../config';
|
|
4
4
|
import { promptTemplatePipelineStringToJson } from '../conversion/promptTemplatePipelineStringToJson';
|
|
5
5
|
import { validatePromptTemplatePipelineJson } from '../conversion/validatePromptTemplatePipelineJson';
|
|
6
6
|
import { createPtpExecutor } from '../execution/createPtpExecutor';
|
|
@@ -9,7 +9,7 @@ import { CallbackInterfaceTools } from '../execution/plugins/user-interface-exec
|
|
|
9
9
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
10
10
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
11
11
|
import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
12
|
-
export { ExecutionTypes,
|
|
12
|
+
export { ExecutionTypes, PTBK_VERSION, PromptTemplatePipeline, PromptTemplatePipelineLibrary };
|
|
13
13
|
export { SimplePromptInterfaceTools };
|
|
14
14
|
export { promptTemplatePipelineStringToJson, validatePromptTemplatePipelineJson };
|
|
15
15
|
export { MockedEchoNaturalExecutionTools };
|
|
@@ -16,5 +16,5 @@ import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineStr
|
|
|
16
16
|
import { ScriptLanguage } from '../types/ScriptLanguage';
|
|
17
17
|
import { DoneTaskProgress, PendingTaskProgress, TaskProgress } from '../types/TaskProgress';
|
|
18
18
|
import { string_char_emoji } from '../types/typeAliasEmoji';
|
|
19
|
-
import { ILicense, IPersonProfile, IRepository, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class,
|
|
20
|
-
export { CommonExecutionToolsOptions, DoneTaskProgress, ExecutionTools, ExecutionType, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, PendingTaskProgress, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class,
|
|
19
|
+
import { ILicense, IPersonProfile, IRepository, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_wallpaper_id, string_xml, uuid, uuid_first_segment } from '../types/typeAliases';
|
|
20
|
+
export { CommonExecutionToolsOptions, DoneTaskProgress, ExecutionTools, ExecutionType, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, PendingTaskProgress, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_wallpaper_id, string_xml, uuid, uuid_first_segment, };
|
|
@@ -8,14 +8,14 @@ import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineStr
|
|
|
8
8
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
9
9
|
*
|
|
10
10
|
* It can have 3 formats:
|
|
11
|
-
* - **.
|
|
12
|
-
* - **JSON** format, parsed from the .
|
|
11
|
+
* - **.ptbk.md file** in custom markdown format described above
|
|
12
|
+
* - **JSON** format, parsed from the .ptbk.md file
|
|
13
13
|
* - _(this)_ **Object** which is created from JSON format and bound with tools around (but not the execution logic)
|
|
14
14
|
*
|
|
15
15
|
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
16
16
|
*/
|
|
17
17
|
export declare class PromptTemplatePipeline {
|
|
18
|
-
readonly
|
|
18
|
+
readonly ptbkUrl: URL | null;
|
|
19
19
|
readonly parameters: Record<string_name, PromptTemplateParameterJson>;
|
|
20
20
|
readonly promptTemplates: Array<PromptTemplateJson>;
|
|
21
21
|
/**
|
|
@@ -23,28 +23,28 @@ export declare class PromptTemplatePipeline {
|
|
|
23
23
|
*
|
|
24
24
|
* Note: During the construction syntax and logic of source is validated
|
|
25
25
|
*
|
|
26
|
-
* @param source content of .
|
|
26
|
+
* @param source content of .ptbk.md or .ptbk.json file
|
|
27
27
|
* @returns PromptTemplatePipeline
|
|
28
28
|
*/
|
|
29
|
-
static fromSource(
|
|
29
|
+
static fromSource(ptbkSource: PromptTemplatePipelineString | PromptTemplatePipelineJson): PromptTemplatePipeline;
|
|
30
30
|
/**
|
|
31
31
|
* Constructs PromptTemplatePipeline from markdown source
|
|
32
32
|
*
|
|
33
33
|
* Note: During the construction syntax and logic of source is validated
|
|
34
34
|
*
|
|
35
|
-
* @param
|
|
35
|
+
* @param ptbkString content of .ptbk.md file
|
|
36
36
|
* @returns PromptTemplatePipeline
|
|
37
37
|
*/
|
|
38
|
-
static fromString(
|
|
38
|
+
static fromString(ptbkString: PromptTemplatePipelineString): PromptTemplatePipeline;
|
|
39
39
|
/**
|
|
40
40
|
* Constructs PromptTemplatePipeline from JSON source
|
|
41
41
|
*
|
|
42
42
|
* Note: During the construction the source is logic validated
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param ptbkjson content of .ptbk.json file parsed into JSON
|
|
45
45
|
* @returns PromptTemplatePipeline
|
|
46
46
|
*/
|
|
47
|
-
static fromJson(
|
|
47
|
+
static fromJson(ptbkjson: PromptTemplatePipelineJson): PromptTemplatePipeline;
|
|
48
48
|
private constructor();
|
|
49
49
|
/**
|
|
50
50
|
* Returns the first prompt template in the pipeline
|
|
@@ -20,12 +20,12 @@ export declare class PromptTemplatePipelineLibrary {
|
|
|
20
20
|
* Constructs PromptTemplatePipeline from any sources
|
|
21
21
|
*
|
|
22
22
|
* Note: During the construction syntax and logic of all sources are validated
|
|
23
|
-
* Note: You can combine .
|
|
23
|
+
* Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
|
|
24
24
|
*
|
|
25
|
-
* @param
|
|
25
|
+
* @param ptbkSources contents of .ptbk.md or .ptbk.json files
|
|
26
26
|
* @returns PromptTemplatePipelineLibrary
|
|
27
27
|
*/
|
|
28
|
-
static fromSources(
|
|
28
|
+
static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>): PromptTemplatePipelineLibrary;
|
|
29
29
|
private constructor();
|
|
30
30
|
/**
|
|
31
31
|
* Gets prompt template pipeline by name
|
|
@@ -41,13 +41,14 @@ export declare class PromptTemplatePipelineLibrary {
|
|
|
41
41
|
createExecutor(name: string_name, tools: ExecutionTools): PtpExecutor;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
+
* TODO: !!! This should be renamed to Promptbook
|
|
44
45
|
* TODO: !! [👐][🧠] Split of PromptTemplatePipeline,PromptTemplatePipelineLibrary between interface and class
|
|
45
46
|
* TODO: !! [👐] Make promptTemplatePipelines private WHEN split between interface and class
|
|
46
47
|
* TODO: [🧠] Maybe isPromptInLibrary should be separate utility function
|
|
47
48
|
* TODO: [🧠] Maybe createExecutor should be separate utility function
|
|
48
49
|
* TODO: Static method fromDirectory
|
|
49
50
|
* TODO: [🤜] Add generic type for entry and result parameters
|
|
50
|
-
* TODO: [🧠] Is it better to
|
|
51
|
+
* TODO: [🧠] Is it better to ptbkLibrary.executePtp('writeXyz',{...}) OR ptbkLibrary.createExecutor('writeXyz')({...}) OR createExecutor(ptbkLibrary.getPtp('writeXyz'))
|
|
51
52
|
* TODO: [🧠] Formarly (before commit 62229afce7668a5b85077cc18becf798b583bf8d) there were two classes PromptTemplatePipelineLibrary+PtpLibraryExecutor (maybe it was better?)
|
|
52
53
|
* TODO: [🧠] Is it better to pass tools into getExecutor or into constructor
|
|
53
54
|
* Maybe it is not a good idea to cache executors when they are can be created with different tools
|
package/umd/typings/config.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineStr
|
|
|
8
8
|
*
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
|
-
export declare function importPtp(path: `${string}.
|
|
12
|
-
export declare function importPtp(path: `${string}.
|
|
11
|
+
export declare function importPtp(path: `${string}.ptbk.md`): PromptTemplatePipelineString;
|
|
12
|
+
export declare function importPtp(path: `${string}.ptbk.json`): PromptTemplatePipelineJson;
|
|
@@ -14,7 +14,7 @@ import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function validatePromptTemplatePipelineJson(ptp: PromptTemplatePipelineJson): void;
|
|
16
16
|
/**
|
|
17
|
-
* TODO: [🧠] Work with
|
|
17
|
+
* TODO: [🧠] Work with ptbkVersion
|
|
18
18
|
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
19
19
|
* > /**
|
|
20
20
|
* > * Validates PromptTemplatePipelineJson if it is logically valid.
|
package/umd/typings/execution/plugins/natural-execution-tools/remote/createRemoteServer.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function createRemoteServer(options: RemoteServerOptions): void;
|
|
11
11
|
/**
|
|
12
|
+
* TODO: !!! This should be name runRemoteServer OR startRemoteServer and return Destroyable OR Promise<Destroyable>
|
|
12
13
|
* TODO: Handle progress - support streaming
|
|
13
14
|
* TODO: [🤹♂️] Do not hang up immediately but wait until client closes OR timeout
|
|
14
15
|
* TODO: [🤹♂️] Timeout on chat to free up resources
|
|
@@ -12,7 +12,7 @@ export interface RemoteServerOptions extends CommonExecutionToolsOptions {
|
|
|
12
12
|
*
|
|
13
13
|
* This is used to checkl validity of the prompt to prevent DDoS
|
|
14
14
|
*/
|
|
15
|
-
readonly
|
|
15
|
+
readonly ptbkLibrary: PromptTemplatePipelineLibrary;
|
|
16
16
|
/**
|
|
17
17
|
* Creates natural execution tools for each client
|
|
18
18
|
*/
|
|
@@ -5,16 +5,16 @@ import { ModelRequirements } from './ModelRequirements';
|
|
|
5
5
|
* Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline.
|
|
6
6
|
* It is parsed from the markdown from ul/ol items - one command per one item.
|
|
7
7
|
*/
|
|
8
|
-
export type Command =
|
|
8
|
+
export type Command = PtbkUrlCommand | PtbkVersionCommand | ExecuteCommand | UseCommand | ParameterCommand | PostprocessCommand;
|
|
9
9
|
/**
|
|
10
10
|
* PtpVersion command tells which version is .ptp file using
|
|
11
11
|
*
|
|
12
12
|
* - It is used for backward compatibility
|
|
13
13
|
* - It is defined per whole .ptp file in the header
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
16
|
-
readonly type: '
|
|
17
|
-
readonly
|
|
15
|
+
export interface PtbkUrlCommand {
|
|
16
|
+
readonly type: 'PTBK_URL';
|
|
17
|
+
readonly ptbkUrl: URL;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* PtpVersion command tells which version is .ptp file using
|
|
@@ -22,9 +22,9 @@ export interface PtpUrlCommand {
|
|
|
22
22
|
* - It is used for backward compatibility
|
|
23
23
|
* - It is defined per whole .ptp file in the header
|
|
24
24
|
*/
|
|
25
|
-
export interface
|
|
26
|
-
readonly type: '
|
|
27
|
-
readonly
|
|
25
|
+
export interface PtbkVersionCommand {
|
|
26
|
+
readonly type: 'PTBK_VERSION';
|
|
27
|
+
readonly ptbkVersion: string_version;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Execute command tells how to execute the section
|
|
@@ -21,6 +21,10 @@ export interface ModelRequirements {
|
|
|
21
21
|
* - **CHAT** - model that takes prompt and previous messages and returns response
|
|
22
22
|
*/
|
|
23
23
|
readonly variant: ModelVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of tokens that can be generated by the model
|
|
26
|
+
*/
|
|
27
|
+
readonly maxTokens?: number;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* TODO: Maybe figure out better word than "variant"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { string_name, string_prompt,
|
|
1
|
+
import { string_name, string_prompt, string_ptbk_url_with_hashtemplate } from '.././types/typeAliases';
|
|
2
2
|
import { ModelRequirements } from './ModelRequirements';
|
|
3
3
|
/**
|
|
4
4
|
* Prompt in a text along with model requirements, but without any execution or templating logic.
|
|
@@ -20,13 +20,13 @@ export interface Prompt {
|
|
|
20
20
|
/**
|
|
21
21
|
* Unique identifier of the prompt template pipeline with specific template name as hash
|
|
22
22
|
*
|
|
23
|
-
* @example https://
|
|
23
|
+
* @example https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
|
|
24
24
|
*/
|
|
25
|
-
readonly
|
|
25
|
+
readonly ptbkUrl: string_ptbk_url_with_hashtemplate;
|
|
26
26
|
/**
|
|
27
27
|
* Parameters used in the prompt
|
|
28
28
|
*
|
|
29
|
-
* Note: This is redundant (same information is in
|
|
29
|
+
* Note: This is redundant (same information is in ptbkUrl+content) but useful for logging and debugging
|
|
30
30
|
*/
|
|
31
31
|
readonly parameters: Record<string_name, string>;
|
|
32
32
|
}
|
|
@@ -49,7 +49,7 @@ interface PromptTemplateJsonCommon {
|
|
|
49
49
|
* Name of the template
|
|
50
50
|
* - It must be unique across the pipeline
|
|
51
51
|
* - It should start uppercase and contain letters and numbers
|
|
52
|
-
* - The
|
|
52
|
+
* - The ptbkUrl together with hash and name are used to identify the prompt template in the pipeline
|
|
53
53
|
*/
|
|
54
54
|
readonly name: string_name;
|
|
55
55
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { string_ptbk_url, string_version } from '../.././types/typeAliases';
|
|
2
2
|
import { PromptTemplateJson } from './PromptTemplateJson';
|
|
3
3
|
import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
4
4
|
/**
|
|
@@ -6,8 +6,8 @@ import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
|
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
8
|
* It can have 3 formats:
|
|
9
|
-
* - **.
|
|
10
|
-
* - _(this)_ **JSON** format, parsed from the .
|
|
9
|
+
* - **.ptbk.md file** in custom markdown format described above
|
|
10
|
+
* - _(this)_ **JSON** format, parsed from the .ptbk.md file
|
|
11
11
|
* - **Object** which is created from JSON format and bound with tools around (but not the execution logic)
|
|
12
12
|
*
|
|
13
13
|
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
@@ -19,19 +19,19 @@ export interface PromptTemplatePipelineJson {
|
|
|
19
19
|
* Note: It must be unique across all prompt template pipelines
|
|
20
20
|
* Note: It must use HTTPs URL
|
|
21
21
|
* Tip: You can do versioning in the URL
|
|
22
|
-
* For example: https://
|
|
22
|
+
* For example: https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@1.0.0
|
|
23
23
|
* Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
|
|
24
24
|
*/
|
|
25
|
-
readonly
|
|
25
|
+
readonly ptbkUrl?: string_ptbk_url;
|
|
26
26
|
/**
|
|
27
27
|
* Title of the prompt template pipeline
|
|
28
28
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
29
29
|
*/
|
|
30
30
|
readonly title: string;
|
|
31
31
|
/**
|
|
32
|
-
* Version of the .
|
|
32
|
+
* Version of the .ptbk.json file
|
|
33
33
|
*/
|
|
34
|
-
readonly
|
|
34
|
+
readonly ptbkVersion: string_version;
|
|
35
35
|
/**
|
|
36
36
|
* Description of the prompt template pipeline
|
|
37
37
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
4
4
|
*
|
|
5
5
|
* It can have 3 formats:
|
|
6
|
-
* - _(this)_ **.
|
|
7
|
-
* - **JSON** format, parsed from the .
|
|
6
|
+
* - _(this)_ **.ptbk.md file** in custom markdown format described above
|
|
7
|
+
* - **JSON** format, parsed from the .ptbk.md file
|
|
8
8
|
* - **Object** which is created from JSON format and bound with tools around (but not the execution logic)
|
|
9
9
|
*
|
|
10
10
|
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
@@ -20,18 +20,6 @@ export type string_prompt = string;
|
|
|
20
20
|
* For example `"A cat wearing a {ITEM}"`
|
|
21
21
|
*/
|
|
22
22
|
export type string_template = string;
|
|
23
|
-
/**
|
|
24
|
-
* Semantic helper
|
|
25
|
-
*
|
|
26
|
-
* For example `"A cat wearing a hat"`
|
|
27
|
-
*/
|
|
28
|
-
export type string_image_prompt = string_prompt;
|
|
29
|
-
/**
|
|
30
|
-
* Semantic helper
|
|
31
|
-
*
|
|
32
|
-
* For example `"A cat wearing a hat --wallpaper --v 5.2"`
|
|
33
|
-
*/
|
|
34
|
-
export type string_midjourney_prompt = string_image_prompt;
|
|
35
23
|
/**
|
|
36
24
|
* Semantic helper
|
|
37
25
|
*
|
|
@@ -191,15 +179,15 @@ export type string_url = string;
|
|
|
191
179
|
/**
|
|
192
180
|
* Semantic helper
|
|
193
181
|
*
|
|
194
|
-
* For example `"https://
|
|
182
|
+
* For example `"https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
|
|
195
183
|
*/
|
|
196
|
-
export type
|
|
184
|
+
export type string_ptbk_url = string;
|
|
197
185
|
/**
|
|
198
186
|
* Semantic helper
|
|
199
187
|
*
|
|
200
|
-
* For example `"https://
|
|
188
|
+
* For example `"https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
|
|
201
189
|
*/
|
|
202
|
-
export type
|
|
190
|
+
export type string_ptbk_url_with_hashtemplate = string;
|
|
203
191
|
/**
|
|
204
192
|
* Semantic helper
|
|
205
193
|
*
|
|
@@ -389,10 +377,6 @@ export interface IRepository {
|
|
|
389
377
|
readonly type?: string | 'git';
|
|
390
378
|
readonly url?: string;
|
|
391
379
|
}
|
|
392
|
-
/**
|
|
393
|
-
* CSS cursor type
|
|
394
|
-
*/
|
|
395
|
-
export type string_css_cursor = 'alias' | 'all-scroll' | 'auto' | 'cell' | 'context-menu' | 'col-resize' | 'copy' | 'crosshair' | 'default' | 'e-resize' | 'ew-resize' | 'grab' | 'grabbing' | 'help' | 'move' | 'n-resize' | 'ne-resize' | 'nesw-resize' | 'ns-resize' | 'nw-resize' | 'nwse-resize' | 'no-drop' | 'none' | 'not-allowed' | 'pointer' | 'progress' | 'row-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'text' | 'w-resize' | 'wait' | 'zoom-in' | 'zoom-out';
|
|
396
380
|
/**
|
|
397
381
|
* Semantic helper for attributes
|
|
398
382
|
*
|