@promptbook/openai 0.52.0-19 → 0.52.0-24

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 CHANGED
@@ -145,7 +145,7 @@ File `write-website-content.ptbk.md`:
145
145
  >
146
146
  > Instructions for creating web page content.
147
147
  >
148
- > - PROMPTBOOK URL https://promptbook.webgpt.com/en/write-website-content.ptbk.md@v0.1.0
148
+ > - PROMPTBOOK URL https://promptbook.webgpt.com/en/write-website-content.ptbk.md
149
149
  > - PROMPTBOOK VERSION 0.0.1
150
150
  > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
151
151
  > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
@@ -10,7 +10,6 @@ import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interfa
10
10
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
11
11
  import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
12
12
  import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
13
- import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
14
13
  import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
15
14
  import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
16
15
  import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
@@ -23,7 +22,7 @@ import { PROMPTBOOK_VERSION } from '../version';
23
22
  export { justTestFsImport };
24
23
  export { ExecutionTypes, PROMPTBOOK_VERSION };
25
24
  export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, };
26
- export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
25
+ export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
27
26
  export { SimplePromptInterfaceTools };
28
27
  export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
29
28
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
@@ -9,6 +9,9 @@ import type { UserInterfaceTools } from './UserInterfaceTools';
9
9
  export type ExecutionTools = {
10
10
  /**
11
11
  * Tools for executing prompts to large language models like GPT-4
12
+ *
13
+ * Tip: Combine multiple LLM execution tools with `MultipleLlmExecutionTools`
14
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#llm-execution-tools
12
15
  */
13
16
  llm: LlmExecutionTools;
14
17
  /**
@@ -16,15 +19,14 @@ export type ExecutionTools = {
16
19
  *
17
20
  * Note: You can pass multiple ScriptExecutionTools, they will be tried one by one until one of them supports the script
18
21
  * If none of them supports the script, an error is thrown
22
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#script-execution-tools
19
23
  */
20
24
  script: Array<ScriptExecutionTools>;
21
25
  /**
22
26
  * Tools for interacting with the user
23
27
  *
24
28
  * Note: When undefined, the user interface is disabled and promptbook which requires user interaction will fail
29
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#user-interface-tools
25
30
  */
26
31
  userInterface?: UserInterfaceTools;
27
32
  };
28
- /**
29
- * TODO: [🍓] !!!! Allow to have more LlmExecutionTools
30
- */
@@ -11,24 +11,28 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
11
11
  */
12
12
  isRecursive?: boolean;
13
13
  /**
14
- * If true, the library ceation outputs information about each file it reads
14
+ * If true, the library creation outputs information about each file it reads
15
15
  *
16
16
  * @default false
17
17
  */
18
18
  isVerbose?: boolean;
19
+ /**
20
+ * If true, directory will be scanned only when needed not during the construction
21
+ *
22
+ * @default false
23
+ */
24
+ isLazyLoaded?: boolean;
19
25
  };
20
26
  /**
21
27
  * Constructs Promptbook from given directory
22
28
  *
23
29
  * Note: Works only in Node.js environment because it reads the file system
24
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
25
- * SO during the construction syntax and logic sources IS NOT validated
26
30
  *
27
31
  * @param path - path to the directory with promptbooks
28
32
  * @param options - Misc options for the library
29
33
  * @returns PromptbookLibrary
30
34
  */
31
- export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): PromptbookLibrary;
35
+ export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
32
36
  export {};
33
37
  /***
34
38
  * TODO: [🧠] Maybe do not do hacks like [1] and just create package @promptbook/node
@@ -18,6 +18,7 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
18
18
  *
19
19
  * @param promptbookSourcesPromiseOrFactory
20
20
  * @returns PromptbookLibrary
21
+ * @private Just internal tool for other constructor functions
21
22
  */
22
23
  export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
