@promptbook/wizard 0.102.0-1 → 0.102.0-10

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 (115) hide show
  1. package/esm/index.es.js +314 -231
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/books/index.d.ts +81 -0
  4. package/esm/typings/src/_packages/components.index.d.ts +21 -13
  5. package/esm/typings/src/_packages/markdown-utils.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +13 -9
  7. package/esm/typings/src/_packages/utils.index.d.ts +12 -14
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +1 -1
  9. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +1 -1
  10. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  11. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  12. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +1 -5
  14. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +35 -0
  15. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +29 -7
  16. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +7 -0
  17. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +19 -1
  18. package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  19. package/esm/typings/src/book-components/Chat/MockedChat/constants.d.ts +1 -1
  20. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +13 -0
  21. package/esm/typings/src/book-components/Chat/save/_common/getChatSaveFormatDefinitions.d.ts +8 -0
  22. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +6 -0
  23. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +12 -0
  24. package/esm/typings/src/book-components/Chat/save/index.d.ts +39 -0
  25. package/esm/typings/src/book-components/Chat/save/json/jsonSaveFormatDefinition.d.ts +12 -0
  26. package/esm/typings/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +12 -0
  27. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +12 -0
  28. package/esm/typings/src/book-components/Chat/save/text/txtSaveFormatDefinition.d.ts +12 -0
  29. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +31 -5
  30. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +3 -3
  31. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +3 -0
  32. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +11 -0
  33. package/esm/typings/src/book-components/icons/CloseIcon.d.ts +11 -0
  34. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +1 -1
  35. package/esm/typings/src/execution/execution-report/countWorkingDuration.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -2
  39. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  41. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +1 -1
  44. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
  45. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
  46. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
  47. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
  48. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
  51. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
  53. package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
  54. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -3
  55. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +5 -5
  56. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +1 -1
  57. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -1
  58. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +13 -0
  59. package/esm/typings/src/remote-server/ui/renderServerIndexHtml.d.ts +7 -0
  60. package/esm/typings/src/remote-server/ui/types.d.ts +16 -0
  61. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
  62. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
  63. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +1 -1
  64. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +1 -1
  65. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -4
  66. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +1 -1
  67. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
  68. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
  69. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
  70. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
  71. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
  72. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
  73. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
  74. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -1
  75. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
  76. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  77. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
  78. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  79. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +6 -6
  80. package/esm/typings/src/types/Prompt.d.ts +5 -0
  81. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  82. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -1
  83. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -1
  84. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -1
  85. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -1
  86. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -1
  87. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +2 -0
  88. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -1
  89. package/esm/typings/src/utils/{trimCodeBlock.d.ts → markdown/trimCodeBlock.d.ts} +1 -1
  90. package/esm/typings/src/utils/{trimEndOfCodeBlock.d.ts → markdown/trimEndOfCodeBlock.d.ts} +1 -1
  91. package/esm/typings/src/utils/{$Register.d.ts → misc/$Register.d.ts} +2 -2
  92. package/esm/typings/src/utils/{$getCurrentDate.d.ts → misc/$getCurrentDate.d.ts} +1 -1
  93. package/esm/typings/src/utils/{arrayableToArray.d.ts → misc/arrayableToArray.d.ts} +1 -1
  94. package/esm/typings/src/utils/misc/debounce.d.ts +5 -0
  95. package/esm/typings/src/utils/{emojis.d.ts → misc/emojis.d.ts} +1 -1
  96. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +20 -0
  97. package/esm/typings/src/version.d.ts +1 -1
  98. package/package.json +2 -2
  99. package/umd/index.umd.js +314 -231
  100. package/umd/index.umd.js.map +1 -1
  101. package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +0 -11
  102. package/esm/typings/src/book-components/Chat/save/savePlugins.d.ts +0 -105
  103. /package/esm/typings/src/{utils/arrayableToArray.test.d.ts → book-2.0/agent-source/createAgentModelRequirementsWithCommitments.delete.test.d.ts} +0 -0
  104. /package/esm/typings/src/utils/{trimCodeBlock.test.d.ts → markdown/trimCodeBlock.test.d.ts} +0 -0
  105. /package/esm/typings/src/utils/{trimEndOfCodeBlock.test.d.ts → markdown/trimEndOfCodeBlock.test.d.ts} +0 -0
  106. /package/esm/typings/src/utils/{FromtoItems.d.ts → misc/FromtoItems.d.ts} +0 -0
  107. /package/esm/typings/src/utils/{markdown/prettifyMarkdown.test.d.ts → misc/arrayableToArray.test.d.ts} +0 -0
  108. /package/esm/typings/src/utils/{parseNumber.d.ts → misc/parseNumber.d.ts} +0 -0
  109. /package/esm/typings/src/utils/{parseNumber.test.d.ts → misc/parseNumber.test.d.ts} +0 -0
  110. /package/esm/typings/src/utils/{removeEmojis.d.ts → normalization/removeEmojis.d.ts} +0 -0
  111. /package/esm/typings/src/utils/{removeEmojis.test.d.ts → normalization/removeEmojis.test.d.ts} +0 -0
  112. /package/esm/typings/src/utils/{removeQuotes.d.ts → normalization/removeQuotes.d.ts} +0 -0
  113. /package/esm/typings/src/utils/{removeQuotes.test.d.ts → normalization/removeQuotes.test.d.ts} +0 -0
  114. /package/esm/typings/src/utils/{unwrapResult.d.ts → normalization/unwrapResult.d.ts} +0 -0
  115. /package/esm/typings/src/utils/{unwrapResult.test.d.ts → normalization/unwrapResult.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.102.0-1';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.102.0-10';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4686,6 +4686,7 @@
4686
4686
  * @public exported from `@promptbook/openai`
4687
4687
  */
4688
4688
  class OpenAiCompatibleExecutionTools {
4689
+ // Removed retriedUnsupportedParameters and attemptHistory instance fields
4689
4690
  /**
4690
4691
  * Creates OpenAI compatible Execution Tools.
4691
4692
  *
@@ -4697,10 +4698,6 @@
4697
4698
  * OpenAI API client.
4698
4699
  */
4699
4700
  this.client = null;
4700
- /**
4701
- * Tracks models and parameters that have already been retried to prevent infinite loops
4702
- */
4703
- this.retriedUnsupportedParameters = new Set();
4704
4701
  // TODO: Allow configuring rate limits via options
4705
4702
  this.limiter = new Bottleneck__default["default"]({
4706
4703
  minTime: 60000 / (this.options.maxRequestsPerMinute || DEFAULT_MAX_REQUESTS_PER_MINUTE),
@@ -4762,12 +4759,16 @@
4762
4759
  * Calls OpenAI compatible API to use a chat model.
4763
4760
  */
4764
4761
  async callChatModel(prompt) {
4765
- return this.callChatModelWithRetry(prompt, prompt.modelRequirements);
4762
+ // Deep clone prompt and modelRequirements to avoid mutation across calls
4763
+ const clonedPrompt = JSON.parse(JSON.stringify(prompt));
4764
+ // Use local Set for retried parameters to ensure independence and thread safety
4765
+ const retriedUnsupportedParameters = new Set();
4766
+ return this.callChatModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
4766
4767
  }
4767
4768
  /**
4768
4769
  * Internal method that handles parameter retry for chat model calls
4769
4770
  */
4770
- async callChatModelWithRetry(prompt, currentModelRequirements) {
4771
+ async callChatModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
4771
4772
  var _a;
4772
4773
  if (this.options.isVerbose) {
4773
4774
  console.info(`💬 ${this.title} callChatModel call`, { prompt, currentModelRequirements });
@@ -4794,6 +4795,14 @@
4794
4795
  // <- TODO: [🚸] Not all models are compatible with JSON mode
4795
4796
  // > 'response_format' of type 'json_object' is not supported with this model.
4796
4797
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
4798
+ // Convert thread to OpenAI format if present
4799
+ let threadMessages = [];
4800
+ if ('thread' in prompt && Array.isArray(prompt.thread)) {
4801
+ threadMessages = prompt.thread.map((msg) => ({
4802
+ role: msg.role === 'assistant' ? 'assistant' : 'user',
4803
+ content: msg.content,
4804
+ }));
4805
+ }
4797
4806
  const rawRequest = {
4798
4807
  ...modelSettings,
4799
4808
  messages: [
@@ -4805,6 +4814,7 @@
4805
4814
  content: currentModelRequirements.systemMessage,
4806
4815
  },
4807
4816
  ]),
4817
+ ...threadMessages,
4808
4818
  {
4809
4819
  role: 'user',
4810
4820
  content: rawPromptContent,
@@ -4865,6 +4875,17 @@
4865
4875
  assertsError(error);
4866
4876
  // Check if this is an unsupported parameter error
4867
4877
  if (!isUnsupportedParameterError(error)) {
4878
+ // If we have attemptStack, include it in the error message
4879
+ if (attemptStack.length > 0) {
4880
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
4881
+ attemptStack
4882
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
4883
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
4884
+ `, Error: ${a.errorMessage}` +
4885
+ (a.stripped ? ' (stripped and retried)' : ''))
4886
+ .join('\n') +
4887
+ `\nFinal error: ${error.message}`);
4888
+ }
4868
4889
  throw error;
4869
4890
  }
4870
4891
  // Parse which parameter is unsupported
@@ -4877,34 +4898,54 @@
4877
4898
  }
4878
4899
  // Create a unique key for this model + parameter combination to prevent infinite loops
4879
4900
  const retryKey = `${modelName}-${unsupportedParameter}`;
4880
- if (this.retriedUnsupportedParameters.has(retryKey)) {
4881
- // Already retried this parameter, throw the error
4882
- if (this.options.isVerbose) {
4883
- console.warn(colors__default["default"].bgRed('Error'), `Parameter '${unsupportedParameter}' for model '${modelName}' already retried once, throwing error:`, error.message);
4884
- }
4885
- throw error;
4901
+ if (retriedUnsupportedParameters.has(retryKey)) {
4902
+ // Already retried this parameter, throw the error with attemptStack
4903
+ attemptStack.push({
4904
+ modelName,
4905
+ unsupportedParameter,
4906
+ errorMessage: error.message,
4907
+ stripped: true,
4908
+ });
4909
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
4910
+ attemptStack
4911
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
4912
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
4913
+ `, Error: ${a.errorMessage}` +
4914
+ (a.stripped ? ' (stripped and retried)' : ''))
4915
+ .join('\n') +
4916
+ `\nFinal error: ${error.message}`);
4886
4917
  }
4887
4918
  // Mark this parameter as retried
4888
- this.retriedUnsupportedParameters.add(retryKey);
4919
+ retriedUnsupportedParameters.add(retryKey);
4889
4920
  // Log warning in verbose mode
4890
4921
  if (this.options.isVerbose) {
4891
4922
  console.warn(colors__default["default"].bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
4892
4923
  }
4924
+ // Add to attemptStack
4925
+ attemptStack.push({
4926
+ modelName,
4927
+ unsupportedParameter,
4928
+ errorMessage: error.message,
4929
+ stripped: true,
4930
+ });
4893
4931
  // Remove the unsupported parameter and retry
4894
4932
  const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
4895
- return this.callChatModelWithRetry(prompt, modifiedModelRequirements);
4933
+ return this.callChatModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
4896
4934
  }
4897
4935
  }
4898
4936
  /**
4899
4937
  * Calls OpenAI API to use a complete model.
4900
4938
  */
4901
4939
  async callCompletionModel(prompt) {
4902
- return this.callCompletionModelWithRetry(prompt, prompt.modelRequirements);
4940
+ // Deep clone prompt and modelRequirements to avoid mutation across calls
4941
+ const clonedPrompt = JSON.parse(JSON.stringify(prompt));
4942
+ const retriedUnsupportedParameters = new Set();
4943
+ return this.callCompletionModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
4903
4944
  }
4904
4945
  /**
4905
4946
  * Internal method that handles parameter retry for completion model calls
4906
4947
  */
4907
- async callCompletionModelWithRetry(prompt, currentModelRequirements) {
4948
+ async callCompletionModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
4908
4949
  var _a;
4909
4950
  if (this.options.isVerbose) {
4910
4951
  console.info(`🖋 ${this.title} callCompletionModel call`, { prompt, currentModelRequirements });
@@ -4920,8 +4961,6 @@
4920
4961
  model: modelName,
4921
4962
  max_tokens: currentModelRequirements.maxTokens,
4922
4963
  temperature: currentModelRequirements.temperature,
4923
- // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
4924
- // <- Note: [🧆]
4925
4964
  };
4926
4965
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
4927
4966
  const rawRequest = {
@@ -4951,7 +4990,6 @@
4951
4990
  throw new PipelineExecutionError(`No choises from ${this.title}`);
4952
4991
  }
4953
4992
  if (rawResponse.choices.length > 1) {
4954
- // TODO: This should be maybe only warning
4955
4993
  throw new PipelineExecutionError(`More than one choise from ${this.title}`);
4956
4994
  }
4957
4995
  const resultContent = rawResponse.choices[0].text;
@@ -4971,17 +5009,24 @@
4971
5009
  rawPromptContent,
4972
5010
  rawRequest,
4973
5011
  rawResponse,
4974
- // <- [🗯]
4975
5012
  },
4976
5013
  });
