@promptbook/types 0.84.0-9 → 0.85.0-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 (55) hide show
  1. package/README.md +21 -5
  2. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  3. package/esm/typings/src/_packages/core.index.d.ts +12 -4
  4. package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +16 -2
  6. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  7. package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
  8. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
  9. package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
  10. package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
  11. package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
  12. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
  13. package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
  14. package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
  15. package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
  16. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
  17. package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
  18. package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
  19. package/esm/typings/src/config.d.ts +27 -1
  20. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
  21. package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
  22. package/esm/typings/src/execution/ExecutionTask.d.ts +71 -0
  23. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  24. package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -5
  25. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -15
  26. package/esm/typings/src/execution/PromptbookFetch.d.ts +8 -1
  27. package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts → assertsTaskSuccessful.d.ts} +4 -3
  28. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -3
  29. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -6
  30. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +3 -6
  31. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
  32. package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
  33. package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
  34. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
  35. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
  36. package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
  37. package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
  38. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
  39. package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
  40. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
  41. package/esm/typings/src/types/typeAliases.d.ts +2 -0
  42. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
  43. package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
  44. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
  45. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
  46. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
  47. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
  48. package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
  49. package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
  50. package/esm/typings/src/utils/random/$randomSeed.d.ts +2 -1
  51. package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
  52. package/esm/typings/src/wizzard/wizzard.d.ts +8 -3
  53. package/package.json +9 -16
  54. package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +0 -10
  55. package/esm/typings/src/types/TaskProgress.d.ts +0 -43
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
2
2
 
3
- # Promptbook
3
+ # Promptbook
4
4
 
5
5
 
6
6
 
@@ -14,12 +14,13 @@
14
14
 
15
15
 
16
16
 
17
- ## New Features
17
+ ## 🌟 New Features
18
18
 
19
+ - 💫 Support of [`o3-mini` model by OpenAI](https://openai.com/index/openai-o3-mini/)
20
+ - 🐋 **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
19
21
  - 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
20
22
  - 🖤 Run books from CLI - `npx ptbk run path/to/your/book`
21
- - 📚 Support of `.docx`, `.doc` and `.pdf` documents
22
- - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
23
+ - 📚 Support of `.docx`, `.doc` and `.pdf` documents as knowledge
23
24
 
24
25
 
25
26
 
@@ -288,8 +289,9 @@ Or you can install them separately:
288
289
  - **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
289
290
  - **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
290
291
  - **[@promptbook/google](https://www.npmjs.com/package/@promptbook/google)** - Integration with Google's Gemini API
292
+ - **[@promptbook/deepseek](https://www.npmjs.com/package/@promptbook/deepseek)** - Integration with [DeepSeek API](https://www.deepseek.com/)
291
293
  - **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API
292
- - **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
294
+
293
295
  - **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
294
296
  - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
295
297
  - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
@@ -459,6 +461,20 @@ See [TODO.md](./TODO.md)
459
461
 
460
462
 
461
463
 
464
+ ## 🤝 Partners
465
+
466
+ <div style="display: flex; align-items: center; gap: 20px;">
467
+
468
+ <a href="https://promptbook.studio/">
469
+ <img src="./other/design/promptbook-studio-logo.png" alt="Partner 3" height="100">
470
+ </a>
471
+
472
+ <a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
473
+ <img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="100">
474
+ </a>
475
+
476
+ </div>
477
+
462
478
  ## 🖋️ Contributing
463
479
 
464
480
  I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
@@ -4,6 +4,8 @@ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic
4
4
  import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
5
5
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
6
6
  import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
7
+ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
8
+ import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
7
9
  import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
8
10
  import { _GoogleRegistration } from '../llm-providers/google/register-constructor';
9
11
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
@@ -30,6 +32,8 @@ export { _AnthropicClaudeMetadataRegistration };
30
32
  export { _AnthropicClaudeRegistration };
31
33
  export { _AzureOpenAiMetadataRegistration };
32
34
  export { _AzureOpenAiRegistration };
35
+ export { _DeepseekMetadataRegistration };
36
+ export { _DeepseekRegistration };
33
37
  export { _GoogleMetadataRegistration };
34
38
  export { _GoogleRegistration };
35
39
  export { _OpenAiMetadataRegistration };
@@ -12,6 +12,9 @@ import { LOGO_LIGHT_SRC } from '../config';
12
12
  import { LOGO_DARK_SRC } from '../config';
13
13
  import { DEFAULT_BOOK_TITLE } from '../config';
14
14
  import { DEFAULT_TASK_TITLE } from '../config';
15
+ import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
16
+ import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config';
17
+ import { DEFAULT_MAX_FILE_SIZE } from '../config';
15
18
  import { MAX_FILENAME_LENGTH } from '../config';
16
19
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
17
20
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
@@ -19,7 +22,8 @@ import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config';
19
22
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config';
20
23
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config';
21
24
  import { DEFAULT_BOOKS_DIRNAME } from '../config';
22
- import { DEFAULT_EXECUTIONS_CACHE_DIRNAME } from '../config';
25
+ import { DEFAULT_DOWNLOAD_CACHE_DIRNAME } from '../config';
26
+ import { DEFAULT_EXECUTION_CACHE_DIRNAME } from '../config';
23
27
  import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config';
24
28
  import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
25
29
  import { DEFAULT_REMOTE_URL } from '../config';
@@ -55,7 +59,6 @@ import { PipelineExecutionError } from '../errors/PipelineExecutionError';
55
59
  import { PipelineLogicError } from '../errors/PipelineLogicError';
56
60
  import { PipelineUrlError } from '../errors/PipelineUrlError';
57
61
  import { UnexpectedError } from '../errors/UnexpectedError';
58
- import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
59
62
  import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor';
60
63
  import { embeddingVectorToString } from '../execution/embeddingVectorToString';
61
64
  import { executionReportJsonToString } from '../execution/execution-report/executionReportJsonToString';
@@ -88,6 +91,7 @@ import { countTotalUsage } from '../llm-providers/_common/utils/count-total-usag
88
91
  import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
89
92
  import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
90
93
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
94
+ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
91
95
  import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
92
96
  import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
93
97
  import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
@@ -138,6 +142,9 @@ export { LOGO_LIGHT_SRC };
138
142
  export { LOGO_DARK_SRC };
139
143
  export { DEFAULT_BOOK_TITLE };
140
144
  export { DEFAULT_TASK_TITLE };
145
+ export { DEFAULT_PROMPT_TASK_TITLE };
146
+ export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME };
147
+ export { DEFAULT_MAX_FILE_SIZE };
141
148
  export { MAX_FILENAME_LENGTH };
142
149
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
143
150
  export { DEFAULT_MAX_PARALLEL_COUNT };
@@ -145,7 +152,8 @@ export { DEFAULT_MAX_EXECUTION_ATTEMPTS };
145
152
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH };
146
153
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL };
147
154
  export { DEFAULT_BOOKS_DIRNAME };
