@promptbook/remote-server 0.75.0-1 → 0.75.0-4

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 (167) hide show
  1. package/README.md +28 -17
  2. package/esm/index.es.js +6 -1
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/{promptbook-collection → books}/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +28 -20
  6. package/esm/typings/src/_packages/types.index.d.ts +62 -52
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  8. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -0
  9. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -0
  10. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
  11. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -0
  12. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -0
  13. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -0
  14. package/esm/typings/src/cli/main.d.ts +1 -0
  15. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  16. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  17. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  18. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  19. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  20. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +3 -3
  21. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -2
  22. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  23. package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +2 -2
  24. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +2 -2
  25. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +2 -2
  26. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +11 -0
  27. package/esm/typings/src/commands/{TEMPLATE/templateCommandParser.d.ts → SECTION/sectionCommandParser.d.ts} +6 -6
  28. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  29. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +17 -19
  30. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +1 -1
  31. package/esm/typings/src/commands/index.d.ts +4 -1
  32. package/esm/typings/src/config.d.ts +11 -3
  33. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
  34. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  35. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +3 -3
  36. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
  37. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +4 -4
  38. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +15 -0
  39. package/esm/typings/src/conversion/utils/renameParameter.d.ts +3 -3
  40. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +3 -2
  41. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
  42. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  43. package/esm/typings/src/errors/index.d.ts +3 -0
  44. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
  45. package/esm/typings/src/execution/PromptResultUsage.d.ts +1 -1
  46. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  47. package/esm/typings/src/execution/createPipelineExecutor/{$OngoingTemplateResult.d.ts → $OngoingTaskResult.d.ts} +1 -1
  48. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
  49. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
  50. package/esm/typings/src/execution/createPipelineExecutor/{20-executeTemplate.d.ts → 20-executeTask.d.ts} +7 -7
  51. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -5
  52. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
  53. package/esm/typings/src/execution/createPipelineExecutor/{getContextForTemplate.d.ts → getContextForTask.d.ts} +2 -2
  54. package/esm/typings/src/execution/createPipelineExecutor/{getExamplesForTemplate.d.ts → getExamplesForTask.d.ts} +2 -2
  55. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +27 -0
  56. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +30 -0
  57. package/esm/typings/src/{types → execution}/execution-report/ExecutionPromptReportJson.d.ts +2 -2
  58. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportJson.d.ts +4 -4
  59. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportStringOptions.d.ts +1 -1
  60. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  61. package/esm/typings/src/execution/utils/usage-constants.d.ts +3 -0
  62. package/esm/typings/src/formats/index.d.ts +3 -0
  63. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  64. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +7 -1
  65. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -0
  66. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +45 -0
  67. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  68. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +3 -3
  69. package/esm/typings/src/formfactors/index.d.ts +85 -12
  70. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
  71. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +13 -3
  72. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +13 -3
  73. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  74. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
  75. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  76. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
  77. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  79. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  80. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
  81. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  82. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  83. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +26 -0
  84. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +14 -0
  85. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
  86. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
  87. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
  88. package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/CommonTaskJson.d.ts} +24 -24
  89. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  90. package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
  91. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
  92. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
  93. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +98 -0
  94. package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +5 -5
  95. package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +11 -11
  96. package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
  97. package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
  98. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  99. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  100. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  101. package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
  102. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
  103. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  104. package/esm/typings/src/prepare/prepareTasks.d.ts +32 -0
  105. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
  106. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  107. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
  108. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  109. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  110. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  111. package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
  112. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  113. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  114. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
  115. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  116. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  117. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
  118. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  119. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  120. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
  121. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  122. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  123. package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
  124. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
  125. package/esm/typings/src/types/Prompt.d.ts +4 -4
  126. package/esm/typings/src/types/SectionType.d.ts +21 -0
  127. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  128. package/esm/typings/src/types/TaskType.d.ts +15 -0
  129. package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
  130. package/esm/typings/src/types/typeAliases.d.ts +2 -1
  131. package/esm/typings/src/utils/emojis.d.ts +1 -0
  132. package/esm/typings/src/utils/expectation-counters/constants.d.ts +1 -0
  133. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  134. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  135. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  136. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  137. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  138. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  139. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
  140. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
  141. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  142. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
  143. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
  144. package/esm/typings/src/version.d.ts +2 -1
  145. package/package.json +5 -4
  146. package/umd/index.umd.js +6 -1
  147. package/umd/index.umd.js.map +1 -1
  148. package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
  149. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
  150. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +0 -15
  151. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  152. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  153. package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +0 -15
  154. package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +0 -22
  155. package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +0 -9
  156. package/esm/typings/src/prepare/prepareTemplates.d.ts +0 -32
  157. package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
  158. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
  159. package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
  160. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
  161. package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
  162. /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
  163. /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
  164. /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
  165. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
  166. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
  167. /package/esm/typings/src/{types → execution}/execution-report/executionReportJsonToString.d.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  import type { string_formfactor_name } from '../../formfactors/_common/string_formfactor_name';
