@promptbook/legacy-documents 0.88.0-8 → 0.88.0-9

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
@@ -60,8 +60,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
60
60
 
61
61
  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**!
62
62
 
63
-
64
-
65
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!
66
64
 
67
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.
@@ -124,21 +122,16 @@ We also have a community of developers and users of **Promptbook**:
124
122
  - [Landing page `ptbk.io`](https://ptbk.io)
125
123
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
126
124
  - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
127
- - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
125
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
128
126
 
129
127
  And **Promptbook.studio** branded socials:
130
128
 
131
-
132
-
133
129
  - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
134
130
 
135
131
  And **Promptujeme** sub-brand:
136
132
 
137
133
  _/Subbrand for Czech clients/_
138
134
 
139
-
140
-
141
-
142
135
  - [Promptujeme.cz](https://www.promptujeme.cz/)
143
136
  - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
144
137
 
@@ -156,8 +149,6 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
156
149
 
157
150
  ## 💙 The Book language
158
151
 
159
-
160
-
161
152
  Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
162
153
 
163
154
  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.
@@ -207,8 +198,6 @@ Personas can have access to different knowledge, tools and actions. They can als
207
198
 
208
199
  - [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
209
200
 
210
-
211
-
212
201
  ### **How:** Knowledge, Instruments and Actions
213
202
 
214
203
  The resources used by the personas are used to do the work.
@@ -284,11 +273,6 @@ Or you can install them separately:
284
273
 
285
274
  ## 📚 Dictionary
286
275
 
287
-
288
-
289
-
290
-
291
-
292
276
  ### 📚 Dictionary
293
277
 
294
278
  The following glossary is used to clarify certain concepts:
@@ -304,12 +288,8 @@ The following glossary is used to clarify certain concepts:
304
288
  - **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.
305
289
  - **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.
306
290
 
307
-
308
-
309
291
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
310
292
 
311
-
312
-
313
293
  #### 💯 Core concepts
314
294
 
315
295
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
@@ -338,8 +318,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
338
318
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
339
319
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
340
320
 
341
-
342
-
343
321
  ### Terms specific to Promptbook TypeScript implementation
344
322
 
345
323
  - Anonymous mode
@@ -347,10 +325,9 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
347
325
 
348
326
 
349
327
 
350
- ## 🔌 Usage in Typescript / Javascript
328
+ ## 🚂 Promptbook Engine
351
329
 
352
- - [Simple usage](./examples/usage/simple-script)
353
- - [Usage with client and remote server](./examples/usage/remote)
330
+ ![Schema of Promptbook Engine](./documents/promptbook-engine.svg)
354
331
 
355
332
  ## ➕➖ When to use Promptbook?
356
333
 
package/esm/index.es.js CHANGED
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.88.0-8';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.88.0-9';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2238,6 +2238,36 @@ function $randomToken(randomness) {
2238
2238
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
2239
2239
  */
2240
2240
 
2241
+ /**
2242
+ * Recursively converts JSON strings to JSON objects
2243
+
2244
+ * @public exported from `@promptbook/utils`
2245
+ */
2246
+ function jsonStringsToJsons(object) {
2247
+ if (object === null) {
2248
+ return object;
2249
+ }
2250
+ if (Array.isArray(object)) {
2251
+ return object.map(jsonStringsToJsons);
2252
+ }
2253
+ if (typeof object !== 'object') {
2254
+ return object;
2255
+ }
2256
+ const newObject = { ...object };
2257
+ for (const [key, value] of Object.entries(object)) {
2258
+ if (typeof value === 'string' && isValidJsonString(value)) {
2259
+ newObject[key] = JSON.parse(value);
2260
+ }
2261
+ else {
2262
+ newObject[key] = jsonStringsToJsons(value);
2263
+ }
2264
+ }
2265
+ return newObject;
2266
+ }
2267
+ /**
2268
+ * TODO: Type the return type correctly
2269
+ */
2270
+
2241
2271
  /**
2242
2272
  * This error indicates problems parsing the format value
2243
2273
  *
@@ -2469,11 +2499,12 @@ function createTask(options) {
2469
2499
  let updatedAt = createdAt;
2470
2500
  const errors = [];
2471
2501
  const warnings = [];
2472
- const currentValue = {};
2502
+ let currentValue = {};
2473
2503
  const partialResultSubject = new Subject();
2474
2504
  // <- Note: Not using `BehaviorSubject` because on error we can't access the last value
2475
2505
  const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
2476
2506
  Object.assign(currentValue, newOngoingResult);
2507
+ // <- TODO: assign deep
2477
2508
  partialResultSubject.next(newOngoingResult);
2478
2509
  });
2479
2510
  finalResultPromise
@@ -2493,7 +2524,8 @@ function createTask(options) {
2493
2524
  // And delete `ExecutionTask.currentValue.preparedPipeline`
2494
2525
  assertsTaskSuccessful(executionResult);
2495
2526
  status = 'FINISHED';
2496
- Object.assign(currentValue, executionResult);
2527
+ currentValue = jsonStringsToJsons(executionResult);
2528
+ // <- TODO: Convert JSON values in string to JSON objects
2497
2529
  partialResultSubject.next(executionResult);
2498
2530
  }
2499
2531
  catch (error) {