4977
5014
  }
4978
5015
  catch (error) {
4979
5016
  assertsError(error);
4980
- // Check if this is an unsupported parameter error
4981
5017
  if (!isUnsupportedParameterError(error)) {
5018
+ if (attemptStack.length > 0) {
5019
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
5020
+ attemptStack
5021
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
5022
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
5023
+ `, Error: ${a.errorMessage}` +
5024
+ (a.stripped ? ' (stripped and retried)' : ''))
5025
+ .join('\n') +
5026
+ `\nFinal error: ${error.message}`);
5027
+ }
4982
5028
  throw error;
4983
5029
  }
4984
- // Parse which parameter is unsupported
4985
5030
  const unsupportedParameter = parseUnsupportedParameterError(error.message);
4986
5031
  if (!unsupportedParameter) {
4987
5032
  if (this.options.isVerbose) {
@@ -4989,40 +5034,59 @@
4989
5034
  }
4990
5035
  throw error;
4991
5036
  }
4992
- // Create a unique key for this model + parameter combination to prevent infinite loops
4993
5037
  const retryKey = `${modelName}-${unsupportedParameter}`;
4994
- if (this.retriedUnsupportedParameters.has(retryKey)) {
4995
- // Already retried this parameter, throw the error
4996
- if (this.options.isVerbose) {
4997
- console.warn(colors__default["default"].bgRed('Error'), `Parameter '${unsupportedParameter}' for model '${modelName}' already retried once, throwing error:`, error.message);
4998
- }
4999
- throw error;
5038
+ if (retriedUnsupportedParameters.has(retryKey)) {
5039
+ attemptStack.push({
5040
+ modelName,
5041
+ unsupportedParameter,
5042
+ errorMessage: error.message,
5043
+ stripped: true,
5044
+ });
5045
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
5046
+ attemptStack
5047
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
5048
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
5049
+ `, Error: ${a.errorMessage}` +
5050
+ (a.stripped ? ' (stripped and retried)' : ''))
5051
+ .join('\n') +
5052
+ `\nFinal error: ${error.message}`);
5000
5053
  }
