@promptbook/documents 0.103.0-9 → 0.103.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 (273) hide show
  1. package/README.md +59 -39
  2. package/esm/index.es.js +320 -231
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +0 -81
  5. package/esm/typings/servers.d.ts +9 -7
  6. package/esm/typings/src/_packages/browser.index.d.ts +6 -0
  7. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  8. package/esm/typings/src/_packages/components.index.d.ts +22 -8
  9. package/esm/typings/src/_packages/core.index.d.ts +58 -18
  10. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -0
  12. package/esm/typings/src/_packages/types.index.d.ts +70 -8
  13. package/esm/typings/src/_packages/utils.index.d.ts +6 -0
  14. package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
  15. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +20 -5
  16. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +17 -1
  17. package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
  18. package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
  19. package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +3 -3
  20. package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
  21. package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
  22. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +18 -0
  23. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
  24. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +3 -0
  25. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
  26. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +85 -14
  27. package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +18 -0
  28. package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
  29. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +17 -0
  30. package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
  31. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +16 -0
  32. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
  33. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
  34. package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
  35. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  36. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
  37. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
  38. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  39. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
  40. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
  41. package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
  42. package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
  43. package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
  44. package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
  45. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
  46. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
  47. package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +2 -2
  48. package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
  49. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
  50. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +11 -0
  51. package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
  52. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
  53. package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
  54. package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
  55. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
  56. package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
  57. package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
  58. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
  59. package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
  60. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
  61. package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
  62. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
  63. package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
  64. package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
  65. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  66. package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
  67. package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
  68. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
  69. package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
  70. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
  71. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
  72. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
  73. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
  74. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
  75. package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
  76. package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
  77. package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
  78. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
  79. package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
  80. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
  81. package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
  82. package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
  83. package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
  84. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
  85. package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
  86. package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +39 -0
  87. package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
  88. package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
  89. package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
  90. package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
  91. package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
  92. package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
  93. package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
  94. package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
  95. package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
  96. package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
  97. package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
  98. package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
  99. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
  100. package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
  101. package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
  102. package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
  103. package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
  104. package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
  105. package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
  106. package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
  107. package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
  108. package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
  109. package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
  110. package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
  111. package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
  112. package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
  113. package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
  114. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
  115. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
  116. package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
  117. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
  118. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +14 -2
  119. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
  120. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
  121. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  122. package/esm/typings/src/commitments/index.d.ts +93 -0
  123. package/esm/typings/src/config.d.ts +24 -3
  124. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
  125. package/esm/typings/src/errors/0-index.d.ts +6 -0
  126. package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
  127. package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
  128. package/esm/typings/src/errors/WrappedError.d.ts +2 -2
  129. package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
  130. package/esm/typings/src/execution/Executables.d.ts +3 -0
  131. package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
  132. package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
  133. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  134. package/esm/typings/src/execution/LlmExecutionTools.d.ts +26 -2
  135. package/esm/typings/src/execution/PromptResult.d.ts +7 -1
  136. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
  137. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
  138. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
  139. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
  140. package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
  141. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
  142. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
  143. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
  144. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
  145. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  146. package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
  147. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
  148. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
  149. package/esm/typings/src/llm-providers/agent/Agent.d.ts +72 -0
  150. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
  151. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
  152. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
  153. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
  154. package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
  155. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
  156. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  157. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  158. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +4 -0
  159. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
  160. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
  161. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +13 -1
  162. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
  163. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +6 -6
  164. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  165. package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
  166. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  167. package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
  168. package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
  169. package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
  170. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  171. package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
  172. package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
  173. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
  174. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
  175. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
  176. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
  177. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
  178. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
  179. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
  180. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
  181. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
  182. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
  183. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
  184. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
  185. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
  186. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
  187. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
  188. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  189. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
  190. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
  191. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
  192. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
  193. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
  194. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
  195. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
  196. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
  197. package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
  198. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
  199. package/esm/typings/src/types/LlmCall.d.ts +20 -0
  200. package/esm/typings/src/types/ModelRequirements.d.ts +13 -1
  201. package/esm/typings/src/types/ModelVariant.d.ts +1 -1
  202. package/esm/typings/src/types/Prompt.d.ts +13 -1
  203. package/esm/typings/src/types/Updatable.d.ts +19 -0
  204. package/esm/typings/src/types/typeAliases.d.ts +38 -2
  205. package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
  206. package/esm/typings/src/utils/color/Color.d.ts +16 -1
  207. package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
  208. package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
  209. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
  210. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  211. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  212. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  213. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  214. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  215. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  216. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
  217. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
  218. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
  219. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
  220. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
  221. package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
  222. package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
  223. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
  224. package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
  225. package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
  226. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
  227. package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
  228. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
  229. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  230. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  231. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
  232. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
  233. package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
  234. package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
  235. package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
  236. package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
  237. package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
  238. package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
  239. package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
  240. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +31 -0
  241. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
  242. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
  243. package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
  244. package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
  245. package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
  246. package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
  247. package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
  248. package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
  249. package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
  250. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
  251. package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
  252. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  253. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
  254. package/esm/typings/src/version.d.ts +1 -1
  255. package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
  256. package/package.json +7 -7
  257. package/umd/index.umd.js +288 -199
  258. package/umd/index.umd.js.map +1 -1
  259. package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
  260. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
  261. package/esm/typings/src/book-components/BookEditor/BookEditorWrapper.d.ts +0 -9
  262. package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
  263. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
  264. package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
  265. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  266. /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
  267. /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
  268. /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
  269. /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
  270. /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
  271. /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
  272. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
  273. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { mkdir, rm, readFile } from 'fs/promises';
2
- import spaceTrim$1, { spaceTrim } from 'spacetrim';
2
+ import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import { spawn } from 'child_process';
4
4
  import colors from 'colors';
5
5
  import { forTime } from 'waitasecond';
@@ -19,14 +19,14 @@ import { parse, unparse } from 'papaparse';
19
19
  * @generated
20
20
  * @see https://github.com/webgptorg/book
21
21
  */
22
- const BOOK_LANGUAGE_VERSION = '1.0.0';
22
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
23
23
  /**
24
24
  * The version of the Promptbook engine
25
25
  *
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-9';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -49,6 +49,17 @@ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-9';
49
49
  function keepUnused(...valuesToKeep) {
50
50
  }
51
51
 
52
+ /**
53
+ * Trims string from all 4 sides
54
+ *
55
+ * Note: This is a re-exported function from the `spacetrim` package which is
56
+ * Developed by same author @hejny as this package
57
+ *
58
+ * @public exported from `@promptbook/utils`
59
+ * @see https://github.com/hejny/spacetrim#usage
60
+ */
61
+ const spaceTrim = spaceTrim$1;
62
+
52
63
  /**
53
64
  * @private util of `@promptbook/color`
54
65
  * @de
@@ -97,6 +108,7 @@ function take(initialValue) {
97
108
  * @public exported from `@promptbook/color`
98
109
  */
99
110
  const CSS_COLORS = {
111
+ promptbook: '#79EAFD',
100
112
  transparent: 'rgba(0,0,0,0)',
101
113
  aliceblue: '#f0f8ff',
102
114
  antiquewhite: '#faebd7',
@@ -278,9 +290,6 @@ function checkChannelValue(channelName, value) {
278
290
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
279
291
  }
280
292
  }
281
- /**
282
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
283
- */
284
293
 
285
294
  /**
286
295
  * Color object represents an RGB color with alpha channel
@@ -300,21 +309,61 @@ class Color {
300
309
  * @param color
301
310
  * @returns Color object
302
311
  */
