@promptbook/pdf 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 +239 -168
  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 +7 -7
  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,5 +1,5 @@
1
1
  import { mkdir, rm, readFile } from 'fs/promises';
2
- import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
+ import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import { SHA256 } from 'crypto-js';
4
4
  import hexEncoder from 'crypto-js/enc-hex';
5
5
  import { basename, join, dirname, isAbsolute } from 'path';
@@ -17,14 +17,14 @@ import { parse, unparse } from 'papaparse';
17
17
  * @generated
18
18
  * @see https://github.com/webgptorg/book
19
19
  */
20
- const BOOK_LANGUAGE_VERSION = '1.0.0';
20
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
21
21
  /**
22
22
  * The version of the Promptbook engine
23
23
  *
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-1';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-100';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -47,6 +47,17 @@ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-1';
47
47
  function keepUnused(...valuesToKeep) {
48
48
  }
49
49
 
50
+ /**
51
+ * Trims string from all 4 sides
52
+ *
53
+ * Note: This is a re-exported function from the `spacetrim` package which is
54
+ * Developed by same author @hejny as this package
55
+ *
56
+ * @public exported from `@promptbook/utils`
57
+ * @see https://github.com/hejny/spacetrim#usage
58
+ */
59
+ const spaceTrim = spaceTrim$1;
60
+
50
61
  /**
51
62
  * Just marks a place of place where should be something implemented
52
63
  * No side effects.
@@ -108,6 +119,7 @@ function take(initialValue) {
108
119
  * @public exported from `@promptbook/color`
109
120
  */
110
121
  const CSS_COLORS = {
122
+ promptbook: '#79EAFD',
111
123
  transparent: 'rgba(0,0,0,0)',
112
124
  aliceblue: '#f0f8ff',
113
125
  antiquewhite: '#faebd7',
@@ -289,9 +301,6 @@ function checkChannelValue(channelName, value) {
289
301
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
290
302
  }
291
303
  }
292
- /**
293
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
294
- */
295
304
 
296
305
  /**
297
306
  * Color object represents an RGB color with alpha channel
@@ -326,6 +335,28 @@ class Color {
326
335
  throw new Error(`Can not create color from given object`);
327
336
  }
328
337
  }
338
+ /**
339
+ * Creates a new Color instance from miscellaneous formats
340
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
341
+ *
342
+ * @param color
343
+ * @returns Color object
344
+ */
345
+ static fromSafe(color) {
346
+ try {
347
+ return Color.from(color);
348
+ }
349
+ catch (error) {
350
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
351
+ console.warn(spaceTrim((block) => `
352
+ Color.fromSafe error:
353
+ ${block(error.message)}
354
+
355
+ Returning default PROMPTBOOK_COLOR.
356
+ `));
357
+ return Color.fromString('promptbook');
358
+ }
359
+ }
329
360
  /**
330
361
  * Creates a new Color instance from miscellaneous string formats
331
362
  *
@@ -393,6 +424,9 @@ class Color {
393
424
  if (hex.length === 3) {
394
425
  return Color.fromHex3(hex);
395
426
  }
427
+ if (hex.length === 4) {
428
+ return Color.fromHex4(hex);
429
+ }
396
430
  if (hex.length === 6) {
397
431
  return Color.fromHex6(hex);
398
432
  }
@@ -413,6 +447,19 @@ class Color {
413
447
  const b = parseInt(hex.substr(2, 1), 16) * 16;
414
448
  return take(new Color(r, g, b));
415
449
  }
450
+ /**
451
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
452
+ *
453
+ * @param color in hex for example `09df`
454
+ * @returns Color object
455
+ */
456
+ static fromHex4(hex) {
457
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
458
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
459
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
460
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
461
+ return take(new Color(r, g, b, a));
462
+ }
416
463
  /**
417
464
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
418
465
  *
@@ -603,7 +650,8 @@ class Color {
603
650
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
604
651
  */