23
24
  /***
@@ -1,13 +1,29 @@
1
+ import { string_url } from '../../types/typeAliases';
1
2
  import { PromptbookLibrary } from '../PromptbookLibrary';
3
+ /**
4
+ * Options for `createPromptbookLibraryFromDirectory` function
5
+ */
6
+ type CreatePromptbookLibraryFromUrlyOptions = {
7
+ /**
8
+ * If true, the library creation outputs information about each file it reads
9
+ *
10
+ * @default false
11
+ */
12
+ isVerbose?: boolean;
13
+ /**
14
+ * If true, directory will be scanned only when needed not during the construction
15
+ *
16
+ * @default false
17
+ */
18
+ isLazyLoaded?: boolean;
19
+ };
2
20
  /**
3
21
  * Constructs Promptbook from remote Promptbase URL
4
- *
5
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
6
- * SO during the construction syntax and logic sources IS NOT validated
7
- *
22
+
8
23
  * @returns PromptbookLibrary
9
24
  */
10
- export declare function createPromptbookLibraryFromUrl(): PromptbookLibrary;
25
+ export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
26
+ export {};
11
27
  /***
12
28
  * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
13
29
  */
@@ -2,3 +2,6 @@
2
2
  * Just testing imports and compatibility
3
3
  */
4
4
  export declare function justTestFsImport(): Promise<void>;
5
+ /**
6
+ * TODO: !!! Remove this file
7
+ */
@@ -39,7 +39,7 @@ export type Prompt = {
39
39
  /**
40
40
  * Unique identifier of the promptbook with specific template name as hash
41
41
  *
42
- * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
42
+ * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords
43
43
  */
44
44
  readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
45
45
  /**
@@ -179,13 +179,13 @@ export type string_url = string;
179
179
  /**
180
180
  * Semantic helper
181
181
  *
182
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
182
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md"`
183
183
  */
184
184
  export type string_promptbook_url = string;
185
185
  /**
186
186
  * Semantic helper
187
187
  *
188
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
188
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords"`
189
189
  */
190
190
  export type string_promptbook_url_with_hashtemplate = string;
191
191
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.52.0-19",
3
+ "version": "0.52.0-24",
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.52.0-19"
51
+ "@promptbook/core": "0.52.0-24"
52
52
  },
53
53
  "main": "./umd/index.umd.js",
54
54
  "module": "./esm/index.es.js",
@@ -10,7 +10,6 @@ import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interfa
10
10
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
11
11
  import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
12
12
  import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
13
- import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
14
13
  import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
15
14
  import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
16
15
  import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
@@ -23,7 +22,7 @@ import { PROMPTBOOK_VERSION } from '../version';
23
22
  export { justTestFsImport };
24
23
  export { ExecutionTypes, PROMPTBOOK_VERSION };
25
24
  export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, };
26
- export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
25
+ export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
27
26
  export { SimplePromptInterfaceTools };
28
27
  export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
29
28
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
@@ -9,6 +9,9 @@ import type { UserInterfaceTools } from './UserInterfaceTools';
9
9
  export type ExecutionTools = {
10
10
  /**
11
11
  * Tools for executing prompts to large language models like GPT-4
12
+ *
13
+ * Tip: Combine multiple LLM execution tools with `MultipleLlmExecutionTools`
14
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#llm-execution-tools
12
15
  */
13
16
  llm: LlmExecutionTools;
14
17
  /**
@@ -16,15 +19,14 @@ export type ExecutionTools = {
16
19
  *
17
20
  * Note: You can pass multiple ScriptExecutionTools, they will be tried one by one until one of them supports the script
18
21
  * If none of them supports the script, an error is thrown
22
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#script-execution-tools
19
23
  */
20
24
  script: Array<ScriptExecutionTools>;
21
25
  /**
22
26
  * Tools for interacting with the user
23
27
  *
24
28
  * Note: When undefined, the user interface is disabled and promptbook which requires user interaction will fail
29
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#user-interface-tools
25
30
  */
26
31
  userInterface?: UserInterfaceTools;
27
32
  };
28
- /**
29
- * TODO: [🍓] !!!! Allow to have more LlmExecutionTools
30
- */
@@ -11,24 +11,28 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
11
11
  */
12
12
  isRecursive?: boolean;
13
13
  /**
14
- * If true, the library ceation outputs information about each file it reads
14
+ * If true, the library creation outputs information about each file it reads
15
15
  *
16
16
  * @default false
17
17
  */