303
- static from(color) {
304
- if (color instanceof Color) {
312
+ static from(color, _isSingleValue = false) {
313
+ if (color === '') {
314
+ throw new Error(`Can not create color from empty string`);
315
+ }
316
+ else if (color instanceof Color) {
305
317
  return take(color);
306
318
  }
307
319
  else if (Color.isColor(color)) {
308
320
  return take(color);
309
321
  }
310
322
  else if (typeof color === 'string') {
311
- return Color.fromString(color);
323
+ try {
324
+ return Color.fromString(color);
325
+ }
326
+ catch (error) {
327
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
328
+ if (_isSingleValue) {
329
+ throw error;
330
+ }
331
+ const parts = color.split(/[\s+,;|]/);
332
+ if (parts.length > 0) {
333
+ return Color.from(parts[0].trim(), true);
334
+ }
335
+ else {
336
+ throw new Error(`Can not create color from given string "${color}"`);
337
+ }
338
+ }
312
339
  }
313
340
  else {
314
341
  console.error({ color });
315
342
  throw new Error(`Can not create color from given object`);
316
343
  }
317
344
  }
345
+ /**
346
+ * Creates a new Color instance from miscellaneous formats
347
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
348
+ *
349
+ * @param color
350
+ * @returns Color object
351
+ */
352
+ static fromSafe(color) {
353
+ try {
354
+ return Color.from(color);
355
+ }
356
+ catch (error) {
357
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
358
+ console.warn(spaceTrim((block) => `
359
+ Color.fromSafe error:
360
+ ${block(error.message)}
361
+
362
+ Returning default PROMPTBOOK_COLOR.
363
+ `));
364
+ return Color.fromString('promptbook');
365
+ }
366
+ }
318
367
  /**
319
368
  * Creates a new Color instance from miscellaneous string formats
320
369
  *
@@ -382,6 +431,9 @@ class Color {
382
431
  if (hex.length === 3) {
383
432
  return Color.fromHex3(hex);
384
433
  }
434
+ if (hex.length === 4) {
435
+ return Color.fromHex4(hex);
436
+ }
385
437
  if (hex.length === 6) {
386
438
  return Color.fromHex6(hex);
387
439
  }
@@ -402,6 +454,19 @@ class Color {
402
454
  const b = parseInt(hex.substr(2, 1), 16) * 16;
403
455
  return take(new Color(r, g, b));
404
456
  }
457
+ /**
458
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
459
+ *
460
+ * @param color in hex for example `09df`
461
+ * @returns Color object
462
+ */
463
+ static fromHex4(hex) {
464
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
465
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
466
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
467
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
468
+ return take(new Color(r, g, b, a));
469
+ }
405
470
  /**
406
471
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
407
472
  *
@@ -592,7 +657,8 @@ class Color {
592
657
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
593
658
  */
594
659
  static isHexColorString(value) {
595
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
660
+ return (typeof value === 'string' &&
661
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
596
662
  }
597
663
  /**
598
664
  * Creates new Color object
@@ -707,6 +773,23 @@ class Color {
707
773
  * TODO: Maybe connect with textures
708
774
  */
709
775
 
776
+ /**
777
+ * Makes color transformer which returns a grayscale version of the color
778
+ *
779
+ * @param amount from 0 to 1
780
+ *
781
+ * @public exported from `@promptbook/color`
782
+ */
783
+ function grayscale(amount) {
784
+ return ({ red, green, blue, alpha }) => {
785
+ const average = (red + green + blue) / 3;
786
+ red = Math.round(average * amount + red * (1 - amount));
787
+ green = Math.round(average * amount + green * (1 - amount));
788
+ blue = Math.round(average * amount + blue * (1 - amount));
789
+ return Color.fromValues(red, green, blue, alpha);
790
+ };
791
+ }
792
+
710
793
  /**
711
794
  * Converts HSL values to RGB values
712
795
  *
@@ -822,102 +905,6 @@ function lighten(amount) {
822
905
  * TODO: Maybe implement by mix+hsl
823
906
  */
824
907
 
825
- /**
826
- * Calculates distance between two colors
827
- *
828
- * @param color1 first color
829
- * @param color2 second color
830
- *
831
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
832
- *
833
- * @public exported from `@promptbook/color`
834
- */
835
- /**
836
- * Calculates distance between two colors without square root
837
- *
838
- * @param color1 first color
839
- * @param color2 second color
840
- *
841
- * @public exported from `@promptbook/color`
842
- */
843
- function colorDistanceSquared(color1, color2) {
844
- const rmean = (color1.red + color2.red) / 2;
845
- const r = color1.red - color2.red;
846
- const g = color1.green - color2.green;
847
- const b = color1.blue - color2.blue;
848
- const weightR = 2 + rmean / 256;
849
- const weightG = 4.0;
850
- const weightB = 2 + (255 - rmean) / 256;
851
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
852
- return distance;
853
- }
854
-
855
- /**
856
- * Makes color transformer which finds the nearest color from the given list
857
- *
858
- * @param colors array of colors to choose from
859
- *
860
- * @public exported from `@promptbook/color`
861
- */
862
- function nearest(...colors) {
863
- return (color) => {
864
- const distances = colors.map((c) => colorDistanceSquared(c, color));
865
- const minDistance = Math.min(...distances);
866
- const minIndex = distances.indexOf(minDistance);
867
- const nearestColor = colors[minIndex];
868
- return nearestColor;
869
- };
870
- }
871
-
872
- /**
873
- * Color transformer which returns the negative color
874
- *
875
- * @public exported from `@promptbook/color`
876
- */
877
- function negative(color) {
878
- const r = 255 - color.red;
879
- const g = 255 - color.green;
880
- const b = 255 - color.blue;
881
- return Color.fromValues(r, g, b, color.alpha);
882
- }
883
-
884
- /**
885
- * Makes color transformer which finds the furthest color from the given list
886
- *
887
- * @param colors array of colors to choose from
888
- *
889
- * @public exported from `@promptbook/color`
890
- */
891
- function furthest(...colors) {
892
- return (color) => {
893
- const furthestColor = negative(nearest(...colors.map(negative))(color));
894
- return furthestColor;
895
- };
896
- }
897
- /**
898
- * Makes color transformer which finds the best text color (black or white) for the given background color
899
- *
900
- * @public exported from `@promptbook/color`
901
- */
902
- furthest(Color.get('white'), Color.from('black'));
903
-
904
- /**
905
- * Makes color transformer which returns a grayscale version of the color
906
- *
907
- * @param amount from 0 to 1
908
- *
909
- * @public exported from `@promptbook/color`
910
- */
911
- function grayscale(amount) {
912
- return ({ red, green, blue, alpha }) => {
913
- const average = (red + green + blue) / 3;
914
- red = Math.round(average * amount + red * (1 - amount));
915
- green = Math.round(average * amount + green * (1 - amount));
916
- blue = Math.round(average * amount + blue * (1 - amount));
917
- return Color.fromValues(red, green, blue, alpha);
918
- };
919
- }
920
-
921
908
  /**
922
909
  * Makes color transformer which saturate the given color
923
910
  *
@@ -986,16 +973,32 @@ const ADMIN_GITHUB_NAME = 'hejny';
986
973
  *
987
974
  * @public exported from `@promptbook/core`
988
975
  */
989
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
990
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
976
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
977
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
991
978
  /**
992
- * Dark color of the Promptbook
979
+ * Colors for syntax highlighting in the `<BookEditor/>`
980
+ *
981
+ * TODO: [🗽] Unite branding and make single place for it
982
+ *
983
+ * @public exported from `@promptbook/core`
984
+ */
985
+ ({
986
+ TITLE: Color.fromHex('#244EA8'),
987
+ LINE: Color.fromHex('#eeeeee'),
988
+ SEPARATOR: Color.fromHex('#cccccc'),
989
+ COMMITMENT: Color.fromHex('#DA0F78'),
990
+ PARAMETER: Color.fromHex('#8e44ad'),
991
+ });
992
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
993
+ /**
994
+ * Chat color of the Promptbook (in chat)
993
995
  *
994
996
  * TODO: [🗽] Unite branding and make single place for it
995
997
  *
996
998
  * @public exported from `@promptbook/core`
997
999
  */
998
1000
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1001
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
999
1002
  /**
1000
1003
  * Color of the user (in chat)
1001
1004
  *
@@ -1004,6 +1007,7 @@ PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1004
1007
  * @public exported from `@promptbook/core`
1005
1008
  */
1006
1009
  Color.fromHex('#1D4ED8');
1010
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1007
1011
  /**
1008
1012
  * When the title is not provided, the default title is used
1009
1013
  *
@@ -1090,7 +1094,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
1090
1094
  * @public exported from `@promptbook/core`
1091
1095
  */
1092
1096
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1093
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1097
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1094
1098
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1095
1099
  /**
1096
1100
  * Where to store the temporary downloads
@@ -1192,7 +1196,7 @@ class KnowledgeScrapeError extends Error {
1192
1196
  */
1193
1197
  class MissingToolsError extends Error {
1194
1198
  constructor(message) {
1195
- super(spaceTrim((block) => `
1199
+ super(spaceTrim$1((block) => `
1196
1200
  ${block(message)}
1197
1201
 
1198
1202
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -1211,7 +1215,7 @@ class MissingToolsError extends Error {
1211
1215
  function getErrorReportUrl(error) {
1212
1216
  const report = {
1213
1217
  title: `🐜 Error report from ${NAME}`,
1214
- body: spaceTrim$1((block) => `
1218
+ body: spaceTrim$2((block) => `
1215
1219
 
1216
1220
 
1217
1221
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1254,7 +1258,7 @@ function getErrorReportUrl(error) {
1254
1258
  */
1255
1259
  class UnexpectedError extends Error {
1256
1260
  constructor(message) {
1257
- super(spaceTrim((block) => `
1261
+ super(spaceTrim$1((block) => `
1258
1262
  ${block(message)}
1259
1263
 
1260
1264
  Note: This error should not happen.
@@ -1415,11 +1419,11 @@ function $execCommand(options) {
1415
1419
  console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
1416
1420
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
1417
1421
  }
1418
- resolve(spaceTrim(output.join('\n')));
1422
+ resolve(spaceTrim$1(output.join('\n')));
1419
1423
  }
1420
1424
  }
1421
1425
  else {
1422
- resolve(spaceTrim(output.join('\n')));
1426
+ resolve(spaceTrim$1(output.join('\n')));
1423
1427
  }
1424
1428
  };
1425
1429
  commandProcess.on('close', finishWithCode);
@@ -1437,7 +1441,7 @@ function $execCommand(options) {
1437
1441
  console.warn(error);
1438
1442
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
1439
1443
  }
1440
- resolve(spaceTrim(output.join('\n')));
1444
+ resolve(spaceTrim$1(output.join('\n')));
1441
1445
  }
1442
1446
  });
1443
1447
  }
@@ -1762,6 +1766,8 @@ function removeDiacritics(input) {
1762
1766
  /**
1763
1767
  * Converts a given text to kebab-case format.
1764
1768
  *
1769
+ * Note: [🔂] This function is idempotent.
1770
+ *
1765
1771
  * @param text The text to be converted.
1766
1772
  * @returns The kebab-case formatted string.
1767
1773
  * @example 'hello-world'
@@ -1917,6 +1923,8 @@ function removeEmojis(text) {
1917
1923
  /**
1918
1924
  * Converts a title string into a normalized name.
1919
1925
  *
1926
+ * Note: [🔂] This function is idempotent.
1927
+ *
1920
1928
  * @param value The title string to be converted to a name.
1921
1929
  * @returns A normalized name derived from the input title.
1922
1930
  * @example 'Hello World!' -> 'hello-world'
@@ -2008,7 +2016,7 @@ async function getScraperIntermediateSource(source, options) {
2008
2016
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2009
2017
  */
2010
2018
 
2011
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-8",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
2019
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
2012
2020
 
2013
2021
  /**
2014
2022
  * Checks if value is valid email
@@ -2050,7 +2058,7 @@ class WrappedError extends Error {
2050
2058
  constructor(whatWasThrown) {
2051
2059
  const tag = `[🤮]`;
2052
2060
  console.error(tag, whatWasThrown);
2053
- super(spaceTrim(`
2061
+ super(spaceTrim$1(`
2054
2062
  Non-Error object was thrown
2055
2063
 
2056
2064
  Note: Look for ${tag} in the console for more details
@@ -2115,6 +2123,8 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
2115
2123
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
2116
2124
  * It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
2117
2125
  *
2126
+ * Note: [🔂] This function is idempotent.
2127
+ *
2118
2128
  * @param {string} pipelineString the candidate for a pipeline string
2119
2129
  * @returns {PipelineString} the same string as input, but validated as valid
2120
2130
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2274,7 +2284,7 @@ function pipelineJsonToString(pipelineJson) {
2274
2284
  pipelineString += '\n\n';
2275
2285
  pipelineString += '```' + contentLanguage;
2276
2286
  pipelineString += '\n';
2277
- pipelineString += spaceTrim$1(content);
2287
+ pipelineString += spaceTrim$2(content);
2278
2288
  // <- TODO: [main] !!3 Escape
2279
2289
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2280
2290
  pipelineString += '\n';
@@ -2395,7 +2405,7 @@ function checkSerializableAsJson(options) {
2395
2405
  }
2396
2406
  else if (typeof value === 'object') {
2397
2407
  if (value instanceof Date) {
2398
- throw new UnexpectedError(spaceTrim$1((block) => `
2408
+ throw new UnexpectedError(spaceTrim$2((block) => `
2399
2409
  \`${name}\` is Date
2400
2410
 
2401
2411
  Use \`string_date_iso8601\` instead
@@ -2414,7 +2424,7 @@ function checkSerializableAsJson(options) {
2414
2424
  throw new UnexpectedError(`${name} is RegExp`);
2415
2425
  }
2416
2426
  else if (value instanceof Error) {
2417
- throw new UnexpectedError(spaceTrim$1((block) => `
2427
+ throw new UnexpectedError(spaceTrim$2((block) => `
2418
2428
  \`${name}\` is unserialized Error
2419
2429
 
2420
2430
  Use function \`serializeError\`
@@ -2437,7 +2447,7 @@ function checkSerializableAsJson(options) {
2437
2447
  }
2438
2448
  catch (error) {
2439
2449
  assertsError(error);
2440
- throw new UnexpectedError(spaceTrim$1((block) => `
2450
+ throw new UnexpectedError(spaceTrim$2((block) => `
2441
2451
  \`${name}\` is not serializable
2442
2452
 
2443
2453
  ${block(error.stack || error.message)}
@@ -2469,7 +2479,7 @@ function checkSerializableAsJson(options) {
2469
2479
  }
2470
2480
  }
2471
2481
  else {
2472
- throw new UnexpectedError(spaceTrim$1((block) => `
2482
+ throw new UnexpectedError(spaceTrim$2((block) => `
2473
2483
  \`${name}\` is unknown type
2474
2484
 
2475
2485
  Additional message for \`${name}\`:
@@ -2499,7 +2509,7 @@ function deepClone(objectValue) {
2499
2509
  TODO: [🧠] Is there a better implementation?
2500
2510
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
2501
2511
  > for (const propertyName of propertyNames) {
2502
- > const value = (objectValue as really_any)[propertyName];
2512
+ > const value = (objectValue as chococake)[propertyName];
2503
2513
  > if (value && typeof value === 'object') {
2504
2514
  > deepClone(value);
2505
2515
  > }
@@ -2704,6 +2714,8 @@ function isValidPipelineUrl(url) {
2704
2714
  * - if it is valid json
2705
2715
  * - if it is meaningful
2706
2716
  *
2717
+ * Note: [🔂] This function is idempotent.
2718
+ *
2707
2719
  * @param pipeline valid or invalid PipelineJson
2708
2720
  * @returns the same pipeline if it is logically valid
2709
2721
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2721,7 +2733,7 @@ function validatePipeline(pipeline) {
2721
2733
  if (!(error instanceof PipelineLogicError)) {
2722
2734
  throw error;
2723
2735
  }
2724
- console.error(spaceTrim((block) => `
2736
+ console.error(spaceTrim$1((block) => `
2725
2737
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2726
2738
 
2727
2739
  ${block(error.message)}
@@ -2748,7 +2760,7 @@ function validatePipeline_InnerFunction(pipeline) {
2748
2760
  })();
2749
2761
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2750
2762
  // <- Note: [🚲]
2751
- throw new PipelineLogicError(spaceTrim((block) => `
2763
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2752
2764
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2753
2765
 
2754
2766
  ${block(pipelineIdentification)}
@@ -2756,7 +2768,7 @@ function validatePipeline_InnerFunction(pipeline) {
2756
2768
  }
2757
2769
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2758
2770
  // <- Note: [🚲]
2759
- throw new PipelineLogicError(spaceTrim((block) => `
2771
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2760
2772
  Invalid Promptbook Version "${pipeline.bookVersion}"
2761
2773
 
2762
2774
  ${block(pipelineIdentification)}
@@ -2765,7 +2777,7 @@ function validatePipeline_InnerFunction(pipeline) {
2765
2777
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2766
2778
  if (!Array.isArray(pipeline.parameters)) {
2767
2779
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2768
- throw new ParseError(spaceTrim((block) => `
2780
+ throw new ParseError(spaceTrim$1((block) => `
2769
2781
  Pipeline is valid JSON but with wrong structure
2770
2782
 
2771
2783
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2776,7 +2788,7 @@ function validatePipeline_InnerFunction(pipeline) {
2776
2788
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2777
2789
  if (!Array.isArray(pipeline.tasks)) {
2778
2790
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2779
- throw new ParseError(spaceTrim((block) => `
2791
+ throw new ParseError(spaceTrim$1((block) => `
2780
2792
  Pipeline is valid JSON but with wrong structure
2781
2793
 
2782
2794
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2802,7 +2814,7 @@ function validatePipeline_InnerFunction(pipeline) {
2802
2814
  // Note: Check each parameter individually
2803
2815
  for (const parameter of pipeline.parameters) {
2804
2816
  if (parameter.isInput && parameter.isOutput) {
2805
- throw new PipelineLogicError(spaceTrim((block) => `
2817
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2806
2818
 
2807
2819
  Parameter \`{${parameter.name}}\` can not be both input and output
2808
2820
 
@@ -2813,7 +2825,7 @@ function validatePipeline_InnerFunction(pipeline) {
2813
2825
  if (!parameter.isInput &&
2814
2826
  !parameter.isOutput &&
2815
2827
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2816
- throw new PipelineLogicError(spaceTrim((block) => `
2828
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2817
2829
  Parameter \`{${parameter.name}}\` is created but not used
2818
2830
 
2819
2831
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2825,7 +2837,7 @@ function validatePipeline_InnerFunction(pipeline) {
2825
2837
  }
2826
2838
  // Note: Testing that parameter is either input or result of some task
2827
2839
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2828
- throw new PipelineLogicError(spaceTrim((block) => `
2840
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2829
2841
  Parameter \`{${parameter.name}}\` is declared but not defined
2830
2842
 
2831
2843
  You can do one of these:
@@ -2841,14 +2853,14 @@ function validatePipeline_InnerFunction(pipeline) {
2841
2853
  // Note: Checking each task individually
2842
2854
  for (const task of pipeline.tasks) {
2843
2855
  if (definedParameters.has(task.resultingParameterName)) {
2844
- throw new PipelineLogicError(spaceTrim((block) => `
2856
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2845
2857
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2846
2858
 
2847
2859
  ${block(pipelineIdentification)}
2848
2860
  `));
2849
2861
  }
2850
2862
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2851
- throw new PipelineLogicError(spaceTrim((block) => `
2863
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2852
2864
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2853
2865
 
2854
2866
  ${block(pipelineIdentification)}
@@ -2858,7 +2870,7 @@ function validatePipeline_InnerFunction(pipeline) {
2858
2870
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2859
2871
  if (!task.format &&
2860
2872
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2861
- throw new PipelineLogicError(spaceTrim((block) => `
2873
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2862
2874
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2863
2875
 
2864
2876
  ${block(pipelineIdentification)}
@@ -2866,7 +2878,7 @@ function validatePipeline_InnerFunction(pipeline) {
2866
2878
  }
2867
2879
  for (const joker of task.jokerParameterNames) {
2868
2880
  if (!task.dependentParameterNames.includes(joker)) {
2869
- throw new PipelineLogicError(spaceTrim((block) => `
2881
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2870
2882
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2871
2883
 
2872
2884
  ${block(pipelineIdentification)}
@@ -2877,21 +2889,21 @@ function validatePipeline_InnerFunction(pipeline) {
2877
2889
  if (task.expectations) {
2878
2890
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2879
2891
  if (min !== undefined && max !== undefined && min > max) {
2880
- throw new PipelineLogicError(spaceTrim((block) => `
2892
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2881
2893
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2882
2894
 
2883
2895
  ${block(pipelineIdentification)}
2884
2896
  `));
2885
2897
  }
2886
2898
  if (min !== undefined && min < 0) {
2887
- throw new PipelineLogicError(spaceTrim((block) => `
2899
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2888
2900
  Min expectation of ${unit} must be zero or positive
2889
2901
 
2890
2902
  ${block(pipelineIdentification)}
2891
2903
  `));
2892
2904
  }
2893
2905
  if (max !== undefined && max <= 0) {
2894
- throw new PipelineLogicError(spaceTrim((block) => `
2906
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2895
2907
  Max expectation of ${unit} must be positive
2896
2908
 
2897
2909
  ${block(pipelineIdentification)}
@@ -2913,7 +2925,7 @@ function validatePipeline_InnerFunction(pipeline) {
2913
2925
  while (unresovedTasks.length > 0) {
2914
2926
  if (loopLimit-- < 0) {
2915
2927
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2916
- throw new UnexpectedError(spaceTrim((block) => `
2928
+ throw new UnexpectedError(spaceTrim$1((block) => `
2917
2929
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2918
2930
 
2919
2931
  ${block(pipelineIdentification)}
@@ -2923,7 +2935,7 @@ function validatePipeline_InnerFunction(pipeline) {
2923
2935
  if (currentlyResovedTasks.length === 0) {
2924
2936
  throw new PipelineLogicError(
2925
2937
  // TODO: [🐎] DRY
2926
- spaceTrim((block) => `
2938
+ spaceTrim$1((block) => `
2927
2939
 
2928
2940
  Can not resolve some parameters:
2929
2941
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -3070,7 +3082,7 @@ function unpreparePipeline(pipeline) {
3070
3082
  * Library of pipelines that groups together pipelines for an application.
3071
3083
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
3072
3084
  *
3073
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
3085
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
3074
3086
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
3075
3087
  */
3076
3088
  class SimplePipelineCollection {
@@ -3080,14 +3092,14 @@ class SimplePipelineCollection {
3080
3092
  * @param pipelines Array of pipeline JSON objects to include in the collection
3081
3093
  *
3082
3094
  * Note: During the construction logic of all pipelines are validated
3083
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
3095
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
3084
3096
  */
3085
3097
  constructor(...pipelines) {
3086
3098
  this.collection = new Map();
3087
3099
  for (const pipeline of pipelines) {
3088
3100
  // TODO: [👠] DRY
3089
3101
  if (pipeline.pipelineUrl === undefined) {
3090
- throw new PipelineUrlError(spaceTrim(`
3102
+ throw new PipelineUrlError(spaceTrim$1(`
3091
3103
  Pipeline with name "${pipeline.title}" does not have defined URL
3092
3104
 
3093
3105
  File:
@@ -3109,7 +3121,7 @@ class SimplePipelineCollection {
3109
3121
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
3110
3122
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
3111
3123
  const existing = this.collection.get(pipeline.pipelineUrl);
3112
- throw new PipelineUrlError(spaceTrim(`
3124
+ throw new PipelineUrlError(spaceTrim$1(`
3113
3125
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
3114
3126
 
3115
3127
  Conflicting files:
@@ -3141,13 +3153,13 @@ class SimplePipelineCollection {
3141
3153
  const pipeline = this.collection.get(url);
3142
3154
  if (!pipeline) {
3143
3155
  if (this.listPipelines().length === 0) {
3144
- throw new NotFoundError(spaceTrim(`
3156
+ throw new NotFoundError(spaceTrim$1(`
3145
3157
  Pipeline with url "${url}" not found
3146
3158
 
3147
3159
  No pipelines available
3148
3160
  `));
3149
3161
  }
3150
- throw new NotFoundError(spaceTrim((block) => `
3162
+ throw new NotFoundError(spaceTrim$1((block) => `
3151
3163
  Pipeline with url "${url}" not found
3152
3164
 
3153
3165
  Available pipelines:
@@ -3168,22 +3180,23 @@ class SimplePipelineCollection {
3168
3180
  }
3169
3181
 
3170
3182
  /**
3171
- * Creates PipelineCollection from array of PipelineJson or PipelineString
3183
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
3172
3184
  *
3173
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
3185
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
3174
3186
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
3175
3187
  *
3176
3188
  * @param promptbookSources
3177
3189
  * @returns PipelineCollection
3178
3190
  * @public exported from `@promptbook/core`
3179
3191
  */
3180
- function createCollectionFromJson(...promptbooks) {
3192
+ function createPipelineCollectionFromJson(...promptbooks) {
3181
3193
  return new SimplePipelineCollection(...promptbooks);
3182
3194
  }
3183
3195
 
3184
3196
  /**
3185
3197
  * Generates random token
3186
3198
  *
3199
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
3187
3200
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
3188
3201
  *
3189
3202
  * @private internal helper function
@@ -3193,6 +3206,7 @@ function $randomToken(randomness) {
3193
3206
  return randomBytes(randomness).toString('hex');
3194
3207
  }
3195
3208
  /**
3209
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3196
3210
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
3197
3211
  */
3198
3212
 
@@ -3311,6 +3325,22 @@ class CollectionError extends Error {
3311
3325
  }
3312
3326
  }
3313
3327
 
3328
+ /**
3329
+ * This error indicates error from the database
3330
+ *
3331
+ * @public exported from `@promptbook/core`
3332
+ */
3333
+ class DatabaseError extends Error {
3334
+ constructor(message) {
3335
+ super(message);
3336
+ this.name = 'DatabaseError';
3337
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3338
+ }
3339
+ }
3340
+ /**
3341
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
3342
+ */
3343
+
3314
3344
  /**
3315
3345
  * This error occurs when some expectation is not met in the execution of the pipeline
3316
3346
  *
@@ -3340,6 +3370,19 @@ class LimitReachedError extends Error {
3340
3370
  }
3341
3371
  }
3342
3372
 
3373
+ /**
3374
+ * This error indicates that promptbook operation is not allowed
3375
+ *
3376
+ * @public exported from `@promptbook/core`
3377
+ */
3378
+ class NotAllowed extends Error {
3379
+ constructor(message) {
3380
+ super(message);
3381
+ this.name = 'NotAllowed';
3382
+ Object.setPrototypeOf(this, NotAllowed.prototype);
3383
+ }
3384
+ }
3385
+
3343
3386
  /**
3344
3387
  * This error type indicates that some part of the code is not implemented yet
3345
3388
  *
@@ -3347,7 +3390,7 @@ class LimitReachedError extends Error {
3347
3390
  */
3348
3391
  class NotYetImplementedError extends Error {
3349
3392
  constructor(message) {
3350
- super(spaceTrim((block) => `
3393
+ super(spaceTrim$1((block) => `
3351
3394
  ${block(message)}
3352
3395
 
3353
3396
  Note: This feature is not implemented yet but it will be soon.
@@ -3400,6 +3443,8 @@ const PROMPTBOOK_ERRORS = {
3400
3443
  PromptbookFetchError,
3401
3444
  UnexpectedError,
3402
3445
  WrappedError,
3446
+ NotAllowed,
3447
+ DatabaseError,
3403
3448
  // TODO: [🪑]> VersionMismatchError,
3404
3449
  };
3405
3450
  /**
@@ -3447,7 +3492,7 @@ function serializeError(error) {
3447
3492
  const { name, message, stack } = error;
3448
3493
  const { id } = error;
3449
3494
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3450
- console.error(spaceTrim$1((block) => `
3495
+ console.error(spaceTrim$2((block) => `
3451
3496
 
3452
3497
  Cannot serialize error with name "${name}"
3453
3498
 
@@ -3480,7 +3525,7 @@ function jsonParse(value) {
3480
3525
  }
3481
3526
  else if (typeof value !== 'string') {
3482
3527
  console.error('Can not parse JSON from non-string value.', { text: value });
3483
- throw new Error(spaceTrim$1(`
3528
+ throw new Error(spaceTrim$2(`
3484
3529
  Can not parse JSON from non-string value.
3485
3530
 
3486
3531
  The value type: ${typeof value}
@@ -3494,7 +3539,7 @@ function jsonParse(value) {
3494
3539
  if (!(error instanceof Error)) {
3495
3540
  throw error;
3496
3541
  }
3497
- throw new Error(spaceTrim$1((block) => `
3542
+ throw new Error(spaceTrim$2((block) => `
3498
3543
  ${block(error.message)}
3499
3544
 
3500
3545
  The expected JSON text:
@@ -3547,7 +3592,7 @@ function deserializeError(error) {
3547
3592
  message = `${name}: ${message}`;
3548
3593
  }
3549
3594
  if (stack !== undefined && stack !== '') {
3550
- message = spaceTrim$1((block) => `
3595
+ message = spaceTrim$2((block) => `
3551
3596
  ${block(message)}
3552
3597
 
3553
3598
  Original stack trace:
@@ -3584,11 +3629,11 @@ function assertsTaskSuccessful(executionResult) {
3584
3629
  throw deserializeError(errors[0]);
3585
3630
  }
3586
3631
  else {
3587
- throw new PipelineExecutionError(spaceTrim((block) => `
3632
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
3588
3633
  Multiple errors occurred during Promptbook execution
3589
3634
 
3590
3635
  ${block(errors
3591
- .map(({ name, stack, message }, index) => spaceTrim((block) => `
3636
+ .map(({ name, stack, message }, index) => spaceTrim$1((block) => `
3592
3637
  ${name} ${index + 1}:
3593
3638
  ${block(stack || message)}
3594
3639
  `))
@@ -3615,6 +3660,7 @@ function createTask(options) {
3615
3660
  let updatedAt = createdAt;
3616
3661
  const errors = [];
3617
3662
  const warnings = [];
3663
+ const llmCalls = [];
3618
3664
  let currentValue = {};
3619
3665
  let customTldr = null;
3620
3666
  const partialResultSubject = new Subject();
@@ -3630,6 +3676,9 @@ function createTask(options) {
3630
3676
  }, (tldrInfo) => {
3631
3677
  customTldr = tldrInfo;
3632
3678
  updatedAt = new Date();
3679
+ }, (llmCall) => {
3680
+ llmCalls.push(llmCall);
3681
+ updatedAt = new Date();
3633
3682
  });
3634
3683
  finalResultPromise
3635
3684
  .catch((error) => {
@@ -3752,7 +3801,7 @@ function createTask(options) {
3752
3801
  }
3753
3802
  return {
3754
3803
  percent: percent,
3755
- message,
3804
+ message: message + ' (!!!fallback)',
3756
3805
  };
3757
3806
  },
3758
3807
  get createdAt() {
@@ -3775,6 +3824,10 @@ function createTask(options) {
3775
3824
  return warnings;
3776
3825
  // <- Note: [1] --||--
3777
3826
  },
3827
+ get llmCalls() {
3828
+ return [...llmCalls, { foo: '!!! bar' }];
3829
+ // <- Note: [1] --||--
3830
+ },
3778
3831
  get currentValue() {
3779
3832
  return currentValue;
3780
3833
  // <- Note: [1] --||--
@@ -4051,14 +4104,14 @@ class MultipleLlmExecutionTools {
4051
4104
  if (description === undefined) {
4052
4105
  return headLine;
4053
4106
  }
4054
- return spaceTrim$1((block) => `
4107
+ return spaceTrim$2((block) => `
4055
4108
  ${headLine}
4056
4109
 
4057
4110
  ${ /* <- Note: Indenting the description: */block(description)}
4058
4111
  `);
4059
4112
  })
4060
4113
  .join('\n\n');
4061
- return spaceTrim$1((block) => `
4114
+ return spaceTrim$2((block) => `
4062
4115
  Multiple LLM Providers:
4063
4116
 
4064
4117
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4149,7 +4202,7 @@ class MultipleLlmExecutionTools {
4149
4202
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4150
4203
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4151
4204
  // 3) ...
4152
- spaceTrim$1((block) => `
4205
+ spaceTrim$2((block) => `
4153
4206
  All execution tools of ${this.title} failed:
4154
4207
 
4155
4208
  ${block(errors
@@ -4162,7 +4215,7 @@ class MultipleLlmExecutionTools {
4162
4215
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4163
4216
  }
4164
4217
  else {
4165
- throw new PipelineExecutionError(spaceTrim$1((block) => `
4218
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
4166
4219
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4167
4220
 
4168
4221
  Available \`LlmExecutionTools\`:
@@ -4195,7 +4248,7 @@ class MultipleLlmExecutionTools {
4195
4248
  */
4196
4249
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4197
4250
  if (llmExecutionTools.length === 0) {
4198
- const warningMessage = spaceTrim$1(`
4251
+ const warningMessage = spaceTrim$2(`
4199
4252
  You have not provided any \`LlmExecutionTools\`
4200
4253
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4201
4254
 
@@ -4228,6 +4281,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
4228
4281
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4229
4282
  }
4230
4283
  /**
4284
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4231
4285
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4232
4286
  */
4233
4287
 
@@ -4244,6 +4298,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
4244
4298
  return llmTools;
4245
4299
  }
4246
4300
  /**
4301
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4247
4302
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4248
4303
  */
4249
4304
 
@@ -4259,7 +4314,7 @@ async function preparePersona(personaDescription, tools, options) {
4259
4314
  throw new MissingToolsError('LLM tools are required for preparing persona');
4260
4315
  }
4261
4316
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4262
- const collection = createCollectionFromJson(...PipelineCollection);
4317
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4263
4318
  const preparePersonaExecutor = createPipelineExecutor({
4264
4319
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
4265
4320
  tools,
@@ -4510,14 +4565,14 @@ function $registeredScrapersMessage(availableScrapers) {
4510
4565
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4511
4566
  });
4512
4567
  if (metadata.length === 0) {
4513
- return spaceTrim$1(`
4568
+ return spaceTrim$2(`
4514
4569
  **No scrapers are available**
4515
4570
 
4516
4571
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4517
4572
  At least there should be available the metadata of the scrapers
4518
4573
  `);
4519
4574
  }
4520
- return spaceTrim$1((block) => `
4575
+ return spaceTrim$2((block) => `
4521
4576
  Available scrapers are:
4522
4577
  ${block(metadata
4523
4578
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4618,7 +4673,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4618
4673
  else if (urlOrRequest instanceof Request) {
4619
4674
  url = urlOrRequest.url;
4620
4675
  }
4621
- throw new PromptbookFetchError(spaceTrim$1((block) => `
4676
+ throw new PromptbookFetchError(spaceTrim$2((block) => `
4622
4677
  Can not fetch "${url}"
4623
4678
 
4624
4679
  Fetch error:
@@ -4779,7 +4834,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4779
4834
  const fileExtension = getFileExtension(filename);
4780
4835
  const mimeType = extensionToMimeType(fileExtension || '');
4781
4836
  if (!(await isFileExisting(filename, tools.fs))) {
4782
- throw new NotFoundError(spaceTrim$1((block) => `
4837
+ throw new NotFoundError(spaceTrim$2((block) => `
4783
4838
  Can not make source handler for file which does not exist:
4784
4839
 
4785
4840
  File:
@@ -4872,7 +4927,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4872
4927
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4873
4928
  break;
4874
4929
  }
4875
- console.warn(spaceTrim$1((block) => `
4930
+ console.warn(spaceTrim$2((block) => `
4876
4931
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4877
4932
 
4878
4933
  The source:
@@ -4888,7 +4943,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4888
4943
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4889
4944
  }
4890
4945
  if (partialPieces === null) {
4891
- throw new KnowledgeScrapeError(spaceTrim$1((block) => `
4946
+ throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4892
4947
  Cannot scrape knowledge
4893
4948
 
4894
4949
  The source:
@@ -4967,7 +5022,7 @@ async function prepareTasks(pipeline, tools, options) {
4967
5022
  if (task.taskType === 'PROMPT_TASK' &&
4968
5023
  knowledgePiecesCount > 0 &&
4969
5024
  !dependentParameterNames.includes('knowledge')) {
4970
- preparedContent = spaceTrim(`
5025
+ preparedContent = spaceTrim$1(`
4971
5026
  {content}
4972
5027
 
4973
5028
  ## Knowledge
@@ -5053,7 +5108,7 @@ async function preparePipeline(pipeline, tools, options) {
5053
5108
  let title = pipeline.title;
5054
5109
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
5055
5110
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
5056
- const collection = createCollectionFromJson(...PipelineCollection);
5111
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
5057
5112
  const prepareTitleExecutor = createPipelineExecutor({
5058
5113
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
5059
5114
  tools,
@@ -5280,7 +5335,7 @@ function extractVariablesFromJavascript(script) {
5280
5335
  }
5281
5336
  catch (error) {
5282
5337
  assertsError(error);
5283
- throw new ParseError(spaceTrim((block) => `
5338
+ throw new ParseError(spaceTrim$1((block) => `
5284
5339
  Can not extract variables from the script
5285
5340
  ${block(error.stack || error.message)}
5286
5341
 
@@ -5463,7 +5518,7 @@ const CsvFormatParser = {
5463
5518
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5464
5519
  const csv = csvParse(value, settings);
5465
5520
  if (csv.errors.length !== 0) {
5466
- throw new CsvFormatError(spaceTrim$1((block) => `
5521
+ throw new CsvFormatError(spaceTrim$2((block) => `
5467
5522
  CSV parsing error
5468
5523
 
5469
5524
  Error(s) from CSV parsing:
@@ -5508,7 +5563,7 @@ const CsvFormatParser = {
5508
5563
  const { value, settings, mapCallback, onProgress } = options;
5509
5564
  const csv = csvParse(value, settings);
5510
5565
  if (csv.errors.length !== 0) {
5511
- throw new CsvFormatError(spaceTrim$1((block) => `
5566
+ throw new CsvFormatError(spaceTrim$2((block) => `
5512
5567
  CSV parsing error
5513
5568
 
5514
5569
  Error(s) from CSV parsing:
@@ -5718,7 +5773,7 @@ function mapAvailableToExpectedParameters(options) {
5718
5773
  }
5719
5774
  // Phase 2️⃣: Non-matching mapping
5720
5775
  if (expectedParameterNames.size !== availableParametersNames.size) {
5721
- throw new PipelineExecutionError(spaceTrim$1((block) => `
5776
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
5722
5777
  Can not map available parameters to expected parameters
5723
5778
 
5724
5779
  Mapped parameters:
@@ -5965,10 +6020,13 @@ const LINES_PER_STANDARD_PAGE = 44;
5965
6020
  * @public exported from `@promptbook/utils`
5966
6021
  */
5967
6022
  function countLines(text) {
6023
+ if (text === '') {
6024
+ return 0;
6025
+ }
5968
6026
  text = text.replace('\r\n', '\n');
5969
6027
  text = text.replace('\r', '\n');
5970
6028
  const lines = text.split('\n');
5971
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
6029
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5972
6030
  }
5973
6031
  /**
5974
6032
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -6093,6 +6151,8 @@ function checkExpectations(expectations, value) {
6093
6151
  * This function provides a common abstraction for result validation that can be used
6094
6152
  * by both execution logic and caching logic to ensure consistency.
6095
6153
  *
6154
+ * Note: [🔂] This function is idempotent.
6155
+ *
6096
6156
  * @param options - The validation options including result string, expectations, and format
6097
6157
  * @returns Validation result with processed string and validity status
6098
6158
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -6112,7 +6172,7 @@ function validatePromptResult(options) {
6112
6172
  }
6113
6173
  catch (error) {
6114
6174
  keepUnused(error);
6115
- throw new ExpectError(spaceTrim((block) => `
6175
+ throw new ExpectError(spaceTrim$1((block) => `
6116
6176
  Expected valid JSON string
6117
6177
 
6118
6178
  The expected JSON text:
@@ -6161,7 +6221,7 @@ function validatePromptResult(options) {
6161
6221
  */
6162
6222
  async function executeAttempts(options) {
6163
6223
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
6164
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6224
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
6165
6225
  const $ongoingTaskResult = {
6166
6226
  $result: null,
6167
6227
  $resultString: null,
@@ -6175,7 +6235,7 @@ async function executeAttempts(options) {
6175
6235
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6176
6236
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6177
6237
  if (isJokerAttempt && !jokerParameterName) {
6178
- throw new UnexpectedError(spaceTrim((block) => `
6238
+ throw new UnexpectedError(spaceTrim$1((block) => `
6179
6239
  Joker not found in attempt ${attemptIndex}
6180
6240
 
6181
6241
  ${block(pipelineIdentification)}
@@ -6186,7 +6246,7 @@ async function executeAttempts(options) {
6186
6246
  $ongoingTaskResult.$expectError = null;
6187
6247
  if (isJokerAttempt) {
6188
6248
  if (parameters[jokerParameterName] === undefined) {
6189
- throw new PipelineExecutionError(spaceTrim((block) => `
6249
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6190
6250
  Joker parameter {${jokerParameterName}} not defined
6191
6251
 
6192
6252
  ${block(pipelineIdentification)}
@@ -6244,7 +6304,7 @@ async function executeAttempts(options) {
6244
6304
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6245
6305
  break variant;
6246
6306
  case 'EMBEDDING':
6247
- throw new PipelineExecutionError(spaceTrim((block) => `
6307
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6248
6308
  Embedding model can not be used in pipeline
6249
6309
 
6250
6310
  This should be catched during parsing
@@ -6255,7 +6315,7 @@ async function executeAttempts(options) {
6255
6315
  break variant;
6256
6316
  // <- case [🤖]:
6257
6317
  default:
6258
- throw new PipelineExecutionError(spaceTrim((block) => `
6318
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6259
6319
  Unknown model variant "${task.modelRequirements.modelVariant}"
6260
6320
 
6261
6321
  ${block(pipelineIdentification)}
@@ -6266,14 +6326,14 @@ async function executeAttempts(options) {
6266
6326
  break;
6267
6327
  case 'SCRIPT_TASK':
6268
6328
  if (arrayableToArray(tools.script).length === 0) {
6269
- throw new PipelineExecutionError(spaceTrim((block) => `
6329
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6270
6330
  No script execution tools are available
6271
6331
 
6272
6332
  ${block(pipelineIdentification)}
6273
6333
  `));
6274
6334
  }
6275
6335
  if (!task.contentLanguage) {
6276
- throw new PipelineExecutionError(spaceTrim((block) => `
6336
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6277
6337
  Script language is not defined for SCRIPT TASK "${task.name}"
6278
6338
 
6279
6339
  ${block(pipelineIdentification)}
@@ -6304,7 +6364,7 @@ async function executeAttempts(options) {
6304
6364
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6305
6365
  }
6306
6366
  else {
6307
- throw new PipelineExecutionError(spaceTrim((block) => `
6367
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6308
6368
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6309
6369
 
6310
6370
  ${block(pipelineIdentification)}
@@ -6318,7 +6378,7 @@ async function executeAttempts(options) {
6318
6378
  break taskType;
6319
6379
  case 'DIALOG_TASK':
6320
6380
  if (tools.userInterface === undefined) {
6321
- throw new PipelineExecutionError(spaceTrim((block) => `
6381
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6322
6382
  User interface tools are not available
6323
6383
 
6324
6384
  ${block(pipelineIdentification)}
@@ -6336,7 +6396,7 @@ async function executeAttempts(options) {
6336
6396
  break taskType;
6337
6397
  // <- case: [🅱]
6338
6398
  default:
6339
- throw new PipelineExecutionError(spaceTrim((block) => `
6399
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6340
6400
  Unknown execution type "${task.taskType}"
6341
6401
 
6342
6402
  ${block(pipelineIdentification)}
@@ -6409,14 +6469,10 @@ async function executeAttempts(options) {
6409
6469
  });
6410
6470
  }
6411
6471
  finally {
6412
- if (!isJokerAttempt &&
6413
- task.taskType === 'PROMPT_TASK' &&
6414
- $ongoingTaskResult.$prompt
6415
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6416
- // In that case we don’t want to make a report about it because it’s not a llm execution error
6417
- ) {
6418
- // TODO: [🧠] Maybe put other taskTypes into report
6419
- $executionReport.promptExecutions.push({
6472
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6473
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6474
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6475
+ const executionPromptReport = {
6420
6476
  prompt: {
6421
6477
  ...$ongoingTaskResult.$prompt,
6422
6478
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6425,13 +6481,20 @@ async function executeAttempts(options) {
6425
6481
  error: $ongoingTaskResult.$expectError === null
6426
6482
  ? undefined
6427
6483
  : serializeError($ongoingTaskResult.$expectError),
6428
- });
6484
+ };
6485
+ $executionReport.promptExecutions.push(executionPromptReport);
6486
+ if (logLlmCall) {
6487
+ logLlmCall({
6488
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6489
+ report: executionPromptReport,
6490
+ });
6491
+ }
6429
6492
  }
6430
6493
  }
6431
6494
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6432
6495
  // Note: Create a summary of all failures
6433
6496
  const failuresSummary = $ongoingTaskResult.$failedResults
6434
- .map((failure) => spaceTrim((block) => {
6497
+ .map((failure) => spaceTrim$1((block) => {
6435
6498
  var _a, _b;
6436
6499
  return `
6437
6500
  Attempt ${failure.attemptIndex + 1}:
@@ -6441,14 +6504,14 @@ async function executeAttempts(options) {
6441
6504
  Result:
6442
6505
  ${block(failure.result === null
6443
6506
  ? 'null'
6444
- : spaceTrim(failure.result)
6507
+ : spaceTrim$1(failure.result)
6445
6508
  .split('\n')
6446
6509
  .map((line) => `> ${line}`)
6447
6510
  .join('\n'))}
6448
6511
  `;
6449
6512
  }))
6450
6513
  .join('\n\n---\n\n');
6451
- throw new PipelineExecutionError(spaceTrim((block) => {
6514
+ throw new PipelineExecutionError(spaceTrim$1((block) => {
6452
6515
  var _a;
6453
6516
  return `
6454
6517
  LLM execution failed ${maxExecutionAttempts}x
@@ -6468,7 +6531,7 @@ async function executeAttempts(options) {
6468
6531
  }
6469
6532
  }
6470
6533
  if ($ongoingTaskResult.$resultString === null) {
6471
- throw new UnexpectedError(spaceTrim((block) => `
6534
+ throw new UnexpectedError(spaceTrim$1((block) => `
6472
6535
  Something went wrong and prompt result is null
6473
6536
 
6474
6537
  ${block(pipelineIdentification)}
@@ -6490,12 +6553,12 @@ async function executeAttempts(options) {
6490
6553
  * @private internal utility of `createPipelineExecutor`
6491
6554
  */
6492
6555
  async function executeFormatSubvalues(options) {
6493
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6556
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6494
6557
  if (task.foreach === undefined) {
6495
- return /* not await */ executeAttempts(options);
6558
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6496
6559
  }
6497
6560
  if (jokerParameterNames.length !== 0) {
6498
- throw new UnexpectedError(spaceTrim$1((block) => `
6561
+ throw new UnexpectedError(spaceTrim$2((block) => `
6499
6562
  JOKER parameters are not supported together with FOREACH command
6500
6563
 
6501
6564
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6508,7 +6571,7 @@ async function executeFormatSubvalues(options) {
6508
6571
  if (formatDefinition === undefined) {
6509
6572
  throw new UnexpectedError(
6510
6573
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6511
- spaceTrim$1((block) => `
6574
+ spaceTrim$2((block) => `
6512
6575
  Unsupported format "${task.foreach.formatName}"
6513
6576
 
6514
6577
  Available formats:
@@ -6525,7 +6588,7 @@ async function executeFormatSubvalues(options) {
6525
6588
  if (subvalueParser === undefined) {
6526
6589
  throw new UnexpectedError(
6527
6590
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6528
- spaceTrim$1((block) => `
6591
+ spaceTrim$2((block) => `
6529
6592
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6530
6593
 
6531
6594
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6565,7 +6628,7 @@ async function executeFormatSubvalues(options) {
6565
6628
  if (!(error instanceof PipelineExecutionError)) {
6566
6629
  throw error;
6567
6630
  }
6568
- const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6631
+ const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6569
6632
  ${error.message}
6570
6633
 
6571
6634
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6589,7 +6652,7 @@ async function executeFormatSubvalues(options) {
6589
6652
  ...options,
6590
6653
  priority: priority + index,
6591
6654
  parameters: allSubparameters,
6592
- pipelineIdentification: spaceTrim$1((block) => `
6655
+ pipelineIdentification: spaceTrim$2((block) => `
6593
6656
  ${block(pipelineIdentification)}
6594
6657
  Subparameter index: ${index}
6595
6658
  `),
@@ -6598,7 +6661,7 @@ async function executeFormatSubvalues(options) {
6598
6661
  }
6599
6662
  catch (error) {
6600
6663
  if (length > BIG_DATASET_TRESHOLD) {
6601
- console.error(spaceTrim$1((block) => `
6664
+ console.error(spaceTrim$2((block) => `
6602
6665
  ${error.message}
6603
6666
 
6604
6667
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6698,7 +6761,7 @@ async function getKnowledgeForTask(options) {
6698
6761
  },
6699
6762
  content: task.content,
6700
6763
  parameters,
6701
- };
6764
+ }; /* <- Note: [🤛] */
6702
6765
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6703
6766
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6704
6767
  const { index } = knowledgePiece;
@@ -6774,7 +6837,7 @@ async function getReservedParametersForTask(options) {
6774
6837
  // Note: Doublecheck that ALL reserved parameters are defined:
6775
6838
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6776
6839
  if (reservedParameters[parameterName] === undefined) {
6777
- throw new UnexpectedError(spaceTrim((block) => `
6840
+ throw new UnexpectedError(spaceTrim$1((block) => `
6778
6841
  Reserved parameter {${parameterName}} is not defined
6779
6842
 
6780
6843
  ${block(pipelineIdentification)}
@@ -6793,14 +6856,14 @@ async function getReservedParametersForTask(options) {
6793
6856
  * @private internal utility of `createPipelineExecutor`
6794
6857
  */
6795
6858
  async function executeTask(options) {
6796
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6859
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6797
6860
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6798
6861
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6799
6862
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
6800
6863
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6801
6864
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6802
6865
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6803
- throw new UnexpectedError(spaceTrim((block) => `
6866
+ throw new UnexpectedError(spaceTrim$1((block) => `
6804
6867
  Dependent parameters are not consistent with used parameters:
6805
6868
 
6806
6869
  Dependent parameters:
@@ -6844,7 +6907,7 @@ async function executeTask(options) {
6844
6907
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6845
6908
  // Houston, we have a problem
6846
6909
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6847
- throw new UnexpectedError(spaceTrim((block) => `
6910
+ throw new UnexpectedError(spaceTrim$1((block) => `
6848
6911
  Parameter \`{${parameterName}}\` is NOT defined
6849
6912
  BUT used in task "${currentTask.title || currentTask.name}"
6850
6913
 
@@ -6872,6 +6935,7 @@ async function executeTask(options) {
6872
6935
  tools,
6873
6936
  $executionReport,
6874
6937
  onProgress,
6938
+ logLlmCall,
6875
6939
  pipelineIdentification,
6876
6940
  maxExecutionAttempts,
6877
6941
  maxParallelCount,
@@ -6912,9 +6976,32 @@ function filterJustOutputParameters(options) {
6912
6976
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6913
6977
  if (parametersToPass[parameter.name] === undefined) {
6914
6978
  // [4]
6915
- $warnings.push(new PipelineExecutionError(spaceTrim((block) => `
6979
+ $warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6916
6980
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6917
6981
 
6982
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6983
+
6984
+ All parameters:
6985
+ ${block(preparedPipeline.parameters
6986
+ .map(({ name, isInput, isOutput, description }) => {
6987
+ let line = `\`{${name}}\``;
6988
+ if (isInput) {
6989
+ line += ' `[input parameter]`';
6990
+ }
6991
+ if (isOutput) {
6992
+ line += ' `[output parameter]`';
6993
+ }
6994
+ if (parametersToPass[name] === undefined) {
6995
+ line += ` <- Warning: Should be in the output but its not |`;
6996
+ }
6997
+ if (description) {
6998
+ line += ` ${description}`;
6999
+ }
7000
+ return line;
7001
+ })
7002
+ .map((line, index) => `${index + 1}) ${line}`)
7003
+ .join('\n'))}
7004
+
6918
7005
  ${block(pipelineIdentification)}
6919
7006
  `)));
6920
7007
  continue;
@@ -6935,7 +7022,7 @@ function filterJustOutputParameters(options) {
6935
7022
  * @private internal utility of `createPipelineExecutor`
6936
7023
  */
6937
7024
  async function executePipeline(options) {
6938
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
7025
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6939
7026
  let { preparedPipeline } = options;
6940
7027
  if (preparedPipeline === undefined) {
6941
7028
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6997,7 +7084,7 @@ async function executePipeline(options) {
6997
7084
  for (const parameterName of Object.keys(inputParameters)) {
6998
7085
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6999
7086
  if (parameter === undefined) {
7000
- warnings.push(new PipelineExecutionError(spaceTrim((block) => `
7087
+ warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
7001
7088
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
7002
7089
 
7003
7090
  ${block(pipelineIdentification)}
@@ -7012,7 +7099,7 @@ async function executePipeline(options) {
7012
7099
  // TODO: [🧠] This should be also non-critical error
7013
7100
  return exportJson({
7014
7101
  name: 'pipelineExecutorResult',
7015
- message: spaceTrim((block) => `
7102
+ message: spaceTrim$1((block) => `
7016
7103
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
7017
7104
 
7018
7105
  ${block(pipelineIdentification)}
@@ -7021,7 +7108,7 @@ async function executePipeline(options) {
7021
7108
  value: {
7022
7109
  isSuccessful: false,
7023
7110
  errors: [
7024
- new PipelineExecutionError(spaceTrim((block) => `
7111
+ new PipelineExecutionError(spaceTrim$1((block) => `
7025
7112
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
7026
7113
 
7027
7114
  ${block(pipelineIdentification)}
@@ -7048,7 +7135,7 @@ async function executePipeline(options) {
7048
7135
  while (unresovedTasks.length > 0) {
7049
7136
  if (loopLimit-- < 0) {
7050
7137
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
7051
- throw new UnexpectedError(spaceTrim((block) => `
7138
+ throw new UnexpectedError(spaceTrim$1((block) => `
7052
7139
  Loop limit reached during resolving parameters pipeline execution
7053
7140
 
7054
7141
  ${block(pipelineIdentification)}
@@ -7058,7 +7145,7 @@ async function executePipeline(options) {
7058
7145
  if (!currentTask && resolving.length === 0) {
7059
7146
  throw new UnexpectedError(
7060
7147
  // TODO: [🐎] DRY
7061
- spaceTrim((block) => `
7148
+ spaceTrim$1((block) => `
7062
7149
  Can not resolve some parameters:
7063
7150
 
7064
7151
  ${block(pipelineIdentification)}
@@ -7098,7 +7185,7 @@ async function executePipeline(options) {
7098
7185
  tools,
7099
7186
  onProgress(newOngoingResult) {
7100
7187
  if (isReturned) {
7101
- throw new UnexpectedError(spaceTrim((block) => `
7188
+ throw new UnexpectedError(spaceTrim$1((block) => `
7102
7189
  Can not call \`onProgress\` after pipeline execution is finished
7103
7190
 
7104
7191
  ${block(pipelineIdentification)}
@@ -7113,8 +7200,9 @@ async function executePipeline(options) {
7113
7200
  onProgress(newOngoingResult);
7114
7201
  }
7115
7202
  },
7203
+ logLlmCall,
7116
7204
  $executionReport: executionReport,
7117
- pipelineIdentification: spaceTrim((block) => `
7205
+ pipelineIdentification: spaceTrim$1((block) => `
7118
7206
  ${block(pipelineIdentification)}
7119
7207
  Task name: ${currentTask.name}
7120
7208
  Task title: ${currentTask.title}
@@ -7223,7 +7311,7 @@ function createPipelineExecutor(options) {
7223
7311
  preparedPipeline = pipeline;
7224
7312
  }
7225
7313
  else if (isNotPreparedWarningSuppressed !== true) {
7226
- console.warn(spaceTrim((block) => `
7314
+ console.warn(spaceTrim$1((block) => `
7227
7315
  Pipeline is not prepared
7228
7316
 
7229
7317
  ${block(pipelineIdentification)}
@@ -7236,7 +7324,7 @@ function createPipelineExecutor(options) {
7236
7324
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7237
7325
  }
7238
7326
  let runCount = 0;
7239
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7327
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7240
7328
  runCount++;
7241
7329
  return /* not await */ executePipeline({
7242
7330
  pipeline,
@@ -7247,7 +7335,8 @@ function createPipelineExecutor(options) {
7247
7335
  inputParameters,
7248
7336
  tools,
7249
7337
  onProgress,
7250
- pipelineIdentification: spaceTrim((block) => `
7338
+ logLlmCall,
7339
+ pipelineIdentification: spaceTrim$1((block) => `
7251
7340
  ${block(pipelineIdentification)}
7252
7341
  ${runCount === 1 ? '' : `Run #${runCount}`}
7253
7342
  `),
@@ -7408,7 +7497,7 @@ class MarkdownScraper {
7408
7497
  }
7409
7498
  const llmTools = getSingleLlmExecutionTools(llm);
7410
7499
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7411
- const collection = createCollectionFromJson(...PipelineCollection);
7500
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7412
7501
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7413
7502
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7414
7503
  tools: {
@@ -7444,8 +7533,8 @@ class MarkdownScraper {
7444
7533
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7445
7534
  // Note: These are just default values, they will be overwritten by the actual values:
7446
7535
  let name = `piece-${i}`;
7447
- let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
7448
- const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
7536
+ let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7537
+ const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7449
7538
  let keywords = [];
7450
7539
  const index = [];
7451
7540
  /*
@@ -7458,7 +7547,7 @@ class MarkdownScraper {
7458
7547
  isCrashedOnError: true,
7459
7548
  });
7460
7549
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7461
- title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
7550
+ title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7462
7551
  name = titleToName(title);
7463
7552
  // --- Keywords
7464
7553
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
@@ -7604,7 +7693,7 @@ class DocumentScraper {
7604
7693
  await $execCommand(command);
7605
7694
  // Note: [0]
7606
7695
  if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
7607
- throw new UnexpectedError(spaceTrim$1((block) => `
7696
+ throw new UnexpectedError(spaceTrim$2((block) => `
7608
7697
  File that was supposed to be created by Pandoc does not exist for unknown reason
7609
7698
 
7610
7699
  Expected file: