@promptbook/remote-client 0.59.0-21 → 0.59.0-23

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.
Files changed (45) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/typings/src/_packages/cli.index.d.ts +2 -2
  3. package/esm/typings/src/_packages/core.index.d.ts +6 -6
  4. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/types.index.d.ts +2 -1
  6. package/esm/typings/src/cli/actions/hello.d.ts +7 -0
  7. package/esm/typings/src/cli/actions/make.d.ts +7 -0
  8. package/esm/typings/src/cli/actions/prettify.d.ts +7 -0
  9. package/esm/typings/src/{conversion/prettify/prettifyPromptbookStringCli.d.ts → cli/promptbookCli.d.ts} +2 -2
  10. package/esm/typings/src/library/SimplePromptbookLibrary.d.ts +3 -1
  11. package/{umd/typings/src/library/constructors/createPromptbookLibraryFromDirectory.d.ts → esm/typings/src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
  12. package/esm/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
  13. package/{umd/typings/src/library/constructors/createPromptbookLibraryFromPromise.d.ts → esm/typings/src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
  14. package/{umd/typings/src/library/constructors/createPromptbookLibraryFromUrl.d.ts → esm/typings/src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
  15. package/esm/typings/src/library/constructors/{createPromptbookSublibrary.d.ts → createSublibrary.d.ts} +1 -1
  16. package/esm/typings/src/library/libraryToJson.d.ts +8 -0
  17. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  18. package/package.json +2 -2
  19. package/umd/index.umd.js +1 -1
  20. package/umd/typings/src/_packages/cli.index.d.ts +2 -2
  21. package/umd/typings/src/_packages/core.index.d.ts +6 -6
  22. package/umd/typings/src/_packages/node.index.d.ts +2 -2
  23. package/umd/typings/src/_packages/types.index.d.ts +2 -1
  24. package/umd/typings/src/cli/actions/hello.d.ts +7 -0
  25. package/umd/typings/src/cli/actions/make.d.ts +7 -0
  26. package/umd/typings/src/cli/actions/prettify.d.ts +7 -0
  27. package/umd/typings/src/{conversion/prettify/prettifyPromptbookStringCli.d.ts → cli/promptbookCli.d.ts} +2 -2
  28. package/umd/typings/src/library/SimplePromptbookLibrary.d.ts +3 -1
  29. package/{esm/typings/src/library/constructors/createPromptbookLibraryFromDirectory.d.ts → umd/typings/src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
  30. package/umd/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
  31. package/{esm/typings/src/library/constructors/createPromptbookLibraryFromPromise.d.ts → umd/typings/src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
  32. package/umd/typings/src/library/constructors/createLibraryFromPromise.test.d.ts +1 -0
  33. package/{esm/typings/src/library/constructors/createPromptbookLibraryFromUrl.d.ts → umd/typings/src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
  34. package/umd/typings/src/library/constructors/{createPromptbookSublibrary.d.ts → createSublibrary.d.ts} +1 -1
  35. package/umd/typings/src/library/libraryToJson.d.ts +8 -0
  36. package/umd/typings/src/library/libraryToJson.test.d.ts +1 -0
  37. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  38. package/esm/typings/src/library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
  39. package/umd/typings/src/library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
  40. /package/esm/typings/src/library/constructors/{createPromptbookLibraryFromDirectory.test.d.ts → createLibraryFromDirectory.test.d.ts} +0 -0
  41. /package/esm/typings/src/library/constructors/{createPromptbookLibraryFromPromise.test.d.ts → createLibraryFromJson.test.d.ts} +0 -0
  42. /package/esm/typings/src/library/constructors/{createPromptbookLibraryFromSources.test.d.ts → createLibraryFromPromise.test.d.ts} +0 -0
  43. /package/{umd/typings/src/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → esm/typings/src/library/libraryToJson.test.d.ts} +0 -0
  44. /package/umd/typings/src/library/constructors/{createPromptbookLibraryFromPromise.test.d.ts → createLibraryFromDirectory.test.d.ts} +0 -0
  45. /package/umd/typings/src/library/constructors/{createPromptbookLibraryFromSources.test.d.ts → createLibraryFromJson.test.d.ts} +0 -0
package/esm/index.es.js CHANGED
@@ -156,7 +156,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
156
156
  /**
157
157
  * The version of the Promptbook library
158
158
  */
159
- var PROMPTBOOK_VERSION = '0.59.0-20';
159
+ var PROMPTBOOK_VERSION = '0.59.0-21';
160
160
 
161
161
  export { PROMPTBOOK_VERSION, RemoteLlmExecutionTools };
162
162
  //# sourceMappingURL=index.es.js.map
@@ -1,10 +1,10 @@
1
- import { prettifyPromptbookStringCli } from '../conversion/prettify/prettifyPromptbookStringCli';
1
+ import { promptbookCli } from '../cli/promptbookCli';
2
2
  import { PROMPTBOOK_VERSION } from '../version';
3
3
  export { PROMPTBOOK_VERSION };
4
4
  /**
5
5
  * Hidden utilities which should not be used by external consumers.
6
6
  */
7
7
  declare const __: {
8
- prettifyPromptbookStringCli: typeof prettifyPromptbookStringCli;
8
+ promptbookCli: typeof promptbookCli;
9
9
  };
10
10
  export { __ };
@@ -20,11 +20,11 @@ import { CallbackInterfaceTools } from '../knowledge/dialogs/callback/CallbackIn
20
20
  import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
21
21
  import { SimplePromptInterfaceTools } from '../knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools';
22
22
  import { prepareKnowledgeFromMarkdown } from '../knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown';
23
- import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
24
- import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
25
- import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
26
- import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
27
- import { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
23
+ import { createLibraryFromJson } from '../library/constructors/createLibraryFromJson';
24
+ import { createLibraryFromPromise } from '../library/constructors/createLibraryFromPromise';
25
+ import { createLibraryFromUrl } from '../library/constructors/createLibraryFromUrl';
26
+ import { createSublibrary } from '../library/constructors/createSublibrary';
27
+ import { libraryToJson } from '../library/libraryToJson';
28
28
  import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
29
29
  import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
30
30
  import type { ExecutionReportStringOptions } from '../types/execution-report/ExecutionReportStringOptions';
@@ -34,7 +34,7 @@ import { PROMPTBOOK_VERSION } from '../version';
34
34
  export { PROMPTBOOK_VERSION };
35
35
  export { ExecutionTypes };
36
36
  export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, };
37
- export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
37
+ export { createLibraryFromJson, createLibraryFromPromise, createLibraryFromUrl, createSublibrary, libraryToJson };
38
38
  export { SimplePromptInterfaceTools };
39
39
  export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
40
40
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
@@ -1,4 +1,4 @@
1
- import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
1
+ import { createLibraryFromDirectory } from '../library/constructors/createLibraryFromDirectory';
2
2
  import { PROMPTBOOK_VERSION } from '../version';
3
3
  export { PROMPTBOOK_VERSION };
4
- export { createPromptbookLibraryFromDirectory };
4
+ export { createLibraryFromDirectory };
@@ -6,6 +6,7 @@ import type { PromptbookExecutor } from '../execution/PromptbookExecutor';
6
6
  import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools';
7
7
  import type { UserInterfaceTools, UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
8
8
  import type { PromptbookLibrary } from '../library/PromptbookLibrary';
9
+ import type { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
9
10
  import type { ExecutionType } from '../types/ExecutionTypes';
10
11
  import type { ModelRequirements, ModelVariant } from '../types/ModelRequirements';
11
12
  import type { Parameters } from '../types/Parameters';
@@ -26,7 +27,7 @@ import type { FromtoItems } from '../utils/FromtoItems';
26
27
  import { PROMPTBOOK_VERSION } from '../version';
27
28
  export { PROMPTBOOK_VERSION };
28
29
  export { EXPECTATION_UNITS };
29
- export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, 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, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
30
+ export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimplePromptbookLibrary, 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, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
30
31
  /**
31
32
  * TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
32
33
  */
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Initializes testing `hello` command for Promptbook CLI utilities
4
+ *
5
+ * @private part of `promptbookCli`
6
+ */
7
+ export declare function initializeHello(program: Command): void;
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Initializes `make` command for Promptbook CLI utilities
4
+ *
5
+ * @private part of `promptbookCli`
6
+ */
7
+ export declare function initializeMake(program: Command): void;
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Initializes `prettify` command for Promptbook CLI utilities
4
+ *
5
+ * @private part of `promptbookCli`
6
+ */
7
+ export declare function initializePrettify(program: Command): void;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Runs CLI script for prettifying promptbooks
2
+ * Runs CLI utilities of Promptbook package
3
3
  */
4
- export declare function prettifyPromptbookStringCli(): Promise<void>;
4
+ export declare function promptbookCli(): Promise<void>;
5
5
  /**
6
6
  * TODO: [🥠] Do not export to utils directly, its just for CLI script
7
7
  * TODO: [🕌] When more functionalities, rename
@@ -6,6 +6,7 @@ import type { PromptbookLibrary } from './PromptbookLibrary';
6
6
  * Library of promptbooks that groups together promptbooks for an application.
7
7
  * This implementation is a very thin wrapper around the Array / Map of promptbooks.
8
8
  *
9
+ * @private use `createLibraryFromJson` instead
9
10
  * @see https://github.com/webgptorg/promptbook#promptbook-library
10
11
  */
11
12
  export declare class SimplePromptbookLibrary implements PromptbookLibrary {
@@ -15,8 +16,9 @@ export declare class SimplePromptbookLibrary implements PromptbookLibrary {
15
16
  *
16
17
  * @param promptbooks !!!
17
18
  *
19
+ * @private Use instead `createLibraryFromJson`
18
20
  * Note: During the construction logic of all promptbooks are validated
19
- * Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
21
+ * Note: It is not recommended to use this constructor directly, use `createLibraryFromJson` *(or other variant)* instead
20
22
  */
21
23
  constructor(...promptbooks: Array<PromptbookJson>);
22
24
  /**
@@ -1,7 +1,7 @@
1
1
  import type { string_folder_path } from '../../types/typeAliases';
2
2
  import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
- * Options for `createPromptbookLibraryFromDirectory` function
4
+ * Options for `createLibraryFromDirectory` function
5
5
  */
6
6
  type CreatePromptbookLibraryFromDirectoryOptions = {
7
7
  /**
@@ -39,7 +39,7 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
39
39
  * @param options - Misc options for the library
40
40
  * @returns PromptbookLibrary
41
41
  */
42
- export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
42
+ export declare function createLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
43
43
  export {};
44
44
  /**
45
45
  * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
@@ -0,0 +1,12 @@
1
+ import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
+ import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
3
+ /**
4
+ * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
5
+ *
6
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
7
+ * Note: During the construction syntax and logic of all sources are validated
8
+ *
9
+ * @param promptbookSources
10
+ * @returns PromptbookLibrary
11
+ */
12
+ export declare function createLibraryFromJson(...promptbooks: Array<PromptbookJson>): Promise<SimplePromptbookLibrary>;
@@ -1,5 +1,4 @@
1
1
  import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../../types/PromptbookString';
3
2
  import type { PromptbookLibrary } from '../PromptbookLibrary';
4
3
  /**
5
4
  * Constructs Promptbook from async sources
@@ -8,19 +7,16 @@ import type { PromptbookLibrary } from '../PromptbookLibrary';
8
7
  * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
9
8
  *
10
9
  * Note: This is useful as internal tool for other constructor functions like
11
- * `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
10
+ * `createLibraryFromUrl` or `createLibraryFromDirectory`
12
11
  * Consider using those functions instead of this one
13
12
  *
14
13
  * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
15
14
  * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
16
15
  *
17
- * Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
16
+ * Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
18
17
  *
19
18
  * @param promptbookSourcesPromiseOrFactory
20
19
  * @returns PromptbookLibrary
21
20
  * @deprecated Do not use, it will became internal tool for other constructor functions
22
21
  */
23
- export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
24
- /**
25
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
26
- */
22
+ export declare function createLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson>> | (() => Promise<Array<PromptbookJson>>)): PromptbookLibrary;
@@ -1,7 +1,7 @@
1
1
  import type { string_url } from '../../types/typeAliases';
2
2
  import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
- * Options for `createPromptbookLibraryFromDirectory` function
4
+ * Options for `createLibraryFromDirectory` function
5
5
  */
6
6
  type CreatePromptbookLibraryFromUrlyOptions = {
7
7
  /**
@@ -22,7 +22,7 @@ type CreatePromptbookLibraryFromUrlyOptions = {
22
22
 
23
23
  * @returns PromptbookLibrary
24
24
  */
25
- export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
25
+ export declare function createLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
26
26
  export {};
27
27
  /**
28
28
  * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
@@ -9,4 +9,4 @@ import type { PromptbookLibrary } from '../PromptbookLibrary';
9
9
  * @param promptbookSources
10
10
  * @returns PromptbookLibrary
11
11
  */
12
- export declare function createPromptbookSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
12
+ export declare function createSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
@@ -0,0 +1,8 @@
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookLibrary } from './PromptbookLibrary';
3
+ /**
4
+ * Converts PromptbookLibrary to serialized JSON
5
+ *
6
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
7
+ */
8
+ export declare function libraryToJson(library: PromptbookLibrary): Promise<Array<PromptbookJson>>;
@@ -10,7 +10,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
10
10
  */
11
11
  export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
12
12
  /**
13
- * TODO: [⚖] Expose the library to be able to connect to same library via createPromptbookLibraryFromUrl
13
+ * TODO: [⚖] Expose the library to be able to connect to same library via createLibraryFromUrl
14
14
  * TODO: Handle progress - support streaming
15
15
  * TODO: [🤹‍♂️] Do not hang up immediately but wait until client closes OR timeout
16
16
  * TODO: [🤹‍♂️] Timeout on chat to free up resources
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-client",
3
- "version": "0.59.0-21",
3
+ "version": "0.59.0-23",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  }
48
48
  ],
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.59.0-21"
50
+ "@promptbook/core": "0.59.0-23"
51
51
  },
52
52
  "main": "./umd/index.umd.js",
53
53
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -160,7 +160,7 @@
160
160
  /**
161
161
  * The version of the Promptbook library
162
162
  */
163
- var PROMPTBOOK_VERSION = '0.59.0-20';
163
+ var PROMPTBOOK_VERSION = '0.59.0-21';
164
164
 
165
165
  exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
166
166
  exports.RemoteLlmExecutionTools = RemoteLlmExecutionTools;
@@ -1,10 +1,10 @@
1
- import { prettifyPromptbookStringCli } from '../conversion/prettify/prettifyPromptbookStringCli';
1
+ import { promptbookCli } from '../cli/promptbookCli';
2
2
  import { PROMPTBOOK_VERSION } from '../version';
3
3
  export { PROMPTBOOK_VERSION };
4
4
  /**
5
5
  * Hidden utilities which should not be used by external consumers.
6
6
  */
7
7
  declare const __: {
8
- prettifyPromptbookStringCli: typeof prettifyPromptbookStringCli;
8
+ promptbookCli: typeof promptbookCli;
9
9
  };
10
10
  export { __ };
@@ -20,11 +20,11 @@ import { CallbackInterfaceTools } from '../knowledge/dialogs/callback/CallbackIn
20
20
  import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
21
21
  import { SimplePromptInterfaceTools } from '../knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools';
22
22
  import { prepareKnowledgeFromMarkdown } from '../knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown';
23
- import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
24
- import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
25
- import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
26
- import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
27
- import { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
23
+ import { createLibraryFromJson } from '../library/constructors/createLibraryFromJson';
24
+ import { createLibraryFromPromise } from '../library/constructors/createLibraryFromPromise';
25
+ import { createLibraryFromUrl } from '../library/constructors/createLibraryFromUrl';
26
+ import { createSublibrary } from '../library/constructors/createSublibrary';
27
+ import { libraryToJson } from '../library/libraryToJson';
28
28
  import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
29
29
  import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
30
30
  import type { ExecutionReportStringOptions } from '../types/execution-report/ExecutionReportStringOptions';
@@ -34,7 +34,7 @@ import { PROMPTBOOK_VERSION } from '../version';
34
34
  export { PROMPTBOOK_VERSION };
35
35
  export { ExecutionTypes };
36
36
  export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, };
37
- export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
37
+ export { createLibraryFromJson, createLibraryFromPromise, createLibraryFromUrl, createSublibrary, libraryToJson };
38
38
  export { SimplePromptInterfaceTools };
39
39
  export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
40
40
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
@@ -1,4 +1,4 @@
1
- import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
1
+ import { createLibraryFromDirectory } from '../library/constructors/createLibraryFromDirectory';
2
2
  import { PROMPTBOOK_VERSION } from '../version';
3
3
  export { PROMPTBOOK_VERSION };
4
- export { createPromptbookLibraryFromDirectory };
4
+ export { createLibraryFromDirectory };
@@ -6,6 +6,7 @@ import type { PromptbookExecutor } from '../execution/PromptbookExecutor';
6
6
  import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools';
7
7
  import type { UserInterfaceTools, UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
8
8
  import type { PromptbookLibrary } from '../library/PromptbookLibrary';
9
+ import type { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
9
10
  import type { ExecutionType } from '../types/ExecutionTypes';
10
11
  import type { ModelRequirements, ModelVariant } from '../types/ModelRequirements';
11
12
  import type { Parameters } from '../types/Parameters';
@@ -26,7 +27,7 @@ import type { FromtoItems } from '../utils/FromtoItems';
26
27
  import { PROMPTBOOK_VERSION } from '../version';
27
28
  export { PROMPTBOOK_VERSION };
28
29
  export { EXPECTATION_UNITS };
29
- export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, 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, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
30
+ export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimplePromptbookLibrary, 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, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
30
31
  /**
31
32
  * TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
32
33
  */
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Initializes testing `hello` command for Promptbook CLI utilities
4
+ *
5
+ * @private part of `promptbookCli`
6
+ */
7
+ export declare function initializeHello(program: Command): void;
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Initializes `make` command for Promptbook CLI utilities
4
+ *
5
+ * @private part of `promptbookCli`
6
+ */
7
+ export declare function initializeMake(program: Command): void;
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Initializes `prettify` command for Promptbook CLI utilities
4
+ *
5
+ * @private part of `promptbookCli`
6
+ */
7
+ export declare function initializePrettify(program: Command): void;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Runs CLI script for prettifying promptbooks
2
+ * Runs CLI utilities of Promptbook package
3
3
  */
4
- export declare function prettifyPromptbookStringCli(): Promise<void>;
4
+ export declare function promptbookCli(): Promise<void>;
5
5
  /**
6
6
  * TODO: [🥠] Do not export to utils directly, its just for CLI script
7
7
  * TODO: [🕌] When more functionalities, rename
@@ -6,6 +6,7 @@ import type { PromptbookLibrary } from './PromptbookLibrary';
6
6
  * Library of promptbooks that groups together promptbooks for an application.
7
7
  * This implementation is a very thin wrapper around the Array / Map of promptbooks.
8
8
  *
9
+ * @private use `createLibraryFromJson` instead
9
10
  * @see https://github.com/webgptorg/promptbook#promptbook-library
10
11
  */
11
12
  export declare class SimplePromptbookLibrary implements PromptbookLibrary {
@@ -15,8 +16,9 @@ export declare class SimplePromptbookLibrary implements PromptbookLibrary {
15
16
  *
16
17
  * @param promptbooks !!!
17
18
  *
19
+ * @private Use instead `createLibraryFromJson`
18
20
  * Note: During the construction logic of all promptbooks are validated
19
- * Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
21
+ * Note: It is not recommended to use this constructor directly, use `createLibraryFromJson` *(or other variant)* instead
20
22
  */
21
23
  constructor(...promptbooks: Array<PromptbookJson>);
22
24
  /**
@@ -1,7 +1,7 @@
1
1
  import type { string_folder_path } from '../../types/typeAliases';
2
2
  import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
- * Options for `createPromptbookLibraryFromDirectory` function
4
+ * Options for `createLibraryFromDirectory` function
5
5
  */
6
6
  type CreatePromptbookLibraryFromDirectoryOptions = {
7
7
  /**
@@ -39,7 +39,7 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
39
39
  * @param options - Misc options for the library
40
40
  * @returns PromptbookLibrary
41
41
  */
42
- export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
42
+ export declare function createLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
43
43
  export {};
44
44
  /**
45
45
  * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
@@ -0,0 +1,12 @@
1
+ import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
+ import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
3
+ /**
4
+ * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
5
+ *
6
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
7
+ * Note: During the construction syntax and logic of all sources are validated
8
+ *
9
+ * @param promptbookSources
10
+ * @returns PromptbookLibrary
11
+ */
12
+ export declare function createLibraryFromJson(...promptbooks: Array<PromptbookJson>): Promise<SimplePromptbookLibrary>;
@@ -1,5 +1,4 @@
1
1
  import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../../types/PromptbookString';
3
2
  import type { PromptbookLibrary } from '../PromptbookLibrary';
4
3
  /**
5
4
  * Constructs Promptbook from async sources
@@ -8,19 +7,16 @@ import type { PromptbookLibrary } from '../PromptbookLibrary';
8
7
  * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
9
8
  *
10
9
  * Note: This is useful as internal tool for other constructor functions like
11
- * `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
10
+ * `createLibraryFromUrl` or `createLibraryFromDirectory`
12
11
  * Consider using those functions instead of this one
13
12
  *
14
13
  * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
15
14
  * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
16
15
  *
17
- * Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
16
+ * Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
18
17
  *
19
18
  * @param promptbookSourcesPromiseOrFactory
20
19
  * @returns PromptbookLibrary
21
20
  * @deprecated Do not use, it will became internal tool for other constructor functions
22
21
  */
23
- export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
24
- /**
25
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
26
- */
22
+ export declare function createLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson>> | (() => Promise<Array<PromptbookJson>>)): PromptbookLibrary;
@@ -1,7 +1,7 @@
1
1
  import type { string_url } from '../../types/typeAliases';
2
2
  import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
- * Options for `createPromptbookLibraryFromDirectory` function
4
+ * Options for `createLibraryFromDirectory` function
5
5
  */
6
6
  type CreatePromptbookLibraryFromUrlyOptions = {
7
7
  /**
@@ -22,7 +22,7 @@ type CreatePromptbookLibraryFromUrlyOptions = {
22
22
 
23
23
  * @returns PromptbookLibrary
24
24
  */
25
- export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
25
+ export declare function createLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
26
26
  export {};
27
27
  /**
28
28
  * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
@@ -9,4 +9,4 @@ import type { PromptbookLibrary } from '../PromptbookLibrary';
9
9
  * @param promptbookSources
10
10
  * @returns PromptbookLibrary
11
11
  */
12
- export declare function createPromptbookSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
12
+ export declare function createSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
@@ -0,0 +1,8 @@
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookLibrary } from './PromptbookLibrary';
3
+ /**
4
+ * Converts PromptbookLibrary to serialized JSON
5
+ *
6
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
7
+ */
8
+ export declare function libraryToJson(library: PromptbookLibrary): Promise<Array<PromptbookJson>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -10,7 +10,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
10
10
  */
11
11
  export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
12
12
  /**
13
- * TODO: [⚖] Expose the library to be able to connect to same library via createPromptbookLibraryFromUrl
13
+ * TODO: [⚖] Expose the library to be able to connect to same library via createLibraryFromUrl
14
14
  * TODO: Handle progress - support streaming
15
15
  * TODO: [🤹‍♂️] Do not hang up immediately but wait until client closes OR timeout
16
16
  * TODO: [🤹‍♂️] Timeout on chat to free up resources
@@ -1,16 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../../types/PromptbookString';
3
- import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
4
- /**
5
- * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
6
- *
7
- * Note: You can combine `PromptbookString` (`.ptbk.md`) with `PromptbookJson` BUT it is not recommended
8
- * Note: During the construction syntax and logic of all sources are validated
9
- *
10
- * @param promptbookSources
11
- * @returns PromptbookLibrary
12
- */
13
- export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): Promise<SimplePromptbookLibrary>;
14
- /**
15
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
16
- */
@@ -1,16 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../../types/PromptbookString';
3
- import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
4
- /**
5
- * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
6
- *
7
- * Note: You can combine `PromptbookString` (`.ptbk.md`) with `PromptbookJson` BUT it is not recommended
8
- * Note: During the construction syntax and logic of all sources are validated
9
- *
10
- * @param promptbookSources
11
- * @returns PromptbookLibrary
12
- */
13
- export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): Promise<SimplePromptbookLibrary>;
14
- /**
15
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
16
- */