@promptbook/markdown-utils 0.103.0-1 → 0.103.0-100

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 (258) hide show
  1. package/README.md +153 -89
  2. package/esm/index.es.js +307 -236
  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 +20 -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 +58 -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 +19 -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 +10 -0
  26. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileTooltip.d.ts +15 -0
  27. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +83 -8
  28. package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +14 -0
  29. package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
  30. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +14 -0
  31. package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
  32. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +10 -0
  33. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
  34. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
  35. package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
  36. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  37. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
  38. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
  39. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +5 -0
  40. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +29 -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 +13 -0
  48. package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
  49. package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +1 -1
  50. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -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/cli/cli-commands/_boilerplate.d.ts +2 -1
  58. package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
  59. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
  60. package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
  61. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
  62. package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
  63. package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
  64. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  65. package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
  66. package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
  67. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
  68. package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
  69. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
  70. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
  71. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
  72. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
  73. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
  74. package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
  75. package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
  76. package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
  77. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
  78. package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
  79. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
  80. package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
  81. package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
  82. package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
  83. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
  84. package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
  85. package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +35 -0
  86. package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
  87. package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
  88. package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
  89. package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
  90. package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
  91. package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
  92. package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
  93. package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
  94. package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
  95. package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
  96. package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
  97. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
  98. package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
  99. package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
  100. package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
  101. package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
  102. package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
  103. package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
  104. package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
  105. package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
  106. package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
  107. package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
  108. package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
  109. package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
  110. package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
  111. package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
  112. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +38 -0
  113. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
  114. package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
  115. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
  116. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +8 -2
  117. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
  118. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
  119. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  120. package/esm/typings/src/commitments/index.d.ts +93 -0
  121. package/esm/typings/src/config.d.ts +24 -3
  122. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
  123. package/esm/typings/src/errors/0-index.d.ts +6 -0
  124. package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
  125. package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
  126. package/esm/typings/src/errors/WrappedError.d.ts +2 -2
  127. package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
  128. package/esm/typings/src/execution/Executables.d.ts +3 -0
  129. package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
  130. package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
  131. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  132. package/esm/typings/src/execution/LlmExecutionTools.d.ts +21 -1
  133. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
  134. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
  135. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
  136. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
  137. package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
  138. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
  139. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
  140. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
  141. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
  142. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  143. package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
  144. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
  145. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
  146. package/esm/typings/src/llm-providers/agent/Agent.d.ts +70 -0
  147. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
  148. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
  149. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
  150. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
  151. package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
  152. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
  153. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  154. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  155. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
  156. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
  157. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  158. package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
  159. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  160. package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
  161. package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
  162. package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
  163. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  164. package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
  165. package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
  166. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
  167. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
  168. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
  169. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
  170. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
  171. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
  172. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
  173. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
  174. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
  175. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
  176. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
  177. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
  178. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
  179. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
  180. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
  181. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  182. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
  183. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
  184. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
  185. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
  186. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
  187. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
  188. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
  189. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
  190. package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
  191. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
  192. package/esm/typings/src/types/LlmCall.d.ts +20 -0
  193. package/esm/typings/src/types/Updatable.d.ts +19 -0
  194. package/esm/typings/src/types/typeAliases.d.ts +32 -2
  195. package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
  196. package/esm/typings/src/utils/color/Color.d.ts +15 -0
  197. package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
  198. package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
  199. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
  200. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  201. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  202. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  203. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  204. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  205. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  206. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
  207. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
  208. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
  209. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
  210. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
  211. package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
  212. package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
  213. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
  214. package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
  215. package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
  216. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
  217. package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
  218. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
  219. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  220. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  221. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
  222. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
  223. package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
  224. package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
  225. package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
  226. package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
  227. package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
  228. package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
  229. package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
  230. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +25 -0
  231. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
  232. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
  233. package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
  234. package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
  235. package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
  236. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
  237. package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
  238. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  239. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
  240. package/esm/typings/src/version.d.ts +1 -1
  241. package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
  242. package/package.json +5 -5
  243. package/umd/index.umd.js +272 -201
  244. package/umd/index.umd.js.map +1 -1
  245. package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
  246. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
  247. package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
  248. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
  249. package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
  250. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  251. /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
  252. /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
  253. /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
  254. /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
  255. /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
  256. /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
  257. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
  258. /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-1';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-100';
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
@@ -439,6 +448,28 @@
439
448
  throw new Error(`Can not create color from given object`);
440
449
  }
441
450
  }
451
+ /**
452
+ * Creates a new Color instance from miscellaneous formats
453
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
454
+ *
455
+ * @param color
456
+ * @returns Color object
457
+ */
458
+ static fromSafe(color) {
459
+ try {
460
+ return Color.from(color);
461
+ }
462
+ catch (error) {
463
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
464
+ console.warn(spaceTrim((block) => `
465
+ Color.fromSafe error:
466
+ ${block(error.message)}
467
+
468
+ Returning default PROMPTBOOK_COLOR.
469
+ `));
470
+ return Color.fromString('promptbook');
471
+ }
472
+ }
442
473
  /**
443
474
  * Creates a new Color instance from miscellaneous string formats
444
475
  *
@@ -506,6 +537,9 @@
506
537
  if (hex.length === 3) {
507
538
  return Color.fromHex3(hex);
508
539
  }
540
+ if (hex.length === 4) {
541
+ return Color.fromHex4(hex);
542
+ }
509
543
  if (hex.length === 6) {
510
544
  return Color.fromHex6(hex);
511
545
  }
@@ -526,6 +560,19 @@
526
560
  const b = parseInt(hex.substr(2, 1), 16) * 16;
527
561
  return take(new Color(r, g, b));
528
562
  }
563
+ /**
564
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
565
+ *
566
+ * @param color in hex for example `09df`
567
+ * @returns Color object
568
+ */
569
+ static fromHex4(hex) {
570
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
571
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
572
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
573
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
574
+ return take(new Color(r, g, b, a));
575
+ }
529
576
  /**
530
577
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
531
578
  *
@@ -716,7 +763,8 @@
716
763
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
717
764
  */