5001
- // Mark this parameter as retried
5002
- this.retriedUnsupportedParameters.add(retryKey);
5003
- // Log warning in verbose mode
5054
+ retriedUnsupportedParameters.add(retryKey);
5004
5055
  if (this.options.isVerbose) {
5005
5056
  console.warn(colors__default["default"].bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
5006
5057
  }
5007
- // Remove the unsupported parameter and retry
5058
+ attemptStack.push({
5059
+ modelName,
5060
+ unsupportedParameter,
5061
+ errorMessage: error.message,
5062
+ stripped: true,
5063
+ });
5008
5064
  const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
5009
- return this.callCompletionModelWithRetry(prompt, modifiedModelRequirements);
5065
+ return this.callCompletionModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
5010
5066
  }
5011
5067
  }
5012
5068
  /**
5013
5069
  * Calls OpenAI compatible API to use a embedding model
5014
5070
  */
5015
5071
  async callEmbeddingModel(prompt) {
5072
+ // Deep clone prompt and modelRequirements to avoid mutation across calls
5073
+ const clonedPrompt = JSON.parse(JSON.stringify(prompt));
5074
+ const retriedUnsupportedParameters = new Set();
5075
+ return this.callEmbeddingModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
5076
+ }
5077
+ /**
5078
+ * Internal method that handles parameter retry for embedding model calls
5079
+ */
5080
+ async callEmbeddingModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
5016
5081
  if (this.options.isVerbose) {
5017
- console.info(`🖋 ${this.title} embedding call`, { prompt });
5082
+ console.info(`🖋 ${this.title} embedding call`, { prompt, currentModelRequirements });
5018
5083
  }
