@promptbook/core 0.59.0-27 → 0.59.0-29

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.
@@ -6,7 +6,6 @@ import type { PromptbookExecutor } from '../execution/PromptbookExecutor';
6
6
  import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools';
7
7
  import type { UserInterfaceTools, UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
8
8
  import type { PromptbookLibrary } from '../library/PromptbookLibrary';
9
- import type { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
10
9
  import type { ExecutionType } from '../types/ExecutionTypes';
11
10
  import type { ModelRequirements, ModelVariant } from '../types/ModelRequirements';
12
11
  import type { Parameters } from '../types/Parameters';
@@ -27,7 +26,7 @@ import type { FromtoItems } from '../utils/FromtoItems';
27
26
  import { PROMPTBOOK_VERSION } from '../version';
28
27
  export { PROMPTBOOK_VERSION };
29
28
  export { EXPECTATION_UNITS };
30
- export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimplePromptbookLibrary, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
29
+ export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
31
30
  /**
32
31
  * TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
33
32
  */
@@ -1,5 +1,5 @@
1
1
  import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
2
+ import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
4
  * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
5
5
  *
@@ -9,4 +9,4 @@ import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
9
9
  * @param promptbookSources
10
10
  * @returns PromptbookLibrary
11
11
  */
12
- export declare function createLibraryFromJson(...promptbooks: Array<PromptbookJson>): SimplePromptbookLibrary;
12
+ export declare function createLibraryFromJson(...promptbooks: Array<PromptbookJson>): PromptbookLibrary;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.59.0-27",
3
+ "version": "0.59.0-29",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -206,7 +206,7 @@
206
206
  return PromptbookSyntaxError;
207
207
  }(Error));
208
208
 
209
- var promptbookLibrary = [{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-26",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"knowledge"}],knowledge:[]}];
209
+ var promptbookLibrary = [{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-28",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"knowledge"}],knowledge:[]}];
210
210
 
211
211
  /**
212
212
  * This error indicates errors during the execution of the promptbook
@@ -530,7 +530,7 @@
530
530
  /**
531
531
  * The version of the Promptbook library
532
532
  */
533
- var PROMPTBOOK_VERSION = '0.59.0-26';
533
+ var PROMPTBOOK_VERSION = '0.59.0-28';
534
534
 
535
535
  /**
536
536
  * Function `addUsage` will add multiple usages into one
@@ -2010,7 +2010,9 @@
2010
2010
  case 0:
2011
2011
  content = options.content, llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
2012
2012
  library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookLibrary), false));
2013
- promptbook = library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md');
2013
+ return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md')];
2014
+ case 1:
2015
+ promptbook = _b.sent();
2014
2016
  executor = createPromptbookExecutor({
2015
2017
  promptbook: promptbook,
2016
2018
  tools: {
@@ -2021,7 +2023,7 @@
2021
2023
  },
2022
2024
  });
2023
2025
  return [4 /*yield*/, executor({ content: content })];
2024
- case 1:
2026
+ case 2:
2025
2027
  result = _b.sent();
2026
2028
  assertsExecutionSuccessful(result);
2027
2029
  outputParameters = result.outputParameters;
@@ -2060,7 +2062,7 @@
2060
2062
  }];
2061
2063
  });
2062
2064
  }); }))];
2063
- case 2:
2065
+ case 3:
2064
2066
  knowledge = _b.sent();
2065
2067
  return [2 /*return*/, knowledge];
2066
2068
  }
@@ -3148,7 +3150,7 @@
3148
3150
  if (templateModelRequirements.modelVariant === undefined) {
3149
3151
  templateModelRequirements.modelVariant = 'CHAT';
3150
3152
  }
3151
- promptbookJson.promptTemplates.push({
3153
+ var template = {
3152
3154
  name: titleToName(section.title),
3153
3155
  title: section.title,
3154
3156
  description: description_1,
@@ -3162,7 +3164,12 @@
3162
3164
  contentLanguage: executionType === 'SCRIPT' ? language : undefined,
3163
3165
  content: content,
3164
3166
  resultingParameterName: resultingParameterName,
3165
- });
3167
+ };
3168
+ if (executionType !== 'PROMPT_TEMPLATE') {
3169
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3170
+ delete template.modelRequirements;
3171
+ }
3172
+ promptbookJson.promptTemplates.push(template);
3166
3173
  };
3167
3174
  try {
3168
3175
  for (_a = __values(markdownStructure.sections), _b = _a.next(); !_b.done; _b = _a.next()) {