@promptbook/documents 0.74.0-0 → 0.74.0-11

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 (40) hide show
  1. package/README.md +143 -29
  2. package/esm/index.es.js +218 -288
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/azure-openai.index.d.ts +2 -2
  6. package/esm/typings/src/_packages/browser.index.d.ts +2 -2
  7. package/esm/typings/src/_packages/cli.index.d.ts +2 -2
  8. package/esm/typings/src/_packages/core.index.d.ts +7 -3
  9. package/esm/typings/src/_packages/documents.index.d.ts +2 -2
  10. package/esm/typings/src/_packages/execute-javascript.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/fake-llm.index.d.ts +2 -2
  12. package/esm/typings/src/_packages/langtail.index.d.ts +2 -2
  13. package/esm/typings/src/_packages/legacy-documents.index.d.ts +2 -2
  14. package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
  15. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  16. package/esm/typings/src/_packages/openai.index.d.ts +2 -2
  17. package/esm/typings/src/_packages/pdf.index.d.ts +2 -2
  18. package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
  19. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -2
  20. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  21. package/esm/typings/src/_packages/website-crawler.index.d.ts +2 -2
  22. package/esm/typings/src/cli/cli-commands/make.d.ts +0 -1
  23. package/esm/typings/src/cli/cli-commands/run.d.ts +14 -0
  24. package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
  25. package/esm/typings/src/cli/test/ptbk.d.ts +5 -2
  26. package/esm/typings/src/commands/{PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts → BOOK_VERSION/BookVersionCommand.d.ts} +4 -4
  27. package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
  28. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  29. package/esm/typings/src/commands/index.d.ts +1 -1
  30. package/esm/typings/src/config.d.ts +6 -0
  31. package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
  32. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
  33. package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
  34. package/esm/typings/src/version.d.ts +13 -2
  35. package/package.json +2 -2
  36. package/umd/index.umd.js +219 -288
  37. package/umd/index.umd.js.map +1 -1
  38. package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
  39. /package/esm/typings/src/commands/{PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts → BOOK_VERSION/bookVersionCommand.test.d.ts} +0 -0
  40. /package/esm/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/README.md CHANGED
@@ -55,8 +55,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
55
55
 
56
56
  ## 🤍 The Promptbook Whitepaper
57
57
 
58
-
59
-
60
58
  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.
61
59
 
62
60
  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:
@@ -77,63 +75,65 @@ In all of these situations, but especially in 3., the **✨ Promptbook can make
77
75
 
78
76
 
79
77
 
80
- ## 💜 The Promptbook Project
81
78
 
82
79
 
83
80
 
81
+ ## 💜 The Promptbook Project
82
+
83
+ Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project:
84
+
84
85
  <table>
85
- <tbody>
86
+ <thead>
86
87
  <tr>
87
- <td>Promptbook whitepaper</td>
88
- <td>Basic motivations and problems which we are trying to solve</td>
89
- <td rowspan=3>https://github.com/webgptorg/book</td>
88
+ <th>Project</th>
89
+ <th>Description</th>
90
+ <th>Link</th>
90
91
  </tr>
92
+ </thead>
93
+ <tbody>
91
94
  <tr>
92
- <td>Promptbook <i>(system)</i></td>
93
- <td>Promptbook ...</td>
95
+ <td>Core</td>
96
+ <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>
97
+ <td rowspan=2>https://ptbk.io<br/>https://github.com/webgptorg/book</td>
94
98
  </tr>
95
99
  <tr>
96
100
  <td>Book language</td>
97
101
  <td>
98
- 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
102
+ 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
99
103
  </td>
100
104
  </tr>
101
105
  <tr>
102
106
  <td>Promptbook typescript project</td>
103
107
  <td>Implementation of Promptbook in TypeScript published into multiple packages to NPM</td>
104
- <td>https://github.com/webgptorg/promptbook</td>
108
+ <td>https://github.com/webgptorg/promptbook + Multiple packages on NPM</td>
105
109
  </tr>
106
110
  <tr>
107
111
  <td>Promptbook studio</td>
108
- <td>Promptbook studio</td>
109
- <td rowspan=2>https://github.com/hejny/promptbook-studio</td>
112
+ <td>No-code studio to write book without need to write even the markdown</td>
113
+ <td rowspan=2>https://promptbook.studio<br/>https://github.com/hejny/promptbook-studio</td>
110
114
  </tr>
111
115
  <tr>
112
116
  <td>Promptbook miniapps</td>
113
- <td>Promptbook miniapps</td>
117
+ <td>Builder of LLM miniapps from book notation</td>
114
118
  </tr>
115
119
  </tbody>
116
120
  </table>
117
121
 
118
- ## 💙 Book language _(for prompt-engineer)_
119
122
 
120
- 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.
121
123
 
124
+ ## 💙 Book language _(for prompt-engineer)_
122
125
 
123
126
 
124
- ```markdown
125
- # 🌟 My first Book
126
127
 
127
- - INPUT PARAMETER {subject}
128
- - OUTPUT PARAMETER {article}
129
128
 
130
- ## Sample subject
129
+ ## 💙 The blueprint of book language
131
130
 
132
- > Promptbook
131
+ Following is the documentation and blueprint of the Book language.
133
132
 
134
- -> {subject}
133
+ ### Example
135
134
 
136
- ## Write an article
135
+ ```markdown
136
+ # 🌟 My first Book
137
137
 
138
138
  - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
139
139
  - KNOWLEDGE https://ptbk.io
@@ -142,11 +142,65 @@ Promptbook [pipelines](https://github.com/webgptorg/promptbook/discussions/64) a
142
142
  - EXPECT MAX 1 Paragraph
143
143
 
144
144
  > 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.
145
- > Look specifically at the impact of {subject} on the AI industry.
145
+ > Look specifically at the impact of Promptbook on the AI industry.
146
146
 
147
147
  -> {article}
148
148
  ```
149
149
 
150
+ ### Goals and principles of book language
151
+
152
+ 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.
153
+
154
+ It has file with `.ptbk.md` or `.book` extension with `UTF-8` non BOM encoding.
155
+
156
+ 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.
157
+
158
+ But unlike programming languages, it is designed to be understandable by non-programmers and non-technical people.
159
+
160
+ ### Structure
161
+
162
+ 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.
163
+
164
+ ### Header
165
+
166
+ 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.
167
+
168
+ ### Parameter
169
+
170
+ Foo bar
171
+
172
+ #### Parameter names
173
+
174
+ Reserved words:
175
+
176
+ - _each command_ like `PERSONA`, `EXPECT`, `KNOWLEDGE`, etc.
177
+ - `content`
178
+ - `context`
179
+ - `knowledge`
180
+ - `examples`
181
+ - `modelName`
182
+ - `currentDate`
183
+
184
+ #### Parameter notation
185
+
186
+ ### Template
187
+
188
+ Todo todo
189
+
190
+ ### Command
191
+
192
+ Todo todo
193
+
194
+ ### Block
195
+
196
+ Todo todo
197
+
198
+ ### Return parameter
199
+
200
+ ### Examples
201
+
202
+
203
+
150
204
  ## 📦 Packages _(for developers)_
151
205
 
152
206
  This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -185,15 +239,66 @@ Or you can install them separately:
185
239
 
186
240
 
187
241
 
242
+
243
+
244
+
188
245
  ## 📚 Dictionary
189
246
 
190
- The following glossary is used to clarify certain concepts:
191
247
 
192
- ### Basic terms
193
248
 
194
249
 
195
250
 
196
- ### Core concepts
251
+
252
+ ### 📚 Dictionary
253
+
254
+ The following glossary is used to clarify certain concepts:
255
+
256
+ #### General LLM / AI terms
257
+
258
+ - **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.
259
+ - **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.
260
+ - **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.
261
+ - **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.
262
+ - **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.
263
+ - **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.
264
+ - **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.
265
+ - **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.
266
+
267
+
268
+
269
+ _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
270
+
271
+ #### Promptbook core
272
+
273
+ - **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).
274
+ - **Jobs**
275
+ - **Task**
276
+ - **Subtask**
277
+ - **Workforce**
278
+ - **Persona**
279
+ - **Team**
280
+ - **Role**
281
+ - **Knowledge**
282
+ - **Public**
283
+ - **Private**
284
+ - **Protected**
285
+ - **Instruments**
286
+ - **Actions**
287
+
288
+ #### Book language
289
+
290
+ - **Book file**
291
+ - **Section**
292
+ - **Heading**
293
+ - **Description**
294
+ - **Command**
295
+ - **Block**
296
+ - **Return statement**
297
+ - **Comment**
298
+ - **Import**
299
+ - **Scope**
300
+
301
+ #### 💯 Core concepts
197
302
 
198
303
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
199
304
  - [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
@@ -206,7 +311,7 @@ The following glossary is used to clarify certain concepts:
206
311
  - [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29)
207
312
  - [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32)
208
313
 
209
- ### Advanced concepts
314
+ ##### Advanced concepts
210
315
 
211
316
  - [📚 Knowledge (Retrieval-augmented generation)](https://github.com/webgptorg/promptbook/discussions/41)
212
317
  - [🌏 Remote server](https://github.com/webgptorg/promptbook/discussions/89)
@@ -221,6 +326,15 @@ The following glossary is used to clarify certain concepts:
221
326
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
222
327
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
223
328
 
329
+
330
+
331
+ ### Terms specific to Promptbook TypeScript implementation
332
+
333
+ - Anonymous mode
334
+ - Application mode
335
+
336
+
337
+
224
338
  ## 🔌 Usage in Typescript / Javascript
225
339
 
226
340
  - [Simple usage](./examples/usage/simple-script)