5019
- const { content, parameters, modelRequirements } = prompt;
5084
+ const { content, parameters } = prompt;
5020
5085
  const client = await this.getClient();
5021
- // TODO: [☂] Use here more modelRequirements
5022
- if (modelRequirements.modelVariant !== 'EMBEDDING') {
5086
+ if (currentModelRequirements.modelVariant !== 'EMBEDDING') {
5023
5087
  throw new PipelineExecutionError('Use embed only for EMBEDDING variant');
5024
5088
  }
5025
- const modelName = modelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
5089
+ const modelName = currentModelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
5026
5090
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
5027
5091
  const rawRequest = {
5028
5092
  input: rawPromptContent,
@@ -5032,44 +5096,95 @@
5032
5096
  if (this.options.isVerbose) {
5033
5097
  console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
5034
5098
  }
5035
- const rawResponse = await this.limiter
5036
- .schedule(() => this.makeRequestWithNetworkRetry(() => client.embeddings.create(rawRequest)))
5037
- .catch((error) => {
5038
- assertsError(error);
5099
+ try {
5100
+ const rawResponse = await this.limiter
5101
+ .schedule(() => this.makeRequestWithNetworkRetry(() => client.embeddings.create(rawRequest)))
5102
+ .catch((error) => {
5103
+ assertsError(error);
5104
+ if (this.options.isVerbose) {
5105
+ console.info(colors__default["default"].bgRed('error'), error);
5106
+ }
5107
+ throw error;
5108
+ });
5039
5109
  if (this.options.isVerbose) {
5040
- console.info(colors__default["default"].bgRed('error'), error);
5110
+ console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
5041
5111
  }
5042
- throw error;
5043
- });
5044
- if (this.options.isVerbose) {
5045
- console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
5112
+ const complete = $getCurrentDate();
5113
+ if (rawResponse.data.length !== 1) {
5114
+ throw new PipelineExecutionError(`Expected exactly 1 data item in response, got ${rawResponse.data.length}`);
5115
+ }
5116
+ const resultContent = rawResponse.data[0].embedding;
5117
+ const usage = this.computeUsage(content || '', '', rawResponse);
5118
+ return exportJson({
5119
+ name: 'promptResult',
5120
+ message: `Result of \`OpenAiCompatibleExecutionTools.callEmbeddingModel\``,
5121
+ order: [],
5122
+ value: {
5123
+ content: resultContent,
5124
+ modelName: rawResponse.model || modelName,
5125
+ timing: {
5126
+ start,
5127
+ complete,
5128
+ },
5129
+ usage,
5130
+ rawPromptContent,
5131
+ rawRequest,
5132
+ rawResponse,
5133
+ },
5134
+ });
5046
5135
  }
5047
- const complete = $getCurrentDate();
5048
- if (rawResponse.data.length !== 1) {
5049
- throw new PipelineExecutionError(`Expected exactly 1 data item in response, got ${rawResponse.data.length}`);
5136
+ catch (error) {
5137
+ assertsError(error);
5138
+ if (!isUnsupportedParameterError(error)) {
5139
+ if (attemptStack.length > 0) {
5140
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
5141
+ attemptStack
5142
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
5143
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
5144
+ `, Error: ${a.errorMessage}` +
5145
+ (a.stripped ? ' (stripped and retried)' : ''))
5146
+ .join('\n') +
5147
+ `\nFinal error: ${error.message}`);
5148
+ }
5149
+ throw error;
5150
+ }
5151
+ const unsupportedParameter = parseUnsupportedParameterError(error.message);
5152
+ if (!unsupportedParameter) {
5153
+ if (this.options.isVerbose) {
5154
+ console.warn(colors__default["default"].bgYellow('Warning'), 'Could not parse unsupported parameter from error:', error.message);
5155
+ }
5156
+ throw error;
5157
+ }
5158
+ const retryKey = `${modelName}-${unsupportedParameter}`;
5159
+ if (retriedUnsupportedParameters.has(retryKey)) {
5160
+ attemptStack.push({
5161
+ modelName,
5162
+ unsupportedParameter,
5163
+ errorMessage: error.message,
5164
+ stripped: true,
5165
+ });
5166
+ throw new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
5167
+ attemptStack
5168
+ .map((a, i) => ` ${i + 1}. Model: ${a.modelName}` +
5169
+ (a.unsupportedParameter ? `, Stripped: ${a.unsupportedParameter}` : '') +
5170
+ `, Error: ${a.errorMessage}` +
5171
+ (a.stripped ? ' (stripped and retried)' : ''))
5172
+ .join('\n') +
5173
+ `\nFinal error: ${error.message}`);
5174
+ }
5175
+ retriedUnsupportedParameters.add(retryKey);
5176
+ if (this.options.isVerbose) {
5177
+ console.warn(colors__default["default"].bgYellow('Warning'), `Removing unsupported parameter '${unsupportedParameter}' for model '${modelName}' and retrying request`);
5178
+ }
5179
+ attemptStack.push({
5180
+ modelName,
5181
+ unsupportedParameter,
5182
+ errorMessage: error.message,
5183
+ stripped: true,
5184
+ });
5185
+ const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
5186
+ return this.callEmbeddingModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
5050
5187
  }
5051
- const resultContent = rawResponse.data[0].embedding;
5052
- const usage = this.computeUsage(content || '', '',
5053
- // <- Note: Embedding does not have result content
5054
- rawResponse);
5055
- return exportJson({
5056
- name: 'promptResult',
5057
- message: `Result of \`OpenAiCompatibleExecutionTools.callEmbeddingModel\``,
5058
- order: [],
5059
- value: {
5060
- content: resultContent,
5061
- modelName: rawResponse.model || modelName,
5062
- timing: {
5063
- start,
5064
- complete,
5065
- },
5066
- usage,
5067
- rawPromptContent,
5068
- rawRequest,
5069
- rawResponse,
5070
- // <- [🗯]
5071
- },
5072
- });
5073
5188
  }
