@promptbook/remote-server 0.81.0-18 → 0.81.0-21

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 (27) hide show
  1. package/README.md +39 -3
  2. package/esm/index.es.js +1 -1
  3. package/esm/typings/books/index.d.ts +38 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +4 -4
  5. package/esm/typings/src/config.d.ts +1 -1
  6. package/esm/typings/src/conversion/compilePipeline.d.ts +1 -4
  7. package/esm/typings/src/conversion/{precompilePipeline.d.ts → parsePipeline.d.ts} +2 -2
  8. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
  9. package/esm/typings/src/high-level-abstractions/index.d.ts +1 -1
  10. package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
  11. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -0
  12. package/esm/typings/src/prepare/preparePipeline.d.ts +2 -0
  13. package/esm/typings/src/scrapers/_common/Converter.d.ts +1 -0
  14. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  15. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +3 -0
  16. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -0
  17. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -0
  18. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  19. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  20. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
  21. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  22. package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +1 -1
  23. package/esm/typings/src/utils/organization/$sideEffect.d.ts +9 -0
  24. package/esm/typings/src/wizzard/wizzard.d.ts +23 -11
  25. package/package.json +2 -2
  26. package/umd/index.umd.js +1 -1
  27. /package/esm/typings/src/conversion/{precompilePipeline.test.d.ts → parsePipeline.test.d.ts} +0 -0
package/README.md CHANGED
@@ -126,11 +126,38 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
126
126
  </tbody>
127
127
  </table>
128
128
 
129
- Also we have a community of developers and users:
129
+ We also have a community of developers and users of **Promptbook**:
130
130
 
