@promptbook/openai 0.36.4 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/typings/_packages/wizzard.index.d.ts +3 -0
- package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/execution/ExecutionTools.d.ts +2 -2
- package/esm/typings/execution/NaturalExecutionTools.d.ts +2 -2
- package/esm/typings/execution/PromptResult.d.ts +3 -4
- package/esm/typings/execution/PromptbookExecutor.d.ts +2 -2
- package/esm/typings/execution/ScriptExecutionTools.d.ts +5 -5
- package/esm/typings/execution/UserInterfaceTools.d.ts +4 -4
- package/esm/typings/execution/createPromptbookExecutor.d.ts +3 -2
- package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/{IAutomaticTranslator.d.ts → AutomaticTranslator.d.ts} +2 -2
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +3 -3
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +2 -2
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +5 -5
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
- package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +4 -4
- package/esm/typings/types/Command.d.ts +20 -19
- package/esm/typings/types/ModelRequirements.d.ts +3 -3
- package/esm/typings/types/Prompt.d.ts +2 -2
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
- package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +6 -4
- package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -2
- package/esm/typings/types/TaskProgress.d.ts +2 -2
- package/esm/typings/types/typeAliases.d.ts +0 -26
- package/esm/typings/utils/markdown-json/MarkdownStructure.d.ts +2 -2
- package/esm/typings/wizzard/Wizzard.d.ts +3 -0
- package/esm/typings/wizzard/sample.d.ts +1 -0
- package/package.json +2 -2
- package/umd/typings/_packages/wizzard.index.d.ts +3 -0
- package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +2 -2
- package/umd/typings/execution/ExecutionTools.d.ts +2 -2
- package/umd/typings/execution/NaturalExecutionTools.d.ts +2 -2
- package/umd/typings/execution/PromptResult.d.ts +3 -4
- package/umd/typings/execution/PromptbookExecutor.d.ts +2 -2
- package/umd/typings/execution/ScriptExecutionTools.d.ts +5 -5
- package/umd/typings/execution/UserInterfaceTools.d.ts +4 -4
- package/umd/typings/execution/createPromptbookExecutor.d.ts +3 -2
- package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +2 -2
- package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/{IAutomaticTranslator.d.ts → AutomaticTranslator.d.ts} +2 -2
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +3 -3
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +2 -2
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +5 -5
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
- package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +4 -4
- package/umd/typings/types/Command.d.ts +20 -19
- package/umd/typings/types/ModelRequirements.d.ts +3 -3
- package/umd/typings/types/Prompt.d.ts +2 -2
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
- package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +6 -4
- package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -2
- package/umd/typings/types/TaskProgress.d.ts +2 -2
- package/umd/typings/types/typeAliases.d.ts +0 -26
- package/umd/typings/utils/markdown-json/MarkdownStructure.d.ts +2 -2
- package/umd/typings/wizzard/Wizzard.d.ts +3 -0
- package/umd/typings/wizzard/sample.d.ts +1 -0
- package/esm/typings/execution/translation/automatic-translate/automatic-translators/ITranslatorOptions.d.ts +0 -4
- package/umd/typings/execution/translation/automatic-translate/automatic-translators/ITranslatorOptions.d.ts +0 -4
|
@@ -7,7 +7,7 @@ import { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
|
7
7
|
*
|
|
8
8
|
* @see https://github.com/webgptorg/promptbook#natural-execution-tools
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type NaturalExecutionTools = {
|
|
11
11
|
/**
|
|
12
12
|
* Use a chat model
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ export interface NaturalExecutionTools {
|
|
|
16
16
|
* Use a completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
/**
|
|
21
21
|
* TODO: [🏳] gptChat -> chat, gptComplete -> complete, translate
|
|
22
22
|
* TODO: [🧠] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
@@ -14,9 +14,8 @@ export type PromptCompletionResult = PromptCommonResult;
|
|
|
14
14
|
/**
|
|
15
15
|
* Prompt chat result
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
export interface PromptCommonResult {
|
|
17
|
+
export type PromptChatResult = PromptCommonResult & {};
|
|
18
|
+
export type PromptCommonResult = {
|
|
20
19
|
/**
|
|
21
20
|
* Exact text response from the model
|
|
22
21
|
*/
|
|
@@ -65,7 +64,7 @@ export interface PromptCommonResult {
|
|
|
65
64
|
* Raw response from the model
|
|
66
65
|
*/
|
|
67
66
|
readonly rawResponse: object;
|
|
68
|
-
}
|
|
67
|
+
};
|
|
69
68
|
/**
|
|
70
69
|
* TODO: [🧠] Maybe timing more accurate then seconds?
|
|
71
70
|
* TODO: [🧠] Should here be link to the prompt?
|
|
@@ -12,7 +12,7 @@ import type { string_name } from '../types/typeAliases';
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://github.com/webgptorg/promptbook#executor
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type PromptbookExecutor = {
|
|
16
16
|
(inputParameters: Record<string_name, string>, onProgress: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
17
17
|
/**
|
|
18
18
|
* Whether the execution was successful
|
|
@@ -33,7 +33,7 @@ export interface PromptbookExecutor {
|
|
|
33
33
|
*/
|
|
34
34
|
outputParameters: Record<string_name, string>;
|
|
35
35
|
}>;
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
/**
|
|
38
38
|
* TODO: [🧠] Should this file be in /execution or /types folder?
|
|
39
39
|
*/
|
|
@@ -5,13 +5,13 @@ import { ScriptLanguage } from '../types/ScriptLanguage';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook#script-execution-tools
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type ScriptExecutionTools = {
|
|
9
9
|
execute(options: ScriptExecutionToolsExecuteOptions): Promise<string>;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
/**
|
|
12
12
|
* Input for the script execution
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type ScriptExecutionToolsExecuteOptions = {
|
|
15
15
|
/**
|
|
16
16
|
* Language of the script
|
|
17
17
|
*/
|
|
@@ -31,7 +31,7 @@ export interface ScriptExecutionToolsExecuteOptions {
|
|
|
31
31
|
* - It can use the parameters as variables and functions from global scope
|
|
32
32
|
*/
|
|
33
33
|
script: string_script;
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
/**
|
|
36
36
|
* TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
37
|
-
*/
|
|
37
|
+
*/
|
|
@@ -4,7 +4,7 @@ import { number_integer, number_positive } from '../types/typeAliases';
|
|
|
4
4
|
*
|
|
5
5
|
* @see https://github.com/webgptorg/promptbook#user-interface-tools
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type UserInterfaceTools = {
|
|
8
8
|
/**
|
|
9
9
|
* Asks the user to answer a free-text (multiline) question
|
|
10
10
|
*
|
|
@@ -12,8 +12,8 @@ export interface UserInterfaceTools {
|
|
|
12
12
|
* @returns the answer from the user
|
|
13
13
|
*/
|
|
14
14
|
promptDialog(options: UserInterfaceToolsPromptDialogOptions): Promise<string>;
|
|
15
|
-
}
|
|
16
|
-
export
|
|
15
|
+
};
|
|
16
|
+
export type UserInterfaceToolsPromptDialogOptions = {
|
|
17
17
|
/**
|
|
18
18
|
* Prompt title
|
|
19
19
|
*
|
|
@@ -42,4 +42,4 @@ export interface UserInterfaceToolsPromptDialogOptions {
|
|
|
42
42
|
* Note: This would be reflected for example into the UI z-index of the prompt modal
|
|
43
43
|
*/
|
|
44
44
|
priority: number_integer & number_positive;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { PromptbookJson } from '../_packages/types.index';
|
|
2
2
|
import { ExecutionTools } from './ExecutionTools';
|
|
3
3
|
import { PromptbookExecutor } from './PromptbookExecutor';
|
|
4
|
-
export
|
|
4
|
+
export type CreatePromptbookExecutorSettings = {
|
|
5
5
|
/**
|
|
6
6
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
7
|
*
|
|
8
8
|
* @default 3
|
|
9
9
|
*/
|
|
10
10
|
readonly maxExecutionAttempts: number;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
/**
|
|
13
13
|
* Options for creating a promptbook executor
|
|
14
14
|
*/
|
|
@@ -37,4 +37,5 @@ export {};
|
|
|
37
37
|
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
38
38
|
* TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
|
|
39
39
|
* Note: CreatePromptbookExecutorOptions are just connected to PromptbookExecutor so do not extract to types folder
|
|
40
|
+
* TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
40
41
|
*/
|
|
@@ -3,7 +3,7 @@ import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOption
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for OpenAiExecutionTools
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
7
|
/**
|
|
8
8
|
* OpenAI API key
|
|
9
9
|
*/
|
|
@@ -13,4 +13,4 @@ export interface OpenAiExecutionToolsOptions extends CommonExecutionToolsOptions
|
|
|
13
13
|
* and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
14
14
|
*/
|
|
15
15
|
user?: string_token;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
@@ -3,7 +3,7 @@ import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOption
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for RemoteNaturalExecutionTools
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type RemoteNaturalExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
7
|
/**
|
|
8
8
|
* URL of the remote PROMPTBOOK server
|
|
9
9
|
* On this server will be connected to the socket.io server
|
|
@@ -20,4 +20,4 @@ export interface RemoteNaturalExecutionToolsOptions extends CommonExecutionTools
|
|
|
20
20
|
* Your client ID
|
|
21
21
|
*/
|
|
22
22
|
readonly clientId: client_id;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
@@ -2,7 +2,7 @@ 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';
|
|
5
|
-
export
|
|
5
|
+
export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
6
6
|
/**
|
|
7
7
|
* Port on which the server will listen
|
|
8
8
|
*/
|
|
@@ -24,4 +24,4 @@ export interface RemoteServerOptions extends CommonExecutionToolsOptions {
|
|
|
24
24
|
* Creates natural execution tools for each client
|
|
25
25
|
*/
|
|
26
26
|
createNaturalExecutionTools(clientId: client_id): NaturalExecutionTools;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
@@ -4,9 +4,9 @@ import { UserInterfaceToolsPromptDialogOptions } from '../../../UserInterfaceToo
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for CallbackInterfaceTools
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type CallbackInterfaceToolsOptions = CommonExecutionToolsOptions & {
|
|
8
8
|
/**
|
|
9
9
|
* The callback function to be called when promptDialog is called
|
|
10
10
|
*/
|
|
11
11
|
callback(prompt: UserInterfaceToolsPromptDialogOptions): Promisable<string>;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutomaticTranslator } from './AutomaticTranslator';
|
|
2
2
|
/**
|
|
3
3
|
* This will wrap an automatic translator and log each translation into the console
|
|
4
4
|
*/
|
|
5
|
-
export declare class DebugAutomaticTranslator implements
|
|
5
|
+
export declare class DebugAutomaticTranslator implements AutomaticTranslator {
|
|
6
6
|
private readonly automaticTranslator;
|
|
7
|
-
constructor(automaticTranslator:
|
|
7
|
+
constructor(automaticTranslator: AutomaticTranslator);
|
|
8
8
|
translate(message: string): Promise<string>;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class FakeAutomaticTranslator implements
|
|
1
|
+
import { AutomaticTranslator } from './AutomaticTranslator';
|
|
2
|
+
export declare class FakeAutomaticTranslator implements AutomaticTranslator {
|
|
3
3
|
constructor();
|
|
4
4
|
translate(message: string): string;
|
|
5
5
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
1
|
+
import { AutomaticTranslator } from './AutomaticTranslator';
|
|
2
|
+
import { TranslatorOptions } from './TranslatorOptions';
|
|
3
|
+
interface LindatAutomaticTranslatorOptions extends TranslatorOptions {
|
|
4
4
|
apiUrl: URL;
|
|
5
5
|
}
|
|
6
|
-
export declare class LindatAutomaticTranslator implements
|
|
6
|
+
export declare class LindatAutomaticTranslator implements AutomaticTranslator {
|
|
7
7
|
private readonly options;
|
|
8
|
-
constructor(options:
|
|
8
|
+
constructor(options: LindatAutomaticTranslatorOptions);
|
|
9
9
|
translate(message: string): Promise<string>;
|
|
10
10
|
}
|
|
11
11
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AutomaticTranslator } from './automatic-translators/AutomaticTranslator';
|
|
2
|
+
import { TranslatorOptions } from './automatic-translators/TranslatorOptions';
|
|
3
3
|
export declare function translateMessages({ automaticTranslator, from, to, }: {
|
|
4
|
-
automaticTranslator:
|
|
5
|
-
} &
|
|
4
|
+
automaticTranslator: AutomaticTranslator;
|
|
5
|
+
} & TranslatorOptions): Promise<void>;
|
|
@@ -13,43 +13,43 @@ export type Command = PromptbookUrlCommand | PromptbookVersionCommand | ExecuteC
|
|
|
13
13
|
* - It is used for backward compatibility
|
|
14
14
|
* - It is defined per whole .promptbook file in the header
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type PromptbookUrlCommand = {
|
|
17
17
|
readonly type: 'PROMPTBOOK_URL';
|
|
18
18
|
readonly promptbookUrl: URL;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
/**
|
|
21
21
|
* PromptbookVersion command tells which version is .promptbook file using
|
|
22
22
|
*
|
|
23
23
|
* - It is used for backward compatibility
|
|
24
24
|
* - It is defined per whole .promptbook file in the header
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type PromptbookVersionCommand = {
|
|
27
27
|
readonly type: 'PROMPTBOOK_VERSION';
|
|
28
28
|
readonly promptbookVersion: string_version;
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
/**
|
|
31
31
|
* Execute command tells how to execute the section
|
|
32
32
|
* It can be either prompt template, script or SIMPLE TEMPLATE etc.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type ExecuteCommand = {
|
|
35
35
|
readonly type: 'EXECUTE';
|
|
36
36
|
readonly executionType: ExecutionType;
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
39
|
* Model command tells which model and modelRequirements to use for the prompt template. execution
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export type ModelCommand = {
|
|
42
42
|
readonly type: 'MODEL';
|
|
43
43
|
readonly key: keyof ModelRequirements;
|
|
44
44
|
readonly value: any;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
/**
|
|
47
47
|
* Joker parameter is used instead of executing the prompt template if it meet the expectations requirements
|
|
48
48
|
*/
|
|
49
|
-
export
|
|
49
|
+
export type JokerCommand = {
|
|
50
50
|
readonly type: 'JOKER';
|
|
51
51
|
readonly parameterName: string_name;
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
/**
|
|
54
54
|
* Parameter command describes one parameter of the prompt template
|
|
55
55
|
*
|
|
@@ -57,20 +57,21 @@ export interface JokerCommand {
|
|
|
57
57
|
* - It can have description
|
|
58
58
|
* - In description it can have simple formatting BUT not markdown structure or reference to other parameters
|
|
59
59
|
*/
|
|
60
|
-
export
|
|
60
|
+
export type ParameterCommand = {
|
|
61
61
|
readonly type: 'PARAMETER';
|
|
62
|
-
readonly
|
|
62
|
+
readonly isInput: boolean;
|
|
63
|
+
readonly isOutput: boolean;
|
|
63
64
|
readonly parameterName: string_name;
|
|
64
65
|
readonly parameterDescription: string_markdown_text | null;
|
|
65
|
-
}
|
|
66
|
+
};
|
|
66
67
|
/**
|
|
67
68
|
* Postprocess command describes which function to use for postprocessing
|
|
68
69
|
* This will be created as separate EXECUTE SCRIPT block bellow
|
|
69
70
|
*/
|
|
70
|
-
export
|
|
71
|
+
export type PostprocessCommand = {
|
|
71
72
|
readonly type: 'POSTPROCESS';
|
|
72
73
|
readonly functionName: string_name;
|
|
73
|
-
}
|
|
74
|
+
};
|
|
74
75
|
/**
|
|
75
76
|
* Expect command describes the desired output of the prompt template (after post-processing)
|
|
76
77
|
* It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
@@ -82,16 +83,16 @@ export type ExpectCommand = ExpectAmountCommand | ExpectFormatCommand;
|
|
|
82
83
|
*
|
|
83
84
|
* Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units.
|
|
84
85
|
*/
|
|
85
|
-
export
|
|
86
|
+
export type ExpectAmountCommand = {
|
|
86
87
|
readonly type: 'EXPECT_AMOUNT';
|
|
87
88
|
readonly sign: 'EXACTLY' | 'MINIMUM' | 'MAXIMUM';
|
|
88
89
|
readonly unit: ExpectationUnit;
|
|
89
90
|
readonly amount: ExpectationAmount;
|
|
90
|
-
}
|
|
91
|
+
};
|
|
91
92
|
/**
|
|
92
93
|
* Represents a command that expects a specific format.
|
|
93
94
|
*/
|
|
94
|
-
export
|
|
95
|
+
export type ExpectFormatCommand = {
|
|
95
96
|
readonly type: 'EXPECT_FORMAT';
|
|
96
97
|
readonly format: 'JSON';
|
|
97
|
-
}
|
|
98
|
+
};
|
|
@@ -7,13 +7,13 @@ export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT"];
|
|
|
7
7
|
* - **COMPLETION** - model that takes prompt and writes the rest of the text
|
|
8
8
|
* - **CHAT** - model that takes prompt and previous messages and returns response
|
|
9
9
|
*/
|
|
10
|
-
export type ModelVariant =
|
|
10
|
+
export type ModelVariant = typeof MODEL_VARIANTS[number];
|
|
11
11
|
/**
|
|
12
12
|
* Abstract way to specify the LLM. It does not specify the LLM with concrete version itself, only the requirements for the LLM.
|
|
13
13
|
*
|
|
14
14
|
* @see https://github.com/webgptorg/promptbook#model-requirements
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type ModelRequirements = {
|
|
17
17
|
/**
|
|
18
18
|
* Model variant describes the very general type of the model
|
|
19
19
|
*
|
|
@@ -34,7 +34,7 @@ export interface ModelRequirements {
|
|
|
34
34
|
* Maximum number of tokens that can be generated by the model
|
|
35
35
|
*/
|
|
36
36
|
readonly maxTokens?: number;
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
39
|
* TODO: Maybe figure out better word than "variant"
|
|
40
40
|
* TODO: Add here more requirement options like max context size, max tokens, etc.
|
|
@@ -5,7 +5,7 @@ import type { ModelRequirements } from './ModelRequirements';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook#prompt
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type Prompt = {
|
|
9
9
|
/**
|
|
10
10
|
* The title of the prompt
|
|
11
11
|
*
|
|
@@ -35,7 +35,7 @@ export interface Prompt {
|
|
|
35
35
|
* Note: This is redundant (same information is in promptbookUrl+content) but useful for logging and debugging
|
|
36
36
|
*/
|
|
37
37
|
readonly parameters: Record<string_name, string>;
|
|
38
|
-
}
|
|
38
|
+
};
|
|
39
39
|
/**
|
|
40
40
|
* TODO: [✔] Check ModelRequirements in runtime
|
|
41
41
|
*/
|
|
@@ -10,14 +10,14 @@ export type PromptTemplateJson = NaturalTemplateJson | SimpleTemplateJson | Scri
|
|
|
10
10
|
/**
|
|
11
11
|
* Template for prompt to LLM
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type NaturalTemplateJson = PromptTemplateJsonCommon & {
|
|
14
14
|
readonly executionType: 'PROMPT_TEMPLATE';
|
|
15
15
|
/**
|
|
16
16
|
* Requirements for the model
|
|
17
17
|
* - This is required only for executionType PROMPT_TEMPLATE
|
|
18
18
|
*/
|
|
19
19
|
readonly modelRequirements: ModelRequirements;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
/**
|
|
22
22
|
* Units of text measurement
|
|
23
23
|
*/
|
|
@@ -2,7 +2,7 @@ import { string_name } from '../typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Describes one parameter of the promptbook
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type PromptTemplateParameterJson = {
|
|
6
6
|
/**
|
|
7
7
|
* Name of the parameter
|
|
8
8
|
* - It must be unique across the pipeline
|
|
@@ -11,13 +11,15 @@ export interface PromptTemplateParameterJson {
|
|
|
11
11
|
readonly name: string_name;
|
|
12
12
|
/**
|
|
13
13
|
* The parameter is input of the pipeline
|
|
14
|
-
*
|
|
15
|
-
* Note: OUTPUT PARAMETER is every parameter including input one
|
|
16
14
|
*/
|
|
17
15
|
readonly isInput: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The parameter is output of the pipeline
|
|
18
|
+
*/
|
|
19
|
+
readonly isOutput: boolean;
|
|
18
20
|
/**
|
|
19
21
|
* Description of the parameter
|
|
20
22
|
* - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
21
23
|
*/
|
|
22
24
|
readonly description?: string;
|
|
23
|
-
}
|
|
25
|
+
};
|
|
@@ -7,7 +7,7 @@ import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
|
7
7
|
*
|
|
8
8
|
* @see https://github.com/webgptorg/promptbook#promptbook
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type PromptbookJson = {
|
|
11
11
|
/**
|
|
12
12
|
* Unique identifier of the promptbook
|
|
13
13
|
*
|
|
@@ -40,7 +40,7 @@ export interface PromptbookJson {
|
|
|
40
40
|
* Sequence of prompt templates that are chained together to form a pipeline
|
|
41
41
|
*/
|
|
42
42
|
readonly promptTemplates: Array<PromptTemplateJson>;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
/**
|
|
45
45
|
* TODO: [🧠] Best format of this code?
|
|
46
46
|
* There must be possible to make
|
|
@@ -3,7 +3,7 @@ import { string_markdown_text, string_name } from './typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* TaskProgress represents the progress of a Promptbook execution.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type TaskProgress = {
|
|
7
7
|
/**
|
|
8
8
|
* The unique name of the task.
|
|
9
9
|
*
|
|
@@ -39,4 +39,4 @@ export interface TaskProgress {
|
|
|
39
39
|
* The parameter value or null if the parameter is not yet processed.
|
|
40
40
|
*/
|
|
41
41
|
readonly parameterValue: string | null;
|
|
42
|
-
}
|
|
42
|
+
};
|
|
@@ -325,37 +325,12 @@ export type string_person_fullname = string;
|
|
|
325
325
|
* For example `"Pavol Hejný <pavol@hejny.org> (https://pavolhejny.com)"`
|
|
326
326
|
*/
|
|
327
327
|
export type string_person_profile = string;
|
|
328
|
-
/**
|
|
329
|
-
* Full profile of the person with his email and web (like in package.json)
|
|
330
|
-
*/
|
|
331
|
-
export interface IPersonProfile {
|
|
332
|
-
readonly name?: string_person_fullname;
|
|
333
|
-
/**
|
|
334
|
-
* Note: Photos are taken from Gravatar by email
|
|
335
|
-
*/
|
|
336
|
-
readonly email?: string_email;
|
|
337
|
-
readonly url?: string_url;
|
|
338
|
-
}
|
|
339
328
|
/**
|
|
340
329
|
* Semantic helper
|
|
341
330
|
*
|
|
342
331
|
* For example `"MIT"`
|
|
343
332
|
*/
|
|
344
333
|
export type string_license = string;
|
|
345
|
-
/**
|
|
346
|
-
* License with its type and url like in package.json
|
|
347
|
-
*/
|
|
348
|
-
export interface ILicense {
|
|
349
|
-
readonly type?: string_license;
|
|
350
|
-
readonly url?: string;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Repository with its type and url like in package.json
|
|
354
|
-
*/
|
|
355
|
-
export interface IRepository {
|
|
356
|
-
readonly type?: string | 'git';
|
|
357
|
-
readonly url?: string;
|
|
358
|
-
}
|
|
359
334
|
/**
|
|
360
335
|
* Semantic helper for attributes
|
|
361
336
|
*
|
|
@@ -392,7 +367,6 @@ export type string_translate_name_not_normalized = string;
|
|
|
392
367
|
* Implementing ISO 639-1
|
|
393
368
|
*
|
|
394
369
|
* TODO: Probably use enum
|
|
395
|
-
* TODO: Rename - remove string_ prefix like ITranslateLanguageCode
|
|
396
370
|
*/
|
|
397
371
|
export type string_translate_language = 'en' | 'cs';
|
|
398
372
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @private within the library
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type MarkdownStructure = {
|
|
7
7
|
/**
|
|
8
8
|
* The section level of the markdown file.
|
|
9
9
|
* h1 is level 1, h2 is level 2, etc.
|
|
@@ -22,4 +22,4 @@ export interface MarkdownStructure {
|
|
|
22
22
|
* The sub-sections of current section which are recursively structured.
|
|
23
23
|
*/
|
|
24
24
|
sections: MarkdownStructure[];
|
|
25
|
-
}
|
|
25
|
+
};
|