@promptbook/utils 0.60.0-4 → 0.60.0-5

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 (92) hide show
  1. package/README.md +3 -5
  2. package/esm/index.es.js +4 -4
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +1 -1
  5. package/esm/typings/src/_packages/core.index.d.ts +9 -9
  6. package/esm/typings/src/_packages/node.index.d.ts +1 -1
  7. package/esm/typings/src/_packages/types.index.d.ts +3 -3
  8. package/{umd/typings/src/library → esm/typings/src/collection}/PipelineCollection.d.ts +4 -4
  9. package/{umd/typings/src/library → esm/typings/src/collection}/SimplePipelineCollection.d.ts +5 -5
  10. package/{umd/typings/src/library/libraryToJson.d.ts → esm/typings/src/collection/collectionToJson.d.ts} +2 -2
  11. package/esm/typings/src/{library → collection}/constructors/createCollectionFromDirectory.d.ts +3 -3
  12. package/esm/typings/src/{library → collection}/constructors/createCollectionFromJson.d.ts +1 -1
  13. package/{umd/typings/src/library → esm/typings/src/collection}/constructors/createCollectionFromPromise.d.ts +1 -1
  14. package/esm/typings/src/{library → collection}/constructors/createCollectionFromUrl.d.ts +1 -1
  15. package/esm/typings/src/collection/constructors/createSubcollection.d.ts +12 -0
  16. package/esm/typings/src/config.d.ts +2 -2
  17. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
  18. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
  19. package/esm/typings/src/errors/CollectionError.d.ts +1 -1
  20. package/esm/typings/src/errors/ExecutionError.d.ts +1 -1
  21. package/esm/typings/src/errors/NotFoundError.d.ts +1 -1
  22. package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
  23. package/esm/typings/src/execution/{PromptbookExecutor.d.ts → PipelineExecutor.d.ts} +3 -3
  24. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +2 -2
  25. package/{umd/typings/src/execution/createPromptbookExecutor.d.ts → esm/typings/src/execution/createPipelineExecutor.d.ts} +13 -13
  26. package/esm/typings/src/execution/utils/replaceParameters.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/mocked/joker.test.d.ts +1 -1
  28. package/esm/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +1 -1
  29. package/esm/typings/src/llm-providers/mocked/mocked-completion.test.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +4 -4
  31. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  32. package/esm/typings/src/types/Command.d.ts +2 -2
  33. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +5 -5
  34. package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +1 -1
  35. package/esm/typings/src/types/PipelineString.d.ts +1 -1
  36. package/esm/typings/src/types/Prompt.d.ts +3 -3
  37. package/esm/typings/src/types/TaskProgress.d.ts +1 -1
  38. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
  39. package/esm/typings/src/types/execution-report/config.d.ts +1 -1
  40. package/esm/typings/src/utils/emojis.d.ts +1 -1
  41. package/package.json +1 -1
  42. package/umd/index.umd.js +4 -4
  43. package/umd/index.umd.js.map +1 -1
  44. package/umd/typings/promptbook-collection/index.d.ts +1 -1
  45. package/umd/typings/src/_packages/core.index.d.ts +9 -9
  46. package/umd/typings/src/_packages/node.index.d.ts +1 -1
  47. package/umd/typings/src/_packages/types.index.d.ts +3 -3
  48. package/{esm/typings/src/library → umd/typings/src/collection}/PipelineCollection.d.ts +4 -4
  49. package/{esm/typings/src/library → umd/typings/src/collection}/SimplePipelineCollection.d.ts +5 -5
  50. package/{esm/typings/src/library/libraryToJson.d.ts → umd/typings/src/collection/collectionToJson.d.ts} +2 -2
  51. package/umd/typings/src/{library → collection}/constructors/createCollectionFromDirectory.d.ts +3 -3
  52. package/umd/typings/src/{library → collection}/constructors/createCollectionFromJson.d.ts +1 -1
  53. package/{esm/typings/src/library → umd/typings/src/collection}/constructors/createCollectionFromPromise.d.ts +1 -1
  54. package/umd/typings/src/{library → collection}/constructors/createCollectionFromUrl.d.ts +1 -1
  55. package/umd/typings/src/collection/constructors/createSubcollection.d.ts +12 -0
  56. package/umd/typings/src/config.d.ts +2 -2
  57. package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
  58. package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
  59. package/umd/typings/src/errors/CollectionError.d.ts +1 -1
  60. package/umd/typings/src/errors/ExecutionError.d.ts +1 -1
  61. package/umd/typings/src/errors/NotFoundError.d.ts +1 -1
  62. package/umd/typings/src/execution/EmbeddingVector.d.ts +1 -1
  63. package/umd/typings/src/execution/{PromptbookExecutor.d.ts → PipelineExecutor.d.ts} +3 -3
  64. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +2 -2
  65. package/{esm/typings/src/execution/createPromptbookExecutor.d.ts → umd/typings/src/execution/createPipelineExecutor.d.ts} +13 -13
  66. package/umd/typings/src/execution/utils/replaceParameters.d.ts +1 -1
  67. package/umd/typings/src/llm-providers/mocked/joker.test.d.ts +1 -1
  68. package/umd/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +1 -1
  69. package/umd/typings/src/llm-providers/mocked/mocked-completion.test.d.ts +1 -1
  70. package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +4 -4
  71. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  72. package/umd/typings/src/types/Command.d.ts +2 -2
  73. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +5 -5
  74. package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +1 -1
  75. package/umd/typings/src/types/PipelineString.d.ts +1 -1
  76. package/umd/typings/src/types/Prompt.d.ts +3 -3
  77. package/umd/typings/src/types/TaskProgress.d.ts +1 -1
  78. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
  79. package/umd/typings/src/types/execution-report/config.d.ts +1 -1
  80. package/umd/typings/src/utils/emojis.d.ts +1 -1
  81. package/esm/typings/src/library/constructors/createSubcollection.d.ts +0 -12
  82. package/umd/typings/src/library/constructors/createSubcollection.d.ts +0 -12
  83. /package/esm/typings/src/{library/constructors/createCollectionFromDirectory.test.d.ts → collection/collectionToJson.test.d.ts} +0 -0
  84. /package/{umd/typings/src/library → esm/typings/src/collection}/constructors/createCollectionFromDirectory.test.d.ts +0 -0
  85. /package/esm/typings/src/{library → collection}/constructors/createCollectionFromJson.test.d.ts +0 -0
  86. /package/esm/typings/src/{library → collection}/constructors/createCollectionFromPromise.test.d.ts +0 -0
  87. /package/esm/typings/src/{library → collection}/constructors/justTestFsImport.d.ts +0 -0
  88. /package/{esm/typings/src/library/libraryToJson.test.d.ts → umd/typings/src/collection/collectionToJson.test.d.ts} +0 -0
  89. /package/umd/typings/src/{library/constructors/createCollectionFromJson.test.d.ts → collection/constructors/createCollectionFromDirectory.test.d.ts} +0 -0
  90. /package/umd/typings/src/{library/constructors/createCollectionFromPromise.test.d.ts → collection/constructors/createCollectionFromJson.test.d.ts} +0 -0
  91. /package/umd/typings/src/{library/libraryToJson.test.d.ts → collection/constructors/createCollectionFromPromise.test.d.ts} +0 -0
  92. /package/umd/typings/src/{library → collection}/constructors/justTestFsImport.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