718
765
  static isHexColorString(value) {
719
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
766
+ return (typeof value === 'string' &&
767
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
720
768
  }
721
769
  /**
722
770
  * Creates new Color object
@@ -831,6 +879,23 @@
831
879
  * TODO: Maybe connect with textures
832
880
  */
833
881
 
882
+ /**
883
+ * Makes color transformer which returns a grayscale version of the color
884
+ *
885
+ * @param amount from 0 to 1
886
+ *
887
+ * @public exported from `@promptbook/color`
888
+ */
889
+ function grayscale(amount) {
890
+ return ({ red, green, blue, alpha }) => {
891
+ const average = (red + green + blue) / 3;
892
+ red = Math.round(average * amount + red * (1 - amount));
893
+ green = Math.round(average * amount + green * (1 - amount));
894
+ blue = Math.round(average * amount + blue * (1 - amount));
895
+ return Color.fromValues(red, green, blue, alpha);
896
+ };
897
+ }
898
+
834
899
  /**
835
900
  * Converts HSL values to RGB values
836
901
  *
@@ -946,102 +1011,6 @@
946
1011
  * TODO: Maybe implement by mix+hsl
947
1012
  */
948
1013
 
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
1014
  /**
1046
1015
  * Makes color transformer which saturate the given color
1047
1016
  *
@@ -1116,16 +1085,32 @@
1116
1085
  *
1117
1086
  * @public exported from `@promptbook/core`
1118
1087
  */
1119
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
1120
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
1088
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
1089
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1090
+ /**
1091
+ * Colors for syntax highlighting in the `<BookEditor/>`
1092
+ *
1093
+ * TODO: [🗽] Unite branding and make single place for it
1094
+ *
1095
+ * @public exported from `@promptbook/core`
1096
+ */
1097
+ ({
1098
+ TITLE: Color.fromHex('#244EA8'),
1099
+ LINE: Color.fromHex('#eeeeee'),
1100
+ SEPARATOR: Color.fromHex('#cccccc'),
1101
+ COMMITMENT: Color.fromHex('#DA0F78'),
1102
+ PARAMETER: Color.fromHex('#8e44ad'),
1103
+ });
1104
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1121
1105
  /**
1122
- * Dark color of the Promptbook
1106
+ * Chat color of the Promptbook (in chat)
1123
1107
  *
1124
1108
  * TODO: [🗽] Unite branding and make single place for it
1125
1109
  *
1126
1110
  * @public exported from `@promptbook/core`
1127
1111
  */
1128
1112
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1113
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
1129
1114
  /**
1130
1115
  * Color of the user (in chat)
1131
1116
  *
@@ -1134,6 +1119,7 @@
1134
1119
  * @public exported from `@promptbook/core`
1135
1120
  */
1136
1121
  Color.fromHex('#1D4ED8');
1122
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1137
1123
  /**
1138
1124
  * When the title is not provided, the default title is used
1139
1125
  *
@@ -1220,7 +1206,7 @@
1220
1206
  * @public exported from `@promptbook/core`
1221
1207
  */
1222
1208
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1223
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1209
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1224
1210
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1225
1211
  /**
1226
1212
  * Where to store the temporary downloads
@@ -1340,7 +1326,7 @@
1340
1326
  */
1341
1327
  class UnexpectedError extends Error {
1342
1328
  constructor(message) {
1343
- super(spaceTrim.spaceTrim((block) => `
1329
+ super(spaceTrim$1.spaceTrim((block) => `
1344
1330
  ${block(message)}
1345
1331
 
1346
1332
  Note: This error should not happen.
@@ -1366,7 +1352,7 @@
1366
1352
  constructor(whatWasThrown) {
1367
1353
  const tag = `[🤮]`;
1368
1354
  console.error(tag, whatWasThrown);
1369
- super(spaceTrim.spaceTrim(`
1355
+ super(spaceTrim$1.spaceTrim(`
1370
1356
  Non-Error object was thrown
1371
1357
 
1372
1358
  Note: Look for ${tag} in the console for more details
@@ -1480,7 +1466,7 @@
1480
1466
  function keepUnused(...valuesToKeep) {
1481
1467
  }
1482
1468
 
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-0",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"}];
1469
+ 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
1470
 
1485
1471
  /**
1486
1472
  * Checks if value is valid email
@@ -1587,6 +1573,8 @@
1587
1573
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
1588
1574
  * 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
1575
  *
1576
+ * Note: [🔂] This function is idempotent.
1577
+ *
1590
1578
  * @param {string} pipelineString the candidate for a pipeline string
1591
1579
  * @returns {PipelineString} the same string as input, but validated as valid
1592
1580
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -1960,7 +1948,7 @@
1960
1948
  TODO: [🧠] Is there a better implementation?
1961
1949
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
1962
1950
  > for (const propertyName of propertyNames) {
1963
- > const value = (objectValue as really_any)[propertyName];
1951
+ > const value = (objectValue as chococake)[propertyName];
1964
1952
  > if (value && typeof value === 'object') {
1965
1953
  > deepClone(value);
1966
1954
  > }
@@ -2165,6 +2153,8 @@
2165
2153
  * - if it is valid json
2166
2154
  * - if it is meaningful
2167
2155
  *
2156
+ * Note: [🔂] This function is idempotent.
2157
+ *
2168
2158
  * @param pipeline valid or invalid PipelineJson
2169
2159
  * @returns the same pipeline if it is logically valid
2170
2160
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2182,7 +2172,7 @@
2182
2172
  if (!(error instanceof PipelineLogicError)) {
2183
2173
  throw error;
2184
2174
  }
2185
- console.error(spaceTrim.spaceTrim((block) => `
2175
+ console.error(spaceTrim$1.spaceTrim((block) => `
2186
2176
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2187
2177
 
2188
2178
  ${block(error.message)}
@@ -2209,7 +2199,7 @@
2209
2199
  })();
2210
2200
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2211
2201
  // <- Note: [🚲]
2212
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2202
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2213
2203
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2214
2204
 
2215
2205
  ${block(pipelineIdentification)}
@@ -2217,7 +2207,7 @@
2217
2207
  }
2218
2208
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2219
2209
  // <- Note: [🚲]
2220
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2210
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2221
2211
  Invalid Promptbook Version "${pipeline.bookVersion}"
2222
2212
 
2223
2213
  ${block(pipelineIdentification)}
@@ -2226,7 +2216,7 @@
2226
2216
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2227
2217
  if (!Array.isArray(pipeline.parameters)) {
2228
2218
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2229
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2219
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2230
2220
  Pipeline is valid JSON but with wrong structure
2231
2221
 
2232
2222
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2237,7 +2227,7 @@
2237
2227
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2238
2228
  if (!Array.isArray(pipeline.tasks)) {
2239
2229
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2240
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2230
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2241
2231
  Pipeline is valid JSON but with wrong structure
2242
2232
 
2243
2233
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2263,7 +2253,7 @@
2263
2253
  // Note: Check each parameter individually
2264
2254
  for (const parameter of pipeline.parameters) {
2265
2255
  if (parameter.isInput && parameter.isOutput) {
2266
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2256
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2267
2257
 
2268
2258
  Parameter \`{${parameter.name}}\` can not be both input and output
2269
2259
 
@@ -2274,7 +2264,7 @@
2274
2264
  if (!parameter.isInput &&
2275
2265
  !parameter.isOutput &&
2276
2266
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2277
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2267
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2278
2268
  Parameter \`{${parameter.name}}\` is created but not used
2279
2269
 
2280
2270
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2286,7 +2276,7 @@
2286
2276
  }
2287
2277
  // Note: Testing that parameter is either input or result of some task
2288
2278
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2289
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2279
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2290
2280
  Parameter \`{${parameter.name}}\` is declared but not defined
2291
2281
 
2292
2282
  You can do one of these:
@@ -2302,14 +2292,14 @@
2302
2292
  // Note: Checking each task individually
2303
2293
  for (const task of pipeline.tasks) {
2304
2294
  if (definedParameters.has(task.resultingParameterName)) {
2305
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2295
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2306
2296
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2307
2297
 
2308
2298
  ${block(pipelineIdentification)}
2309
2299
  `));
2310
2300
  }
2311
2301
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2312
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2302
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2313
2303
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2314
2304
 
2315
2305
  ${block(pipelineIdentification)}
@@ -2319,7 +2309,7 @@
2319
2309
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2320
2310
  if (!task.format &&
2321
2311
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2322
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2312
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2323
2313
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2324
2314
 
2325
2315
  ${block(pipelineIdentification)}
@@ -2327,7 +2317,7 @@
2327
2317
  }
2328
2318
  for (const joker of task.jokerParameterNames) {
2329
2319
  if (!task.dependentParameterNames.includes(joker)) {
2330
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2320
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2331
2321
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2332
2322
 
2333
2323
  ${block(pipelineIdentification)}
@@ -2338,21 +2328,21 @@
2338
2328
  if (task.expectations) {
2339
2329
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2340
2330
  if (min !== undefined && max !== undefined && min > max) {
2341
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2331
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2342
2332
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2343
2333
 
2344
2334
  ${block(pipelineIdentification)}
2345
2335
  `));
2346
2336
  }
2347
2337
  if (min !== undefined && min < 0) {
2348
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2338
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2349
2339
  Min expectation of ${unit} must be zero or positive
2350
2340
 
2351
2341
  ${block(pipelineIdentification)}
2352
2342
  `));
2353
2343
  }
2354
2344
  if (max !== undefined && max <= 0) {
2355
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2345
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2356
2346
  Max expectation of ${unit} must be positive
2357
2347
 
2358
2348
  ${block(pipelineIdentification)}
@@ -2374,7 +2364,7 @@
2374
2364
  while (unresovedTasks.length > 0) {
2375
2365
  if (loopLimit-- < 0) {
2376
2366
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2377
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2367
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2378
2368
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2379
2369
 
2380
2370
  ${block(pipelineIdentification)}
@@ -2384,7 +2374,7 @@
2384
2374
  if (currentlyResovedTasks.length === 0) {
2385
2375
  throw new PipelineLogicError(
2386
2376
  // TODO: [🐎] DRY
2387
- spaceTrim.spaceTrim((block) => `
2377
+ spaceTrim$1.spaceTrim((block) => `
2388
2378
 
2389
2379
  Can not resolve some parameters:
2390
2380
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2531,7 +2521,7 @@
2531
2521
  * Library of pipelines that groups together pipelines for an application.
2532
2522
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
2533
2523
  *
2534
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
2524
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
2535
2525
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
2536
2526
  */
2537
2527
  class SimplePipelineCollection {
@@ -2541,14 +2531,14 @@
2541
2531
  * @param pipelines Array of pipeline JSON objects to include in the collection
2542
2532
  *
2543
2533
  * 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
2534
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
2545
2535
  */
2546
2536
  constructor(...pipelines) {
2547
2537
  this.collection = new Map();
2548
2538
  for (const pipeline of pipelines) {
2549
2539
  // TODO: [👠] DRY
2550
2540
  if (pipeline.pipelineUrl === undefined) {
2551
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2541
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2552
2542
  Pipeline with name "${pipeline.title}" does not have defined URL
2553
2543
 
2554
2544
  File:
@@ -2570,7 +2560,7 @@
2570
2560
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2571
2561
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2572
2562
  const existing = this.collection.get(pipeline.pipelineUrl);
2573
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2563
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2574
2564
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
2575
2565
 
2576
2566
  Conflicting files:
@@ -2602,13 +2592,13 @@
2602
2592
  const pipeline = this.collection.get(url);
2603
2593
  if (!pipeline) {
2604
2594
  if (this.listPipelines().length === 0) {
2605
- throw new NotFoundError(spaceTrim.spaceTrim(`
2595
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
2606
2596
  Pipeline with url "${url}" not found
2607
2597
 
2608
2598
  No pipelines available
2609
2599
  `));
2610
2600
  }
2611
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
2601
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
2612
2602
  Pipeline with url "${url}" not found
2613
2603
 
2614
2604
  Available pipelines:
@@ -2629,16 +2619,16 @@
2629
2619
  }
2630
2620
 
2631
2621
  /**
2632
- * Creates PipelineCollection from array of PipelineJson or PipelineString
2622
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
2633
2623
  *
2634
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
2624
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
2635
2625
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
2636
2626
  *
2637
2627
  * @param promptbookSources
2638
2628
  * @returns PipelineCollection
2639
2629
  * @public exported from `@promptbook/core`
2640
2630
  */
2641
- function createCollectionFromJson(...promptbooks) {
2631
+ function createPipelineCollectionFromJson(...promptbooks) {
2642
2632
  return new SimplePipelineCollection(...promptbooks);
2643
2633
  }
2644
2634
 
@@ -2649,7 +2639,7 @@
2649
2639
  */
2650
2640
  class MissingToolsError extends Error {
2651
2641
  constructor(message) {
2652
- super(spaceTrim.spaceTrim((block) => `
2642
+ super(spaceTrim$1.spaceTrim((block) => `
2653
2643
  ${block(message)}
2654
2644
 
2655
2645
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -2663,6 +2653,7 @@
2663
2653
  /**
2664
2654
  * Generates random token
2665
2655
  *
2656
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
2666
2657
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
2667
2658
  *
2668
2659
  * @private internal helper function
@@ -2672,6 +2663,7 @@
2672
2663
  return crypto.randomBytes(randomness).toString('hex');
2673
2664
  }
2674
2665
  /**
2666
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
2675
2667
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
2676
2668
  */
2677
2669
 
@@ -2790,6 +2782,22 @@
2790
2782
  }
2791
2783
  }
2792
2784
 
2785
+ /**
2786
+ * This error indicates error from the database
2787
+ *
2788
+ * @public exported from `@promptbook/core`
2789
+ */
2790
+ class DatabaseError extends Error {
2791
+ constructor(message) {
2792
+ super(message);
2793
+ this.name = 'DatabaseError';
2794
+ Object.setPrototypeOf(this, DatabaseError.prototype);
2795
+ }
2796
+ }
2797
+ /**
2798
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
2799
+ */
2800
+
2793
2801
  /**
2794
2802
  * This error type indicates that you try to use a feature that is not available in the current environment
2795
2803
  *
@@ -2845,6 +2853,19 @@
2845
2853
  }
2846
2854
  }
2847
2855
 
2856
+ /**
2857
+ * This error indicates that promptbook operation is not allowed
2858
+ *
2859
+ * @public exported from `@promptbook/core`
2860
+ */
2861
+ class NotAllowed extends Error {
2862
+ constructor(message) {
2863
+ super(message);
2864
+ this.name = 'NotAllowed';
2865
+ Object.setPrototypeOf(this, NotAllowed.prototype);
2866
+ }
2867
+ }
2868
+
2848
2869
  /**
2849
2870
  * This error type indicates that some part of the code is not implemented yet
2850
2871
  *
@@ -2852,7 +2873,7 @@
2852
2873
  */
2853
2874
  class NotYetImplementedError extends Error {
2854
2875
  constructor(message) {
2855
- super(spaceTrim.spaceTrim((block) => `
2876
+ super(spaceTrim$1.spaceTrim((block) => `
2856
2877
  ${block(message)}
2857
2878
 
2858
2879
  Note: This feature is not implemented yet but it will be soon.
@@ -2905,6 +2926,8 @@
2905
2926
  PromptbookFetchError,
2906
2927
  UnexpectedError,
2907
2928
  WrappedError,
2929
+ NotAllowed,
2930
+ DatabaseError,
2908
2931
  // TODO: [🪑]> VersionMismatchError,
2909
2932
  };
2910
2933
  /**
@@ -3089,11 +3112,11 @@
3089
3112
  throw deserializeError(errors[0]);
3090
3113
  }
3091
3114
  else {
3092
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3115
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
3093
3116
  Multiple errors occurred during Promptbook execution
3094
3117
 
3095
3118
  ${block(errors
3096
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3119
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
3097
3120
  ${name} ${index + 1}:
3098
3121
  ${block(stack || message)}
3099
3122
  `))
@@ -3120,6 +3143,7 @@
3120
3143
  let updatedAt = createdAt;
3121
3144
  const errors = [];
3122
3145
  const warnings = [];
3146
+ const llmCalls = [];
3123
3147
  let currentValue = {};
3124
3148
  let customTldr = null;
3125
3149
  const partialResultSubject = new rxjs.Subject();
@@ -3135,6 +3159,9 @@
3135
3159
  }, (tldrInfo) => {
3136
3160
  customTldr = tldrInfo;
3137
3161
  updatedAt = new Date();
3162
+ }, (llmCall) => {
3163
+ llmCalls.push(llmCall);
3164
+ updatedAt = new Date();
3138
3165
  });
3139
3166
  finalResultPromise
3140
3167
  .catch((error) => {
@@ -3257,7 +3284,7 @@
3257
3284
  }
3258
3285
  return {
3259
3286
  percent: percent,
3260
- message,
3287
+ message: message + ' (!!!fallback)',
3261
3288
  };
3262
3289
  },
3263
3290
  get createdAt() {
@@ -3280,6 +3307,10 @@
3280
3307
  return warnings;
3281
3308
  // <- Note: [1] --||--
3282
3309
  },
3310
+ get llmCalls() {
3311
+ return [...llmCalls, { foo: '!!! bar' }];
3312
+ // <- Note: [1] --||--
3313
+ },
3283
3314
  get currentValue() {
3284
3315
  return currentValue;
3285
3316
  // <- Note: [1] --||--
@@ -3733,6 +3764,7 @@
3733
3764
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
3734
3765
  }
3735
3766
  /**
3767
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
3736
3768
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
3737
3769
  */
3738
3770
 
@@ -3749,6 +3781,7 @@
3749
3781
  return llmTools;
3750
3782
  }
3751
3783
  /**
3784
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
3752
3785
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
3753
3786
  */
3754
3787
 
@@ -3764,7 +3797,7 @@
3764
3797
  throw new MissingToolsError('LLM tools are required for preparing persona');
3765
3798
  }
3766
3799
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
3767
- const collection = createCollectionFromJson(...PipelineCollection);
3800
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
3768
3801
  const preparePersonaExecutor = createPipelineExecutor({
3769
3802
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
3770
3803
  tools,
@@ -4330,6 +4363,8 @@
4330
4363
  /**
4331
4364
  * Converts a given text to kebab-case format.
4332
4365
  *
4366
+ * Note: [🔂] This function is idempotent.
4367
+ *
4333
4368
  * @param text The text to be converted.
4334
4369
  * @returns The kebab-case formatted string.
4335
4370
  * @example 'hello-world'
@@ -4485,6 +4520,8 @@
4485
4520
  /**
4486
4521
  * Converts a title string into a normalized name.
4487
4522
  *
4523
+ * Note: [🔂] This function is idempotent.
4524
+ *
4488
4525
  * @param value The title string to be converted to a name.
4489
4526
  * @returns A normalized name derived from the input title.
4490
4527
  * @example 'Hello World!' -> 'hello-world'
@@ -4873,7 +4910,7 @@
4873
4910
  if (task.taskType === 'PROMPT_TASK' &&
4874
4911
  knowledgePiecesCount > 0 &&
4875
4912
  !dependentParameterNames.includes('knowledge')) {
4876
- preparedContent = spaceTrim.spaceTrim(`
4913
+ preparedContent = spaceTrim$1.spaceTrim(`
4877
4914
  {content}
4878
4915
 
4879
4916
  ## Knowledge
@@ -4959,7 +4996,7 @@
4959
4996
  let title = pipeline.title;
4960
4997
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
4961
4998
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4962
- const collection = createCollectionFromJson(...PipelineCollection);
4999
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4963
5000
  const prepareTitleExecutor = createPipelineExecutor({
4964
5001
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
4965
5002
  tools,
@@ -5186,7 +5223,7 @@
5186
5223
  }
5187
5224
  catch (error) {
5188
5225
  assertsError(error);
5189
- throw new ParseError(spaceTrim.spaceTrim((block) => `
5226
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5190
5227
  Can not extract variables from the script
5191
5228
  ${block(error.stack || error.message)}
5192
5229
 
@@ -5769,10 +5806,13 @@
5769
5806
  * @public exported from `@promptbook/utils`
5770
5807
  */
5771
5808
  function countLines(text) {
5809
+ if (text === '') {
5810
+ return 0;
5811
+ }
5772
5812
  text = text.replace('\r\n', '\n');
5773
5813
  text = text.replace('\r', '\n');
5774
5814
  const lines = text.split('\n');
5775
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
5815
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5776
5816
  }
5777
5817
  /**
5778
5818
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -5897,6 +5937,8 @@
5897
5937
  * This function provides a common abstraction for result validation that can be used
5898
5938
  * by both execution logic and caching logic to ensure consistency.
5899
5939
  *
5940
+ * Note: [🔂] This function is idempotent.
5941
+ *
5900
5942
  * @param options - The validation options including result string, expectations, and format
5901
5943
  * @returns Validation result with processed string and validity status
5902
5944
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -5916,7 +5958,7 @@
5916
5958
  }
5917
5959
  catch (error) {
5918
5960
  keepUnused(error);
5919
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
5961
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
5920
5962
  Expected valid JSON string
5921
5963
 
5922
5964
  The expected JSON text:
@@ -5965,7 +6007,7 @@
5965
6007
  */
5966
6008
  async function executeAttempts(options) {
5967
6009
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
5968
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6010
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
5969
6011
  const $ongoingTaskResult = {
5970
6012
  $result: null,
5971
6013
  $resultString: null,
@@ -5979,7 +6021,7 @@
5979
6021
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
5980
6022
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
5981
6023
  if (isJokerAttempt && !jokerParameterName) {
5982
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6024
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5983
6025
  Joker not found in attempt ${attemptIndex}
5984
6026
 
5985
6027
  ${block(pipelineIdentification)}
@@ -5990,7 +6032,7 @@
5990
6032
  $ongoingTaskResult.$expectError = null;
5991
6033
  if (isJokerAttempt) {
5992
6034
  if (parameters[jokerParameterName] === undefined) {
5993
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6035
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5994
6036
  Joker parameter {${jokerParameterName}} not defined
5995
6037
 
5996
6038
  ${block(pipelineIdentification)}
@@ -6048,7 +6090,7 @@
6048
6090
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6049
6091
  break variant;
6050
6092
  case 'EMBEDDING':
6051
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6093
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6052
6094
  Embedding model can not be used in pipeline
6053
6095
 
6054
6096
  This should be catched during parsing
@@ -6059,7 +6101,7 @@
6059
6101
  break variant;
6060
6102
  // <- case [🤖]:
6061
6103
  default:
6062
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6104
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6063
6105
  Unknown model variant "${task.modelRequirements.modelVariant}"
6064
6106
 
6065
6107
  ${block(pipelineIdentification)}
@@ -6070,14 +6112,14 @@
6070
6112
  break;
6071
6113
  case 'SCRIPT_TASK':
6072
6114
  if (arrayableToArray(tools.script).length === 0) {
6073
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6115
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6074
6116
  No script execution tools are available
6075
6117
 
6076
6118
  ${block(pipelineIdentification)}
6077
6119
  `));
6078
6120
  }
6079
6121
  if (!task.contentLanguage) {
6080
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6122
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6081
6123
  Script language is not defined for SCRIPT TASK "${task.name}"
6082
6124
 
6083
6125
  ${block(pipelineIdentification)}
@@ -6108,7 +6150,7 @@
6108
6150
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6109
6151
  }
6110
6152
  else {
6111
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6153
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6112
6154
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6113
6155
 
6114
6156
  ${block(pipelineIdentification)}
@@ -6122,7 +6164,7 @@
6122
6164
  break taskType;
6123
6165
  case 'DIALOG_TASK':
6124
6166
  if (tools.userInterface === undefined) {
6125
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6167
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6126
6168
  User interface tools are not available
6127
6169
 
6128
6170
  ${block(pipelineIdentification)}
@@ -6140,7 +6182,7 @@
6140
6182
  break taskType;
6141
6183
  // <- case: [🅱]
6142
6184
  default:
6143
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6185
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6144
6186
  Unknown execution type "${task.taskType}"
6145
6187
 
6146
6188
  ${block(pipelineIdentification)}
@@ -6213,14 +6255,10 @@
6213
6255
  });
6214
6256
  }
6215
6257
  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({
6258
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6259
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6260
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6261
+ const executionPromptReport = {
6224
6262
  prompt: {
6225
6263
  ...$ongoingTaskResult.$prompt,
6226
6264
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6229,13 +6267,20 @@
6229
6267
  error: $ongoingTaskResult.$expectError === null
6230
6268
  ? undefined
6231
6269
  : serializeError($ongoingTaskResult.$expectError),
6232
- });
6270
+ };
6271
+ $executionReport.promptExecutions.push(executionPromptReport);
6272
+ if (logLlmCall) {
6273
+ logLlmCall({
6274
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6275
+ report: executionPromptReport,
6276
+ });
6277
+ }
6233
6278
  }
6234
6279
  }
6235
6280
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6236
6281
  // Note: Create a summary of all failures
6237
6282
  const failuresSummary = $ongoingTaskResult.$failedResults
6238
- .map((failure) => spaceTrim.spaceTrim((block) => {
6283
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
6239
6284
  var _a, _b;
6240
6285
  return `
6241
6286
  Attempt ${failure.attemptIndex + 1}:
@@ -6245,14 +6290,14 @@
6245
6290
  Result:
6246
6291
  ${block(failure.result === null
6247
6292
  ? 'null'
6248
- : spaceTrim.spaceTrim(failure.result)
6293
+ : spaceTrim$1.spaceTrim(failure.result)
6249
6294
  .split('\n')
6250
6295
  .map((line) => `> ${line}`)
6251
6296
  .join('\n'))}
6252
6297
  `;
6253
6298
  }))
6254
6299
  .join('\n\n---\n\n');
6255
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
6300
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
6256
6301
  var _a;
6257
6302
  return `
6258
6303
  LLM execution failed ${maxExecutionAttempts}x
@@ -6272,7 +6317,7 @@
6272
6317
  }
6273
6318
  }
6274
6319
  if ($ongoingTaskResult.$resultString === null) {
6275
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6320
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6276
6321
  Something went wrong and prompt result is null
6277
6322
 
6278
6323
  ${block(pipelineIdentification)}
@@ -6294,9 +6339,9 @@
6294
6339
  * @private internal utility of `createPipelineExecutor`
6295
6340
  */
6296
6341
  async function executeFormatSubvalues(options) {
6297
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6342
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6298
6343
  if (task.foreach === undefined) {
6299
- return /* not await */ executeAttempts(options);
6344
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6300
6345
  }
6301
6346
  if (jokerParameterNames.length !== 0) {
6302
6347
  throw new UnexpectedError(spaceTrim__default["default"]((block) => `
@@ -6502,7 +6547,7 @@
6502
6547
  },
6503
6548
  content: task.content,
6504
6549
  parameters,
6505
- };
6550
+ }; /* <- Note: [🤛] */
6506
6551
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6507
6552
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6508
6553
  const { index } = knowledgePiece;
@@ -6578,7 +6623,7 @@
6578
6623
  // Note: Doublecheck that ALL reserved parameters are defined:
6579
6624
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6580
6625
  if (reservedParameters[parameterName] === undefined) {
6581
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6626
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6582
6627
  Reserved parameter {${parameterName}} is not defined
6583
6628
 
6584
6629
  ${block(pipelineIdentification)}
@@ -6597,14 +6642,14 @@
6597
6642
  * @private internal utility of `createPipelineExecutor`
6598
6643
  */
6599
6644
  async function executeTask(options) {
6600
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6645
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6601
6646
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6602
6647
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6603
6648
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
6604
6649
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6605
6650
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6606
6651
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6607
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6652
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6608
6653
  Dependent parameters are not consistent with used parameters:
6609
6654
 
6610
6655
  Dependent parameters:
@@ -6648,7 +6693,7 @@
6648
6693
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6649
6694
  // Houston, we have a problem
6650
6695
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6651
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6696
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6652
6697
  Parameter \`{${parameterName}}\` is NOT defined
6653
6698
  BUT used in task "${currentTask.title || currentTask.name}"
6654
6699
 
@@ -6676,6 +6721,7 @@
6676
6721
  tools,
6677
6722
  $executionReport,
6678
6723
  onProgress,
6724
+ logLlmCall,
6679
6725
  pipelineIdentification,
6680
6726
  maxExecutionAttempts,
6681
6727
  maxParallelCount,
@@ -6716,9 +6762,32 @@
6716
6762
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6717
6763
  if (parametersToPass[parameter.name] === undefined) {
6718
6764
  // [4]
6719
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6765
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6720
6766
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6721
6767
 
6768
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6769
+
6770
+ All parameters:
6771
+ ${block(preparedPipeline.parameters
6772
+ .map(({ name, isInput, isOutput, description }) => {
6773
+ let line = `\`{${name}}\``;
6774
+ if (isInput) {
6775
+ line += ' `[input parameter]`';
6776
+ }
6777
+ if (isOutput) {
6778
+ line += ' `[output parameter]`';
6779
+ }
6780
+ if (parametersToPass[name] === undefined) {
6781
+ line += ` <- Warning: Should be in the output but its not |`;
6782
+ }
6783
+ if (description) {
6784
+ line += ` ${description}`;
6785
+ }
6786
+ return line;
6787
+ })
6788
+ .map((line, index) => `${index + 1}) ${line}`)
6789
+ .join('\n'))}
6790
+
6722
6791
  ${block(pipelineIdentification)}
6723
6792
  `)));
6724
6793
  continue;
@@ -6739,7 +6808,7 @@
6739
6808
  * @private internal utility of `createPipelineExecutor`
6740
6809
  */
6741
6810
  async function executePipeline(options) {
6742
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6811
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6743
6812
  let { preparedPipeline } = options;
6744
6813
  if (preparedPipeline === undefined) {
6745
6814
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6801,7 +6870,7 @@
6801
6870
  for (const parameterName of Object.keys(inputParameters)) {
6802
6871
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6803
6872
  if (parameter === undefined) {
6804
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6873
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6805
6874
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6806
6875
 
6807
6876
  ${block(pipelineIdentification)}
@@ -6816,7 +6885,7 @@
6816
6885
  // TODO: [🧠] This should be also non-critical error
6817
6886
  return exportJson({
6818
6887
  name: 'pipelineExecutorResult',
6819
- message: spaceTrim.spaceTrim((block) => `
6888
+ message: spaceTrim$1.spaceTrim((block) => `
6820
6889
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6821
6890
 
6822
6891
  ${block(pipelineIdentification)}
@@ -6825,7 +6894,7 @@
6825
6894
  value: {
6826
6895
  isSuccessful: false,
6827
6896
  errors: [
6828
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6897
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6829
6898
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6830
6899
 
6831
6900
  ${block(pipelineIdentification)}
@@ -6852,7 +6921,7 @@
6852
6921
  while (unresovedTasks.length > 0) {
6853
6922
  if (loopLimit-- < 0) {
6854
6923
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
6855
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6924
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6856
6925
  Loop limit reached during resolving parameters pipeline execution
6857
6926
 
6858
6927
  ${block(pipelineIdentification)}
@@ -6862,7 +6931,7 @@
6862
6931
  if (!currentTask && resolving.length === 0) {
6863
6932
  throw new UnexpectedError(
6864
6933
  // TODO: [🐎] DRY
6865
- spaceTrim.spaceTrim((block) => `
6934
+ spaceTrim$1.spaceTrim((block) => `
6866
6935
  Can not resolve some parameters:
6867
6936
 
6868
6937
  ${block(pipelineIdentification)}
@@ -6902,7 +6971,7 @@
6902
6971
  tools,
6903
6972
  onProgress(newOngoingResult) {
6904
6973
  if (isReturned) {
6905
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6974
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6906
6975
  Can not call \`onProgress\` after pipeline execution is finished
6907
6976
 
6908
6977
  ${block(pipelineIdentification)}
@@ -6917,8 +6986,9 @@
6917
6986
  onProgress(newOngoingResult);
6918
6987
  }
6919
6988
  },
6989
+ logLlmCall,
6920
6990
  $executionReport: executionReport,
6921
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
6991
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
6922
6992
  ${block(pipelineIdentification)}
6923
6993
  Task name: ${currentTask.name}
6924
6994
  Task title: ${currentTask.title}
@@ -7027,7 +7097,7 @@
7027
7097
  preparedPipeline = pipeline;
7028
7098
  }
7029
7099
  else if (isNotPreparedWarningSuppressed !== true) {
7030
- console.warn(spaceTrim.spaceTrim((block) => `
7100
+ console.warn(spaceTrim$1.spaceTrim((block) => `
7031
7101
  Pipeline is not prepared
7032
7102
 
7033
7103
  ${block(pipelineIdentification)}
@@ -7040,7 +7110,7 @@
7040
7110
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7041
7111
  }
7042
7112
  let runCount = 0;
7043
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7113
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7044
7114
  runCount++;
7045
7115
  return /* not await */ executePipeline({
7046
7116
  pipeline,
@@ -7051,7 +7121,8 @@
7051
7121
  inputParameters,
7052
7122
  tools,
7053
7123
  onProgress,
7054
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7124
+ logLlmCall,
7125
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7055
7126
  ${block(pipelineIdentification)}
7056
7127
  ${runCount === 1 ? '' : `Run #${runCount}`}
7057
7128
  `),
@@ -7212,7 +7283,7 @@
7212
7283
  }
7213
7284
  const llmTools = getSingleLlmExecutionTools(llm);
7214
7285
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7215
- const collection = createCollectionFromJson(...PipelineCollection);
7286
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7216
7287
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7217
7288
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7218
7289
  tools: {
@@ -7359,7 +7430,7 @@
7359
7430
  * @public exported from `@promptbook/markdown-utils`
7360
7431
  */
7361
7432
  function removeMarkdownComments(content) {
7362
- return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
7433
+ return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
7363
7434
  }
7364
7435
 
7365
7436
  /**
@@ -7372,7 +7443,7 @@
7372
7443
  const warningLine = `<!-- ${GENERATOR_WARNING} -->`;
7373
7444
  const sectionRegex = new RegExp(`<!--${sectionName}-->([\\s\\S]*?)<!--/${sectionName}-->`, 'g');
7374
7445
  const sectionMatch = content.match(sectionRegex);
7375
- const contentToInsert = spaceTrim.spaceTrim((block) => `
7446
+ const contentToInsert = spaceTrim$1.spaceTrim((block) => `
7376
7447
  <!--${sectionName}-->
7377
7448
  ${block(warningLine)}
7378
7449
  ${block(sectionContent)}
@@ -7385,7 +7456,7 @@
7385
7456
  const placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
7386
7457
  if (placeForSection !== null) {
7387
7458
  const [heading] = placeForSection;
7388
- return content.replace(heading, spaceTrim.spaceTrim((block) => `
7459
+ return content.replace(heading, spaceTrim$1.spaceTrim((block) => `
7389
7460
  ${block(contentToInsert)}
7390
7461
 
7391
7462
  ${block(heading)}
@@ -7394,7 +7465,7 @@
7394
7465
  console.warn(`No place where to put the section <!--${sectionName}-->, using the end of the file`);
7395
7466
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7396
7467
  // <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
7397
- return spaceTrim.spaceTrim((block) => `
7468
+ return spaceTrim$1.spaceTrim((block) => `
7398
7469
  ${block(content)}
7399
7470
 
7400
7471
  ${block(contentToInsert)}
@@ -7809,13 +7880,13 @@
7809
7880
  * @public exported from `@promptbook/markdown-utils`
7810
7881
  */
7811
7882
  function trimCodeBlock(value) {
7812
- value = spaceTrim.spaceTrim(value);
7883
+ value = spaceTrim$1.spaceTrim(value);
7813
7884
  if (!/^```[a-z]*(.*)```$/is.test(value)) {
7814
7885
  return value;
7815
7886
  }
7816
7887
  value = value.replace(/^```[a-z]*/i, '');
7817
7888
  value = value.replace(/```$/i, '');
7818
- value = spaceTrim.spaceTrim(value);
7889
+ value = spaceTrim$1.spaceTrim(value);
7819
7890
  return value;
7820
7891
  }
7821
7892
 
@@ -7828,9 +7899,9 @@
7828
7899
  * @public exported from `@promptbook/markdown-utils`
7829
7900
  */
7830
7901
  function trimEndOfCodeBlock(value) {
7831
- value = spaceTrim.spaceTrim(value);
7902
+ value = spaceTrim$1.spaceTrim(value);
7832
7903
  value = value.replace(/```$/g, '');
7833
- value = spaceTrim.spaceTrim(value);
7904
+ value = spaceTrim$1.spaceTrim(value);
7834
7905
  return value;
7835
7906
  }
7836
7907