@promptbook/markdown-utils 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 +328 -239
  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 +6 -6
  257. package/umd/index.umd.js +293 -204
  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/umd/index.umd.js CHANGED
@@ -1,12 +1,12 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('papaparse')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'papaparse'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markdown-utils"] = {}, global.spaceTrim, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse));
5
- })(this, (function (exports, spaceTrim, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markdown-utils"] = {}, global.spaceTrim$1, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse));
5
+ })(this, (function (exports, spaceTrim$1, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
9
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
10
10
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
11
11
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
12
12
 
@@ -17,14 +17,14 @@
17
17
  * @generated
18
18
  * @see https://github.com/webgptorg/book
19
19
  */
20
- const BOOK_LANGUAGE_VERSION = '1.0.0';
20
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
21
21
  /**
22
22
  * The version of the Promptbook engine
23
23
  *
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-9';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -173,6 +173,17 @@
173
173
  return content;
174
174
  }
175
175
 
176
+ /**
177
+ * Trims string from all 4 sides
178
+ *
179
+ * Note: This is a re-exported function from the `spacetrim` package which is
180
+ * Developed by same author @hejny as this package
181
+ *
182
+ * @public exported from `@promptbook/utils`
183
+ * @see https://github.com/hejny/spacetrim#usage
184
+ */
185
+ const spaceTrim = spaceTrim$1.spaceTrim;
186
+
176
187
  /**
177
188
  * @private util of `@promptbook/color`
178
189
  * @de
@@ -221,6 +232,7 @@
221
232
  * @public exported from `@promptbook/color`
222
233
  */
223
234
  const CSS_COLORS = {
235
+ promptbook: '#79EAFD',
224
236
  transparent: 'rgba(0,0,0,0)',
225
237
  aliceblue: '#f0f8ff',
226
238
  antiquewhite: '#faebd7',
@@ -402,9 +414,6 @@
402
414
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
403
415
  }
404
416
  }
405
- /**
406
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
407
- */
408
417
 
409
418
  /**
410
419
  * Color object represents an RGB color with alpha channel
@@ -424,21 +433,61 @@
424
433
  * @param color
425
434
  * @returns Color object
426
435
  */
427
- static from(color) {
428
- if (color instanceof Color) {
436
+ static from(color, _isSingleValue = false) {
437
+ if (color === '') {
438
+ throw new Error(`Can not create color from empty string`);
439
+ }
440
+ else if (color instanceof Color) {
429
441
  return take(color);
430
442
  }
431
443
  else if (Color.isColor(color)) {
432
444
  return take(color);
433
445
  }
434
446
  else if (typeof color === 'string') {
435
- return Color.fromString(color);
447
+ try {
448
+ return Color.fromString(color);
449
+ }
450
+ catch (error) {
451
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
452
+ if (_isSingleValue) {
453
+ throw error;
454
+ }
455
+ const parts = color.split(/[\s+,;|]/);
456
+ if (parts.length > 0) {
457
+ return Color.from(parts[0].trim(), true);
458
+ }
459
+ else {
460
+ throw new Error(`Can not create color from given string "${color}"`);
461
+ }
462
+ }
436
463
  }
437
464
  else {
438
465
  console.error({ color });
439
466
  throw new Error(`Can not create color from given object`);
440
467
  }
441
468
  }
469
+ /**
470
+ * Creates a new Color instance from miscellaneous formats
471
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
472
+ *
473
+ * @param color
474
+ * @returns Color object
475
+ */
476
+ static fromSafe(color) {
477
+ try {
478
+ return Color.from(color);
479
+ }
480
+ catch (error) {
481
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
482
+ console.warn(spaceTrim((block) => `
483
+ Color.fromSafe error:
484
+ ${block(error.message)}
485
+
486
+ Returning default PROMPTBOOK_COLOR.
487
+ `));
488
+ return Color.fromString('promptbook');
489
+ }
490
+ }
442
491
  /**
443
492
  * Creates a new Color instance from miscellaneous string formats
444
493
  *
@@ -506,6 +555,9 @@
506
555
  if (hex.length === 3) {
507
556
  return Color.fromHex3(hex);
508
557
  }
558
+ if (hex.length === 4) {
559
+ return Color.fromHex4(hex);
560
+ }
509
561
  if (hex.length === 6) {
510
562
  return Color.fromHex6(hex);
511
563
  }
@@ -526,6 +578,19 @@
526
578
  const b = parseInt(hex.substr(2, 1), 16) * 16;
527
579
  return take(new Color(r, g, b));
528
580
  }
581
+ /**
582
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
583
+ *
584
+ * @param color in hex for example `09df`
585
+ * @returns Color object
586
+ */
587
+ static fromHex4(hex) {
588
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
589
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
590
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
591
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
592
+ return take(new Color(r, g, b, a));
593
+ }
529
594
  /**
530
595
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
531
596
  *
@@ -716,7 +781,8 @@
716
781
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
717
782
  */
718
783
  static isHexColorString(value) {
719
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
784
+ return (typeof value === 'string' &&
785
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
720
786
  }
721
787
  /**
722
788
  * Creates new Color object
@@ -831,6 +897,23 @@
831
897
  * TODO: Maybe connect with textures
832
898
  */
833
899
 
900
+ /**
901
+ * Makes color transformer which returns a grayscale version of the color
902
+ *
903
+ * @param amount from 0 to 1
904
+ *
905
+ * @public exported from `@promptbook/color`
906
+ */
907
+ function grayscale(amount) {
908
+ return ({ red, green, blue, alpha }) => {
909
+ const average = (red + green + blue) / 3;
910
+ red = Math.round(average * amount + red * (1 - amount));
911
+ green = Math.round(average * amount + green * (1 - amount));
912
+ blue = Math.round(average * amount + blue * (1 - amount));
913
+ return Color.fromValues(red, green, blue, alpha);
914
+ };
915
+ }
916
+
834
917
  /**
835
918
  * Converts HSL values to RGB values
836
919
  *
@@ -946,102 +1029,6 @@
946
1029
  * TODO: Maybe implement by mix+hsl
947
1030
  */
948
1031
 
949
- /**
950
- * Calculates distance between two colors
951
- *
952
- * @param color1 first color
953
- * @param color2 second color
954
- *
955
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
956
- *
957
- * @public exported from `@promptbook/color`
958
- */
959
- /**
960
- * Calculates distance between two colors without square root
961
- *
962
- * @param color1 first color
963
- * @param color2 second color
964
- *
965
- * @public exported from `@promptbook/color`
966
- */
967
- function colorDistanceSquared(color1, color2) {
968
- const rmean = (color1.red + color2.red) / 2;
969
- const r = color1.red - color2.red;
970
- const g = color1.green - color2.green;
971
- const b = color1.blue - color2.blue;
972
- const weightR = 2 + rmean / 256;
973
- const weightG = 4.0;
974
- const weightB = 2 + (255 - rmean) / 256;
975
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
976
- return distance;
977
- }
978
-
979
- /**
980
- * Makes color transformer which finds the nearest color from the given list
981
- *
982
- * @param colors array of colors to choose from
983
- *
984
- * @public exported from `@promptbook/color`
985
- */
986
- function nearest(...colors) {
987
- return (color) => {
988
- const distances = colors.map((c) => colorDistanceSquared(c, color));
989
- const minDistance = Math.min(...distances);
990
- const minIndex = distances.indexOf(minDistance);
991
- const nearestColor = colors[minIndex];
992
- return nearestColor;
993
- };
994
- }
995
-
996
- /**
997
- * Color transformer which returns the negative color
998
- *
999
- * @public exported from `@promptbook/color`
1000
- */
1001
- function negative(color) {
1002
- const r = 255 - color.red;
1003
- const g = 255 - color.green;
1004
- const b = 255 - color.blue;
1005
- return Color.fromValues(r, g, b, color.alpha);
1006
- }
1007
-
1008
- /**
1009
- * Makes color transformer which finds the furthest color from the given list
1010
- *
1011
- * @param colors array of colors to choose from
1012
- *
1013
- * @public exported from `@promptbook/color`
1014
- */
1015
- function furthest(...colors) {
1016
- return (color) => {
1017
- const furthestColor = negative(nearest(...colors.map(negative))(color));
1018
- return furthestColor;
1019
- };
1020
- }
1021
- /**
1022
- * Makes color transformer which finds the best text color (black or white) for the given background color
1023
- *
1024
- * @public exported from `@promptbook/color`
1025
- */
1026
- furthest(Color.get('white'), Color.from('black'));
1027
-
1028
- /**
1029
- * Makes color transformer which returns a grayscale version of the color
1030
- *
1031
- * @param amount from 0 to 1
1032
- *
1033
- * @public exported from `@promptbook/color`
1034
- */
1035
- function grayscale(amount) {
1036
- return ({ red, green, blue, alpha }) => {
1037
- const average = (red + green + blue) / 3;
1038
- red = Math.round(average * amount + red * (1 - amount));
1039
- green = Math.round(average * amount + green * (1 - amount));
1040
- blue = Math.round(average * amount + blue * (1 - amount));
1041
- return Color.fromValues(red, green, blue, alpha);
1042
- };
1043
- }
1044
-
1045
1032
  /**
1046
1033
  * Makes color transformer which saturate the given color
1047
1034
  *
@@ -1116,16 +1103,32 @@
1116
1103
  *
1117
1104
  * @public exported from `@promptbook/core`
1118
1105
  */
1119
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
1120
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
1106
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
1107
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1121
1108
  /**
1122
- * Dark color of the Promptbook
1109
+ * Colors for syntax highlighting in the `<BookEditor/>`
1110
+ *
1111
+ * TODO: [🗽] Unite branding and make single place for it
1112
+ *
1113
+ * @public exported from `@promptbook/core`
1114
+ */
1115
+ ({
1116
+ TITLE: Color.fromHex('#244EA8'),
1117
+ LINE: Color.fromHex('#eeeeee'),
1118
+ SEPARATOR: Color.fromHex('#cccccc'),
1119
+ COMMITMENT: Color.fromHex('#DA0F78'),
1120
+ PARAMETER: Color.fromHex('#8e44ad'),
1121
+ });
1122
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1123
+ /**
1124
+ * Chat color of the Promptbook (in chat)
1123
1125
  *
1124
1126
  * TODO: [🗽] Unite branding and make single place for it
1125
1127
  *
1126
1128
  * @public exported from `@promptbook/core`
1127
1129
  */
1128
1130
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1131
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
1129
1132
  /**
1130
1133
  * Color of the user (in chat)
1131
1134
  *
@@ -1134,6 +1137,7 @@
1134
1137
  * @public exported from `@promptbook/core`
1135
1138
  */
1136
1139
  Color.fromHex('#1D4ED8');
1140
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1137
1141
  /**
1138
1142
  * When the title is not provided, the default title is used
1139
1143
  *
@@ -1220,7 +1224,7 @@
1220
1224
  * @public exported from `@promptbook/core`
1221
1225
  */
1222
1226
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1223
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1227
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1224
1228
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1225
1229
  /**
1226
1230
  * Where to store the temporary downloads
@@ -1340,7 +1344,7 @@
1340
1344
  */
1341
1345
  class UnexpectedError extends Error {
1342
1346
  constructor(message) {
1343
- super(spaceTrim.spaceTrim((block) => `
1347
+ super(spaceTrim$1.spaceTrim((block) => `
1344
1348
  ${block(message)}
1345
1349
 
1346
1350
  Note: This error should not happen.
@@ -1366,7 +1370,7 @@
1366
1370
  constructor(whatWasThrown) {
1367
1371
  const tag = `[🤮]`;
1368
1372
  console.error(tag, whatWasThrown);
1369
- super(spaceTrim.spaceTrim(`
1373
+ super(spaceTrim$1.spaceTrim(`
1370
1374
  Non-Error object was thrown
1371
1375
 
1372
1376
  Note: Look for ${tag} in the console for more details
@@ -1480,7 +1484,7 @@
1480
1484
  function keepUnused(...valuesToKeep) {
1481
1485
  }
1482
1486
 
1483
- 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"}];
1487
+ 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"}];
1484
1488
 
1485
1489
  /**
1486
1490
  * Checks if value is valid email
@@ -1587,6 +1591,8 @@
1587
1591
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
1588
1592
  * 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.
1589
1593
  *
1594
+ * Note: [🔂] This function is idempotent.
1595
+ *
1590
1596
  * @param {string} pipelineString the candidate for a pipeline string
1591
1597
  * @returns {PipelineString} the same string as input, but validated as valid
1592
1598
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -1960,7 +1966,7 @@
1960
1966
  TODO: [🧠] Is there a better implementation?
1961
1967
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
1962
1968
  > for (const propertyName of propertyNames) {
1963
- > const value = (objectValue as really_any)[propertyName];
1969
+ > const value = (objectValue as chococake)[propertyName];
1964
1970
  > if (value && typeof value === 'object') {
1965
1971
  > deepClone(value);
1966
1972
  > }
@@ -2165,6 +2171,8 @@
2165
2171
  * - if it is valid json
2166
2172
  * - if it is meaningful
2167
2173
  *
2174
+ * Note: [🔂] This function is idempotent.
2175
+ *
2168
2176
  * @param pipeline valid or invalid PipelineJson
2169
2177
  * @returns the same pipeline if it is logically valid
2170
2178
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2182,7 +2190,7 @@
2182
2190
  if (!(error instanceof PipelineLogicError)) {
2183
2191
  throw error;
2184
2192
  }
2185
- console.error(spaceTrim.spaceTrim((block) => `
2193
+ console.error(spaceTrim$1.spaceTrim((block) => `
2186
2194
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2187
2195
 
2188
2196
  ${block(error.message)}
@@ -2209,7 +2217,7 @@
2209
2217
  })();
2210
2218
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2211
2219
  // <- Note: [🚲]
2212
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2220
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2213
2221
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2214
2222
 
2215
2223
  ${block(pipelineIdentification)}
@@ -2217,7 +2225,7 @@
2217
2225
  }
2218
2226
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2219
2227
  // <- Note: [🚲]
2220
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2228
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2221
2229
  Invalid Promptbook Version "${pipeline.bookVersion}"
2222
2230
 
2223
2231
  ${block(pipelineIdentification)}
@@ -2226,7 +2234,7 @@
2226
2234
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2227
2235
  if (!Array.isArray(pipeline.parameters)) {
2228
2236
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2229
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2237
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2230
2238
  Pipeline is valid JSON but with wrong structure
2231
2239
 
2232
2240
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2237,7 +2245,7 @@
2237
2245
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2238
2246
  if (!Array.isArray(pipeline.tasks)) {
2239
2247
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2240
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2248
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2241
2249
  Pipeline is valid JSON but with wrong structure
2242
2250
 
2243
2251
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2263,7 +2271,7 @@
2263
2271
  // Note: Check each parameter individually
2264
2272
  for (const parameter of pipeline.parameters) {
2265
2273
  if (parameter.isInput && parameter.isOutput) {
2266
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2274
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2267
2275
 
2268
2276
  Parameter \`{${parameter.name}}\` can not be both input and output
2269
2277
 
@@ -2274,7 +2282,7 @@
2274
2282
  if (!parameter.isInput &&
2275
2283
  !parameter.isOutput &&
2276
2284
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2277
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2285
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2278
2286
  Parameter \`{${parameter.name}}\` is created but not used
2279
2287
 
2280
2288
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2286,7 +2294,7 @@
2286
2294
  }
2287
2295
  // Note: Testing that parameter is either input or result of some task
2288
2296
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2289
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2297
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2290
2298
  Parameter \`{${parameter.name}}\` is declared but not defined
2291
2299
 
2292
2300
  You can do one of these:
@@ -2302,14 +2310,14 @@
2302
2310
  // Note: Checking each task individually
2303
2311
  for (const task of pipeline.tasks) {
2304
2312
  if (definedParameters.has(task.resultingParameterName)) {
2305
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2313
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2306
2314
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2307
2315
 
2308
2316
  ${block(pipelineIdentification)}
2309
2317
  `));
2310
2318
  }
2311
2319
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2312
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2320
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2313
2321
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2314
2322
 
2315
2323
  ${block(pipelineIdentification)}
@@ -2319,7 +2327,7 @@
2319
2327
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2320
2328
  if (!task.format &&
2321
2329
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2322
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2330
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2323
2331
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2324
2332
 
2325
2333
  ${block(pipelineIdentification)}
@@ -2327,7 +2335,7 @@
2327
2335
  }
2328
2336
  for (const joker of task.jokerParameterNames) {
2329
2337
  if (!task.dependentParameterNames.includes(joker)) {
2330
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2338
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2331
2339
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2332
2340
 
2333
2341
  ${block(pipelineIdentification)}
@@ -2338,21 +2346,21 @@
2338
2346
  if (task.expectations) {
2339
2347
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2340
2348
  if (min !== undefined && max !== undefined && min > max) {
2341
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2349
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2342
2350
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2343
2351
 
2344
2352
  ${block(pipelineIdentification)}
2345
2353
  `));
2346
2354
  }
2347
2355
  if (min !== undefined && min < 0) {
2348
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2356
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2349
2357
  Min expectation of ${unit} must be zero or positive
2350
2358
 
2351
2359
  ${block(pipelineIdentification)}
2352
2360
  `));
2353
2361
  }
2354
2362
  if (max !== undefined && max <= 0) {
2355
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2363
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2356
2364
  Max expectation of ${unit} must be positive
2357
2365
 
2358
2366
  ${block(pipelineIdentification)}
@@ -2374,7 +2382,7 @@
2374
2382
  while (unresovedTasks.length > 0) {
2375
2383
  if (loopLimit-- < 0) {
2376
2384
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2377
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2385
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2378
2386
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2379
2387
 
2380
2388
  ${block(pipelineIdentification)}
@@ -2384,7 +2392,7 @@
2384
2392
  if (currentlyResovedTasks.length === 0) {
2385
2393
  throw new PipelineLogicError(
2386
2394
  // TODO: [🐎] DRY
2387
- spaceTrim.spaceTrim((block) => `
2395
+ spaceTrim$1.spaceTrim((block) => `
2388
2396
 
2389
2397
  Can not resolve some parameters:
2390
2398
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2531,7 +2539,7 @@
2531
2539
  * Library of pipelines that groups together pipelines for an application.
2532
2540
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
2533
2541
  *
2534
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
2542
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
2535
2543
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
2536
2544
  */
2537
2545
  class SimplePipelineCollection {
@@ -2541,14 +2549,14 @@
2541
2549
  * @param pipelines Array of pipeline JSON objects to include in the collection
2542
2550
  *
2543
2551
  * Note: During the construction logic of all pipelines are validated
2544
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
2552
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
2545
2553
  */
2546
2554
  constructor(...pipelines) {
2547
2555
  this.collection = new Map();
2548
2556
  for (const pipeline of pipelines) {
2549
2557
  // TODO: [👠] DRY
2550
2558
  if (pipeline.pipelineUrl === undefined) {
2551
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2559
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2552
2560
  Pipeline with name "${pipeline.title}" does not have defined URL
2553
2561
 
2554
2562
  File:
@@ -2570,7 +2578,7 @@
2570
2578
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2571
2579
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2572
2580
  const existing = this.collection.get(pipeline.pipelineUrl);
2573
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2581
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2574
2582
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
2575
2583
 
2576
2584
  Conflicting files:
@@ -2602,13 +2610,13 @@
2602
2610
  const pipeline = this.collection.get(url);
2603
2611
  if (!pipeline) {
2604
2612
  if (this.listPipelines().length === 0) {
2605
- throw new NotFoundError(spaceTrim.spaceTrim(`
2613
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
2606
2614
  Pipeline with url "${url}" not found
2607
2615
 
2608
2616
  No pipelines available
2609
2617
  `));
2610
2618
  }
2611
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
2619
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
2612
2620
  Pipeline with url "${url}" not found
2613
2621
 
2614
2622
  Available pipelines:
@@ -2629,16 +2637,16 @@
2629
2637
  }
2630
2638
 
2631
2639
  /**
2632
- * Creates PipelineCollection from array of PipelineJson or PipelineString
2640
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
2633
2641
  *
2634
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
2642
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
2635
2643
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
2636
2644
  *
2637
2645
  * @param promptbookSources
2638
2646
  * @returns PipelineCollection
2639
2647
  * @public exported from `@promptbook/core`
2640
2648
  */
2641
- function createCollectionFromJson(...promptbooks) {
2649
+ function createPipelineCollectionFromJson(...promptbooks) {
2642
2650
  return new SimplePipelineCollection(...promptbooks);
2643
2651
  }
2644
2652
 
@@ -2649,7 +2657,7 @@
2649
2657
  */
2650
2658
  class MissingToolsError extends Error {
2651
2659
  constructor(message) {
2652
- super(spaceTrim.spaceTrim((block) => `
2660
+ super(spaceTrim$1.spaceTrim((block) => `
2653
2661
  ${block(message)}
2654
2662
 
2655
2663
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -2663,6 +2671,7 @@
2663
2671
  /**
2664
2672
  * Generates random token
2665
2673
  *
2674
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
2666
2675
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
2667
2676
  *
2668
2677
  * @private internal helper function
@@ -2672,6 +2681,7 @@
2672
2681
  return crypto.randomBytes(randomness).toString('hex');
2673
2682
  }
2674
2683
  /**
2684
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
2675
2685
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
2676
2686
  */
2677
2687
 
@@ -2790,6 +2800,22 @@
2790
2800
  }
2791
2801
  }
2792
2802
 
2803
+ /**
2804
+ * This error indicates error from the database
2805
+ *
2806
+ * @public exported from `@promptbook/core`
2807
+ */
2808
+ class DatabaseError extends Error {
2809
+ constructor(message) {
2810
+ super(message);
2811
+ this.name = 'DatabaseError';
2812
+ Object.setPrototypeOf(this, DatabaseError.prototype);
2813
+ }
2814
+ }
2815
+ /**
2816
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
2817
+ */
2818
+
2793
2819
  /**
2794
2820
  * This error type indicates that you try to use a feature that is not available in the current environment
2795
2821
  *
@@ -2845,6 +2871,19 @@
2845
2871
  }
2846
2872
  }
2847
2873
 
2874
+ /**
2875
+ * This error indicates that promptbook operation is not allowed
2876
+ *
2877
+ * @public exported from `@promptbook/core`
2878
+ */
2879
+ class NotAllowed extends Error {
2880
+ constructor(message) {
2881
+ super(message);
2882
+ this.name = 'NotAllowed';
2883
+ Object.setPrototypeOf(this, NotAllowed.prototype);
2884
+ }
2885
+ }
2886
+
2848
2887
  /**
2849
2888
  * This error type indicates that some part of the code is not implemented yet
2850
2889
  *
@@ -2852,7 +2891,7 @@
2852
2891
  */
2853
2892
  class NotYetImplementedError extends Error {
2854
2893
  constructor(message) {
2855
- super(spaceTrim.spaceTrim((block) => `
2894
+ super(spaceTrim$1.spaceTrim((block) => `
2856
2895
  ${block(message)}
2857
2896
 
2858
2897
  Note: This feature is not implemented yet but it will be soon.
@@ -2905,6 +2944,8 @@
2905
2944
  PromptbookFetchError,
2906
2945
  UnexpectedError,
2907
2946
  WrappedError,
2947
+ NotAllowed,
2948
+ DatabaseError,
2908
2949
  // TODO: [🪑]> VersionMismatchError,
2909
2950
  };
2910
2951
  /**
@@ -3089,11 +3130,11 @@
3089
3130
  throw deserializeError(errors[0]);
3090
3131
  }
3091
3132
  else {
3092
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3133
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
3093
3134
  Multiple errors occurred during Promptbook execution
3094
3135
 
3095
3136
  ${block(errors
3096
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3137
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
3097
3138
  ${name} ${index + 1}:
3098
3139
  ${block(stack || message)}
3099
3140
  `))
@@ -3120,6 +3161,7 @@
3120
3161
  let updatedAt = createdAt;
3121
3162
  const errors = [];
3122
3163
  const warnings = [];
3164
+ const llmCalls = [];
3123
3165
  let currentValue = {};
3124
3166
  let customTldr = null;
3125
3167
  const partialResultSubject = new rxjs.Subject();
@@ -3135,6 +3177,9 @@
3135
3177
  }, (tldrInfo) => {
3136
3178
  customTldr = tldrInfo;
3137
3179
  updatedAt = new Date();
3180
+ }, (llmCall) => {
3181
+ llmCalls.push(llmCall);
3182
+ updatedAt = new Date();
3138
3183
  });
3139
3184
  finalResultPromise
3140
3185
  .catch((error) => {
@@ -3257,7 +3302,7 @@
3257
3302
  }
3258
3303
  return {
3259
3304
  percent: percent,
3260
- message,
3305
+ message: message + ' (!!!fallback)',
3261
3306
  };
3262
3307
  },
3263
3308
  get createdAt() {
@@ -3280,6 +3325,10 @@
3280
3325
  return warnings;
3281
3326
  // <- Note: [1] --||--
3282
3327
  },
3328
+ get llmCalls() {
3329
+ return [...llmCalls, { foo: '!!! bar' }];
3330
+ // <- Note: [1] --||--
3331
+ },
3283
3332
  get currentValue() {
3284
3333
  return currentValue;
3285
3334
  // <- Note: [1] --||--
@@ -3733,6 +3782,7 @@
3733
3782
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
3734
3783
  }
3735
3784
  /**
3785
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
3736
3786
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
3737
3787
  */
3738
3788
 
@@ -3749,6 +3799,7 @@
3749
3799
  return llmTools;
3750
3800
  }
3751
3801
  /**
3802
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
3752
3803
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
3753
3804
  */
3754
3805
 
@@ -3764,7 +3815,7 @@
3764
3815
  throw new MissingToolsError('LLM tools are required for preparing persona');
3765
3816
  }
3766
3817
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
3767
- const collection = createCollectionFromJson(...PipelineCollection);
3818
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
3768
3819
  const preparePersonaExecutor = createPipelineExecutor({
3769
3820
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
3770
3821
  tools,
@@ -4330,6 +4381,8 @@
4330
4381
  /**
4331
4382
  * Converts a given text to kebab-case format.
4332
4383
  *
4384
+ * Note: [🔂] This function is idempotent.
4385
+ *
4333
4386
  * @param text The text to be converted.
4334
4387
  * @returns The kebab-case formatted string.
4335
4388
  * @example 'hello-world'
@@ -4485,6 +4538,8 @@
4485
4538
  /**
4486
4539
  * Converts a title string into a normalized name.
4487
4540
  *
4541
+ * Note: [🔂] This function is idempotent.
4542
+ *
4488
4543
  * @param value The title string to be converted to a name.
4489
4544
  * @returns A normalized name derived from the input title.
4490
4545
  * @example 'Hello World!' -> 'hello-world'
@@ -4873,7 +4928,7 @@
4873
4928
  if (task.taskType === 'PROMPT_TASK' &&
4874
4929
  knowledgePiecesCount > 0 &&
4875
4930
  !dependentParameterNames.includes('knowledge')) {
4876
- preparedContent = spaceTrim.spaceTrim(`
4931
+ preparedContent = spaceTrim$1.spaceTrim(`
4877
4932
  {content}
4878
4933
 
4879
4934
  ## Knowledge
@@ -4959,7 +5014,7 @@
4959
5014
  let title = pipeline.title;
4960
5015
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
4961
5016
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4962
- const collection = createCollectionFromJson(...PipelineCollection);
5017
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4963
5018
  const prepareTitleExecutor = createPipelineExecutor({
4964
5019
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
4965
5020
  tools,
@@ -5186,7 +5241,7 @@
5186
5241
  }
5187
5242
  catch (error) {
5188
5243
  assertsError(error);
5189
- throw new ParseError(spaceTrim.spaceTrim((block) => `
5244
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5190
5245
  Can not extract variables from the script
5191
5246
  ${block(error.stack || error.message)}
5192
5247
 
@@ -5769,10 +5824,13 @@
5769
5824
  * @public exported from `@promptbook/utils`
5770
5825
  */
5771
5826
  function countLines(text) {
5827
+ if (text === '') {
5828
+ return 0;
5829
+ }
5772
5830
  text = text.replace('\r\n', '\n');
5773
5831
  text = text.replace('\r', '\n');
5774
5832
  const lines = text.split('\n');
5775
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
5833
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5776
5834
  }
5777
5835
  /**
5778
5836
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -5897,6 +5955,8 @@
5897
5955
  * This function provides a common abstraction for result validation that can be used
5898
5956
  * by both execution logic and caching logic to ensure consistency.
5899
5957
  *
5958
+ * Note: [🔂] This function is idempotent.
5959
+ *
5900
5960
  * @param options - The validation options including result string, expectations, and format
5901
5961
  * @returns Validation result with processed string and validity status
5902
5962
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -5916,7 +5976,7 @@
5916
5976
  }
5917
5977
  catch (error) {
5918
5978
  keepUnused(error);
5919
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
5979
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
5920
5980
  Expected valid JSON string
5921
5981
 
5922
5982
  The expected JSON text:
@@ -5965,7 +6025,7 @@
5965
6025
  */
5966
6026
  async function executeAttempts(options) {
5967
6027
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
5968
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6028
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
5969
6029
  const $ongoingTaskResult = {
5970
6030
  $result: null,
5971
6031
  $resultString: null,
@@ -5979,7 +6039,7 @@
5979
6039
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
5980
6040
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
5981
6041
  if (isJokerAttempt && !jokerParameterName) {
5982
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6042
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5983
6043
  Joker not found in attempt ${attemptIndex}
5984
6044
 
5985
6045
  ${block(pipelineIdentification)}
@@ -5990,7 +6050,7 @@
5990
6050
  $ongoingTaskResult.$expectError = null;
5991
6051
  if (isJokerAttempt) {
5992
6052
  if (parameters[jokerParameterName] === undefined) {
5993
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6053
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5994
6054
  Joker parameter {${jokerParameterName}} not defined
5995
6055
 
5996
6056
  ${block(pipelineIdentification)}
@@ -6048,7 +6108,7 @@
6048
6108
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6049
6109
  break variant;
6050
6110
  case 'EMBEDDING':
6051
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6111
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6052
6112
  Embedding model can not be used in pipeline
6053
6113
 
6054
6114
  This should be catched during parsing
@@ -6059,7 +6119,7 @@
6059
6119
  break variant;
6060
6120
  // <- case [🤖]:
6061
6121
  default:
6062
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6122
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6063
6123
  Unknown model variant "${task.modelRequirements.modelVariant}"
6064
6124
 
6065
6125
  ${block(pipelineIdentification)}
@@ -6070,14 +6130,14 @@
6070
6130
  break;
6071
6131
  case 'SCRIPT_TASK':
6072
6132
  if (arrayableToArray(tools.script).length === 0) {
6073
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6133
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6074
6134
  No script execution tools are available
6075
6135
 
6076
6136
  ${block(pipelineIdentification)}
6077
6137
  `));
6078
6138
  }
6079
6139
  if (!task.contentLanguage) {
6080
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6140
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6081
6141
  Script language is not defined for SCRIPT TASK "${task.name}"
6082
6142
 
6083
6143
  ${block(pipelineIdentification)}
@@ -6108,7 +6168,7 @@
6108
6168
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6109
6169
  }
6110
6170
  else {
6111
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6171
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6112
6172
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6113
6173
 
6114
6174
  ${block(pipelineIdentification)}
@@ -6122,7 +6182,7 @@
6122
6182
  break taskType;
6123
6183
  case 'DIALOG_TASK':
6124
6184
  if (tools.userInterface === undefined) {
6125
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6185
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6126
6186
  User interface tools are not available
6127
6187
 
6128
6188
  ${block(pipelineIdentification)}
@@ -6140,7 +6200,7 @@
6140
6200
  break taskType;
6141
6201
  // <- case: [🅱]
6142
6202
  default:
6143
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6203
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6144
6204
  Unknown execution type "${task.taskType}"
6145
6205
 
6146
6206
  ${block(pipelineIdentification)}
@@ -6213,14 +6273,10 @@
6213
6273
  });
6214
6274
  }
6215
6275
  finally {
6216
- if (!isJokerAttempt &&
6217
- task.taskType === 'PROMPT_TASK' &&
6218
- $ongoingTaskResult.$prompt
6219
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6220
- // In that case we don’t want to make a report about it because it’s not a llm execution error
6221
- ) {
6222
- // TODO: [🧠] Maybe put other taskTypes into report
6223
- $executionReport.promptExecutions.push({
6276
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6277
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6278
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6279
+ const executionPromptReport = {
6224
6280
  prompt: {
6225
6281
  ...$ongoingTaskResult.$prompt,
6226
6282
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6229,13 +6285,20 @@
6229
6285
  error: $ongoingTaskResult.$expectError === null
6230
6286
  ? undefined
6231
6287
  : serializeError($ongoingTaskResult.$expectError),
6232
- });
6288
+ };
6289
+ $executionReport.promptExecutions.push(executionPromptReport);
6290
+ if (logLlmCall) {
6291
+ logLlmCall({
6292
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6293
+ report: executionPromptReport,
6294
+ });
6295
+ }
6233
6296
  }
6234
6297
  }
6235
6298
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6236
6299
  // Note: Create a summary of all failures
6237
6300
  const failuresSummary = $ongoingTaskResult.$failedResults
6238
- .map((failure) => spaceTrim.spaceTrim((block) => {
6301
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
6239
6302
  var _a, _b;
6240
6303
  return `
6241
6304
  Attempt ${failure.attemptIndex + 1}:
@@ -6245,14 +6308,14 @@
6245
6308
  Result:
6246
6309
  ${block(failure.result === null
6247
6310
  ? 'null'
6248
- : spaceTrim.spaceTrim(failure.result)
6311
+ : spaceTrim$1.spaceTrim(failure.result)
6249
6312
  .split('\n')
6250
6313
  .map((line) => `> ${line}`)
6251
6314
  .join('\n'))}
6252
6315
  `;
6253
6316
  }))
6254
6317
  .join('\n\n---\n\n');
6255
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
6318
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
6256
6319
  var _a;
6257
6320
  return `
6258
6321
  LLM execution failed ${maxExecutionAttempts}x
@@ -6272,7 +6335,7 @@
6272
6335
  }
6273
6336
  }
6274
6337
  if ($ongoingTaskResult.$resultString === null) {
6275
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6338
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6276
6339
  Something went wrong and prompt result is null
6277
6340
 
6278
6341
  ${block(pipelineIdentification)}
@@ -6294,9 +6357,9 @@
6294
6357
  * @private internal utility of `createPipelineExecutor`
6295
6358
  */
6296
6359
  async function executeFormatSubvalues(options) {
6297
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6360
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6298
6361
  if (task.foreach === undefined) {
6299
- return /* not await */ executeAttempts(options);
6362
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6300
6363
  }
6301
6364
  if (jokerParameterNames.length !== 0) {
6302
6365
  throw new UnexpectedError(spaceTrim__default["default"]((block) => `
@@ -6502,7 +6565,7 @@
6502
6565
  },
6503
6566
  content: task.content,
6504
6567
  parameters,
6505
- };
6568
+ }; /* <- Note: [🤛] */
6506
6569
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6507
6570
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6508
6571
  const { index } = knowledgePiece;
@@ -6578,7 +6641,7 @@
6578
6641
  // Note: Doublecheck that ALL reserved parameters are defined:
6579
6642
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6580
6643
  if (reservedParameters[parameterName] === undefined) {
6581
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6644
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6582
6645
  Reserved parameter {${parameterName}} is not defined
6583
6646
 
6584
6647
  ${block(pipelineIdentification)}
@@ -6597,14 +6660,14 @@
6597
6660
  * @private internal utility of `createPipelineExecutor`
6598
6661
  */
6599
6662
  async function executeTask(options) {
6600
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6663
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6601
6664
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6602
6665
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6603
6666
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
6604
6667
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6605
6668
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6606
6669
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6607
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6670
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6608
6671
  Dependent parameters are not consistent with used parameters:
6609
6672
 
6610
6673
  Dependent parameters:
@@ -6648,7 +6711,7 @@
6648
6711
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6649
6712
  // Houston, we have a problem
6650
6713
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6651
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6714
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6652
6715
  Parameter \`{${parameterName}}\` is NOT defined
6653
6716
  BUT used in task "${currentTask.title || currentTask.name}"
6654
6717
 
@@ -6676,6 +6739,7 @@
6676
6739
  tools,
6677
6740
  $executionReport,
6678
6741
  onProgress,
6742
+ logLlmCall,
6679
6743
  pipelineIdentification,
6680
6744
  maxExecutionAttempts,
6681
6745
  maxParallelCount,
@@ -6716,9 +6780,32 @@
6716
6780
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6717
6781
  if (parametersToPass[parameter.name] === undefined) {
6718
6782
  // [4]
6719
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6783
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6720
6784
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6721
6785
 
6786
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6787
+
6788
+ All parameters:
6789
+ ${block(preparedPipeline.parameters
6790
+ .map(({ name, isInput, isOutput, description }) => {
6791
+ let line = `\`{${name}}\``;
6792
+ if (isInput) {
6793
+ line += ' `[input parameter]`';
6794
+ }
6795
+ if (isOutput) {
6796
+ line += ' `[output parameter]`';
6797
+ }
6798
+ if (parametersToPass[name] === undefined) {
6799
+ line += ` <- Warning: Should be in the output but its not |`;
6800
+ }
6801
+ if (description) {
6802
+ line += ` ${description}`;
6803
+ }
6804
+ return line;
6805
+ })
6806
+ .map((line, index) => `${index + 1}) ${line}`)
6807
+ .join('\n'))}
6808
+
6722
6809
  ${block(pipelineIdentification)}
6723
6810
  `)));
6724
6811
  continue;
@@ -6739,7 +6826,7 @@
6739
6826
  * @private internal utility of `createPipelineExecutor`
6740
6827
  */
6741
6828
  async function executePipeline(options) {
6742
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6829
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6743
6830
  let { preparedPipeline } = options;
6744
6831
  if (preparedPipeline === undefined) {
6745
6832
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6801,7 +6888,7 @@
6801
6888
  for (const parameterName of Object.keys(inputParameters)) {
6802
6889
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6803
6890
  if (parameter === undefined) {
6804
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6891
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6805
6892
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6806
6893
 
6807
6894
  ${block(pipelineIdentification)}
@@ -6816,7 +6903,7 @@
6816
6903
  // TODO: [🧠] This should be also non-critical error
6817
6904
  return exportJson({
6818
6905
  name: 'pipelineExecutorResult',
6819
- message: spaceTrim.spaceTrim((block) => `
6906
+ message: spaceTrim$1.spaceTrim((block) => `
6820
6907
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6821
6908
 
6822
6909
  ${block(pipelineIdentification)}
@@ -6825,7 +6912,7 @@
6825
6912
  value: {
6826
6913
  isSuccessful: false,
6827
6914
  errors: [
6828
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6915
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6829
6916
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6830
6917
 
6831
6918
  ${block(pipelineIdentification)}
@@ -6852,7 +6939,7 @@
6852
6939
  while (unresovedTasks.length > 0) {
6853
6940
  if (loopLimit-- < 0) {
6854
6941
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
6855
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6942
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6856
6943
  Loop limit reached during resolving parameters pipeline execution
6857
6944
 
6858
6945
  ${block(pipelineIdentification)}
@@ -6862,7 +6949,7 @@
6862
6949
  if (!currentTask && resolving.length === 0) {
6863
6950
  throw new UnexpectedError(
6864
6951
  // TODO: [🐎] DRY
6865
- spaceTrim.spaceTrim((block) => `
6952
+ spaceTrim$1.spaceTrim((block) => `
6866
6953
  Can not resolve some parameters:
6867
6954
 
6868
6955
  ${block(pipelineIdentification)}
@@ -6902,7 +6989,7 @@
6902
6989
  tools,
6903
6990
  onProgress(newOngoingResult) {
6904
6991
  if (isReturned) {
6905
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6992
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6906
6993
  Can not call \`onProgress\` after pipeline execution is finished
6907
6994
 
6908
6995
  ${block(pipelineIdentification)}
@@ -6917,8 +7004,9 @@
6917
7004
  onProgress(newOngoingResult);
6918
7005
  }
6919
7006
  },
7007
+ logLlmCall,
6920
7008
  $executionReport: executionReport,
6921
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7009
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
6922
7010
  ${block(pipelineIdentification)}
6923
7011
  Task name: ${currentTask.name}
6924
7012
  Task title: ${currentTask.title}
@@ -7027,7 +7115,7 @@
7027
7115
  preparedPipeline = pipeline;
7028
7116
  }
7029
7117
  else if (isNotPreparedWarningSuppressed !== true) {
7030
- console.warn(spaceTrim.spaceTrim((block) => `
7118
+ console.warn(spaceTrim$1.spaceTrim((block) => `
7031
7119
  Pipeline is not prepared
7032
7120
 
7033
7121
  ${block(pipelineIdentification)}
@@ -7040,7 +7128,7 @@
7040
7128
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7041
7129
  }
7042
7130
  let runCount = 0;
7043
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7131
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7044
7132
  runCount++;
7045
7133
  return /* not await */ executePipeline({
7046
7134
  pipeline,
@@ -7051,7 +7139,8 @@
7051
7139
  inputParameters,
7052
7140
  tools,
7053
7141
  onProgress,
7054
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7142
+ logLlmCall,
7143
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7055
7144
  ${block(pipelineIdentification)}
7056
7145
  ${runCount === 1 ? '' : `Run #${runCount}`}
7057
7146
  `),
@@ -7212,7 +7301,7 @@
7212
7301
  }
7213
7302
  const llmTools = getSingleLlmExecutionTools(llm);
7214
7303
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7215
- const collection = createCollectionFromJson(...PipelineCollection);
7304
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7216
7305
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7217
7306
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7218
7307
  tools: {
@@ -7359,7 +7448,7 @@
7359
7448
  * @public exported from `@promptbook/markdown-utils`
7360
7449
  */
7361
7450
  function removeMarkdownComments(content) {
7362
- return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
7451
+ return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
7363
7452
  }
7364
7453
 
7365
7454
  /**
@@ -7372,7 +7461,7 @@
7372
7461
  const warningLine = `<!-- ${GENERATOR_WARNING} -->`;
7373
7462
  const sectionRegex = new RegExp(`<!--${sectionName}-->([\\s\\S]*?)<!--/${sectionName}-->`, 'g');
7374
7463
  const sectionMatch = content.match(sectionRegex);
7375
- const contentToInsert = spaceTrim.spaceTrim((block) => `
7464
+ const contentToInsert = spaceTrim$1.spaceTrim((block) => `
7376
7465
  <!--${sectionName}-->
7377
7466
  ${block(warningLine)}
7378
7467
  ${block(sectionContent)}
@@ -7385,7 +7474,7 @@
7385
7474
  const placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
7386
7475
  if (placeForSection !== null) {
7387
7476
  const [heading] = placeForSection;
7388
- return content.replace(heading, spaceTrim.spaceTrim((block) => `
7477
+ return content.replace(heading, spaceTrim$1.spaceTrim((block) => `
7389
7478
  ${block(contentToInsert)}
7390
7479
 
7391
7480
  ${block(heading)}
@@ -7394,7 +7483,7 @@
7394
7483
  console.warn(`No place where to put the section <!--${sectionName}-->, using the end of the file`);
7395
7484
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7396
7485
  // <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
7397
- return spaceTrim.spaceTrim((block) => `
7486
+ return spaceTrim$1.spaceTrim((block) => `
7398
7487
  ${block(content)}
7399
7488
 
7400
7489
  ${block(contentToInsert)}
@@ -7809,13 +7898,13 @@
7809
7898
  * @public exported from `@promptbook/markdown-utils`
7810
7899
  */
7811
7900
  function trimCodeBlock(value) {
7812
- value = spaceTrim.spaceTrim(value);
7901
+ value = spaceTrim$1.spaceTrim(value);
7813
7902
  if (!/^```[a-z]*(.*)```$/is.test(value)) {
7814
7903
  return value;
7815
7904
  }
7816
7905
  value = value.replace(/^```[a-z]*/i, '');
7817
7906
  value = value.replace(/```$/i, '');
7818
- value = spaceTrim.spaceTrim(value);
7907
+ value = spaceTrim$1.spaceTrim(value);
7819
7908
  return value;
7820
7909
  }
7821
7910
 
@@ -7828,9 +7917,9 @@
7828
7917
  * @public exported from `@promptbook/markdown-utils`
7829
7918
  */
7830
7919
  function trimEndOfCodeBlock(value) {
7831
- value = spaceTrim.spaceTrim(value);
7920
+ value = spaceTrim$1.spaceTrim(value);
7832
7921
  value = value.replace(/```$/g, '');
7833
- value = spaceTrim.spaceTrim(value);
7922
+ value = spaceTrim$1.spaceTrim(value);
7834
7923
  return value;
7835
7924
  }
7836
7925