@promptbook/utils 0.72.0-9 → 0.73.0

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 (146) hide show
  1. package/README.md +36 -252
  2. package/esm/index.es.js +10 -8
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +24 -18
  5. package/esm/typings/src/_packages/node.index.d.ts +2 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +18 -12
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  8. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  9. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +2 -2
  10. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  11. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  12. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  13. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +1 -1
  14. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -5
  15. package/esm/typings/src/config.d.ts +22 -15
  16. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
  17. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  18. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
  19. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -2
  20. package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +12 -0
  21. package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +11 -0
  22. package/esm/typings/src/executables/apps/locatePandoc.d.ts +11 -0
  23. package/esm/typings/src/executables/locateApp.d.ts +33 -0
  24. package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
  25. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +12 -0
  26. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +12 -0
  27. package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +12 -0
  28. package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
  29. package/esm/typings/src/execution/Executables.d.ts +18 -0
  30. package/esm/typings/src/execution/ExecutionTools.d.ts +9 -3
  31. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  32. package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -2
  33. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
  34. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -2
  35. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +29 -6
  36. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -11
  37. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +4 -13
  38. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +9 -14
  39. package/esm/typings/src/execution/createPipelineExecutor/{getSamplesForTemplate.d.ts → getExamplesForTemplate.d.ts} +1 -1
  40. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
  41. package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
  42. package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
  43. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +4 -4
  44. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +3 -3
  45. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +2 -2
  46. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
  47. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +7 -0
  48. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +4 -1
  49. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
  51. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  53. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
  54. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +1 -1
  55. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  56. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  57. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  58. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +4 -5
  59. package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
  60. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +0 -1
  61. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -2
  62. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
  63. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  64. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +4 -4
  65. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +15 -6
  66. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +4 -4
  67. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +6 -12
  68. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +3 -3
  69. package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +9 -14
  70. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -8
  71. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  72. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  73. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -23
  74. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
  75. package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -2
  76. package/esm/typings/src/scrapers/_common/Scraper.d.ts +2 -9
  77. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
  78. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +2 -2
  79. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
  80. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -2
  81. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +2 -2
  82. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  83. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +2 -2
  84. package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +1 -1
  85. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  86. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
  87. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +3 -3
  88. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +1 -1
  89. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
  90. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
  91. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  92. package/esm/typings/src/scrapers/markdown/MarkdownScraper.test.d.ts +1 -1
  93. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -1
  94. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
  95. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +2 -2
  96. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  97. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  98. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +6 -3
  99. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
  100. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  101. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
  102. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.test.d.ts +1 -0
  103. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
  104. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
  105. package/esm/typings/src/types/Arrayable.d.ts +1 -1
  106. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +7 -0
  107. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +4 -4
  108. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
  109. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +2 -2
  110. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
  111. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  112. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
  113. package/esm/typings/src/types/Prompt.d.ts +2 -1
  114. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
  115. package/esm/typings/src/types/typeAliases.d.ts +11 -8
  116. package/esm/typings/src/utils/$Register.d.ts +1 -1
  117. package/esm/typings/src/utils/FromtoItems.d.ts +1 -1
  118. package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
  119. package/esm/typings/src/utils/emojis.d.ts +1 -1
  120. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +4 -2
  121. package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +12 -0
  122. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -0
  123. package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +45 -0
  124. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  125. package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
  126. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
  127. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
  128. package/esm/typings/src/utils/normalization/IKeywords.d.ts +2 -2
  129. package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -2
  130. package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +2 -2
  131. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +2 -2
  132. package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
  133. package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
  134. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  135. package/esm/typings/src/utils/sets/intersection.d.ts +1 -1
  136. package/esm/typings/src/utils/sets/union.d.ts +1 -1
  137. package/esm/typings/src/utils/unwrapResult.d.ts +4 -4
  138. package/package.json +5 -3
  139. package/umd/index.umd.js +10 -8
  140. package/umd/index.umd.js.map +1 -1
  141. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
  142. package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +0 -12
  143. package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +0 -23
  144. package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +0 -10
  145. /package/esm/typings/src/{scrapers/website/WebsiteScraper.test.d.ts → executables/apps/locateLibreoffice.test.d.ts} +0 -0
  146. /package/esm/typings/src/{scrapers/website/utils/markdownConverter.test.d.ts → executables/apps/locatePandoc.test.d.ts} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
4
4
 
5
- Supercharge your use of large language models
5
+ Build responsible, controlled and transparent applications on top of LLM models!
6
6
 
7
7
 
8
8
 
@@ -18,12 +18,10 @@ Supercharge your use of large language models
18
18
 
19
19
  ## ✨ New Features
20
20
 
21
+ - 💙 Working on [the **Book** language v1](https://github.com/webgptorg/book)
22
+ - 📚 Support of `.docx`, `.doc` and `.pdf` documents
21
23
  - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
22
24
 
23
- <blockquote style="color: #ff8811">
24
- <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
25
- </blockquote>
26
-
27
25
 
28
26
 
29
27
  ## 📦 Package `@promptbook/utils`
@@ -171,260 +169,48 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
171
169
 
172
170
  ## 🤍 The Promptbook Whitepaper
173
171
 
172
+ 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.
174
173
 
175
-
176
- If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, 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.
177
-
178
- But often you will struggle with the limitations of LLMs, such as hallucinations, off-topic responses, poor quality output, language drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd responses. When this happens, you generally have three options:
174
+ 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:
179
175
 
180
176
  1. **Fine-tune** the model to your specifications or even train your own.
181
177
  2. **Prompt-engineer** the prompt to the best shape you can achieve.
182
178
  3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
183
179
 
184
- In all of these situations, but especially in 3., the Promptbook library can make your life easier.
180
+ In all of these situations, but especially in 3., the **✨ Promptbook can make your life waaaaaaaaaay easier**.
185
181
 
186
- - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic.
187
- - Establishes a [**common format `.ptbk.md`**](https://github.com/webgptorg/promptbook/discussions/85) that can be used to describe your prompt business logic without having to write code or deal with the technicalities of LLMs.
188
- - **Forget** about **low-level details** like choosing the right model, tokens, context size, temperature, top-k, top-p, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
189
- - Has built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
182
+ - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic. For this purpose, it introduces a new language called [the **💙 Book**](https://github.com/webgptorg/book).
183
+ - Book allows you to **focus on the business** logic without having to write code or deal with the technicalities of LLMs.
184
+ - **Forget** about **low-level details** like choosing the right model, tokens, context size, `temperature`, `top-k`, `top-p`, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
185
+ - We have built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
190
186
  - Sometimes even the best prompts with the best framework like Promptbook `:)` can't avoid the problems. In this case, the library has built-in **[anomaly detection](https://github.com/webgptorg/promptbook/discussions/40) and logging** to help you find and fix the problems.
191
- - Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
192
- - Promptbook is designed to do [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques. You can use **knowledge** to improve the quality of the output.
193
-
194
-
195
-
196
- ## 🧔 Pipeline _(for prompt-engeneers)_
197
-
198
- **P**romp**t** **b**oo**k** markdown file (or `.ptbk.md` file) is document that describes a **pipeline** - a series of prompts that are chained together to form somewhat reciepe for transforming natural language input.
199
-
200
- - Multiple pipelines forms a **collection** which will handle core **know-how of your LLM application**.
201
- - Theese pipelines are designed such as they **can be written by non-programmers**.
202
-
203
-
204
-
205
- ### Sample:
206
-
207
- File `write-website-content.ptbk.md`:
208
-
209
-
210
-
211
-
212
-
213
- > # 🌍 Create website content
214
- >
215
- > Instructions for creating web page content.
216
- >
217
- > - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
218
- > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
219
- > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
220
- > - OUTPUT PARAM `{websiteContent}` Web content
221
- > - OUTPUT PARAM `{keywords}` Keywords
222
- >
223
- > ## 👤 Specifying the assigment
224
- >
225
- > What is your web about?
226
- >
227
- > - DIALOG TEMPLATE
228
- >
229
- > ```
230
- > {rawAssigment}
231
- > ```
232
- >
233
- > `-> {assigment}` Website assignment and specification
234
- >
235
- > ## ✨ Improving the title
236
- >
237
- > - PERSONA Jane, Copywriter and Marketing Specialist.
238
- >
239
- > ```
240
- > As an experienced marketing specialist, you have been entrusted with improving the name of your client's business.
241
- >
242
- > A suggested name from a client:
243
- > "{rawTitle}"
244
- >
245
- > Assignment from customer:
246
- >
247
- > > {assigment}
248
- >
249
- > ## Instructions:
250
- >
251
- > - Write only one name suggestion
252
- > - The name will be used on the website, business cards, visuals, etc.
253
- > ```
254
- >
255
- > `-> {enhancedTitle}` Enhanced title
256
- >
257
- > ## 👤 Website title approval
258
- >
259
- > Is the title for your website okay?
260
- >
261
- > - DIALOG TEMPLATE
262
- >
263
- > ```
264
- > {enhancedTitle}
265
- > ```
266
- >
267
- > `-> {title}` Title for the website
268
- >
269
- > ## 🐰 Cunning subtitle
270
- >
271
- > - PERSONA Josh, a copywriter, tasked with creating a claim for the website.
272
- >
273
- > ```
274
- > As an experienced copywriter, you have been entrusted with creating a claim for the "{title}" web page.
275
- >
276
- > A website assignment from a customer:
277
- >
278
- > > {assigment}
279
- >
280
- > ## Instructions:
281
- >
282
- > - Write only one name suggestion
283
- > - Claim will be used on website, business cards, visuals, etc.
284
- > - Claim should be punchy, funny, original
285
- > ```
286
- >
287
- > `-> {claim}` Claim for the web
288
- >
289
- > ## 🚦 Keyword analysis
290
- >
291
- > - PERSONA Paul, extremely creative SEO specialist.
292
- >
293
- > ```
294
- > As an experienced SEO specialist, you have been entrusted with creating keywords for the website "{title}".
295
- >
296
- > Website assignment from the customer:
297
- >
298
- > > {assigment}
299
- >
300
- > ## Instructions:
301
- >
302
- > - Write a list of keywords
303
- > - Keywords are in basic form
304
- >
305
- > ## Example:
306
- >
307
- > - Ice cream
308
- > - Olomouc
309
- > - Quality
310
- > - Family
311
- > - Tradition
312
- > - Italy
313
- > - Craft
314
- >
315
- > ```
316
- >
317
- > `-> {keywords}` Keywords
318
- >
319
- > ## 🔗 Combine the beginning
320
- >
321
- > - SIMPLE TEMPLATE
322
- >
323
- > ```
324
- >
325
- > # {title}
326
- >
327
- > > {claim}
328
- >
329
- > ```
330
- >
331
- > `-> {contentBeginning}` Beginning of web content
332
- >
333
- > ## 🖋 Write the content
334
- >
335
- > - PERSONA Jane
336
- >
337
- > ```
338
- > As an experienced copywriter and web designer, you have been entrusted with creating text for a new website {title}.
339
- >
340
- > A website assignment from a customer:
341
- >
342
- > > {assigment}
343
- >
344
- > ## Instructions:
345
- >
346
- > - Text formatting is in Markdown
347
- > - Be concise and to the point
348
- > - Use keywords, but they should be naturally in the text
349
- > - This is the complete content of the page, so don't forget all the important information and elements the page should contain
350
- > - Use headings, bullets, text formatting
351
- >
352
- > ## Keywords:
353
- >
354
- > {keywords}
355
- >
356
- > ## Web Content:
357
- >
358
- > {contentBeginning}
359
- > ```
360
- >
361
- > `-> {contentBody}` Middle of the web content
362
- >
363
- > ## 🔗 Combine the content
364
- >
365
- > - SIMPLE TEMPLATE
366
- >
367
- > ```markdown
368
- > {contentBeginning}
369
- >
370
- > {contentBody}
371
- > ```
372
- >
373
- > `-> {websiteContent}`
374
-
375
-
376
-
377
- Following is the scheme how the promptbook above is executed:
378
-
379
- ```mermaid
380
- %% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
381
-
382
- flowchart LR
383
- subgraph "🌍 Create website content"
384
-
385
- direction TB
386
-
387
- input((Input)):::input
388
- templateSpecifyingTheAssigment(👤 Specifying the assigment)
389
- input--"{rawAssigment}"-->templateSpecifyingTheAssigment
390
- templateImprovingTheTitle(✨ Improving the title)
391
- input--"{rawTitle}"-->templateImprovingTheTitle
392
- templateSpecifyingTheAssigment--"{assigment}"-->templateImprovingTheTitle
393
- templateWebsiteTitleApproval(👤 Website title approval)
394
- templateImprovingTheTitle--"{enhancedTitle}"-->templateWebsiteTitleApproval
395
- templateCunningSubtitle(🐰 Cunning subtitle)
396
- templateWebsiteTitleApproval--"{title}"-->templateCunningSubtitle
397
- templateSpecifyingTheAssigment--"{assigment}"-->templateCunningSubtitle
398
- templateKeywordAnalysis(🚦 Keyword analysis)
399
- templateWebsiteTitleApproval--"{title}"-->templateKeywordAnalysis
400
- templateSpecifyingTheAssigment--"{assigment}"-->templateKeywordAnalysis
401
- templateCombineTheBeginning(🔗 Combine the beginning)
402
- templateWebsiteTitleApproval--"{title}"-->templateCombineTheBeginning
403
- templateCunningSubtitle--"{claim}"-->templateCombineTheBeginning
404
- templateWriteTheContent(🖋 Write the content)
405
- templateWebsiteTitleApproval--"{title}"-->templateWriteTheContent
406
- templateSpecifyingTheAssigment--"{assigment}"-->templateWriteTheContent
407
- templateKeywordAnalysis--"{keywords}"-->templateWriteTheContent
408
- templateCombineTheBeginning--"{contentBeginning}"-->templateWriteTheContent
409
- templateCombineTheContent(🔗 Combine the content)
410
- templateCombineTheBeginning--"{contentBeginning}"-->templateCombineTheContent
411
- templateWriteTheContent--"{contentBody}"-->templateCombineTheContent
412
-
413
- templateCombineTheContent--"{websiteContent}"-->output
414
- output((Output)):::output
415
-
416
- classDef input color: grey;
417
- classDef output color: grey;
418
-
419
- end;
420
- ```
187
+ - Versioning is build in. You can test multiple **A/B versions** of pipelines and see which one works best.
188
+ - Promptbook is designed to use [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques to bring the context of your business to generic LLM. You can use **knowledge** to improve the quality of the output.
189
+
190
+
191
+
192
+ ## 💙 Book language _(for prompt-engineer)_
193
+
194
+ 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.
421
195
 
422
- - [More template samples](./samples/pipelines/)
423
- - [Read more about `.ptbk.md` file format here](https://github.com/webgptorg/promptbook/discussions/categories/concepts?discussions_q=is%3Aopen+label%3A.ptbk.md+category%3AConcepts)
424
196
 
425
- _Note: We are using [postprocessing functions](#postprocessing-functions) like `unwrapResult` that can be used to postprocess the result._
426
197
 
427
- ## 📦 Packages
198
+ ```markdown
199
+ # 🌟 My first Book
200
+
201
+ - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
202
+ - KNOWLEDGE https://ptbk.io
203
+ - KNOWLEDGE ./promptbook.pdf
204
+ - EXPECT MIN 1 Sentence
205
+ - EXPECT MAX 1 Paragraph
206
+
207
+ > 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.
208
+ > Look specifically at the impact of Promptbook on the AI industry.
209
+
210
+ -> {article}
211
+ ```
212
+
213
+ ## 📦 Packages _(for developers)_
428
214
 
429
215
  This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
430
216
  You can install all of them at once:
@@ -466,8 +252,6 @@ Or you can install them separately:
466
252
 
467
253
  The following glossary is used to clarify certain concepts:
468
254
 
469
-
470
-
471
255
  ### Core concepts
472
256
 
473
257
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
@@ -498,8 +282,8 @@ The following glossary is used to clarify certain concepts:
498
282
 
499
283
  ## 🔌 Usage in Typescript / Javascript
500
284
 
501
- - [Simple usage](./samples/usage/simple-script)
502
- - [Usage with client and remote server](./samples/usage/remote)
285
+ - [Simple usage](./examples/usage/simple-script)
286
+ - [Usage with client and remote server](./examples/usage/remote)
503
287
 
504
288
  ## ➕➖ When to use Promptbook?
505
289
 
package/esm/index.es.js CHANGED
@@ -5,7 +5,7 @@ import { basename } from 'path';
5
5
  /**
6
6
  * The version of the Promptbook library
7
7
  */
8
- var PROMPTBOOK_VERSION = '0.72.0-8';
8
+ var PROMPTBOOK_VERSION = '0.72.0';
9
9
  // TODO: [main] !!!! List here all the versions and annotate + put into script
10
10
 
11
11
  /*! *****************************************************************************
@@ -678,9 +678,9 @@ function renderPromptbookMermaid(pipelineJson, options) {
678
678
  return promptbookMermaid;
679
679
  }
680
680
  /**
681
- * TODO: !!!!! FOREACH in mermaid graph
682
- * TODO: !!!!! Knowledge in mermaid graph
683
- * TODO: !!!!! Personas in mermaid graph
681
+ * TODO: [🧠] !! FOREACH in mermaid graph
682
+ * TODO: [🧠] !! Knowledge in mermaid graph
683
+ * TODO: [🧠] !! Personas in mermaid graph
684
684
  * TODO: Maybe use some Mermaid package instead of string templating
685
685
  * TODO: [🕌] When more than 2 functionalities, split into separate functions
686
686
  */
@@ -891,7 +891,9 @@ function renameParameter(options) {
891
891
  if (pipeline.parameters.some(function (parameter) { return parameter.name === newParameterName; })) {
892
892
  throw new PipelineLogicError("Can not replace {".concat(oldParameterName, "} to {").concat(newParameterName, "} because {").concat(newParameterName, "} is already used in the pipeline"));
893
893
  }
894
- var renamedPipeline = __assign(__assign({}, pipeline), { parameters: __spreadArray([], __read(pipeline.parameters), false), templates: __spreadArray([], __read(pipeline.templates), false) });
894
+ var renamedPipeline = __assign(__assign({}, pipeline), {
895
+ // <- TODO: [🪓] This should be without `as $PipelineJson`
896
+ parameters: __spreadArray([], __read(pipeline.parameters), false), templates: __spreadArray([], __read(pipeline.templates), false) });
895
897
  try {
896
898
  for (var _c = __values(renamedPipeline.parameters), _d = _c.next(); !_d.done; _d = _c.next()) {
897
899
  var parameter = _d.value;
@@ -1793,10 +1795,10 @@ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
1793
1795
  'content',
1794
1796
  'context',
1795
1797
  'knowledge',
1796
- 'samples',
1798
+ 'examples',
1797
1799
  'modelName',
1798
1800
  'currentDate',
1799
- // <- TODO: !!!!! list here all command names
1801
+ // <- TODO: list here all command names
1800
1802
  // <- TODO: Add more like 'date', 'modelName',...
1801
1803
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
1802
1804
  ]);
@@ -1979,7 +1981,7 @@ function parseNumber(value) {
1979
1981
  * Generates random seed
1980
1982
  *
1981
1983
  * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
1982
- * Warning: This function is not cryptographically secure (it uses Math.random internally)
1984
+ * Warning: This function is NOT cryptographically secure (it uses Math.random internally)
1983
1985
  * @public exported from `@promptbook/utils`
1984
1986
  */
1985
1987
  function $randomSeed() {