@promptbook/openai 0.40.0-1 → 0.40.0-10
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 +5 -1
- package/esm/typings/_packages/types.index.d.ts +1 -7
- package/esm/typings/errors/PromptbookReferenceError.d.ts +7 -0
- package/esm/typings/execution/createPromptbookExecutor.d.ts +1 -1
- package/esm/typings/library/PromptbookLibrary.d.ts +1 -1
- package/esm/typings/library/SimplePromptbookLibrary.d.ts +7 -13
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +7 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +16 -0
- package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +6 -0
- package/package.json +2 -2
- package/umd/typings/_packages/core.index.d.ts +5 -1
- package/umd/typings/_packages/types.index.d.ts +1 -7
- package/umd/typings/errors/PromptbookReferenceError.d.ts +7 -0
- package/umd/typings/execution/createPromptbookExecutor.d.ts +1 -1
- package/umd/typings/library/PromptbookLibrary.d.ts +1 -1
- package/umd/typings/library/SimplePromptbookLibrary.d.ts +7 -13
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +7 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +16 -0
- package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +6 -0
|
@@ -6,9 +6,13 @@ import { CallbackInterfaceTools } from '../execution/plugins/user-interface-exec
|
|
|
6
6
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
7
7
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
8
8
|
import { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
|
|
9
|
+
import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
|
|
10
|
+
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
11
|
+
import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
|
|
9
12
|
import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
10
13
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
11
|
-
export { ExecutionTypes, PROMPTBOOK_VERSION
|
|
14
|
+
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
15
|
+
export { SimplePromptbookLibrary, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, };
|
|
12
16
|
export { SimplePromptInterfaceTools };
|
|
13
17
|
export { promptbookStringToJson, validatePromptbookJson };
|
|
14
18
|
export { MockedEchoNaturalExecutionTools };
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { ExpectError } from '../errors/ExpectError';
|
|
2
|
-
import { NotFoundError } from '../errors/NotFoundError';
|
|
3
|
-
import { PromptbookExecutionError } from '../errors/PromptbookExecutionError';
|
|
4
|
-
import { PromptbookLogicError } from '../errors/PromptbookLogicError';
|
|
5
|
-
import { PromptbookSyntaxError } from '../errors/PromptbookSyntaxError';
|
|
6
1
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
7
2
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
8
3
|
import type { NaturalExecutionTools } from '../execution/NaturalExecutionTools';
|
|
@@ -26,8 +21,7 @@ import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
|
26
21
|
import type { client_id, string_char, 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 } from '../types/typeAliases';
|
|
27
22
|
import { FromtoItems } from '../utils/FromtoItems';
|
|
28
23
|
export { CommonExecutionToolsOptions, EXPECTATION_UNITS, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, FromtoItems, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, 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, };
|
|
29
|
-
export { ExpectError, NotFoundError, PromptbookExecutionError, PromptbookLogicError, PromptbookSyntaxError };
|
|
30
24
|
/**
|
|
31
|
-
* TODO: [🧠] Is this the best package to export custom errors from?
|
|
25
|
+
* TODO: [🧠][🆔] Is this the best package to export custom errors from?
|
|
32
26
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
33
27
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PromptbookJson } from '../_packages/types.index';
|
|
2
2
|
import { ExecutionTools } from './ExecutionTools';
|
|
3
3
|
import { PromptbookExecutor } from './PromptbookExecutor';
|
|
4
|
-
|
|
4
|
+
type CreatePromptbookExecutorSettings = {
|
|
5
5
|
/**
|
|
6
6
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
7
|
*
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import { CreatePromptbookExecutorSettings } from '../execution/createPromptbookExecutor';
|
|
2
1
|
import type { Prompt } from '../types/Prompt';
|
|
3
2
|
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
4
|
-
import type { PromptbookString } from '../types/PromptbookString';
|
|
5
3
|
import type { string_promptbook_url } from '../types/typeAliases';
|
|
6
4
|
import { PromptbookLibrary } from './PromptbookLibrary';
|
|
7
5
|
/**
|
|
8
6
|
* Library of promptbooks that groups together promptbooks for an application.
|
|
9
|
-
* This implementation is a very thin wrapper around the Array /
|
|
7
|
+
* This implementation is a very thin wrapper around the Array / Map of promptbooks.
|
|
10
8
|
*
|
|
11
9
|
* @see https://github.com/webgptorg/promptbook#promptbook-library
|
|
12
10
|
*/
|
|
13
11
|
export declare class SimplePromptbookLibrary implements PromptbookLibrary {
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
* Constructs Promptbook from any sources
|
|
12
|
+
private library;
|
|
13
|
+
/**!!!
|
|
17
14
|
*
|
|
18
|
-
*
|
|
19
|
-
* Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
|
|
15
|
+
* @param promptbooks !!!
|
|
20
16
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @returns PromptbookLibrary
|
|
17
|
+
* Note: During the construction logic of all promptbooks are validated
|
|
18
|
+
* Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
|
|
24
19
|
*/
|
|
25
|
-
|
|
26
|
-
private constructor();
|
|
20
|
+
constructor(...promptbooks: Array<PromptbookJson>);
|
|
27
21
|
/**
|
|
28
22
|
* Gets all promptbooks in the library
|
|
29
23
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
+
import { PromptbookString } from '../../types/PromptbookString';
|
|
3
|
+
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
4
|
+
export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
|
|
5
|
+
/***
|
|
6
|
+
* TODO: !!! Annotate all + all to README and samples
|
|
7
|
+
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PromptbookJson, PromptbookString } from '../../_packages/types.index';
|
|
2
|
+
import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
|
|
3
|
+
export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): SimplePromptbookLibrary;
|
|
4
|
+
/**
|
|
5
|
+
* Constructs Promptbook from any sources
|
|
6
|
+
*
|
|
7
|
+
* Note: During the construction syntax and logic of all sources are validated
|
|
8
|
+
* Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
|
|
9
|
+
*
|
|
10
|
+
* @param promptbookSources contents of .ptbk.md or .ptbk.json files
|
|
11
|
+
* @param settings settings for creating executor functions
|
|
12
|
+
* @returns PromptbookLibrary
|
|
13
|
+
*/
|
|
14
|
+
/***
|
|
15
|
+
* TODO: !!! Annotate all + all to README and samples
|
|
16
|
+
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { string_promptbook_url } from '../../types/typeAliases';
|
|
2
|
+
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
3
|
+
export declare function createPromptbookSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
|
|
4
|
+
/***
|
|
5
|
+
* TODO: !!! Annotate all + all to README and samples
|
|
6
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/openai",
|
|
3
|
-
"version": "0.40.0-
|
|
3
|
+
"version": "0.40.0-10",
|
|
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
|
"openai": "4.2.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@promptbook/core": "0.40.0-
|
|
40
|
+
"@promptbook/core": "0.40.0-10"
|
|
41
41
|
},
|
|
42
42
|
"main": "./umd/index.umd.js",
|
|
43
43
|
"module": "./esm/index.es.js",
|
|
@@ -6,9 +6,13 @@ import { CallbackInterfaceTools } from '../execution/plugins/user-interface-exec
|
|
|
6
6
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
7
7
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
8
8
|
import { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
|
|
9
|
+
import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
|
|
10
|
+
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
11
|
+
import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
|
|
9
12
|
import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
10
13
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
11
|
-
export { ExecutionTypes, PROMPTBOOK_VERSION
|
|
14
|
+
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
15
|
+
export { SimplePromptbookLibrary, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, };
|
|
12
16
|
export { SimplePromptInterfaceTools };
|
|
13
17
|
export { promptbookStringToJson, validatePromptbookJson };
|
|
14
18
|
export { MockedEchoNaturalExecutionTools };
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { ExpectError } from '../errors/ExpectError';
|
|
2
|
-
import { NotFoundError } from '../errors/NotFoundError';
|
|
3
|
-
import { PromptbookExecutionError } from '../errors/PromptbookExecutionError';
|
|
4
|
-
import { PromptbookLogicError } from '../errors/PromptbookLogicError';
|
|
5
|
-
import { PromptbookSyntaxError } from '../errors/PromptbookSyntaxError';
|
|
6
1
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
7
2
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
8
3
|
import type { NaturalExecutionTools } from '../execution/NaturalExecutionTools';
|
|
@@ -26,8 +21,7 @@ import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
|
26
21
|
import type { client_id, string_char, 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 } from '../types/typeAliases';
|
|
27
22
|
import { FromtoItems } from '../utils/FromtoItems';
|
|
28
23
|
export { CommonExecutionToolsOptions, EXPECTATION_UNITS, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, FromtoItems, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, 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, };
|
|
29
|
-
export { ExpectError, NotFoundError, PromptbookExecutionError, PromptbookLogicError, PromptbookSyntaxError };
|
|
30
24
|
/**
|
|
31
|
-
* TODO: [🧠] Is this the best package to export custom errors from?
|
|
25
|
+
* TODO: [🧠][🆔] Is this the best package to export custom errors from?
|
|
32
26
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
33
27
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PromptbookJson } from '../_packages/types.index';
|
|
2
2
|
import { ExecutionTools } from './ExecutionTools';
|
|
3
3
|
import { PromptbookExecutor } from './PromptbookExecutor';
|
|
4
|
-
|
|
4
|
+
type CreatePromptbookExecutorSettings = {
|
|
5
5
|
/**
|
|
6
6
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
7
|
*
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import { CreatePromptbookExecutorSettings } from '../execution/createPromptbookExecutor';
|
|
2
1
|
import type { Prompt } from '../types/Prompt';
|
|
3
2
|
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
4
|
-
import type { PromptbookString } from '../types/PromptbookString';
|
|
5
3
|
import type { string_promptbook_url } from '../types/typeAliases';
|
|
6
4
|
import { PromptbookLibrary } from './PromptbookLibrary';
|
|
7
5
|
/**
|
|
8
6
|
* Library of promptbooks that groups together promptbooks for an application.
|
|
9
|
-
* This implementation is a very thin wrapper around the Array /
|
|
7
|
+
* This implementation is a very thin wrapper around the Array / Map of promptbooks.
|
|
10
8
|
*
|
|
11
9
|
* @see https://github.com/webgptorg/promptbook#promptbook-library
|
|
12
10
|
*/
|
|
13
11
|
export declare class SimplePromptbookLibrary implements PromptbookLibrary {
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
* Constructs Promptbook from any sources
|
|
12
|
+
private library;
|
|
13
|
+
/**!!!
|
|
17
14
|
*
|
|
18
|
-
*
|
|
19
|
-
* Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
|
|
15
|
+
* @param promptbooks !!!
|
|
20
16
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @returns PromptbookLibrary
|
|
17
|
+
* Note: During the construction logic of all promptbooks are validated
|
|
18
|
+
* Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
|
|
24
19
|
*/
|
|
25
|
-
|
|
26
|
-
private constructor();
|
|
20
|
+
constructor(...promptbooks: Array<PromptbookJson>);
|
|
27
21
|
/**
|
|
28
22
|
* Gets all promptbooks in the library
|
|
29
23
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
+
import { PromptbookString } from '../../types/PromptbookString';
|
|
3
|
+
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
4
|
+
export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
|
|
5
|
+
/***
|
|
6
|
+
* TODO: !!! Annotate all + all to README and samples
|
|
7
|
+
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PromptbookJson, PromptbookString } from '../../_packages/types.index';
|
|
2
|
+
import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
|
|
3
|
+
export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): SimplePromptbookLibrary;
|
|
4
|
+
/**
|
|
5
|
+
* Constructs Promptbook from any sources
|
|
6
|
+
*
|
|
7
|
+
* Note: During the construction syntax and logic of all sources are validated
|
|
8
|
+
* Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
|
|
9
|
+
*
|
|
10
|
+
* @param promptbookSources contents of .ptbk.md or .ptbk.json files
|
|
11
|
+
* @param settings settings for creating executor functions
|
|
12
|
+
* @returns PromptbookLibrary
|
|
13
|
+
*/
|
|
14
|
+
/***
|
|
15
|
+
* TODO: !!! Annotate all + all to README and samples
|
|
16
|
+
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { string_promptbook_url } from '../../types/typeAliases';
|
|
2
|
+
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
3
|
+
export declare function createPromptbookSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
|
|
4
|
+
/***
|
|
5
|
+
* TODO: !!! Annotate all + all to README and samples
|
|
6
|
+
*/
|