@promptbook/website-crawler 0.103.0-9 → 0.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +59 -39
  2. package/esm/index.es.js +316 -227
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +0 -81
  5. package/esm/typings/servers.d.ts +9 -7
  6. package/esm/typings/src/_packages/browser.index.d.ts +6 -0
  7. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  8. package/esm/typings/src/_packages/components.index.d.ts +22 -8
  9. package/esm/typings/src/_packages/core.index.d.ts +58 -18
  10. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -0
  12. package/esm/typings/src/_packages/types.index.d.ts +70 -8
  13. package/esm/typings/src/_packages/utils.index.d.ts +6 -0
  14. package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
  15. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +20 -5
  16. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +17 -1
  17. package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
  18. package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
  19. package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +3 -3
  20. package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
  21. package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
  22. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +18 -0
  23. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
  24. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +3 -0
  25. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
  26. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +85 -14
  27. package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +18 -0
  28. package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
  29. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +17 -0
  30. package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
  31. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +16 -0
  32. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
  33. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
  34. package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
  35. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  36. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
  37. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
  38. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  39. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
  40. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
  41. package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
  42. package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
  43. package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
  44. package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
  45. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
  46. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
  47. package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +2 -2
  48. package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
  49. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
  50. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +11 -0
  51. package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
  52. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
  53. package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
  54. package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
  55. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
  56. package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
  57. package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
  58. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
  59. package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
  60. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
  61. package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
  62. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
  63. package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
  64. package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
  65. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  66. package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
  67. package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
  68. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
  69. package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
  70. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
  71. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
  72. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
  73. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
  74. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
  75. package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
  76. package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
  77. package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
  78. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
  79. package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
  80. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
  81. package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
  82. package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
  83. package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
  84. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
  85. package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
  86. package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +39 -0
  87. package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
  88. package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
  89. package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
  90. package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
  91. package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
  92. package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
  93. package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
  94. package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
  95. package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
  96. package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
  97. package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
  98. package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
  99. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
  100. package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
  101. package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
  102. package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
  103. package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
  104. package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
  105. package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
  106. package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
  107. package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
  108. package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
  109. package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
  110. package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
  111. package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
  112. package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
  113. package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
  114. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
  115. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
  116. package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
  117. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
  118. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +14 -2
  119. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
  120. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
  121. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  122. package/esm/typings/src/commitments/index.d.ts +93 -0
  123. package/esm/typings/src/config.d.ts +24 -3
  124. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
  125. package/esm/typings/src/errors/0-index.d.ts +6 -0
  126. package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
  127. package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
  128. package/esm/typings/src/errors/WrappedError.d.ts +2 -2
  129. package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
  130. package/esm/typings/src/execution/Executables.d.ts +3 -0
  131. package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
  132. package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
  133. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  134. package/esm/typings/src/execution/LlmExecutionTools.d.ts +26 -2
  135. package/esm/typings/src/execution/PromptResult.d.ts +7 -1
  136. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
  137. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
  138. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
  139. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
  140. package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
  141. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
  142. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
  143. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
  144. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
  145. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  146. package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
  147. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
  148. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
  149. package/esm/typings/src/llm-providers/agent/Agent.d.ts +72 -0
  150. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
  151. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
  152. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
  153. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
  154. package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
  155. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
  156. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  157. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  158. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +4 -0
  159. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
  160. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
  161. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +13 -1
  162. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
  163. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +6 -6
  164. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  165. package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
  166. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  167. package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
  168. package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
  169. package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
  170. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  171. package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
  172. package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
  173. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
  174. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
  175. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
  176. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
  177. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
  178. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
  179. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
  180. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
  181. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
  182. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
  183. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
  184. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
  185. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
  186. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
  187. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
  188. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  189. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
  190. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
  191. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
  192. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
  193. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
  194. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
  195. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
  196. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
  197. package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
  198. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
  199. package/esm/typings/src/types/LlmCall.d.ts +20 -0
  200. package/esm/typings/src/types/ModelRequirements.d.ts +13 -1
  201. package/esm/typings/src/types/ModelVariant.d.ts +1 -1
  202. package/esm/typings/src/types/Prompt.d.ts +13 -1
  203. package/esm/typings/src/types/Updatable.d.ts +19 -0
  204. package/esm/typings/src/types/typeAliases.d.ts +38 -2
  205. package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
  206. package/esm/typings/src/utils/color/Color.d.ts +16 -1
  207. package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
  208. package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
  209. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
  210. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  211. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  212. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  213. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  214. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  215. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  216. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
  217. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
  218. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
  219. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
  220. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
  221. package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
  222. package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
  223. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
  224. package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
  225. package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
  226. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
  227. package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
  228. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
  229. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  230. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  231. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
  232. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
  233. package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
  234. package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
  235. package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
  236. package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
  237. package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
  238. package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
  239. package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
  240. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +31 -0
  241. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
  242. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
  243. package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
  244. package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
  245. package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
  246. package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
  247. package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
  248. package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
  249. package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
  250. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
  251. package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
  252. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  253. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
  254. package/esm/typings/src/version.d.ts +1 -1
  255. package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
  256. package/package.json +7 -7
  257. package/umd/index.umd.js +285 -196
  258. package/umd/index.umd.js.map +1 -1
  259. package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
  260. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
  261. package/esm/typings/src/book-components/BookEditor/BookEditorWrapper.d.ts +0 -9
  262. package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
  263. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
  264. package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
  265. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  266. /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
  267. /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
  268. /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
  269. /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
  270. /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
  271. /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
  272. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
  273. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import spaceTrim$1, { spaceTrim } from 'spacetrim';
1
+ import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { Readability } from '@mozilla/readability';
3
3
  import { JSDOM } from 'jsdom';
4
4
  import { SHA256 } from 'crypto-js';
@@ -20,14 +20,14 @@ import { Converter } from 'showdown';
20
20
  * @generated
21
21
  * @see https://github.com/webgptorg/book
22
22
  */
23
- const BOOK_LANGUAGE_VERSION = '1.0.0';
23
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
24
24
  /**
25
25
  * The version of the Promptbook engine
26
26
  *
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-9';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -77,6 +77,17 @@ function $deepFreeze(objectValue) {
77
77
  * TODO: [🧠] Is there a way how to meaningfully test this utility
78
78
  */
79
79
 
80
+ /**
81
+ * Trims string from all 4 sides
82
+ *
83
+ * Note: This is a re-exported function from the `spacetrim` package which is
84
+ * Developed by same author @hejny as this package
85
+ *
86
+ * @public exported from `@promptbook/utils`
87
+ * @see https://github.com/hejny/spacetrim#usage
88
+ */
89
+ const spaceTrim = spaceTrim$1;
90
+
80
91
  /**
81
92
  * @private util of `@promptbook/color`
82
93
  * @de
@@ -125,6 +136,7 @@ function take(initialValue) {
125
136
  * @public exported from `@promptbook/color`
126
137
  */
127
138
  const CSS_COLORS = {
139
+ promptbook: '#79EAFD',
128
140
  transparent: 'rgba(0,0,0,0)',
129
141
  aliceblue: '#f0f8ff',
130
142
  antiquewhite: '#faebd7',
@@ -306,9 +318,6 @@ function checkChannelValue(channelName, value) {
306
318
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
307
319
  }
308
320
  }
309
- /**
310
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
311
- */
312
321
 
313
322
  /**
314
323
  * Color object represents an RGB color with alpha channel
@@ -328,21 +337,61 @@ class Color {
328
337
  * @param color
329
338
  * @returns Color object
330
339
  */
