@promptbook/types 0.75.0-2 → 0.75.1

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 (49) hide show
  1. package/README.md +46 -30
  2. package/esm/typings/src/_packages/core.index.d.ts +16 -4
  3. package/esm/typings/src/_packages/types.index.d.ts +8 -6
  4. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  5. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
  6. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
  7. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +0 -2
  8. package/esm/typings/src/config.d.ts +34 -2
  9. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  10. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
  11. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +3 -3
  12. package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
  13. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  14. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  15. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  16. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +3 -0
  17. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +32 -2
  18. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  19. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  20. package/esm/typings/src/formfactors/index.d.ts +72 -10
  21. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +2 -2
  22. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +12 -2
  23. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +12 -2
  24. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +5 -4
  25. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +2 -2
  26. package/esm/typings/src/pipeline/PipelineJson/{TaskJsonCommon.d.ts → CommonTaskJson.d.ts} +13 -13
  27. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +2 -2
  28. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -0
  29. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +1 -1
  30. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  31. package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +2 -2
  32. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +2 -2
  33. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +2 -2
  34. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +1 -1
  35. package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
  36. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  37. package/esm/typings/src/prepare/prepareTasks.d.ts +5 -5
  38. package/esm/typings/src/types/Prompt.d.ts +3 -3
  39. package/esm/typings/src/types/SectionType.d.ts +21 -0
  40. package/esm/typings/src/types/TaskProgress.d.ts +1 -1
  41. package/esm/typings/src/types/TaskType.d.ts +15 -0
  42. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  43. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  44. package/esm/typings/src/utils/organization/spaceTrim.d.ts +11 -0
  45. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +1 -1
  46. package/esm/typings/src/version.d.ts +1 -1
  47. package/package.json +2 -2
  48. package/esm/typings/src/commands/SECTION/SectionType.d.ts +0 -13
  49. /package/esm/typings/{promptbook-collection → books}/index.d.ts +0 -0
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
4
4
 
5
- Build responsible, controlled and transparent applications on top of LLM models!
6
-
7
5
 
8
6
 
9
7
 
@@ -25,10 +23,6 @@ Build responsible, controlled and transparent applications on top of LLM models!
25
23
 
26
24
 
27
25
 
28
- <blockquote style="color: #ff8811">
29
- <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>.
30
- </blockquote>
31
-
32
26
  ## 📦 Package `@promptbook/types`
33
27
 
34
28
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -76,28 +70,33 @@ _Note: `@promptbook/types` does not export brand-specific types like `OpenAiExec
76
70
 
77
71
  Rest of the documentation is common for **entire promptbook ecosystem**:
78
72
 
79
- ## 🤍 The Promptbook Whitepaper
80
73
 
81
- 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.
82
74
 
83
- 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:
84
75
 
85
- 1. **Fine-tune** the model to your specifications or even train your own.
86
- 2. **Prompt-engineer** the prompt to the best shape you can achieve.
87
- 3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
76
+ ## 🤍 The Book Abstract
77
+
78
+ **It's time for a paradigm shift! The future of software is in plain English, French or Latin.**
79
+
80
+ 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**!
81
+
82
+ 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!
83
+
84
+ 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.
88
85
 
89
- In all of these situations, but especially in 3., the **✨ Promptbook can make your life waaaaaaaaaay easier**.
86
+ This shift is going to happen, whether we are ready for it or not. Our mission is to make it excellently, not just good.
90
87
 
91
- - [**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).
92
- - Book allows you to **focus on the business** logic without having to write code or deal with the technicalities of LLMs.
93
- - **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.
94
- - 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.
95
- - 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.
96
- - Versioning is build in. You can test multiple **A/B versions** of pipelines and see which one works best.
97
- - 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.
88
+ **Join us in this journey!**
98
89
 
99
90
 
100
91
 
92
+ ## 🚀 Get started
93
+
94
+ Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
95
+
96
+ - [Hello Book](https://github.com/webgptorg/hello-world)
97
+ - [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js)
98
+ - [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js)
99
+
101
100
 
102
101
 
103
102
 
@@ -116,7 +115,7 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
116
115
  <tbody>
117
116
  <tr>
118
117
  <td>Core</td>
119
- <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>
118
+ <td>Promptbook Core is a description and documentation of the basic concepts, ideas and inner workings of how Promptbook should be implemented, and defines what features must be describable by book language.</td>
120
119
  <td rowspan=2>https://ptbk.io<br/>https://github.com/webgptorg/book</td>
121
120
  </tr>
122
121
  <tr>
@@ -127,17 +126,23 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
127
126
  </tr>
128
127
  <tr>
129
128
  <td>Promptbook typescript project</td>
130
- <td>Implementation of Promptbook in TypeScript published into multiple packages to NPM</td>
129
+ <td>Promptbook implementation in TypeScript released as multiple NPM packages</td>
131
130
  <td>https://github.com/webgptorg/promptbook + Multiple packages on NPM</td>
132
131
  </tr>
133
132
  <tr>
134
133
  <td>Promptbook studio</td>
135
- <td>No-code studio to write book without need to write even the markdown</td>
136
- <td rowspan=2>https://promptbook.studio<br/>https://github.com/hejny/promptbook-studio</td>
137
- </tr>
138
- <tr>
139
- <td>Promptbook miniapps</td>
140
- <td>Builder of LLM miniapps from book notation</td>
134
+ <td>Studio to write Books and instantly publish them as miniapps</td>
135
+ <td>
136
+ https://promptbook.studio<br/>
137
+ https://github.com/hejny/promptbook-studio</td>
138
+ </tr><tr>
139
+ <td>Hello World</td>
140
+ <td>Simple starter kit with Books integrated into the sample applications</td>
141
+ <td>
142
+ https://github.com/webgptorg/hello-world<br/>
143
+ https://github.com/webgptorg/hello-world-node-js<br/>
144
+ https://github.com/webgptorg/hello-world-next-js
145
+ </td>
141
146
  </tr>
142
147
  </tbody>
143
148
  </table>
@@ -206,7 +211,9 @@ Reserved words:
206
211
 
207
212
  #### Parameter notation
208
213
 
209
- ### Template
214
+ ### Task
215
+
216
+ ### Task type
210
217
 
211
218
  Todo todo
212
219
 
@@ -267,6 +274,11 @@ Or you can install them separately:
267
274
 
268
275
  ## 📚 Dictionary
269
276
 
277
+
278
+
279
+
280
+
281
+
270
282
  ### 📚 Dictionary
271
283
 
272
284
  The following glossary is used to clarify certain concepts:
@@ -282,6 +294,8 @@ The following glossary is used to clarify certain concepts:
282
294
  - **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.
283
295
  - **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.
284
296
 
297
+
298
+
285
299
  _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
286
300
 
287
301
  #### Promptbook core
@@ -318,7 +332,7 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
318
332
 
319
333
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
320
334
  - [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
321
- - [🎺 Pipeline templates](https://github.com/webgptorg/promptbook/discussions/88)
335
+ - [🙇‍♂️ Tasks and pipeline sections](https://github.com/webgptorg/promptbook/discussions/88)
322
336
  - [🤼 Personas](https://github.com/webgptorg/promptbook/discussions/22)
323
337
  - [⭕ Parameters](https://github.com/webgptorg/promptbook/discussions/83)
324
338
  - [🚀 Pipeline execution](https://github.com/webgptorg/promptbook/discussions/84)
@@ -342,6 +356,8 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
342
356
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
343
357
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
344
358
 
359
+
360
+
345
361
  ### Terms specific to Promptbook TypeScript implementation
346
362
 
347
363
  - Anonymous mode
@@ -4,9 +4,10 @@ import { createCollectionFromJson } from '../collection/constructors/createColle
4
4
  import { createCollectionFromPromise } from '../collection/constructors/createCollectionFromPromise';
5
5
  import { createCollectionFromUrl } from '../collection/constructors/createCollectionFromUrl';
6
6
  import { createSubcollection } from '../collection/constructors/createSubcollection';
7
- import type { SectionType } from '../commands/SECTION/SectionType';
8
- import { SectionTypes } from '../commands/SECTION/SectionType';
7
+ import { NAME } from '../config';
9
8
  import { CLAIM } from '../config';
9
+ import { LOGO_LIGHT_SRC } from '../config';
10
+ import { LOGO_DARK_SRC } from '../config';
10
11
  import { DEFAULT_TITLE } from '../config';
11
12
  import { MAX_FILENAME_LENGTH } from '../config';
12
13
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
@@ -14,6 +15,7 @@ import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
14
15
  import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config';
15
16
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config';
16
17
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config';
18
+ import { DEFAULT_BOOKS_DIRNAME } from '../config';
17
19
  import { DEFAULT_EXECUTIONS_CACHE_DIRNAME } from '../config';
18
20
  import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config';
19
21
  import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
@@ -64,6 +66,7 @@ import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings';
64
66
  import { TextFormatDefinition } from '../formats/text/TextFormatDefinition';
65
67
  import { BoilerplateFormfactorDefinition } from '../formfactors/_boilerplate/BoilerplateFormfactorDefinition';
66
68
  import { ChatbotFormfactorDefinition } from '../formfactors/chatbot/ChatbotFormfactorDefinition';
69
+ import { GeneratorFormfactorDefinition } from '../formfactors/generator/GeneratorFormfactorDefinition';
67
70
  import { GenericFormfactorDefinition } from '../formfactors/generic/GenericFormfactorDefinition';
68
71
  import { FORMFACTOR_DEFINITIONS } from '../formfactors/index';
69
72
  import { MatcherFormfactorDefinition } from '../formfactors/matcher/MatcherFormfactorDefinition';
@@ -104,15 +107,19 @@ import { BlackholeStorage } from '../storage/blackhole/BlackholeStorage';
104
107
  import { MemoryStorage } from '../storage/memory/MemoryStorage';
105
108
  import { PrefixStorage } from '../storage/utils/PrefixStorage';
106
109
  import { MODEL_VARIANTS } from '../types/ModelVariant';
110
+ import { NonTaskSectionTypes } from '../types/SectionType';
111
+ import { SectionTypes } from '../types/SectionType';
112
+ import { TaskTypes } from '../types/TaskType';
107
113
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
108
114
  export { collectionToJson };
109
115
  export { createCollectionFromJson };
110
116
  export { createCollectionFromPromise };
111
117
  export { createCollectionFromUrl };
112
118
  export { createSubcollection };
113
- export type { SectionType };
114
- export { SectionTypes };
119
+ export { NAME };
115
120
  export { CLAIM };
121
+ export { LOGO_LIGHT_SRC };
122
+ export { LOGO_DARK_SRC };
116
123
  export { DEFAULT_TITLE };
117
124
  export { MAX_FILENAME_LENGTH };
118
125
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
@@ -120,6 +127,7 @@ export { DEFAULT_MAX_PARALLEL_COUNT };
120
127
  export { DEFAULT_MAX_EXECUTION_ATTEMPTS };
121
128
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH };
122
129
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL };
130
+ export { DEFAULT_BOOKS_DIRNAME };
123
131
  export { DEFAULT_EXECUTIONS_CACHE_DIRNAME };
124
132
  export { DEFAULT_SCRAPE_CACHE_DIRNAME };
125
133
  export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME };
@@ -170,6 +178,7 @@ export { MANDATORY_CSV_SETTINGS };
170
178
  export { TextFormatDefinition };
171
179
  export { BoilerplateFormfactorDefinition };
172
180
  export { ChatbotFormfactorDefinition };
181
+ export { GeneratorFormfactorDefinition };
173
182
  export { GenericFormfactorDefinition };
174
183
  export { FORMFACTOR_DEFINITIONS };
175
184
  export { MatcherFormfactorDefinition };
@@ -210,3 +219,6 @@ export { BlackholeStorage };
210
219
  export { MemoryStorage };
211
220
  export { PrefixStorage };
212
221
  export { MODEL_VARIANTS };
222
+ export { NonTaskSectionTypes };
223
+ export { SectionTypes };
224
+ export { TaskTypes };
@@ -9,7 +9,6 @@ import type { CommandUsagePlace } from '../commands/_common/types/CommandUsagePl
9
9
  import type { ExpectCommand } from '../commands/EXPECT/ExpectCommand';
10
10
  import type { ForeachJson } from '../commands/FOREACH/ForeachJson';
11
11
  import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
12
- import type { SectionType } from '../commands/SECTION/SectionType';
13
12
  import type { PrettifyOptions } from '../conversion/prettify/PrettifyOptions';
14
13
  import type { renderPipelineMermaidOptions } from '../conversion/prettify/renderPipelineMermaidOptions';
15
14
  import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
@@ -76,6 +75,7 @@ import type { CollectionRemoteServerOptions } from '../llm-providers/remote/inte
76
75
  import type { CollectionRemoteServerClientOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
77
76
  import type { IsPipelineImplementingInterfaceOptions } from '../pipeline/PipelineInterface/isPipelineImplementingInterface';
78
77
  import type { PipelineInterface } from '../pipeline/PipelineInterface/PipelineInterface';
78
+ import type { CommonTaskJson } from '../pipeline/PipelineJson/CommonTaskJson';
79
79
  import type { DialogTaskJson } from '../pipeline/PipelineJson/DialogTaskJson';
80
80
  import type { Expectations } from '../pipeline/PipelineJson/Expectations';
81
81
  import type { ExpectationUnit } from '../pipeline/PipelineJson/Expectations';
@@ -96,7 +96,6 @@ import type { PromptTaskJson } from '../pipeline/PipelineJson/PromptTaskJson';
96
96
  import type { ScriptTaskJson } from '../pipeline/PipelineJson/ScriptTaskJson';
97
97
  import type { SimpleTaskJson } from '../pipeline/PipelineJson/SimpleTaskJson';
98
98
  import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
99
- import type { TaskJsonCommon } from '../pipeline/PipelineJson/TaskJsonCommon';
100
99
  import type { PipelineString } from '../pipeline/PipelineString';
101
100
  import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
102
101
  import type { Converter } from '../scrapers/_common/Converter';
@@ -120,7 +119,9 @@ import type { CompletionPrompt } from '../types/Prompt';
120
119
  import type { ChatPrompt } from '../types/Prompt';
121
120
  import type { EmbeddingPrompt } from '../types/Prompt';
122
121
  import type { ScriptLanguage } from '../types/ScriptLanguage';
122
+ import type { SectionType } from '../types/SectionType';
123
123
  import type { TaskProgress } from '../types/TaskProgress';
124
+ import type { TaskType } from '../types/TaskType';
124
125
  import type { string_char_emoji } from '../types/typeAliasEmoji';
125
126
  import type { string_business_category_name } from '../types/typeAliases';
126
127
  import type { string_model_name } from '../types/typeAliases';
@@ -165,7 +166,7 @@ import type { string_css_selector } from '../types/typeAliases';
165
166
  import type { string_url } from '../types/typeAliases';
166
167
  import type { string_base_url } from '../types/typeAliases';
167
168
  import type { string_pipeline_url } from '../types/typeAliases';
168
- import type { string_pipeline_url_with_hashtemplate } from '../types/typeAliases';
169
+ import type { string_pipeline_url_with_task_hash } from '../types/typeAliases';
169
170
  import type { string_data_url } from '../types/typeAliases';
170
171
  import type { string_base64 } from '../types/typeAliases';
171
172
  import type { string_href } from '../types/typeAliases';
@@ -262,7 +263,6 @@ export type { CommandUsagePlace };
262
263
  export type { ExpectCommand };
263
264
  export type { ForeachJson };
264
265
  export type { FormatCommand };
265
- export type { SectionType };
266
266
  export type { PrettifyOptions };
267
267
  export type { renderPipelineMermaidOptions };
268
268
  export type { CallbackInterfaceToolsOptions };
@@ -329,6 +329,7 @@ export type { CollectionRemoteServerOptions };
329
329
  export type { CollectionRemoteServerClientOptions };
330
330
  export type { IsPipelineImplementingInterfaceOptions };
331
331
  export type { PipelineInterface };
332
+ export type { CommonTaskJson };
332
333
  export type { DialogTaskJson };
333
334
  export type { Expectations };
334
335
  export type { ExpectationUnit };
@@ -349,7 +350,6 @@ export type { PromptTaskJson };
349
350
  export type { ScriptTaskJson };
350
351
  export type { SimpleTaskJson };
351
352
  export type { TaskJson };
352
- export type { TaskJsonCommon };
353
353
  export type { PipelineString };
354
354
  export type { PrepareAndScrapeOptions };
355
355
  export type { Converter };
@@ -373,7 +373,9 @@ export type { CompletionPrompt };
373
373
  export type { ChatPrompt };
374
374
  export type { EmbeddingPrompt };
375
375
  export type { ScriptLanguage };
376
+ export type { SectionType };
376
377
  export type { TaskProgress };
378
+ export type { TaskType };
377
379
  export type { string_char_emoji };
378
380
  export type { string_business_category_name };
379
381
  export type { string_model_name };
@@ -418,7 +420,7 @@ export type { string_css_selector };
418
420
  export type { string_url };
419
421
  export type { string_base_url };
420
422
  export type { string_pipeline_url };
421
- export type { string_pipeline_url_with_hashtemplate };
423
+ export type { string_pipeline_url_with_task_hash };
422
424
  export type { string_data_url };
423
425
  export type { string_base64 };
424
426
  export type { string_href };
@@ -44,6 +44,7 @@ import { parseKeywords } from '../utils/normalization/parseKeywords';
44
44
  import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFromString';
45
45
  import { removeDiacritics } from '../utils/normalization/removeDiacritics';
46
46
  import { searchKeywords } from '../utils/normalization/searchKeywords';
47
+ import { spaceTrim } from '../utils/organization/spaceTrim';
47
48
  import { extractParameterNames } from '../utils/parameters/extractParameterNames';
48
49
  import { replaceParameters } from '../utils/parameters/replaceParameters';
49
50
  import { parseNumber } from '../utils/parseNumber';
@@ -117,6 +118,7 @@ export { parseKeywords };
117
118
  export { parseKeywordsFromString };
118
119
  export { removeDiacritics };
119
120
  export { searchKeywords };
121
+ export { spaceTrim };
120
122
  export { extractParameterNames };
121
123
  export { replaceParameters };
122
124
  export { parseNumber };
@@ -1,7 +1,7 @@
1
1
  import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations';
2
2
  import type { ExpectationUnit } from '../../pipeline/PipelineJson/Expectations';
3
3
  /**
4
- * Expect amount command describes the desired output of the template (after post-processing)
4
+ * Expect amount command describes the desired output of the task (after post-processing)
5
5
  * It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs,...
6
6
  *
7
7
  * Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units.
@@ -1,4 +1,4 @@
1
- import type { SectionType } from './SectionType';
1
+ import type { SectionType } from '../../types/SectionType';
2
2
  /**
3
3
  * Parsed SECTION command
4
4
  *
@@ -99,8 +99,6 @@ export type PipelineHeadCommandParser<TCommand extends CommandBase> = CommonComm
99
99
  };
100
100
  /**
101
101
  * @@@
102
- *
103
- * TODO: !!!!!! Rename to PipelineTaskCommandParser, applyToTaskJson, TaskJson, isUsedInPipelineTask,...
104
102
  */
105
103
  export type PipelineTaskCommandParser<TCommand extends CommandBase> = CommonCommandParser<TCommand> & {
106
104
  /**
@@ -1,11 +1,20 @@
1
1
  import type { CsvSettings } from './formats/csv/CsvSettings';
2
2
  import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy';
3
+ import type { string_url_image } from './types/typeAliases';
3
4
  /**
4
5
  * Warning message for the generated sections and files files
5
6
  *
6
7
  * @private within the repository
7
8
  */
8
9
  export declare const GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so that any manual changes will be overwritten";
10
+ /**
11
+ * Name for the Promptbook
12
+ *
13
+ * TODO: [🗽] Unite branding and make single place for it
14
+ *
15
+ * @public exported from `@promptbook/core`
16
+ */
17
+ export declare const NAME = "Promptbook";
9
18
  /**
10
19
  * Claim for the Promptbook
11
20
  *
@@ -14,6 +23,22 @@ export declare const GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has be
14
23
  * @public exported from `@promptbook/core`
15
24
  */
16
25
  export declare const CLAIM = "It's time for a paradigm shift. The future of software in plain English, French or Latin";
26
+ /**
27
+ * Logo for the light theme
28
+ *
29
+ * TODO: [🗽] Unite branding and make single place for it
30
+ *
31
+ * @public exported from `@promptbook/core`
32
+ */
33
+ export declare const LOGO_LIGHT_SRC: string_url_image;
34
+ /**
35
+ * Logo for the dark theme
36
+ *
37
+ * TODO: [🗽] Unite branding and make single place for it
38
+ *
39
+ * @public exported from `@promptbook/core`
40
+ */
41
+ export declare const LOGO_DARK_SRC: string_url_image;
17
42
  /**
18
43
  * When the title is not provided, the default title is used
19
44
  *
@@ -94,6 +119,13 @@ export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
94
119
  * @public exported from `@promptbook/core`
95
120
  */
96
121
  export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
122
+ /**
123
+ * Where to store your books
124
+ * This is kind of a "src" for your books
125
+ *
126
+ * @public exported from `@promptbook/core`
127
+ */
128
+ export declare const DEFAULT_BOOKS_DIRNAME = "./books";
97
129
  /**
98
130
  * Where to store the cache of executions for promptbook CLI
99
131
  *
@@ -101,7 +133,7 @@ export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
101
133
  *
102
134
  * @public exported from `@promptbook/core`
103
135
  */
104
- export declare const DEFAULT_EXECUTIONS_CACHE_DIRNAME = "/.promptbook/executions-cache";
136
+ export declare const DEFAULT_EXECUTIONS_CACHE_DIRNAME = "./.promptbook/executions-cache";
105
137
  /**
106
138
  * Where to store the scrape cache
107
139
  *
@@ -109,7 +141,7 @@ export declare const DEFAULT_EXECUTIONS_CACHE_DIRNAME = "/.promptbook/executions
109
141
  *
110
142
  * @public exported from `@promptbook/core`
111
143
  */
112
- export declare const DEFAULT_SCRAPE_CACHE_DIRNAME = "/.promptbook/scrape-cache";
144
+ export declare const DEFAULT_SCRAPE_CACHE_DIRNAME = "./.promptbook/scrape-cache";
113
145
  /**
114
146
  * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
115
147
  *
@@ -9,7 +9,7 @@ import type { PipelineString } from '../pipeline/PipelineString';
9
9
  */
10
10
  export declare function pipelineJsonToString(pipelineJson: PipelineJson): PipelineString;
11
11
  /**
12
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
12
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
13
13
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
14
14
  * TODO: [🏛] Maybe make some markdown builder
15
15
  * TODO: [🏛] Escape all
@@ -6,9 +6,9 @@ import type { string_href } from '../../types/typeAliases';
6
6
  */
7
7
  export type renderPipelineMermaidOptions = {
8
8
  /**
9
- * Callback for creating from template graph node
9
+ * Callback for creating from task graph node
10
10
  */
11
- linkTemplate?(template: TaskJson): {
11
+ linkTask?(task: TaskJson): {
12
12
  href: string_href;
13
13
  title: string;
14
14
  } | null;
@@ -2,14 +2,14 @@ import type { ReadonlyDeep } from 'type-fest';
2
2
  import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
3
3
  import type { string_parameter_name } from '../../types/typeAliases';
4
4
  /**
5
- * Parses the template and returns the set of all used parameters
5
+ * Parses the task and returns the set of all used parameters
6
6
  *
7
- * @param template the template with used parameters
7
+ * @param task the task with used parameters
8
8
  * @returns the set of parameter names
9
9
  * @throws {ParseError} if the script is invalid
10
10
  * @public exported from `@promptbook/utils`
11
11
  */
12
- export declare function extractParameterNamesFromTask(template: ReadonlyDeep<Pick<TaskJson, 'title' | 'description' | 'taskType' | 'content' | 'preparedContent' | 'jokerParameterNames' | 'foreach'>>): Set<string_parameter_name>;
12
+ export declare function extractParameterNamesFromTask(task: ReadonlyDeep<Pick<TaskJson, 'title' | 'description' | 'taskType' | 'content' | 'preparedContent' | 'jokerParameterNames' | 'foreach'>>): Set<string_parameter_name>;
13
13
  /**
14
14
  * TODO: [🔣] If script require contentLanguage
15
15
  */
@@ -16,8 +16,8 @@ type RenameParameterOptions = {
16
16
  readonly newParameterName: string_name;
17
17
  };
18
18
  /**
19
- * Function `renameParameter` will find all usable parameters for given template
20
- * In other words, it will find all parameters that are not used in the template itseld and all its dependencies
19
+ * Function `renameParameter` will find all usable parameters for given task
20
+ * In other words, it will find all parameters that are not used in the task itseld and all its dependencies
21
21
  *
22
22
  * @throws {PipelineLogicError} If the new parameter name is already used in the pipeline
23
23
  * @public exported from `@promptbook/utils`
@@ -13,7 +13,7 @@ export declare class SimplePromptInterfaceTools implements UserInterfaceTools {
13
13
  protected readonly options: CommonToolsOptions;
14
14
  constructor(options?: CommonToolsOptions);
15
15
  /**
16
- * Trigger window.DIALOG TEMPLATE
16
+ * Trigger window.prompt dialog
17
17
  */
18
18
  promptDialog(options: UserInterfaceToolsPromptDialogOptions): Promise<string>;
19
19
  }
@@ -2,7 +2,7 @@ import type { ScriptLanguage } from '../types/ScriptLanguage';
2
2
  import type { Parameters } from '../types/typeAliases';
3
3
  import type { string_script } from '../types/typeAliases';
4
4
  /**
5
- * Represents all the tools needed to execute SCRIPT TEMPLATE
5
+ * Represents all the tools needed to execute `SCRIPT` tasks
6
6
  *
7
7
  * @see https://github.com/webgptorg/promptbook#script-execution-tools
8
8
  */
@@ -8,7 +8,7 @@ export declare const BoilerplateFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameterNames: readonly [];
12
- readonly outputParameterNames: readonly [];
11
+ readonly inputParameters: readonly [];
12
+ readonly outputParameters: readonly [];
13
13
  };
14
14
  };
@@ -35,3 +35,6 @@ export type AbstractFormfactorDefinition = {
35
35
  */
36
36
  readonly pipelineInterface: PipelineInterface;
37
37
  };
38
+ /**
39
+ * TODO: [🧠][🤓] How to pass optional parameters - for example summary in FORMFACTOR Translator
40
+ */
@@ -9,7 +9,37 @@ export declare const ChatbotFormfactorDefinition: {
9
9
  readonly description: "@@@";
10
10
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174";
11
11
  readonly pipelineInterface: {
12
- readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
13
- readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
12
+ readonly inputParameters: readonly [{
13
+ readonly name: "previousTitle";
14
+ readonly description: "Previous title of the conversation";
15
+ readonly isInput: true;
16
+ readonly isOutput: false;
17
+ }, {
18
+ readonly name: "previousConversationSummary";
19
+ readonly description: "Previous conversation summary";
20
+ readonly isInput: true;
21
+ readonly isOutput: false;
22
+ }, {
23
+ readonly name: "userMessage";
24
+ readonly description: "User message";
25
+ readonly isInput: true;
26
+ readonly isOutput: false;
27
+ }];
28
+ readonly outputParameters: readonly [{
29
+ readonly name: "title";
30
+ readonly description: "Title of the conversation";
31
+ readonly isInput: false;
32
+ readonly isOutput: true;
33
+ }, {
34
+ readonly name: "conversationSummary";
35
+ readonly description: "Summary of the conversation";
36
+ readonly isInput: false;
37
+ readonly isOutput: true;
38
+ }, {
39
+ readonly name: "chatbotResponse";
40
+ readonly description: "Chatbot response";
41
+ readonly isInput: false;
42
+ readonly isOutput: true;
43
+ }];
14
44
  };
15
45
  };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generator is form of app that @@@
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const GeneratorFormfactorDefinition: {
7
+ readonly name: "GENERATOR";
8
+ readonly description: "@@@";
9
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
10
+ readonly pipelineInterface: {
11
+ readonly inputParameters: readonly [];
12
+ readonly outputParameters: readonly [];
13
+ };
14
+ };
@@ -8,7 +8,7 @@ export declare const GenericFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameterNames: readonly [];
12
- readonly outputParameterNames: readonly [];
11
+ readonly inputParameters: readonly [];
12
+ readonly outputParameters: readonly [];
13
13
  };
14
14
  };
@@ -8,8 +8,8 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameterNames: readonly [];
12
- readonly outputParameterNames: readonly [];
11
+ readonly inputParameters: readonly [];
12
+ readonly outputParameters: readonly [];
13
13
  };
14
14
  }, {
15
15
  readonly name: "CHATBOT";
@@ -17,32 +17,94 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
17
17
  readonly description: "@@@";
18
18
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174";
19
19
  readonly pipelineInterface: {
20
- readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
21
- readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
20
+ readonly inputParameters: readonly [{
21
+ readonly name: "previousTitle";
22
+ readonly description: "Previous title of the conversation"; /**
23
+ * All available formfactor definitions
24
+ *
25
+ * @public exported from `@promptbook/core`
26
+ */
27
+ readonly isInput: true;
28
+ readonly isOutput: false;
29
+ }, {
30
+ readonly name: "previousConversationSummary";
31
+ readonly description: "Previous conversation summary";
32
+ readonly isInput: true;
33
+ readonly isOutput: false;
34
+ }, {
35
+ readonly name: "userMessage";
36
+ readonly description: "User message";
37
+ readonly isInput: true;
38
+ readonly isOutput: false;
39
+ }];
40
+ readonly outputParameters: readonly [{
41
+ readonly name: "title";
42
+ readonly description: "Title of the conversation";
43
+ readonly isInput: false;
44
+ readonly isOutput: true;
45
+ }, {
46
+ readonly name: "conversationSummary";
47
+ readonly description: "Summary of the conversation";
48
+ readonly isInput: false;
49
+ readonly isOutput: true;
50
+ }, {
51
+ readonly name: "chatbotResponse";
52
+ readonly description: "Chatbot response";
53
+ readonly isInput: false;
54
+ readonly isOutput: true;
55
+ }];
22
56
  };
23
57
  }, {
24
58
  readonly name: "TRANSLATOR";
25
59
  readonly description: "@@@";
26
60
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175";
27
61
  readonly pipelineInterface: {
28
- readonly inputParameterNames: readonly ["inputMessage"];
29
- readonly outputParameterNames: readonly ["outputMessage"];
62
+ readonly inputParameters: readonly [{
63
+ readonly name: "inputMessage";
64
+ readonly description: "Input message to be translated";
65
+ readonly isInput: true;
66
+ readonly isOutput: false;
67
+ }];
68
+ readonly outputParameters: readonly [{
69
+ readonly name: "outputMessage";
70
+ readonly description: "Translated output message";
71
+ readonly isInput: false;
72
+ readonly isOutput: true;
73
+ }];
30
74
  };
31
75
  }, {
32
76
  readonly name: "SHEETS";
33
77
  readonly description: "@@@";
34
78
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176";
35
79
  readonly pipelineInterface: {
36
- readonly inputParameterNames: readonly ["inputSheet"];
37
- readonly outputParameterNames: readonly ["outputSheet"];
80
+ readonly inputParameters: readonly [{
81
+ readonly name: "inputSheet";
82
+ readonly description: "Input sheet to be processed as csv";
83
+ readonly isInput: true;
84
+ readonly isOutput: false;
85
+ }];
86
+ readonly outputParameters: readonly [{
87
+ readonly name: "outputSheet";
88
+ readonly description: "Output sheet as csv";
89
+ readonly isInput: false;
90
+ readonly isOutput: true;
91
+ }];
38
92
  };
39
93
  }, {
40
94
  readonly name: "EXPERIMENTAL_MATCHER";
41
95
  readonly description: "@@@";
42
96
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
43
97
  readonly pipelineInterface: {
44
- readonly inputParameterNames: readonly [];
45
- readonly outputParameterNames: readonly [];
98
+ readonly inputParameters: readonly [];
99
+ readonly outputParameters: readonly [];
100
+ };
101
+ }, {
102
+ readonly name: "GENERATOR";
103
+ readonly description: "@@@";
104
+ readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
105
+ readonly pipelineInterface: {
106
+ readonly inputParameters: readonly [];
107
+ readonly outputParameters: readonly [];
46
108
  };
47
109
  }];
48
110
  /**
@@ -8,7 +8,7 @@ export declare const MatcherFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameterNames: readonly [];
12
- readonly outputParameterNames: readonly [];
11
+ readonly inputParameters: readonly [];
12
+ readonly outputParameters: readonly [];
13
13
  };
14
14
  };
@@ -8,7 +8,17 @@ export declare const SheetsFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameterNames: readonly ["inputSheet"];
12
- readonly outputParameterNames: readonly ["outputSheet"];
11
+ readonly inputParameters: readonly [{
12
+ readonly name: "inputSheet";
13
+ readonly description: "Input sheet to be processed as csv";
14
+ readonly isInput: true;
15
+ readonly isOutput: false;
16
+ }];
17
+ readonly outputParameters: readonly [{
18
+ readonly name: "outputSheet";
19
+ readonly description: "Output sheet as csv";
20
+ readonly isInput: false;
21
+ readonly isOutput: true;
22
+ }];
13
23
  };
14
24
  };
@@ -8,7 +8,17 @@ export declare const TranslatorFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameterNames: readonly ["inputMessage"];
12
- readonly outputParameterNames: readonly ["outputMessage"];
11
+ readonly inputParameters: readonly [{
12
+ readonly name: "inputMessage";
13
+ readonly description: "Input message to be translated";
14
+ readonly isInput: true;
15
+ readonly isOutput: false;
16
+ }];
17
+ readonly outputParameters: readonly [{
18
+ readonly name: "outputMessage";
19
+ readonly description: "Translated output message";
20
+ readonly isInput: false;
21
+ readonly isOutput: true;
22
+ }];
13
23
  };
14
24
  };
@@ -1,4 +1,5 @@
1
- import type { string_parameter_name } from '../../types/typeAliases';
1
+ import type { InputParameterJson } from '../PipelineJson/ParameterJson';
2
+ import type { OutputParameterJson } from '../PipelineJson/ParameterJson';
2
3
  /**
3
4
  * @@@
4
5
  *
@@ -11,15 +12,15 @@ export type PipelineInterface = {
11
12
  *
12
13
  * Note: Sorted alphabetically
13
14
  */
14
- readonly inputParameterNames: ReadonlyArray<string_parameter_name>;
15
+ readonly inputParameters: ReadonlyArray<InputParameterJson>;
15
16
  /**
16
17
  * @@@
17
18
  *
18
19
  * Note: Sorted alphabetically
19
20
  */
20
- readonly outputParameterNames: ReadonlyArray<string_parameter_name>;
21
+ readonly outputParameters: ReadonlyArray<OutputParameterJson>;
21
22
  };
22
23
  /**
23
- * TODO: !!!!!! Change inputParameterNames to inputParameters<InputParameter>
24
+ * TODO: [🧠][🤓] How to pass optional parameters - for example summary in FORMFACTOR Translator
24
25
  * TODO: [🧠] Better name than `PipelineInterface` to avoid confusion with typescript `interface`
25
26
  */
@@ -6,8 +6,8 @@
6
6
  * @public exported from `@promptbook/core`
7
7
  */
8
8
  export declare const GENERIC_PIPELINE_INTERFACE: {
9
- readonly inputParameterNames: readonly [];
10
- readonly outputParameterNames: readonly [];
9
+ readonly inputParameters: readonly [];
10
+ readonly outputParameters: readonly [];
11
11
  };
12
12
  /**
13
13
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1,6 +1,6 @@
1
1
  import type { ForeachJson } from '../../commands/FOREACH/ForeachJson';
2
2
  import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
3
- import type { SectionType } from '../../commands/SECTION/SectionType';
3
+ import type { SectionType } from '../../types/SectionType';
4
4
  import type { string_javascript } from '../../types/typeAliases';
5
5
  import type { string_markdown } from '../../types/typeAliases';
6
6
  import type { string_markdown_text } from '../../types/typeAliases';
@@ -13,32 +13,32 @@ import type { Expectations } from './Expectations';
13
13
  /**
14
14
  * Common properties of all tasks
15
15
  */
16
- export type TaskJsonCommon = {
16
+ export type CommonTaskJson = {
17
17
  /**
18
- * Name of the template
18
+ * Name of the task
19
19
  * - It must be unique across the pipeline
20
20
  * - It should start uppercase and can contain letters and numbers
21
- * - The pipelineUrl together with hash and name are used to identify the template in the pipeline
21
+ * - The pipelineUrl together with hash and name are used to identify the task in the pipeline
22
22
  */
23
23
  readonly name: string_name;
24
24
  /**
25
- * Title of the template
25
+ * Title of the task
26
26
  * It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
27
27
  */
28
28
  readonly title: string;
29
29
  /**
30
- * Description of the template
30
+ * Description of the task
31
31
  * It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
32
32
  */
33
33
  readonly description?: string_markdown_text;
34
34
  /**
35
- * List of parameter names that are used in the template and must be defined before the template is executed
35
+ * List of parameter names that are used in the task and must be defined before the task is executed
36
36
  *
37
37
  * Note: Joker is one of the dependent parameters
38
38
  */
39
39
  readonly dependentParameterNames: Array<string_parameter_name>;
40
40
  /**
41
- * If theese parameters meet the expectations requirements, they are used instead of executing this template
41
+ * If theese parameters meet the expectations requirements, they are used instead of executing this task
42
42
  *
43
43
  * @see https://github.com/webgptorg/promptbook/discussions/66
44
44
  */
@@ -49,17 +49,17 @@ export type TaskJsonCommon = {
49
49
  readonly foreach?: ForeachJson;
50
50
  /**
51
51
  * Type of the execution
52
- * This determines if the template is send to LLM, user or some scripting evaluation
52
+ * This determines if the task is send to LLM, user or some scripting evaluation
53
53
  */
54
54
  readonly taskType: SectionType;
55
55
  /**
56
- * Content of the template with {placeholders} for parameters
56
+ * Content of the task with {placeholders} for parameters
57
57
  *
58
58
  * @@@ content vs preparedContent
59
59
  */
60
60
  readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
61
61
  /**
62
- * @@@ Content of the template with {placeholders} for parameters
62
+ * @@@ Content of the task with {placeholders} for parameters
63
63
  *
64
64
  * @@@ content vs preparedContent
65
65
  *
@@ -67,7 +67,7 @@ export type TaskJsonCommon = {
67
67
  */
68
68
  readonly preparedContent?: (string_prompt | string_javascript | string_markdown) & string_template;
69
69
  /**
70
- * List of postprocessing steps that are executed after the template
70
+ * List of postprocessing steps that are executed after the task
71
71
  *
72
72
  * @see https://github.com/webgptorg/promptbook/discussions/31
73
73
  */
@@ -90,7 +90,7 @@ export type TaskJsonCommon = {
90
90
  */
91
91
  readonly format?: FormatCommand['format'];
92
92
  /**
93
- * Name of the parameter that is the result of the template
93
+ * Name of the parameter that is the result of the task
94
94
  */
95
95
  readonly resultingParameterName: string_name;
96
96
  };
@@ -1,11 +1,11 @@
1
- import type { TaskJsonCommon } from './TaskJsonCommon';
1
+ import type { CommonTaskJson } from './CommonTaskJson';
2
2
  /**
3
3
  * Task for prompt to user
4
4
  *
5
5
  * Note: [🚉] This is fully serializable as JSON
6
6
  * @see https://github.com/webgptorg/promptbook/discussions/76
7
7
  */
8
- export type DialogTaskJson = TaskJsonCommon & {
8
+ export type DialogTaskJson = CommonTaskJson & {
9
9
  readonly taskType: 'DIALOG_TASK';
10
10
  };
11
11
  /**
@@ -90,6 +90,8 @@ export type CommonParameterJson = {
90
90
  readonly exampleValues?: Array<string_parameter_value>;
91
91
  };
92
92
  /**
93
+ * TODO: [🧠][🛴][♈] Maybe add type + expectations into the intefrace, like "a person name"
94
+ * [🛴] @see https://github.com/webgptorg/promptbook/discussions/53
93
95
  * TODO: [🧠] Should be here registered subparameters from foreach or not?
94
96
  * TODO: [♈] Probbably move expectations from tasks to parameters
95
97
  * TODO: [🍙] Make some standard order of json properties
@@ -11,7 +11,7 @@ import type { string_persona_description } from '../../types/typeAliases';
11
11
  */
12
12
  export type PersonaJson = {
13
13
  /**
14
- * Name of the template
14
+ * Name of the persona
15
15
  * - It must be unique across the pipeline
16
16
  * - It should start uppercase and can contain letters and numbers
17
17
  */
@@ -14,7 +14,7 @@ import type { PreparationJson } from './PreparationJson';
14
14
  import type { TaskJson } from './TaskJson';
15
15
  /**
16
16
  * Promptbook is the **core concept of this package**.
17
- * It represents a series of tasks chained together to form a pipeline / one big template with input and result parameters.
17
+ * It represents a series of tasks chained together to form a pipeline / one big task with input and result parameters.
18
18
  *
19
19
  * Note: [🚉] This is fully serializable as JSON
20
20
  *
@@ -28,7 +28,7 @@ export type PipelineJson = {
28
28
  * Note: It must use HTTPs URL
29
29
  * Tip: You can do versioning in the URL
30
30
  * For example: https://promptbook.studio/webgpt/write-website-content-cs.book.md@1.0.0
31
- * Warning: Do not hash part of the URL, hash part is used for identification of the template in the pipeline
31
+ * Warning: Do not hash part of the URL, hash part is used for identification of the task in the pipeline
32
32
  */
33
33
  readonly pipelineUrl?: string_pipeline_url;
34
34
  /**
@@ -1,12 +1,12 @@
1
1
  import type { ModelRequirements } from '../../types/ModelRequirements';
2
2
  import type { string_name } from '../../types/typeAliases';
3
- import type { TaskJsonCommon } from './TaskJsonCommon';
3
+ import type { CommonTaskJson } from './CommonTaskJson';
4
4
  /**
5
5
  * Task for prompt to LLM
6
6
  *
7
7
  * Note: [🚉] This is fully serializable as JSON
8
8
  */
9
- export type PromptTaskJson = TaskJsonCommon & {
9
+ export type PromptTaskJson = CommonTaskJson & {
10
10
  readonly taskType: 'PROMPT_TASK';
11
11
  /**
12
12
  * Name of the persona who will be responding to this prompt
@@ -1,12 +1,12 @@
1
1
  import type { ScriptLanguage } from '../../types/ScriptLanguage';
2
- import type { TaskJsonCommon } from './TaskJsonCommon';
2
+ import type { CommonTaskJson } from './CommonTaskJson';
3
3
  /**
4
4
  * Task for script execution
5
5
  *
6
6
  * Note: [🚉] This is fully serializable as JSON
7
7
  * @see https://github.com/webgptorg/promptbook/discussions/77
8
8
  */
9
- export type ScriptTaskJson = TaskJsonCommon & {
9
+ export type ScriptTaskJson = CommonTaskJson & {
10
10
  readonly taskType: 'SCRIPT_TASK';
11
11
  /**
12
12
  * Language of the script
@@ -1,11 +1,11 @@
1
- import type { TaskJsonCommon } from './TaskJsonCommon';
1
+ import type { CommonTaskJson } from './CommonTaskJson';
2
2
  /**
3
3
  * Task for simple concatenation of strings
4
4
  *
5
5
  * Note: [🚉] This is fully serializable as JSON
6
6
  * @see https://github.com/webgptorg/promptbook/discussions/17
7
7
  */
8
- export type SimpleTaskJson = TaskJsonCommon & {
8
+ export type SimpleTaskJson = CommonTaskJson & {
9
9
  readonly taskType: 'SIMPLE_TASK';
10
10
  };
11
11
  /**
@@ -4,7 +4,7 @@ import type { PromptTaskJson } from './PromptTaskJson';
4
4
  import type { ScriptTaskJson } from './ScriptTaskJson';
5
5
  import type { SimpleTaskJson } from './SimpleTaskJson';
6
6
  /**
7
- * Describes one (prompt) template in the promptbook
7
+ * Describes one (prompt) task in the pipeline
8
8
  *
9
9
  * Note: [🚉] This is fully serializable as JSON
10
10
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Promptbook is the **core concept of this package**.
3
- * It represents a series of tasks chained together to form a pipeline / one big template with input and result parameters.
3
+ * It represents a series of tasks chained together to form a pipeline / one big task with input and result parameters.
4
4
  *
5
5
  * @see @@@ https://github.com/webgptorg/promptbook#promptbook
6
6
  */
@@ -10,7 +10,7 @@ export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
10
10
  * TODO: [🐠] Maybe base this on `makeValidator`
11
11
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
12
12
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
13
- * - [🏍] ? Is context in each template
13
+ * - [🏍] ? Is context in each task
14
14
  * - [♨] Are examples prepared
15
15
  * - [♨] Are tasks prepared
16
16
  */
@@ -2,13 +2,13 @@ import type { ExecutionTools } from '../execution/ExecutionTools';
2
2
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
4
4
  import type { PrepareAndScrapeOptions } from './PrepareAndScrapeOptions';
5
- type PrepareTemplateInput = Pick<PipelineJson, 'tasks' | 'parameters'> & {
5
+ type PrepareTaskInput = Pick<PipelineJson, 'tasks' | 'parameters'> & {
6
6
  /**
7
7
  * @@@
8
8
  */
9
9
  readonly knowledgePiecesCount: number;
10
10
  };
11
- type PreparedTemplates = {
11
+ type PreparedTasks = {
12
12
  /**
13
13
  * @@@ Sequence of tasks that are chained together to form a pipeline
14
14
  */
@@ -19,11 +19,11 @@ type PreparedTemplates = {
19
19
  *
20
20
  * @public exported from `@promptbook/core`
21
21
  */
22
- export declare function prepareTasks(pipeline: PrepareTemplateInput, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PreparedTemplates>;
22
+ export declare function prepareTasks(pipeline: PrepareTaskInput, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PreparedTasks>;
23
23
  export {};
24
24
  /**
25
- * TODO: [🧠] Add context to each template (if missing)
26
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
25
+ * TODO: [🧠] Add context to each task (if missing)
26
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
27
27
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
28
28
  * TODO: Write tests for `preparePipeline`
29
29
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -5,7 +5,7 @@ import type { CompletionModelRequirements } from './ModelRequirements';
5
5
  import type { EmbeddingModelRequirements } from './ModelRequirements';
6
6
  import type { ModelRequirements } from './ModelRequirements';
7
7
  import type { Parameters } from './typeAliases';
8
- import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
8
+ import type { string_pipeline_url_with_task_hash } from './typeAliases';
9
9
  import type { string_postprocessing_function_name } from './typeAliases';
10
10
  import type { string_prompt } from './typeAliases';
11
11
  import type { string_template } from './typeAliases';
@@ -93,11 +93,11 @@ export type CommonPrompt = {
93
93
  */
94
94
  readonly format?: FormatCommand['format'];
95
95
  /**
96
- * Unique identifier of the pipeline with specific template name as hash
96
+ * Unique identifier of the pipeline with specific task name as hash
97
97
  *
98
98
  * @example https://promptbook.studio/webgpt/write-website-content-cs.book.md#keywords
99
99
  */
100
- readonly pipelineUrl?: string_pipeline_url_with_hashtemplate;
100
+ readonly pipelineUrl?: string_pipeline_url_with_task_hash;
101
101
  /**
102
102
  * Parameters used in the `content`
103
103
  */
@@ -0,0 +1,21 @@
1
+ import type { TupleToUnion } from 'type-fest';
2
+ /**
3
+ * Type of the section
4
+ */
5
+ export type SectionType = TupleToUnion<typeof SectionTypes>;
6
+ /**
7
+ * All available sections which are not tasks
8
+ *
9
+ * @public exported from `@promptbook/core`
10
+ */
11
+ export declare const NonTaskSectionTypes: readonly ["EXAMPLE", "KNOWLEDGE", "INSTRUMENT", "ACTION"];
12
+ /**
13
+ * All available section types
14
+ *
15
+ * There is is distinction between task types and section types
16
+ * - Every section in markdown has its SectionType
17
+ * - Some sections are tasks but other can be non-task sections
18
+ *
19
+ * @public exported from `@promptbook/core`
20
+ */
21
+ export declare const SectionTypes: readonly [...("PROMPT_TASK" | "SIMPLE_TASK" | "SCRIPT_TASK" | "DIALOG_TASK")[], "EXAMPLE", "KNOWLEDGE", "INSTRUMENT", "ACTION"];
@@ -1,4 +1,4 @@
1
- import type { SectionType } from '../commands/SECTION/SectionType';
1
+ import type { SectionType } from './SectionType';
2
2
  import type { string_markdown_text } from './typeAliases';
3
3
  import type { string_name } from './typeAliases';
4
4
  /**
@@ -0,0 +1,15 @@
1
+ import type { TupleToUnion } from 'type-fest';
2
+ /**
3
+ * Type of the task
4
+ */
5
+ export type TaskType = TupleToUnion<typeof TaskTypes>;
6
+ /**
7
+ * All available task types
8
+ *
9
+ * There is is distinction between task types and section types
10
+ * - Every section in markdown has its SectionType
11
+ * - Some sections are tasks but other can be non-task sections
12
+ *
13
+ * @public exported from `@promptbook/core`
14
+ */
15
+ export declare const TaskTypes: readonly ["PROMPT", "SIMPLE", "SCRIPT", "DIALOG"];
@@ -306,7 +306,7 @@ export type string_pipeline_url = string;
306
306
  *
307
307
  * For example `"https://promptbook.studio/webgpt/write-website-content-cs.book.md#keywords"`
308
308
  */
309
- export type string_pipeline_url_with_hashtemplate = string;
309
+ export type string_pipeline_url_with_task_hash = string;
310
310
  /**
311
311
  * Semantic helper
312
312
  *
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Organizational helper to better mark the place is used as but should not be
3
+ *
4
+ * @private within the repository
5
+ */
6
+ export type TODO_remove_as<T> = T;
@@ -0,0 +1,11 @@
1
+ import { spaceTrim as spaceTrimReexported } from 'spacetrim';
2
+ /**
3
+ * Trims string from all 4 sides
4
+ *
5
+ * Note: This is a re-exported function from the `spacetrim` package which is
6
+ * Developed by same author @hejny as this package
7
+ *
8
+ * @public exported from `@promptbook/utils`
9
+ * @see https://github.com/hejny/spacetrim#usage
10
+ */
11
+ export declare const spaceTrim: typeof spaceTrimReexported;
@@ -3,7 +3,7 @@ import type { string_template } from '../../types/typeAliases';
3
3
  /**
4
4
  * Parses the task and returns the list of all parameter names
5
5
  *
6
- * @param template the task with parameters in {curly} braces
6
+ * @param template the string template with parameters in {curly} braces
7
7
  * @returns the list of parameter names
8
8
  * @public exported from `@promptbook/utils`
9
9
  */
@@ -15,4 +15,4 @@ export type string_promptbook_version = string_semantic_version;
15
15
  /**
16
16
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
17
17
  * Note: [💞] Ignore a discrepancy between file name and entity name
18
- */
18
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.75.0-2",
3
+ "version": "0.75.1",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "--note-0": " <- [🐊]",
6
6
  "private": false,
@@ -52,6 +52,6 @@
52
52
  ],
53
53
  "typings": "./esm/typings/src/_packages/types.index.d.ts",
54
54
  "peerDependencies": {
55
- "@promptbook/core": "0.75.0-2"
55
+ "@promptbook/core": "0.75.1"
56
56
  }
57
57
  }
@@ -1,13 +0,0 @@
1
- import type { TupleToUnion } from 'type-fest';
2
- /**
3
- * Section type describes the way how the section is sectiond
4
- *
5
- * @public exported from `@promptbook/core`
6
- */
7
- export type SectionType = TupleToUnion<typeof SectionTypes>;
8
- /**
9
- * Section type describes the way how the section is sectiond
10
- *
11
- * @public exported from `@promptbook/core`
12
- */
13
- export declare const SectionTypes: readonly ["PROMPT_TASK", "SIMPLE_TASK", "SCRIPT_TASK", "DIALOG_TASK", "EXAMPLE", "KNOWLEDGE", "INSTRUMENT", "ACTION"];