@promptbook/types 0.35.0 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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/utils/markdown/addAutoGeneratedSection.d.ts +10 -0
- package/esm/typings/utils/markdown/createMarkdownChart.d.ts +4 -0
- package/esm/typings/version.d.ts +1 -1
- package/package.json +2 -2
- 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/umd/typings/conversion/validatePromptbookJson.test.d.ts +1 -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/utils/markdown/addAutoGeneratedSection.d.ts +10 -0
- package/umd/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
- package/umd/typings/utils/markdown/createMarkdownChart.d.ts +4 -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 → esm/typings/utils/markdown/addAutoGeneratedSection.test.d.ts} +0 -0
- /package/umd/typings/conversion/{promptTemplatePipelineStringToJson.test.d.ts → promptbookStringToJson-syntaxErrors.test.d.ts} +0 -0
- /package/umd/typings/conversion/{validatePromptTemplatePipelineJson-logicErrors.test.d.ts → promptbookStringToJson.test.d.ts} +0 -0
- /package/umd/typings/conversion/{validatePromptTemplatePipelineJson.test.d.ts → validatePromptbookJson-logicErrors.test.d.ts} +0 -0
package/umd/typings/config.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ModelRequirements } from './types/ModelRequirements';
|
|
2
|
-
/**
|
|
3
|
-
* Default model requirements for the pipeline
|
|
4
|
-
*
|
|
5
|
-
* Note: As default, we use the chat model gpt-3.5-turbo. For most tasks, this is the best model with most intuitive usage.
|
|
6
|
-
* GPT-4 is overkill for most tasks so keeping it as opt-in option.
|
|
7
|
-
*/
|
|
8
|
-
export declare const DEFAULT_MODEL_REQUIREMENTS: ModelRequirements;
|
|
9
|
-
/**
|
|
10
|
-
* TODO: !!! Different default model for different model variant
|
|
11
|
-
* TODO: [🧠] What should be the default model?
|
|
12
|
-
*/
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson';
|
|
2
|
-
import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineString';
|
|
3
|
-
/**
|
|
4
|
-
* Import the text file
|
|
5
|
-
*
|
|
6
|
-
* Note: Using here custom import to work in jest tests
|
|
7
|
-
* Note: Using sync version is 💩 in the production code, but it's ok here in tests
|
|
8
|
-
*
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
export declare function importPtp(path: `${string}.ptbk.md`): PromptTemplatePipelineString;
|
|
12
|
-
export declare function importPtp(path: `${string}.ptbk.json`): PromptTemplatePipelineJson;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson';
|
|
2
|
-
import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineString';
|
|
3
|
-
/**
|
|
4
|
-
* Parse prompt template pipeline from string format to JSON format
|
|
5
|
-
*
|
|
6
|
-
* Note: This function does not validate logic of the pipeline only the syntax
|
|
7
|
-
*/
|
|
8
|
-
export declare function promptTemplatePipelineStringToJson(promptTemplatePipelineString: PromptTemplatePipelineString): PromptTemplatePipelineJson;
|
|
9
|
-
/**
|
|
10
|
-
* TODO: Report here line/column of error
|
|
11
|
-
* TODO: Use spaceTrim more effectively
|
|
12
|
-
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
13
|
-
*/
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson';
|
|
2
|
-
/**
|
|
3
|
-
* Validates PromptTemplatePipelineJson if it is logically valid.
|
|
4
|
-
*
|
|
5
|
-
* It checks:
|
|
6
|
-
* - if it has correct parameters dependency
|
|
7
|
-
*
|
|
8
|
-
* It does NOT check:
|
|
9
|
-
* - if it is valid json
|
|
10
|
-
* - if it is meaningful
|
|
11
|
-
*
|
|
12
|
-
* @param ptp valid or invalid PromptTemplatePipelineJson
|
|
13
|
-
* @throws {Error} if invalid
|
|
14
|
-
*/
|
|
15
|
-
export declare function validatePromptTemplatePipelineJson(ptp: PromptTemplatePipelineJson): void;
|
|
16
|
-
/**
|
|
17
|
-
* TODO: [🧠] Work with ptbkVersion
|
|
18
|
-
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
19
|
-
* > /**
|
|
20
|
-
* > * Validates PromptTemplatePipelineJson if it is logically valid.
|
|
21
|
-
* > *
|
|
22
|
-
* > * It checks:
|
|
23
|
-
* > * - it has a valid structure
|
|
24
|
-
* > * - ...
|
|
25
|
-
* > ex port function validatePromptTemplatePipelineJson(ptp: unknown): asserts ptp is PromptTemplatePipelineJson {
|
|
26
|
-
*/
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { PromptTemplatePipelineJson } from '../_packages/types.index';
|
|
2
|
-
import { ExecutionTools } from './ExecutionTools';
|
|
3
|
-
import { PtpExecutor } from './PtpExecutor';
|
|
4
|
-
export interface CreatePtpExecutorSettings {
|
|
5
|
-
/**
|
|
6
|
-
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
|
-
*
|
|
8
|
-
* @default 3
|
|
9
|
-
*/
|
|
10
|
-
readonly maxExecutionAttempts: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Options for creating a PTP (Prompt Template Pipeline) executor
|
|
14
|
-
*/
|
|
15
|
-
interface CreatePtpExecutorOptions {
|
|
16
|
-
/**
|
|
17
|
-
* The Prompt Template Pipeline (PTP) to be executed
|
|
18
|
-
*/
|
|
19
|
-
readonly ptp: PromptTemplatePipelineJson;
|
|
20
|
-
/**
|
|
21
|
-
* The execution tools to be used during the execution of the PTP
|
|
22
|
-
*/
|
|
23
|
-
readonly tools: ExecutionTools;
|
|
24
|
-
/**
|
|
25
|
-
* Optional settings for the PTP executor
|
|
26
|
-
*/
|
|
27
|
-
readonly settings?: Partial<CreatePtpExecutorSettings>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Creates executor function from prompt template pipeline and execution tools.
|
|
31
|
-
*
|
|
32
|
-
* Note: Consider using getExecutor method of the library instead of using this function
|
|
33
|
-
*/
|
|
34
|
-
export declare function createPtpExecutor(options: CreatePtpExecutorOptions): PtpExecutor;
|
|
35
|
-
export {};
|
|
36
|
-
/**
|
|
37
|
-
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
38
|
-
* TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
|
|
39
|
-
* Note: CreatePtpExecutorOptions are just connected to PtpExecutor so do not extract to types folder
|
|
40
|
-
*/
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt template pipeline 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
|
-
* It can have 3 formats:
|
|
6
|
-
* - _(this)_ **.ptbk.md file** in custom markdown format described above
|
|
7
|
-
* - **JSON** format, parsed from the .ptbk.md file
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/webgptorg/promptbook#prompt-template-pipeline
|
|
10
|
-
*/
|
|
11
|
-
export type PromptTemplatePipelineString = string & {
|
|
12
|
-
readonly _type: 'PromptTemplatePipeline';
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* TODO: !! Better validation (validatePromptTemplatePipelineString) or remove branded type and make it just string
|
|
16
|
-
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|