148
- export { DEFAULT_EXECUTIONS_CACHE_DIRNAME };
155
+ export { DEFAULT_DOWNLOAD_CACHE_DIRNAME };
156
+ export { DEFAULT_EXECUTION_CACHE_DIRNAME };
149
157
  export { DEFAULT_SCRAPE_CACHE_DIRNAME };
150
158
  export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME };
151
159
  export { DEFAULT_REMOTE_URL };
@@ -181,7 +189,6 @@ export { PipelineExecutionError };
181
189
  export { PipelineLogicError };
182
190
  export { PipelineUrlError };
183
191
  export { UnexpectedError };
184
- export { assertsExecutionSuccessful };
185
192
  export { createPipelineExecutor };
186
193
  export { embeddingVectorToString };
187
194
  export { executionReportJsonToString };
@@ -214,6 +221,7 @@ export { countTotalUsage };
214
221
  export { limitTotalUsage };
215
222
  export { _AnthropicClaudeMetadataRegistration };
216
223
  export { _AzureOpenAiMetadataRegistration };
224
+ export { _DeepseekMetadataRegistration };
217
225
  export { _GoogleMetadataRegistration };
218
226
  export { joinLlmExecutionTools };
219
227
  export { MultipleLlmExecutionTools };
@@ -0,0 +1,8 @@
1
+ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
+ import { createDeepseekExecutionTools } from '../llm-providers/deepseek/createDeepseekExecutionTools';
3
+ import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
4
+ import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
5
+ export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
6
+ export { createDeepseekExecutionTools };
7
+ export type { DeepseekExecutionToolsOptions };
8
+ export { _DeepseekRegistration };
@@ -28,6 +28,7 @@ import type { renderPipelineMermaidOptions } from '../conversion/prettify/render
28
28
  import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
29
29
  import type { ErrorJson } from '../errors/utils/ErrorJson';
30
30
  import type { LocateAppOptions } from '../executables/locateApp';
31
+ import type { AbstractTaskResult } from '../execution/AbstractTaskResult';
31
32
  import type { AvailableModel } from '../execution/AvailableModel';
32
33
  import type { CommonToolsOptions } from '../execution/CommonToolsOptions';
33
34
  import type { CreatePipelineExecutorOptions } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorOptions';
@@ -37,6 +38,10 @@ import type { ExecutionPromptReportJson } from '../execution/execution-report/Ex
37
38
  import type { ExecutionReportJson } from '../execution/execution-report/ExecutionReportJson';
38
39
  import type { ExecutionReportString } from '../execution/execution-report/ExecutionReportString';
39
40
  import type { ExecutionReportStringOptions } from '../execution/execution-report/ExecutionReportStringOptions';
41
+ import type { ExecutionTask } from '../execution/ExecutionTask';
42
+ import type { PreparationTask } from '../execution/ExecutionTask';
43
+ import type { AbstractTask } from '../execution/ExecutionTask';
44
+ import type { Task } from '../execution/ExecutionTask';
40
45
  import type { ExecutionTools } from '../execution/ExecutionTools';
41
46
  import type { FilesystemTools } from '../execution/FilesystemTools';