5074
5189
  // <- Note: [🤖] callXxxModel
5075
5190
  /**
@@ -6376,24 +6491,6 @@
6376
6491
  * Note: [💞] Ignore a discrepancy between file name and entity name
6377
6492
  */
6378
6493
 
6379
- /**
6380
- * Removes emojis from a string and fix whitespaces
6381
- *
6382
- * Note: [🔂] This function is idempotent.
6383
- *
6384
- * @param text with emojis
6385
- * @returns text without emojis
6386
- * @public exported from `@promptbook/utils`
6387
- */
6388
- function removeEmojis(text) {
6389
- // Replace emojis (and also ZWJ sequence) with hyphens
6390
- text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
6391
- text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
6392
- text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
6393
- text = text.replace(/\p{Extended_Pictographic}/gu, '');
6394
- return text;
6395
- }
6396
-
6397
6494
  /**
6398
6495
  * Tests if given string is valid file path.
6399
6496
  *
@@ -6450,6 +6547,24 @@
6450
6547
  * TODO: [🍏] Implement for MacOs
6451
6548
  */
6452
6549
 
6550
+ /**
6551
+ * Removes emojis from a string and fix whitespaces
6552
+ *
6553
+ * Note: [🔂] This function is idempotent.
6554
+ *
6555
+ * @param text with emojis
6556
+ * @returns text without emojis
6557
+ * @public exported from `@promptbook/utils`
6558
+ */
6559
+ function removeEmojis(text) {
6560
+ // Replace emojis (and also ZWJ sequence) with hyphens
6561
+ text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
6562
+ text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
6563
+ text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
6564
+ text = text.replace(/\p{Extended_Pictographic}/gu, '');
6565
+ return text;
6566
+ }
6567
+
6453
6568
  /**
6454
6569
  * Converts a title string into a normalized name.
6455
6570
  *
@@ -6557,7 +6672,7 @@
6557
6672
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
6558
6673
  */