131
- - [Discord](https://discord.gg/x3QWNaa89N)
132
- - [Landing page](https://ptbk.io)
131
+ - [Discord community](https://discord.gg/x3QWNaa89N)
132
+ - [Landing page `ptbk.io`](https://ptbk.io)
133
133
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
134
+ - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
135
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
136
+
137
+ And **Promptbook.studio** branded socials:
138
+
139
+
140
+
141
+ - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
142
+
143
+
144
+
145
+ And **Promptujeme** sub-brand:
146
+
147
+ */Subbrand for Czech clients/*
148
+
149
+
150
+
151
+ - [Promptujeme.cz](https://www.promptujeme.cz/)
152
+ - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
153
+
154
+
155
+ And **Promptbook.city** branded socials:
156
+
157
+ */Sub-brand for images and graphics generated via Promptbook prompting/*
158
+
159
+ - [Instagram `@promptbook.city`](https://www.instagram.com/promptbook.city/)
160
+ - [Facebook `Promptbook City`](https://www.facebook.com/61565718625569)
134
161
 
135
162
 
136
163
 
@@ -264,6 +291,11 @@ Or you can install them separately:
264
291
 
265
292
  ## 📚 Dictionary
266
293
 
294
+
295
+
296
+
297
+
298
+
267
299
  ### 📚 Dictionary
268
300
 
269
301
  The following glossary is used to clarify certain concepts:
@@ -279,6 +311,8 @@ The following glossary is used to clarify certain concepts:
279
311
  - **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
280
312
  - **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
281
313
 
314
+
315
+
282
316
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
283
317
 
284
318
  #### Promptbook core
@@ -339,6 +373,8 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
339
373
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
340
374
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
341
375
 
376
+
377
+
342
378
  ### Terms specific to Promptbook TypeScript implementation
343
379
 
344
380
  - Anonymous mode
package/esm/index.es.js CHANGED
@@ -17,7 +17,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
17
17
  * @generated
18
18
  * @see https://github.com/webgptorg/promptbook
19
19
  */
20
- var PROMPTBOOK_ENGINE_VERSION = '0.81.0-17';
20
+ var PROMPTBOOK_ENGINE_VERSION = '0.81.0-20';
21
21
  /**
22
22
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
23
23
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -89,5 +89,43 @@ declare const _default: ({
89
89
  content: string;
90
90
  }[];
91
91
  sourceFile: string;
92
+ } | {
93
+ title: string;
94
+ pipelineUrl: string;
95
+ formfactorName: string;
96
+ parameters: {
97
+ name: string;
98
+ description: string;
99
+ isInput: boolean;
100
+ isOutput: boolean;
101
+ }[];
102
+ tasks: {
103
+ taskType: string;
104
+ name: string;
105
+ title: string;
106
+ content: string;
107
+ resultingParameterName: string;
108
+ expectations: {
109
+ words: {
110
+ min: number;
111
+ max: number;
112
+ };
113
+ lines: {
114
+ min: number;
115
+ max: number;
116
+ };
117
+ };
118
+ dependentParameterNames: string[];
119
+ }[];
120
+ personas: never[];
121
+ preparations: never[];
122
+ knowledgeSources: never[];
123
+ knowledgePieces: never[];
124
+ sources: {
125
+ type: string;
126
+ path: null;
127
+ content: string;
128
+ }[];
129
+ sourceFile: string;
92
130
  })[];
93
131
  export default _default;
@@ -10,7 +10,7 @@ import { ADMIN_GITHUB_NAME } from '../config';
10
10
  import { CLAIM } from '../config';
11
11
  import { LOGO_LIGHT_SRC } from '../config';
12
12
  import { LOGO_DARK_SRC } from '../config';
13
- import { DEFAULT_TITLE } from '../config';
13
+ import { DEFAULT_BOOK_TITLE } from '../config';
14
14
  import { MAX_FILENAME_LENGTH } from '../config';
15
15
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
16
16
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
@@ -31,8 +31,8 @@ import { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME } from '../config';
31
31
  import { ORDER_OF_PIPELINE_JSON } from '../constants';
32
32
  import { RESERVED_PARAMETER_NAMES } from '../constants';
33
33
  import { compilePipeline } from '../conversion/compilePipeline';
34
+ import { parsePipeline } from '../conversion/parsePipeline';
34
35
  import { pipelineJsonToString } from '../conversion/pipelineJsonToString';
35
- import { precompilePipeline } from '../conversion/precompilePipeline';
36
36
  import { prettifyPipelineString } from '../conversion/prettify/prettifyPipelineString';
37
37
  import { extractParameterNamesFromTask } from '../conversion/utils/extractParameterNamesFromTask';
38
38
  import { validatePipeline } from '../conversion/validation/validatePipeline';
@@ -132,7 +132,7 @@ export { ADMIN_GITHUB_NAME };
132
132
  export { CLAIM };
133
133
  export { LOGO_LIGHT_SRC };
134
134
  export { LOGO_DARK_SRC };
135
- export { DEFAULT_TITLE };
135
+ export { DEFAULT_BOOK_TITLE };
136
136
  export { MAX_FILENAME_LENGTH };
137
137
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
138
138
  export { DEFAULT_MAX_PARALLEL_COUNT };
@@ -153,8 +153,8 @@ export { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME };
153
153
  export { ORDER_OF_PIPELINE_JSON };
154
154
  export { RESERVED_PARAMETER_NAMES };
155
155
  export { compilePipeline };
156
+ export { parsePipeline };
156
157
  export { pipelineJsonToString };
157
- export { precompilePipeline };
158
158
  export { prettifyPipelineString };
159
159
  export { extractParameterNamesFromTask };
160
160
  export { validatePipeline };
@@ -58,7 +58,7 @@ export declare const LOGO_DARK_SRC: string_url_image;
58
58
  *
59
59
  * @public exported from `@promptbook/core`
60
60
  */
61
- export declare const DEFAULT_TITLE = "Untitled";
61
+ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
62
62
  /**
63
63
  * Warning message for the generated sections and files files
64
64
  *
@@ -5,10 +5,7 @@ import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions
5
5
  /**
6
6
  * Compile pipeline from string (markdown) format to JSON format
7
7
  *
8
- * Note: There are 3 similar functions:
9
- * - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
10
- * - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
11
- * - `preparePipeline` - just one step in the compilation process
8
+ * @see https://github.com/webgptorg/promptbook/discussions/196
12
9
  *
13
10
  * Note: This function does not validate logic of the pipeline only the parsing
14
11
  * Note: This function acts as compilation process
@@ -5,7 +5,7 @@ import type { PipelineString } from '../pipeline/PipelineString';
5
5
  *
6
6
  * Note: There are 3 similar functions:
7
7
  * - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
8
- * - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
8
+ * - `parsePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
9
9
  * - `preparePipeline` - just one step in the compilation process
10
10
  *
11
11
  * Note: This function does not validate logic of the pipeline only the parsing
@@ -16,7 +16,7 @@ import type { PipelineString } from '../pipeline/PipelineString';
16
16
  * @throws {ParseError} if the promptbook string is not valid
17
17
  * @public exported from `@promptbook/core`
18
18
  */
19
- export declare function precompilePipeline(pipelineString: PipelineString): PipelineJson;
19
+ export declare function parsePipeline(pipelineString: PipelineString): PipelineJson;
20
20
  /**
21
21
  * TODO: [🧠] Maybe more things here can be refactored as high-level abstractions
22
22
  * TODO: [main] !!!! Warn if used only sync version
@@ -1,6 +1,6 @@
1
1
  import type { $PipelineJson } from '../../commands/_common/types/CommandParser';
2
2
  /**
3
- * Used in `precompilePipeline`
3
+ * Used in `parsePipeline`
4
4
  *
5
5
  * @private
6
6
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * All high-level abstractions
3
3
  *
4
- * @private internal index of `precompilePipeline` (= used for sync) and `preparePipeline` (= used for async)
4
+ * @private internal index of `parsePipeline` (= used for sync) and `preparePipeline` (= used for async)
5
5
  */
6
6
  export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
7
7
  type: "SYNC";
@@ -1,6 +1,6 @@
1
1
  import type { PipelineString } from './PipelineString';
2
2
  /**
3
- * Function for notating a pipeline with a book\`...\ notation as template literal
3
+ * Tag function for notating a pipeline with a book\`...\ notation as template literal
4
4
  *
5
5
  * @param strings @@@
6
6
  * @param values @@@
@@ -9,7 +9,7 @@ import type { PipelineString } from './PipelineString';
9
9
  */
10
10
  export declare function book(strings: TemplateStringsArray, ...values: Array<string>): PipelineString;
11
11
  /**
12
- * TODO: !!!!!! Use book\`...\ notation instead of as PipelineString
12
+ * TODO: Use ACRY book\`...\ notation instead of as PipelineString
13
13
  * TODO: [🧠][🈴] Where is the best location for this file
14
14
  * Note: [💞] Ignore a discrepancy between file name and entity name
15
15
  */
@@ -2,6 +2,8 @@ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
2
2
  /**
3
3
  * Determine if the pipeline is fully prepared
4
4
  *
5
+ * @see https://github.com/webgptorg/promptbook/discussions/196
6
+ *
5
7
  * @public exported from `@promptbook/core`
6
8
  */
7
9
  export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
@@ -4,6 +4,8 @@ import type { PrepareAndScrapeOptions } from './PrepareAndScrapeOptions';
4
4
  /**
5
5
  * Prepare pipeline from string (markdown) format to JSON format
6
6
  *
7
+ * @see https://github.com/webgptorg/promptbook/discussions/196
8
+ *
7
9
  * Note: This function does not validate logic of the pipeline
8
10
  * Note: This function acts as part of compilation process
9
11
  * Note: When the pipeline is already prepared, it returns the same pipeline
@@ -4,6 +4,7 @@ import type { ScraperIntermediateSource } from './ScraperIntermediateSource';
4
4
  /**
5
5
  * @@@
6
6
  *
7
+ * Note: [🌏] Converters are not usable in browser because they produce a files
7
8
  */
8
9
  export type Converter = {
9
10
  /**
@@ -7,7 +7,6 @@ import type { string_url } from '../../types/typeAliases';
7
7
  import type { ScraperAndConverterMetadata } from './register/ScraperAndConverterMetadata';
8
8
  /**
9
9
  * @@@
10
- *
11
10
  */
12
11
  export type Scraper = {
13
12
  /**
@@ -53,6 +52,7 @@ export type ScraperSourceHandler = {
53
52
  asText(): Promisable<string>;
54
53
  };
55
54
  /**
55
+ * TODO: [🧠] Maybe split `ScraperSourceHandler` into `ScraperWebsiteSourceHandler` + `ScraperFileSourceHandler`
56
56
  * TODO: [🥽] Add ` asBlob(): Promisable<Blob>;` or asFile
57
57
  * TODO: [🐝] @@@ Annotate all
58
58
  * TODO: [🔼] Export via types
@@ -9,3 +9,6 @@ export type ScraperIntermediateSource = IDestroyable & {
9
9
  */
10
10
  readonly filename: string_absolute_filename;
11
11
  };
12
+ /**
13
+ * Note: [🌏] Converters can be used only in node because they uses `ScraperIntermediateSource` which uses file system
14
+ */
@@ -28,6 +28,8 @@ export type ScraperAndConverterMetadata = Registered & {
28
28
  readonly mimeTypes: ReadonlyArray<string_mime_type>;
29
29
  /**
30
30
  * @@@
31
+ *
32
+ * Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
31
33
  */
32
34
  readonly isAvilableInBrowser: boolean;
33
35
  /**
@@ -37,4 +37,5 @@ export declare class PdfScraper implements Converter, Scraper {
37
37
  * TODO: [👣] Converted pdf documents can act as cached items - there is no need to run conversion each time
38
38
  * TODO: [🪂] Do it in parallel 11:11
39
39
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
40
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
40
41
  */
@@ -12,7 +12,7 @@ export declare const createPdfScraper: ((tools: Pick<ExecutionTools, 'llm'>, opt
12
12
  className: string;
13
13
  mimeTypes: string[];
14
14
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
15
- isAvilableInBrowser: true;
15
+ isAvilableInBrowser: false;
16
16
  requiredExecutables: never[];
17
17
  }>;
18
18
  /**
@@ -10,7 +10,7 @@ export declare const pdfScraperMetadata: import("type-fest/source/readonly-deep"
10
10
  className: string;
11
11
  mimeTypes: string[];
12
12
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
13
- isAvilableInBrowser: true;
13
+ isAvilableInBrowser: false;
14
14
  requiredExecutables: never[];
15
15
  }>;
16
16
  /**
@@ -12,7 +12,7 @@ export declare const createWebsiteScraper: ((tools: Pick<ExecutionTools, 'llm'>,
12
12
  className: string;
13
13
  mimeTypes: string[];
14
14
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
15
- isAvilableInBrowser: true; /**
15
+ isAvilableInBrowser: false; /**
16
16
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
17
17
  */
18
18
  requiredExecutables: never[];
@@ -10,7 +10,7 @@ export declare const websiteScraperMetadata: import("type-fest/source/readonly-d
10
10
  className: string;
11
11
  mimeTypes: string[];
12
12
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
13
- isAvilableInBrowser: true;
13
+ isAvilableInBrowser: false;
14
14
  requiredExecutables: never[];
15
15
  }>;
16
16
  /**
@@ -2,7 +2,7 @@ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Normalizes the markdown by flattening the structure
4
4
  *
5
- * - It always have h1 - if there is no h1 in the markdown, it will be added "# Untitled"
5
+ * - It always have h1 - if there is no h1 in the markdown, it will be added `DEFAULT_BOOK_TITLE`
6
6
  * - All other headings are normalized to h2
7
7
  *
8
8
  * @public exported from `@promptbook/markdown-utils`
@@ -0,0 +1,9 @@
1
+ import type { really_any } from './really_any';
2
+ /**
3
+ * Just says that the variable is not used directlys but should be kept because the existence of the variable is important
4
+ *
5
+ * @param value any values
6
+ * @returns void
7
+ * @private within the repository
8
+ */
9
+ export declare function $sideEffect(...sideEffectSubjects: ReadonlyArray<really_any>): void;
@@ -8,36 +8,50 @@ import type { InputParameters } from '../types/typeAliases';
8
8
  import type { string_filename } from '../types/typeAliases';
9
9
  import type { string_pipeline_url } from '../types/typeAliases';
10
10
  /**
11
+ * Wizzard for simple usage of the Promptbook
11
12
  * Look at `wizzard` for more details
12
13
  *
14
+ * Note: This works only in Node.js environment and looks for the configuration, environment, tools and cache in the Node.js environment
15
+ *
13
16
  * @private just for single instance
14
17
  */
15
18
  declare class Wizzard {
16
19
  /**
17
- * @@@!!!!!!
20
+ * Run the book
21
+ *
22
+ * It can be loaded from:
23
+ * 1) As a file ./books/write-cv.book.md
24
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md found in ./books folder recursively
25
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md fetched from the internet
26
+ * 3) As a string
27
+ *
28
+ * Note: This works simmilar to the `ptbk run` command
18
29
  */
19
- execute(book: string_pipeline_url, inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<PipelineExecutorResult>;
30
+ execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<PipelineExecutorResult>;
20
31
  private executionTools;
21
32
  /**
22
- * @@@!!!
33
+ * Provides the tools automatically for the Node.js environment
23
34
  *
24
35
  * @param pipelineSource
25
36
  */
26
37
  getExecutionTools(): Promise<Required<Pick<ExecutionTools, 'fs' | 'fetch'>>>;
27
38
  /**
28
- * TODO: Make standalone function from this exported from node and used here and in `ptbk run`
29
- * @@@!!!
39
+ * Load book from the source
30
40
  *
31
- * Strategies:
32
- * 1) @@@!!!
33
- * 2) @@@!!!
41
+ * Pipelines can be loaded from:
42
+ * 1) As a file ./books/write-cv.book.md
43
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md found in ./books folder recursively
44
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md fetched from the internet
45
+ * 3) As a string
34
46
  *
35
47
  * @param pipelineSource
36
48
  */
37
49
  getCompiledBook(pipelineSource: string_filename | string_pipeline_url | PipelineString): Promise<PipelineJson>;
38
50
  }
39
51
  /**
40
- * 🧙‍♂️ @@@
52
+ * Wizzard for simple usage of the Promptbook
53
+ *
54
+ * Note: This works only in Node.js environment and looks for the configuration, environment, tools and cache in the Node.js environment
41
55
  *
42
56
  * @singleton
43
57
  * @public exported from `@promptbook/wizzard`
@@ -45,7 +59,5 @@ declare class Wizzard {
45
59
  export declare const wizzard: Wizzard;
46
60
  export {};
47
61
  /**
48
- * TODO: !!!!!! Mark in jsdoc as non-pure
49
- * TODO: !!!!!! Add to readmes - one markdown here imported in all packages
50
62
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
51
63
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.81.0-18",
3
+ "version": "0.81.0-21",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "--note-0": " <- [🐊]",
6
6
  "private": false,
@@ -54,7 +54,7 @@
54
54
  "module": "./esm/index.es.js",
55
55
  "typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.81.0-18"
57
+ "@promptbook/core": "0.81.0-21"
58
58
  },
59
59
  "dependencies": {
60
60
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- var PROMPTBOOK_ENGINE_VERSION = '0.81.0-17';
27
+ var PROMPTBOOK_ENGINE_VERSION = '0.81.0-20';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name