@promptbook/documents 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 +320 -231
  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 +288 -199
  258. package/umd/index.umd.js.map +1 -1
  259. package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
  260. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
  261. package/esm/typings/src/book-components/BookEditor/BookEditorWrapper.d.ts +0 -9
  262. package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
  263. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
  264. package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
  265. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  266. /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
  267. /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
  268. /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
  269. /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
  270. /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
  271. /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
  272. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
  273. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -1,12 +1,12 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('child_process'), require('colors'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'child_process', 'colors', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
5
- })(this, (function (exports, promises, spaceTrim, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim$1, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
5
+ })(this, (function (exports, promises, spaceTrim$1, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
9
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
10
10
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
11
11
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
12
12
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
@@ -18,14 +18,14 @@
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/book
20
20
  */
21
- const BOOK_LANGUAGE_VERSION = '1.0.0';
21
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
22
22
  /**
23
23
  * The version of the Promptbook engine
24
24
  *
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-9';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -48,6 +48,17 @@
48
48
  function keepUnused(...valuesToKeep) {
49
49
  }
50
50
 
51
+ /**
52
+ * Trims string from all 4 sides
53
+ *
54
+ * Note: This is a re-exported function from the `spacetrim` package which is
55
+ * Developed by same author @hejny as this package
56
+ *
57
+ * @public exported from `@promptbook/utils`
58
+ * @see https://github.com/hejny/spacetrim#usage
59
+ */
60
+ const spaceTrim = spaceTrim$1.spaceTrim;
61
+
51
62
  /**
52
63
  * @private util of `@promptbook/color`
53
64
  * @de
@@ -96,6 +107,7 @@
96
107
  * @public exported from `@promptbook/color`
97
108
  */
98
109
  const CSS_COLORS = {
110
+ promptbook: '#79EAFD',
99
111
  transparent: 'rgba(0,0,0,0)',
100
112
  aliceblue: '#f0f8ff',
101
113
  antiquewhite: '#faebd7',
@@ -277,9 +289,6 @@
277
289
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
278
290
  }
279
291
  }
280
- /**
281
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
282
- */
283
292
 
284
293
  /**
285
294
  * Color object represents an RGB color with alpha channel
@@ -299,21 +308,61 @@
299
308
  * @param color
300
309
  * @returns Color object
301
310
  */
302
- static from(color) {
303
- if (color instanceof Color) {
311
+ static from(color, _isSingleValue = false) {
312
+ if (color === '') {
313
+ throw new Error(`Can not create color from empty string`);
314
+ }
315
+ else if (color instanceof Color) {
304
316
  return take(color);
305
317
  }
306
318
  else if (Color.isColor(color)) {
307
319
  return take(color);
308
320
  }
309
321
  else if (typeof color === 'string') {
310
- return Color.fromString(color);
322
+ try {
323
+ return Color.fromString(color);
324
+ }
325
+ catch (error) {
326
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
327
+ if (_isSingleValue) {
328
+ throw error;
329
+ }
330
+ const parts = color.split(/[\s+,;|]/);
331
+ if (parts.length > 0) {
332
+ return Color.from(parts[0].trim(), true);
333
+ }
334
+ else {
335
+ throw new Error(`Can not create color from given string "${color}"`);
336
+ }
337
+ }
311
338
  }
312
339
  else {
313
340
  console.error({ color });
314
341
  throw new Error(`Can not create color from given object`);
315
342
  }
316
343
  }
344
+ /**
345
+ * Creates a new Color instance from miscellaneous formats
346
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
347
+ *
348
+ * @param color
349
+ * @returns Color object
350
+ */
351
+ static fromSafe(color) {
352
+ try {
353
+ return Color.from(color);
354
+ }
355
+ catch (error) {
356
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
357
+ console.warn(spaceTrim((block) => `
358
+ Color.fromSafe error:
359
+ ${block(error.message)}
360
+
361
+ Returning default PROMPTBOOK_COLOR.
362
+ `));
363
+ return Color.fromString('promptbook');
364
+ }
365
+ }
317
366
  /**
318
367
  * Creates a new Color instance from miscellaneous string formats
319
368
  *
@@ -381,6 +430,9 @@
381
430
  if (hex.length === 3) {
382
431
  return Color.fromHex3(hex);
383
432
  }
433
+ if (hex.length === 4) {
434
+ return Color.fromHex4(hex);
435
+ }
384
436
  if (hex.length === 6) {
385
437
  return Color.fromHex6(hex);
386
438
  }
@@ -401,6 +453,19 @@
401
453
  const b = parseInt(hex.substr(2, 1), 16) * 16;
402
454
  return take(new Color(r, g, b));
403
455
  }
456
+ /**
457
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
458
+ *
459
+ * @param color in hex for example `09df`
460
+ * @returns Color object
461
+ */
462
+ static fromHex4(hex) {
463
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
464
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
465
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
466
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
467
+ return take(new Color(r, g, b, a));
468
+ }
404
469
  /**
405
470
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
406
471
  *
@@ -591,7 +656,8 @@
591
656
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
592
657
  */
593
658
  static isHexColorString(value) {
594
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
659
+ return (typeof value === 'string' &&
660
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
595
661
  }
596
662
  /**
597
663
  * Creates new Color object
@@ -706,6 +772,23 @@
706
772
  * TODO: Maybe connect with textures
707
773
  */
708
774
 
775
+ /**
776
+ * Makes color transformer which returns a grayscale version of the color
777
+ *
778
+ * @param amount from 0 to 1
779
+ *
780
+ * @public exported from `@promptbook/color`
781
+ */
782
+ function grayscale(amount) {
783
+ return ({ red, green, blue, alpha }) => {
784
+ const average = (red + green + blue) / 3;
785
+ red = Math.round(average * amount + red * (1 - amount));
786
+ green = Math.round(average * amount + green * (1 - amount));
787
+ blue = Math.round(average * amount + blue * (1 - amount));
788
+ return Color.fromValues(red, green, blue, alpha);
789
+ };
790
+ }
791
+
709
792
  /**
710
793
  * Converts HSL values to RGB values
711
794
  *
@@ -821,102 +904,6 @@
821
904
  * TODO: Maybe implement by mix+hsl
822
905
  */
823
906
 
824
- /**
825
- * Calculates distance between two colors
826
- *
827
- * @param color1 first color
828
- * @param color2 second color
829
- *
830
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
831
- *
832
- * @public exported from `@promptbook/color`
833
- */
834
- /**
835
- * Calculates distance between two colors without square root
836
- *
837
- * @param color1 first color
838
- * @param color2 second color
839
- *
840
- * @public exported from `@promptbook/color`
841
- */
842
- function colorDistanceSquared(color1, color2) {
843
- const rmean = (color1.red + color2.red) / 2;
844
- const r = color1.red - color2.red;
845
- const g = color1.green - color2.green;
846
- const b = color1.blue - color2.blue;
847
- const weightR = 2 + rmean / 256;
848
- const weightG = 4.0;
849
- const weightB = 2 + (255 - rmean) / 256;
850
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
851
- return distance;
852
- }
853
-
854
- /**
855
- * Makes color transformer which finds the nearest color from the given list
856
- *
857
- * @param colors array of colors to choose from
858
- *
859
- * @public exported from `@promptbook/color`
860
- */
861
- function nearest(...colors) {
862
- return (color) => {
863
- const distances = colors.map((c) => colorDistanceSquared(c, color));
864
- const minDistance = Math.min(...distances);
865
- const minIndex = distances.indexOf(minDistance);
866
- const nearestColor = colors[minIndex];
867
- return nearestColor;
868
- };
869
- }
870
-
871
- /**
872
- * Color transformer which returns the negative color
873
- *
874
- * @public exported from `@promptbook/color`
875
- */
876
- function negative(color) {
877
- const r = 255 - color.red;
878
- const g = 255 - color.green;
879
- const b = 255 - color.blue;
880
- return Color.fromValues(r, g, b, color.alpha);
881
- }
882
-
883
- /**
884
- * Makes color transformer which finds the furthest 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 furthest(...colors) {
891
- return (color) => {
892
- const furthestColor = negative(nearest(...colors.map(negative))(color));
893
- return furthestColor;
894
- };
895
- }
896
- /**
897
- * Makes color transformer which finds the best text color (black or white) for the given background color
898
- *
899
- * @public exported from `@promptbook/color`
900
- */
901
- furthest(Color.get('white'), Color.from('black'));
902
-
903
- /**
904
- * Makes color transformer which returns a grayscale version of the color
905
- *
906
- * @param amount from 0 to 1
907
- *
908
- * @public exported from `@promptbook/color`
909
- */
910
- function grayscale(amount) {
911
- return ({ red, green, blue, alpha }) => {
912
- const average = (red + green + blue) / 3;
913
- red = Math.round(average * amount + red * (1 - amount));
914
- green = Math.round(average * amount + green * (1 - amount));
915
- blue = Math.round(average * amount + blue * (1 - amount));
916
- return Color.fromValues(red, green, blue, alpha);
917
- };
918
- }
919
-
920
907
  /**
921
908
  * Makes color transformer which saturate the given color
922
909
  *
@@ -985,16 +972,32 @@
985
972
  *
986
973
  * @public exported from `@promptbook/core`
987
974
  */
988
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
989
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
975
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
976
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
990
977
  /**
991
- * Dark color of the Promptbook
978
+ * Colors for syntax highlighting in the `<BookEditor/>`
979
+ *
980
+ * TODO: [🗽] Unite branding and make single place for it
981
+ *
982
+ * @public exported from `@promptbook/core`
983
+ */
984
+ ({
985
+ TITLE: Color.fromHex('#244EA8'),
986
+ LINE: Color.fromHex('#eeeeee'),
987
+ SEPARATOR: Color.fromHex('#cccccc'),
988
+ COMMITMENT: Color.fromHex('#DA0F78'),
989
+ PARAMETER: Color.fromHex('#8e44ad'),
990
+ });
991
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
992
+ /**
993
+ * Chat color of the Promptbook (in chat)
992
994
  *
993
995
  * TODO: [🗽] Unite branding and make single place for it
994
996
  *
995
997
  * @public exported from `@promptbook/core`
996
998
  */
997
999
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1000
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
998
1001
  /**
999
1002
  * Color of the user (in chat)
1000
1003
  *
@@ -1003,6 +1006,7 @@
1003
1006
  * @public exported from `@promptbook/core`
1004
1007
  */
1005
1008
  Color.fromHex('#1D4ED8');
1009
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1006
1010
  /**
1007
1011
  * When the title is not provided, the default title is used
1008
1012
  *
@@ -1089,7 +1093,7 @@
1089
1093
  * @public exported from `@promptbook/core`
1090
1094
  */
1091
1095
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1092
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1096
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1093
1097
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1094
1098
  /**
1095
1099
  * Where to store the temporary downloads
@@ -1191,7 +1195,7 @@
1191
1195
  */
1192
1196
  class MissingToolsError extends Error {
1193
1197
  constructor(message) {
1194
- super(spaceTrim.spaceTrim((block) => `
1198
+ super(spaceTrim$1.spaceTrim((block) => `
1195
1199
  ${block(message)}
1196
1200
 
1197
1201
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -1253,7 +1257,7 @@
1253
1257
  */
1254
1258
  class UnexpectedError extends Error {
1255
1259
  constructor(message) {
1256
- super(spaceTrim.spaceTrim((block) => `
1260
+ super(spaceTrim$1.spaceTrim((block) => `
1257
1261
  ${block(message)}
1258
1262
 
1259
1263
  Note: This error should not happen.
@@ -1414,11 +1418,11 @@
1414
1418
  console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
1415
1419
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
1416
1420
  }
1417
- resolve(spaceTrim.spaceTrim(output.join('\n')));
1421
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
1418
1422
  }
1419
1423
  }
1420
1424
  else {
1421
- resolve(spaceTrim.spaceTrim(output.join('\n')));
1425
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
1422
1426
  }
1423
1427
  };
1424
1428
  commandProcess.on('close', finishWithCode);
@@ -1436,7 +1440,7 @@
1436
1440
  console.warn(error);
1437
1441
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
1438
1442
  }
1439
- resolve(spaceTrim.spaceTrim(output.join('\n')));
1443
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
1440
1444
  }
1441
1445
  });
1442
1446
  }
@@ -1761,6 +1765,8 @@
1761
1765
  /**
1762
1766
  * Converts a given text to kebab-case format.
1763
1767
  *
1768
+ * Note: [🔂] This function is idempotent.
1769
+ *
1764
1770
  * @param text The text to be converted.
1765
1771
  * @returns The kebab-case formatted string.
1766
1772
  * @example 'hello-world'
@@ -1916,6 +1922,8 @@
1916
1922
  /**
1917
1923
  * Converts a title string into a normalized name.
1918
1924
  *
1925
+ * Note: [🔂] This function is idempotent.
1926
+ *
1919
1927
  * @param value The title string to be converted to a name.
1920
1928
  * @returns A normalized name derived from the input title.
1921
1929
  * @example 'Hello World!' -> 'hello-world'
@@ -2007,7 +2015,7 @@
2007
2015
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2008
2016
  */
2009
2017
 
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"},{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"}];
2018
+ 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"}];
2011
2019
 
2012
2020
  /**
2013
2021
  * Checks if value is valid email
@@ -2049,7 +2057,7 @@
2049
2057
  constructor(whatWasThrown) {
2050
2058
  const tag = `[🤮]`;
2051
2059
  console.error(tag, whatWasThrown);
2052
- super(spaceTrim.spaceTrim(`
2060
+ super(spaceTrim$1.spaceTrim(`
2053
2061
  Non-Error object was thrown
2054
2062
 
2055
2063
  Note: Look for ${tag} in the console for more details
@@ -2114,6 +2122,8 @@
2114
2122
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
2115
2123
  * 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.
2116
2124
  *
2125
+ * Note: [🔂] This function is idempotent.
2126
+ *
2117
2127
  * @param {string} pipelineString the candidate for a pipeline string
2118
2128
  * @returns {PipelineString} the same string as input, but validated as valid
2119
2129
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2498,7 +2508,7 @@
2498
2508
  TODO: [🧠] Is there a better implementation?
2499
2509
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
2500
2510
  > for (const propertyName of propertyNames) {
2501
- > const value = (objectValue as really_any)[propertyName];
2511
+ > const value = (objectValue as chococake)[propertyName];
2502
2512
  > if (value && typeof value === 'object') {
2503
2513
  > deepClone(value);
2504
2514
  > }
@@ -2703,6 +2713,8 @@
2703
2713
  * - if it is valid json
2704
2714
  * - if it is meaningful
2705
2715
  *
2716
+ * Note: [🔂] This function is idempotent.
2717
+ *
2706
2718
  * @param pipeline valid or invalid PipelineJson
2707
2719
  * @returns the same pipeline if it is logically valid
2708
2720
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -2720,7 +2732,7 @@
2720
2732
  if (!(error instanceof PipelineLogicError)) {
2721
2733
  throw error;
2722
2734
  }
2723
- console.error(spaceTrim.spaceTrim((block) => `
2735
+ console.error(spaceTrim$1.spaceTrim((block) => `
2724
2736
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2725
2737
 
2726
2738
  ${block(error.message)}
@@ -2747,7 +2759,7 @@
2747
2759
  })();
2748
2760
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2749
2761
  // <- Note: [🚲]
2750
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2762
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2751
2763
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2752
2764
 
2753
2765
  ${block(pipelineIdentification)}
@@ -2755,7 +2767,7 @@
2755
2767
  }
2756
2768
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2757
2769
  // <- Note: [🚲]
2758
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2770
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2759
2771
  Invalid Promptbook Version "${pipeline.bookVersion}"
2760
2772
 
2761
2773
  ${block(pipelineIdentification)}
@@ -2764,7 +2776,7 @@
2764
2776
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2765
2777
  if (!Array.isArray(pipeline.parameters)) {
2766
2778
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2767
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2779
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2768
2780
  Pipeline is valid JSON but with wrong structure
2769
2781
 
2770
2782
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2775,7 +2787,7 @@
2775
2787
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2776
2788
  if (!Array.isArray(pipeline.tasks)) {
2777
2789
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2778
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2790
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2779
2791
  Pipeline is valid JSON but with wrong structure
2780
2792
 
2781
2793
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2801,7 +2813,7 @@
2801
2813
  // Note: Check each parameter individually
2802
2814
  for (const parameter of pipeline.parameters) {
2803
2815
  if (parameter.isInput && parameter.isOutput) {
2804
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2816
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2805
2817
 
2806
2818
  Parameter \`{${parameter.name}}\` can not be both input and output
2807
2819
 
@@ -2812,7 +2824,7 @@
2812
2824
  if (!parameter.isInput &&
2813
2825
  !parameter.isOutput &&
2814
2826
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2815
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2827
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2816
2828
  Parameter \`{${parameter.name}}\` is created but not used
2817
2829
 
2818
2830
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2824,7 +2836,7 @@
2824
2836
  }
2825
2837
  // Note: Testing that parameter is either input or result of some task
2826
2838
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2827
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2839
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2828
2840
  Parameter \`{${parameter.name}}\` is declared but not defined
2829
2841
 
2830
2842
  You can do one of these:
@@ -2840,14 +2852,14 @@
2840
2852
  // Note: Checking each task individually
2841
2853
  for (const task of pipeline.tasks) {
2842
2854
  if (definedParameters.has(task.resultingParameterName)) {
2843
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2855
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2844
2856
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2845
2857
 
2846
2858
  ${block(pipelineIdentification)}
2847
2859
  `));
2848
2860
  }
2849
2861
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2850
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2862
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2851
2863
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2852
2864
 
2853
2865
  ${block(pipelineIdentification)}
@@ -2857,7 +2869,7 @@
2857
2869
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2858
2870
  if (!task.format &&
2859
2871
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2860
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2872
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2861
2873
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2862
2874
 
2863
2875
  ${block(pipelineIdentification)}
@@ -2865,7 +2877,7 @@
2865
2877
  }
2866
2878
  for (const joker of task.jokerParameterNames) {
2867
2879
  if (!task.dependentParameterNames.includes(joker)) {
2868
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2880
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2869
2881
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2870
2882
 
2871
2883
  ${block(pipelineIdentification)}
@@ -2876,21 +2888,21 @@
2876
2888
  if (task.expectations) {
2877
2889
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2878
2890
  if (min !== undefined && max !== undefined && min > max) {
2879
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2891
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2880
2892
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2881
2893
 
2882
2894
  ${block(pipelineIdentification)}
2883
2895
  `));
2884
2896
  }
2885
2897
  if (min !== undefined && min < 0) {
2886
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2898
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2887
2899
  Min expectation of ${unit} must be zero or positive
2888
2900
 
2889
2901
  ${block(pipelineIdentification)}
2890
2902
  `));
2891
2903
  }
2892
2904
  if (max !== undefined && max <= 0) {
2893
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2905
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2894
2906
  Max expectation of ${unit} must be positive
2895
2907
 
2896
2908
  ${block(pipelineIdentification)}
@@ -2912,7 +2924,7 @@
2912
2924
  while (unresovedTasks.length > 0) {
2913
2925
  if (loopLimit-- < 0) {
2914
2926
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2915
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2927
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2916
2928
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2917
2929
 
2918
2930
  ${block(pipelineIdentification)}
@@ -2922,7 +2934,7 @@
2922
2934
  if (currentlyResovedTasks.length === 0) {
2923
2935
  throw new PipelineLogicError(
2924
2936
  // TODO: [🐎] DRY
2925
- spaceTrim.spaceTrim((block) => `
2937
+ spaceTrim$1.spaceTrim((block) => `
2926
2938
 
2927
2939
  Can not resolve some parameters:
2928
2940
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -3069,7 +3081,7 @@
3069
3081
  * Library of pipelines that groups together pipelines for an application.
3070
3082
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
3071
3083
  *
3072
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
3084
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
3073
3085
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
3074
3086
  */
3075
3087
  class SimplePipelineCollection {
@@ -3079,14 +3091,14 @@
3079
3091
  * @param pipelines Array of pipeline JSON objects to include in the collection
3080
3092
  *
3081
3093
  * Note: During the construction logic of all pipelines are validated
3082
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
3094
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
3083
3095
  */
3084
3096
  constructor(...pipelines) {
3085
3097
  this.collection = new Map();
3086
3098
  for (const pipeline of pipelines) {
3087
3099
  // TODO: [👠] DRY
3088
3100
  if (pipeline.pipelineUrl === undefined) {
3089
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
3101
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
3090
3102
  Pipeline with name "${pipeline.title}" does not have defined URL
3091
3103
 
3092
3104
  File:
@@ -3108,7 +3120,7 @@
3108
3120
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
3109
3121
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
3110
3122
  const existing = this.collection.get(pipeline.pipelineUrl);
3111
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
3123
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
3112
3124
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
3113
3125
 
3114
3126
  Conflicting files:
@@ -3140,13 +3152,13 @@
3140
3152
  const pipeline = this.collection.get(url);
3141
3153
  if (!pipeline) {
3142
3154
  if (this.listPipelines().length === 0) {
3143
- throw new NotFoundError(spaceTrim.spaceTrim(`
3155
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
3144
3156
  Pipeline with url "${url}" not found
3145
3157
 
3146
3158
  No pipelines available
3147
3159
  `));
3148
3160
  }
3149
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
3161
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
3150
3162
  Pipeline with url "${url}" not found
3151
3163
 
3152
3164
  Available pipelines:
@@ -3167,22 +3179,23 @@
3167
3179
  }
3168
3180
 
3169
3181
  /**
3170
- * Creates PipelineCollection from array of PipelineJson or PipelineString
3182
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
3171
3183
  *
3172
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
3184
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
3173
3185
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
3174
3186
  *
3175
3187
  * @param promptbookSources
3176
3188
  * @returns PipelineCollection
3177
3189
  * @public exported from `@promptbook/core`
3178
3190
  */
3179
- function createCollectionFromJson(...promptbooks) {
3191
+ function createPipelineCollectionFromJson(...promptbooks) {
3180
3192
  return new SimplePipelineCollection(...promptbooks);
3181
3193
  }
3182
3194
 
3183
3195
  /**
3184
3196
  * Generates random token
3185
3197
  *
3198
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
3186
3199
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
3187
3200
  *
3188
3201
  * @private internal helper function
@@ -3192,6 +3205,7 @@
3192
3205
  return crypto.randomBytes(randomness).toString('hex');
3193
3206
  }
3194
3207
  /**
3208
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
3195
3209
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
3196
3210
  */
3197
3211
 
@@ -3310,6 +3324,22 @@
3310
3324
  }
3311
3325
  }
3312
3326
 
3327
+ /**
3328
+ * This error indicates error from the database
3329
+ *
3330
+ * @public exported from `@promptbook/core`
3331
+ */
3332
+ class DatabaseError extends Error {
3333
+ constructor(message) {
3334
+ super(message);
3335
+ this.name = 'DatabaseError';
3336
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3337
+ }
3338
+ }
3339
+ /**
3340
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
3341
+ */
3342
+
3313
3343
  /**
3314
3344
  * This error occurs when some expectation is not met in the execution of the pipeline
3315
3345
  *
@@ -3339,6 +3369,19 @@
3339
3369
  }
3340
3370
  }
3341
3371
 
3372
+ /**
3373
+ * This error indicates that promptbook operation is not allowed
3374
+ *
3375
+ * @public exported from `@promptbook/core`
3376
+ */
3377
+ class NotAllowed extends Error {
3378
+ constructor(message) {
3379
+ super(message);
3380
+ this.name = 'NotAllowed';
3381
+ Object.setPrototypeOf(this, NotAllowed.prototype);
3382
+ }
3383
+ }
3384
+
3342
3385
  /**
3343
3386
  * This error type indicates that some part of the code is not implemented yet
3344
3387
  *
@@ -3346,7 +3389,7 @@
3346
3389
  */
3347
3390
  class NotYetImplementedError extends Error {
3348
3391
  constructor(message) {
3349
- super(spaceTrim.spaceTrim((block) => `
3392
+ super(spaceTrim$1.spaceTrim((block) => `
3350
3393
  ${block(message)}
3351
3394
 
3352
3395
  Note: This feature is not implemented yet but it will be soon.
@@ -3399,6 +3442,8 @@
3399
3442
  PromptbookFetchError,
3400
3443
  UnexpectedError,
3401
3444
  WrappedError,
3445
+ NotAllowed,
3446
+ DatabaseError,
3402
3447
  // TODO: [🪑]> VersionMismatchError,
3403
3448
  };
3404
3449
  /**
@@ -3583,11 +3628,11 @@
3583
3628
  throw deserializeError(errors[0]);
3584
3629
  }
3585
3630
  else {
3586
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3631
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
3587
3632
  Multiple errors occurred during Promptbook execution
3588
3633
 
3589
3634
  ${block(errors
3590
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3635
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
3591
3636
  ${name} ${index + 1}:
3592
3637
  ${block(stack || message)}
3593
3638
  `))
@@ -3614,6 +3659,7 @@
3614
3659
  let updatedAt = createdAt;
3615
3660
  const errors = [];
3616
3661
  const warnings = [];
3662
+ const llmCalls = [];
3617
3663
  let currentValue = {};
3618
3664
  let customTldr = null;
3619
3665
  const partialResultSubject = new rxjs.Subject();
@@ -3629,6 +3675,9 @@
3629
3675
  }, (tldrInfo) => {
3630
3676
  customTldr = tldrInfo;
3631
3677
  updatedAt = new Date();
3678
+ }, (llmCall) => {
3679
+ llmCalls.push(llmCall);
3680
+ updatedAt = new Date();
3632
3681
  });
3633
3682
  finalResultPromise
3634
3683
  .catch((error) => {
@@ -3751,7 +3800,7 @@
3751
3800
  }
3752
3801
  return {
3753
3802
  percent: percent,
3754
- message,
3803
+ message: message + ' (!!!fallback)',
3755
3804
  };
3756
3805
  },
3757
3806
  get createdAt() {
@@ -3774,6 +3823,10 @@
3774
3823
  return warnings;
3775
3824
  // <- Note: [1] --||--
3776
3825
  },
3826
+ get llmCalls() {
3827
+ return [...llmCalls, { foo: '!!! bar' }];
3828
+ // <- Note: [1] --||--
3829
+ },
3777
3830
  get currentValue() {
3778
3831
  return currentValue;
3779
3832
  // <- Note: [1] --||--
@@ -4227,6 +4280,7 @@
4227
4280
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4228
4281
  }
4229
4282
  /**
4283
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4230
4284
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4231
4285
  */
4232
4286
 
@@ -4243,6 +4297,7 @@
4243
4297
  return llmTools;
4244
4298
  }
4245
4299
  /**
4300
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4246
4301
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4247
4302
  */
4248
4303
 
@@ -4258,7 +4313,7 @@
4258
4313
  throw new MissingToolsError('LLM tools are required for preparing persona');
4259
4314
  }
4260
4315
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
4261
- const collection = createCollectionFromJson(...PipelineCollection);
4316
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
4262
4317
  const preparePersonaExecutor = createPipelineExecutor({
4263
4318
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
4264
4319
  tools,
@@ -4966,7 +5021,7 @@
4966
5021
  if (task.taskType === 'PROMPT_TASK' &&
4967
5022
  knowledgePiecesCount > 0 &&
4968
5023
  !dependentParameterNames.includes('knowledge')) {
4969
- preparedContent = spaceTrim.spaceTrim(`
5024
+ preparedContent = spaceTrim$1.spaceTrim(`
4970
5025
  {content}
4971
5026
 
4972
5027
  ## Knowledge
@@ -5052,7 +5107,7 @@
5052
5107
  let title = pipeline.title;
5053
5108
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
5054
5109
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
5055
- const collection = createCollectionFromJson(...PipelineCollection);
5110
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
5056
5111
  const prepareTitleExecutor = createPipelineExecutor({
5057
5112
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
5058
5113
  tools,
@@ -5279,7 +5334,7 @@
5279
5334
  }
5280
5335
  catch (error) {
5281
5336
  assertsError(error);
5282
- throw new ParseError(spaceTrim.spaceTrim((block) => `
5337
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5283
5338
  Can not extract variables from the script
5284
5339
  ${block(error.stack || error.message)}
5285
5340
 
@@ -5964,10 +6019,13 @@
5964
6019
  * @public exported from `@promptbook/utils`
5965
6020
  */
5966
6021
  function countLines(text) {
6022
+ if (text === '') {
6023
+ return 0;
6024
+ }
5967
6025
  text = text.replace('\r\n', '\n');
5968
6026
  text = text.replace('\r', '\n');
5969
6027
  const lines = text.split('\n');
5970
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
6028
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
5971
6029
  }
5972
6030
  /**
5973
6031
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -6092,6 +6150,8 @@
6092
6150
  * This function provides a common abstraction for result validation that can be used
6093
6151
  * by both execution logic and caching logic to ensure consistency.
6094
6152
  *
6153
+ * Note: [🔂] This function is idempotent.
6154
+ *
6095
6155
  * @param options - The validation options including result string, expectations, and format
6096
6156
  * @returns Validation result with processed string and validity status
6097
6157
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -6111,7 +6171,7 @@
6111
6171
  }
6112
6172
  catch (error) {
6113
6173
  keepUnused(error);
6114
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
6174
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
6115
6175
  Expected valid JSON string
6116
6176
 
6117
6177
  The expected JSON text:
@@ -6160,7 +6220,7 @@
6160
6220
  */
6161
6221
  async function executeAttempts(options) {
6162
6222
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
6163
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
6223
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
6164
6224
  const $ongoingTaskResult = {
6165
6225
  $result: null,
6166
6226
  $resultString: null,
@@ -6174,7 +6234,7 @@
6174
6234
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6175
6235
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6176
6236
  if (isJokerAttempt && !jokerParameterName) {
6177
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6237
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6178
6238
  Joker not found in attempt ${attemptIndex}
6179
6239
 
6180
6240
  ${block(pipelineIdentification)}
@@ -6185,7 +6245,7 @@
6185
6245
  $ongoingTaskResult.$expectError = null;
6186
6246
  if (isJokerAttempt) {
6187
6247
  if (parameters[jokerParameterName] === undefined) {
6188
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6248
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6189
6249
  Joker parameter {${jokerParameterName}} not defined
6190
6250
 
6191
6251
  ${block(pipelineIdentification)}
@@ -6243,7 +6303,7 @@
6243
6303
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6244
6304
  break variant;
6245
6305
  case 'EMBEDDING':
6246
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6306
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6247
6307
  Embedding model can not be used in pipeline
6248
6308
 
6249
6309
  This should be catched during parsing
@@ -6254,7 +6314,7 @@
6254
6314
  break variant;
6255
6315
  // <- case [🤖]:
6256
6316
  default:
6257
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6317
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6258
6318
  Unknown model variant "${task.modelRequirements.modelVariant}"
6259
6319
 
6260
6320
  ${block(pipelineIdentification)}
@@ -6265,14 +6325,14 @@
6265
6325
  break;
6266
6326
  case 'SCRIPT_TASK':
6267
6327
  if (arrayableToArray(tools.script).length === 0) {
6268
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6328
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6269
6329
  No script execution tools are available
6270
6330
 
6271
6331
  ${block(pipelineIdentification)}
6272
6332
  `));
6273
6333
  }
6274
6334
  if (!task.contentLanguage) {
6275
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6335
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6276
6336
  Script language is not defined for SCRIPT TASK "${task.name}"
6277
6337
 
6278
6338
  ${block(pipelineIdentification)}
@@ -6303,7 +6363,7 @@
6303
6363
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6304
6364
  }
6305
6365
  else {
6306
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6366
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6307
6367
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6308
6368
 
6309
6369
  ${block(pipelineIdentification)}
@@ -6317,7 +6377,7 @@
6317
6377
  break taskType;
6318
6378
  case 'DIALOG_TASK':
6319
6379
  if (tools.userInterface === undefined) {
6320
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6380
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6321
6381
  User interface tools are not available
6322
6382
 
6323
6383
  ${block(pipelineIdentification)}
@@ -6335,7 +6395,7 @@
6335
6395
  break taskType;
6336
6396
  // <- case: [🅱]
6337
6397
  default:
6338
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6398
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6339
6399
  Unknown execution type "${task.taskType}"
6340
6400
 
6341
6401
  ${block(pipelineIdentification)}
@@ -6408,14 +6468,10 @@
6408
6468
  });
6409
6469
  }
6410
6470
  finally {
6411
- if (!isJokerAttempt &&
6412
- task.taskType === 'PROMPT_TASK' &&
6413
- $ongoingTaskResult.$prompt
6414
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6415
- // In that case we don’t want to make a report about it because it’s not a llm execution error
6416
- ) {
6417
- // TODO: [🧠] Maybe put other taskTypes into report
6418
- $executionReport.promptExecutions.push({
6471
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
6472
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
6473
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
6474
+ const executionPromptReport = {
6419
6475
  prompt: {
6420
6476
  ...$ongoingTaskResult.$prompt,
6421
6477
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -6424,13 +6480,20 @@
6424
6480
  error: $ongoingTaskResult.$expectError === null
6425
6481
  ? undefined
6426
6482
  : serializeError($ongoingTaskResult.$expectError),
6427
- });
6483
+ };
6484
+ $executionReport.promptExecutions.push(executionPromptReport);
6485
+ if (logLlmCall) {
6486
+ logLlmCall({
6487
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
6488
+ report: executionPromptReport,
6489
+ });
6490
+ }
6428
6491
  }
6429
6492
  }
6430
6493
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6431
6494
  // Note: Create a summary of all failures
6432
6495
  const failuresSummary = $ongoingTaskResult.$failedResults
6433
- .map((failure) => spaceTrim.spaceTrim((block) => {
6496
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
6434
6497
  var _a, _b;
6435
6498
  return `
6436
6499
  Attempt ${failure.attemptIndex + 1}:
@@ -6440,14 +6503,14 @@
6440
6503
  Result:
6441
6504
  ${block(failure.result === null
6442
6505
  ? 'null'
6443
- : spaceTrim.spaceTrim(failure.result)
6506
+ : spaceTrim$1.spaceTrim(failure.result)
6444
6507
  .split('\n')
6445
6508
  .map((line) => `> ${line}`)
6446
6509
  .join('\n'))}
6447
6510
  `;
6448
6511
  }))
6449
6512
  .join('\n\n---\n\n');
6450
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
6513
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
6451
6514
  var _a;
6452
6515
  return `
6453
6516
  LLM execution failed ${maxExecutionAttempts}x
@@ -6467,7 +6530,7 @@
6467
6530
  }
6468
6531
  }
6469
6532
  if ($ongoingTaskResult.$resultString === null) {
6470
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6533
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6471
6534
  Something went wrong and prompt result is null
6472
6535
 
6473
6536
  ${block(pipelineIdentification)}
@@ -6489,9 +6552,9 @@
6489
6552
  * @private internal utility of `createPipelineExecutor`
6490
6553
  */
6491
6554
  async function executeFormatSubvalues(options) {
6492
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
6555
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
6493
6556
  if (task.foreach === undefined) {
6494
- return /* not await */ executeAttempts(options);
6557
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
6495
6558
  }
6496
6559
  if (jokerParameterNames.length !== 0) {
6497
6560
  throw new UnexpectedError(spaceTrim__default["default"]((block) => `
@@ -6697,7 +6760,7 @@
6697
6760
  },
6698
6761
  content: task.content,
6699
6762
  parameters,
6700
- };
6763
+ }; /* <- Note: [🤛] */
6701
6764
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6702
6765
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6703
6766
  const { index } = knowledgePiece;
@@ -6773,7 +6836,7 @@
6773
6836
  // Note: Doublecheck that ALL reserved parameters are defined:
6774
6837
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6775
6838
  if (reservedParameters[parameterName] === undefined) {
6776
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6839
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6777
6840
  Reserved parameter {${parameterName}} is not defined
6778
6841
 
6779
6842
  ${block(pipelineIdentification)}
@@ -6792,14 +6855,14 @@
6792
6855
  * @private internal utility of `createPipelineExecutor`
6793
6856
  */
6794
6857
  async function executeTask(options) {
6795
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6858
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
6796
6859
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
6797
6860
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
6798
6861
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
6799
6862
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6800
6863
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6801
6864
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6802
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6865
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6803
6866
  Dependent parameters are not consistent with used parameters:
6804
6867
 
6805
6868
  Dependent parameters:
@@ -6843,7 +6906,7 @@
6843
6906
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6844
6907
  // Houston, we have a problem
6845
6908
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6846
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6909
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6847
6910
  Parameter \`{${parameterName}}\` is NOT defined
6848
6911
  BUT used in task "${currentTask.title || currentTask.name}"
6849
6912
 
@@ -6871,6 +6934,7 @@
6871
6934
  tools,
6872
6935
  $executionReport,
6873
6936
  onProgress,
6937
+ logLlmCall,
6874
6938
  pipelineIdentification,
6875
6939
  maxExecutionAttempts,
6876
6940
  maxParallelCount,
@@ -6911,9 +6975,32 @@
6911
6975
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6912
6976
  if (parametersToPass[parameter.name] === undefined) {
6913
6977
  // [4]
6914
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6978
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6915
6979
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6916
6980
 
6981
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
6982
+
6983
+ All parameters:
6984
+ ${block(preparedPipeline.parameters
6985
+ .map(({ name, isInput, isOutput, description }) => {
6986
+ let line = `\`{${name}}\``;
6987
+ if (isInput) {
6988
+ line += ' `[input parameter]`';
6989
+ }
6990
+ if (isOutput) {
6991
+ line += ' `[output parameter]`';
6992
+ }
6993
+ if (parametersToPass[name] === undefined) {
6994
+ line += ` <- Warning: Should be in the output but its not |`;
6995
+ }
6996
+ if (description) {
6997
+ line += ` ${description}`;
6998
+ }
6999
+ return line;
7000
+ })
7001
+ .map((line, index) => `${index + 1}) ${line}`)
7002
+ .join('\n'))}
7003
+
6917
7004
  ${block(pipelineIdentification)}
6918
7005
  `)));
6919
7006
  continue;
@@ -6934,7 +7021,7 @@
6934
7021
  * @private internal utility of `createPipelineExecutor`
6935
7022
  */
6936
7023
  async function executePipeline(options) {
6937
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
7024
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
6938
7025
  let { preparedPipeline } = options;
6939
7026
  if (preparedPipeline === undefined) {
6940
7027
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -6996,7 +7083,7 @@
6996
7083
  for (const parameterName of Object.keys(inputParameters)) {
6997
7084
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6998
7085
  if (parameter === undefined) {
6999
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
7086
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
7000
7087
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
7001
7088
 
7002
7089
  ${block(pipelineIdentification)}
@@ -7011,7 +7098,7 @@
7011
7098
  // TODO: [🧠] This should be also non-critical error
7012
7099
  return exportJson({
7013
7100
  name: 'pipelineExecutorResult',
7014
- message: spaceTrim.spaceTrim((block) => `
7101
+ message: spaceTrim$1.spaceTrim((block) => `
7015
7102
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
7016
7103
 
7017
7104
  ${block(pipelineIdentification)}
@@ -7020,7 +7107,7 @@
7020
7107
  value: {
7021
7108
  isSuccessful: false,
7022
7109
  errors: [
7023
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
7110
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
7024
7111
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
7025
7112
 
7026
7113
  ${block(pipelineIdentification)}
@@ -7047,7 +7134,7 @@
7047
7134
  while (unresovedTasks.length > 0) {
7048
7135
  if (loopLimit-- < 0) {
7049
7136
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
7050
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
7137
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7051
7138
  Loop limit reached during resolving parameters pipeline execution
7052
7139
 
7053
7140
  ${block(pipelineIdentification)}
@@ -7057,7 +7144,7 @@
7057
7144
  if (!currentTask && resolving.length === 0) {
7058
7145
  throw new UnexpectedError(
7059
7146
  // TODO: [🐎] DRY
7060
- spaceTrim.spaceTrim((block) => `
7147
+ spaceTrim$1.spaceTrim((block) => `
7061
7148
  Can not resolve some parameters:
7062
7149
 
7063
7150
  ${block(pipelineIdentification)}
@@ -7097,7 +7184,7 @@
7097
7184
  tools,
7098
7185
  onProgress(newOngoingResult) {
7099
7186
  if (isReturned) {
7100
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
7187
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7101
7188
  Can not call \`onProgress\` after pipeline execution is finished
7102
7189
 
7103
7190
  ${block(pipelineIdentification)}
@@ -7112,8 +7199,9 @@
7112
7199
  onProgress(newOngoingResult);
7113
7200
  }
7114
7201
  },
7202
+ logLlmCall,
7115
7203
  $executionReport: executionReport,
7116
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7204
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7117
7205
  ${block(pipelineIdentification)}
7118
7206
  Task name: ${currentTask.name}
7119
7207
  Task title: ${currentTask.title}
@@ -7222,7 +7310,7 @@
7222
7310
  preparedPipeline = pipeline;
7223
7311
  }
7224
7312
  else if (isNotPreparedWarningSuppressed !== true) {
7225
- console.warn(spaceTrim.spaceTrim((block) => `
7313
+ console.warn(spaceTrim$1.spaceTrim((block) => `
7226
7314
  Pipeline is not prepared
7227
7315
 
7228
7316
  ${block(pipelineIdentification)}
@@ -7235,7 +7323,7 @@
7235
7323
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7236
7324
  }
7237
7325
  let runCount = 0;
7238
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
7326
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
7239
7327
  runCount++;
7240
7328
  return /* not await */ executePipeline({
7241
7329
  pipeline,
@@ -7246,7 +7334,8 @@
7246
7334
  inputParameters,
7247
7335
  tools,
7248
7336
  onProgress,
7249
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7337
+ logLlmCall,
7338
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7250
7339
  ${block(pipelineIdentification)}
7251
7340
  ${runCount === 1 ? '' : `Run #${runCount}`}
7252
7341
  `),
@@ -7407,7 +7496,7 @@
7407
7496
  }
7408
7497
  const llmTools = getSingleLlmExecutionTools(llm);
7409
7498
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7410
- const collection = createCollectionFromJson(...PipelineCollection);
7499
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7411
7500
  const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
7412
7501
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
7413
7502
  tools: {