6559
6674
 
6560
- 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"}];
6675
+ 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.102.0-9",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"}];
6561
6676
 
6562
6677
  /**
6563
6678
  * Checks if value is valid email
@@ -6631,42 +6746,10 @@
6631
6746
  * @param content raw html code
6632
6747
  * @returns formatted html code
6633
6748
  * @private withing the package because of HUGE size of prettier dependency
6749
+ * @deprecated Prettier removed from Promptbook due to package size
6634
6750
  */
6635
6751
  function prettifyMarkdown(content) {
6636
- // In browser/Next.js environments, just return the original content
6637
- // since prettier parsers are not available and would cause bundling issues
6638
- if (typeof window !== 'undefined') {
6639
- return content;
6640
- }
6641
- try {
6642
- // Use dynamic require to avoid static imports that cause bundling issues
6643
- // This will only work in Node.js environments
6644
- const prettierStandalone = eval('require')('prettier/standalone');
6645
- const parserMarkdown = eval('require')('prettier/parser-markdown');
6646
- const parserHtml = eval('require')('prettier/parser-html');
6647
- return prettierStandalone.format(content, {
6648
- parser: 'markdown',
6649
- plugins: [parserMarkdown, parserHtml],
6650
- // TODO: DRY - make some import or auto-copy of .prettierrc
6651
- endOfLine: 'lf',
6652
- tabWidth: 4,
6653
- singleQuote: true,
6654
- trailingComma: 'all',
6655
- arrowParens: 'always',
6656
- printWidth: 120,
6657
- htmlWhitespaceSensitivity: 'ignore',
6658
- jsxBracketSameLine: false,
6659
- bracketSpacing: true,
6660
- });
6661
- }
6662
- catch (error) {
6663
- // TODO: [🟥] Detect browser / node and make it colorful
6664
- console.error('There was an error with prettifying the markdown, using the original as the fallback', {
6665
- error,
6666
- html: content,
6667
- });
6668
- return content;
6669
- }
6752
+ return (content + `\n\n<!-- Note: Prettier removed from Promptbook -->`);
6670
6753
  }