42
47
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
@@ -70,6 +75,7 @@ import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anth
70
75
  import type { AnthropicClaudeExecutionToolsDirectOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
71
76
  import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
72
77
  import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
78
+ import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
73
79
  import type { GoogleExecutionToolsOptions } from '../llm-providers/google/GoogleExecutionToolsOptions';
74
80
  import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
75
81
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
@@ -132,7 +138,6 @@ import type { ChatPrompt } from '../types/Prompt';
132
138
  import type { EmbeddingPrompt } from '../types/Prompt';
133
139
  import type { ScriptLanguage } from '../types/ScriptLanguage';
134
140
  import type { SectionType } from '../types/SectionType';
135
- import type { TaskProgress } from '../types/TaskProgress';
136
141
  import type { TaskType } from '../types/TaskType';
137
142
  import type { string_char_emoji } from '../types/typeAliasEmoji';
138
143
  import type { string_business_category_name } from '../types/typeAliases';
@@ -220,6 +225,7 @@ import type { string_translate_language } from '../types/typeAliases';
220
225
  import type { string_javascript_name } from '../types/typeAliases';
221
226
  import type { string_postprocessing_function_name } from '../types/typeAliases';
222
227
  import type { id } from '../types/typeAliases';
228
+ import type { task_id } from '../types/typeAliases';
223
229
  import type { string_token } from '../types/typeAliases';
224
230
  import type { string_license_token } from '../types/typeAliases';
225
231
  import type { string_password } from '../types/typeAliases';
@@ -233,6 +239,7 @@ import type { number_tokens } from '../types/typeAliases';
233
239
  import type { number_positive } from '../types/typeAliases';
234
240
  import type { number_negative } from '../types/typeAliases';
235
241
  import type { number_integer } from '../types/typeAliases';
242
+ import type { number_port } from '../types/typeAliases';
236
243
  import type { number_percent } from '../types/typeAliases';
237
244
  import type { number_model_temperature } from '../types/typeAliases';
238
245
  import type { number_seed } from '../types/typeAliases';
@@ -302,6 +309,7 @@ export type { renderPipelineMermaidOptions };
302
309
  export type { CallbackInterfaceToolsOptions };
303
310
  export type { ErrorJson };
304
311
  export type { LocateAppOptions };
312
+ export type { AbstractTaskResult };
305
313
  export type { AvailableModel };
306
314
  export type { CommonToolsOptions };
307
315
  export type { CreatePipelineExecutorOptions };
@@ -311,6 +319,10 @@ export type { ExecutionPromptReportJson };
311
319
  export type { ExecutionReportJson };
312
320
  export type { ExecutionReportString };
313
321
  export type { ExecutionReportStringOptions };
322
+ export type { ExecutionTask };
323
+ export type { PreparationTask };
324
+ export type { AbstractTask };
325
+ export type { Task };
314
326
  export type { ExecutionTools };
315
327
  export type { FilesystemTools };
316
328
  export type { LlmExecutionTools };
@@ -344,6 +356,7 @@ export type { AnthropicClaudeExecutionToolsOptions };
344
356
  export type { AnthropicClaudeExecutionToolsDirectOptions };
345
357
  export type { AnthropicClaudeExecutionToolsProxiedOptions };
346
358
  export type { AzureOpenAiExecutionToolsOptions };
359
+ export type { DeepseekExecutionToolsOptions };
347
360
  export type { GoogleExecutionToolsOptions };
348
361
  export type { OpenAiAssistantExecutionToolsOptions };
349
362
  export type { OpenAiExecutionToolsOptions };
@@ -406,7 +419,6 @@ export type { ChatPrompt };
406
419
  export type { EmbeddingPrompt };
407
420
  export type { ScriptLanguage };
408
421
  export type { SectionType };
409
- export type { TaskProgress };
410
422
  export type { TaskType };
411
423
  export type { string_char_emoji };
412
424
  export type { string_business_category_name };
@@ -494,6 +506,7 @@ export type { string_translate_language };
494
506
  export type { string_javascript_name };
495
507
  export type { string_postprocessing_function_name };
496
508
  export type { id };
509
+ export type { task_id };
497
510
  export type { string_token };
498
511
  export type { string_license_token };
499
512
  export type { string_password };
@@ -507,6 +520,7 @@ export type { number_tokens };
507
520
  export type { number_positive };
508
521
  export type { number_negative };
509
522
  export type { number_integer };
523
+ export type { number_port };
510
524
  export type { number_percent };
511
525
  export type { number_model_temperature };
512
526
  export type { number_seed };
@@ -8,6 +8,7 @@ import { serializeError } from '../errors/utils/serializeError';
8
8
  import { forEachAsync } from '../execution/utils/forEachAsync';
9
9
  import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
10
10
  import { prompt } from '../pipeline/prompt-notation';
11
+ import { promptTemplate } from '../pipeline/prompt-notation';
11
12
  import { $getCurrentDate } from '../utils/$getCurrentDate';
12
13
  import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
13
14
  import { $isRunningInJest } from '../utils/environment/$isRunningInJest';
@@ -53,7 +54,6 @@ import { numberToString } from '../utils/parameters/numberToString';
53
54
  import { templateParameters } from '../utils/parameters/templateParameters';
54
55
  import { valueToString } from '../utils/parameters/valueToString';
55
56
  import { parseNumber } from '../utils/parseNumber';
56
- import { $randomSeed } from '../utils/random/$randomSeed';
57
57
  import { removeEmojis } from '../utils/removeEmojis';
58
58
  import { removeQuotes } from '../utils/removeQuotes';
59
59
  import { $deepFreeze } from '../utils/serialization/$deepFreeze';
@@ -89,6 +89,7 @@ export { serializeError };
89
89
  export { forEachAsync };
90
90
  export { isValidJsonString };
91
91
  export { prompt };
92
+ export { promptTemplate };
92
93
  export { $getCurrentDate };
93
94
  export { $isRunningInBrowser };
94
95
  export { $isRunningInJest };
@@ -134,7 +135,6 @@ export { numberToString };
134
135
  export { templateParameters };
135
136
  export { valueToString };
136
137
  export { parseNumber };
137
- export { $randomSeed };
138
138
  export { removeEmojis };
139
139
  export { removeQuotes };
140
140
  export { $deepFreeze };
@@ -3,6 +3,8 @@ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic
3
3
  import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
4
4
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
5
5
  import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
6
+ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
7
+ import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
6
8
  import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
7
9
  import { _GoogleRegistration } from '../llm-providers/google/register-constructor';
8
10
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
@@ -29,6 +31,8 @@ export { _AnthropicClaudeMetadataRegistration };
29
31
  export { _AnthropicClaudeRegistration };
30
32
  export { _AzureOpenAiMetadataRegistration };
31
33
  export { _AzureOpenAiRegistration };
34
+ export { _DeepseekMetadataRegistration };
35
+ export { _DeepseekRegistration };
32
36
  export { _GoogleMetadataRegistration };
33
37
  export { _GoogleRegistration };
34
38
  export { _OpenAiMetadataRegistration };
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `boilerplate` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeBoilerplateCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -2,10 +2,13 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `about` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeAboutCommand(program: Program): void;
9
+ export declare function $initializeAboutCommand(program: Program): void;
8
10
  /**
11
+ * TODO: !!! Test this in `deno`
9
12
  * TODO: [🗽] Unite branding and make single place for it
10
13
  * Note: [💞] Ignore a discrepancy between file name and entity name
11
14
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes testing `hello` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeHelloCommand(program: Program): void;
9
+ export declare function $initializeHelloCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [🧠][🐣] Make here some easter egg with generated hello greeting via LLM models
10
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `list-models` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeListModelsCommand(program: Program): void;
9
+ export declare function $initializeListModelsCommand(program: Program): void;
8
10
  /**
9
11
  * Note: [💞] Ignore a discrepancy between file name and entity name
10
12
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `list-scrapers` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeListScrapersCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `make` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeMakeCommand(program: Program): void;
9
+ export declare function $initializeMakeCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [🥃][main] !!3 Allow `ptbk make` without configuring any llm tools
10
12
  * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `prettify` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializePrettifyCommand(program: Program): void;
9
+ export declare function $initializePrettifyCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [😶] Unite floder listing
10
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `run` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeRunCommand(program: Program): void;
9
+ export declare function $initializeRunCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: !!5 Catch and wrap all errors from CLI
10
12
  * TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
@@ -1,5 +1,5 @@
1
- import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
1
  import type { PipelineExecutor } from '../../execution/PipelineExecutor';
2
+ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
3
  /**
4
4
  * Options for running the interactive chatbot
5
5
  */
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `start-server` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeStartServerCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `test` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeTestCommand(program: Program): void;
9
+ export declare function $initializeTestCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [😶] Unite floder listing
10
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -65,6 +65,24 @@ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
65
65
  * @public exported from `@promptbook/core`
66
66
  */
67
67
  export declare const DEFAULT_TASK_TITLE = "Task";
68
+ /**
69
+ * When the title of the prompt task is not provided, the default title is used
70
+ *
71
+ * @public exported from `@promptbook/core`
72
+ */
73
+ export declare const DEFAULT_PROMPT_TASK_TITLE = "Prompt";
74
+ /**
75
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
76
+ *
77
+ * @public exported from `@promptbook/core`
78
+ */
79
+ export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
80
+ /**
81
+ * Maximum file size limit
82
+ *
83
+ * @public exported from `@promptbook/core`
84
+ */
85
+ export declare const DEFAULT_MAX_FILE_SIZE: number;
68
86
  /**
69
87
  * Warning message for the generated sections and files files
70
88
  *
@@ -166,6 +184,14 @@ export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
166
184
  * @public exported from `@promptbook/core`
167
185
  */
168
186
  export declare const DEFAULT_BOOKS_DIRNAME = "./books";
187
+ /**
188
+ * Where to store the temporary downloads
189
+ *
190
+ * Note: When the folder does not exist, it is created recursively
191
+ *
192
+ * @public exported from `@promptbook/core`
193
+ */
194
+ export declare const DEFAULT_DOWNLOAD_CACHE_DIRNAME = "./.promptbook/download-cache";
169
195
  /**
170
196
  * Where to store the cache of executions for promptbook CLI
171
197
  *
@@ -173,7 +199,7 @@ export declare const DEFAULT_BOOKS_DIRNAME = "./books";
173
199
  *
174
200
  * @public exported from `@promptbook/core`
175
201
  */
176
- export declare const DEFAULT_EXECUTIONS_CACHE_DIRNAME = "./.promptbook/executions-cache";
202
+ export declare const DEFAULT_EXECUTION_CACHE_DIRNAME = "./.promptbook/execution-cache";
177
203
  /**
178
204
  * Where to store the scrape cache
179
205
  *
@@ -17,5 +17,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
17
17
  */
18
18
  export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
19
19
  /**
20
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
20
+ * TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
21
21
  */
@@ -0,0 +1,25 @@
1
+ import { ReadonlyDeep } from 'type-fest';
2
+ import type { ErrorJson } from '../errors/utils/ErrorJson';
3
+ /**
4
+ * @@@
5
+ *
6
+ * Note: [🚉] This is fully serializable as JSON
7
+ */
8
+ export type AbstractTaskResult = {
9
+ /**
10
+ * Whether the execution was successful, details are aviable in `executionReport`
11
+ */
12
+ readonly isSuccessful: boolean;
13
+ /**
14
+ * Errors that occured during the execution, details are aviable in `executionReport`
15
+ */
16
+ readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
17
+ /**
18
+ * Warnings that occured during the execution, details are aviable in `executionReport`
19
+ */
20
+ readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
21
+ };
22
+ /**
23
+ * TODO: [🧠] Should this file be in /execution or /types folder?
24
+ * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
25
+ */
@@ -0,0 +1,71 @@
1
+ import type { Observable } from 'rxjs';
2
+ import { PartialDeep } from 'type-fest';
3
+ import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
4
+ import type { task_id } from '../types/typeAliases';
5
+ import type { AbstractTaskResult } from './AbstractTaskResult';
6
+ import type { PipelineExecutorResult } from './PipelineExecutorResult';
7
+ /**
8
+ * Options for creating a new task
9
+ */
10
+ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
11
+ /**
12
+ * The type of task to create
13
+ */
14
+ readonly taskType: AbstractTask<TTaskResult>['taskType'];
15
+ /**
16
+ * Callback that processes the task and updates the ongoing result
17
+ * @param ongoingResult The partial result of the task processing
18
+ * @returns The final task result
19
+ */
20
+ taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult>) => void): Promise<TTaskResult>;
21
+ };
22
+ /**
23
+ * Helper to create a new task
24
+ *
25
+ * @private internal helper function
26
+ */
27
+ export declare function createTask<TTaskResult extends AbstractTaskResult>(options: CreateTaskOptions<TTaskResult>): AbstractTask<TTaskResult>;
28
+ /**
29
+ * Represents a task that executes a pipeline
30
+ */
31
+ export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
32
+ readonly taskType: 'EXECUTION';
33
+ readonly taskId: `execution-${task_id}`;
34
+ };
35
+ /**
36
+ * Represents a task that prepares a pipeline
37
+ * @deprecated TODO: [🐚] Currently unused - use
38
+ */
39
+ export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
40
+ readonly taskType: 'PREPARATION';
41
+ readonly taskId: `preparation-${task_id}`;
42
+ };
43
+ /**
44
+ * Base interface for all task types
45
+ */
46
+ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
47
+ /**
48
+ * Type of the task
49
+ */
50
+ readonly taskType: string_SCREAMING_CASE;
51
+ /**
52
+ * Unique identifier for the task
53
+ */
54
+ readonly taskId: task_id;
55
+ /**
56
+ * Gets a promise that resolves with the task result
57
+ */
58
+ asPromise(options?: {
59
+ readonly isCrashedOnError?: boolean;
60
+ }): Promise<TTaskResult>;
61
+ /**
62
+ * Gets an observable stream of partial task results
63
+ */
64
+ asObservable(): Observable<PartialDeep<TTaskResult>>;
65
+ };
66
+ export type Task = ExecutionTask | PreparationTask;
67
+ export {};
68
+ /**
69
+ * TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
70
+ * TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
71
+ */
@@ -3,7 +3,7 @@ import type fs from 'fs/promises';
3
3
  /**
4
4
  * Container for all the tools needed to manipulate with filesystem
5
5
  */