18
18
  isVerbose?: boolean;
19
+ /**
20
+ * If true, directory will be scanned only when needed not during the construction
21
+ *
22
+ * @default false
23
+ */
24
+ isLazyLoaded?: boolean;
19
25
  };
20
26
  /**
21
27
  * Constructs Promptbook from given directory
22
28
  *
23
29
  * Note: Works only in Node.js environment because it reads the file system
24
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
25
- * SO during the construction syntax and logic sources IS NOT validated
26
30
  *
27
31
  * @param path - path to the directory with promptbooks
28
32
  * @param options - Misc options for the library
29
33
  * @returns PromptbookLibrary
30
34
  */
31
- export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): PromptbookLibrary;
35
+ export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
32
36
  export {};
33
37
  /***
34
38
  * TODO: [🧠] Maybe do not do hacks like [1] and just create package @promptbook/node
@@ -18,6 +18,7 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
18
18
  *
19
19
  * @param promptbookSourcesPromiseOrFactory
20
20
  * @returns PromptbookLibrary
21
+ * @private Just internal tool for other constructor functions
21
22
  */
22
23
  export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
23
24
  /***
@@ -1,13 +1,29 @@
1
+ import { string_url } from '../../types/typeAliases';
1
2
  import { PromptbookLibrary } from '../PromptbookLibrary';
3
+ /**
4
+ * Options for `createPromptbookLibraryFromDirectory` function
5
+ */
6
+ type CreatePromptbookLibraryFromUrlyOptions = {
7
+ /**
8
+ * If true, the library creation outputs information about each file it reads
9
+ *
10
+ * @default false
11
+ */
12
+ isVerbose?: boolean;
13
+ /**
14
+ * If true, directory will be scanned only when needed not during the construction
15
+ *
16
+ * @default false
17
+ */
18
+ isLazyLoaded?: boolean;
19
+ };
2
20
  /**
3
21
  * Constructs Promptbook from remote Promptbase URL
4
- *
5
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
6
- * SO during the construction syntax and logic sources IS NOT validated
7
- *
22
+
8
23
  * @returns PromptbookLibrary
9
24
  */
10
- export declare function createPromptbookLibraryFromUrl(): PromptbookLibrary;
25
+ export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
26
+ export {};
11
27
  /***
12
28
  * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
13
29
  */
@@ -2,3 +2,6 @@
2
2
  * Just testing imports and compatibility
3
3
  */
4
4
  export declare function justTestFsImport(): Promise<void>;
5
+ /**
6
+ * TODO: !!! Remove this file
7
+ */
@@ -39,7 +39,7 @@ export type Prompt = {
39
39
  /**
40
40
  * Unique identifier of the promptbook with specific template name as hash
41
41
  *
42
- * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
42
+ * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords
43
43
  */
44
44
  readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
45
45
  /**
@@ -179,13 +179,13 @@ export type string_url = string;
179
179
  /**
180
180
  * Semantic helper
181
181
  *
182
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
182
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md"`
183
183
  */
184
184
  export type string_promptbook_url = string;
185
185
  /**
186
186
  * Semantic helper
187
187
  *
188
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
188
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords"`
189
189
  */
190
190
  export type string_promptbook_url_with_hashtemplate = string;
191
191
  /**
@@ -1,4 +0,0 @@
1
- export declare const Wizzard: any;
2
- /**
3
- * TODO: [🧙‍♂️]
4
- */
@@ -1,6 +0,0 @@
1
- export {};
2
- /**
3
- * TODO: [🧙‍♂️]
4
- url, sources nebo folder
5
- * TODO: [🧠] OpenAi apiKey vs token
6
- */
@@ -1,4 +0,0 @@
1
- export declare const Wizzard: any;
2
- /**
3
- * TODO: [🧙‍♂️]
4
- */
@@ -1,6 +0,0 @@
1
- export {};
2
- /**
3
- * TODO: [🧙‍♂️]
4
- url, sources nebo folder
5
- * TODO: [🧠] OpenAi apiKey vs token
6
- */