2
2
  import type { ExecutionTools } from './ExecutionTools';
3
- import type { PromptbookExecutor } from './PromptbookExecutor';
4
- type CreatePromptbookExecutorSettings = {
3
+ import type { PipelineExecutor } from './PipelineExecutor';
4
+ type CreatePipelineExecutorSettings = {
5
5
  /**
6
6
  * When executor does not satisfy expectations it will be retried this amount of times
7
7
  *
@@ -10,33 +10,33 @@ type CreatePromptbookExecutorSettings = {
10
10
  readonly maxExecutionAttempts: number;
11
11
  };
12
12
  /**
13
- * Options for creating a promptbook executor
13
+ * Options for creating a pipeline executor
14
14
  */
15
- interface CreatePromptbookExecutorOptions {
15
+ interface CreatePipelineExecutorOptions {
16
16
  /**
17
- * The promptbook to be executed
17
+ * The pipeline to be executed
18
18
  */
19
- readonly promptbook: PipelineJson;
19
+ readonly pipeline: PipelineJson;
20
20
  /**
21
- * The execution tools to be used during the execution of the PROMPTBOOK
21
+ * The execution tools to be used during the execution of the pipeline
22
22
  */
23
23
  readonly tools: ExecutionTools;
24
24
  /**
25
- * Optional settings for the PROMPTBOOK executor
25
+ * Optional settings for the pipeline executor
26
26
  */
27
- readonly settings?: Partial<CreatePromptbookExecutorSettings>;
27
+ readonly settings?: Partial<CreatePipelineExecutorSettings>;
28
28
  }
29
29
  /**
30
- * Creates executor function from promptbook and execution tools.
30
+ * Creates executor function from pipeline and execution tools.
31
31
  *
32
32
  * @returns The executor function
33
- * @throws {PipelineLogicError} on logical error in the promptbook
33
+ * @throws {PipelineLogicError} on logical error in the pipeline
34
34
  */
35
- export declare function createPromptbookExecutor(options: CreatePromptbookExecutorOptions): PromptbookExecutor;
35
+ export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
36
36
  export {};
37
37
  /**
38
38
  * TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
39
39
  * TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
40
- * Note: CreatePromptbookExecutorOptions are just connected to PromptbookExecutor so do not extract to types folder
40
+ * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
41
41
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
42
42
  */
@@ -8,6 +8,6 @@ import type { string_template } from '../../types/typeAliases';
8
8
  * @returns the template with replaced parameters
9
9
  * @throws {TemplateError} if parameter is not defined, not closed, or not opened
10
10
  *
11
- * @private within the createPromptbookExecutor
11
+ * @private within the createPipelineExecutor
12
12
  */
13
13
  export declare function replaceParameters(template: string_template, parameters: Parameters): string;
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * TODO: [🧠] What should be name of this test "MockedEchoExecutionTools.test.ts" or "createPromptbookExecutor.test.ts"
3
+ * TODO: [🧠] What should be name of this test "MockedEchoExecutionTools.test.ts" or "createPipelineExecutor.test.ts"
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * TODO: [🧠] What should be name of this test "MockedEchoExecutionTools.test.ts" or "createPromptbookExecutor.test.ts"
3
+ * TODO: [🧠] What should be name of this test "MockedEchoExecutionTools.test.ts" or "createPipelineExecutor.test.ts"
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * TODO: [🧠] What should be name of this test "MockedEchoExecutionTools.test.ts" or "createPromptbookExecutor.test.ts"
3
+ * TODO: [🧠] What should be name of this test "MockedEchoExecutionTools.test.ts" or "createPipelineExecutor.test.ts"
4
4
  */
@@ -1,6 +1,6 @@
1
+ import type { PipelineCollection } from '../../../collection/PipelineCollection';
1
2
  import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
2
3
  import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
3
- import type { PipelineCollection } from '../../../library/PipelineCollection';
4
4
  import type { client_id } from '../../../types/typeAliases';
5
5
  import type { string_uri } from '../../../types/typeAliases';
6
6
  export type RemoteServerOptions = CommonExecutionToolsOptions & {
@@ -16,11 +16,11 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
16
16
  */
17
17
  readonly path: string_uri;
18
18
  /**
19
- * Promptbook library to use
19
+ * Promptbook collection to use
20
20
  *
21
- * This is used to checkl validity of the prompt to prevent DDoS
21
+ * This is used to check validity of the prompt to prevent DDoS
22
22
  */
23
- readonly library: PipelineCollection;
23
+ readonly collection: PipelineCollection;
24
24
  /**
25
25
  * Creates llm execution tools for each client
26
26
  */
@@ -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 createCollectionFromUrl
13
+ * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
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
@@ -17,8 +17,8 @@ export type Command = PromptbookUrlCommand | PromptbookVersionCommand | ExecuteC
17
17
  * - It is defined per whole .promptbook file in the header
18
18
  */
19
19
  export type PromptbookUrlCommand = {
20
- readonly type: 'PROMPTBOOK_URL';
21
- readonly promptbookUrl: URL;
20
+ readonly type: 'PIPELINE_URL';
21
+ readonly pipelineUrl: URL;
22
22
  };
23
23
  /**
24
24
  * PromptbookVersion command tells which version is .promptbook file using
@@ -5,22 +5,22 @@ import type { KnowledgeJson } from './KnowledgeJson';
5
5
  import type { PromptTemplateJson } from './PromptTemplateJson';
6
6
  import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
7
7
  /**
8
- * Promptbook is the **core concept of this library**.
8
+ * Promptbook is the **core concept of this package**.
9
9
  * It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
10
10
  *
11
11
  * @see !!! https://github.com/webgptorg/promptbook#promptbook
12
12
  */
13
13
  export type PipelineJson = {
14
14
  /**
15
- * Unique identifier of the promptbook
15
+ * Unique identifier of the pipeline
16
16
  *
17
- * Note: It must be unique across all promptbooks libraries
17
+ * Note: It must be unique across all pipeline collections
18
18
  * Note: It must use HTTPs URL
19
19
  * Tip: You can do versioning in the URL
20
20
  * For example: https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md@1.0.0
21
21
  * Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
22
22
  */
23
- readonly promptbookUrl?: string_pipeline_url;
23
+ readonly pipelineUrl?: string_pipeline_url;
24
24
  /**
25
25
  * Title of the promptbook
26
26
  * -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
@@ -51,5 +51,5 @@ export type PipelineJson = {
51
51
  /**
52
52
  * Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
53
53
  * But then immediately reverted back to the single type
54
- * With knowledge as part of the promptbook and library just as a collection of promptbooks
54
+ * With knowledge as part of the promptbook and collection just as a collection of promptbooks
55
55
  */
@@ -81,7 +81,7 @@ interface PromptTemplateJsonCommon {
81
81
  * Name of the template
82
82
  * - It must be unique across the pipeline
83
83
  * - It should start uppercase and contain letters and numbers
84
- * - The promptbookUrl together with hash and name are used to identify the prompt template in the pipeline
84
+ * - The pipelineUrl together with hash and name are used to identify the prompt template in the pipeline
85
85
  */
86
86
  readonly name: string_name;
87
87
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Promptbook is the **core concept of this library**.
2
+ * Promptbook is the **core concept of this package**.
3
3
  * It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
4
4
  *
5
5
  * @see !!! https://github.com/webgptorg/promptbook#promptbook
@@ -48,15 +48,15 @@ export type Prompt = {
48
48
  */
49
49
  readonly expectFormat?: ExpectFormatCommand['format'];
50
50
  /**
51
- * Unique identifier of the promptbook with specific template name as hash
51
+ * Unique identifier of the pipeline with specific template name as hash
52
52
  *
53
53
  * @example https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md#keywords
54
54
  */
55
- readonly promptbookUrl: string_pipeline_url_with_hashtemplate;
55
+ readonly pipelineUrl: string_pipeline_url_with_hashtemplate;
56
56
  /**
57
57
  * Parameters used in the prompt
58
58
  *
59
- * Note: This is redundant (same information is in promptbookUrl+content) but useful for logging and debugging
59
+ * Note: This is redundant (same information is in pipelineUrl+content) but useful for logging and debugging
60
60
  */
61
61
  readonly parameters: Record<string_name, string>;
62
62
  };
@@ -29,7 +29,7 @@ export type TaskProgress = {
29
29
  readonly isDone: boolean;
30
30
  /**
31
31
  * The type of the execution.
32
- * Note: The Promptbook library reports everything, in the app level you can filter out the execution types that you don't want to show to the user.
32
+ * Note: The pipeline executor reports everything, in the app level you can filter out the execution types that you don't want to show to the user.
33
33
  */
34
34
  readonly executionType: ExecutionType;
35
35
  /**
@@ -15,9 +15,9 @@ import type { string_version } from '../typeAliases';
15
15
  */
16
16
  export type ExecutionReportJson = {
17
17
  /**
18
- * Unique identifier of the promptbook from promptbook which was executed
18
+ * Unique identifier of the pipeline from promptbook which was executed
19
19
  */
20
- readonly promptbookUrl?: string_pipeline_url;
20
+ readonly pipelineUrl?: string_pipeline_url;
21
21
  /**
22
22
  * Title of from promptbook which was executed
23
23
  */
@@ -41,7 +41,7 @@ export type ExecutionReportJson = {
41
41
  /**
42
42
  * The prompt wich was executed
43
43
  */
44
- prompt: Omit<Prompt, 'promptbookUrl' | 'parameters'>;
44
+ prompt: Omit<Prompt, 'pipelineUrl' | 'parameters'>;
45
45
  /**
46
46
  * Result of the prompt execution (if not failed during LLM execution)
47
47
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The thresholds for the relative time in the `moment` library.
2
+ * The thresholds for the relative time in the `moment` NPM package.
3
3
  *
4
4
  * @see https://momentjscom.readthedocs.io/en/latest/moment/07-customization/13-relative-time-threshold/
5
5
  */
@@ -18,5 +18,5 @@ export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoj
18
18
  */
19
19
  export declare const EMOJIS: Set<string_char_emoji>;
20
20
  /**
21
- * TODO: Mirror from Collboard or some common library
21
+ * TODO: Mirror from Collboard or some common package
22
22
  */
@@ -1,12 +0,0 @@
1
- import type { string_pipeline_url } from '../../types/typeAliases';
2
- import type { PipelineCollection } from '../PipelineCollection';
3
- /**
4
- * Creates PipelineCollection as a subset of another PipelineCollection
5
- *
6
- * Note: You can use any type of library as a parent library - local, remote, etc.
7
- * Note: This is just a thin wrapper / proxy around the parent library
8
- *
9
- * @param promptbookSources
10
- * @returns PipelineCollection
11
- */
12
- export declare function createSubcollection(library: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;
@@ -1,12 +0,0 @@
1
- import type { string_pipeline_url } from '../../types/typeAliases';
2
- import type { PipelineCollection } from '../PipelineCollection';
3
- /**
4
- * Creates PipelineCollection as a subset of another PipelineCollection
5
- *
6
- * Note: You can use any type of library as a parent library - local, remote, etc.
7
- * Note: This is just a thin wrapper / proxy around the parent library
8
- *
9
- * @param promptbookSources
10
- * @returns PipelineCollection
11
- */
12
- export declare function createSubcollection(library: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;