@promptbook/website-crawler 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 +295 -224
  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 +6 -6
  243. package/umd/index.umd.js +264 -193
  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/esm/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import spaceTrim$1, { spaceTrim } from 'spacetrim';
1
+ import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { Readability } from '@mozilla/readability';
3
3
  import { JSDOM } from 'jsdom';
4
4
  import { SHA256 } from 'crypto-js';
@@ -20,14 +20,14 @@ import { Converter } from 'showdown';
20
20
  * @generated
21
21
  * @see https://github.com/webgptorg/book
22
22
  */
23
- const BOOK_LANGUAGE_VERSION = '1.0.0';
23
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
24
24
  /**
25
25
  * The version of the Promptbook engine
26
26
  *
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-1';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-100';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -77,6 +77,17 @@ function $deepFreeze(objectValue) {
77
77
  * TODO: [🧠] Is there a way how to meaningfully test this utility
78
78
  */
79
79
 
80
+ /**
81
+ * Trims string from all 4 sides
82
+ *
83
+ * Note: This is a re-exported function from the `spacetrim` package which is
84
+ * Developed by same author @hejny as this package
85
+ *
86
+ * @public exported from `@promptbook/utils`
87
+ * @see https://github.com/hejny/spacetrim#usage
88
+ */
89
+ const spaceTrim = spaceTrim$1;
90
+
80
91
  /**
81
92
  * @private util of `@promptbook/color`
82
93
  * @de
@@ -125,6 +136,7 @@ function take(initialValue) {
125
136
  * @public exported from `@promptbook/color`
126
137
  */
127
138
  const CSS_COLORS = {
139
+ promptbook: '#79EAFD',
128
140
  transparent: 'rgba(0,0,0,0)',
129
141
  aliceblue: '#f0f8ff',
130
142
  antiquewhite: '#faebd7',
@@ -306,9 +318,6 @@ function checkChannelValue(channelName, value) {
306
318
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
307
319
  }
308
320
  }
309
- /**
310
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
311
- */
312
321
 
313
322
  /**
314
323
  * Color object represents an RGB color with alpha channel
@@ -343,6 +352,28 @@ class Color {
343
352
  throw new Error(`Can not create color from given object`);
344
353
  }
345
354
  }
355
+ /**
356
+ * Creates a new Color instance from miscellaneous formats
357
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
358
+ *
359
+ * @param color
360
+ * @returns Color object
361
+ */
362
+ static fromSafe(color) {
363
+ try {
364
+ return Color.from(color);
365
+ }
366
+ catch (error) {
367
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
368
+ console.warn(spaceTrim((block) => `
369
+ Color.fromSafe error:
370
+ ${block(error.message)}
371
+
372
+ Returning default PROMPTBOOK_COLOR.
373
+ `));
374
+ return Color.fromString('promptbook');
375
+ }
376
+ }
346
377
  /**
347
378
  * Creates a new Color instance from miscellaneous string formats
348
379
  *
@@ -410,6 +441,9 @@ class Color {
410
441
  if (hex.length === 3) {
411
442
  return Color.fromHex3(hex);
412
443
  }
444
+ if (hex.length === 4) {
445
+ return Color.fromHex4(hex);
446
+ }
413
447
  if (hex.length === 6) {
414
448
  return Color.fromHex6(hex);
415
449
  }
@@ -430,6 +464,19 @@ class Color {
430
464
  const b = parseInt(hex.substr(2, 1), 16) * 16;
431
465
  return take(new Color(r, g, b));
432
466
  }
467
+ /**
468
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
469
+ *
470
+ * @param color in hex for example `09df`
471
+ * @returns Color object
472
+ */
473
+ static fromHex4(hex) {
474
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
475
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
476
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
477
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
478
+ return take(new Color(r, g, b, a));
479
+ }
433
480
  /**
434
481
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
435
482
  *
@@ -620,7 +667,8 @@ class Color {
620
667
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
621
668
  */