2
- import type { ModelRequirements } from '../ModelRequirements';
3
- import type { string_filename } from '../typeAliases';
4
- import type { string_markdown_text } from '../typeAliases';
5
- import type { string_pipeline_url } from '../typeAliases';
6
- import type { string_semantic_version } from '../typeAliases';
2
+ import type { ModelRequirements } from '../../types/ModelRequirements';
3
+ import type { string_filename } from '../../types/typeAliases';
4
+ import type { string_markdown_text } from '../../types/typeAliases';
5
+ import type { string_pipeline_url } from '../../types/typeAliases';
6
+ import type { string_semantic_version } from '../../types/typeAliases';
7
7
  import type { KnowledgePiecePreparedJson } from './KnowledgePieceJson';
8
8
  import type { KnowledgeSourceJson } from './KnowledgeSourceJson';
9
9
  import type { KnowledgeSourcePreparedJson } from './KnowledgeSourceJson';
@@ -11,10 +11,10 @@ import type { ParameterJson } from './ParameterJson';
11
11
  import type { PersonaJson } from './PersonaJson';
12
12
  import type { PersonaPreparedJson } from './PersonaJson';
13
13
  import type { PreparationJson } from './PreparationJson';
14
- import type { TemplateJson } from './TemplateJson';
14
+ import type { TaskJson } from './TaskJson';
15
15
  /**
16
16
  * Promptbook is the **core concept of this package**.
17
- * It represents a series of templates 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
  /**
@@ -60,13 +60,13 @@ export type PipelineJson = {
60
60
  */
61
61
  readonly parameters: Array<ParameterJson>;
62
62
  /**
63
- * Default model requirements for the model for all `templates`
63
+ * Default model requirements for the model for all `tasks`
64
64
  */
65
65
  readonly defaultModelRequirements?: Partial<ModelRequirements>;
66
66
  /**
67
- * Sequence of templates that are chained together to form a pipeline
67
+ * Sequence of tasks that are chained together to form a pipeline
68
68
  */
69
- readonly templates: Array<TemplateJson>;
69
+ readonly tasks: Array<TaskJson>;
70
70
  /**
71
71
  * Set of information that are used as external knowledge in the pipeline
72
72
  *
@@ -1,6 +1,6 @@
1
1
  import type { PromptResultUsage } from '../../execution/PromptResultUsage';
2
+ import type { number_id } from '../../types/typeAliases';
2
3
  import type { string_promptbook_version } from '../../version';
3
- import type { number_id } from '../typeAliases';
4
4
  export type PreparationJson = {
5
5
  /**
6
6
  * Incremental ID of the preparation
@@ -1,25 +1,25 @@
1
- import type { ModelRequirements } from '../ModelRequirements';
2
- import type { string_name } from '../typeAliases';
3
- import type { TemplateJsonCommon } from './TemplateJsonCommon';
1
+ import type { ModelRequirements } from '../../types/ModelRequirements';
2
+ import type { string_name } from '../../types/typeAliases';
3
+ import type { CommonTaskJson } from './CommonTaskJson';
4
4
  /**
5
- * Template for prompt to LLM
5
+ * Task for prompt to LLM
6
6
  *
7
7
  * Note: [🚉] This is fully serializable as JSON
8
8
  */
