@promptbook/core 0.61.0-11 → 0.61.0-12
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.
- package/esm/index.es.js +46 -26
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/esm/typings/src/llm-providers/{utils → _common}/createLlmToolsFromEnv.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/esm/typings/src/llm-providers/{utils → _common/utils}/cache/CacheItem.d.ts +4 -4
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/cacheLlmTools.d.ts +3 -4
- package/esm/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/personas/preparePersona.d.ts +6 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/esm/typings/src/utils/emojis.d.ts +2 -2
- package/esm/typings/src/utils/formatNumber.d.ts +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/esm/typings/src/utils/organization/TODO.d.ts +2 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/esm/typings/src/utils/organization/___.d.ts +2 -0
- package/esm/typings/src/utils/organization/just.d.ts +1 -0
- package/esm/typings/src/utils/organization/keepImported.d.ts +12 -0
- package/esm/typings/src/utils/organization/notUsing.d.ts +1 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +2 -0
- package/esm/typings/src/version.d.ts +3 -0
- package/package.json +1 -1
- package/umd/index.umd.js +46 -26
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
- package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/umd/typings/src/llm-providers/{utils → _common}/createLlmToolsFromEnv.d.ts +3 -2
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/umd/typings/src/llm-providers/{utils → _common/utils}/cache/CacheItem.d.ts +4 -4
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/cacheLlmTools.d.ts +3 -4
- package/umd/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/personas/preparePersona.d.ts +6 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/umd/typings/src/utils/emojis.d.ts +2 -2
- package/umd/typings/src/utils/formatNumber.d.ts +1 -1
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/umd/typings/src/utils/organization/TODO.d.ts +2 -0
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/umd/typings/src/utils/organization/___.d.ts +2 -0
- package/umd/typings/src/utils/organization/just.d.ts +1 -0
- package/umd/typings/src/utils/organization/keepImported.d.ts +12 -0
- package/umd/typings/src/utils/organization/notUsing.d.ts +1 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +2 -0
- package/umd/typings/src/version.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
package/esm/index.es.js
CHANGED
|
@@ -385,7 +385,7 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
|
|
|
385
385
|
return parameterString;
|
|
386
386
|
}
|
|
387
387
|
/**
|
|
388
|
-
* TODO:
|
|
388
|
+
* TODO: !!!! Implement new features and commands into `promptTemplateParameterJsonToString`
|
|
389
389
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
390
390
|
* TODO: Escape all
|
|
391
391
|
*/
|
|
@@ -406,6 +406,10 @@ var RESERVED_PARAMETER_NAMES = [
|
|
|
406
406
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
407
407
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
408
408
|
];
|
|
409
|
+
/*
|
|
410
|
+
TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
411
|
+
*/
|
|
412
|
+
// [🟡][🟢][🔵][⚪]
|
|
409
413
|
|
|
410
414
|
/**
|
|
411
415
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -780,7 +784,9 @@ function validatePipeline(pipeline) {
|
|
|
780
784
|
* > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
|
|
781
785
|
*/
|
|
782
786
|
/**
|
|
783
|
-
* TODO: [🧠]
|
|
787
|
+
* TODO: [🧠][🐣] !!!! Validate that all samples match expectations
|
|
788
|
+
* TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
|
|
789
|
+
* TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
784
790
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
785
791
|
*/
|
|
786
792
|
|
|
@@ -823,7 +829,7 @@ var SimplePipelineCollection = /** @class */ (function () {
|
|
|
823
829
|
/**
|
|
824
830
|
* Constructs a pipeline collection from promptbooks
|
|
825
831
|
*
|
|
826
|
-
* @param promptbooks
|
|
832
|
+
* @param promptbooks @@@
|
|
827
833
|
*
|
|
828
834
|
* @private Use instead `createCollectionFromJson`
|
|
829
835
|
* Note: During the construction logic of all promptbooks are validated
|
|
@@ -1292,7 +1298,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1292
1298
|
});
|
|
1293
1299
|
}
|
|
1294
1300
|
|
|
1295
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
1301
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-11",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"],blockType:"PROMPT_TEMPLATE",personaName:null,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"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-11",modelUsage:{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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-11",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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> {content}",resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-11",modelUsage:{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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-11",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",expectations:{words:{min:1,max:8}},personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {content}",resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-11",modelUsage:{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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-11",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{name:"make-model-requirements",title:"Make modelRequirements",dependentParameterNames:["availableModelNames","personaDescription"],blockType:"PROMPT_TEMPLATE",expectFormat:"JSON",personaName:null,modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-11",modelUsage:{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}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1296
1302
|
|
|
1297
1303
|
var defaultDiacriticsRemovalMap = [
|
|
1298
1304
|
{
|
|
@@ -1966,8 +1972,11 @@ function arrayableToArray(input) {
|
|
|
1966
1972
|
/**
|
|
1967
1973
|
* The version of the Promptbook library
|
|
1968
1974
|
*/
|
|
1969
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
1975
|
+
var PROMPTBOOK_VERSION = '0.61.0-11';
|
|
1970
1976
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
1977
|
+
/**
|
|
1978
|
+
* TODO: [🔼] !!! Export via `@promptbook/code`
|
|
1979
|
+
*/
|
|
1971
1980
|
|
|
1972
1981
|
/**
|
|
1973
1982
|
* Counts number of characters in the text
|
|
@@ -2711,6 +2720,7 @@ function createPipelineExecutor(options) {
|
|
|
2711
2720
|
*
|
|
2712
2721
|
* @param value any values
|
|
2713
2722
|
* @returns void
|
|
2723
|
+
* @private within the repository
|
|
2714
2724
|
*/
|
|
2715
2725
|
function TODO_USE() {
|
|
2716
2726
|
var value = [];
|
|
@@ -2846,6 +2856,7 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
|
|
|
2846
2856
|
});
|
|
2847
2857
|
}
|
|
2848
2858
|
/**
|
|
2859
|
+
* TODO: [🔼] !!! Export via `@promptbook/markdown`
|
|
2849
2860
|
* TODO: [🪂] Do it in parallel 11:11
|
|
2850
2861
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
2851
2862
|
*/
|
|
@@ -2854,7 +2865,6 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
|
|
|
2854
2865
|
* Prepares the knowle
|
|
2855
2866
|
*
|
|
2856
2867
|
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
2857
|
-
* @private within the package
|
|
2858
2868
|
*/
|
|
2859
2869
|
function prepareKnowledgePieces(knowledgeSources, options) {
|
|
2860
2870
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2869,7 +2879,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
|
|
|
2869
2879
|
var partialPieces, pieces;
|
|
2870
2880
|
return __generator(this, function (_a) {
|
|
2871
2881
|
switch (_a.label) {
|
|
2872
|
-
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: !!!!! Unhardcode markdown, detect which type it is
|
|
2882
|
+
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!!!! Unhardcode markdown, detect which type it is
|
|
2873
2883
|
options)];
|
|
2874
2884
|
case 1:
|
|
2875
2885
|
partialPieces = _a.sent();
|
|
@@ -2907,6 +2917,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
2907
2917
|
> ):
|
|
2908
2918
|
*/
|
|
2909
2919
|
/**
|
|
2920
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
2910
2921
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
2911
2922
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
2912
2923
|
* TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
|
@@ -2919,7 +2930,6 @@ TODO: [🧊] This is how it can look in future
|
|
|
2919
2930
|
* Prepares the persona for the pipeline
|
|
2920
2931
|
*
|
|
2921
2932
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
2922
|
-
* @private within the package
|
|
2923
2933
|
*/
|
|
2924
2934
|
function preparePersona(personaDescription, options) {
|
|
2925
2935
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2963,9 +2973,6 @@ function preparePersona(personaDescription, options) {
|
|
|
2963
2973
|
console.info("PERSONA ".concat(personaDescription), modelRequirements);
|
|
2964
2974
|
}
|
|
2965
2975
|
modelName = modelRequirements.modelName, systemMessage = modelRequirements.systemMessage, temperature = modelRequirements.temperature;
|
|
2966
|
-
// TODO: !!! Check validity of `modelName`
|
|
2967
|
-
// TODO: !!! Check validity of `systemMessage`
|
|
2968
|
-
// TODO: !!! Check validity of `temperature`
|
|
2969
2976
|
return [2 /*return*/, {
|
|
2970
2977
|
modelVariant: 'CHAT',
|
|
2971
2978
|
modelName: modelName,
|
|
@@ -2976,6 +2983,12 @@ function preparePersona(personaDescription, options) {
|
|
|
2976
2983
|
});
|
|
2977
2984
|
});
|
|
2978
2985
|
}
|
|
2986
|
+
/**
|
|
2987
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
2988
|
+
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
2989
|
+
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
2990
|
+
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
2991
|
+
*/
|
|
2979
2992
|
|
|
2980
2993
|
/**
|
|
2981
2994
|
* Prepare pipeline from string (markdown) format to JSON format
|
|
@@ -3036,10 +3049,11 @@ function preparePipeline(pipeline, options) {
|
|
|
3036
3049
|
});
|
|
3037
3050
|
}
|
|
3038
3051
|
/**
|
|
3052
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3039
3053
|
* TODO: Write tests for `preparePipeline`
|
|
3040
3054
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3041
3055
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3042
|
-
* TODO:
|
|
3056
|
+
* TODO: [🎐] !!!! Use here countTotalUsage
|
|
3043
3057
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3044
3058
|
*/
|
|
3045
3059
|
|
|
@@ -3354,7 +3368,7 @@ var blockCommandParser = {
|
|
|
3354
3368
|
'Knowledge BLOCK',
|
|
3355
3369
|
// 'Knowledge', // <- Note: [⛱] For execution blocks which are also separate commands shortcut does not work
|
|
3356
3370
|
//---
|
|
3357
|
-
/*
|
|
3371
|
+
/* Note: Not implemented block types will be in examples in future -> */
|
|
3358
3372
|
'Instrument BLOCK',
|
|
3359
3373
|
// 'Instrument', // <- Note: [⛱]
|
|
3360
3374
|
'Action BLOCK',
|
|
@@ -3372,10 +3386,10 @@ var blockCommandParser = {
|
|
|
3372
3386
|
if (blockTypes.length !== 1) {
|
|
3373
3387
|
throw new ParsingError(spaceTrim(function (block) { return "\n Unknown block type in BLOCK command\n\n Supported block types are:\n ".concat(block(BlockTypes.join(', ')), "\n "); }));
|
|
3374
3388
|
}
|
|
3375
|
-
|
|
3389
|
+
var blockType = blockTypes[0];
|
|
3376
3390
|
return {
|
|
3377
3391
|
type: 'BLOCK',
|
|
3378
|
-
blockType:
|
|
3392
|
+
blockType: blockType,
|
|
3379
3393
|
};
|
|
3380
3394
|
},
|
|
3381
3395
|
};
|
|
@@ -3620,7 +3634,7 @@ var jokerCommandParser = {
|
|
|
3620
3634
|
|
|
3621
3635
|
var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
3622
3636
|
/**
|
|
3623
|
-
* TODO: [🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
3637
|
+
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
3624
3638
|
* TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
|
|
3625
3639
|
* [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
|
|
3626
3640
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
@@ -4080,6 +4094,7 @@ var boilerplateCommandParser = {
|
|
|
4080
4094
|
};
|
|
4081
4095
|
/**
|
|
4082
4096
|
* TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
|
|
4097
|
+
* Note: [⚪] This should never be in any released package
|
|
4083
4098
|
*/
|
|
4084
4099
|
|
|
4085
4100
|
/**
|
|
@@ -4098,7 +4113,7 @@ var COMMANDS = [
|
|
|
4098
4113
|
actionCommandParser,
|
|
4099
4114
|
instrumentCommandParser,
|
|
4100
4115
|
personaCommandParser,
|
|
4101
|
-
boilerplateCommandParser, // <- TODO:
|
|
4116
|
+
boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
|
|
4102
4117
|
];
|
|
4103
4118
|
|
|
4104
4119
|
/**
|
|
@@ -4184,7 +4199,7 @@ function parseCommand(raw, usagePlace) {
|
|
|
4184
4199
|
}));
|
|
4185
4200
|
}
|
|
4186
4201
|
/**
|
|
4187
|
-
*
|
|
4202
|
+
* @@@
|
|
4188
4203
|
*/
|
|
4189
4204
|
function getSupportedCommandsMessage() {
|
|
4190
4205
|
return COMMANDS.flatMap(function (_a) {
|
|
@@ -4195,7 +4210,7 @@ function getSupportedCommandsMessage() {
|
|
|
4195
4210
|
}).join('\n');
|
|
4196
4211
|
}
|
|
4197
4212
|
/**
|
|
4198
|
-
*
|
|
4213
|
+
* @@@
|
|
4199
4214
|
*/
|
|
4200
4215
|
function parseCommandVariant(input) {
|
|
4201
4216
|
var e_1, _a;
|
|
@@ -4926,7 +4941,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
4926
4941
|
if (command.blockType === 'KNOWLEDGE') {
|
|
4927
4942
|
knowledgeCommandParser.applyToPipelineJson(pipelineJson, {
|
|
4928
4943
|
type: 'KNOWLEDGE',
|
|
4929
|
-
source: content, // <- TODO: !!!!
|
|
4944
|
+
source: content, // <- TODO: [🐝] !!!! Work with KNOWLEDGE which not referring to the source file/wweb, but its content itself
|
|
4930
4945
|
});
|
|
4931
4946
|
return "continue-templates";
|
|
4932
4947
|
}
|
|
@@ -5064,7 +5079,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
5064
5079
|
delete template.modelRequirements;
|
|
5065
5080
|
}
|
|
5066
5081
|
// TODO: [🍧] What actually about preparation and pushing the block into `promptTemplates`
|
|
5067
|
-
pipelineJson.promptTemplates.push(template
|
|
5082
|
+
pipelineJson.promptTemplates.push(template);
|
|
5068
5083
|
};
|
|
5069
5084
|
try {
|
|
5070
5085
|
// =============================================================
|
|
@@ -5178,7 +5193,7 @@ function pipelineStringToJson(pipelineString, options) {
|
|
|
5178
5193
|
/**
|
|
5179
5194
|
* Add or modify an auto-generated section in a markdown file
|
|
5180
5195
|
*
|
|
5181
|
-
* @private within the
|
|
5196
|
+
* @private within the repository
|
|
5182
5197
|
*/
|
|
5183
5198
|
function addAutoGeneratedSection(content, options) {
|
|
5184
5199
|
var sectionName = options.sectionName, sectionContent = options.sectionContent;
|
|
@@ -5465,6 +5480,9 @@ var SimplePromptInterfaceTools = /** @class */ (function () {
|
|
|
5465
5480
|
};
|
|
5466
5481
|
return SimplePromptInterfaceTools;
|
|
5467
5482
|
}());
|
|
5483
|
+
/**
|
|
5484
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
5485
|
+
*/
|
|
5468
5486
|
|
|
5469
5487
|
/**
|
|
5470
5488
|
* Unprepare just strips the preparation data of the pipeline
|
|
@@ -5476,6 +5494,7 @@ function unpreparePipeline(pipeline) {
|
|
|
5476
5494
|
return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
|
|
5477
5495
|
}
|
|
5478
5496
|
/**
|
|
5497
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
5479
5498
|
* TODO: Write tests for `preparePipeline`
|
|
5480
5499
|
*/
|
|
5481
5500
|
|
|
@@ -5490,7 +5509,7 @@ var ExecutionReportStringOptionsDefaults = {
|
|
|
5490
5509
|
/**
|
|
5491
5510
|
* Format either small or big number
|
|
5492
5511
|
*
|
|
5493
|
-
* @private within the
|
|
5512
|
+
* @private within the repository
|
|
5494
5513
|
*/
|
|
5495
5514
|
function formatNumber(value) {
|
|
5496
5515
|
if (value === 0) {
|
|
@@ -5510,7 +5529,7 @@ function formatNumber(value) {
|
|
|
5510
5529
|
/**
|
|
5511
5530
|
* Create a markdown table from a 2D array of strings
|
|
5512
5531
|
*
|
|
5513
|
-
* @private within the
|
|
5532
|
+
* @private within the repository
|
|
5514
5533
|
*/
|
|
5515
5534
|
function createMarkdownTable(table) {
|
|
5516
5535
|
var columnWidths = table.reduce(function (widths, row) {
|
|
@@ -5538,7 +5557,7 @@ function createMarkdownTable(table) {
|
|
|
5538
5557
|
/**
|
|
5539
5558
|
* Function createMarkdownChart will draw a chart in markdown from ⬛+🟦 tiles
|
|
5540
5559
|
*
|
|
5541
|
-
* @private within the
|
|
5560
|
+
* @private within the repository
|
|
5542
5561
|
*/
|
|
5543
5562
|
function createMarkdownChart(options) {
|
|
5544
5563
|
var e_1, _a;
|
|
@@ -5587,6 +5606,7 @@ function escapeMarkdownBlock(value) {
|
|
|
5587
5606
|
*
|
|
5588
5607
|
* @param value any values
|
|
5589
5608
|
* @returns the same values
|
|
5609
|
+
* @private within the repository
|
|
5590
5610
|
*/
|
|
5591
5611
|
function just(value) {
|
|
5592
5612
|
if (value === undefined) {
|
|
@@ -5607,7 +5627,7 @@ var MOMENT_ARG_THRESHOLDS = {
|
|
|
5607
5627
|
/**
|
|
5608
5628
|
* Count the duration of working time
|
|
5609
5629
|
*
|
|
5610
|
-
* @private within the
|
|
5630
|
+
* @private within the repository
|
|
5611
5631
|
*/
|
|
5612
5632
|
function countWorkingDuration(items) {
|
|
5613
5633
|
var e_1, _a;
|