@promptbook/node 0.86.0-8 โ†’ 0.86.6

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
@@ -5,8 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- [![NPM Version of ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
9
- [![Quality of package ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
8
+ [![NPM Version of ![Promptbook logo - cube with letters P and B](./design/logo-h1.png) Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
9
+ [![Quality of package ![Promptbook logo - cube with letters P and B](./design/logo-h1.png) Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
10
10
  [![Known Vulnerabilities](https://snyk.io/test/github/webgptorg/promptbook/badge.svg)](https://snyk.io/test/github/webgptorg/promptbook)
11
11
  [![Issues](https://img.shields.io/github/issues/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/issues)
12
12
 
@@ -17,18 +17,12 @@
17
17
  ## ๐ŸŒŸ New Features
18
18
 
19
19
  - ๐Ÿ“‚ We have plugin for [VSCode](https://github.com/webgptorg/book-extension) to support `.book` file extension
20
+ - ๐Ÿณ Available [Docker image](https://hub.docker.com/r/hejny/promptbook/)
20
21
  - ๐Ÿ’ซ Support of [`o3-mini` model by OpenAI](https://openai.com/index/openai-o3-mini/)
21
22
  - ๐Ÿ‹ **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
22
- - ๐Ÿ’™ Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
23
- - ๐Ÿ–ค Run books from CLI - `npx ptbk run path/to/your/book`
24
- - ๐Ÿ“š Support of `.docx`, `.doc` and `.pdf` documents as knowledge
25
23
 
26
24
 
27
25
 
28
- <blockquote style="color: #ff8811">
29
- <b>โš  Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
30
- </blockquote>
31
-
32
26
  ## ๐Ÿ“ฆ Package `@promptbook/node`
33
27
 
34
28
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -64,6 +58,8 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
64
58
 
65
59
  During the computer revolution, we have seen [multiple generations of computer languages](https://github.com/webgptorg/promptbook/discussions/180), from the physical rewiring of the vacuum tubes through low-level machine code to the high-level languages like Python or JavaScript. And now, we're on the edge of the **next revolution**!
66
60
 
61
+
62
+
67
63
  It's a revolution of writing software in **plain human language** that is understandable and executable by both humans and machines โ€“ and it's going to change everything!
68
64
 
69
65
  The incredible growth in power of microprocessors and the Moore's Law have been the driving force behind the ever-more powerful languages, and it's been an amazing journey! Similarly, the large language models (like GPT or Claude) are the next big thing in language technology, and they're set to transform the way we interact with computers.
@@ -100,17 +96,22 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
100
96
  <tr>
101
97
  <td><a href="https://github.com/webgptorg/book">Book language</a></td>
102
98
  <td>
103
- Book is a markdown-like language to define core entities like personas, knowledge, tasks,.... It is designed to be understandable by non-programmers and non-technical people<hr>
99
+ Book is a human-understandable markup language for writing AI applications such as chatbots, knowledge bases, agents, avarars, translators, automations and more.
100
+ <hr>
104
101
  There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
105
102
  </td>
106
103
  </tr>
107
104
  <tr>
108
105
  <td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
109
- <td>Promptbook implementation in TypeScript released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Docker HUB</a></td>
106
+ <td>
107
+ Promptbook engine can run applications written in Book language. It is released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Docker HUB</a>
108
+ </td>
110
109
  </tr>
111
110
  <tr>
112
111
  <td><a href="https://promptbook.studio">Promptbook Studio</a></td>
113
- <td>Studio to write Books and instantly publish them as miniapps</td>
112
+ <td>
113
+ Promptbook.studio is a web-based editor and runner for book applications. It is still in the experimental MVP stage.
114
+ </td>
114
115
  </tr>
115
116
  </tbody>
116
117
  </table>
@@ -121,16 +122,21 @@ We also have a community of developers and users of **Promptbook**:
121
122
  - [Landing page `ptbk.io`](https://ptbk.io)
122
123
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
123
124
  - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
124
- - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
125
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
125
126
 
126
127
  And **Promptbook.studio** branded socials:
127
128
 
129
+
130
+
128
131
  - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
129
132
 
130
133
  And **Promptujeme** sub-brand:
131
134
 
132
135
  _/Subbrand for Czech clients/_
133
136
 
137
+
138
+
139
+
134
140
  - [Promptujeme.cz](https://www.promptujeme.cz/)
135
141
  - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
136
142
 
@@ -139,16 +145,18 @@ And **Promptbook.city** branded socials:
139
145
  _/Sub-brand for images and graphics generated via Promptbook prompting/_
140
146
 
141
147
  - [Instagram `@promptbook.city`](https://www.instagram.com/promptbook.city/)
142
- - [Facebook `Promptbook City`](https://www.facebook.com/61565718625569)
148
+ - [Facebook `Promptbook City`](https://www.facebook.com/61565718625569)
149
+
150
+ ##
151
+
143
152
 
144
153
 
145
154
 
146
- ## ๐Ÿ’™ Book language _(for prompt-engineer)_
147
155
 
148
156
 
157
+ ## ๐Ÿ’™ The Book language
149
158
 
150
159
 
151
- ## ๐Ÿ’™ The blueprint of book language
152
160
 
153
161
  Following is the documentation and blueprint of the Book language.
154
162
 
@@ -157,6 +165,11 @@ Following is the documentation and blueprint of the Book language.
157
165
  ```markdown
158
166
  # ๐ŸŒŸ My first Book
159
167
 
168
+ - BOOK VERSION 1.0.0
169
+ - URL https://promptbook.studio/my-first-book/
170
+
171
+ # Write an article
172
+
160
173
  - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
161
174
  - KNOWLEDGE https://ptbk.io
162
175
  - KNOWLEDGE ./promptbook.pdf
@@ -169,59 +182,31 @@ Following is the documentation and blueprint of the Book language.
169
182
  -> {article}
170
183
  ```
171
184
 
172
- ### Goals and principles of book language
185
+ ### **What:** Workflows, Tasks and Parameters
173
186
 
174
- File is designed to be easy to read and write. It is strict subset of markdown. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
175
-
176
- It has file with `.book.md` or `.book` extension with `UTF-8` non BOM encoding.
177
-
178
- As it is source code, it can leverage all the features of version control systems like git and does not suffer from the problems of binary formats, proprietary formats, or no-code solutions.
179
-
180
- But unlike programming languages, it is designed to be understandable by non-programmers and non-technical people.
187
+ - [PARAMETER](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PARAMETER.md)
181
188
 
182
- ### Structure
189
+ ### **Who:** Personas
183
190
 
184
- Book is divided into sections. Each section starts with heading. The language itself is not sensitive to the type of heading _(`h1`, `h2`, `h3`, ...)_ but it is recommended to use `h1` for header section and `h2` for other sections.
191
+ - [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
185
192
 
186
- ### Header
193
+ ### **How:** Knowledge, Instruments and Actions
187
194
 
188
- Header is the first section of the book. It contains metadata about the pipeline. It is recommended to use `h1` heading for header section but it is not required.
195
+ - [KNOWLEDGE](https://github.com/webgptorg/promptbook/blob/main/documents/commands/KNOWLEDGE.md)
196
+ - [INSTRUMENT](https://github.com/webgptorg/promptbook/blob/main/documents/commands/INSTRUMENT.md)
197
+ - [ACTION](https://github.com/webgptorg/promptbook/blob/main/documents/commands/ACTION.md)
189
198
 
190
- ### Parameter
199
+ ### General principles of book language
191
200
 
192
- Foo bar
201
+ Book language is based on markdown. It is subset of markdown. It is designed to be easy to read and write. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
193
202
 
194
- #### Parameter names
203
+ The file has `.book` extension. It uses `UTF-8` non BOM encoding.
195
204
 
196
- Reserved words:
205
+ Book has two variants: flat - which is just a prompt with no structure, and full - which has a structure with tasks, commands and prompts.
197
206
 
198
- - _each command_ like `PERSONA`, `EXPECT`, `KNOWLEDGE`, etc.
199
- - `content`
200
- - `context`
201
- - `knowledge`
202
- - `examples`
203
- - `modelName`
204
- - `currentDate`
205
-
206
- #### Parameter notation
207
-
208
- ### Task
209
-
210
- ### Task type
211
-
212
- Todo todo
213
-
214
- ### Command
215
-
216
- Todo todo
217
-
218
- ### Block
219
-
220
- Todo todo
221
-
222
- ### Return parameter
207
+ As it is source code, it can leverage all the features of version control systems like git and does not suffer from the problems of binary formats, proprietary formats, or no-code solutions.
223
208
 
224
- ### Examples
209
+ But unlike programming languages, it is designed to be understandable by non-programmers and non-technical people.
225
210
 
226
211
 
227
212
 
@@ -267,6 +252,7 @@ Or you can install them separately:
267
252
  - **[@promptbook/templates](https://www.npmjs.com/package/@promptbook/templates)** - Usefull templates and examples of books which can be used as a starting point
268
253
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
269
254
  - โญ **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
255
+ - ๐Ÿ‹ **[Docker image](https://hub.docker.com/r/hejny/promptbook/)** - Promptbook server
270
256
 
271
257
 
272
258
 
@@ -275,6 +261,11 @@ Or you can install them separately:
275
261
 
276
262
  ## ๐Ÿ“š Dictionary
277
263
 
264
+
265
+
266
+
267
+
268
+
278
269
  ### ๐Ÿ“š Dictionary
279
270
 
280
271
  The following glossary is used to clarify certain concepts:
@@ -290,6 +281,8 @@ The following glossary is used to clarify certain concepts:
290
281
  - **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.
291
282
  - **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.
292
283
 
284
+
285
+
293
286
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
294
287
 
295
288
  #### Promptbook core
@@ -350,6 +343,8 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
350
343
  - [๐Ÿ‘ฎ Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
351
344
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
352
345
 
346
+
347
+
353
348
  ### Terms specific to Promptbook TypeScript implementation
354
349
 
355
350
  - Anonymous mode
@@ -429,7 +424,7 @@ See [TODO.md](./TODO.md)
429
424
  <div style="display: flex; align-items: center; gap: 20px;">
430
425
 
431
426
  <a href="https://promptbook.studio/">
432
- <img src="./other/design/promptbook-studio-logo.png" alt="Partner 3" height="100">
427
+ <img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="100">
433
428
  </a>
434
429
 
435
430
  <a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
package/esm/index.es.js CHANGED
@@ -29,7 +29,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- var PROMPTBOOK_ENGINE_VERSION = '0.86.0-7';
32
+ var PROMPTBOOK_ENGINE_VERSION = '0.86.6';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -548,7 +548,7 @@ function capitalize(word) {
548
548
  * Converts promptbook in JSON format to string format
549
549
  *
550
550
  * @deprecated TODO: [๐Ÿฅ][๐Ÿง ] Backup original files in `PipelineJson` same as in Promptbook.studio
551
- * @param pipelineJson Promptbook in JSON format (.book.json)
551
+ * @param pipelineJson Promptbook in JSON format (.bookc)
552
552
  * @returns Promptbook in string format (.book.md)
553
553
  * @public exported from `@promptbook/core`
554
554
  */
@@ -5908,7 +5908,9 @@ function prepareTasks(pipeline, tools, options) {
5908
5908
  return __generator(this, function (_a) {
5909
5909
  dependentParameterNames = task.dependentParameterNames;
5910
5910
  preparedContent = undefined;
5911
- if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
5911
+ if (task.taskType === 'PROMPT_TASK' &&
5912
+ knowledgePiecesCount > 0 &&
5913
+ !dependentParameterNames.includes('knowledge')) {
5912
5914
  preparedContent = spaceTrim$1("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
5913
5915
  // <- TODO: [๐Ÿง ][๐Ÿงป] Cutomize shape/language/formatting of the addition to the prompt
5914
5916
  dependentParameterNames = __spreadArray(__spreadArray([], __read(dependentParameterNames), false), [
@@ -9070,7 +9072,7 @@ function flattenMarkdown(markdown) {
9070
9072
  * Note: This function acts as compilation process
9071
9073
  *
9072
9074
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
9073
- * @returns {Promptbook} compiled in JSON format (.book.json)
9075
+ * @returns {Promptbook} compiled in JSON format (.bookc)
9074
9076
  * @throws {ParseError} if the promptbook string is not valid
9075
9077
  * @public exported from `@promptbook/core`
9076
9078
  */
@@ -9538,7 +9540,7 @@ function parsePipeline(pipelineString) {
9538
9540
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
9539
9541
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
9540
9542
  * @param options - Options and tools for the compilation
9541
- * @returns {Promptbook} compiled in JSON format (.book.json)
9543
+ * @returns {Promptbook} compiled in JSON format (.bookc)
9542
9544
  * @throws {ParseError} if the promptbook string is not valid
9543
9545
  * @public exported from `@promptbook/core`
9544
9546
  */
@@ -11266,7 +11268,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11266
11268
  }
11267
11269
  madeLibraryFilePath = join(rootPath, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
11268
11270
  // <- TODO: [๐Ÿฆ’] Allow to override (pass different value into the function)
11269
- , ".json"));
11271
+ , ".bookc"));
11270
11272
  return [4 /*yield*/, isFileExisting(madeLibraryFilePath, tools.fs)];
11271
11273
  case 3:
11272
11274
  if (!(_f.sent())) ;
@@ -11288,13 +11290,13 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11288
11290
  return [4 /*yield*/, listAllFiles(rootPath, isRecursive, tools.fs)];
11289
11291
  case 1:
11290
11292
  fileNames = _b.sent();
11291
- // Note: First load all `.book.json` and then `.book` / `.book` files
11292
- // `.book.json` can be prepared so it is faster to load
11293
+ // Note: First load compiled `.bookc` files and then source `.book` files
11294
+ // `.bookc` are already compiled and can be used faster
11293
11295
  fileNames.sort(function (a, b) {
11294
- if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book'))) {
11296
+ if ((a.endsWith('.bookc') || a.endsWith('.book.json')) && (b.endsWith('.book') || b.endsWith('.book.md'))) {
11295
11297
  return -1;
11296
11298
  }
11297
- if ((a.endsWith('.book') || a.endsWith('.book')) && b.endsWith('.json')) {
11299
+ if ((a.endsWith('.book') || a.endsWith('.book.md')) && (b.endsWith('.bookc') || b.endsWith('.book.json'))) {
11298
11300
  return 1;
11299
11301
  }
11300
11302
  return 0;
@@ -11311,7 +11313,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11311
11313
  case 1:
11312
11314
  _f.trys.push([1, 8, , 9]);
11313
11315
  pipeline = null;
11314
- if (!(fileName.endsWith('.book') || fileName.endsWith('.book'))) return [3 /*break*/, 4];
11316
+ if (!(fileName.endsWith('.book') || fileName.endsWith('.book.md'))) return [3 /*break*/, 4];
11315
11317
  _c = validatePipelineString;
11316
11318
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
11317
11319
  case 2:
@@ -11324,7 +11326,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11324
11326
  pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
11325
11327
  return [3 /*break*/, 7];
11326
11328
  case 4:
11327
- if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
11329
+ if (!(fileName.endsWith('.bookc') || fileName.endsWith('.book.json'))) return [3 /*break*/, 6];
11328
11330
  _e = (_d = JSON).parse;
11329
11331
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
11330
11332
  case 5: