@promptbook/cli 0.74.0-0 → 0.74.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.
Files changed (57) hide show
  1. package/README.md +137 -32
  2. package/bin/promptbook-cli.js +6 -1
  3. package/esm/index.es.js +1078 -500
  4. package/esm/index.es.js.map +1 -1
  5. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
  6. package/esm/typings/src/_packages/azure-openai.index.d.ts +2 -2
  7. package/esm/typings/src/_packages/browser.index.d.ts +2 -2
  8. package/esm/typings/src/_packages/cli.index.d.ts +2 -2
  9. package/esm/typings/src/_packages/core.index.d.ts +7 -3
  10. package/esm/typings/src/_packages/documents.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/execute-javascript.index.d.ts +2 -2
  12. package/esm/typings/src/_packages/fake-llm.index.d.ts +2 -2
  13. package/esm/typings/src/_packages/langtail.index.d.ts +2 -2
  14. package/esm/typings/src/_packages/legacy-documents.index.d.ts +2 -2
  15. package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
  16. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  17. package/esm/typings/src/_packages/openai.index.d.ts +2 -2
  18. package/esm/typings/src/_packages/pdf.index.d.ts +2 -2
  19. package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
  20. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -2
  21. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  22. package/esm/typings/src/_packages/website-crawler.index.d.ts +2 -2
  23. package/esm/typings/src/cli/cli-commands/make.d.ts +0 -1
  24. package/esm/typings/src/cli/cli-commands/run.d.ts +14 -0
  25. package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
  26. package/esm/typings/src/cli/test/ptbk.d.ts +5 -2
  27. package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
  28. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
  29. package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +11 -0
  30. package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
  31. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  32. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  33. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  34. package/esm/typings/src/commands/index.d.ts +1 -1
  35. package/esm/typings/src/config.d.ts +6 -0
  36. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
  37. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  38. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
  39. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  40. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
  41. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  42. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
  43. package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
  44. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
  45. package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
  46. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
  47. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  48. package/esm/typings/src/types/Prompt.d.ts +1 -1
  49. package/esm/typings/src/types/typeAliases.d.ts +2 -2
  50. package/esm/typings/src/version.d.ts +13 -2
  51. package/package.json +8 -4
  52. package/umd/index.umd.js +1083 -504
  53. package/umd/index.umd.js.map +1 -1
  54. package/esm/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
  55. package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
  56. /package/esm/typings/src/commands/{PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts → BOOK_VERSION/bookVersionCommand.test.d.ts} +0 -0
  57. /package/esm/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/README.md CHANGED
@@ -70,7 +70,7 @@ import { OpenAiExecutionTools } from '@promptbook/openai';
70
70
 
71
71
  // ▶ Get single Pipeline
72
72
  const promptbook = await getPipelineCollection().getPipelineByUrl(
73
- `https://promptbook.studio/my-collection/write-article.ptbk.md`,
73
+ `https://promptbook.studio/my-collection/write-article.book.md`,
74
74
  );
75
75
 
76
76
  // ▶ Create executor - the function that will execute the Pipeline
@@ -97,7 +97,7 @@ There is also a javascript and json format available.
97
97
  ## Prettify
98
98
 
99
99
  ```bash
100
- npx ptbk prettify promptbook/**/*.ptbk.md
100
+ npx ptbk prettify promptbook/**/*.book.md
101
101
  ```
102
102
 
103
103
  This will prettify all promptbooks in `promptbook` directory and adds Mermaid graphs to them.
@@ -109,8 +109,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
109
109
 
110
110
  ## 🤍 The Promptbook Whitepaper
111
111
 
112
-
113
-
114
112
  If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 3, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
115
113
 
116
114
  But often you will struggle with the **limitations of LLMs**, such as **hallucinations, off-topic responses, poor quality output, language and prompt drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd resp0nses**. When this happens, you generally have three options:
@@ -131,63 +129,65 @@ In all of these situations, but especially in 3., the **✨ Promptbook can make
131
129
 
132
130
 
133
131
 
134
- ## 💜 The Promptbook Project
135
132
 
136
133
 
137
134
 
135
+ ## 💜 The Promptbook Project
136
+
137
+ Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project:
138
+
138
139
  <table>
139
- <tbody>
140
+ <thead>
140
141
  <tr>
141
- <td>Promptbook whitepaper</td>
142
- <td>Basic motivations and problems which we are trying to solve</td>
143
- <td rowspan=3>https://github.com/webgptorg/book</td>
142
+ <th>Project</th>
143
+ <th>Description</th>
144
+ <th>Link</th>
144
145
  </tr>
146
+ </thead>
147
+ <tbody>
145
148
  <tr>
146
- <td>Promptbook <i>(system)</i></td>
147
- <td>Promptbook ...</td>
149
+ <td>Core</td>
150
+ <td>Promptbook core is a description and documentation of basic innerworkings how should be Promptbook implemented and defines which fetures must be descriable by book language</td>
151
+ <td rowspan=2>https://ptbk.io<br/>https://github.com/webgptorg/book</td>
148
152
  </tr>
149
153
  <tr>
150
154
  <td>Book language</td>
151
155
  <td>
152
- Book is a markdown-like language to define projects, pipelines, knowledge,... in the Promptbook system. It is designed to be understandable by non-programmers and non-technical people
156
+ Book is a markdown-like language to define core entities like projects, pipelines, knowledge,.... It is designed to be understandable by non-programmers and non-technical people
153
157
  </td>
154
158
  </tr>
155
159
  <tr>
156
160
  <td>Promptbook typescript project</td>
157
161
  <td>Implementation of Promptbook in TypeScript published into multiple packages to NPM</td>
158
- <td>https://github.com/webgptorg/promptbook</td>
162
+ <td>https://github.com/webgptorg/promptbook + Multiple packages on NPM</td>
159
163
  </tr>
160
164
  <tr>
161
165
  <td>Promptbook studio</td>
162
- <td>Promptbook studio</td>
163
- <td rowspan=2>https://github.com/hejny/promptbook-studio</td>
166
+ <td>No-code studio to write book without need to write even the markdown</td>
167
+ <td rowspan=2>https://promptbook.studio<br/>https://github.com/hejny/promptbook-studio</td>
164
168
  </tr>
165
169
  <tr>
166
170
  <td>Promptbook miniapps</td>
167
- <td>Promptbook miniapps</td>
171
+ <td>Builder of LLM miniapps from book notation</td>
168
172
  </tr>
169
173
  </tbody>
170
174
  </table>
171
175
 
172
- ## 💙 Book language _(for prompt-engineer)_
173
176
 
174
- Promptbook [pipelines](https://github.com/webgptorg/promptbook/discussions/64) are written in markdown-like language called [Book](https://github.com/webgptorg/book). It is designed to be understandable by non-programmers and non-technical people.
175
177
 
178
+ ## 💙 Book language _(for prompt-engineer)_
176
179
 
177
180
 
178
- ```markdown
179
- # 🌟 My first Book
180
181
 
181
- - INPUT PARAMETER {subject}
182
- - OUTPUT PARAMETER {article}
183
182
 
184
- ## Sample subject
183
+ ## 💙 The blueprint of book language
185
184
 
186
- > Promptbook
185
+ Following is the documentation and blueprint of the Book language.
187
186
 
188
- -> {subject}
187
+ ### Example
189
188
 
190
- ## Write an article
189
+ ```markdown
190
+ # 🌟 My first Book
191
191
 
192
192
  - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
193
193
  - KNOWLEDGE https://ptbk.io
@@ -196,11 +196,65 @@ Promptbook [pipelines](https://github.com/webgptorg/promptbook/discussions/64) a
196
196
  - EXPECT MAX 1 Paragraph
197
197
 
198
198
  > Write an article about the future of artificial intelligence in the next 10 years and how metalanguages will change the way AI is used in the world.
199
- > Look specifically at the impact of {subject} on the AI industry.
199
+ > Look specifically at the impact of Promptbook on the AI industry.
200
200
 
201
201
  -> {article}
202
202
  ```
203
203
 
204
+ ### Goals and principles of book language
205
+
206
+ 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.
207
+
208
+ It has file with `.book.md` or `.book` extension with `UTF-8` non BOM encoding.
209
+
210
+ 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.
211
+
212
+ But unlike programming languages, it is designed to be understandable by non-programmers and non-technical people.
213
+
214
+ ### Structure
215
+
216
+ 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.
217
+
218
+ ### Header
219
+
220
+ 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.
221
+
222
+ ### Parameter
223
+
224
+ Foo bar
225
+
226
+ #### Parameter names
227
+
228
+ Reserved words:
229
+
230
+ - _each command_ like `PERSONA`, `EXPECT`, `KNOWLEDGE`, etc.
231
+ - `content`
232
+ - `context`
233
+ - `knowledge`
234
+ - `examples`
235
+ - `modelName`
236
+ - `currentDate`
237
+
238
+ #### Parameter notation
239
+
240
+ ### Template
241
+
242
+ Todo todo
243
+
244
+ ### Command
245
+
246
+ Todo todo
247
+
248
+ ### Block
249
+
250
+ Todo todo
251
+
252
+ ### Return parameter
253
+
254
+ ### Examples
255
+
256
+
257
+
204
258
  ## 📦 Packages _(for developers)_
205
259
 
206
260
  This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -239,15 +293,59 @@ Or you can install them separately:
239
293
 
240
294
 
241
295
 
242
- ## 📚 Dictionary
243
296
 
244
- The following glossary is used to clarify certain concepts:
245
297
 
246
- ### Basic terms
247
298
 
299
+ ## 📚 Dictionary
300
+
301
+ ### 📚 Dictionary
248
302
 
303
+ The following glossary is used to clarify certain concepts:
249
304
 
250
- ### Core concepts
305
+ #### General LLM / AI terms
306
+
307
+ - **Prompt drift** is a phenomenon where the AI model starts to generate outputs that are not aligned with the original prompt. This can happen due to the model's training data, the prompt's wording, or the model's architecture.
308
+ - **Pipeline, workflow or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.
309
+ - **Fine-tuning** is a process where a pre-trained AI model is further trained on a specific dataset to improve its performance on a specific task.
310
+ - **Zero-shot learning** is a machine learning paradigm where a model is trained to perform a task without any labeled examples. Instead, the model is provided with a description of the task and is expected to generate the correct output.
311
+ - **Few-shot learning** is a machine learning paradigm where a model is trained to perform a task with only a few labeled examples. This is in contrast to traditional machine learning, where models are trained on large datasets.
312
+ - **Meta-learning** is a machine learning paradigm where a model is trained on a variety of tasks and is able to learn new tasks with minimal additional training. This is achieved by learning a set of meta-parameters that can be quickly adapted to new tasks.
313
+ - **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.
314
+ - **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.
315
+
316
+ _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
317
+
318
+ #### Promptbook core
319
+
320
+ - **Organization** _(legacy name collection)_ group jobs, workforce, knowledge, instruments, and actions into one package. Entities in one organization can share resources (= import resources from each other).
321
+ - **Jobs**
322
+ - **Task**
323
+ - **Subtask**
324
+ - **Workforce**
325
+ - **Persona**
326
+ - **Team**
327
+ - **Role**
328
+ - **Knowledge**
329
+ - **Public**
330
+ - **Private**
331
+ - **Protected**
332
+ - **Instruments**
333
+ - **Actions**
334
+
335
+ #### Book language
336
+
337
+ - **Book file**
338
+ - **Section**
339
+ - **Heading**
340
+ - **Description**
341
+ - **Command**
342
+ - **Block**
343
+ - **Return statement**
344
+ - **Comment**
345
+ - **Import**
346
+ - **Scope**
347
+
348
+ #### 💯 Core concepts
251
349
 
252
350
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
253
351
  - [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
@@ -260,7 +358,7 @@ The following glossary is used to clarify certain concepts:
260
358
  - [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29)
261
359
  - [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32)
262
360
 
263
- ### Advanced concepts
361
+ ##### Advanced concepts
264
362
 
265
363
  - [📚 Knowledge (Retrieval-augmented generation)](https://github.com/webgptorg/promptbook/discussions/41)
266
364
  - [🌏 Remote server](https://github.com/webgptorg/promptbook/discussions/89)
@@ -275,6 +373,13 @@ The following glossary is used to clarify certain concepts:
275
373
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
276
374
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
277
375
 
376
+ ### Terms specific to Promptbook TypeScript implementation
377
+
378
+ - Anonymous mode
379
+ - Application mode
380
+
381
+
382
+
278
383
  ## 🔌 Usage in Typescript / Javascript
279
384
 
280
385
  - [Simple usage](./examples/usage/simple-script)
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { _CLI /* <- Note: [🥠] */ } = require('../umd/index.umd.js');
3
+ // Disable deprecation warnings programmatically
4
+ process.noDeprecation = true;
5
+ // <- TODO: !!!!!! Is this try to get rid of deprecation warnings in node v23.2.0 working?
6
+
7
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
8
+ const { _CLI } = require('../umd/index.umd.js');
4
9
 
5
10
  _CLI._initialize();
6
11