@promptbook/openai 0.53.0 → 0.54.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 +10 -0
- package/esm/typings/_packages/types.index.d.ts +0 -1
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -1
- package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +2 -1
- package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +3 -2
- package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +2 -1
- package/package.json +2 -2
- package/umd/typings/_packages/core.index.d.ts +10 -0
- package/umd/typings/_packages/types.index.d.ts +0 -1
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -1
- package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +2 -1
- package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +3 -2
- package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +2 -1
package/README.md
CHANGED
|
@@ -612,7 +612,7 @@ There are [postprocessing functions](#postprocessing-functions) that can be used
|
|
|
612
612
|
Executor is a simple async function that takes **input parameters** and returns **output parameters**.
|
|
613
613
|
It is constructed by combining execution tools and promptbook to execute together.
|
|
614
614
|
|
|
615
|
-
### 🃏 Jokers
|
|
615
|
+
### 🃏 Jokers (conditions)
|
|
616
616
|
|
|
617
617
|
Joker is a previously defined parameter that is used to bypass some parts of the pipeline.
|
|
618
618
|
If the joker is present in the template, it is checked to see if it meets the requirements (without postprocessing), and if so, it is used instead of executing that prompt template. There can be multiple wildcards in a prompt template, if so they are checked in order and the first one that meets the requirements is used.
|
|
@@ -2,6 +2,15 @@ import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptb
|
|
|
2
2
|
import { promptbookJsonToString } from '../conversion/promptbookJsonToString';
|
|
3
3
|
import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
|
|
4
4
|
import { validatePromptbookJson } from '../conversion/validation/validatePromptbookJson';
|
|
5
|
+
import { ExpectError } from '../errors/_ExpectError';
|
|
6
|
+
import { PromptbookExecutionError } from '../errors/PromptbookExecutionError';
|
|
7
|
+
import { PromptbookLibraryError } from '../errors/PromptbookLibraryError';
|
|
8
|
+
import { PromptbookLogicError } from '../errors/PromptbookLogicError';
|
|
9
|
+
import { PromptbookNotFoundError } from '../errors/PromptbookNotFoundError';
|
|
10
|
+
import { PromptbookReferenceError } from '../errors/PromptbookReferenceError';
|
|
11
|
+
import { PromptbookSyntaxError } from '../errors/PromptbookSyntaxError';
|
|
12
|
+
import { TemplateError } from '../errors/TemplateError';
|
|
13
|
+
import { UnexpectedError } from '../errors/UnexpectedError';
|
|
5
14
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
6
15
|
import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
|
|
7
16
|
import { MultipleLlmExecutionTools } from '../execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools';
|
|
@@ -27,3 +36,4 @@ export { SimplePromptInterfaceTools };
|
|
|
27
36
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
28
37
|
export { createPromptbookExecutor, MultipleLlmExecutionTools };
|
|
29
38
|
export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
|
|
39
|
+
export { ExpectError, PromptbookExecutionError, PromptbookLibraryError, PromptbookLogicError, PromptbookNotFoundError, PromptbookReferenceError, PromptbookSyntaxError, TemplateError, UnexpectedError, };
|
|
@@ -23,6 +23,5 @@ import type { client_id, string_char, string_chat_prompt, string_completion_prom
|
|
|
23
23
|
import { FromtoItems } from '../utils/FromtoItems';
|
|
24
24
|
export { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, 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_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
|
|
25
25
|
/**
|
|
26
|
-
* TODO: [🧠][🆔] Is this the best package to export custom errors from?
|
|
27
26
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
28
27
|
*/
|
|
@@ -3,6 +3,7 @@ import type { ExecutionType } from '../ExecutionTypes';
|
|
|
3
3
|
import type { ModelRequirements } from '../ModelRequirements';
|
|
4
4
|
import type { ScriptLanguage } from '../ScriptLanguage';
|
|
5
5
|
import type { number_integer } from '../typeAliases';
|
|
6
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
6
7
|
import type { number_positive_or_zero } from '../typeAliases';
|
|
7
8
|
import type { string_javascript } from '../typeAliases';
|
|
8
9
|
import type { string_javascript_name } from '../typeAliases';
|
|
@@ -92,7 +93,7 @@ interface PromptTemplateJsonCommon {
|
|
|
92
93
|
* Description of the prompt template
|
|
93
94
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
94
95
|
*/
|
|
95
|
-
readonly description?:
|
|
96
|
+
readonly description?: string_markdown_text;
|
|
96
97
|
/**
|
|
97
98
|
* List of parameter names that are used in the prompt template and must be defined before the prompt template is executed
|
|
98
99
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
1
2
|
import type { string_name } from '../typeAliases';
|
|
2
3
|
/**
|
|
3
4
|
* Describes one parameter of the promptbook
|
|
@@ -21,5 +22,5 @@ export type PromptTemplateParameterJson = {
|
|
|
21
22
|
* Description of the parameter
|
|
22
23
|
* - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
23
24
|
*/
|
|
24
|
-
readonly description?:
|
|
25
|
+
readonly description?: string_markdown_text;
|
|
25
26
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
1
2
|
import type { string_promptbook_url } from '../typeAliases';
|
|
2
3
|
import type { string_version } from '../typeAliases';
|
|
3
4
|
import type { PromptTemplateJson } from './PromptTemplateJson';
|
|
@@ -23,7 +24,7 @@ export type PromptbookJson = {
|
|
|
23
24
|
* Title of the promptbook
|
|
24
25
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
25
26
|
*/
|
|
26
|
-
readonly title:
|
|
27
|
+
readonly title: string_markdown_text;
|
|
27
28
|
/**
|
|
28
29
|
* Version of the .ptbk.json file
|
|
29
30
|
*/
|
|
@@ -32,7 +33,7 @@ export type PromptbookJson = {
|
|
|
32
33
|
* Description of the promptbook
|
|
33
34
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
34
35
|
*/
|
|
35
|
-
readonly description?:
|
|
36
|
+
readonly description?: string_markdown_text;
|
|
36
37
|
/**
|
|
37
38
|
* Set of variables that are used across the pipeline
|
|
38
39
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PromptResult } from '../../execution/PromptResult';
|
|
2
2
|
import type { Prompt } from '../Prompt';
|
|
3
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
3
4
|
import type { string_promptbook_url } from '../typeAliases';
|
|
4
5
|
import type { string_version } from '../typeAliases';
|
|
5
6
|
/**
|
|
@@ -32,7 +33,7 @@ export type ExecutionReportJson = {
|
|
|
32
33
|
/**
|
|
33
34
|
* Description of the promptbook which was executed
|
|
34
35
|
*/
|
|
35
|
-
readonly description?:
|
|
36
|
+
readonly description?: string_markdown_text;
|
|
36
37
|
/**
|
|
37
38
|
* Sequence of prompt templates in order which were executed
|
|
38
39
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.1",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@promptbook/core": "0.
|
|
51
|
+
"@promptbook/core": "0.54.1"
|
|
52
52
|
},
|
|
53
53
|
"main": "./umd/index.umd.js",
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
@@ -2,6 +2,15 @@ import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptb
|
|
|
2
2
|
import { promptbookJsonToString } from '../conversion/promptbookJsonToString';
|
|
3
3
|
import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
|
|
4
4
|
import { validatePromptbookJson } from '../conversion/validation/validatePromptbookJson';
|
|
5
|
+
import { ExpectError } from '../errors/_ExpectError';
|
|
6
|
+
import { PromptbookExecutionError } from '../errors/PromptbookExecutionError';
|
|
7
|
+
import { PromptbookLibraryError } from '../errors/PromptbookLibraryError';
|
|
8
|
+
import { PromptbookLogicError } from '../errors/PromptbookLogicError';
|
|
9
|
+
import { PromptbookNotFoundError } from '../errors/PromptbookNotFoundError';
|
|
10
|
+
import { PromptbookReferenceError } from '../errors/PromptbookReferenceError';
|
|
11
|
+
import { PromptbookSyntaxError } from '../errors/PromptbookSyntaxError';
|
|
12
|
+
import { TemplateError } from '../errors/TemplateError';
|
|
13
|
+
import { UnexpectedError } from '../errors/UnexpectedError';
|
|
5
14
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
6
15
|
import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
|
|
7
16
|
import { MultipleLlmExecutionTools } from '../execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools';
|
|
@@ -27,3 +36,4 @@ export { SimplePromptInterfaceTools };
|
|
|
27
36
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
28
37
|
export { createPromptbookExecutor, MultipleLlmExecutionTools };
|
|
29
38
|
export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
|
|
39
|
+
export { ExpectError, PromptbookExecutionError, PromptbookLibraryError, PromptbookLogicError, PromptbookNotFoundError, PromptbookReferenceError, PromptbookSyntaxError, TemplateError, UnexpectedError, };
|
|
@@ -23,6 +23,5 @@ import type { client_id, string_char, string_chat_prompt, string_completion_prom
|
|
|
23
23
|
import { FromtoItems } from '../utils/FromtoItems';
|
|
24
24
|
export { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, 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_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
|
|
25
25
|
/**
|
|
26
|
-
* TODO: [🧠][🆔] Is this the best package to export custom errors from?
|
|
27
26
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
28
27
|
*/
|
|
@@ -3,6 +3,7 @@ import type { ExecutionType } from '../ExecutionTypes';
|
|
|
3
3
|
import type { ModelRequirements } from '../ModelRequirements';
|
|
4
4
|
import type { ScriptLanguage } from '../ScriptLanguage';
|
|
5
5
|
import type { number_integer } from '../typeAliases';
|
|
6
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
6
7
|
import type { number_positive_or_zero } from '../typeAliases';
|
|
7
8
|
import type { string_javascript } from '../typeAliases';
|
|
8
9
|
import type { string_javascript_name } from '../typeAliases';
|
|
@@ -92,7 +93,7 @@ interface PromptTemplateJsonCommon {
|
|
|
92
93
|
* Description of the prompt template
|
|
93
94
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
94
95
|
*/
|
|
95
|
-
readonly description?:
|
|
96
|
+
readonly description?: string_markdown_text;
|
|
96
97
|
/**
|
|
97
98
|
* List of parameter names that are used in the prompt template and must be defined before the prompt template is executed
|
|
98
99
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
1
2
|
import type { string_name } from '../typeAliases';
|
|
2
3
|
/**
|
|
3
4
|
* Describes one parameter of the promptbook
|
|
@@ -21,5 +22,5 @@ export type PromptTemplateParameterJson = {
|
|
|
21
22
|
* Description of the parameter
|
|
22
23
|
* - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
23
24
|
*/
|
|
24
|
-
readonly description?:
|
|
25
|
+
readonly description?: string_markdown_text;
|
|
25
26
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
1
2
|
import type { string_promptbook_url } from '../typeAliases';
|
|
2
3
|
import type { string_version } from '../typeAliases';
|
|
3
4
|
import type { PromptTemplateJson } from './PromptTemplateJson';
|
|
@@ -23,7 +24,7 @@ export type PromptbookJson = {
|
|
|
23
24
|
* Title of the promptbook
|
|
24
25
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
25
26
|
*/
|
|
26
|
-
readonly title:
|
|
27
|
+
readonly title: string_markdown_text;
|
|
27
28
|
/**
|
|
28
29
|
* Version of the .ptbk.json file
|
|
29
30
|
*/
|
|
@@ -32,7 +33,7 @@ export type PromptbookJson = {
|
|
|
32
33
|
* Description of the promptbook
|
|
33
34
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
34
35
|
*/
|
|
35
|
-
readonly description?:
|
|
36
|
+
readonly description?: string_markdown_text;
|
|
36
37
|
/**
|
|
37
38
|
* Set of variables that are used across the pipeline
|
|
38
39
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PromptResult } from '../../execution/PromptResult';
|
|
2
2
|
import type { Prompt } from '../Prompt';
|
|
3
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
3
4
|
import type { string_promptbook_url } from '../typeAliases';
|
|
4
5
|
import type { string_version } from '../typeAliases';
|
|
5
6
|
/**
|
|
@@ -32,7 +33,7 @@ export type ExecutionReportJson = {
|
|
|
32
33
|
/**
|
|
33
34
|
* Description of the promptbook which was executed
|
|
34
35
|
*/
|
|
35
|
-
readonly description?:
|
|
36
|
+
readonly description?: string_markdown_text;
|
|
36
37
|
/**
|
|
37
38
|
* Sequence of prompt templates in order which were executed
|
|
38
39
|
*/
|