6671
6754
 
6672
6755
  /**
@@ -13243,6 +13326,75 @@
13243
13326
  * TODO: [🌺] Use some intermediate util splitWords
13244
13327
  */
13245
13328
 
13329
+ /**
13330
+ * Function parseNumber will parse number from string
13331
+ *
13332
+ * Note: [🔂] This function is idempotent.
13333
+ * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
13334
+ * Note: it also works only with decimal numbers
13335
+ *
13336
+ * @returns parsed number
13337
+ * @throws {ParseError} if the value is not a number
13338
+ *
13339
+ * @public exported from `@promptbook/utils`
13340
+ */
13341
+ function parseNumber(value) {
13342
+ const originalValue = value;
13343
+ if (typeof value === 'number') {
13344
+ value = value.toString(); // <- TODO: Maybe more efficient way to do this
13345
+ }
13346
+ if (typeof value !== 'string') {
13347
+ return 0;
13348
+ }
13349
+ value = value.trim();
13350
+ if (value.startsWith('+')) {
13351
+ return parseNumber(value.substring(1));
13352
+ }
13353
+ if (value.startsWith('-')) {
13354
+ const number = parseNumber(value.substring(1));
13355
+ if (number === 0) {
13356
+ return 0; // <- Note: To prevent -0
13357
+ }
13358
+ return -number;
13359
+ }
13360
+ value = value.replace(/,/g, '.');
13361
+ value = value.toUpperCase();
13362
+ if (value === '') {
13363
+ return 0;
13364
+ }
13365
+ if (value === '♾' || value.startsWith('INF')) {
13366
+ return Infinity;
13367
+ }
13368
+ if (value.includes('/')) {
13369
+ const [numerator_, denominator_] = value.split('/');
13370
+ const numerator = parseNumber(numerator_);
13371
+ const denominator = parseNumber(denominator_);
13372
+ if (denominator === 0) {
13373
+ throw new ParseError(`Unable to parse number from "${originalValue}" because denominator is zero`);
13374
+ }
13375
+ return numerator / denominator;
13376
+ }
13377
+ if (/^(NAN|NULL|NONE|UNDEFINED|ZERO|NO.*)$/.test(value)) {
13378
+ return 0;
13379
+ }
13380
+ if (value.includes('E')) {
13381
+ const [significand, exponent] = value.split('E');
13382
+ return parseNumber(significand) * 10 ** parseNumber(exponent);
13383
+ }
13384
+ if (!/^[0-9.]+$/.test(value) || value.split('.').length > 2) {
13385
+ throw new ParseError(`Unable to parse number from "${originalValue}"`);
13386
+ }
13387
+ const num = parseFloat(value);
13388
+ if (isNaN(num)) {
13389
+ throw new ParseError(`Unexpected NaN when parsing number from "${originalValue}"`);
13390
+ }
13391
+ return num;
13392
+ }
13393
+ /**
13394
+ * TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
13395
+ * TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
13396
+ */
13397
+
13246
13398
  /**
13247
13399
  * Makes first letter of a string lowercase
13248
13400
  *
@@ -13324,75 +13476,6 @@
13324
13476
  return sentence.replace(/\s+/gs, ' ').trim();
13325
13477
  }
13326
13478
 
13327
- /**
13328
- * Function parseNumber will parse number from string
13329
- *
13330
- * Note: [🔂] This function is idempotent.
13331
- * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
13332
- * Note: it also works only with decimal numbers
13333
- *
13334
- * @returns parsed number
13335
- * @throws {ParseError} if the value is not a number
13336
- *
13337
- * @public exported from `@promptbook/utils`
13338
- */
13339
- function parseNumber(value) {
13340
- const originalValue = value;
13341
- if (typeof value === 'number') {
13342
- value = value.toString(); // <- TODO: Maybe more efficient way to do this
13343
- }
13344
- if (typeof value !== 'string') {
13345
- return 0;
13346
- }
13347
- value = value.trim();
13348
- if (value.startsWith('+')) {
13349
- return parseNumber(value.substring(1));
13350
- }
13351
- if (value.startsWith('-')) {
13352
- const number = parseNumber(value.substring(1));
13353
- if (number === 0) {
13354
- return 0; // <- Note: To prevent -0
13355
- }
13356
- return -number;
13357
- }
13358
- value = value.replace(/,/g, '.');
13359
- value = value.toUpperCase();
13360
- if (value === '') {
13361
- return 0;
13362
- }
13363
- if (value === '♾' || value.startsWith('INF')) {
13364
- return Infinity;
13365
- }
13366
- if (value.includes('/')) {
13367
- const [numerator_, denominator_] = value.split('/');
13368
- const numerator = parseNumber(numerator_);
13369
- const denominator = parseNumber(denominator_);
13370
- if (denominator === 0) {
13371
- throw new ParseError(`Unable to parse number from "${originalValue}" because denominator is zero`);
13372
- }
13373
- return numerator / denominator;
13374
- }
13375
- if (/^(NAN|NULL|NONE|UNDEFINED|ZERO|NO.*)$/.test(value)) {
13376
- return 0;
13377
- }
13378
- if (value.includes('E')) {
13379
- const [significand, exponent] = value.split('E');
13380
- return parseNumber(significand) * 10 ** parseNumber(exponent);
13381
- }
13382
- if (!/^[0-9.]+$/.test(value) || value.split('.').length > 2) {
13383
- throw new ParseError(`Unable to parse number from "${originalValue}"`);
13384
- }
13385
- const num = parseFloat(value);
13386
- if (isNaN(num)) {
13387
- throw new ParseError(`Unexpected NaN when parsing number from "${originalValue}"`);
13388
- }
13389
- return num;
13390
- }
13391
- /**
13392
- * TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
13393
- * TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
13394
- */
13395
-
13396
13479
  /**
13397
13480
  * Removes quotes from a string
13398
13481
  *
@@ -13417,41 +13500,6 @@
13417
13500
  return text;
13418
13501
  }
13419
13502
 
13420
- /**
13421
- * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
13422
- *
13423
- * Note: [🔂] This function is idempotent.
13424
- * Note: This is useful for post-processing of the result of the chat LLM model
13425
- * when the model wraps the result in the (markdown) code block.
13426
- *
13427
- * @public exported from `@promptbook/utils`
13428
- */
13429
- function trimCodeBlock(value) {
13430
- value = spaceTrim.spaceTrim(value);
13431
- if (!/^```[a-z]*(.*)```$/is.test(value)) {
13432
- return value;
13433
- }
13434
- value = value.replace(/^```[a-z]*/i, '');
13435
- value = value.replace(/```$/i, '');
13436
- value = spaceTrim.spaceTrim(value);
13437
- return value;
13438
- }
13439
-
13440
- /**
13441
- * Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
13442
- *
13443
- * Note: This is useful for post-processing of the result of the completion LLM model
13444
- * if you want to start code block in the prompt but you don't want to end it in the result.
13445
- *
13446
- * @public exported from `@promptbook/utils`
13447
- */
13448
- function trimEndOfCodeBlock(value) {
13449
- value = spaceTrim.spaceTrim(value);
13450
- value = value.replace(/```$/g, '');
13451
- value = spaceTrim.spaceTrim(value);
13452
- return value;
13453
- }
13454
-
13455
13503
  /**
13456
13504
  * Removes quotes and optional introduce text from a string
13457
13505
  *
@@ -13587,6 +13635,41 @@
13587
13635
  return content;
13588
13636
  }
13589
13637
 
13638
+ /**
13639
+ * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
13640
+ *
13641
+ * Note: [🔂] This function is idempotent.
13642
+ * Note: This is useful for post-processing of the result of the chat LLM model
13643
+ * when the model wraps the result in the (markdown) code block.
13644
+ *
13645
+ * @public exported from `@promptbook/markdown-utils`
13646
+ */
13647
+ function trimCodeBlock(value) {
13648
+ value = spaceTrim.spaceTrim(value);
13649
+ if (!/^```[a-z]*(.*)```$/is.test(value)) {
13650
+ return value;
13651
+ }
13652
+ value = value.replace(/^```[a-z]*/i, '');
13653
+ value = value.replace(/```$/i, '');
13654
+ value = spaceTrim.spaceTrim(value);
13655
+ return value;
13656
+ }
13657
+
13658
+ /**
13659
+ * Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
13660
+ *
13661
+ * Note: This is useful for post-processing of the result of the completion LLM model
13662
+ * if you want to start code block in the prompt but you don't want to end it in the result.
13663
+ *
13664
+ * @public exported from `@promptbook/markdown-utils`
13665
+ */
13666
+ function trimEndOfCodeBlock(value) {
13667
+ value = spaceTrim.spaceTrim(value);
13668
+ value = value.replace(/```$/g, '');
13669
+ value = spaceTrim.spaceTrim(value);
13670
+ return value;
13671
+ }
13672
+
13590
13673
  /**
13591
13674
  * @private internal for `preserve`
13592
13675
  */