331
- static from(color) {
332
- if (color instanceof Color) {
340
+ static from(color, _isSingleValue = false) {
341
+ if (color === '') {
342
+ throw new Error(`Can not create color from empty string`);
343
+ }
344
+ else if (color instanceof Color) {
333
345
  return take(color);
334
346
  }
335
347
  else if (Color.isColor(color)) {
336
348
  return take(color);
337
349
  }
338
350
  else if (typeof color === 'string') {
339
- return Color.fromString(color);
351
+ try {
352
+ return Color.fromString(color);
353
+ }
354
+ catch (error) {
355
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
356
+ if (_isSingleValue) {
357
+ throw error;
358
+ }
359
+ const parts = color.split(/[\s+,;|]/);
360
+ if (parts.length > 0) {
361
+ return Color.from(parts[0].trim(), true);
362
+ }
363
+ else {
364
+ throw new Error(`Can not create color from given string "${color}"`);
365
+ }
366
+ }
340
367
  }
341
368
  else {
342
369
  console.error({ color });
343
370
  throw new Error(`Can not create color from given object`);
344
371
  }
345
372
  }
373
+ /**
374
+ * Creates a new Color instance from miscellaneous formats
375
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
376
+ *
377
+ * @param color
378
+ * @returns Color object
379
+ */
380
+ static fromSafe(color) {
381
+ try {
382
+ return Color.from(color);
383
+ }
384
+ catch (error) {
385
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
386
+ console.warn(spaceTrim((block) => `
387
+ Color.fromSafe error:
388
+ ${block(error.message)}
389
+
390
+ Returning default PROMPTBOOK_COLOR.
391
+ `));
392
+ return Color.fromString('promptbook');
393
+ }
394
+ }
346
395
  /**
347
396
  * Creates a new Color instance from miscellaneous string formats
348
397
  *
@@ -410,6 +459,9 @@ class Color {
410
459
  if (hex.length === 3) {
411
460
  return Color.fromHex3(hex);
412
461
  }
462
+ if (hex.length === 4) {
463
+ return Color.fromHex4(hex);
464
+ }
413
465
  if (hex.length === 6) {
414
466
  return Color.fromHex6(hex);
415
467
  }
@@ -430,6 +482,19 @@ class Color {
430
482
  const b = parseInt(hex.substr(2, 1), 16) * 16;
431
483
  return take(new Color(r, g, b));
432
484
  }
485
+ /**
486
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
487
+ *
488
+ * @param color in hex for example `09df`
489
+ * @returns Color object
490
+ */
491
+ static fromHex4(hex) {
492
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
493
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
494
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
495
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
496
+ return take(new Color(r, g, b, a));
497
+ }
433
498
  /**
434
499
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
435
500
  *
@@ -620,7 +685,8 @@ class Color {
620
685
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
621
686
  */
622
687
  static isHexColorString(value) {
623
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
688
+ return (typeof value === 'string' &&
689
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
624
690
  }
625
691
  /**
626
692
  * Creates new Color object
@@ -735,6 +801,23 @@ class Color {
735
801
  * TODO: Maybe connect with textures
736
802
  */
737
803
 
804
+ /**
805
+ * Makes color transformer which returns a grayscale version of the color
806
+ *
807
+ * @param amount from 0 to 1
808
+ *
809
+ * @public exported from `@promptbook/color`
810
+ */
811
+ function grayscale(amount) {
812
+ return ({ red, green, blue, alpha }) => {
813
+ const average = (red + green + blue) / 3;
814
+ red = Math.round(average * amount + red * (1 - amount));
815
+ green = Math.round(average * amount + green * (1 - amount));
816
+ blue = Math.round(average * amount + blue * (1 - amount));
817
+ return Color.fromValues(red, green, blue, alpha);
818
+ };
819
+ }
820
+
738
821
  /**
739
822
  * Converts HSL values to RGB values
740
823
  *
@@ -850,102 +933,6 @@ function lighten(amount) {
850
933
  * TODO: Maybe implement by mix+hsl
851
934
  */
852
935
 
853
- /**
854
- * Calculates distance between two colors
855
- *
856
- * @param color1 first color
857
- * @param color2 second color
858
- *
859
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
860
- *
861
- * @public exported from `@promptbook/color`
862
- */
863
- /**
864
- * Calculates distance between two colors without square root
865
- *
866
- * @param color1 first color
867
- * @param color2 second color
868
- *
869
- * @public exported from `@promptbook/color`
870
- */
871
- function colorDistanceSquared(color1, color2) {
872
- const rmean = (color1.red + color2.red) / 2;
873
- const r = color1.red - color2.red;
874
- const g = color1.green - color2.green;
875
- const b = color1.blue - color2.blue;
876
- const weightR = 2 + rmean / 256;
877
- const weightG = 4.0;
878
- const weightB = 2 + (255 - rmean) / 256;
879
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
880
- return distance;
881
- }
882
-
883
- /**
884
- * Makes color transformer which finds the nearest color from the given list
885
- *
886
- * @param colors array of colors to choose from
887
- *
888
- * @public exported from `@promptbook/color`
889
- */
890
- function nearest(...colors) {
891
- return (color) => {
892
- const distances = colors.map((c) => colorDistanceSquared(c, color));
893
- const minDistance = Math.min(...distances);
894
- const minIndex = distances.indexOf(minDistance);
895
- const nearestColor = colors[minIndex];
896
- return nearestColor;
897
- };
898
- }
899
-
900
- /**
901
- * Color transformer which returns the negative color
902
- *
903
- * @public exported from `@promptbook/color`
904
- */
905
- function negative(color) {
906
- const r = 255 - color.red;
907
- const g = 255 - color.green;
908
- const b = 255 - color.blue;
909
- return Color.fromValues(r, g, b, color.alpha);
910
- }
911
-
912
- /**
913
- * Makes color transformer which finds the furthest color from the given list
914
- *
915
- * @param colors array of colors to choose from
916
- *
917
- * @public exported from `@promptbook/color`
918
- */
919
- function furthest(...colors) {
920
- return (color) => {
921
- const furthestColor = negative(nearest(...colors.map(negative))(color));
922
- return furthestColor;
923
- };
924
- }
925
- /**
926
- * Makes color transformer which finds the best text color (black or white) for the given background color
927
- *
928
- * @public exported from `@promptbook/color`
929
- */
930
- furthest(Color.get('white'), Color.from('black'));
931
-
932
- /**
933
- * Makes color transformer which returns a grayscale version of the color
934
- *
935
- * @param amount from 0 to 1
936
- *
937
- * @public exported from `@promptbook/color`
938
- */
939
- function grayscale(amount) {
940
- return ({ red, green, blue, alpha }) => {
941
- const average = (red + green + blue) / 3;
942
- red = Math.round(average * amount + red * (1 - amount));
943
- green = Math.round(average * amount + green * (1 - amount));
944
- blue = Math.round(average * amount + blue * (1 - amount));
945
- return Color.fromValues(red, green, blue, alpha);
946
- };
947
- }
948
-
949
936
  /**
950
937
  * Makes color transformer which saturate the given color
951
938
  *
@@ -1014,16 +1001,32 @@ const ADMIN_GITHUB_NAME = 'hejny';
1014
1001
  *
1015
1002
  * @public exported from `@promptbook/core`
1016
1003
  */
1017
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
1018
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
1004
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
1005
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1019
1006
  /**
1020
- * Dark color of the Promptbook
1007
+ * Colors for syntax highlighting in the `<BookEditor/>`
1008
+ *
1009
+ * TODO: [🗽] Unite branding and make single place for it
1010
+ *
1011
+ * @public exported from `@promptbook/core`
1012
+ */
1013
+ ({
1014
+ TITLE: Color.fromHex('#244EA8'),
1015
+ LINE: Color.fromHex('#eeeeee'),
1016
+ SEPARATOR: Color.fromHex('#cccccc'),
1017
+ COMMITMENT: Color.fromHex('#DA0F78'),
1018
+ PARAMETER: Color.fromHex('#8e44ad'),
1019
+ });
1020
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1021
+ /**
1022
+ * Chat color of the Promptbook (in chat)
1021
1023
  *
1022
1024
  * TODO: [🗽] Unite branding and make single place for it
1023
1025
  *
1024
1026
  * @public exported from `@promptbook/core`
1025
1027
  */
1026
1028
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1029
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
1027
1030
  /**
1028
1031
  * Color of the user (in chat)
1029
1032
  *
@@ -1032,6 +1035,7 @@ PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1032
1035
  * @public exported from `@promptbook/core`
1033
1036
  */
1034
1037
  Color.fromHex('#1D4ED8');
1038
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1035
1039
  /**
1036
1040
  * When the title is not provided, the default title is used
1037
1041
  *
@@ -1118,7 +1122,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
1118
1122
  * @public exported from `@promptbook/core`
1119
1123
  */
1120
1124
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1121
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1125
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1122
1126
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1123
1127
  /**
1124
1128
  * Where to store the temporary downloads
@@ -1194,7 +1198,7 @@ true);
1194
1198
  */
1195
1199
  class NotYetImplementedError extends Error {
1196
1200
  constructor(message) {
1197
- super(spaceTrim((block) => `
1201
+ super(spaceTrim$1((block) => `
1198
1202
  ${block(message)}
1199
1203
 
1200
1204
  Note: This feature is not implemented yet but it will be soon.
@@ -1218,7 +1222,7 @@ class NotYetImplementedError extends Error {
1218
1222
  function getErrorReportUrl(error) {
1219
1223
  const report = {
1220
1224
  title: `🐜 Error report from ${NAME}`,
1221
- body: spaceTrim$1((block) => `
1225
+ body: spaceTrim$2((block) => `
1222
1226
 
1223
1227
 
1224
1228
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1261,7 +1265,7 @@ function getErrorReportUrl(error) {
1261
1265
  */
1262
1266
  class UnexpectedError extends Error {
1263
1267
  constructor(message) {
1264
- super(spaceTrim((block) => `
1268
+ super(spaceTrim$1((block) => `
1265
1269
  ${block(message)}
1266
1270
 
1267
1271
  Note: This error should not happen.
@@ -1753,6 +1757,8 @@ function removeDiacritics(input) {
1753
1757
  /**
1754
1758
  * Converts a given text to kebab-case format.
1755
1759
  *
1760
+ * Note: [🔂] This function is idempotent.
1761
+ *
1756
1762
  * @param text The text to be converted.
1757
1763
  * @returns The kebab-case formatted string.
1758
1764
  * @example 'hello-world'
@@ -1908,6 +1914,8 @@ function removeEmojis(text) {
1908
1914
  /**
1909
1915
  * Converts a title string into a normalized name.
1910
1916
  *
1917
+ * Note: [🔂] This function is idempotent.
1918
+ *
1911
1919
  * @param value The title string to be converted to a name.
1912
1920
  * @returns A normalized name derived from the input title.
1913
1921
  * @example 'Hello World!' -> 'hello-world'
@@ -1999,7 +2007,7 @@ async function getScraperIntermediateSource(source, options) {
1999
2007
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2000
2008
  */
2001
2009
 
2002
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-8",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
2010
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
2003
2011
 
2004
2012
  /**
2005
2013
  * Checks if value is valid email
@@ -2041,7 +2049,7 @@ class WrappedError extends Error {
2041
2049
  constructor(whatWasThrown) {
2042
2050
  const tag = `[🤮]`;
2043
2051
  console.error(tag, whatWasThrown);
2044
- super(spaceTrim(`
2052
+ super(spaceTrim$1(`
2045
2053
  Non-Error object was thrown
2046
2054
 
2047
2055
  Note: Look for ${tag} in the console for more details
@@ -2106,6 +2114,8 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
2106
2114
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
2107
2115
  * It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
2108
2116
  *
2117
+ * Note: [🔂] This function is idempotent.
2118
+ *
2109
2119
  * @param {string} pipelineString the candidate for a pipeline string
2110
2120
  * @returns {PipelineString} the same string as input, but validated as valid
2111
2121
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2265,7 +2275,7 @@ function pipelineJsonToString(pipelineJson) {
2265
2275
  pipelineString += '\n\n';
2266
2276
  pipelineString += '```' + contentLanguage;
2267
2277
  pipelineString += '\n';
2268
- pipelineString += spaceTrim$1(content);
2278
+ pipelineString += spaceTrim$2(content);
2269
2279
  // <- TODO: [main] !!3 Escape
2270
2280
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2271
2281
  pipelineString += '\n';
@@ -2359,7 +2369,7 @@ function checkSerializableAsJson(options) {
2359
2369
  }
2360
2370
  else if (typeof value === 'object') {
2361
2371
  if (value instanceof Date) {
2362
- throw new UnexpectedError(spaceTrim$1((block) => `
2372
+ throw new UnexpectedError(spaceTrim$2((block) => `
2363
2373
  \`${name}\` is Date
2364
2374
 
2365
2375
  Use \`string_date_iso8601\` instead
@@ -2378,7 +2388,7 @@ function checkSerializableAsJson(options) {
2378
2388
  throw new UnexpectedError(`${name} is RegExp`);
2379
2389
  }
2380
2390
  else if (value instanceof Error) {
2381
- throw new UnexpectedError(spaceTrim$1((block) => `
2391
+ throw new UnexpectedError(spaceTrim$2((block) => `
2382
2392
  \`${name}\` is unserialized Error
2383
2393
 
2384
2394
  Use function \`serializeError\`
@@ -2401,7 +2411,7 @@ function checkSerializableAsJson(options) {
2401
2411
  }
2402
2412
  catch (error) {
2403
2413
  assertsError(error);
2404
- throw new UnexpectedError(spaceTrim$1((block) => `
2414
+ throw new UnexpectedError(spaceTrim$2((block) => `
2405
2415
  \`${name}\` is not serializable
2406
2416
 
2407
2417
  ${block(error.stack || error.message)}
@@ -2433,7 +2443,7 @@ function checkSerializableAsJson(options) {
2433
2443
  }
2434
2444
  }
2435
2445
  else {
2436
- throw new UnexpectedError(spaceTrim$1((block) => `
2446
+ throw new UnexpectedError(spaceTrim$2((block) => `
2437
2447
  \`${name}\` is unknown type
2438
2448
 
2439
2449
  Additional message for \`${name}\`:
@@ -2463,7 +2473,7 @@ function deepClone(objectValue) {
2463
2473
  TODO: [🧠] Is there a better implementation?
2464
2474
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
2465
2475
  > for (const propertyName of propertyNames) {
2466
- > const value = (objectValue as really_any)[propertyName];
2476
+ > const value = (objectValue as chococake)[propertyName];
2467
2477
  > if (value && typeof value === 'object') {
2468
2478
  > deepClone(value);
2469
2479
  > }
@@ -2668,6 +2678,8 @@ function isValidPipelineUrl(url) {
2668
2678
  * - if it is valid json
2669
2679
  * - if it is meaningful
2670
2680
  *
2681
+ * Note: [🔂] This function is idempotent.
2682
+ *
2671
2683
  * @param pipeline valid or invalid PipelineJson
2672
2684
  * @returns the same pipeline if it is logically valid
2673
2685
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2685,7 +2697,7 @@ function validatePipeline(pipeline) {
2685
2697
  if (!(error instanceof PipelineLogicError)) {
2686
2698
  throw error;
2687
2699
  }
2688
- console.error(spaceTrim((block) => `
2700
+ console.error(spaceTrim$1((block) => `
2689
2701
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2690
2702
 
2691
2703
  ${block(error.message)}
@@ -2712,7 +2724,7 @@ function validatePipeline_InnerFunction(pipeline) {
2712
2724
  })();
2713
2725
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2714
2726
  // <- Note: [🚲]
2715
- throw new PipelineLogicError(spaceTrim((block) => `
2727
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2716
2728
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2717
2729
 
2718
2730
  ${block(pipelineIdentification)}
@@ -2720,7 +2732,7 @@ function validatePipeline_InnerFunction(pipeline) {
2720
2732
  }
2721
2733
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2722
2734
  // <- Note: [🚲]
2723
- throw new PipelineLogicError(spaceTrim((block) => `
2735
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2724
2736
  Invalid Promptbook Version "${pipeline.bookVersion}"
2725
2737
 
2726
2738
  ${block(pipelineIdentification)}
@@ -2729,7 +2741,7 @@ function validatePipeline_InnerFunction(pipeline) {
2729
2741
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2730
2742
  if (!Array.isArray(pipeline.parameters)) {
2731
2743
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2732
- throw new ParseError(spaceTrim((block) => `
2744
+ throw new ParseError(spaceTrim$1((block) => `
2733
2745
  Pipeline is valid JSON but with wrong structure
2734
2746
 
2735
2747
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2740,7 +2752,7 @@ function validatePipeline_InnerFunction(pipeline) {
2740
2752
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2741
2753
  if (!Array.isArray(pipeline.tasks)) {
2742
2754
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2743
- throw new ParseError(spaceTrim((block) => `
2755
+ throw new ParseError(spaceTrim$1((block) => `
2744
2756
  Pipeline is valid JSON but with wrong structure
2745
2757
 
2746
2758
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2766,7 +2778,7 @@ function validatePipeline_InnerFunction(pipeline) {
2766
2778
  // Note: Check each parameter individually
2767
2779
  for (const parameter of pipeline.parameters) {
2768
2780
  if (parameter.isInput && parameter.isOutput) {
2769
- throw new PipelineLogicError(spaceTrim((block) => `
2781
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2770
2782
 
2771
2783
  Parameter \`{${parameter.name}}\` can not be both input and output
2772
2784
 
@@ -2777,7 +2789,7 @@ function validatePipeline_InnerFunction(pipeline) {
2777
2789
  if (!parameter.isInput &&
2778
2790
  !parameter.isOutput &&
2779
2791
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2780
- throw new PipelineLogicError(spaceTrim((block) => `
2792
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2781
2793
  Parameter \`{${parameter.name}}\` is created but not used
2782
2794
 
2783
2795
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2789,7 +2801,7 @@ function validatePipeline_InnerFunction(pipeline) {
2789
2801
  }
2790
2802
  // Note: Testing that parameter is either input or result of some task
2791
2803
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2792
- throw new PipelineLogicError(spaceTrim((block) => `
2804
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2793
2805
  Parameter \`{${parameter.name}}\` is declared but not defined
2794
2806
 
2795
2807
  You can do one of these:
@@ -2805,14 +2817,14 @@ function validatePipeline_InnerFunction(pipeline) {
2805
2817
  // Note: Checking each task individually
2806
2818
  for (const task of pipeline.tasks) {
2807
2819
  if (definedParameters.has(task.resultingParameterName)) {
2808
- throw new PipelineLogicError(spaceTrim((block) => `
2820
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2809
2821
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2810
2822
 
2811
2823
  ${block(pipelineIdentification)}
2812
2824
  `));
2813
2825
  }
2814
2826
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2815
- throw new PipelineLogicError(spaceTrim((block) => `
2827
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2816
2828
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2817
2829
 
2818
2830
  ${block(pipelineIdentification)}
@@ -2822,7 +2834,7 @@ function validatePipeline_InnerFunction(pipeline) {
2822
2834
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2823
2835
  if (!task.format &&
2824
2836
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2825
- throw new PipelineLogicError(spaceTrim((block) => `
2837
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2826
2838
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2827
2839
 
2828
2840
  ${block(pipelineIdentification)}
@@ -2830,7 +2842,7 @@ function validatePipeline_InnerFunction(pipeline) {
2830
2842
  }
2831
2843
  for (const joker of task.jokerParameterNames) {
2832
2844
  if (!task.dependentParameterNames.includes(joker)) {
2833
- throw new PipelineLogicError(spaceTrim((block) => `
2845
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2834
2846
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2835
2847
 
2836
2848
  ${block(pipelineIdentification)}
@@ -2841,21 +2853,21 @@ function validatePipeline_InnerFunction(pipeline) {
2841
2853
  if (task.expectations) {
2842
2854
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2843
2855
  if (min !== undefined && max !== undefined && min > max) {
2844
- throw new PipelineLogicError(spaceTrim((block) => `
2856
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2845
2857
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2846
2858
 
2847
2859
  ${block(pipelineIdentification)}
2848
2860
  `));
2849
2861
  }
2850
2862
  if (min !== undefined && min < 0) {
2851
- throw new PipelineLogicError(spaceTrim((block) => `
2863
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2852
2864
  Min expectation of ${unit} must be zero or positive
2853
2865
 
2854
2866
  ${block(pipelineIdentification)}
2855
2867
  `));
2856
2868
  }
2857
2869
  if (max !== undefined && max <= 0) {
2858
- throw new PipelineLogicError(spaceTrim((block) => `
2870
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2859
2871
  Max expectation of ${unit} must be positive
2860
2872
 
2861
2873
  ${block(pipelineIdentification)}
@@ -2877,7 +2889,7 @@ function validatePipeline_InnerFunction(pipeline) {
2877
2889
  while (unresovedTasks.length > 0) {
2878
2890
  if (loopLimit-- < 0) {
2879
2891
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2880
- throw new UnexpectedError(spaceTrim((block) => `
2892
+ throw new UnexpectedError(spaceTrim$1((block) => `
2881
2893
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2882
2894
 
2883
2895
  ${block(pipelineIdentification)}
@@ -2887,7 +2899,7 @@ function validatePipeline_InnerFunction(pipeline) {
2887
2899
  if (currentlyResovedTasks.length === 0) {
2888
2900
  throw new PipelineLogicError(
2889
2901
  // TODO: [🐎] DRY
2890
- spaceTrim((block) => `
2902
+ spaceTrim$1((block) => `
2891
2903
 
2892
2904
  Can not resolve some parameters:
2893
2905
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -3034,7 +3046,7 @@ function unpreparePipeline(pipeline) {
3034
3046
  * Library of pipelines that groups together pipelines for an application.
3035
3047
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
3036
3048
  *
3037
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
3049
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
3038
3050
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
3039
3051
  */
3040
3052
  class SimplePipelineCollection {
@@ -3044,14 +3056,14 @@ class SimplePipelineCollection {
3044
3056
  * @param pipelines Array of pipeline JSON objects to include in the collection
3045
3057
  *
3046
3058
  * Note: During the construction logic of all pipelines are validated
3047
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
3059
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
3048
3060
  */
3049
3061
  constructor(...pipelines) {
3050
3062
  this.collection = new Map();
3051
3063
  for (const pipeline of pipelines) {
3052
3064
  // TODO: [👠] DRY
3053
3065
  if (pipeline.pipelineUrl === undefined) {
3054
- throw new PipelineUrlError(spaceTrim(`
3066
+ throw new PipelineUrlError(spaceTrim$1(`
3055
3067
  Pipeline with name "${pipeline.title}" does not have defined URL
3056
3068
 
3057
3069
  File:
@@ -3073,7 +3085,7 @@ class SimplePipelineCollection {
3073
3085
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
3074
3086
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
3075
3087
  const existing = this.collection.get(pipeline.pipelineUrl);
3076
- throw new PipelineUrlError(spaceTrim(`
3088
+ throw new PipelineUrlError(spaceTrim$1(`
3077
3089
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
3078
3090
 
3079
3091
  Conflicting files:
@@ -3105,13 +3117,13 @@ class SimplePipelineCollection {
3105
3117
  const pipeline = this.collection.get(url);
3106
3118
  if (!pipeline) {
3107
3119
  if (this.listPipelines().length === 0) {
3108
- throw new NotFoundError(spaceTrim(`
3120
+ throw new NotFoundError(spaceTrim$1(`
3109
3121
  Pipeline with url "${url}" not found
3110
3122
 
3111
3123
  No pipelines available
3112
3124
  `));
3113
3125
  }
3114
- throw new NotFoundError(spaceTrim((block) => `
3126
+ throw new NotFoundError(spaceTrim$1((block) => `
3115
3127
  Pipeline with url "${url}" not found
3116
3128
 
3117
3129
  Available pipelines:
@@ -3132,16 +3144,16 @@ class SimplePipelineCollection {
3132
3144
  }
3133
3145
 
3134
3146
  /**
3135
- * Creates PipelineCollection from array of PipelineJson or PipelineString
3147
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
3136
3148
  *
3137
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
3149
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
3138
3150
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
3139
3151
  *
3140
3152
  * @param promptbookSources
3141
3153
  * @returns PipelineCollection
3142
3154
  * @public exported from `@promptbook/core`
3143
3155
  */
3144
- function createCollectionFromJson(...promptbooks) {
3156
+ function createPipelineCollectionFromJson(...promptbooks) {
3145
3157
  return new SimplePipelineCollection(...promptbooks);
3146
3158
  }
3147
3159
 
@@ -3152,7 +3164,7 @@ function createCollectionFromJson(...promptbooks) {
3152
3164
  */
3153
3165
  class MissingToolsError extends Error {
3154
3166
  constructor(message) {
3155
- super(spaceTrim((block) => `
3167
+ super(spaceTrim$1((block) => `
3156
3168
  ${block(message)}
3157
3169
 
3158
3170
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -3166,6 +3178,7 @@ class MissingToolsError extends Error {
3166
3178
  /**
3167
3179
  * Generates random token
3168
3180
  *
3181
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
3169
3182
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
3170
3183
  *
3171
3184
  * @private internal helper function
@@ -3175,6 +3188,7 @@ function $randomToken(randomness) {
3175
3188
  return randomBytes(randomness).toString('hex');
3176
3189
  }
3177
3190
  /**
3191
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3178
3192
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
3179
3193
  */
3180
3194
 
@@ -3293,6 +3307,22 @@ class CollectionError extends Error {
3293
3307
  }
3294
3308
  }
3295
3309
 
3310
+ /**
3311
+ * This error indicates error from the database
3312
+ *
3313
+ * @public exported from `@promptbook/core`
3314
+ */
3315
+ class DatabaseError extends Error {
3316
+ constructor(message) {
3317
+ super(message);
3318
+ this.name = 'DatabaseError';
3319
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3320
+ }
3321
+ }
3322
+ /**
3323
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
3324
+ */
3325
+
3296
3326
  /**
3297
3327
  * This error occurs when some expectation is not met in the execution of the pipeline
3298
3328
  *
@@ -3322,6 +3352,19 @@ class LimitReachedError extends Error {
3322
3352
  }
3323
3353
  }
3324
3354
 
3355
+ /**
3356
+ * This error indicates that promptbook operation is not allowed
3357
+ *
3358
+ * @public exported from `@promptbook/core`
3359
+ */
3360
+ class NotAllowed extends Error {
3361
+ constructor(message) {
3362
+ super(message);
3363
+ this.name = 'NotAllowed';
3364
+ Object.setPrototypeOf(this, NotAllowed.prototype);
3365
+ }
3366
+ }
3367
+
3325
3368
  /**
3326
3369
  * Error thrown when a fetch request fails
3327
3370
  *
@@ -3359,6 +3402,8 @@ const PROMPTBOOK_ERRORS = {
3359
3402
  PromptbookFetchError,
3360
3403
  UnexpectedError,
3361
3404
  WrappedError,
3405
+ NotAllowed,
3406
+ DatabaseError,
3362
3407
  // TODO: [🪑]> VersionMismatchError,
3363
3408
  };
3364
3409
  /**
@@ -3406,7 +3451,7 @@ function serializeError(error) {
3406
3451
  const { name, message, stack } = error;
3407
3452
  const { id } = error;
3408
3453
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3409
- console.error(spaceTrim$1((block) => `
3454
+ console.error(spaceTrim$2((block) => `
3410
3455
 
3411
3456
  Cannot serialize error with name "${name}"
3412
3457
 
@@ -3439,7 +3484,7 @@ function jsonParse(value) {
3439
3484
  }
3440
3485
  else if (typeof value !== 'string') {
3441
3486
  console.error('Can not parse JSON from non-string value.', { text: value });
3442
- throw new Error(spaceTrim$1(`
3487
+ throw new Error(spaceTrim$2(`
3443
3488
  Can not parse JSON from non-string value.
3444
3489
 
3445
3490
  The value type: ${typeof value}
@@ -3453,7 +3498,7 @@ function jsonParse(value) {
3453
3498
  if (!(error instanceof Error)) {
3454
3499
  throw error;
3455
3500
  }
3456
- throw new Error(spaceTrim$1((block) => `
3501
+ throw new Error(spaceTrim$2((block) => `
3457
3502
  ${block(error.message)}
3458
3503
 
3459
3504
  The expected JSON text:
@@ -3506,7 +3551,7 @@ function deserializeError(error) {
3506
3551
  message = `${name}: ${message}`;
3507
3552
  }
3508
3553
  if (stack !== undefined && stack !== '') {
3509
- message = spaceTrim$1((block) => `
3554
+ message = spaceTrim$2((block) => `
3510
3555
  ${block(message)}
3511
3556
 
3512
3557
  Original stack trace:
@@ -3543,11 +3588,11 @@ function assertsTaskSuccessful(executionResult) {
3543
3588
  throw deserializeError(errors[0]);
3544
3589
  }
3545
3590
  else {
3546
- throw new PipelineExecutionError(spaceTrim((block) => `
3591
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
3547
3592
  Multiple errors occurred during Promptbook execution
3548
3593
 
3549
3594
  ${block(errors
3550
- .map(({ name, stack, message }, index) => spaceTrim((block) => `
3595
+ .map(({ name, stack, message }, index) => spaceTrim$1((block) => `
3551
3596
  ${name} ${index + 1}:
3552
3597
  ${block(stack || message)}
3553
3598
  `))
@@ -3574,6 +3619,7 @@ function createTask(options) {
3574
3619
  let updatedAt = createdAt;
3575
3620
  const errors = [];
3576
3621
  const warnings = [];
3622
+ const llmCalls = [];
3577
3623
  let currentValue = {};
3578
3624
  let customTldr = null;
3579
3625
  const partialResultSubject = new Subject();
@@ -3589,6 +3635,9 @@ function createTask(options) {
3589
3635
  }, (tldrInfo) => {
3590
3636
  customTldr = tldrInfo;
3591
3637
  updatedAt = new Date();
3638
+ }, (llmCall) => {
3639
+ llmCalls.push(llmCall);
3640
+ updatedAt = new Date();
3592
3641
  });
3593
3642
  finalResultPromise
3594
3643
  .catch((error) => {
@@ -3711,7 +3760,7 @@ function createTask(options) {
3711
3760
  }
3712
3761
  return {
3713
3762
  percent: percent,
3714
- message,
3763
+ message: message + ' (!!!fallback)',
3715
3764
  };
3716
3765
  },
3717
3766
  get createdAt() {
@@ -3734,6 +3783,10 @@ function createTask(options) {
3734
3783
  return warnings;
3735
3784
  // <- Note: [1] --||--
3736
3785
  },
3786
+ get llmCalls() {
3787
+ return [...llmCalls, { foo: '!!! bar' }];
3788
+ // <- Note: [1] --||--
3789
+ },
3737
3790
  get currentValue() {
3738
3791
  return currentValue;
3739
3792
  // <- Note: [1] --||--
@@ -4010,14 +4063,14 @@ class MultipleLlmExecutionTools {
4010
4063
  if (description === undefined) {
4011
4064
  return headLine;
4012
4065
  }
4013
- return spaceTrim$1((block) => `
4066
+ return spaceTrim$2((block) => `
4014
4067
  ${headLine}
4015
4068
 
4016
4069
  ${ /* <- Note: Indenting the description: */block(description)}
4017
4070
  `);
4018
4071
  })
4019
4072
  .join('\n\n');
4020
- return spaceTrim$1((block) => `
4073
+ return spaceTrim$2((block) => `
4021
4074
  Multiple LLM Providers:
4022
4075
 
4023
4076
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4108,7 +4161,7 @@ class MultipleLlmExecutionTools {
4108
4161
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4109
4162
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4110
4163
  // 3) ...
4111
- spaceTrim$1((block) => `
4164
+ spaceTrim$2((block) => `
4112
4165
  All execution tools of ${this.title} failed:
4113
4166
 
4114
4167
  ${block(errors
@@ -4121,7 +4174,7 @@ class MultipleLlmExecutionTools {
4121
4174
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4122
4175
  }
4123
4176
  else {
4124
- throw new PipelineExecutionError(spaceTrim$1((block) => `
4177
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
4125
4178
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4126
4179
 
4127
4180
  Available \`LlmExecutionTools\`:
@@ -4154,7 +4207,7 @@ class MultipleLlmExecutionTools {
4154
4207
  */
4155
4208
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4156
4209
  if (llmExecutionTools.length === 0) {
4157
- const warningMessage = spaceTrim$1(`
4210
+ const warningMessage = spaceTrim$2(`
4158
4211
  You have not provided any \`LlmExecutionTools\`
4159
4212
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4160
4213
 
@@ -4187,6 +4240,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
4187
4240
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4188
4241
  }
4189
4242
  /**
4243
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4190
4244
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4191
4245
  */
4192
4246
 
@@ -4203,6 +4257,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
4203
4257
  return llmTools;
4204
4258
  }
4205
4259
  /**
4260
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4206
4261
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4207
4262
  */
4208
4263
 
@@ -4218,7 +4273,7 @@ async function preparePersona(personaDescription, tools, options) {
4218
4273
  throw new MissingToolsError('LLM tools are required for preparing persona');
4219
4274
  }
4220
4275
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4221
- const collection = createCollectionFromJson(...PipelineCollection);
4276
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4222
4277
  const preparePersonaExecutor = createPipelineExecutor({
4223
4278
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
4224
4279
  tools,
@@ -4325,14 +4380,14 @@ function $registeredScrapersMessage(availableScrapers) {
4325
4380
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4326
4381
  });
4327
4382
  if (metadata.length === 0) {
4328
- return spaceTrim$1(`
4383
+ return spaceTrim$2(`
4329
4384
  **No scrapers are available**
4330
4385
 
4331
4386
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4332
4387
  At least there should be available the metadata of the scrapers
4333
4388
  `);
4334
4389
  }
4335
- return spaceTrim$1((block) => `
4390
+ return spaceTrim$2((block) => `
4336
4391
  Available scrapers are:
4337
4392
  ${block(metadata
4338
4393
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4468,7 +4523,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4468
4523
  else if (urlOrRequest instanceof Request) {
4469
4524
  url = urlOrRequest.url;
4470
4525
  }
4471
- throw new PromptbookFetchError(spaceTrim$1((block) => `
4526
+ throw new PromptbookFetchError(spaceTrim$2((block) => `
4472
4527
  Can not fetch "${url}"
4473
4528
 
4474
4529
  Fetch error:
@@ -4629,7 +4684,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4629
4684
  const fileExtension = getFileExtension(filename);
4630
4685
  const mimeType = extensionToMimeType(fileExtension || '');
4631
4686
  if (!(await isFileExisting(filename, tools.fs))) {
4632
- throw new NotFoundError(spaceTrim$1((block) => `
4687
+ throw new NotFoundError(spaceTrim$2((block) => `
4633
4688
  Can not make source handler for file which does not exist:
4634
4689
 
4635
4690
  File:
@@ -4722,7 +4777,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4722
4777
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4723
4778
  break;
4724
4779
  }
4725
- console.warn(spaceTrim$1((block) => `
4780
+ console.warn(spaceTrim$2((block) => `
4726
4781
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4727
4782
 
4728
4783
  The source:
@@ -4738,7 +4793,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4738
4793
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4739
4794
  }
4740
4795
  if (partialPieces === null) {
4741
- throw new KnowledgeScrapeError(spaceTrim$1((block) => `
4796
+ throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4742
4797
  Cannot scrape knowledge
4743
4798
 
4744
4799
  The source:
@@ -4817,7 +4872,7 @@ async function prepareTasks(pipeline, tools, options) {
4817
4872
  if (task.taskType === 'PROMPT_TASK' &&
4818
4873
  knowledgePiecesCount > 0 &&
4819
4874
  !dependentParameterNames.includes('knowledge')) {
4820
- preparedContent = spaceTrim(`
4875
+ preparedContent = spaceTrim$1(`
4821
4876
  {content}
4822
4877
 
4823
4878
  ## Knowledge
@@ -4903,7 +4958,7 @@ async function preparePipeline(pipeline, tools, options) {
4903
4958
  let title = pipeline.title;
4904
4959
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
4905
4960
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4906
- const collection = createCollectionFromJson(...PipelineCollection);
4961
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4907
4962
  const prepareTitleExecutor = createPipelineExecutor({
4908
4963
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
4909
4964
  tools,
@@ -5130,7 +5185,7 @@ function extractVariablesFromJavascript(script) {
5130
5185
  }
5131
5186
  catch (error) {
5132
5187
  assertsError(error);
5133
- throw new ParseError(spaceTrim((block) => `
5188
+ throw new ParseError(spaceTrim$1((block) => `
5134
5189
  Can not extract variables from the script
5135
5190
  ${block(error.stack || error.message)}
5136
5191
 
@@ -5313,7 +5368,7 @@ const CsvFormatParser = {
5313
5368
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5314
5369
  const csv = csvParse(value, settings);
5315
5370
  if (csv.errors.length !== 0) {
5316
- throw new CsvFormatError(spaceTrim$1((block) => `
5371
+ throw new CsvFormatError(spaceTrim$2((block) => `
5317
5372
  CSV parsing error
5318
5373
 
5319
5374
  Error(s) from CSV parsing:
@@ -5358,7 +5413,7 @@ const CsvFormatParser = {
5358
5413
  const { value, settings, mapCallback, onProgress } = options;
5359
5414
  const csv = csvParse(value, settings);
5360
5415
  if (csv.errors.length !== 0) {
5361
- throw new CsvFormatError(spaceTrim$1((block) => `
5416
+ throw new CsvFormatError(spaceTrim$2((block) => `
5362
5417
  CSV parsing error
5363
5418
 
5364
5419
  Error(s) from CSV parsing:
@@ -5568,7 +5623,7 @@ function mapAvailableToExpectedParameters(options) {
5568
5623
  }
5569
5624
  // Phase 2️⃣: Non-matching mapping
5570
5625
  if (expectedParameterNames.size !== availableParametersNames.size) {
5571
- throw new PipelineExecutionError(spaceTrim$1((block) => `
5626
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
5572
5627
  Can not map available parameters to expected parameters
5573
5628
 
5574
5629
  Mapped parameters:
@@ -5815,10 +5870,13 @@ const LINES_PER_STANDARD_PAGE = 44;
5815
5870
  * @public exported from `@promptbook/utils`
5816
5871
  */
5817
5872
  function countLines(text) {
5873
+ if (text === '') {
5874
+ return 0;
5875
+ }
5818
5876
  text = text.replace('\r\n', '\n');
5819
5877
  text = text.replace('\r', '\n');
5820
5878
  const lines = text.split('\n');
5821
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
5879
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5822
5880
  }
5823
5881
  /**
5824
5882
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -5943,6 +6001,8 @@ function checkExpectations(expectations, value) {
5943
6001
  * This function provides a common abstraction for result validation that can be used
5944
6002
  * by both execution logic and caching logic to ensure consistency.
5945
6003
  *
6004
+ * Note: [🔂] This function is idempotent.
6005
+ *
5946
6006
  * @param options - The validation options including result string, expectations, and format
5947
6007
  * @returns Validation result with processed string and validity status
5948
6008
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -5962,7 +6022,7 @@ function validatePromptResult(options) {
5962
6022
  }
5963
6023
  catch (error) {
5964
6024
  keepUnused(error);
5965
- throw new ExpectError(spaceTrim((block) => `
6025
+ throw new ExpectError(spaceTrim$1((block) => `
5966
6026
  Expected valid JSON string
5967
6027
 
5968
6028
  The expected JSON text:
@@ -6011,7 +6071,7 @@ function validatePromptResult(options) {
6011
6071
  */
6012
6072
  async function executeAttempts(options) {
6013
6073
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
6014
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6074
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
6015
6075
  const $ongoingTaskResult = {
6016
6076
  $result: null,
6017
6077
  $resultString: null,
@@ -6025,7 +6085,7 @@ async function executeAttempts(options) {
6025
6085
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6026
6086
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6027
6087
  if (isJokerAttempt && !jokerParameterName) {
6028
- throw new UnexpectedError(spaceTrim((block) => `
6088
+ throw new UnexpectedError(spaceTrim$1((block) => `
6029
6089
  Joker not found in attempt ${attemptIndex}
6030
6090
 
6031
6091
  ${block(pipelineIdentification)}
@@ -6036,7 +6096,7 @@ async function executeAttempts(options) {
6036
6096
  $ongoingTaskResult.$expectError = null;
6037
6097
  if (isJokerAttempt) {
6038
6098
  if (parameters[jokerParameterName] === undefined) {
6039
- throw new PipelineExecutionError(spaceTrim((block) => `
6099
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6040
6100
  Joker parameter {${jokerParameterName}} not defined
6041
6101
 
6042
6102
  ${block(pipelineIdentification)}
@@ -6094,7 +6154,7 @@ async function executeAttempts(options) {
6094
6154
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6095
6155
  break variant;
6096
6156
  case 'EMBEDDING':
6097
- throw new PipelineExecutionError(spaceTrim((block) => `
6157
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6098
6158
  Embedding model can not be used in pipeline
6099
6159
 
6100
6160
  This should be catched during parsing
@@ -6105,7 +6165,7 @@ async function executeAttempts(options) {
6105
6165
  break variant;
6106
6166
  // <- case [🤖]:
6107
6167
  default:
6108
- throw new PipelineExecutionError(spaceTrim((block) => `
6168
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6109
6169
  Unknown model variant "${task.modelRequirements.modelVariant}"
6110
6170
 
6111
6171
  ${block(pipelineIdentification)}
@@ -6116,14 +6176,14 @@ async function executeAttempts(options) {
6116
6176
  break;
6117
6177
  case 'SCRIPT_TASK':
6118
6178
  if (arrayableToArray(tools.script).length === 0) {
6119
- throw new PipelineExecutionError(spaceTrim((block) => `
6179
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6120
6180
  No script execution tools are available
6121
6181
 
6122
6182
  ${block(pipelineIdentification)}
6123
6183
  `));
6124
6184
  }
6125
6185
  if (!task.contentLanguage) {
6126
- throw new PipelineExecutionError(spaceTrim((block) => `
6186
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6127
6187
  Script language is not defined for SCRIPT TASK "${task.name}"
6128
6188
 
6129
6189
  ${block(pipelineIdentification)}
@@ -6154,7 +6214,7 @@ async function executeAttempts(options) {
6154
6214
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6155
6215
  }
6156
6216
  else {
6157
- throw new PipelineExecutionError(spaceTrim((block) => `
6217
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6158
6218
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6159
6219
 
6160
6220
  ${block(pipelineIdentification)}
@@ -6168,7 +6228,7 @@ async function executeAttempts(options) {
6168
6228
  break taskType;
6169
6229
  case 'DIALOG_TASK':
6170
6230
  if (tools.userInterface === undefined) {
6171
- throw new PipelineExecutionError(spaceTrim((block) => `
6231
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6172
6232
  User interface tools are not available
6173
6233
 
6174
6234
  ${block(pipelineIdentification)}
@@ -6186,7 +6246,7 @@ async function executeAttempts(options) {
6186
6246
  break taskType;
6187
6247
  // <- case: [🅱]
6188
6248
  default:
6189
- throw new PipelineExecutionError(spaceTrim((block) => `
6249
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6190
6250
  Unknown execution type "${task.taskType}"
6191
6251
 
6192
6252
  ${block(pipelineIdentification)}
@@ -6259,14 +6319,10 @@ async function executeAttempts(options) {
6259
6319
  });
6260
6320
  }
6261
6321
  finally {
6262
- if (!isJokerAttempt &&
6263
- task.taskType === 'PROMPT_TASK' &&
6264
- $ongoingTaskResult.$prompt
6265
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6266
- // In that case we don’t want to make a report about it because it’s not a llm execution error
6267
- ) {
6268
- // TODO: [🧠] Maybe put other taskTypes into report
6269
- $executionReport.promptExecutions.push({
6322
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6323
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6324
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6325
+ const executionPromptReport = {
6270
6326
  prompt: {
6271
6327
  ...$ongoingTaskResult.$prompt,
6272
6328
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6275,13 +6331,20 @@ async function executeAttempts(options) {
6275
6331
  error: $ongoingTaskResult.$expectError === null
6276
6332
  ? undefined
6277
6333
  : serializeError($ongoingTaskResult.$expectError),
6278
- });
6334
+ };
6335
+ $executionReport.promptExecutions.push(executionPromptReport);
6336
+ if (logLlmCall) {
6337
+ logLlmCall({
6338
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6339
+ report: executionPromptReport,
6340
+ });
6341
+ }
6279
6342
  }
6280
6343
  }
6281
6344
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6282
6345
  // Note: Create a summary of all failures
6283
6346
  const failuresSummary = $ongoingTaskResult.$failedResults
6284
- .map((failure) => spaceTrim((block) => {
6347
+ .map((failure) => spaceTrim$1((block) => {
6285
6348
  var _a, _b;
6286
6349
  return `
6287
6350
  Attempt ${failure.attemptIndex + 1}:
@@ -6291,14 +6354,14 @@ async function executeAttempts(options) {
6291
6354
  Result:
6292
6355
  ${block(failure.result === null
6293
6356
  ? 'null'
6294
- : spaceTrim(failure.result)
6357
+ : spaceTrim$1(failure.result)
6295
6358
  .split('\n')
6296
6359
  .map((line) => `> ${line}`)
6297
6360
  .join('\n'))}
6298
6361
  `;
6299
6362
  }))
6300
6363
  .join('\n\n---\n\n');
6301
- throw new PipelineExecutionError(spaceTrim((block) => {
6364
+ throw new PipelineExecutionError(spaceTrim$1((block) => {
6302
6365
  var _a;
6303
6366
  return `
6304
6367
  LLM execution failed ${maxExecutionAttempts}x
@@ -6318,7 +6381,7 @@ async function executeAttempts(options) {
6318
6381
  }
6319
6382
  }
6320
6383
  if ($ongoingTaskResult.$resultString === null) {
6321
- throw new UnexpectedError(spaceTrim((block) => `
6384
+ throw new UnexpectedError(spaceTrim$1((block) => `
6322
6385
  Something went wrong and prompt result is null
6323
6386
 
6324
6387
  ${block(pipelineIdentification)}
@@ -6340,12 +6403,12 @@ async function executeAttempts(options) {
6340
6403
  * @private internal utility of `createPipelineExecutor`
6341
6404
  */
6342
6405
  async function executeFormatSubvalues(options) {
6343
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6406
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6344
6407
  if (task.foreach === undefined) {
6345
- return /* not await */ executeAttempts(options);
6408
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6346
6409
  }
6347
6410
  if (jokerParameterNames.length !== 0) {
6348
- throw new UnexpectedError(spaceTrim$1((block) => `
6411
+ throw new UnexpectedError(spaceTrim$2((block) => `
6349
6412
  JOKER parameters are not supported together with FOREACH command
6350
6413
 
6351
6414
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6358,7 +6421,7 @@ async function executeFormatSubvalues(options) {
6358
6421
  if (formatDefinition === undefined) {
6359
6422
  throw new UnexpectedError(
6360
6423
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6361
- spaceTrim$1((block) => `
6424
+ spaceTrim$2((block) => `
6362
6425
  Unsupported format "${task.foreach.formatName}"
6363
6426
 
6364
6427
  Available formats:
@@ -6375,7 +6438,7 @@ async function executeFormatSubvalues(options) {
6375
6438
  if (subvalueParser === undefined) {
6376
6439
  throw new UnexpectedError(
6377
6440
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6378
- spaceTrim$1((block) => `
6441
+ spaceTrim$2((block) => `
6379
6442
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6380
6443
 
6381
6444
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6415,7 +6478,7 @@ async function executeFormatSubvalues(options) {
6415
6478
  if (!(error instanceof PipelineExecutionError)) {
6416
6479
  throw error;
6417
6480
  }
6418
- const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6481
+ const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6419
6482
  ${error.message}
6420
6483
 
6421
6484
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6439,7 +6502,7 @@ async function executeFormatSubvalues(options) {
6439
6502
  ...options,
6440
6503
  priority: priority + index,
6441
6504
  parameters: allSubparameters,
6442
- pipelineIdentification: spaceTrim$1((block) => `
6505
+ pipelineIdentification: spaceTrim$2((block) => `
6443
6506
  ${block(pipelineIdentification)}
6444
6507
  Subparameter index: ${index}
6445
6508
  `),
@@ -6448,7 +6511,7 @@ async function executeFormatSubvalues(options) {
6448
6511
  }
6449
6512
  catch (error) {
6450
6513
  if (length > BIG_DATASET_TRESHOLD) {
6451
- console.error(spaceTrim$1((block) => `
6514
+ console.error(spaceTrim$2((block) => `
6452
6515
  ${error.message}
6453
6516
 
6454
6517
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6548,7 +6611,7 @@ async function getKnowledgeForTask(options) {
6548
6611
  },
6549
6612
  content: task.content,
6550
6613
  parameters,
6551
- };
6614
+ }; /* <- Note: [🤛] */
6552
6615
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6553
6616
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6554
6617
  const { index } = knowledgePiece;
@@ -6624,7 +6687,7 @@ async function getReservedParametersForTask(options) {
6624
6687
  // Note: Doublecheck that ALL reserved parameters are defined:
6625
6688
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6626
6689
  if (reservedParameters[parameterName] === undefined) {
6627
- throw new UnexpectedError(spaceTrim((block) => `
6690
+ throw new UnexpectedError(spaceTrim$1((block) => `
6628
6691
  Reserved parameter {${parameterName}} is not defined
6629
6692
 
6630
6693
  ${block(pipelineIdentification)}
@@ -6643,14 +6706,14 @@ async function getReservedParametersForTask(options) {
6643
6706
  * @private internal utility of `createPipelineExecutor`
6644
6707
  */
6645
6708
  async function executeTask(options) {
6646
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6709
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6647
6710
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6648
6711
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6649
6712
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
6650
6713
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6651
6714
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6652
6715
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6653
- throw new UnexpectedError(spaceTrim((block) => `
6716
+ throw new UnexpectedError(spaceTrim$1((block) => `
6654
6717
  Dependent parameters are not consistent with used parameters:
6655
6718
 
6656
6719
  Dependent parameters:
@@ -6694,7 +6757,7 @@ async function executeTask(options) {
6694
6757
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6695
6758
  // Houston, we have a problem
6696
6759
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6697
- throw new UnexpectedError(spaceTrim((block) => `
6760
+ throw new UnexpectedError(spaceTrim$1((block) => `
6698
6761
  Parameter \`{${parameterName}}\` is NOT defined
6699
6762
  BUT used in task "${currentTask.title || currentTask.name}"
6700
6763
 
@@ -6722,6 +6785,7 @@ async function executeTask(options) {
6722
6785
  tools,
6723
6786
  $executionReport,
6724
6787
  onProgress,
6788
+ logLlmCall,
6725
6789
  pipelineIdentification,
6726
6790
  maxExecutionAttempts,
6727
6791
  maxParallelCount,
@@ -6762,9 +6826,32 @@ function filterJustOutputParameters(options) {
6762
6826
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6763
6827
  if (parametersToPass[parameter.name] === undefined) {
6764
6828
  // [4]
6765
- $warnings.push(new PipelineExecutionError(spaceTrim((block) => `
6829
+ $warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6766
6830
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6767
6831
 
6832
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6833
+
6834
+ All parameters:
6835
+ ${block(preparedPipeline.parameters
6836
+ .map(({ name, isInput, isOutput, description }) => {
6837
+ let line = `\`{${name}}\``;
6838
+ if (isInput) {
6839
+ line += ' `[input parameter]`';
6840
+ }
6841
+ if (isOutput) {
6842
+ line += ' `[output parameter]`';
6843
+ }
6844
+ if (parametersToPass[name] === undefined) {
6845
+ line += ` <- Warning: Should be in the output but its not |`;
6846
+ }
6847
+ if (description) {
6848
+ line += ` ${description}`;
6849
+ }
6850
+ return line;
6851
+ })
6852
+ .map((line, index) => `${index + 1}) ${line}`)
6853
+ .join('\n'))}
6854
+
6768
6855
  ${block(pipelineIdentification)}
6769
6856
  `)));
6770
6857
  continue;
@@ -6785,7 +6872,7 @@ function filterJustOutputParameters(options) {
6785
6872
  * @private internal utility of `createPipelineExecutor`
6786
6873
  */
6787
6874
  async function executePipeline(options) {
6788
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6875
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6789
6876
  let { preparedPipeline } = options;
6790
6877
  if (preparedPipeline === undefined) {
6791
6878
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6847,7 +6934,7 @@ async function executePipeline(options) {
6847
6934
  for (const parameterName of Object.keys(inputParameters)) {
6848
6935
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6849
6936
  if (parameter === undefined) {
6850
- warnings.push(new PipelineExecutionError(spaceTrim((block) => `
6937
+ warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6851
6938
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6852
6939
 
6853
6940
  ${block(pipelineIdentification)}
@@ -6862,7 +6949,7 @@ async function executePipeline(options) {
6862
6949
  // TODO: [🧠] This should be also non-critical error
6863
6950
  return exportJson({
6864
6951
  name: 'pipelineExecutorResult',
6865
- message: spaceTrim((block) => `
6952
+ message: spaceTrim$1((block) => `
6866
6953
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6867
6954
 
6868
6955
  ${block(pipelineIdentification)}
@@ -6871,7 +6958,7 @@ async function executePipeline(options) {
6871
6958
  value: {
6872
6959
  isSuccessful: false,
6873
6960
  errors: [
6874
- new PipelineExecutionError(spaceTrim((block) => `
6961
+ new PipelineExecutionError(spaceTrim$1((block) => `
6875
6962
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6876
6963
 
6877
6964
  ${block(pipelineIdentification)}
@@ -6898,7 +6985,7 @@ async function executePipeline(options) {
6898
6985
  while (unresovedTasks.length > 0) {
6899
6986
  if (loopLimit-- < 0) {
6900
6987
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
6901
- throw new UnexpectedError(spaceTrim((block) => `
6988
+ throw new UnexpectedError(spaceTrim$1((block) => `
6902
6989
  Loop limit reached during resolving parameters pipeline execution
6903
6990
 
6904
6991
  ${block(pipelineIdentification)}
@@ -6908,7 +6995,7 @@ async function executePipeline(options) {
6908
6995
  if (!currentTask && resolving.length === 0) {
6909
6996
  throw new UnexpectedError(
6910
6997
  // TODO: [🐎] DRY
6911
- spaceTrim((block) => `
6998
+ spaceTrim$1((block) => `
6912
6999
  Can not resolve some parameters:
6913
7000
 
6914
7001
  ${block(pipelineIdentification)}
@@ -6948,7 +7035,7 @@ async function executePipeline(options) {
6948
7035
  tools,
6949
7036
  onProgress(newOngoingResult) {
6950
7037
  if (isReturned) {
6951
- throw new UnexpectedError(spaceTrim((block) => `
7038
+ throw new UnexpectedError(spaceTrim$1((block) => `
6952
7039
  Can not call \`onProgress\` after pipeline execution is finished
6953
7040
 
6954
7041
  ${block(pipelineIdentification)}
@@ -6963,8 +7050,9 @@ async function executePipeline(options) {
6963
7050
  onProgress(newOngoingResult);
6964
7051
  }
6965
7052
  },
7053
+ logLlmCall,
6966
7054
  $executionReport: executionReport,
6967
- pipelineIdentification: spaceTrim((block) => `
7055
+ pipelineIdentification: spaceTrim$1((block) => `
6968
7056
  ${block(pipelineIdentification)}
6969
7057
  Task name: ${currentTask.name}
6970
7058
  Task title: ${currentTask.title}
@@ -7073,7 +7161,7 @@ function createPipelineExecutor(options) {
7073
7161
  preparedPipeline = pipeline;
7074
7162
  }
7075
7163
  else if (isNotPreparedWarningSuppressed !== true) {
7076
- console.warn(spaceTrim((block) => `
7164
+ console.warn(spaceTrim$1((block) => `
7077
7165
  Pipeline is not prepared
7078
7166
 
7079
7167
  ${block(pipelineIdentification)}
@@ -7086,7 +7174,7 @@ function createPipelineExecutor(options) {
7086
7174
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7087
7175
  }
7088
7176
  let runCount = 0;
7089
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7177
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7090
7178
  runCount++;
7091
7179
  return /* not await */ executePipeline({
7092
7180
  pipeline,
@@ -7097,7 +7185,8 @@ function createPipelineExecutor(options) {
7097
7185
  inputParameters,
7098
7186
  tools,
7099
7187
  onProgress,
7100
- pipelineIdentification: spaceTrim((block) => `
7188
+ logLlmCall,
7189
+ pipelineIdentification: spaceTrim$1((block) => `
7101
7190
  ${block(pipelineIdentification)}
7102
7191
  ${runCount === 1 ? '' : `Run #${runCount}`}
7103
7192
  `),
@@ -7258,7 +7347,7 @@ class MarkdownScraper {
7258
7347
  }
7259
7348
  const llmTools = getSingleLlmExecutionTools(llm);
7260
7349
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7261
- const collection = createCollectionFromJson(...PipelineCollection);
7350
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7262
7351
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7263
7352
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7264
7353
  tools: {
@@ -7294,8 +7383,8 @@ class MarkdownScraper {
7294
7383
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7295
7384
  // Note: These are just default values, they will be overwritten by the actual values:
7296
7385
  let name = `piece-${i}`;
7297
- let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
7298
- const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
7386
+ let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7387
+ const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7299
7388
  let keywords = [];
7300
7389
  const index = [];
7301
7390
  /*
@@ -7308,7 +7397,7 @@ class MarkdownScraper {
7308
7397
  isCrashedOnError: true,
7309
7398
  });
7310
7399
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7311
- title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
7400
+ title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7312
7401
  name = titleToName(title);
7313
7402
  // --- Keywords
7314
7403
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({