@promptbook/node 0.88.0-11 โ 0.88.0-12
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 +7 -19
- package/esm/index.es.js +35 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +5 -0
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +5 -0
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -0
- package/package.json +2 -2
- package/umd/index.umd.js +35 -6
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -62,8 +62,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
62
62
|
|
|
63
63
|
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**!
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
65
|
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
66
|
|
|
69
67
|
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.
|
|
@@ -74,6 +72,9 @@ This shift is going to happen, whether we are ready for it or not. Our mission i
|
|
|
74
72
|
|
|
75
73
|
|
|
76
74
|
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
77
78
|
## ๐ Get started
|
|
78
79
|
|
|
79
80
|
Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
|
|
@@ -85,6 +86,8 @@ Take a look at the simple starter kit with books integrated into the **Hello Wor
|
|
|
85
86
|
|
|
86
87
|
|
|
87
88
|
|
|
89
|
+
|
|
90
|
+
|
|
88
91
|
## ๐ The Promptbook Project
|
|
89
92
|
|
|
90
93
|
Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project:
|
|
@@ -126,29 +129,22 @@ Hello world examples:
|
|
|
126
129
|
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
127
130
|
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
128
131
|
|
|
129
|
-
|
|
130
|
-
|
|
131
132
|
We also have a community of developers and users of **Promptbook**:
|
|
132
133
|
|
|
133
134
|
- [Discord community](https://discord.gg/x3QWNaa89N)
|
|
134
135
|
- [Landing page `ptbk.io`](https://ptbk.io)
|
|
135
136
|
- [Github discussions](https://github.com/webgptorg/promptbook/discussions)
|
|
136
137
|
- [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
|
|
137
|
-
- [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
|
|
138
|
+
- [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
|
|
138
139
|
|
|
139
140
|
And **Promptbook.studio** branded socials:
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
142
|
- [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
|
|
144
143
|
|
|
145
144
|
And **Promptujeme** sub-brand:
|
|
146
145
|
|
|
147
146
|
_/Subbrand for Czech clients/_
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
148
|
- [Promptujeme.cz](https://www.promptujeme.cz/)
|
|
153
149
|
- [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
|
|
154
150
|
|
|
@@ -166,8 +162,6 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
|
|
|
166
162
|
|
|
167
163
|
## ๐ The Book language
|
|
168
164
|
|
|
169
|
-
|
|
170
|
-
|
|
171
165
|
Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
|
|
172
166
|
|
|
173
167
|
Book is a language that can be used to write AI applications, agents, workflows, automations, knowledgebases, translators, sheet processors, email automations and more. It allows you to harness the power of AI models in human-like terms, without the need to know the specifics and technicalities of the models.
|
|
@@ -217,8 +211,6 @@ Personas can have access to different knowledge, tools and actions. They can als
|
|
|
217
211
|
|
|
218
212
|
- [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
|
|
219
213
|
|
|
220
|
-
|
|
221
|
-
|
|
222
214
|
### **How:** Knowledge, Instruments and Actions
|
|
223
215
|
|
|
224
216
|
The resources used by the personas are used to do the work.
|
|
@@ -307,12 +299,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
307
299
|
- **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.
|
|
308
300
|
- **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.
|
|
309
301
|
|
|
310
|
-
|
|
311
|
-
|
|
312
302
|
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
313
303
|
|
|
314
|
-
|
|
315
|
-
|
|
316
304
|
### ๐ฏ Core concepts
|
|
317
305
|
|
|
318
306
|
- [๐ Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
|
@@ -417,7 +405,7 @@ See [TODO.md](./TODO.md)
|
|
|
417
405
|
<a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
|
|
418
406
|
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="70">
|
|
419
407
|
</a>
|
|
420
|
-
|
|
408
|
+
|
|
421
409
|
</div>
|
|
422
410
|
|
|
423
411
|
## ๐๏ธ Contributing
|
package/esm/index.es.js
CHANGED
|
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.88.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.88.0-12';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -157,7 +157,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐คนโโ๏ธ]
|
|
|
157
157
|
*
|
|
158
158
|
* @public exported from `@promptbook/core`
|
|
159
159
|
*/
|
|
160
|
-
const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
160
|
+
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [๐คนโโ๏ธ]
|
|
161
161
|
// <- TODO: [๐] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
162
162
|
/**
|
|
163
163
|
* Where to store the temporary downloads
|
|
@@ -1642,11 +1642,17 @@ function jsonStringsToJsons(object) {
|
|
|
1642
1642
|
*/
|
|
1643
1643
|
class PipelineExecutionError extends Error {
|
|
1644
1644
|
constructor(message) {
|
|
1645
|
+
// Added id parameter
|
|
1645
1646
|
super(message);
|
|
1646
1647
|
this.name = 'PipelineExecutionError';
|
|
1648
|
+
// TODO: [๐] DRY - Maybe $randomId
|
|
1649
|
+
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
1647
1650
|
Object.setPrototypeOf(this, PipelineExecutionError.prototype);
|
|
1648
1651
|
}
|
|
1649
1652
|
}
|
|
1653
|
+
/**
|
|
1654
|
+
* TODO: !!!!!! Add id to all errors
|
|
1655
|
+
*/
|
|
1650
1656
|
|
|
1651
1657
|
/**
|
|
1652
1658
|
* This error indicates problems parsing the format value
|
|
@@ -1834,7 +1840,7 @@ const ALL_ERRORS = {
|
|
|
1834
1840
|
* @public exported from `@promptbook/utils`
|
|
1835
1841
|
*/
|
|
1836
1842
|
function deserializeError(error) {
|
|
1837
|
-
const { name, stack } = error;
|
|
1843
|
+
const { name, stack, id } = error; // Added id
|
|
1838
1844
|
let { message } = error;
|
|
1839
1845
|
let ErrorClass = ALL_ERRORS[error.name];
|
|
1840
1846
|
if (ErrorClass === undefined) {
|
|
@@ -1849,7 +1855,9 @@ function deserializeError(error) {
|
|
|
1849
1855
|
${block(stack || '')}
|
|
1850
1856
|
`);
|
|
1851
1857
|
}
|
|
1852
|
-
|
|
1858
|
+
const deserializedError = new ErrorClass(message);
|
|
1859
|
+
deserializedError.id = id; // Assign id to the error object
|
|
1860
|
+
return deserializedError;
|
|
1853
1861
|
}
|
|
1854
1862
|
|
|
1855
1863
|
/**
|
|
@@ -1899,6 +1907,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
1899
1907
|
*/
|
|
1900
1908
|
function createTask(options) {
|
|
1901
1909
|
const { taskType, taskProcessCallback } = options;
|
|
1910
|
+
// TODO: [๐] DRY
|
|
1902
1911
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
1903
1912
|
let status = 'RUNNING';
|
|
1904
1913
|
const createdAt = new Date();
|
|
@@ -1995,19 +2004,21 @@ function createTask(options) {
|
|
|
1995
2004
|
*/
|
|
1996
2005
|
function serializeError(error) {
|
|
1997
2006
|
const { name, message, stack } = error;
|
|
2007
|
+
const { id } = error;
|
|
1998
2008
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
1999
2009
|
console.error(spaceTrim((block) => `
|
|
2000
|
-
|
|
2010
|
+
|
|
2001
2011
|
Cannot serialize error with name "${name}"
|
|
2002
2012
|
|
|
2003
2013
|
${block(stack || message)}
|
|
2004
|
-
|
|
2014
|
+
|
|
2005
2015
|
`));
|
|
2006
2016
|
}
|
|
2007
2017
|
return {
|
|
2008
2018
|
name: name,
|
|
2009
2019
|
message,
|
|
2010
2020
|
stack,
|
|
2021
|
+
id, // Include id in the serialized object
|
|
2011
2022
|
};
|
|
2012
2023
|
}
|
|
2013
2024
|
|
|
@@ -3050,6 +3061,9 @@ function countCharacters(text) {
|
|
|
3050
3061
|
text = text.replace(/\p{Extended_Pictographic}(\u{200D}\p{Extended_Pictographic})*/gu, '-');
|
|
3051
3062
|
return text.length;
|
|
3052
3063
|
}
|
|
3064
|
+
/**
|
|
3065
|
+
* TODO: [๐ฅด] Implement counting in formats - like JSON, CSV, XML,...
|
|
3066
|
+
*/
|
|
3053
3067
|
|
|
3054
3068
|
/**
|
|
3055
3069
|
* Number of characters per standard line with 11pt Arial font size.
|
|
@@ -3081,6 +3095,9 @@ function countLines(text) {
|
|
|
3081
3095
|
const lines = text.split('\n');
|
|
3082
3096
|
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
3083
3097
|
}
|
|
3098
|
+
/**
|
|
3099
|
+
* TODO: [๐ฅด] Implement counting in formats - like JSON, CSV, XML,...
|
|
3100
|
+
*/
|
|
3084
3101
|
|
|
3085
3102
|
/**
|
|
3086
3103
|
* Counts number of pages in the text
|
|
@@ -3092,6 +3109,9 @@ function countLines(text) {
|
|
|
3092
3109
|
function countPages(text) {
|
|
3093
3110
|
return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);
|
|
3094
3111
|
}
|
|
3112
|
+
/**
|
|
3113
|
+
* TODO: [๐ฅด] Implement counting in formats - like JSON, CSV, XML,...
|
|
3114
|
+
*/
|
|
3095
3115
|
|
|
3096
3116
|
/**
|
|
3097
3117
|
* Counts number of paragraphs in the text
|
|
@@ -3101,6 +3121,9 @@ function countPages(text) {
|
|
|
3101
3121
|
function countParagraphs(text) {
|
|
3102
3122
|
return text.split(/\n\s*\n/).filter((paragraph) => paragraph.trim() !== '').length;
|
|
3103
3123
|
}
|
|
3124
|
+
/**
|
|
3125
|
+
* TODO: [๐ฅด] Implement counting in formats - like JSON, CSV, XML,...
|
|
3126
|
+
*/
|
|
3104
3127
|
|
|
3105
3128
|
/**
|
|
3106
3129
|
* Split text into sentences
|
|
@@ -3118,6 +3141,9 @@ function splitIntoSentences(text) {
|
|
|
3118
3141
|
function countSentences(text) {
|
|
3119
3142
|
return splitIntoSentences(text).length;
|
|
3120
3143
|
}
|
|
3144
|
+
/**
|
|
3145
|
+
* TODO: [๐ฅด] Implement counting in formats - like JSON, CSV, XML,...
|
|
3146
|
+
*/
|
|
3121
3147
|
|
|
3122
3148
|
const defaultDiacriticsRemovalMap = [
|
|
3123
3149
|
{
|
|
@@ -3392,6 +3418,9 @@ function countWords(text) {
|
|
|
3392
3418
|
text = text.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
3393
3419
|
return text.split(/[^a-zะฐ-ั0-9]+/i).filter((word) => word.length > 0).length;
|
|
3394
3420
|
}
|
|
3421
|
+
/**
|
|
3422
|
+
* TODO: [๐ฅด] Implement counting in formats - like JSON, CSV, XML,...
|
|
3423
|
+
*/
|
|
3395
3424
|
|
|
3396
3425
|
/**
|
|
3397
3426
|
* Index of all counter functions
|