@promptbook/node 0.86.0-8 → 0.86.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.
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.
@@ -121,34 +117,41 @@ We also have a community of developers and users of **Promptbook**:
121
117
  - [Landing page `ptbk.io`](https://ptbk.io)
122
118
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
123
119
  - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
124
- - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
120
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
125
121
 
126
122
  And **Promptbook.studio** branded socials:
127
123
 
124
+
125
+
128
126
  - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
129
127
 
128
+
129
+
130
130
  And **Promptujeme** sub-brand:
131
131
 
132
- _/Subbrand for Czech clients/_
132
+ */Subbrand for Czech clients/*
133
+
134
+
133
135
 
134
136
  - [Promptujeme.cz](https://www.promptujeme.cz/)
135
137
  - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
136
138
 
139
+
137
140
  And **Promptbook.city** branded socials:
138
141
 
139
- _/Sub-brand for images and graphics generated via Promptbook prompting/_
142
+ */Sub-brand for images and graphics generated via Promptbook prompting/*
140
143
 
141
144
  - [Instagram `@promptbook.city`](https://www.instagram.com/promptbook.city/)
142
- - [Facebook `Promptbook City`](https://www.facebook.com/61565718625569)
145
+ - [Facebook `Promptbook City`](https://www.facebook.com/61565718625569)
143
146
 
144
147
 
145
148
 
146
- ## 💙 Book language _(for prompt-engineer)_
147
149
 
148
150
 
149
151
 
152
+ ## 💙 The Book language
153
+
150
154
 
151
- ## 💙 The blueprint of book language
152
155
 
153
156
  Following is the documentation and blueprint of the Book language.
154
157
 
@@ -157,6 +160,11 @@ Following is the documentation and blueprint of the Book language.
157
160
  ```markdown
158
161
  # 🌟 My first Book
159
162
 
163
+ - BOOK VERSION 1.0.0
164
+ - URL https://promptbook.studio/my-first-book/
165
+
166
+ # Write an article
167
+
160
168
  - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
161
169
  - KNOWLEDGE https://ptbk.io
162
170
  - KNOWLEDGE ./promptbook.pdf
@@ -169,59 +177,31 @@ Following is the documentation and blueprint of the Book language.
169
177
  -> {article}
170
178
  ```
171
179
 
172
- ### Goals and principles of book language
173
-
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.
181
-
182
- ### Structure
183
-
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.
185
-
186
- ### Header
187
-
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.
189
-
190
- ### Parameter
180
+ ### **What:** Workflows, Tasks and Parameters
191
181
 
192
- Foo bar
182
+ - [PARAMETER](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PARAMETER.md)
193
183
 
194
- #### Parameter names
184
+ ### **Who:** Personas
195
185
 
196
- Reserved words:
186
+ - [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
197
187
 
198
- - _each command_ like `PERSONA`, `EXPECT`, `KNOWLEDGE`, etc.
199
- - `content`
200
- - `context`
201
- - `knowledge`
202
- - `examples`
203
- - `modelName`
204
- - `currentDate`
188
+ ### **How:** Knowledge, Instruments and Actions
205
189
 
206
- #### Parameter notation
190
+ - [KNOWLEDGE](https://github.com/webgptorg/promptbook/blob/main/documents/commands/KNOWLEDGE.md)
191
+ - [INSTRUMENT](https://github.com/webgptorg/promptbook/blob/main/documents/commands/INSTRUMENT.md)
192
+ - [ACTION](https://github.com/webgptorg/promptbook/blob/main/documents/commands/ACTION.md)
207
193
 
208
- ### Task
194
+ ### General principles of book language
209
195
 
210
- ### Task type
196
+ 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.
211
197
 
212
- Todo todo
198
+ The file has `.book` extension. It uses `UTF-8` non BOM encoding.
213
199
 
214
- ### Command
200
+ Book has two variants: flat - which is just a prompt with no structure, and full - which has a structure with tasks, commands and prompts.
215
201
 
216
- Todo todo
217
-
218
- ### Block
219
-
220
- Todo todo
221
-
222
- ### Return parameter
202
+ 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
203
 
224
- ### Examples
204
+ But unlike programming languages, it is designed to be understandable by non-programmers and non-technical people.
225
205
 
226
206
 
227
207
 
@@ -267,6 +247,7 @@ Or you can install them separately:
267
247
  - **[@promptbook/templates](https://www.npmjs.com/package/@promptbook/templates)** - Usefull templates and examples of books which can be used as a starting point
268
248
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
269
249
  - ⭐ **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
250
+ - 🐋 **[Docker image](https://hub.docker.com/r/hejny/promptbook/)** - Promptbook server
270
251
 
271
252
 
272
253
 
@@ -275,6 +256,11 @@ Or you can install them separately:
275
256
 
276
257
  ## 📚 Dictionary
277
258
 
259
+
260
+
261
+
262
+
263
+
278
264
  ### 📚 Dictionary
279
265
 
280
266
  The following glossary is used to clarify certain concepts:
@@ -290,6 +276,8 @@ The following glossary is used to clarify certain concepts:
290
276
  - **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
277
  - **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
278
 
279
+
280
+
293
281
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
294
282
 
295
283
  #### Promptbook core
@@ -350,6 +338,8 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
350
338
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
351
339
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
352
340
 
341
+
342
+
353
343
  ### Terms specific to Promptbook TypeScript implementation
354
344
 
355
345
  - Anonymous mode
@@ -429,7 +419,7 @@ See [TODO.md](./TODO.md)
429
419
  <div style="display: flex; align-items: center; gap: 20px;">
430
420
 
431
421
  <a href="https://promptbook.studio/">
432
- <img src="./other/design/promptbook-studio-logo.png" alt="Partner 3" height="100">
422
+ <img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="100">
433
423
  </a>
434
424
 
435
425
  <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.5';
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
  */
@@ -9070,7 +9070,7 @@ function flattenMarkdown(markdown) {
9070
9070
  * Note: This function acts as compilation process
9071
9071
  *
9072
9072
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
9073
- * @returns {Promptbook} compiled in JSON format (.book.json)
9073
+ * @returns {Promptbook} compiled in JSON format (.bookc)
9074
9074
  * @throws {ParseError} if the promptbook string is not valid
9075
9075
  * @public exported from `@promptbook/core`
9076
9076
  */
@@ -9538,7 +9538,7 @@ function parsePipeline(pipelineString) {
9538
9538
  * @param pipelineString {Promptbook} in string markdown format (.book.md)
9539
9539
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
9540
9540
  * @param options - Options and tools for the compilation
9541
- * @returns {Promptbook} compiled in JSON format (.book.json)
9541
+ * @returns {Promptbook} compiled in JSON format (.bookc)
9542
9542
  * @throws {ParseError} if the promptbook string is not valid
9543
9543
  * @public exported from `@promptbook/core`
9544
9544
  */
@@ -11266,7 +11266,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11266
11266
  }
11267
11267
  madeLibraryFilePath = join(rootPath, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
11268
11268
  // <- TODO: [🦒] Allow to override (pass different value into the function)
11269
- , ".json"));
11269
+ , ".bookc"));
11270
11270
  return [4 /*yield*/, isFileExisting(madeLibraryFilePath, tools.fs)];