6
- export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir'>;
6
+ export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir' | 'mkdir'>;
7
7
  /**
8
8
  * TODO: Implement destroyable pattern to free resources
9
9
  */
@@ -1,7 +1,5 @@
1
- import type { Promisable } from 'type-fest';
2
- import type { TaskProgress } from '../types/TaskProgress';
3
1
  import type { InputParameters } from '../types/typeAliases';
4
- import type { PipelineExecutorResult } from './PipelineExecutorResult';
2
+ import type { ExecutionTask } from './ExecutionTask';
5
3
  /**
6
4
  * Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
7
5
  * Executor is made by combining execution tools and pipeline collection.
@@ -11,9 +9,8 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
11
9
  * @see https://github.com/webgptorg/promptbook#executor
12
10
  */
13
11
  export type PipelineExecutor = {
14
- (inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<PipelineExecutorResult>;
12
+ (inputParameters: InputParameters): ExecutionTask;
15
13
  };
16
14
  /**
17
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
18
15
  * TODO: [🧠] Should this file be in /execution or /types folder?
19
16
  */
@@ -1,7 +1,7 @@
1
1
  import { ReadonlyDeep } from 'type-fest';
2
- import type { ErrorJson } from '../errors/utils/ErrorJson';
3
2
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
4
3
  import type { Parameters } from '../types/typeAliases';
4
+ import type { AbstractTaskResult } from './AbstractTaskResult';
5
5
  import type { ExecutionReportJson } from './execution-report/ExecutionReportJson';
6
6
  import type { PromptResultUsage } from './PromptResultUsage';
7
7
  /**
@@ -9,29 +9,17 @@ import type { PromptResultUsage } from './PromptResultUsage';
9
9
  *
10
10
  * Note: [🚉] This is fully serializable as JSON
11
11
  */
12
- export type PipelineExecutorResult = {
12
+ export type PipelineExecutorResult = AbstractTaskResult & {
13
13
  /**
14
14
  * Result parameters of the execution
15
15
  *
16
16
  * Note: If the execution was not successful, there are only some of the result parameters
17
17
  */
18
18
  readonly outputParameters: Readonly<Parameters>;
19
- /**
20
- * Whether the execution was successful, details are aviable in `executionReport`
21
- */
22
- readonly isSuccessful: boolean;
23
19
  /**
24
20
  * Added usage of whole execution, detailed usage is aviable in `executionReport`
25
21
  */
26
22
  readonly usage: ReadonlyDeep<PromptResultUsage>;
27
- /**
28
- * Errors that occured during the execution, details are aviable in `executionReport`
29
- */
30
- readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
31
- /**
32
- * Warnings that occured during the execution, details are aviable in `executionReport`
33
- */
34
- readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
35
23
  /**
36
24
  * The report of the execution with all details
37
25
  */
@@ -46,5 +34,4 @@ export type PipelineExecutorResult = {
46
34
  };
47
35
  /**
48
36
  * TODO: [🧠] Should this file be in /execution or /types folder?
49
- * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
50
37
  */
@@ -1,5 +1,12 @@
1
1
  import type { string_url } from '../types/typeAliases';
2
2
  /**
3
- * Fetch function for fetching data from the internet used in scraping
3
+ * Fetch function used in Promptbook engine
4
+ *
5
+ * In most cases it is just native `fetch` function with a lightweight error handling wrapper
6
+ * But it can be replaced with any other fetch function, polyfill, custom implementation, security layer, etc.
7
+ *
8
+ * It is used in theese places:
9
+ * - Fetching knowledge sources
10
+ * - Callbacks from remote server ([👩🏾‍🤝‍🧑🏾] Not yet implemented)
4
11
  */
5
12
  export type PromptbookFetch = (url: string_url, init?: RequestInit) => Promise<Response>;
@@ -2,12 +2,13 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
2
2
  /**
3
3
  * Asserts that the execution of a Promptbook is successful
4
4
  *
5
+ * Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
6
+ *
5
7
  * @param executionResult - The partial result of the Promptbook execution
6
8
  * @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
7
- * @public exported from `@promptbook/core`
9
+ * @private internal helper function of `asPromise` method of `ExecutionTask`
8
10
  */
9
- export declare function assertsExecutionSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors'>): void;
11
+ export declare function assertsTaskSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors' | 'warnings'>): void;
10
12
  /**
11
- * TODO: [🐚] This function should be removed OR changed OR be completely rewritten
12
13
  * TODO: [🧠] Can this return type be better typed than void
13
14
  */
@@ -8,6 +8,3 @@ import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorO
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
10
  export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
11
- /**
12
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
13
- */
@@ -1,6 +1,5 @@
1
- import type { Promisable, ReadonlyDeep } from 'type-fest';
1
+ import type { PartialDeep, Promisable, ReadonlyDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
- import type { TaskProgress } from '../../types/TaskProgress';
4
3
  import type { InputParameters } from '../../types/typeAliases';
5
4
  import type { PipelineExecutorResult } from '../PipelineExecutorResult';
6
5
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
@@ -17,7 +16,7 @@ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
17
16
  /**
18
17
  * @@@
19
18
  */
20
- onProgress?(taskProgress: TaskProgress): Promisable<void>;
19
+ onProgress?(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>;
21
20
  /**
22
21
  * @@@
23
22
  */
@@ -44,6 +43,3 @@ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
44
43
  */
45
44
  export declare function executePipeline(options: ExecutePipelineOptions): Promise<PipelineExecutorResult>;
46
45
  export {};
47
- /**
48
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
49
- */
@@ -1,9 +1,9 @@
1
- import type { Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
1
+ import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
4
- import type { TaskProgress } from '../../types/TaskProgress';
5
4
  import type { Parameters } from '../../types/typeAliases';
6
5
  import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
6
+ import type { PipelineExecutorResult } from '../PipelineExecutorResult';
7
7
  import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
8
8
  /**
9
9
  * @@@
@@ -26,7 +26,7 @@ type executeSingleTaskOptions = Required<CreatePipelineExecutorOptions> & {
26
26
  /**
27
27
  * @@@
28
28
  */
29
- readonly onProgress: (taskProgress: TaskProgress) => Promisable<void>;
29
+ readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
30
30
  /**
31
31
  * @@@
32
32
  */
@@ -46,6 +46,3 @@ export {};
46
46
  /**
47
47
  * TODO: [🤹‍♂️]
48
48
  */
49
- /**
50
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
51
- */
@@ -1,4 +1,13 @@
1
+ import type { string_filename } from '../../../types/typeAliases';
1
2
  import type { string_markdown } from '../../../types/typeAliases';
3
+ /**
4
+ * Pass the `.env` file which was used to configure LLM tools
5
+ *
6
+ * Note: `$` is used to indicate that this variable is making side effect
7
+ *
8
+ * @private internal log of `$provideLlmToolsConfigurationFromEnv` and `$registeredLlmToolsMessage`
9
+ */
10
+ export declare function $setUsedEnvFilename(filepath: string_filename): void;
2
11
  /**
3
12
  * Creates a message with all registered LLM tools
4
13
  *
@@ -0,0 +1,9 @@
1
+ import type { createDeepSeek } from '@ai-sdk/deepseek';
2
+ import type { VercelExecutionToolsOptions } from '../vercel/VercelExecutionToolsOptions';
3
+ /**
4
+ * Options for `DeepseekExecutionTools`
5
+ *
6
+ * This combines options for Promptbook, Deepseek and Vercel together
7
+ * @public exported from `@promptbook/deepseek`
8
+ */
9
+ export type DeepseekExecutionToolsOptions = Omit<VercelExecutionToolsOptions, 'title' | 'description' | 'vercelProvider' | 'availableModels'> & Parameters<typeof createDeepSeek>[0];
@@ -0,0 +1,14 @@
1
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
2
+ import type { DeepseekExecutionToolsOptions } from './DeepseekExecutionToolsOptions';
3
+ /**
4
+ * Execution Tools for calling Deepseek API.
5
+ *
6
+ * @public exported from `@promptbook/deepseek`
7
+ */
8
+ export declare const createDeepseekExecutionTools: ((options: DeepseekExecutionToolsOptions) => LlmExecutionTools) & {
9
+ packageName: string;
10
+ className: string;
11
+ };
12
+ /**
13
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
14
+ */
@@ -0,0 +1,14 @@
1
+ import type { Registration } from '../../utils/$Register';
2
+ /**
3
+ * Registration of LLM provider metadata
4
+ *
5
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
+ *
7
+ * @public exported from `@promptbook/core`
8
+ * @public exported from `@promptbook/wizzard`
9
+ * @public exported from `@promptbook/cli`
10
+ */
11
+ export declare const _DeepseekMetadataRegistration: Registration;
12
+ /**
13
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14
+ */
@@ -0,0 +1,15 @@
1
+ import type { Registration } from '../../utils/$Register';
2
+ /**
3
+ * Registration of LLM provider
4
+ *
5
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
6
+ *
7
+ * @public exported from `@promptbook/deepseek`
8
+ * @public exported from `@promptbook/wizzard`
9
+ * @public exported from `@promptbook/cli`
10
+ */
11
+ export declare const _DeepseekRegistration: Registration;
12
+ /**
13
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
14
+ * Note: [💞] Ignore a discrepancy between file name and entity name
15
+ */
@@ -2,9 +2,10 @@ import type { PipelineString } from './PipelineString';
2
2
  /**
3
3
  * Tag function for notating a pipeline with a book\`...\ notation as template literal
4
4
  *
5
- * Note: There are 2 similar functions:
5
+ * Note: There are 3 similar functions:
6
6
  * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
7
- * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
7
+ * 2) `promptTemplate` alias for `prompt`
8
+ * 3) `book` for notating and validating entire books exported from `@promptbook/utils`
8
9
  *
9
10
  * @param strings @@@
10
11
  * @param values @@@
@@ -2,16 +2,29 @@ import type { string_prompt } from '../types/typeAliases';
2
2
  /**
3
3
  * Tag function for notating a prompt as template literal
4
4
  *
5
- * Note: There are 2 similar functions:
5
+ * Note: There are 3 similar functions:
6
6
  * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
7
- * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
7
+ * 2) `promptTemplate` alias for `prompt`
8
+ * 3) `book` for notating and validating entire books exported from `@promptbook/utils`
8
9
  *
9
- * @param strings @@@
10
- * @param values @@@
11
- * @returns the pipeline string
10
+ * @param strings
11
+ * @param values
12
+ * @returns the prompt string
12
13
  * @public exported from `@promptbook/utils`
13
14
  */
14
15
  export declare function prompt(strings: TemplateStringsArray, ...values: Array<string>): string_prompt;
16
+ /**
17
+ * Tag function for notating a prompt as template literal
18
+ *
19
+ * Note: There are 3 similar functions:
20
+ * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
21
+ * 2) `promptTemplate` alias for `prompt`
22
+ * 3) `book` for notating and validating entire books exported from `@promptbook/utils`
23
+ *
24
+ * @alias prompt
25
+ * @public exported from `@promptbook/utils`
26
+ */
27
+ export declare const promptTemplate: typeof prompt;
15
28
  /**
16
29
  * TODO: [🧠][🈴] Where is the best location for this file
17
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -13,5 +13,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
13
13
  */
14
14
  export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
15
15
  /**
16
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
16
+ * TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
17
17
  */
@@ -9,7 +9,7 @@ import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteSer
9
9
  */
10
10
  export type PromptbookServer_Identification<TCustomOptions> = PromptbookServer_ApplicationIdentification<TCustomOptions> | PromptbookServer_AnonymousIdentification;
11
11
  /**
12
- * Application mode is @@@!!!
12
+ * Application mode is situation when you run known and well-defined books with your own api keys
13
13
  *
14
14
  * @public exported from `@promptbook/remote-server`
15
15
  * @public exported from `@promptbook/remote-client`
@@ -21,7 +21,10 @@ export type PromptbookServer_ApplicationIdentification<TCustomOptions> = Applica
21
21
  readonly isAnonymous: false;
22
22
  };
23
23
  /**
24
- * Anonymous mode is @@@!!!
24
+ * Anonymous mode is when you run arbitrary user books without api keys from user
25
+ *
26
+ * Note: This is useful in situations when the LLM provider does not allow to call the API requests from the client side
27
+ * It is kind of a proxy mode
25
28
  *
26
29
  * @public exported from `@promptbook/remote-server`
27
30
  * @public exported from `@promptbook/remote-client`
@@ -11,6 +11,7 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
13
13
  /**
14
+ * TODO: [👩🏾‍🤝‍🧑🏾] Allow to pass custom fetch function here - PromptbookFetch
14
15
  * TODO: Split this file into multiple functions - handler for each request
15
16
  * TODO: Maybe use `$exportJson`
16
17
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
@@ -556,6 +556,7 @@ export type string_javascript_name = string;
556
556
  */
557
557
  export type string_postprocessing_function_name = string;
558
558
  export type id = string | number;
559
+ export type task_id = string;
559
560
  export type string_token = string;
560
561
  export type string_license_token = string_token;
561
562
  export type string_password = string;
@@ -588,6 +589,7 @@ export type number_tokens = number_integer & (number_positive | 0);
588
589
  export type number_positive = number;
589
590
  export type number_negative = number;
590
591
  export type number_integer = number;
592
+ export type number_port = number_positive & number_integer;
591
593
  /**
592
594
  * Semantic helper;
593
595
  * Percentage from 0 to 1 (100%) (and bellow and above)
@@ -6,3 +6,6 @@
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare const $isRunningInBrowser: Function;
9
+ /**
10
+ * TODO: [🎺]
11
+ */
@@ -6,3 +6,6 @@
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare const $isRunningInJest: Function;
9
+ /**
10
+ * TODO: [🎺]
11
+ */
@@ -6,3 +6,6 @@
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare const $isRunningInNode: Function;
9
+ /**
10
+ * TODO: [🎺]
11
+ */
@@ -6,3 +6,6 @@
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare const $isRunningInWebWorker: Function;
9
+ /**
10
+ * TODO: [🎺]
11
+ */
@@ -0,0 +1,10 @@
1
+ import type { string_file_extension } from '../../types/typeAliases';
2
+ import type { string_mime_type } from '../../types/typeAliases';
3
+ /**
4
+ * Convert mime type to file extension
5
+ *
6
+ * Note: If the mime type is invalid, `null` is returned
7
+ *
8
+ * @private within the repository
9
+ */
10
+ export declare function mimeTypeToExtension(value: string_mime_type): string_file_extension | null;
@@ -4,6 +4,7 @@ import type { number_seed } from '../../types/typeAliases';
4
4
  *
5
5
  * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
6
6
  * Warning: This function is NOT cryptographically secure (it uses Math.random internally)
7
- * @public exported from `@promptbook/utils`
7
+ *
8
+ * @private internal helper function
8
9
  */
9
10
  export declare function $randomSeed(): number_seed;
@@ -0,0 +1,13 @@
1
+ import type { string_token } from '../../types/typeAliases';
2
+ /**
3
+ * Generates random token
4
+ *
5
+ * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
6
+ *
7
+ * @private internal helper function
8
+ * @returns secure random token
9
+ */
10
+ export declare function $randomToken(randomness: number): string_token;
11
+ /**
12
+ * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
13
+ */
@@ -1,11 +1,10 @@
1
- import { Promisable } from 'type-fest';
2
1
  import type { ExecutionTools } from '../execution/ExecutionTools';
3
2
  import type { PipelineExecutorResult } from '../execution/PipelineExecutorResult';
4
3
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
5
4
  import type { PipelineString } from '../pipeline/PipelineString';
6
- import type { TaskProgress } from '../types/TaskProgress';
7
5
  import type { InputParameters } from '../types/typeAliases';
8
6
  import type { string_filename } from '../types/typeAliases';
7
+ import type { string_parameter_value } from '../types/typeAliases';
9
8
  import type { string_pipeline_url } from '../types/typeAliases';
10
9
  /**
11
10
  * Wizzard for simple usage of the Promptbook
@@ -27,7 +26,12 @@ declare class Wizzard {
27
26
  *
28
27
  * Note: This works simmilar to the `ptbk run` command
29
28
  */
30
- execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<PipelineExecutorResult>;
29
+ execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters): Promise<{
30
+ /**
31
+ * Simple result of the execution
32
+ */
33
+ result: string_parameter_value;
34
+ } & PipelineExecutorResult>;
31
35
  private executionTools;
32
36
  /**
33
37
  * Provides the tools automatically for the Node.js environment
@@ -59,5 +63,6 @@ declare class Wizzard {
59
63
  export declare const wizzard: Wizzard;
60
64
  export {};
61
65
  /**
66
+ * TODO: [🧠] Maybe some way how to handle the progress and streaming?
62
67
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
63
68
  */
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.84.0-9",
3
+ "version": "0.85.0-0",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
- "--note-0": " <- [🐊]",
6
5
  "private": false,
7
6
  "sideEffects": false,
8
7
  "repository": {
9
8
  "type": "git",
10
9
  "url": "https://github.com/webgptorg/promptbook"
11
10
  },
11
+ "author": "Pavol Hejný <pavol@ptbk.io> (https://www.pavolhejny.com/)",
12
12
  "contributors": [
13
- "Pavol Hejný <pavol@ptbk.io> (https://www.pavolhejny.com/)"
13
+ "Pavol Hejný <pavol@ptbk.io> (https://www.pavolhejny.com/)",
14
+ "Jiří Jahn <jiri@ptbk.io> (https://www.ptbk.io/)"
14
15
  ],
15
- "--todo-0": "TODO: [❇️] Make better list of keywords",
16
16
  "keywords": [
17
17
  "ai",
18
18
  "llm",
@@ -25,6 +25,9 @@
25
25
  "natural-language-processing",
26
26
  "nlp",
27
27
  "openai",
28
+ "o3",
29
+ "o3-mini",
30
+ "deepseek",
28
31
  "gpt-3",
29
32
  "gpt-4",
30
33
  "gpt-4o",
@@ -35,23 +38,13 @@
35
38
  "anthropic",
36
39
  "LLMOps"
37
40
  ],
38
- "license": "CC-BY-4.0",
41
+ "license": "BUSL-1.1",
39
42
  "bugs": {
40
43
  "url": "https://github.com/webgptorg/promptbook/issues"
41
44
  },
42
45
  "homepage": "https://www.npmjs.com/package/@promptbook/core",
43
- "funding": [
44
- {
45
- "type": "individual",
46
- "url": "https://buymeacoffee.com/hejny"
47
- },
48
- {
49
- "type": "github",
50
- "url": "https://github.com/webgptorg/promptbook/blob/main/README.md#%EF%B8%8F-contributing"
51
- }
52
- ],
53
46
  "typings": "./esm/typings/src/_packages/types.index.d.ts",
54
47
  "peerDependencies": {
55
- "@promptbook/core": "0.84.0-9"
48
+ "@promptbook/core": "0.85.0-0"
56
49
  }
57
50
  }
@@ -1,10 +0,0 @@
1
- import type { TaskProgress } from '../../../types/TaskProgress';
2
- /**
3
- * This is sent from server to client as indication of prograss arbitrarily and may be sent multiple times
4
- *
5
- * @private internal type of remote server
6
- */
7
- export type PromptbookServer_Progress = TaskProgress;
8
- /**
9
- * TODO: `PromptbookServer_Progress` is unused for now, but it will be used in the future
10
- */
@@ -1,43 +0,0 @@
1
- import type { SectionType } from './SectionType';
2
- import type { string_markdown_text } from './typeAliases';
3
- import type { string_name } from './typeAliases';
4
- /**
5
- * TaskProgress represents the progress of a Promptbook execution.
6
- */
7
- export type TaskProgress = {
8
- /**
9
- * The unique name of the task.
10
- *
11
- * Note: This is not supposed to be displayed to the user.
12
- * It is used to identify the task in the code, for example as react key
13
- */
14
- readonly name: string_name;
15
- /**
16
- * Title of the task.
17
- *
18
- * Note: This is supposed to be displayed to the user.
19
- * Note: This is trimmed and stripped of HTML tags and emojis
20
- */
21
- readonly title: string_markdown_text;
22
- /**
23
- * Does the task started?
24
- */
25
- readonly isStarted: boolean;
26
- /**
27
- * Is task done?
28
- */
29
- readonly isDone: boolean;
30
- /**
31
- * The type of the execution.
32
- * Note: The pipeline executor reports everything, in the app level you can filter out the execution types that you don't want to show to the user.
33
- */
34
- readonly taskType: SectionType;
35
- /**
36
- * The parameter name that is being processed.
37
- */
38
- readonly parameterName: string_name;
39
- /**
40
- * The parameter value or null if the parameter is not yet processed.
41
- */
42
- readonly parameterValue: string | null;
43
- };