605
652
  static isHexColorString(value) {
606
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
653
+ return (typeof value === 'string' &&
654
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
607
655
  }
608
656
  /**
609
657
  * Creates new Color object
@@ -718,6 +766,23 @@ class Color {
718
766
  * TODO: Maybe connect with textures
719
767
  */
720
768
 
769
+ /**
770
+ * Makes color transformer which returns a grayscale version of the color
771
+ *
772
+ * @param amount from 0 to 1
773
+ *
774
+ * @public exported from `@promptbook/color`
775
+ */
776
+ function grayscale(amount) {
777
+ return ({ red, green, blue, alpha }) => {
778
+ const average = (red + green + blue) / 3;
779
+ red = Math.round(average * amount + red * (1 - amount));
780
+ green = Math.round(average * amount + green * (1 - amount));
781
+ blue = Math.round(average * amount + blue * (1 - amount));
782
+ return Color.fromValues(red, green, blue, alpha);
783
+ };
784
+ }
785
+
721
786
  /**
722
787
  * Converts HSL values to RGB values
723
788
  *
@@ -833,102 +898,6 @@ function lighten(amount) {
833
898
  * TODO: Maybe implement by mix+hsl
834
899
  */
835
900
 
836
- /**
837
- * Calculates distance between two colors
838
- *
839
- * @param color1 first color
840
- * @param color2 second color
841
- *
842
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
843
- *
844
- * @public exported from `@promptbook/color`
845
- */
846
- /**
847
- * Calculates distance between two colors without square root
848
- *
849
- * @param color1 first color
850
- * @param color2 second color
851
- *
852
- * @public exported from `@promptbook/color`
853
- */
854
- function colorDistanceSquared(color1, color2) {
855
- const rmean = (color1.red + color2.red) / 2;
856
- const r = color1.red - color2.red;
857
- const g = color1.green - color2.green;
858
- const b = color1.blue - color2.blue;
859
- const weightR = 2 + rmean / 256;
860
- const weightG = 4.0;
861
- const weightB = 2 + (255 - rmean) / 256;
862
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
863
- return distance;
864
- }
865
-
866
- /**
867
- * Makes color transformer which finds the nearest color from the given list
868
- *
869
- * @param colors array of colors to choose from
870
- *
871
- * @public exported from `@promptbook/color`
872
- */
873
- function nearest(...colors) {
874
- return (color) => {
875
- const distances = colors.map((c) => colorDistanceSquared(c, color));
876
- const minDistance = Math.min(...distances);
877
- const minIndex = distances.indexOf(minDistance);
878
- const nearestColor = colors[minIndex];
879
- return nearestColor;
880
- };
881
- }
882
-
883
- /**
884
- * Color transformer which returns the negative color
885
- *
886
- * @public exported from `@promptbook/color`
887
- */
888
- function negative(color) {
889
- const r = 255 - color.red;
890
- const g = 255 - color.green;
891
- const b = 255 - color.blue;
892
- return Color.fromValues(r, g, b, color.alpha);
893
- }
894
-
895
- /**
896
- * Makes color transformer which finds the furthest color from the given list
897
- *
898
- * @param colors array of colors to choose from
899
- *
900
- * @public exported from `@promptbook/color`
901
- */
902
- function furthest(...colors) {
903
- return (color) => {
904
- const furthestColor = negative(nearest(...colors.map(negative))(color));
905
- return furthestColor;
906
- };
907
- }
908
- /**
909
- * Makes color transformer which finds the best text color (black or white) for the given background color
910
- *
911
- * @public exported from `@promptbook/color`
912
- */
913
- furthest(Color.get('white'), Color.from('black'));
914
-
915
- /**
916
- * Makes color transformer which returns a grayscale version of the color
917
- *
918
- * @param amount from 0 to 1
919
- *
920
- * @public exported from `@promptbook/color`
921
- */
922
- function grayscale(amount) {
923
- return ({ red, green, blue, alpha }) => {
924
- const average = (red + green + blue) / 3;
925
- red = Math.round(average * amount + red * (1 - amount));
926
- green = Math.round(average * amount + green * (1 - amount));
927
- blue = Math.round(average * amount + blue * (1 - amount));
928
- return Color.fromValues(red, green, blue, alpha);
929
- };
930
- }
931
-
932
901
  /**
933
902
  * Makes color transformer which saturate the given color
934
903
  *
@@ -997,16 +966,32 @@ const ADMIN_GITHUB_NAME = 'hejny';
997
966
  *
998
967
  * @public exported from `@promptbook/core`
999
968
  */
1000
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
1001
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
969
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
970
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
971
+ /**
972
+ * Colors for syntax highlighting in the `<BookEditor/>`
973
+ *
974
+ * TODO: [🗽] Unite branding and make single place for it
975
+ *
976
+ * @public exported from `@promptbook/core`
977
+ */
978
+ ({
979
+ TITLE: Color.fromHex('#244EA8'),
980
+ LINE: Color.fromHex('#eeeeee'),
981
+ SEPARATOR: Color.fromHex('#cccccc'),
982
+ COMMITMENT: Color.fromHex('#DA0F78'),
983
+ PARAMETER: Color.fromHex('#8e44ad'),
984
+ });
985
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1002
986
  /**
1003
- * Dark color of the Promptbook
987
+ * Chat color of the Promptbook (in chat)
1004
988
  *
1005
989
  * TODO: [🗽] Unite branding and make single place for it
1006
990
  *
1007
991
  * @public exported from `@promptbook/core`
1008
992
  */
1009
993
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
994
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
1010
995
  /**
1011
996
  * Color of the user (in chat)
1012
997
  *
@@ -1015,6 +1000,7 @@ PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1015
1000
  * @public exported from `@promptbook/core`
1016
1001
  */
1017
1002
  Color.fromHex('#1D4ED8');
1003
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1018
1004
  /**
1019
1005
  * When the title is not provided, the default title is used
1020
1006
  *
@@ -1101,7 +1087,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
1101
1087
  * @public exported from `@promptbook/core`
1102
1088
  */
1103
1089
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1104
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1090
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1105
1091
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1106
1092
  /**
1107
1093
  * Where to store the temporary downloads
@@ -1204,7 +1190,7 @@ class KnowledgeScrapeError extends Error {
1204
1190
  function getErrorReportUrl(error) {
1205
1191
  const report = {
1206
1192
  title: `🐜 Error report from ${NAME}`,
1207
- body: spaceTrim((block) => `
1193
+ body: spaceTrim$2((block) => `
1208
1194
 
1209
1195
 
1210
1196
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1583,6 +1569,8 @@ function removeDiacritics(input) {
1583
1569
  /**
1584
1570
  * Converts a given text to kebab-case format.
1585
1571
  *
1572
+ * Note: [🔂] This function is idempotent.
1573
+ *
1586
1574
  * @param text The text to be converted.
1587
1575
  * @returns The kebab-case formatted string.
1588
1576
  * @example 'hello-world'
@@ -1738,6 +1726,8 @@ function removeEmojis(text) {
1738
1726
  /**
1739
1727
  * Converts a title string into a normalized name.
1740
1728
  *
1729
+ * Note: [🔂] This function is idempotent.
1730
+ *
1741
1731
  * @param value The title string to be converted to a name.
1742
1732
  * @returns A normalized name derived from the input title.
1743
1733
  * @example 'Hello World!' -> 'hello-world'
@@ -1829,7 +1819,7 @@ async function getScraperIntermediateSource(source, options) {
1829
1819
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
1830
1820
  */
1831
1821
 
1832
- 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"}];
1822
+ 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"}];
1833
1823
 
1834
1824
  /**
1835
1825
  * Checks if value is valid email
@@ -1936,6 +1926,8 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
1936
1926
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
1937
1927
  * 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.
1938
1928
  *
1929
+ * Note: [🔂] This function is idempotent.
1930
+ *
1939
1931
  * @param {string} pipelineString the candidate for a pipeline string
1940
1932
  * @returns {PipelineString} the same string as input, but validated as valid
1941
1933
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2095,7 +2087,7 @@ function pipelineJsonToString(pipelineJson) {
2095
2087
  pipelineString += '\n\n';
2096
2088
  pipelineString += '```' + contentLanguage;
2097
2089
  pipelineString += '\n';
2098
- pipelineString += spaceTrim(content);
2090
+ pipelineString += spaceTrim$2(content);
2099
2091
  // <- TODO: [main] !!3 Escape
2100
2092
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2101
2093
  pipelineString += '\n';
@@ -2216,7 +2208,7 @@ function checkSerializableAsJson(options) {
2216
2208
  }
2217
2209
  else if (typeof value === 'object') {
2218
2210
  if (value instanceof Date) {
2219
- throw new UnexpectedError(spaceTrim((block) => `
2211
+ throw new UnexpectedError(spaceTrim$2((block) => `
2220
2212
  \`${name}\` is Date
2221
2213
 
2222
2214
  Use \`string_date_iso8601\` instead
@@ -2235,7 +2227,7 @@ function checkSerializableAsJson(options) {
2235
2227
  throw new UnexpectedError(`${name} is RegExp`);
2236
2228
  }
2237
2229
  else if (value instanceof Error) {
2238
- throw new UnexpectedError(spaceTrim((block) => `
2230
+ throw new UnexpectedError(spaceTrim$2((block) => `
2239
2231
  \`${name}\` is unserialized Error
2240
2232
 
2241
2233
  Use function \`serializeError\`
@@ -2258,7 +2250,7 @@ function checkSerializableAsJson(options) {
2258
2250
  }
2259
2251
  catch (error) {
2260
2252
  assertsError(error);
2261
- throw new UnexpectedError(spaceTrim((block) => `
2253
+ throw new UnexpectedError(spaceTrim$2((block) => `
2262
2254
  \`${name}\` is not serializable
2263
2255
 
2264
2256
  ${block(error.stack || error.message)}
@@ -2290,7 +2282,7 @@ function checkSerializableAsJson(options) {
2290
2282
  }
2291
2283
  }
2292
2284
  else {
2293
- throw new UnexpectedError(spaceTrim((block) => `
2285
+ throw new UnexpectedError(spaceTrim$2((block) => `
2294
2286
  \`${name}\` is unknown type
2295
2287
 
2296
2288
  Additional message for \`${name}\`:
@@ -2320,7 +2312,7 @@ function deepClone(objectValue) {
2320
2312
  TODO: [🧠] Is there a better implementation?
2321
2313
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
2322
2314
  > for (const propertyName of propertyNames) {
2323
- > const value = (objectValue as really_any)[propertyName];
2315
+ > const value = (objectValue as chococake)[propertyName];
2324
2316
  > if (value && typeof value === 'object') {
2325
2317
  > deepClone(value);
2326
2318
  > }
@@ -2525,6 +2517,8 @@ function isValidPipelineUrl(url) {
2525
2517
  * - if it is valid json
2526
2518
  * - if it is meaningful
2527
2519
  *
2520
+ * Note: [🔂] This function is idempotent.
2521
+ *
2528
2522
  * @param pipeline valid or invalid PipelineJson
2529
2523
  * @returns the same pipeline if it is logically valid
2530
2524
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2891,7 +2885,7 @@ function unpreparePipeline(pipeline) {
2891
2885
  * Library of pipelines that groups together pipelines for an application.
2892
2886
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
2893
2887
  *
2894
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
2888
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
2895
2889
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
2896
2890
  */
2897
2891
  class SimplePipelineCollection {
@@ -2901,7 +2895,7 @@ class SimplePipelineCollection {
2901
2895
  * @param pipelines Array of pipeline JSON objects to include in the collection
2902
2896
  *
2903
2897
  * Note: During the construction logic of all pipelines are validated
2904
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
2898
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
2905
2899
  */
2906
2900
  constructor(...pipelines) {
2907
2901
  this.collection = new Map();
@@ -2989,16 +2983,16 @@ class SimplePipelineCollection {
2989
2983
  }
2990
2984
 
2991
2985
  /**
2992
- * Creates PipelineCollection from array of PipelineJson or PipelineString
2986
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
2993
2987
  *
2994
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
2988
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
2995
2989
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
2996
2990
  *
2997
2991
  * @param promptbookSources
2998
2992
  * @returns PipelineCollection
2999
2993
  * @public exported from `@promptbook/core`
3000
2994
  */
3001
- function createCollectionFromJson(...promptbooks) {
2995
+ function createPipelineCollectionFromJson(...promptbooks) {
3002
2996
  return new SimplePipelineCollection(...promptbooks);
3003
2997
  }
3004
2998
 
@@ -3023,6 +3017,7 @@ class MissingToolsError extends Error {
3023
3017
  /**
3024
3018
  * Generates random token
3025
3019
  *
3020
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
3026
3021
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
3027
3022
  *
3028
3023
  * @private internal helper function
@@ -3032,6 +3027,7 @@ function $randomToken(randomness) {
3032
3027
  return randomBytes(randomness).toString('hex');
3033
3028
  }
3034
3029
  /**
3030
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3035
3031
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
3036
3032
  */
3037
3033
 
@@ -3150,6 +3146,22 @@ class CollectionError extends Error {
3150
3146
  }
3151
3147
  }
3152
3148
 
3149
+ /**
3150
+ * This error indicates error from the database
3151
+ *
3152
+ * @public exported from `@promptbook/core`
3153
+ */
3154
+ class DatabaseError extends Error {
3155
+ constructor(message) {
3156
+ super(message);
3157
+ this.name = 'DatabaseError';
3158
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3159
+ }
3160
+ }
3161
+ /**
3162
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
3163
+ */
3164
+
3153
3165
  /**
3154
3166
  * This error occurs when some expectation is not met in the execution of the pipeline
3155
3167
  *
@@ -3179,6 +3191,19 @@ class LimitReachedError extends Error {
3179
3191
  }
3180
3192
  }
3181
3193
 
3194
+ /**
3195
+ * This error indicates that promptbook operation is not allowed
3196
+ *
3197
+ * @public exported from `@promptbook/core`
3198
+ */
3199
+ class NotAllowed extends Error {
3200
+ constructor(message) {
3201
+ super(message);
3202
+ this.name = 'NotAllowed';
3203
+ Object.setPrototypeOf(this, NotAllowed.prototype);
3204
+ }
3205
+ }
3206
+
3182
3207
  /**
3183
3208
  * This error type indicates that some part of the code is not implemented yet
3184
3209
  *
@@ -3239,6 +3264,8 @@ const PROMPTBOOK_ERRORS = {
3239
3264
  PromptbookFetchError,
3240
3265
  UnexpectedError,
3241
3266
  WrappedError,
3267
+ NotAllowed,
3268
+ DatabaseError,
3242
3269
  // TODO: [🪑]> VersionMismatchError,
3243
3270
  };
3244
3271
  /**
@@ -3286,7 +3313,7 @@ function serializeError(error) {
3286
3313
  const { name, message, stack } = error;
3287
3314
  const { id } = error;
3288
3315
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3289
- console.error(spaceTrim((block) => `
3316
+ console.error(spaceTrim$2((block) => `
3290
3317
 
3291
3318
  Cannot serialize error with name "${name}"
3292
3319
 
@@ -3319,7 +3346,7 @@ function jsonParse(value) {
3319
3346
  }
3320
3347
  else if (typeof value !== 'string') {
3321
3348
  console.error('Can not parse JSON from non-string value.', { text: value });
3322
- throw new Error(spaceTrim(`
3349
+ throw new Error(spaceTrim$2(`
3323
3350
  Can not parse JSON from non-string value.
3324
3351
 
3325
3352
  The value type: ${typeof value}
@@ -3333,7 +3360,7 @@ function jsonParse(value) {
3333
3360
  if (!(error instanceof Error)) {
3334
3361
  throw error;
3335
3362
  }
3336
- throw new Error(spaceTrim((block) => `
3363
+ throw new Error(spaceTrim$2((block) => `
3337
3364
  ${block(error.message)}
3338
3365
 
3339
3366
  The expected JSON text:
@@ -3386,7 +3413,7 @@ function deserializeError(error) {
3386
3413
  message = `${name}: ${message}`;
3387
3414
  }
3388
3415
  if (stack !== undefined && stack !== '') {
3389
- message = spaceTrim((block) => `
3416
+ message = spaceTrim$2((block) => `
3390
3417
  ${block(message)}
3391
3418
 
3392
3419
  Original stack trace:
@@ -3454,6 +3481,7 @@ function createTask(options) {
3454
3481
  let updatedAt = createdAt;
3455
3482
  const errors = [];
3456
3483
  const warnings = [];
3484
+ const llmCalls = [];
3457
3485
  let currentValue = {};
3458
3486
  let customTldr = null;
3459
3487
  const partialResultSubject = new Subject();
@@ -3469,6 +3497,9 @@ function createTask(options) {
3469
3497
  }, (tldrInfo) => {
3470
3498
  customTldr = tldrInfo;
3471
3499
  updatedAt = new Date();
3500
+ }, (llmCall) => {
3501
+ llmCalls.push(llmCall);
3502
+ updatedAt = new Date();
3472
3503
  });
3473
3504
  finalResultPromise
3474
3505
  .catch((error) => {
@@ -3591,7 +3622,7 @@ function createTask(options) {
3591
3622
  }
3592
3623
  return {
3593
3624
  percent: percent,
3594
- message,
3625
+ message: message + ' (!!!fallback)',
3595
3626
  };
3596
3627
  },
3597
3628
  get createdAt() {
@@ -3614,6 +3645,10 @@ function createTask(options) {
3614
3645
  return warnings;
3615
3646
  // <- Note: [1] --||--
3616
3647
  },
3648
+ get llmCalls() {
3649
+ return [...llmCalls, { foo: '!!! bar' }];
3650
+ // <- Note: [1] --||--
3651
+ },
3617
3652
  get currentValue() {
3618
3653
  return currentValue;
3619
3654
  // <- Note: [1] --||--
@@ -3890,14 +3925,14 @@ class MultipleLlmExecutionTools {
3890
3925
  if (description === undefined) {
3891
3926
  return headLine;
3892
3927
  }
3893
- return spaceTrim((block) => `
3928
+ return spaceTrim$2((block) => `
3894
3929
  ${headLine}
3895
3930
 
3896
3931
  ${ /* <- Note: Indenting the description: */block(description)}
3897
3932
  `);
3898
3933
  })
3899
3934
  .join('\n\n');
3900
- return spaceTrim((block) => `
3935
+ return spaceTrim$2((block) => `
3901
3936
  Multiple LLM Providers:
3902
3937
 
3903
3938
  ${block(innerModelsTitlesAndDescriptions)}
@@ -3988,7 +4023,7 @@ class MultipleLlmExecutionTools {
3988
4023
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
3989
4024
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
3990
4025
  // 3) ...
3991
- spaceTrim((block) => `
4026
+ spaceTrim$2((block) => `
3992
4027
  All execution tools of ${this.title} failed:
3993
4028
 
3994
4029
  ${block(errors
@@ -4001,7 +4036,7 @@ class MultipleLlmExecutionTools {
4001
4036
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4002
4037
  }
4003
4038
  else {
4004
- throw new PipelineExecutionError(spaceTrim((block) => `
4039
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
4005
4040
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4006
4041
 
4007
4042
  Available \`LlmExecutionTools\`:
@@ -4034,7 +4069,7 @@ class MultipleLlmExecutionTools {
4034
4069
  */
4035
4070
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4036
4071
  if (llmExecutionTools.length === 0) {
4037
- const warningMessage = spaceTrim(`
4072
+ const warningMessage = spaceTrim$2(`
4038
4073
  You have not provided any \`LlmExecutionTools\`
4039
4074
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4040
4075
 
@@ -4067,6 +4102,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
4067
4102
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4068
4103
  }
4069
4104
  /**
4105
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4070
4106
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4071
4107
  */
4072
4108
 
@@ -4083,6 +4119,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
4083
4119
  return llmTools;
4084
4120
  }
4085
4121
  /**
4122
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4086
4123
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4087
4124
  */
4088
4125
 
@@ -4098,7 +4135,7 @@ async function preparePersona(personaDescription, tools, options) {
4098
4135
  throw new MissingToolsError('LLM tools are required for preparing persona');
4099
4136
  }
4100
4137
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4101
- const collection = createCollectionFromJson(...PipelineCollection);
4138
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4102
4139
  const preparePersonaExecutor = createPipelineExecutor({
4103
4140
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
4104
4141
  tools,
@@ -4349,14 +4386,14 @@ function $registeredScrapersMessage(availableScrapers) {
4349
4386
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4350
4387
  });
4351
4388
  if (metadata.length === 0) {
4352
- return spaceTrim(`
4389
+ return spaceTrim$2(`
4353
4390
  **No scrapers are available**
4354
4391
 
4355
4392
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4356
4393
  At least there should be available the metadata of the scrapers
4357
4394
  `);
4358
4395
  }
4359
- return spaceTrim((block) => `
4396
+ return spaceTrim$2((block) => `
4360
4397
  Available scrapers are:
4361
4398
  ${block(metadata
4362
4399
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4467,7 +4504,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4467
4504
  else if (urlOrRequest instanceof Request) {
4468
4505
  url = urlOrRequest.url;
4469
4506
  }
4470
- throw new PromptbookFetchError(spaceTrim((block) => `
4507
+ throw new PromptbookFetchError(spaceTrim$2((block) => `
4471
4508
  Can not fetch "${url}"
4472
4509
 
4473
4510
  Fetch error:
@@ -4628,7 +4665,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4628
4665
  const fileExtension = getFileExtension(filename);
4629
4666
  const mimeType = extensionToMimeType(fileExtension || '');
4630
4667
  if (!(await isFileExisting(filename, tools.fs))) {
4631
- throw new NotFoundError(spaceTrim((block) => `
4668
+ throw new NotFoundError(spaceTrim$2((block) => `
4632
4669
  Can not make source handler for file which does not exist:
4633
4670
 
4634
4671
  File:
@@ -4721,7 +4758,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4721
4758
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4722
4759
  break;
4723
4760
  }
4724
- console.warn(spaceTrim((block) => `
4761
+ console.warn(spaceTrim$2((block) => `
4725
4762
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4726
4763
 
4727
4764
  The source:
@@ -4737,7 +4774,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4737
4774
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4738
4775
  }
4739
4776
  if (partialPieces === null) {
4740
- throw new KnowledgeScrapeError(spaceTrim((block) => `
4777
+ throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4741
4778
  Cannot scrape knowledge
4742
4779
 
4743
4780
  The source:
@@ -4902,7 +4939,7 @@ async function preparePipeline(pipeline, tools, options) {
4902
4939
  let title = pipeline.title;
4903
4940
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
4904
4941
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4905
- const collection = createCollectionFromJson(...PipelineCollection);
4942
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4906
4943
  const prepareTitleExecutor = createPipelineExecutor({
4907
4944
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
4908
4945
  tools,
@@ -5312,7 +5349,7 @@ const CsvFormatParser = {
5312
5349
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5313
5350
  const csv = csvParse(value, settings);
5314
5351
  if (csv.errors.length !== 0) {
5315
- throw new CsvFormatError(spaceTrim((block) => `
5352
+ throw new CsvFormatError(spaceTrim$2((block) => `
5316
5353
  CSV parsing error
5317
5354
 
5318
5355
  Error(s) from CSV parsing:
@@ -5357,7 +5394,7 @@ const CsvFormatParser = {
5357
5394
  const { value, settings, mapCallback, onProgress } = options;
5358
5395
  const csv = csvParse(value, settings);
5359
5396
  if (csv.errors.length !== 0) {
5360
- throw new CsvFormatError(spaceTrim((block) => `
5397
+ throw new CsvFormatError(spaceTrim$2((block) => `
5361
5398
  CSV parsing error
5362
5399
 
5363
5400
  Error(s) from CSV parsing:
@@ -5567,7 +5604,7 @@ function mapAvailableToExpectedParameters(options) {
5567
5604
  }
5568
5605
  // Phase 2️⃣: Non-matching mapping
5569
5606
  if (expectedParameterNames.size !== availableParametersNames.size) {
5570
- throw new PipelineExecutionError(spaceTrim((block) => `
5607
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
5571
5608
  Can not map available parameters to expected parameters
5572
5609
 
5573
5610
  Mapped parameters:
@@ -5814,10 +5851,13 @@ const LINES_PER_STANDARD_PAGE = 44;
5814
5851
  * @public exported from `@promptbook/utils`
5815
5852
  */
5816
5853
  function countLines(text) {
5854
+ if (text === '') {
5855
+ return 0;
5856
+ }
5817
5857
  text = text.replace('\r\n', '\n');
5818
5858
  text = text.replace('\r', '\n');
5819
5859
  const lines = text.split('\n');
5820
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
5860
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5821
5861
  }
5822
5862
  /**
5823
5863
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -5942,6 +5982,8 @@ function checkExpectations(expectations, value) {
5942
5982
  * This function provides a common abstraction for result validation that can be used
5943
5983
  * by both execution logic and caching logic to ensure consistency.
5944
5984
  *
5985
+ * Note: [🔂] This function is idempotent.
5986
+ *
5945
5987
  * @param options - The validation options including result string, expectations, and format
5946
5988
  * @returns Validation result with processed string and validity status
5947
5989
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -6010,7 +6052,7 @@ function validatePromptResult(options) {
6010
6052
  */
6011
6053
  async function executeAttempts(options) {
6012
6054
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
6013
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6055
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
6014
6056
  const $ongoingTaskResult = {
6015
6057
  $result: null,
6016
6058
  $resultString: null,
@@ -6258,14 +6300,10 @@ async function executeAttempts(options) {
6258
6300
  });
6259
6301
  }
6260
6302
  finally {
6261
- if (!isJokerAttempt &&
6262
- task.taskType === 'PROMPT_TASK' &&
6263
- $ongoingTaskResult.$prompt
6264
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6265
- // In that case we don’t want to make a report about it because it’s not a llm execution error
6266
- ) {
6267
- // TODO: [🧠] Maybe put other taskTypes into report
6268
- $executionReport.promptExecutions.push({
6303
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6304
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6305
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6306
+ const executionPromptReport = {
6269
6307
  prompt: {
6270
6308
  ...$ongoingTaskResult.$prompt,
6271
6309
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6274,7 +6312,14 @@ async function executeAttempts(options) {
6274
6312
  error: $ongoingTaskResult.$expectError === null
6275
6313
  ? undefined
6276
6314
  : serializeError($ongoingTaskResult.$expectError),
6277
- });
6315
+ };
6316
+ $executionReport.promptExecutions.push(executionPromptReport);
6317
+ if (logLlmCall) {
6318
+ logLlmCall({
6319
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6320
+ report: executionPromptReport,
6321
+ });
6322
+ }
6278
6323
  }
6279
6324
  }
6280
6325
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
@@ -6339,12 +6384,12 @@ async function executeAttempts(options) {
6339
6384
  * @private internal utility of `createPipelineExecutor`
6340
6385
  */
6341
6386
  async function executeFormatSubvalues(options) {
6342
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6387
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6343
6388
  if (task.foreach === undefined) {
6344
- return /* not await */ executeAttempts(options);
6389
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6345
6390
  }
6346
6391
  if (jokerParameterNames.length !== 0) {
6347
- throw new UnexpectedError(spaceTrim((block) => `
6392
+ throw new UnexpectedError(spaceTrim$2((block) => `
6348
6393
  JOKER parameters are not supported together with FOREACH command
6349
6394
 
6350
6395
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6357,7 +6402,7 @@ async function executeFormatSubvalues(options) {
6357
6402
  if (formatDefinition === undefined) {
6358
6403
  throw new UnexpectedError(
6359
6404
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6360
- spaceTrim((block) => `
6405
+ spaceTrim$2((block) => `
6361
6406
  Unsupported format "${task.foreach.formatName}"
6362
6407
 
6363
6408
  Available formats:
@@ -6374,7 +6419,7 @@ async function executeFormatSubvalues(options) {
6374
6419
  if (subvalueParser === undefined) {
6375
6420
  throw new UnexpectedError(
6376
6421
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6377
- spaceTrim((block) => `
6422
+ spaceTrim$2((block) => `
6378
6423
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6379
6424
 
6380
6425
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6414,7 +6459,7 @@ async function executeFormatSubvalues(options) {
6414
6459
  if (!(error instanceof PipelineExecutionError)) {
6415
6460
  throw error;
6416
6461
  }
6417
- const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
6462
+ const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6418
6463
  ${error.message}
6419
6464
 
6420
6465
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6438,7 +6483,7 @@ async function executeFormatSubvalues(options) {
6438
6483
  ...options,
6439
6484
  priority: priority + index,
6440
6485
  parameters: allSubparameters,
6441
- pipelineIdentification: spaceTrim((block) => `
6486
+ pipelineIdentification: spaceTrim$2((block) => `
6442
6487
  ${block(pipelineIdentification)}
6443
6488
  Subparameter index: ${index}
6444
6489
  `),
@@ -6447,7 +6492,7 @@ async function executeFormatSubvalues(options) {
6447
6492
  }
6448
6493
  catch (error) {
6449
6494
  if (length > BIG_DATASET_TRESHOLD) {
6450
- console.error(spaceTrim((block) => `
6495
+ console.error(spaceTrim$2((block) => `
6451
6496
  ${error.message}
6452
6497
 
6453
6498
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6547,7 +6592,7 @@ async function getKnowledgeForTask(options) {
6547
6592
  },
6548
6593
  content: task.content,
6549
6594
  parameters,
6550
- };
6595
+ }; /* <- Note: [🤛] */
6551
6596
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6552
6597
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6553
6598
  const { index } = knowledgePiece;
@@ -6642,7 +6687,7 @@ async function getReservedParametersForTask(options) {
6642
6687
  * @private internal utility of `createPipelineExecutor`
6643
6688
  */
6644
6689
  async function executeTask(options) {
6645
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6690
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6646
6691
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6647
6692
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6648
6693
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
@@ -6721,6 +6766,7 @@ async function executeTask(options) {
6721
6766
  tools,
6722
6767
  $executionReport,
6723
6768
  onProgress,
6769
+ logLlmCall,
6724
6770
  pipelineIdentification,
6725
6771
  maxExecutionAttempts,
6726
6772
  maxParallelCount,
@@ -6764,6 +6810,29 @@ function filterJustOutputParameters(options) {
6764
6810
  $warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6765
6811
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6766
6812
 
6813
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6814
+
6815
+ All parameters:
6816
+ ${block(preparedPipeline.parameters
6817
+ .map(({ name, isInput, isOutput, description }) => {
6818
+ let line = `\`{${name}}\``;
6819
+ if (isInput) {
6820
+ line += ' `[input parameter]`';
6821
+ }
6822
+ if (isOutput) {
6823
+ line += ' `[output parameter]`';
6824
+ }
6825
+ if (parametersToPass[name] === undefined) {
6826
+ line += ` <- Warning: Should be in the output but its not |`;
6827
+ }
6828
+ if (description) {
6829
+ line += ` ${description}`;
6830
+ }
6831
+ return line;
6832
+ })
6833
+ .map((line, index) => `${index + 1}) ${line}`)
6834
+ .join('\n'))}
6835
+
6767
6836
  ${block(pipelineIdentification)}
6768
6837
  `)));
6769
6838
  continue;
@@ -6784,7 +6853,7 @@ function filterJustOutputParameters(options) {
6784
6853
  * @private internal utility of `createPipelineExecutor`
6785
6854
  */
6786
6855
  async function executePipeline(options) {
6787
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6856
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6788
6857
  let { preparedPipeline } = options;
6789
6858
  if (preparedPipeline === undefined) {
6790
6859
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6962,6 +7031,7 @@ async function executePipeline(options) {
6962
7031
  onProgress(newOngoingResult);
6963
7032
  }
6964
7033
  },
7034
+ logLlmCall,
6965
7035
  $executionReport: executionReport,
6966
7036
  pipelineIdentification: spaceTrim$1((block) => `
6967
7037
  ${block(pipelineIdentification)}
@@ -7085,7 +7155,7 @@ function createPipelineExecutor(options) {
7085
7155
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7086
7156
  }
7087
7157
  let runCount = 0;
7088
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7158
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7089
7159
  runCount++;
7090
7160
  return /* not await */ executePipeline({
7091
7161
  pipeline,
@@ -7096,6 +7166,7 @@ function createPipelineExecutor(options) {
7096
7166
  inputParameters,
7097
7167
  tools,
7098
7168
  onProgress,
7169
+ logLlmCall,
7099
7170
  pipelineIdentification: spaceTrim$1((block) => `
7100
7171
  ${block(pipelineIdentification)}
7101
7172
  ${runCount === 1 ? '' : `Run #${runCount}`}
@@ -7257,7 +7328,7 @@ class MarkdownScraper {
7257
7328
  }
7258
7329
  const llmTools = getSingleLlmExecutionTools(llm);
7259
7330
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7260
- const collection = createCollectionFromJson(...PipelineCollection);
7331
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7261
7332
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7262
7333
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7263
7334
  tools: {
@@ -7293,8 +7364,8 @@ class MarkdownScraper {
7293
7364
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7294
7365
  // Note: These are just default values, they will be overwritten by the actual values:
7295
7366
  let name = `piece-${i}`;
7296
- let title = spaceTrim(knowledgeTextPiece.substring(0, 100));
7297
- const knowledgePieceContent = spaceTrim(knowledgeTextPiece);
7367
+ let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7368
+ const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7298
7369
  let keywords = [];
7299
7370
  const index = [];
7300
7371
  /*
@@ -7307,7 +7378,7 @@ class MarkdownScraper {
7307
7378
  isCrashedOnError: true,
7308
7379
  });
7309
7380
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7310
- title = spaceTrim(titleRaw) /* <- TODO: Maybe do in pipeline */;
7381
+ title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7311
7382
  name = titleToName(title);
7312
7383
  // --- Keywords
7313
7384
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({