622
669
  static isHexColorString(value) {
623
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
670
+ return (typeof value === 'string' &&
671
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
624
672
  }
625
673
  /**
626
674
  * Creates new Color object
@@ -735,6 +783,23 @@ class Color {
735
783
  * TODO: Maybe connect with textures
736
784
  */
737
785
 
786
+ /**
787
+ * Makes color transformer which returns a grayscale version of the color
788
+ *
789
+ * @param amount from 0 to 1
790
+ *
791
+ * @public exported from `@promptbook/color`
792
+ */
793
+ function grayscale(amount) {
794
+ return ({ red, green, blue, alpha }) => {
795
+ const average = (red + green + blue) / 3;
796
+ red = Math.round(average * amount + red * (1 - amount));
797
+ green = Math.round(average * amount + green * (1 - amount));
798
+ blue = Math.round(average * amount + blue * (1 - amount));
799
+ return Color.fromValues(red, green, blue, alpha);
800
+ };
801
+ }
802
+
738
803
  /**
739
804
  * Converts HSL values to RGB values
740
805
  *
@@ -850,102 +915,6 @@ function lighten(amount) {
850
915
  * TODO: Maybe implement by mix+hsl
851
916
  */
852
917
 
853
- /**
854
- * Calculates distance between two colors
855
- *
856
- * @param color1 first color
857
- * @param color2 second color
858
- *
859
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
860
- *
861
- * @public exported from `@promptbook/color`
862
- */
863
- /**
864
- * Calculates distance between two colors without square root
865
- *
866
- * @param color1 first color
867
- * @param color2 second color
868
- *
869
- * @public exported from `@promptbook/color`
870
- */
871
- function colorDistanceSquared(color1, color2) {
872
- const rmean = (color1.red + color2.red) / 2;
873
- const r = color1.red - color2.red;
874
- const g = color1.green - color2.green;
875
- const b = color1.blue - color2.blue;
876
- const weightR = 2 + rmean / 256;
877
- const weightG = 4.0;
878
- const weightB = 2 + (255 - rmean) / 256;
879
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
880
- return distance;
881
- }
882
-
883
- /**
884
- * Makes color transformer which finds the nearest color from the given list
885
- *
886
- * @param colors array of colors to choose from
887
- *
888
- * @public exported from `@promptbook/color`
889
- */
890
- function nearest(...colors) {
891
- return (color) => {
892
- const distances = colors.map((c) => colorDistanceSquared(c, color));
893
- const minDistance = Math.min(...distances);
894
- const minIndex = distances.indexOf(minDistance);
895
- const nearestColor = colors[minIndex];
896
- return nearestColor;
897
- };
898
- }
899
-
900
- /**
901
- * Color transformer which returns the negative color
902
- *
903
- * @public exported from `@promptbook/color`
904
- */
905
- function negative(color) {
906
- const r = 255 - color.red;
907
- const g = 255 - color.green;
908
- const b = 255 - color.blue;
909
- return Color.fromValues(r, g, b, color.alpha);
910
- }
911
-
912
- /**
913
- * Makes color transformer which finds the furthest color from the given list
914
- *
915
- * @param colors array of colors to choose from
916
- *
917
- * @public exported from `@promptbook/color`
918
- */
919
- function furthest(...colors) {
920
- return (color) => {
921
- const furthestColor = negative(nearest(...colors.map(negative))(color));
922
- return furthestColor;
923
- };
924
- }
925
- /**
926
- * Makes color transformer which finds the best text color (black or white) for the given background color
927
- *
928
- * @public exported from `@promptbook/color`
929
- */
930
- furthest(Color.get('white'), Color.from('black'));
931
-
932
- /**
933
- * Makes color transformer which returns a grayscale version of the color
934
- *
935
- * @param amount from 0 to 1
936
- *
937
- * @public exported from `@promptbook/color`
938
- */
939
- function grayscale(amount) {
940
- return ({ red, green, blue, alpha }) => {
941
- const average = (red + green + blue) / 3;
942
- red = Math.round(average * amount + red * (1 - amount));
943
- green = Math.round(average * amount + green * (1 - amount));
944
- blue = Math.round(average * amount + blue * (1 - amount));
945
- return Color.fromValues(red, green, blue, alpha);
946
- };
947
- }
948
-
949
918
  /**
950
919
  * Makes color transformer which saturate the given color
951
920
  *
@@ -1014,16 +983,32 @@ const ADMIN_GITHUB_NAME = 'hejny';
1014
983
  *
1015
984
  * @public exported from `@promptbook/core`
1016
985
  */
1017
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
1018
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
986
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
987
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
988
+ /**
989
+ * Colors for syntax highlighting in the `<BookEditor/>`
990
+ *
991
+ * TODO: [🗽] Unite branding and make single place for it
992
+ *
993
+ * @public exported from `@promptbook/core`
994
+ */
995
+ ({
996
+ TITLE: Color.fromHex('#244EA8'),
997
+ LINE: Color.fromHex('#eeeeee'),
998
+ SEPARATOR: Color.fromHex('#cccccc'),
999
+ COMMITMENT: Color.fromHex('#DA0F78'),
1000
+ PARAMETER: Color.fromHex('#8e44ad'),
1001
+ });
1002
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1019
1003
  /**
1020
- * Dark color of the Promptbook
1004
+ * Chat color of the Promptbook (in chat)
1021
1005
  *
1022
1006
  * TODO: [🗽] Unite branding and make single place for it
1023
1007
  *
1024
1008
  * @public exported from `@promptbook/core`
1025
1009
  */
1026
1010
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1011
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
1027
1012
  /**
1028
1013
  * Color of the user (in chat)
1029
1014
  *
@@ -1032,6 +1017,7 @@ PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1032
1017
  * @public exported from `@promptbook/core`
1033
1018
  */
1034
1019
  Color.fromHex('#1D4ED8');
1020
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1035
1021
  /**
1036
1022
  * When the title is not provided, the default title is used
1037
1023
  *
@@ -1118,7 +1104,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
1118
1104
  * @public exported from `@promptbook/core`
1119
1105
  */
1120
1106
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1121
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1107
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1122
1108
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1123
1109
  /**
1124
1110
  * Where to store the temporary downloads
@@ -1194,7 +1180,7 @@ true);
1194
1180
  */
1195
1181
  class NotYetImplementedError extends Error {
1196
1182
  constructor(message) {
1197
- super(spaceTrim((block) => `
1183
+ super(spaceTrim$1((block) => `
1198
1184
  ${block(message)}
1199
1185
 
1200
1186
  Note: This feature is not implemented yet but it will be soon.
@@ -1218,7 +1204,7 @@ class NotYetImplementedError extends Error {
1218
1204
  function getErrorReportUrl(error) {
1219
1205
  const report = {
1220
1206
  title: `🐜 Error report from ${NAME}`,
1221
- body: spaceTrim$1((block) => `
1207
+ body: spaceTrim$2((block) => `
1222
1208
 
1223
1209
 
1224
1210
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1261,7 +1247,7 @@ function getErrorReportUrl(error) {
1261
1247
  */
1262
1248
  class UnexpectedError extends Error {
1263
1249
  constructor(message) {
1264
- super(spaceTrim((block) => `
1250
+ super(spaceTrim$1((block) => `
1265
1251
  ${block(message)}
1266
1252
 
1267
1253
  Note: This error should not happen.
@@ -1753,6 +1739,8 @@ function removeDiacritics(input) {
1753
1739
  /**
1754
1740
  * Converts a given text to kebab-case format.
1755
1741
  *
1742
+ * Note: [🔂] This function is idempotent.
1743
+ *
1756
1744
  * @param text The text to be converted.
1757
1745
  * @returns The kebab-case formatted string.
1758
1746
  * @example 'hello-world'
@@ -1908,6 +1896,8 @@ function removeEmojis(text) {
1908
1896
  /**
1909
1897
  * Converts a title string into a normalized name.
1910
1898
  *
1899
+ * Note: [🔂] This function is idempotent.
1900
+ *
1911
1901
  * @param value The title string to be converted to a name.
1912
1902
  * @returns A normalized name derived from the input title.
1913
1903
  * @example 'Hello World!' -> 'hello-world'
@@ -1999,7 +1989,7 @@ async function getScraperIntermediateSource(source, options) {
1999
1989
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2000
1990
  */
2001
1991
 
2002
- 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"}];
1992
+ 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"}];
2003
1993
 
2004
1994
  /**
2005
1995
  * Checks if value is valid email
@@ -2041,7 +2031,7 @@ class WrappedError extends Error {
2041
2031
  constructor(whatWasThrown) {
2042
2032
  const tag = `[🤮]`;
2043
2033
  console.error(tag, whatWasThrown);
2044
- super(spaceTrim(`
2034
+ super(spaceTrim$1(`
2045
2035
  Non-Error object was thrown
2046
2036
 
2047
2037
  Note: Look for ${tag} in the console for more details
@@ -2106,6 +2096,8 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
2106
2096
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
2107
2097
  * 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.
2108
2098
  *
2099
+ * Note: [🔂] This function is idempotent.
2100
+ *
2109
2101
  * @param {string} pipelineString the candidate for a pipeline string
2110
2102
  * @returns {PipelineString} the same string as input, but validated as valid
2111
2103
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2265,7 +2257,7 @@ function pipelineJsonToString(pipelineJson) {
2265
2257
  pipelineString += '\n\n';
2266
2258
  pipelineString += '```' + contentLanguage;
2267
2259
  pipelineString += '\n';
2268
- pipelineString += spaceTrim$1(content);
2260
+ pipelineString += spaceTrim$2(content);
2269
2261
  // <- TODO: [main] !!3 Escape
2270
2262
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2271
2263
  pipelineString += '\n';
@@ -2359,7 +2351,7 @@ function checkSerializableAsJson(options) {
2359
2351
  }
2360
2352
  else if (typeof value === 'object') {
2361
2353
  if (value instanceof Date) {
2362
- throw new UnexpectedError(spaceTrim$1((block) => `
2354
+ throw new UnexpectedError(spaceTrim$2((block) => `
2363
2355
  \`${name}\` is Date
2364
2356
 
2365
2357
  Use \`string_date_iso8601\` instead
@@ -2378,7 +2370,7 @@ function checkSerializableAsJson(options) {
2378
2370
  throw new UnexpectedError(`${name} is RegExp`);
2379
2371
  }
2380
2372
  else if (value instanceof Error) {
2381
- throw new UnexpectedError(spaceTrim$1((block) => `
2373
+ throw new UnexpectedError(spaceTrim$2((block) => `
2382
2374
  \`${name}\` is unserialized Error
2383
2375
 
2384
2376
  Use function \`serializeError\`
@@ -2401,7 +2393,7 @@ function checkSerializableAsJson(options) {
2401
2393
  }
2402
2394
  catch (error) {
2403
2395
  assertsError(error);
2404
- throw new UnexpectedError(spaceTrim$1((block) => `
2396
+ throw new UnexpectedError(spaceTrim$2((block) => `
2405
2397
  \`${name}\` is not serializable
2406
2398
 
2407
2399
  ${block(error.stack || error.message)}
@@ -2433,7 +2425,7 @@ function checkSerializableAsJson(options) {
2433
2425
  }
2434
2426
  }
2435
2427
  else {
2436
- throw new UnexpectedError(spaceTrim$1((block) => `
2428
+ throw new UnexpectedError(spaceTrim$2((block) => `
2437
2429
  \`${name}\` is unknown type
2438
2430
 
2439
2431
  Additional message for \`${name}\`:
@@ -2463,7 +2455,7 @@ function deepClone(objectValue) {
2463
2455
  TODO: [🧠] Is there a better implementation?
2464
2456
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
2465
2457
  > for (const propertyName of propertyNames) {
2466
- > const value = (objectValue as really_any)[propertyName];
2458
+ > const value = (objectValue as chococake)[propertyName];
2467
2459
  > if (value && typeof value === 'object') {
2468
2460
  > deepClone(value);
2469
2461
  > }
@@ -2668,6 +2660,8 @@ function isValidPipelineUrl(url) {
2668
2660
  * - if it is valid json
2669
2661
  * - if it is meaningful
2670
2662
  *
2663
+ * Note: [🔂] This function is idempotent.
2664
+ *
2671
2665
  * @param pipeline valid or invalid PipelineJson
2672
2666
  * @returns the same pipeline if it is logically valid
2673
2667
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2685,7 +2679,7 @@ function validatePipeline(pipeline) {
2685
2679
  if (!(error instanceof PipelineLogicError)) {
2686
2680
  throw error;
2687
2681
  }
2688
- console.error(spaceTrim((block) => `
2682
+ console.error(spaceTrim$1((block) => `
2689
2683
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2690
2684
 
2691
2685
  ${block(error.message)}
@@ -2712,7 +2706,7 @@ function validatePipeline_InnerFunction(pipeline) {
2712
2706
  })();
2713
2707
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2714
2708
  // <- Note: [🚲]
2715
- throw new PipelineLogicError(spaceTrim((block) => `
2709
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2716
2710
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2717
2711
 
2718
2712
  ${block(pipelineIdentification)}
@@ -2720,7 +2714,7 @@ function validatePipeline_InnerFunction(pipeline) {
2720
2714
  }
2721
2715
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2722
2716
  // <- Note: [🚲]
2723
- throw new PipelineLogicError(spaceTrim((block) => `
2717
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2724
2718
  Invalid Promptbook Version "${pipeline.bookVersion}"
2725
2719
 
2726
2720
  ${block(pipelineIdentification)}
@@ -2729,7 +2723,7 @@ function validatePipeline_InnerFunction(pipeline) {
2729
2723
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2730
2724
  if (!Array.isArray(pipeline.parameters)) {
2731
2725
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2732
- throw new ParseError(spaceTrim((block) => `
2726
+ throw new ParseError(spaceTrim$1((block) => `
2733
2727
  Pipeline is valid JSON but with wrong structure
2734
2728
 
2735
2729
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2740,7 +2734,7 @@ function validatePipeline_InnerFunction(pipeline) {
2740
2734
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2741
2735
  if (!Array.isArray(pipeline.tasks)) {
2742
2736
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2743
- throw new ParseError(spaceTrim((block) => `
2737
+ throw new ParseError(spaceTrim$1((block) => `
2744
2738
  Pipeline is valid JSON but with wrong structure
2745
2739
 
2746
2740
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2766,7 +2760,7 @@ function validatePipeline_InnerFunction(pipeline) {
2766
2760
  // Note: Check each parameter individually
2767
2761
  for (const parameter of pipeline.parameters) {
2768
2762
  if (parameter.isInput && parameter.isOutput) {
2769
- throw new PipelineLogicError(spaceTrim((block) => `
2763
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2770
2764
 
2771
2765
  Parameter \`{${parameter.name}}\` can not be both input and output
2772
2766
 
@@ -2777,7 +2771,7 @@ function validatePipeline_InnerFunction(pipeline) {
2777
2771
  if (!parameter.isInput &&
2778
2772
  !parameter.isOutput &&
2779
2773
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2780
- throw new PipelineLogicError(spaceTrim((block) => `
2774
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2781
2775
  Parameter \`{${parameter.name}}\` is created but not used
2782
2776
 
2783
2777
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2789,7 +2783,7 @@ function validatePipeline_InnerFunction(pipeline) {
2789
2783
  }
2790
2784
  // Note: Testing that parameter is either input or result of some task
2791
2785
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2792
- throw new PipelineLogicError(spaceTrim((block) => `
2786
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2793
2787
  Parameter \`{${parameter.name}}\` is declared but not defined
2794
2788
 
2795
2789
  You can do one of these:
@@ -2805,14 +2799,14 @@ function validatePipeline_InnerFunction(pipeline) {
2805
2799
  // Note: Checking each task individually
2806
2800
  for (const task of pipeline.tasks) {
2807
2801
  if (definedParameters.has(task.resultingParameterName)) {
2808
- throw new PipelineLogicError(spaceTrim((block) => `
2802
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2809
2803
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2810
2804
 
2811
2805
  ${block(pipelineIdentification)}
2812
2806
  `));
2813
2807
  }
2814
2808
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2815
- throw new PipelineLogicError(spaceTrim((block) => `
2809
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2816
2810
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2817
2811
 
2818
2812
  ${block(pipelineIdentification)}
@@ -2822,7 +2816,7 @@ function validatePipeline_InnerFunction(pipeline) {
2822
2816
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2823
2817
  if (!task.format &&
2824
2818
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2825
- throw new PipelineLogicError(spaceTrim((block) => `
2819
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2826
2820
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2827
2821
 
2828
2822
  ${block(pipelineIdentification)}
@@ -2830,7 +2824,7 @@ function validatePipeline_InnerFunction(pipeline) {
2830
2824
  }
2831
2825
  for (const joker of task.jokerParameterNames) {
2832
2826
  if (!task.dependentParameterNames.includes(joker)) {
2833
- throw new PipelineLogicError(spaceTrim((block) => `
2827
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2834
2828
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2835
2829
 
2836
2830
  ${block(pipelineIdentification)}
@@ -2841,21 +2835,21 @@ function validatePipeline_InnerFunction(pipeline) {
2841
2835
  if (task.expectations) {
2842
2836
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2843
2837
  if (min !== undefined && max !== undefined && min > max) {
2844
- throw new PipelineLogicError(spaceTrim((block) => `
2838
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2845
2839
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2846
2840
 
2847
2841
  ${block(pipelineIdentification)}
2848
2842
  `));
2849
2843
  }
2850
2844
  if (min !== undefined && min < 0) {
2851
- throw new PipelineLogicError(spaceTrim((block) => `
2845
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2852
2846
  Min expectation of ${unit} must be zero or positive
2853
2847
 
2854
2848
  ${block(pipelineIdentification)}
2855
2849
  `));
2856
2850
  }
2857
2851
  if (max !== undefined && max <= 0) {
2858
- throw new PipelineLogicError(spaceTrim((block) => `
2852
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2859
2853
  Max expectation of ${unit} must be positive
2860
2854
 
2861
2855
  ${block(pipelineIdentification)}
@@ -2877,7 +2871,7 @@ function validatePipeline_InnerFunction(pipeline) {
2877
2871
  while (unresovedTasks.length > 0) {
2878
2872
  if (loopLimit-- < 0) {
2879
2873
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2880
- throw new UnexpectedError(spaceTrim((block) => `
2874
+ throw new UnexpectedError(spaceTrim$1((block) => `
2881
2875
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2882
2876
 
2883
2877
  ${block(pipelineIdentification)}
@@ -2887,7 +2881,7 @@ function validatePipeline_InnerFunction(pipeline) {
2887
2881
  if (currentlyResovedTasks.length === 0) {
2888
2882
  throw new PipelineLogicError(
2889
2883
  // TODO: [🐎] DRY
2890
- spaceTrim((block) => `
2884
+ spaceTrim$1((block) => `
2891
2885
 
2892
2886
  Can not resolve some parameters:
2893
2887
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -3034,7 +3028,7 @@ function unpreparePipeline(pipeline) {
3034
3028
  * Library of pipelines that groups together pipelines for an application.
3035
3029
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
3036
3030
  *
3037
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
3031
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
3038
3032
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
3039
3033
  */
3040
3034
  class SimplePipelineCollection {
@@ -3044,14 +3038,14 @@ class SimplePipelineCollection {
3044
3038
  * @param pipelines Array of pipeline JSON objects to include in the collection
3045
3039
  *
3046
3040
  * Note: During the construction logic of all pipelines are validated
3047
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
3041
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
3048
3042
  */
3049
3043
  constructor(...pipelines) {
3050
3044
  this.collection = new Map();
3051
3045
  for (const pipeline of pipelines) {
3052
3046
  // TODO: [👠] DRY
3053
3047
  if (pipeline.pipelineUrl === undefined) {
3054
- throw new PipelineUrlError(spaceTrim(`
3048
+ throw new PipelineUrlError(spaceTrim$1(`
3055
3049
  Pipeline with name "${pipeline.title}" does not have defined URL
3056
3050
 
3057
3051
  File:
@@ -3073,7 +3067,7 @@ class SimplePipelineCollection {
3073
3067
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
3074
3068
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
3075
3069
  const existing = this.collection.get(pipeline.pipelineUrl);
3076
- throw new PipelineUrlError(spaceTrim(`
3070
+ throw new PipelineUrlError(spaceTrim$1(`
3077
3071
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
3078
3072
 
3079
3073
  Conflicting files:
@@ -3105,13 +3099,13 @@ class SimplePipelineCollection {
3105
3099
  const pipeline = this.collection.get(url);
3106
3100
  if (!pipeline) {
3107
3101
  if (this.listPipelines().length === 0) {
3108
- throw new NotFoundError(spaceTrim(`
3102
+ throw new NotFoundError(spaceTrim$1(`
3109
3103
  Pipeline with url "${url}" not found
3110
3104
 
3111
3105
  No pipelines available
3112
3106
  `));
3113
3107
  }
3114
- throw new NotFoundError(spaceTrim((block) => `
3108
+ throw new NotFoundError(spaceTrim$1((block) => `
3115
3109
  Pipeline with url "${url}" not found
3116
3110
 
3117
3111
  Available pipelines:
@@ -3132,16 +3126,16 @@ class SimplePipelineCollection {
3132
3126
  }
3133
3127
 
3134
3128
  /**
3135
- * Creates PipelineCollection from array of PipelineJson or PipelineString
3129
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
3136
3130
  *
3137
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
3131
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
3138
3132
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
3139
3133
  *
3140
3134
  * @param promptbookSources
3141
3135
  * @returns PipelineCollection
3142
3136
  * @public exported from `@promptbook/core`
3143
3137
  */
3144
- function createCollectionFromJson(...promptbooks) {
3138
+ function createPipelineCollectionFromJson(...promptbooks) {
3145
3139
  return new SimplePipelineCollection(...promptbooks);
3146
3140
  }
3147
3141
 
@@ -3152,7 +3146,7 @@ function createCollectionFromJson(...promptbooks) {
3152
3146
  */
3153
3147
  class MissingToolsError extends Error {
3154
3148
  constructor(message) {
3155
- super(spaceTrim((block) => `
3149
+ super(spaceTrim$1((block) => `
3156
3150
  ${block(message)}
3157
3151
 
3158
3152
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -3166,6 +3160,7 @@ class MissingToolsError extends Error {
3166
3160
  /**
3167
3161
  * Generates random token
3168
3162
  *
3163
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
3169
3164
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
3170
3165
  *
3171
3166
  * @private internal helper function
@@ -3175,6 +3170,7 @@ function $randomToken(randomness) {
3175
3170
  return randomBytes(randomness).toString('hex');
3176
3171
  }
3177
3172
  /**
3173
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3178
3174
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
3179
3175
  */
3180
3176
 
@@ -3293,6 +3289,22 @@ class CollectionError extends Error {
3293
3289
  }
3294
3290
  }
3295
3291
 
3292
+ /**
3293
+ * This error indicates error from the database
3294
+ *
3295
+ * @public exported from `@promptbook/core`
3296
+ */
3297
+ class DatabaseError extends Error {
3298
+ constructor(message) {
3299
+ super(message);
3300
+ this.name = 'DatabaseError';
3301
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3302
+ }
3303
+ }
3304
+ /**
3305
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
3306
+ */
3307
+
3296
3308
  /**
3297
3309
  * This error occurs when some expectation is not met in the execution of the pipeline
3298
3310
  *
@@ -3322,6 +3334,19 @@ class LimitReachedError extends Error {
3322
3334
  }
3323
3335
  }
3324
3336
 
3337
+ /**
3338
+ * This error indicates that promptbook operation is not allowed
3339
+ *
3340
+ * @public exported from `@promptbook/core`
3341
+ */
3342
+ class NotAllowed extends Error {
3343
+ constructor(message) {
3344
+ super(message);
3345
+ this.name = 'NotAllowed';
3346
+ Object.setPrototypeOf(this, NotAllowed.prototype);
3347
+ }
3348
+ }
3349
+
3325
3350
  /**
3326
3351
  * Error thrown when a fetch request fails
3327
3352
  *
@@ -3359,6 +3384,8 @@ const PROMPTBOOK_ERRORS = {
3359
3384
  PromptbookFetchError,
3360
3385
  UnexpectedError,
3361
3386
  WrappedError,
3387
+ NotAllowed,
3388
+ DatabaseError,
3362
3389
  // TODO: [🪑]> VersionMismatchError,
3363
3390
  };
3364
3391
  /**
@@ -3406,7 +3433,7 @@ function serializeError(error) {
3406
3433
  const { name, message, stack } = error;
3407
3434
  const { id } = error;
3408
3435
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3409
- console.error(spaceTrim$1((block) => `
3436
+ console.error(spaceTrim$2((block) => `
3410
3437
 
3411
3438
  Cannot serialize error with name "${name}"
3412
3439
 
@@ -3439,7 +3466,7 @@ function jsonParse(value) {
3439
3466
  }
3440
3467
  else if (typeof value !== 'string') {
3441
3468
  console.error('Can not parse JSON from non-string value.', { text: value });
3442
- throw new Error(spaceTrim$1(`
3469
+ throw new Error(spaceTrim$2(`
3443
3470
  Can not parse JSON from non-string value.
3444
3471
 
3445
3472
  The value type: ${typeof value}
@@ -3453,7 +3480,7 @@ function jsonParse(value) {
3453
3480
  if (!(error instanceof Error)) {
3454
3481
  throw error;
3455
3482
  }
3456
- throw new Error(spaceTrim$1((block) => `
3483
+ throw new Error(spaceTrim$2((block) => `
3457
3484
  ${block(error.message)}
3458
3485
 
3459
3486
  The expected JSON text:
@@ -3506,7 +3533,7 @@ function deserializeError(error) {
3506
3533
  message = `${name}: ${message}`;
3507
3534
  }
3508
3535
  if (stack !== undefined && stack !== '') {
3509
- message = spaceTrim$1((block) => `
3536
+ message = spaceTrim$2((block) => `
3510
3537
  ${block(message)}
3511
3538
 
3512
3539
  Original stack trace:
@@ -3543,11 +3570,11 @@ function assertsTaskSuccessful(executionResult) {
3543
3570
  throw deserializeError(errors[0]);
3544
3571
  }
3545
3572
  else {
3546
- throw new PipelineExecutionError(spaceTrim((block) => `
3573
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
3547
3574
  Multiple errors occurred during Promptbook execution
3548
3575
 
3549
3576
  ${block(errors
3550
- .map(({ name, stack, message }, index) => spaceTrim((block) => `
3577
+ .map(({ name, stack, message }, index) => spaceTrim$1((block) => `
3551
3578
  ${name} ${index + 1}:
3552
3579
  ${block(stack || message)}
3553
3580
  `))
@@ -3574,6 +3601,7 @@ function createTask(options) {
3574
3601
  let updatedAt = createdAt;
3575
3602
  const errors = [];
3576
3603
  const warnings = [];
3604
+ const llmCalls = [];
3577
3605
  let currentValue = {};
3578
3606
  let customTldr = null;
3579
3607
  const partialResultSubject = new Subject();
@@ -3589,6 +3617,9 @@ function createTask(options) {
3589
3617
  }, (tldrInfo) => {
3590
3618
  customTldr = tldrInfo;
3591
3619
  updatedAt = new Date();
3620
+ }, (llmCall) => {
3621
+ llmCalls.push(llmCall);
3622
+ updatedAt = new Date();
3592
3623
  });
3593
3624
  finalResultPromise
3594
3625
  .catch((error) => {
@@ -3711,7 +3742,7 @@ function createTask(options) {
3711
3742
  }
3712
3743
  return {
3713
3744
  percent: percent,
3714
- message,
3745
+ message: message + ' (!!!fallback)',
3715
3746
  };
3716
3747
  },
3717
3748
  get createdAt() {
@@ -3734,6 +3765,10 @@ function createTask(options) {
3734
3765
  return warnings;
3735
3766
  // <- Note: [1] --||--
3736
3767
  },
3768
+ get llmCalls() {
3769
+ return [...llmCalls, { foo: '!!! bar' }];
3770
+ // <- Note: [1] --||--
3771
+ },
3737
3772
  get currentValue() {
3738
3773
  return currentValue;
3739
3774
  // <- Note: [1] --||--
@@ -4010,14 +4045,14 @@ class MultipleLlmExecutionTools {
4010
4045
  if (description === undefined) {
4011
4046
  return headLine;
4012
4047
  }
4013
- return spaceTrim$1((block) => `
4048
+ return spaceTrim$2((block) => `
4014
4049
  ${headLine}
4015
4050
 
4016
4051
  ${ /* <- Note: Indenting the description: */block(description)}
4017
4052
  `);
4018
4053
  })
4019
4054
  .join('\n\n');
4020
- return spaceTrim$1((block) => `
4055
+ return spaceTrim$2((block) => `
4021
4056
  Multiple LLM Providers:
4022
4057
 
4023
4058
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4108,7 +4143,7 @@ class MultipleLlmExecutionTools {
4108
4143
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4109
4144
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4110
4145
  // 3) ...
4111
- spaceTrim$1((block) => `
4146
+ spaceTrim$2((block) => `
4112
4147
  All execution tools of ${this.title} failed:
4113
4148
 
4114
4149
  ${block(errors
@@ -4121,7 +4156,7 @@ class MultipleLlmExecutionTools {
4121
4156
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4122
4157
  }
4123
4158
  else {
4124
- throw new PipelineExecutionError(spaceTrim$1((block) => `
4159
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
4125
4160
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4126
4161
 
4127
4162
  Available \`LlmExecutionTools\`:
@@ -4154,7 +4189,7 @@ class MultipleLlmExecutionTools {
4154
4189
  */
4155
4190
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4156
4191
  if (llmExecutionTools.length === 0) {
4157
- const warningMessage = spaceTrim$1(`
4192
+ const warningMessage = spaceTrim$2(`
4158
4193
  You have not provided any \`LlmExecutionTools\`
4159
4194
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4160
4195
 
@@ -4187,6 +4222,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
4187
4222
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4188
4223
  }
4189
4224
  /**
4225
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4190
4226
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4191
4227
  */
4192
4228
 
@@ -4203,6 +4239,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
4203
4239
  return llmTools;
4204
4240
  }
4205
4241
  /**
4242
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4206
4243
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4207
4244
  */
4208
4245
 
@@ -4218,7 +4255,7 @@ async function preparePersona(personaDescription, tools, options) {
4218
4255
  throw new MissingToolsError('LLM tools are required for preparing persona');
4219
4256
  }
4220
4257
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4221
- const collection = createCollectionFromJson(...PipelineCollection);
4258
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4222
4259
  const preparePersonaExecutor = createPipelineExecutor({
4223
4260
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
4224
4261
  tools,
@@ -4325,14 +4362,14 @@ function $registeredScrapersMessage(availableScrapers) {
4325
4362
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4326
4363
  });
4327
4364
  if (metadata.length === 0) {
4328
- return spaceTrim$1(`
4365
+ return spaceTrim$2(`
4329
4366
  **No scrapers are available**
4330
4367
 
4331
4368
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4332
4369
  At least there should be available the metadata of the scrapers
4333
4370
  `);
4334
4371
  }
4335
- return spaceTrim$1((block) => `
4372
+ return spaceTrim$2((block) => `
4336
4373
  Available scrapers are:
4337
4374
  ${block(metadata
4338
4375
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4468,7 +4505,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4468
4505
  else if (urlOrRequest instanceof Request) {
4469
4506
  url = urlOrRequest.url;
4470
4507
  }
4471
- throw new PromptbookFetchError(spaceTrim$1((block) => `
4508
+ throw new PromptbookFetchError(spaceTrim$2((block) => `
4472
4509
  Can not fetch "${url}"
4473
4510
 
4474
4511
  Fetch error:
@@ -4629,7 +4666,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4629
4666
  const fileExtension = getFileExtension(filename);
4630
4667
  const mimeType = extensionToMimeType(fileExtension || '');
4631
4668
  if (!(await isFileExisting(filename, tools.fs))) {
4632
- throw new NotFoundError(spaceTrim$1((block) => `
4669
+ throw new NotFoundError(spaceTrim$2((block) => `
4633
4670
  Can not make source handler for file which does not exist:
4634
4671
 
4635
4672
  File:
@@ -4722,7 +4759,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4722
4759
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4723
4760
  break;
4724
4761
  }
4725
- console.warn(spaceTrim$1((block) => `
4762
+ console.warn(spaceTrim$2((block) => `
4726
4763
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4727
4764
 
4728
4765
  The source:
@@ -4738,7 +4775,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4738
4775
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4739
4776
  }
4740
4777
  if (partialPieces === null) {
4741
- throw new KnowledgeScrapeError(spaceTrim$1((block) => `
4778
+ throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4742
4779
  Cannot scrape knowledge
4743
4780
 
4744
4781
  The source:
@@ -4817,7 +4854,7 @@ async function prepareTasks(pipeline, tools, options) {
4817
4854
  if (task.taskType === 'PROMPT_TASK' &&
4818
4855
  knowledgePiecesCount > 0 &&
4819
4856
  !dependentParameterNames.includes('knowledge')) {
4820
- preparedContent = spaceTrim(`
4857
+ preparedContent = spaceTrim$1(`
4821
4858
  {content}
4822
4859
 
4823
4860
  ## Knowledge
@@ -4903,7 +4940,7 @@ async function preparePipeline(pipeline, tools, options) {
4903
4940
  let title = pipeline.title;
4904
4941
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
4905
4942
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4906
- const collection = createCollectionFromJson(...PipelineCollection);
4943
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4907
4944
  const prepareTitleExecutor = createPipelineExecutor({
4908
4945
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
4909
4946
  tools,
@@ -5130,7 +5167,7 @@ function extractVariablesFromJavascript(script) {
5130
5167
  }
5131
5168
  catch (error) {
5132
5169
  assertsError(error);
5133
- throw new ParseError(spaceTrim((block) => `
5170
+ throw new ParseError(spaceTrim$1((block) => `
5134
5171
  Can not extract variables from the script
5135
5172
  ${block(error.stack || error.message)}
5136
5173
 
@@ -5313,7 +5350,7 @@ const CsvFormatParser = {
5313
5350
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5314
5351
  const csv = csvParse(value, settings);
5315
5352
  if (csv.errors.length !== 0) {
5316
- throw new CsvFormatError(spaceTrim$1((block) => `
5353
+ throw new CsvFormatError(spaceTrim$2((block) => `
5317
5354
  CSV parsing error
5318
5355
 
5319
5356
  Error(s) from CSV parsing:
@@ -5358,7 +5395,7 @@ const CsvFormatParser = {
5358
5395
  const { value, settings, mapCallback, onProgress } = options;
5359
5396
  const csv = csvParse(value, settings);
5360
5397
  if (csv.errors.length !== 0) {
5361
- throw new CsvFormatError(spaceTrim$1((block) => `
5398
+ throw new CsvFormatError(spaceTrim$2((block) => `
5362
5399
  CSV parsing error
5363
5400
 
5364
5401
  Error(s) from CSV parsing:
@@ -5568,7 +5605,7 @@ function mapAvailableToExpectedParameters(options) {
5568
5605
  }
5569
5606
  // Phase 2️⃣: Non-matching mapping
5570
5607
  if (expectedParameterNames.size !== availableParametersNames.size) {
5571
- throw new PipelineExecutionError(spaceTrim$1((block) => `
5608
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
5572
5609
  Can not map available parameters to expected parameters
5573
5610
 
5574
5611
  Mapped parameters:
@@ -5815,10 +5852,13 @@ const LINES_PER_STANDARD_PAGE = 44;
5815
5852
  * @public exported from `@promptbook/utils`
5816
5853
  */
5817
5854
  function countLines(text) {
5855
+ if (text === '') {
5856
+ return 0;
5857
+ }
5818
5858
  text = text.replace('\r\n', '\n');
5819
5859
  text = text.replace('\r', '\n');
5820
5860
  const lines = text.split('\n');
5821
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
5861
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5822
5862
  }
5823
5863
  /**
5824
5864
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -5943,6 +5983,8 @@ function checkExpectations(expectations, value) {
5943
5983
  * This function provides a common abstraction for result validation that can be used
5944
5984
  * by both execution logic and caching logic to ensure consistency.
5945
5985
  *
5986
+ * Note: [🔂] This function is idempotent.
5987
+ *
5946
5988
  * @param options - The validation options including result string, expectations, and format
5947
5989
  * @returns Validation result with processed string and validity status
5948
5990
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -5962,7 +6004,7 @@ function validatePromptResult(options) {
5962
6004
  }
5963
6005
  catch (error) {
5964
6006
  keepUnused(error);
5965
- throw new ExpectError(spaceTrim((block) => `
6007
+ throw new ExpectError(spaceTrim$1((block) => `
5966
6008
  Expected valid JSON string
5967
6009
 
5968
6010
  The expected JSON text:
@@ -6011,7 +6053,7 @@ function validatePromptResult(options) {
6011
6053
  */
6012
6054
  async function executeAttempts(options) {
6013
6055
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
6014
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6056
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
6015
6057
  const $ongoingTaskResult = {
6016
6058
  $result: null,
6017
6059
  $resultString: null,
@@ -6025,7 +6067,7 @@ async function executeAttempts(options) {
6025
6067
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6026
6068
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6027
6069
  if (isJokerAttempt && !jokerParameterName) {
6028
- throw new UnexpectedError(spaceTrim((block) => `
6070
+ throw new UnexpectedError(spaceTrim$1((block) => `
6029
6071
  Joker not found in attempt ${attemptIndex}
6030
6072
 
6031
6073
  ${block(pipelineIdentification)}
@@ -6036,7 +6078,7 @@ async function executeAttempts(options) {
6036
6078
  $ongoingTaskResult.$expectError = null;
6037
6079
  if (isJokerAttempt) {
6038
6080
  if (parameters[jokerParameterName] === undefined) {
6039
- throw new PipelineExecutionError(spaceTrim((block) => `
6081
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6040
6082
  Joker parameter {${jokerParameterName}} not defined
6041
6083
 
6042
6084
  ${block(pipelineIdentification)}
@@ -6094,7 +6136,7 @@ async function executeAttempts(options) {
6094
6136
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6095
6137
  break variant;
6096
6138
  case 'EMBEDDING':
6097
- throw new PipelineExecutionError(spaceTrim((block) => `
6139
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6098
6140
  Embedding model can not be used in pipeline
6099
6141
 
6100
6142
  This should be catched during parsing
@@ -6105,7 +6147,7 @@ async function executeAttempts(options) {
6105
6147
  break variant;
6106
6148
  // <- case [🤖]:
6107
6149
  default:
6108
- throw new PipelineExecutionError(spaceTrim((block) => `
6150
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6109
6151
  Unknown model variant "${task.modelRequirements.modelVariant}"
6110
6152
 
6111
6153
  ${block(pipelineIdentification)}
@@ -6116,14 +6158,14 @@ async function executeAttempts(options) {
6116
6158
  break;
6117
6159
  case 'SCRIPT_TASK':
6118
6160
  if (arrayableToArray(tools.script).length === 0) {
6119
- throw new PipelineExecutionError(spaceTrim((block) => `
6161
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6120
6162
  No script execution tools are available
6121
6163
 
6122
6164
  ${block(pipelineIdentification)}
6123
6165
  `));
6124
6166
  }
6125
6167
  if (!task.contentLanguage) {
6126
- throw new PipelineExecutionError(spaceTrim((block) => `
6168
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6127
6169
  Script language is not defined for SCRIPT TASK "${task.name}"
6128
6170
 
6129
6171
  ${block(pipelineIdentification)}
@@ -6154,7 +6196,7 @@ async function executeAttempts(options) {
6154
6196
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6155
6197
  }
6156
6198
  else {
6157
- throw new PipelineExecutionError(spaceTrim((block) => `
6199
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6158
6200
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6159
6201
 
6160
6202
  ${block(pipelineIdentification)}
@@ -6168,7 +6210,7 @@ async function executeAttempts(options) {
6168
6210
  break taskType;
6169
6211
  case 'DIALOG_TASK':
6170
6212
  if (tools.userInterface === undefined) {
6171
- throw new PipelineExecutionError(spaceTrim((block) => `
6213
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6172
6214
  User interface tools are not available
6173
6215
 
6174
6216
  ${block(pipelineIdentification)}
@@ -6186,7 +6228,7 @@ async function executeAttempts(options) {
6186
6228
  break taskType;
6187
6229
  // <- case: [🅱]
6188
6230
  default:
6189
- throw new PipelineExecutionError(spaceTrim((block) => `
6231
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6190
6232
  Unknown execution type "${task.taskType}"
6191
6233
 
6192
6234
  ${block(pipelineIdentification)}
@@ -6259,14 +6301,10 @@ async function executeAttempts(options) {
6259
6301
  });
6260
6302
  }
6261
6303
  finally {
6262
- if (!isJokerAttempt &&
6263
- task.taskType === 'PROMPT_TASK' &&
6264
- $ongoingTaskResult.$prompt
6265
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6266
- // In that case we don’t want to make a report about it because it’s not a llm execution error
6267
- ) {
6268
- // TODO: [🧠] Maybe put other taskTypes into report
6269
- $executionReport.promptExecutions.push({
6304
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6305
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6306
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6307
+ const executionPromptReport = {
6270
6308
  prompt: {
6271
6309
  ...$ongoingTaskResult.$prompt,
6272
6310
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6275,13 +6313,20 @@ async function executeAttempts(options) {
6275
6313
  error: $ongoingTaskResult.$expectError === null
6276
6314
  ? undefined
6277
6315
  : serializeError($ongoingTaskResult.$expectError),
6278
- });
6316
+ };
6317
+ $executionReport.promptExecutions.push(executionPromptReport);
6318
+ if (logLlmCall) {
6319
+ logLlmCall({
6320
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6321
+ report: executionPromptReport,
6322
+ });
6323
+ }
6279
6324
  }
6280
6325
  }
6281
6326
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6282
6327
  // Note: Create a summary of all failures
6283
6328
  const failuresSummary = $ongoingTaskResult.$failedResults
6284
- .map((failure) => spaceTrim((block) => {
6329
+ .map((failure) => spaceTrim$1((block) => {
6285
6330
  var _a, _b;
6286
6331
  return `
6287
6332
  Attempt ${failure.attemptIndex + 1}:
@@ -6291,14 +6336,14 @@ async function executeAttempts(options) {
6291
6336
  Result:
6292
6337
  ${block(failure.result === null
6293
6338
  ? 'null'
6294
- : spaceTrim(failure.result)
6339
+ : spaceTrim$1(failure.result)
6295
6340
  .split('\n')
6296
6341
  .map((line) => `> ${line}`)
6297
6342
  .join('\n'))}
6298
6343
  `;
6299
6344
  }))
6300
6345
  .join('\n\n---\n\n');
6301
- throw new PipelineExecutionError(spaceTrim((block) => {
6346
+ throw new PipelineExecutionError(spaceTrim$1((block) => {
6302
6347
  var _a;
6303
6348
  return `
6304
6349
  LLM execution failed ${maxExecutionAttempts}x
@@ -6318,7 +6363,7 @@ async function executeAttempts(options) {
6318
6363
  }
6319
6364
  }
6320
6365
  if ($ongoingTaskResult.$resultString === null) {
6321
- throw new UnexpectedError(spaceTrim((block) => `
6366
+ throw new UnexpectedError(spaceTrim$1((block) => `
6322
6367
  Something went wrong and prompt result is null
6323
6368
 
6324
6369
  ${block(pipelineIdentification)}
@@ -6340,12 +6385,12 @@ async function executeAttempts(options) {
6340
6385
  * @private internal utility of `createPipelineExecutor`
6341
6386
  */
6342
6387
  async function executeFormatSubvalues(options) {
6343
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6388
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6344
6389
  if (task.foreach === undefined) {
6345
- return /* not await */ executeAttempts(options);
6390
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6346
6391
  }
6347
6392
  if (jokerParameterNames.length !== 0) {
6348
- throw new UnexpectedError(spaceTrim$1((block) => `
6393
+ throw new UnexpectedError(spaceTrim$2((block) => `
6349
6394
  JOKER parameters are not supported together with FOREACH command
6350
6395
 
6351
6396
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6358,7 +6403,7 @@ async function executeFormatSubvalues(options) {
6358
6403
  if (formatDefinition === undefined) {
6359
6404
  throw new UnexpectedError(
6360
6405
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6361
- spaceTrim$1((block) => `
6406
+ spaceTrim$2((block) => `
6362
6407
  Unsupported format "${task.foreach.formatName}"
6363
6408
 
6364
6409
  Available formats:
@@ -6375,7 +6420,7 @@ async function executeFormatSubvalues(options) {
6375
6420
  if (subvalueParser === undefined) {
6376
6421
  throw new UnexpectedError(
6377
6422
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6378
- spaceTrim$1((block) => `
6423
+ spaceTrim$2((block) => `
6379
6424
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6380
6425
 
6381
6426
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6415,7 +6460,7 @@ async function executeFormatSubvalues(options) {
6415
6460
  if (!(error instanceof PipelineExecutionError)) {
6416
6461
  throw error;
6417
6462
  }
6418
- const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6463
+ const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6419
6464
  ${error.message}
6420
6465
 
6421
6466
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6439,7 +6484,7 @@ async function executeFormatSubvalues(options) {
6439
6484
  ...options,
6440
6485
  priority: priority + index,
6441
6486
  parameters: allSubparameters,
6442
- pipelineIdentification: spaceTrim$1((block) => `
6487
+ pipelineIdentification: spaceTrim$2((block) => `
6443
6488
  ${block(pipelineIdentification)}
6444
6489
  Subparameter index: ${index}
6445
6490
  `),
@@ -6448,7 +6493,7 @@ async function executeFormatSubvalues(options) {
6448
6493
  }
6449
6494
  catch (error) {
6450
6495
  if (length > BIG_DATASET_TRESHOLD) {
6451
- console.error(spaceTrim$1((block) => `
6496
+ console.error(spaceTrim$2((block) => `
6452
6497
  ${error.message}
6453
6498
 
6454
6499
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6548,7 +6593,7 @@ async function getKnowledgeForTask(options) {
6548
6593
  },
6549
6594
  content: task.content,
6550
6595
  parameters,
6551
- };
6596
+ }; /* <- Note: [🤛] */
6552
6597
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6553
6598
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6554
6599
  const { index } = knowledgePiece;
@@ -6624,7 +6669,7 @@ async function getReservedParametersForTask(options) {
6624
6669
  // Note: Doublecheck that ALL reserved parameters are defined:
6625
6670
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6626
6671
  if (reservedParameters[parameterName] === undefined) {
6627
- throw new UnexpectedError(spaceTrim((block) => `
6672
+ throw new UnexpectedError(spaceTrim$1((block) => `
6628
6673
  Reserved parameter {${parameterName}} is not defined
6629
6674
 
6630
6675
  ${block(pipelineIdentification)}
@@ -6643,14 +6688,14 @@ async function getReservedParametersForTask(options) {
6643
6688
  * @private internal utility of `createPipelineExecutor`
6644
6689
  */
6645
6690
  async function executeTask(options) {
6646
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6691
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6647
6692
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6648
6693
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6649
6694
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
6650
6695
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6651
6696
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6652
6697
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6653
- throw new UnexpectedError(spaceTrim((block) => `
6698
+ throw new UnexpectedError(spaceTrim$1((block) => `
6654
6699
  Dependent parameters are not consistent with used parameters:
6655
6700
 
6656
6701
  Dependent parameters:
@@ -6694,7 +6739,7 @@ async function executeTask(options) {
6694
6739
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6695
6740
  // Houston, we have a problem
6696
6741
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6697
- throw new UnexpectedError(spaceTrim((block) => `
6742
+ throw new UnexpectedError(spaceTrim$1((block) => `
6698
6743
  Parameter \`{${parameterName}}\` is NOT defined
6699
6744
  BUT used in task "${currentTask.title || currentTask.name}"
6700
6745
 
@@ -6722,6 +6767,7 @@ async function executeTask(options) {
6722
6767
  tools,
6723
6768
  $executionReport,
6724
6769
  onProgress,
6770
+ logLlmCall,
6725
6771
  pipelineIdentification,
6726
6772
  maxExecutionAttempts,
6727
6773
  maxParallelCount,
@@ -6762,9 +6808,32 @@ function filterJustOutputParameters(options) {
6762
6808
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6763
6809
  if (parametersToPass[parameter.name] === undefined) {
6764
6810
  // [4]
6765
- $warnings.push(new PipelineExecutionError(spaceTrim((block) => `
6811
+ $warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6766
6812
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6767
6813
 
6814
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6815
+
6816
+ All parameters:
6817
+ ${block(preparedPipeline.parameters
6818
+ .map(({ name, isInput, isOutput, description }) => {
6819
+ let line = `\`{${name}}\``;
6820
+ if (isInput) {
6821
+ line += ' `[input parameter]`';
6822
+ }
6823
+ if (isOutput) {
6824
+ line += ' `[output parameter]`';
6825
+ }
6826
+ if (parametersToPass[name] === undefined) {
6827
+ line += ` <- Warning: Should be in the output but its not |`;
6828
+ }
6829
+ if (description) {
6830
+ line += ` ${description}`;
6831
+ }
6832
+ return line;
6833
+ })
6834
+ .map((line, index) => `${index + 1}) ${line}`)
6835
+ .join('\n'))}
6836
+
6768
6837
  ${block(pipelineIdentification)}
6769
6838
  `)));
6770
6839
  continue;
@@ -6785,7 +6854,7 @@ function filterJustOutputParameters(options) {
6785
6854
  * @private internal utility of `createPipelineExecutor`
6786
6855
  */
6787
6856
  async function executePipeline(options) {
6788
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6857
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6789
6858
  let { preparedPipeline } = options;
6790
6859
  if (preparedPipeline === undefined) {
6791
6860
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6847,7 +6916,7 @@ async function executePipeline(options) {
6847
6916
  for (const parameterName of Object.keys(inputParameters)) {
6848
6917
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6849
6918
  if (parameter === undefined) {
6850
- warnings.push(new PipelineExecutionError(spaceTrim((block) => `
6919
+ warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6851
6920
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6852
6921
 
6853
6922
  ${block(pipelineIdentification)}
@@ -6862,7 +6931,7 @@ async function executePipeline(options) {
6862
6931
  // TODO: [🧠] This should be also non-critical error
6863
6932
  return exportJson({
6864
6933
  name: 'pipelineExecutorResult',
6865
- message: spaceTrim((block) => `
6934
+ message: spaceTrim$1((block) => `
6866
6935
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6867
6936
 
6868
6937
  ${block(pipelineIdentification)}
@@ -6871,7 +6940,7 @@ async function executePipeline(options) {
6871
6940
  value: {
6872
6941
  isSuccessful: false,
6873
6942
  errors: [
6874
- new PipelineExecutionError(spaceTrim((block) => `
6943
+ new PipelineExecutionError(spaceTrim$1((block) => `
6875
6944
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6876
6945
 
6877
6946
  ${block(pipelineIdentification)}
@@ -6898,7 +6967,7 @@ async function executePipeline(options) {
6898
6967
  while (unresovedTasks.length > 0) {
6899
6968
  if (loopLimit-- < 0) {
6900
6969
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
6901
- throw new UnexpectedError(spaceTrim((block) => `
6970
+ throw new UnexpectedError(spaceTrim$1((block) => `
6902
6971
  Loop limit reached during resolving parameters pipeline execution
6903
6972
 
6904
6973
  ${block(pipelineIdentification)}
@@ -6908,7 +6977,7 @@ async function executePipeline(options) {
6908
6977
  if (!currentTask && resolving.length === 0) {
6909
6978
  throw new UnexpectedError(
6910
6979
  // TODO: [🐎] DRY
6911
- spaceTrim((block) => `
6980
+ spaceTrim$1((block) => `
6912
6981
  Can not resolve some parameters:
6913
6982
 
6914
6983
  ${block(pipelineIdentification)}
@@ -6948,7 +7017,7 @@ async function executePipeline(options) {
6948
7017
  tools,
6949
7018
  onProgress(newOngoingResult) {
6950
7019
  if (isReturned) {
6951
- throw new UnexpectedError(spaceTrim((block) => `
7020
+ throw new UnexpectedError(spaceTrim$1((block) => `
6952
7021
  Can not call \`onProgress\` after pipeline execution is finished
6953
7022
 
6954
7023
  ${block(pipelineIdentification)}
@@ -6963,8 +7032,9 @@ async function executePipeline(options) {
6963
7032
  onProgress(newOngoingResult);
6964
7033
  }
6965
7034
  },
7035
+ logLlmCall,
6966
7036
  $executionReport: executionReport,
6967
- pipelineIdentification: spaceTrim((block) => `
7037
+ pipelineIdentification: spaceTrim$1((block) => `
6968
7038
  ${block(pipelineIdentification)}
6969
7039
  Task name: ${currentTask.name}
6970
7040
  Task title: ${currentTask.title}
@@ -7073,7 +7143,7 @@ function createPipelineExecutor(options) {
7073
7143
  preparedPipeline = pipeline;
7074
7144
  }
7075
7145
  else if (isNotPreparedWarningSuppressed !== true) {
7076
- console.warn(spaceTrim((block) => `
7146
+ console.warn(spaceTrim$1((block) => `
7077
7147
  Pipeline is not prepared
7078
7148
 
7079
7149
  ${block(pipelineIdentification)}
@@ -7086,7 +7156,7 @@ function createPipelineExecutor(options) {
7086
7156
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7087
7157
  }
7088
7158
  let runCount = 0;
7089
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7159
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7090
7160
  runCount++;
7091
7161
  return /* not await */ executePipeline({
7092
7162
  pipeline,
@@ -7097,7 +7167,8 @@ function createPipelineExecutor(options) {
7097
7167
  inputParameters,
7098
7168
  tools,
7099
7169
  onProgress,
7100
- pipelineIdentification: spaceTrim((block) => `
7170
+ logLlmCall,
7171
+ pipelineIdentification: spaceTrim$1((block) => `
7101
7172
  ${block(pipelineIdentification)}
7102
7173
  ${runCount === 1 ? '' : `Run #${runCount}`}
7103
7174
  `),
@@ -7258,7 +7329,7 @@ class MarkdownScraper {
7258
7329
  }
7259
7330
  const llmTools = getSingleLlmExecutionTools(llm);
7260
7331
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7261
- const collection = createCollectionFromJson(...PipelineCollection);
7332
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7262
7333
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7263
7334
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7264
7335
  tools: {
@@ -7294,8 +7365,8 @@ class MarkdownScraper {
7294
7365
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7295
7366
  // Note: These are just default values, they will be overwritten by the actual values:
7296
7367
  let name = `piece-${i}`;
7297
- let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
7298
- const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
7368
+ let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7369
+ const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7299
7370
  let keywords = [];
7300
7371
  const index = [];
7301
7372
  /*
@@ -7308,7 +7379,7 @@ class MarkdownScraper {
7308
7379
  isCrashedOnError: true,
7309
7380
  });
7310
7381
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7311
- title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
7382
+ title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7312
7383
  name = titleToName(title);
7313
7384
  // --- Keywords
7314
7385
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({