11271
11271
  case 3:
11272
11272
  if (!(_f.sent())) ;
@@ -11288,13 +11288,13 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11288
11288
  return [4 /*yield*/, listAllFiles(rootPath, isRecursive, tools.fs)];
11289
11289
  case 1:
11290
11290
  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
11291
+ // Note: First load compiled `.bookc` files and then source `.book` files
11292
+ // `.bookc` are already compiled and can be used faster
11293
11293
  fileNames.sort(function (a, b) {
11294
- if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book'))) {
11294
+ if ((a.endsWith('.bookc') || a.endsWith('.book.json')) && (b.endsWith('.book') || b.endsWith('.book.md'))) {
11295
11295
  return -1;
11296
11296
  }
11297
- if ((a.endsWith('.book') || a.endsWith('.book')) && b.endsWith('.json')) {
11297
+ if ((a.endsWith('.book') || a.endsWith('.book.md')) && (b.endsWith('.bookc') || b.endsWith('.book.json'))) {
11298
11298
  return 1;
11299
11299
  }
11300
11300
  return 0;
@@ -11311,7 +11311,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11311
11311
  case 1:
11312
11312
  _f.trys.push([1, 8, , 9]);
11313
11313
  pipeline = null;
11314
- if (!(fileName.endsWith('.book') || fileName.endsWith('.book'))) return [3 /*break*/, 4];
11314
+ if (!(fileName.endsWith('.book') || fileName.endsWith('.book.md'))) return [3 /*break*/, 4];
11315
11315
  _c = validatePipelineString;
11316
11316
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
11317
11317
  case 2:
@@ -11324,7 +11324,7 @@ function createCollectionFromDirectory(rootPath, tools, options) {
11324
11324
  pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
11325
11325
  return [3 /*break*/, 7];
11326
11326
  case 4:
11327
- if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
11327
+ if (!(fileName.endsWith('.bookc') || fileName.endsWith('.book.json'))) return [3 /*break*/, 6];
11328
11328
  _e = (_d = JSON).parse;
11329
11329
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
11330
11330
  case 5: