@promptbook/cli 0.69.0-1 → 0.69.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 (55) hide show
  1. package/README.md +17 -58
  2. package/esm/index.es.js +1913 -1163
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +5 -1
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  6. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  7. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +2 -6
  8. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +26 -0
  9. package/esm/typings/src/commands/FOREACH/foreachCommand.test.d.ts +3 -0
  10. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -1
  11. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -4
  12. package/esm/typings/src/config.d.ts +7 -1
  13. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -0
  14. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +2 -1
  15. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +5 -0
  16. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +5 -3
  17. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +21 -0
  18. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +20 -0
  19. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +33 -0
  20. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +10 -0
  21. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +55 -0
  22. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +62 -0
  23. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatCells.d.ts +21 -0
  24. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +74 -0
  25. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +34 -0
  26. package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +10 -0
  27. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +27 -0
  28. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +30 -0
  29. package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +10 -0
  30. package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
  31. package/esm/typings/src/execution/utils/usageToHuman.d.ts +3 -4
  32. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +9 -12
  33. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +30 -0
  34. package/esm/typings/src/formats/csv/{ListFormatDefinition.d.ts → CsvFormatDefinition.d.ts} +3 -2
  35. package/esm/typings/src/formats/index.d.ts +1 -1
  36. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -1
  37. package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +17 -0
  38. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -1
  39. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +1 -0
  40. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +5 -0
  41. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -0
  42. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -0
  43. package/esm/typings/src/utils/{extractParameterNames.d.ts → parameters/extractParameterNames.d.ts} +2 -2
  44. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +27 -0
  45. package/esm/typings/src/utils/{replaceParameters.d.ts → parameters/replaceParameters.d.ts} +2 -2
  46. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +10 -0
  47. package/package.json +2 -1
  48. package/umd/index.umd.js +1916 -1167
  49. package/umd/index.umd.js.map +1 -1
  50. package/esm/typings/src/execution/createPipelineExecutor.d.ts +0 -72
  51. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +0 -16
  52. /package/esm/typings/src/utils/{extractParameterNames.test.d.ts → parameters/extractParameterNames.test.d.ts} +0 -0
  53. /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → utils/parameters/mapAvailableToExpectedParameters.test.d.ts} +0 -0
  54. /package/esm/typings/src/utils/{replaceParameters.test.d.ts → parameters/replaceParameters.test.d.ts} +0 -0
  55. /package/esm/typings/src/{execution/utils/usageToHuman.test.d.ts → utils/validators/parameterName/validateParameterName.test.d.ts} +0 -0
package/README.md CHANGED
@@ -105,13 +105,15 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
105
105
 
106
106
  ## 🤍 The Promptbook Whitepaper
107
107
 
108
+
109
+
108
110
  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.
109
111
 
110
112
  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:
111
113
 
112
114
  1. **Fine-tune** the model to your specifications or even train your own.
113
115
  2. **Prompt-engineer** the prompt to the best shape you can achieve.
114
- 3. Use **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
116
+ 3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
115
117
 
116
118
  In all of these situations, but especially in 3., the Promptbook library can make your life easier.
117
119
 
@@ -123,7 +125,9 @@ In all of these situations, but especially in 3., the Promptbook library can mak
123
125
  - Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
124
126
  - 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.
125
127
 
126
- ## 🧔 Promptbook _(for prompt-engeneers)_
128
+
129
+
130
+ ## 🧔 Pipeline _(for prompt-engeneers)_
127
131
 
128
132
  **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.
129
133
 
@@ -145,7 +149,6 @@ File `write-website-content.ptbk.md`:
145
149
  > Instructions for creating web page content.
146
150
  >
147
151
  > - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
148
- > - PROMPTBOOK VERSION 0.0.1
149
152
  > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
150
153
  > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
151
154
  > - OUTPUT PARAM `{websiteContent}` Web content
@@ -440,6 +443,8 @@ The following glossary is used to clarify certain concepts:
440
443
  - When you want to **version** your prompts and **test multiple versions**
441
444
  - When you want to **log** the execution of prompts and backtrace the issues
442
445
 
446
+ [See more](https://github.com/webgptorg/promptbook/discussions/111)
447
+
443
448
  ### ➖ When not to use
444
449
 
445
450
  - When you have already implemented single simple prompt and it works fine for your job
@@ -449,6 +454,8 @@ The following glossary is used to clarify certain concepts:
449
454
  - When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_
450
455
  - When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_
451
456
 
457
+ [See more](https://github.com/webgptorg/promptbook/discussions/112)
458
+
452
459
  ## 🐜 Known issues
453
460
 
454
461
  - [🤸‍♂️ Iterations not working yet](https://github.com/webgptorg/promptbook/discussions/55)
@@ -461,63 +468,15 @@ The following glossary is used to clarify certain concepts:
461
468
 
462
469
  ## ❔ FAQ
463
470
 
464
-
465
-
466
471
  If you have a question [start a discussion](https://github.com/webgptorg/promptbook/discussions/), [open an issue](https://github.com/webgptorg/promptbook/issues) or [write me an email](https://www.pavolhejny.com/contact).
467
472
 
468
- ### Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?
469
-
470
- Different levels of abstraction. OpenAI library is for direct use of OpenAI API. This library is for a higher level of abstraction. It define pipelines that are independent of the underlying library, LLM model, or even LLM provider.
471
-
472
- ### How is it different from the Langchain library?
473
-
474
- Langchain is primarily aimed at ML developers working in Python. This library is for developers working in javascript/typescript and creating applications for end users.
475
-
476
- We are considering creating a bridge/converter between these two libraries.
477
-
478
-
479
-
480
- ### Promptbooks vs. OpenAI`s GPTs
481
-
482
- GPTs are chat assistants that can be assigned to specific tasks and materials. But they are still chat assistants. Promptbooks are a way to orchestrate many more predefined tasks to have much tighter control over the process. Promptbooks are not a good technology for creating human-like chatbots, GPTs are not a good technology for creating outputs with specific requirements.
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
- ### Where should I store my promptbooks?
499
-
500
- If you use raw SDKs, you just put prompts in the sourcecode, mixed in with typescript, javascript, python or whatever programming language you use.
501
-
502
- If you use promptbooks, you can store them in several places, each with its own advantages and disadvantages:
503
-
504
- 1. As **source code**, typically git-committed. In this case you can use the versioning system and the promptbooks will be tightly coupled with the version of the application. You still get the power of promptbooks, as you separate the concerns of the prompt-engineer and the programmer.
505
-
506
- 2. As data in a **database** In this case, promptbooks are like posts / articles on the blog. They can be modified independently of the application. You don't need to redeploy the application to change the promptbooks. You can have multiple versions of promptbooks for each user. You can have a web interface for non-programmers to create and modify promptbooks. But you lose the versioning system and you still have to consider the interface between the promptbooks and the application _(= input and output parameters)_.
507
-
508
- 3. In a **configuration** in environment variables. This is a good way to store promptbooks if you have an application with multiple deployments and you want to have different but simple promptbooks for each deployment and you don't need to change them often.
509
-
510
- ### What should I do when I need same promptbook in multiple human languages?
511
-
512
- A single promptbook can be written for several _(human)_ languages at once. However, we recommend that you have separate promptbooks for each language.
513
-
514
- In large language models, you will get better results if you have prompts in the same language as the user input.
515
-
516
- The best way to manage this is to have suffixed promptbooks like `write-website-content.en.ptbk.md` and `write-website-content.cs.ptbk.md` for each supported language.
517
-
518
-
519
-
520
-
473
+ - [❔ Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?](https://github.com/webgptorg/promptbook/discussions/114)
474
+ - [❔ How is it different from the OpenAI`s GPTs?](https://github.com/webgptorg/promptbook/discussions/118)
475
+ - [❔ How is it different from the Langchain?](https://github.com/webgptorg/promptbook/discussions/115)
476
+ - [❔ How is it different from the DSPy?](https://github.com/webgptorg/promptbook/discussions/117)
477
+ - [❔ How is it different from _anything_?](https://github.com/webgptorg/promptbook/discussions?discussions_q=is%3Aopen+label%3A%22Promptbook+vs%22)
478
+ - [❔ Is Promptbook using RAG _(Retrieval-Augmented Generation)_?](https://github.com/webgptorg/promptbook/discussions/123)
479
+ - [❔ Is Promptbook using function calling?](https://github.com/webgptorg/promptbook/discussions/124)
521
480
 
522
481
  ## ⌚ Changelog
523
482