9
- export type PromptTemplateJson = TemplateJsonCommon & {
10
- readonly templateType: 'PROMPT_TEMPLATE';
9
+ export type PromptTaskJson = CommonTaskJson & {
10
+ readonly taskType: 'PROMPT_TASK';
11
11
  /**
12
12
  * Name of the persona who will be responding to this prompt
13
13
  */
14
14
  readonly personaName?: string_name;
15
15
  /**
16
16
  * Requirements for the model
17
- * - This is required only for templateType PROMPT_TEMPLATE
17
+ * - This is required only for taskType PROMPT_TASK
18
18
  */
19
19
  readonly modelRequirements?: Partial<ModelRequirements>;
20
20
  };
21
21
  /**
22
- * TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
22
+ * TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each task
23
23
  * @see https://github.com/webgptorg/promptbook/discussions/79
24
24
  * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
25
25
  * TODO: [🍙] Make some standard order of json properties
@@ -0,0 +1,20 @@
1
+ import type { ScriptLanguage } from '../../types/ScriptLanguage';
2
+ import type { CommonTaskJson } from './CommonTaskJson';
3
+ /**
4
+ * Task for script execution
5
+ *
6
+ * Note: [🚉] This is fully serializable as JSON
7
+ * @see https://github.com/webgptorg/promptbook/discussions/77
8
+ */
9
+ export type ScriptTaskJson = CommonTaskJson & {
10
+ readonly taskType: 'SCRIPT_TASK';
11
+ /**
12
+ * Language of the script
13
+ * - This is required only for taskType SCRIPT
14
+ *
15
+ */
16
+ readonly contentLanguage?: ScriptLanguage;
17
+ };
18
+ /**
19
+ * TODO: [🍙] Make some standard order of json properties
20
+ */
@@ -0,0 +1,13 @@
1
+ import type { CommonTaskJson } from './CommonTaskJson';
2
+ /**
3
+ * Task for simple concatenation of strings
4
+ *
5
+ * Note: [🚉] This is fully serializable as JSON
6
+ * @see https://github.com/webgptorg/promptbook/discussions/17
7
+ */
8
+ export type SimpleTaskJson = CommonTaskJson & {
9
+ readonly taskType: 'SIMPLE_TASK';
10
+ };
11
+ /**
12
+ * TODO: [🍙] Make some standard order of json properties
13
+ */
@@ -0,0 +1,11 @@
1
+ import type { ___or___ } from '../../utils/organization/___or___';
2
+ import type { DialogTaskJson } from './DialogTaskJson';
3
+ import type { PromptTaskJson } from './PromptTaskJson';
4
+ import type { ScriptTaskJson } from './ScriptTaskJson';
5
+ import type { SimpleTaskJson } from './SimpleTaskJson';
6
+ /**
7
+ * Describes one (prompt) task in the pipeline
8
+ *
9
+ * Note: [🚉] This is fully serializable as JSON
10
+ */
11
+ export type TaskJson = PromptTaskJson | SimpleTaskJson | ScriptTaskJson | DialogTaskJson | ___or___ | ___or___;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Promptbook is the **core concept of this package**.
3
- * It represents a series of templates 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
  */
@@ -1,4 +1,4 @@
1
- import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
1
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
2
2
  /**
3
3
  * Determine if the pipeline is fully prepared
4
4
  *
@@ -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
- * - [♨] Are templates prepared
15
+ * - [♨] Are tasks prepared
16
16
  */
@@ -1,5 +1,5 @@
1
1
  import type { ExecutionTools } from '../execution/ExecutionTools';
2
- import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
2
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
3
  import type { PrepareAndScrapeOptions } from './PrepareAndScrapeOptions';
4
4
  /**
5
5
  * Prepare pipeline from string (markdown) format to JSON format
@@ -0,0 +1,32 @@
1
+ import type { ExecutionTools } from '../execution/ExecutionTools';
2
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
3
+ import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
4
+ import type { PrepareAndScrapeOptions } from './PrepareAndScrapeOptions';
5
+ type PrepareTaskInput = Pick<PipelineJson, 'tasks' | 'parameters'> & {
6
+ /**
7
+ * @@@
8
+ */
9
+ readonly knowledgePiecesCount: number;
10
+ };
11
+ type PreparedTasks = {
12
+ /**
13
+ * @@@ Sequence of tasks that are chained together to form a pipeline
14
+ */
15
+ readonly tasksPrepared: ReadonlyArray<TaskJson>;
16
+ };
17
+ /**
18
+ * @@@
19
+ *
20
+ * @public exported from `@promptbook/core`
21
+ */
22
+ export declare function prepareTasks(pipeline: PrepareTaskInput, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PreparedTasks>;
23
+ export {};
24
+ /**
25
+ * TODO: [🧠] Add context to each task (if missing)
26
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
27
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
28
+ * TODO: Write tests for `preparePipeline`
29
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
30
+ * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
31
+ * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
32
+ */
@@ -1,4 +1,4 @@
1
- import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
1
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
2
2
  /**
3
3
  * Unprepare just strips the preparation data of the pipeline
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import type { Promisable } from 'type-fest';
2
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
2
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
3
3
  import type { string_filename } from '../../types/typeAliases';
4
4
  import type { string_knowledge_source_link } from '../../types/typeAliases';
5
5
  import type { string_mime_type } from '../../types/typeAliases';
@@ -1,6 +1,6 @@
1
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
+ import type { KnowledgeSourceJson } from '../../pipeline/PipelineJson/KnowledgeSourceJson';
1
3
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
2
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
3
- import type { KnowledgeSourceJson } from '../../types/PipelineJson/KnowledgeSourceJson';
4
4
  import type { ExecutionTools } from '../../execution/ExecutionTools';
5
5
  /**
6
6
  * Prepares the knowle
@@ -1,7 +1,7 @@
1
1
  import type { SetOptional } from 'type-fest';
2
2
  import type { ExecutionTools } from '../../../execution/ExecutionTools';
3
+ import type { KnowledgeSourceJson } from '../../../pipeline/PipelineJson/KnowledgeSourceJson';
3
4
  import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
4
- import type { KnowledgeSourceJson } from '../../../types/PipelineJson/KnowledgeSourceJson';
5
5
  import type { ScraperSourceHandler } from '../Scraper';
6
6
  /**
7
7
  * @@@
@@ -1,4 +1,4 @@
1
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
1
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
2
  import type { ExecutionTools } from '../../execution/ExecutionTools';
3
3
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
4
4
  import type { Converter } from '../_common/Converter';
@@ -10,4 +10,5 @@ import type { Registration } from '../../utils/$Register';
10
10
  export declare const _DocumentScraperRegistration: Registration;
11
11
  /**
12
12
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13
14
  */
@@ -22,3 +22,6 @@ export declare const documentScraperMetadata: import("type-fest/source/readonly-
22
22
  * @public exported from `@promptbook/cli`
23
23
  */
24
24
  export declare const _DocumentScraperMetadataRegistration: Registration;
25
+ /**
26
+ * Note: [💞] Ignore a discrepancy between file name and entity name
27
+ */
@@ -1,4 +1,4 @@
1
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
1
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
2
  import type { ExecutionTools } from '../../execution/ExecutionTools';
3
3
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
4
4
  import type { Converter } from '../_common/Converter';
@@ -10,4 +10,5 @@ import type { Registration } from '../../utils/$Register';
10
10
  export declare const _LegacyDocumentScraperRegistration: Registration;
11
11
  /**
12
12
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13
14
  */
@@ -22,3 +22,6 @@ export declare const legacyDocumentScraperMetadata: import("type-fest/source/rea
22
22
  * @public exported from `@promptbook/cli`
23
23
  */
24
24
  export declare const _LegacyDocumentScraperMetadataRegistration: Registration;
25
+ /**
26
+ * Note: [💞] Ignore a discrepancy between file name and entity name
27
+ */
@@ -1,4 +1,4 @@
1
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
1
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
2
  import type { Scraper } from '../_common/Scraper';
3
3
  import type { ScraperSourceHandler } from '../_common/Scraper';
4
4
  import type { ExecutionTools } from '../../execution/ExecutionTools';
@@ -10,4 +10,5 @@ import type { Registration } from '../../utils/$Register';
10
10
  export declare const _MarkdownScraperRegistration: Registration;
11
11
  /**
12
12
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13
14
  */
@@ -22,3 +22,6 @@ export declare const markdownScraperMetadata: import("type-fest/source/readonly-
22
22
  * @public exported from `@promptbook/cli`
23
23
  */
24
24
  export declare const _MarkdownScraperMetadataRegistration: Registration;
25
+ /**
26
+ * Note: [💞] Ignore a discrepancy between file name and entity name
27
+ */
@@ -1,4 +1,4 @@
1
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
1
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
2
  import type { Scraper } from '../_common/Scraper';
3
3
  import type { ScraperSourceHandler } from '../_common/Scraper';
4
4
  import type { ExecutionTools } from '../../execution/ExecutionTools';
@@ -10,4 +10,5 @@ import type { Registration } from '../../utils/$Register';
10
10
  export declare const _PdfScraperRegistration: Registration;
11
11
  /**
12
12
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13
14
  */
@@ -22,3 +22,6 @@ export declare const pdfScraperMetadata: import("type-fest/source/readonly-deep"
22
22
  * @public exported from `@promptbook/cli`
23
23
  */
24
24
  export declare const _PdfScraperMetadataRegistration: Registration;
25
+ /**
26
+ * Note: [💞] Ignore a discrepancy between file name and entity name
27
+ */
@@ -1,4 +1,4 @@
1
- import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson';
1
+ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson';
2
2
  import type { string_markdown } from '../../types/typeAliases';
3
3
  import type { Converter } from '../_common/Converter';
4
4
  import type { Scraper } from '../_common/Scraper';
@@ -10,4 +10,5 @@ import type { Registration } from '../../utils/$Register';
10
10
  export declare const _WebsiteScraperRegistration: Registration;
11
11
  /**
12
12
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13
14
  */
@@ -22,3 +22,6 @@ export declare const websiteScraperMetadata: import("type-fest/source/readonly-d
22
22
  * @public exported from `@promptbook/cli`
23
23
  */
24
24
  export declare const _WebsiteScraperMetadataRegistration: Registration;
25
+ /**
26
+ * Note: [💞] Ignore a discrepancy between file name and entity name
27
+ */
@@ -48,4 +48,5 @@ export declare const POSTPROCESSING_FUNCTIONS: {
48
48
  };
49
49
  /**
50
50
  * TODO: DRY [🍯], [🧠] Where should be POSTPROCESSING_FUNCTIONS located and how it should be named
51
+ * Note: [💞] Ignore a discrepancy between file name and entity name
51
52
  */
@@ -1,11 +1,11 @@
1
1
  import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
2
+ import type { Expectations } from '../pipeline/PipelineJson/Expectations';
2
3
  import type { ChatModelRequirements } from './ModelRequirements';
3
4
  import type { CompletionModelRequirements } from './ModelRequirements';
4
5
  import type { EmbeddingModelRequirements } from './ModelRequirements';
5
6
  import type { ModelRequirements } from './ModelRequirements';
6
- import type { Expectations } from './PipelineJson/Expectations';
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 { TemplateType } from '../commands/TEMPLATE/TemplateTypes';
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
  /**
@@ -31,7 +31,7 @@ export type TaskProgress = {
31
31
  * The type of the execution.
32
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
33
  */
34
- readonly templateType: TemplateType;
34
+ readonly taskType: SectionType;
35
35
  /**
36
36
  * The parameter name that is being processed.
37
37
  */
@@ -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"];