@promptbook/cli 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
@@ -112,8 +112,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
112
112
 
113
113
  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**!
114
114
 
115
-
116
-
117
115
  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!
118
116
 
119
117
  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.
@@ -176,21 +174,16 @@ We also have a community of developers and users of **Promptbook**:
176
174
  - [Landing page `ptbk.io`](https://ptbk.io)
177
175
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
178
176
  - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
179
- - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
177
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
180
178
 
181
179
  And **Promptbook.studio** branded socials:
182
180
 
183
-
184
-
185
181
  - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
186
182
 
187
183
  And **Promptujeme** sub-brand:
188
184
 
189
185
  _/Subbrand for Czech clients/_
190
186
 
191
-
192
-
193
-
194
187
  - [Promptujeme.cz](https://www.promptujeme.cz/)
195
188
  - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
196
189
 
@@ -208,8 +201,6 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
208
201
 
209
202
  ## 💙 The Book language
210
203
 
211
-
212
-
213
204
  Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
214
205
 
215
206
  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.
@@ -259,8 +250,6 @@ Personas can have access to different knowledge, tools and actions. They can als
259
250
 
260
251
  - [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
261
252
 
262
-
263
-
264
253
  ### **How:** Knowledge, Instruments and Actions
265
254
 
266
255
  The resources used by the personas are used to do the work.
@@ -336,11 +325,6 @@ Or you can install them separately:
336
325
 
337
326
  ## 📚 Dictionary
338
327
 
339
-
340
-
341
-
342
-
343
-
344
328
  ### 📚 Dictionary
345
329
 
346
330
  The following glossary is used to clarify certain concepts:
@@ -356,12 +340,8 @@ The following glossary is used to clarify certain concepts:
356
340
  - **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.
357
341
  - **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.
358
342
 
359
-
360
-
361
343
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
362
344
 
363
-
364
-
365
345
  #### 💯 Core concepts
366
346
 
367
347
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
@@ -390,8 +370,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
390
370
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
391
371
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
392
372
 
393
-
394
-
395
373
  ### Terms specific to Promptbook TypeScript implementation
396
374
 
397
375
  - Anonymous mode
@@ -399,10 +377,9 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
399
377
 
400
378
 
401
379
 
402
- ## 🔌 Usage in Typescript / Javascript
380
+ ## 🚂 Promptbook Engine
403
381
 
404
- - [Simple usage](./examples/usage/simple-script)
405
- - [Usage with client and remote server](./examples/usage/remote)
382
+ ![Schema of Promptbook Engine](./documents/promptbook-engine.svg)
406
383
 
407
384
  ## ➕➖ When to use Promptbook?
408
385
 
package/esm/index.es.js CHANGED
@@ -44,7 +44,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
44
44
  * @generated
45
45
  * @see https://github.com/webgptorg/promptbook
46
46
  */
47
- const PROMPTBOOK_ENGINE_VERSION = '0.88.0-8';
47
+ const PROMPTBOOK_ENGINE_VERSION = '0.88.0-9';
48
48
  /**
49
49
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
50
50
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4088,6 +4088,36 @@ function $randomToken(randomness) {
4088
4088
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
4089
4089
  */
4090
4090
 
4091
+ /**
4092
+ * Recursively converts JSON strings to JSON objects
4093
+
4094
+ * @public exported from `@promptbook/utils`
4095
+ */
4096
+ function jsonStringsToJsons(object) {
4097
+ if (object === null) {
4098
+ return object;
4099
+ }
4100
+ if (Array.isArray(object)) {
4101
+ return object.map(jsonStringsToJsons);
4102
+ }
4103
+ if (typeof object !== 'object') {
4104
+ return object;
4105
+ }
4106
+ const newObject = { ...object };
4107
+ for (const [key, value] of Object.entries(object)) {
4108
+ if (typeof value === 'string' && isValidJsonString(value)) {
4109
+ newObject[key] = JSON.parse(value);
4110
+ }
4111
+ else {
4112
+ newObject[key] = jsonStringsToJsons(value);
4113
+ }
4114
+ }
4115
+ return newObject;
4116
+ }
4117
+ /**
4118
+ * TODO: Type the return type correctly
4119
+ */
4120
+
4091
4121
  /**
4092
4122
  * This error indicates problems parsing the format value
4093
4123
  *
@@ -4309,11 +4339,12 @@ function createTask(options) {
4309
4339
  let updatedAt = createdAt;
4310
4340
  const errors = [];
4311
4341
  const warnings = [];
4312
- const currentValue = {};
4342
+ let currentValue = {};
4313
4343
  const partialResultSubject = new Subject();
4314
4344
  // <- Note: Not using `BehaviorSubject` because on error we can't access the last value
4315
4345
  const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
4316
4346
  Object.assign(currentValue, newOngoingResult);
4347
+ // <- TODO: assign deep
4317
4348
  partialResultSubject.next(newOngoingResult);
4318
4349
  });
4319
4350
  finalResultPromise
@@ -4333,7 +4364,8 @@ function createTask(options) {
4333
4364
  // And delete `ExecutionTask.currentValue.preparedPipeline`
4334
4365
  assertsTaskSuccessful(executionResult);
4335
4366
  status = 'FINISHED';
4336
- Object.assign(currentValue, executionResult);
4367
+ currentValue = jsonStringsToJsons(executionResult);
4368
+ // <- TODO: Convert JSON values in string to JSON objects
4337
4369
  partialResultSubject.next(executionResult);
4338
4370
  }
4339
4371
  catch (error) {