@promptbook/node 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 +40 -21
- 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 +2 -2
- package/umd/index.umd.js +40 -21
- 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
|
@@ -144,6 +144,10 @@ var RESERVED_PARAMETER_NAMES = [
|
|
|
144
144
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
145
145
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
146
146
|
];
|
|
147
|
+
/*
|
|
148
|
+
TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
|
|
149
|
+
*/
|
|
150
|
+
// [🟡][🟢][🔵][⚪]
|
|
147
151
|
|
|
148
152
|
/**
|
|
149
153
|
* Function `addUsage` will add multiple usages into one
|
|
@@ -310,7 +314,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
310
314
|
});
|
|
311
315
|
}
|
|
312
316
|
|
|
313
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
317
|
+
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"}];
|
|
314
318
|
|
|
315
319
|
/**
|
|
316
320
|
* Prettify the html code
|
|
@@ -550,7 +554,7 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
|
|
|
550
554
|
return parameterString;
|
|
551
555
|
}
|
|
552
556
|
/**
|
|
553
|
-
* TODO:
|
|
557
|
+
* TODO: !!!! Implement new features and commands into `promptTemplateParameterJsonToString`
|
|
554
558
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
555
559
|
* TODO: Escape all
|
|
556
560
|
*/
|
|
@@ -928,7 +932,9 @@ function validatePipeline(pipeline) {
|
|
|
928
932
|
* > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
|
|
929
933
|
*/
|
|
930
934
|
/**
|
|
931
|
-
* TODO: [🧠]
|
|
935
|
+
* TODO: [🧠][🐣] !!!! Validate that all samples match expectations
|
|
936
|
+
* TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
|
|
937
|
+
* TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
932
938
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
933
939
|
*/
|
|
934
940
|
|
|
@@ -971,7 +977,7 @@ var SimplePipelineCollection = /** @class */ (function () {
|
|
|
971
977
|
/**
|
|
972
978
|
* Constructs a pipeline collection from promptbooks
|
|
973
979
|
*
|
|
974
|
-
* @param promptbooks
|
|
980
|
+
* @param promptbooks @@@
|
|
975
981
|
*
|
|
976
982
|
* @private Use instead `createCollectionFromJson`
|
|
977
983
|
* Note: During the construction logic of all promptbooks are validated
|
|
@@ -1730,8 +1736,11 @@ function arrayableToArray(input) {
|
|
|
1730
1736
|
/**
|
|
1731
1737
|
* The version of the Promptbook library
|
|
1732
1738
|
*/
|
|
1733
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
1739
|
+
var PROMPTBOOK_VERSION = '0.61.0-11';
|
|
1734
1740
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
1741
|
+
/**
|
|
1742
|
+
* TODO: [🔼] !!! Export via `@promptbook/code`
|
|
1743
|
+
*/
|
|
1735
1744
|
|
|
1736
1745
|
/**
|
|
1737
1746
|
* Counts number of characters in the text
|
|
@@ -2454,6 +2463,7 @@ function createPipelineExecutor(options) {
|
|
|
2454
2463
|
*
|
|
2455
2464
|
* @param value any values
|
|
2456
2465
|
* @returns void
|
|
2466
|
+
* @private within the repository
|
|
2457
2467
|
*/
|
|
2458
2468
|
function TODO_USE() {
|
|
2459
2469
|
var value = [];
|
|
@@ -2589,6 +2599,7 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
|
|
|
2589
2599
|
});
|
|
2590
2600
|
}
|
|
2591
2601
|
/**
|
|
2602
|
+
* TODO: [🔼] !!! Export via `@promptbook/markdown`
|
|
2592
2603
|
* TODO: [🪂] Do it in parallel 11:11
|
|
2593
2604
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
2594
2605
|
*/
|
|
@@ -2597,7 +2608,6 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
|
|
|
2597
2608
|
* Prepares the knowle
|
|
2598
2609
|
*
|
|
2599
2610
|
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
2600
|
-
* @private within the package
|
|
2601
2611
|
*/
|
|
2602
2612
|
function prepareKnowledgePieces(knowledgeSources, options) {
|
|
2603
2613
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2612,7 +2622,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
|
|
|
2612
2622
|
var partialPieces, pieces;
|
|
2613
2623
|
return __generator(this, function (_a) {
|
|
2614
2624
|
switch (_a.label) {
|
|
2615
|
-
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: !!!!! Unhardcode markdown, detect which type it is
|
|
2625
|
+
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!!!! Unhardcode markdown, detect which type it is
|
|
2616
2626
|
options)];
|
|
2617
2627
|
case 1:
|
|
2618
2628
|
partialPieces = _a.sent();
|
|
@@ -2650,6 +2660,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
2650
2660
|
> ):
|
|
2651
2661
|
*/
|
|
2652
2662
|
/**
|
|
2663
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
2653
2664
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
2654
2665
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
2655
2666
|
* TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
|
@@ -2662,7 +2673,6 @@ TODO: [🧊] This is how it can look in future
|
|
|
2662
2673
|
* Prepares the persona for the pipeline
|
|
2663
2674
|
*
|
|
2664
2675
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
2665
|
-
* @private within the package
|
|
2666
2676
|
*/
|
|
2667
2677
|
function preparePersona(personaDescription, options) {
|
|
2668
2678
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2706,9 +2716,6 @@ function preparePersona(personaDescription, options) {
|
|
|
2706
2716
|
console.info("PERSONA ".concat(personaDescription), modelRequirements);
|
|
2707
2717
|
}
|
|
2708
2718
|
modelName = modelRequirements.modelName, systemMessage = modelRequirements.systemMessage, temperature = modelRequirements.temperature;
|
|
2709
|
-
// TODO: !!! Check validity of `modelName`
|
|
2710
|
-
// TODO: !!! Check validity of `systemMessage`
|
|
2711
|
-
// TODO: !!! Check validity of `temperature`
|
|
2712
2719
|
return [2 /*return*/, {
|
|
2713
2720
|
modelVariant: 'CHAT',
|
|
2714
2721
|
modelName: modelName,
|
|
@@ -2719,6 +2726,12 @@ function preparePersona(personaDescription, options) {
|
|
|
2719
2726
|
});
|
|
2720
2727
|
});
|
|
2721
2728
|
}
|
|
2729
|
+
/**
|
|
2730
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
2731
|
+
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
2732
|
+
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
2733
|
+
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
2734
|
+
*/
|
|
2722
2735
|
|
|
2723
2736
|
/**
|
|
2724
2737
|
* Prepare pipeline from string (markdown) format to JSON format
|
|
@@ -2779,10 +2792,11 @@ function preparePipeline(pipeline, options) {
|
|
|
2779
2792
|
});
|
|
2780
2793
|
}
|
|
2781
2794
|
/**
|
|
2795
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
2782
2796
|
* TODO: Write tests for `preparePipeline`
|
|
2783
2797
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
2784
2798
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
2785
|
-
* TODO:
|
|
2799
|
+
* TODO: [🎐] !!!! Use here countTotalUsage
|
|
2786
2800
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
2787
2801
|
*/
|
|
2788
2802
|
|
|
@@ -3114,7 +3128,7 @@ var blockCommandParser = {
|
|
|
3114
3128
|
'Knowledge BLOCK',
|
|
3115
3129
|
// 'Knowledge', // <- Note: [⛱] For execution blocks which are also separate commands shortcut does not work
|
|
3116
3130
|
//---
|
|
3117
|
-
/*
|
|
3131
|
+
/* Note: Not implemented block types will be in examples in future -> */
|
|
3118
3132
|
'Instrument BLOCK',
|
|
3119
3133
|
// 'Instrument', // <- Note: [⛱]
|
|
3120
3134
|
'Action BLOCK',
|
|
@@ -3132,10 +3146,10 @@ var blockCommandParser = {
|
|
|
3132
3146
|
if (blockTypes.length !== 1) {
|
|
3133
3147
|
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 "); }));
|
|
3134
3148
|
}
|
|
3135
|
-
|
|
3149
|
+
var blockType = blockTypes[0];
|
|
3136
3150
|
return {
|
|
3137
3151
|
type: 'BLOCK',
|
|
3138
|
-
blockType:
|
|
3152
|
+
blockType: blockType,
|
|
3139
3153
|
};
|
|
3140
3154
|
},
|
|
3141
3155
|
};
|
|
@@ -3380,7 +3394,7 @@ var jokerCommandParser = {
|
|
|
3380
3394
|
|
|
3381
3395
|
var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
3382
3396
|
/**
|
|
3383
|
-
* TODO: [🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
3397
|
+
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
3384
3398
|
* TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
|
|
3385
3399
|
* [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
|
|
3386
3400
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
@@ -3840,6 +3854,7 @@ var boilerplateCommandParser = {
|
|
|
3840
3854
|
};
|
|
3841
3855
|
/**
|
|
3842
3856
|
* TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
|
|
3857
|
+
* Note: [⚪] This should never be in any released package
|
|
3843
3858
|
*/
|
|
3844
3859
|
|
|
3845
3860
|
/**
|
|
@@ -3858,7 +3873,7 @@ var COMMANDS = [
|
|
|
3858
3873
|
actionCommandParser,
|
|
3859
3874
|
instrumentCommandParser,
|
|
3860
3875
|
personaCommandParser,
|
|
3861
|
-
boilerplateCommandParser, // <- TODO:
|
|
3876
|
+
boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
|
|
3862
3877
|
];
|
|
3863
3878
|
|
|
3864
3879
|
/**
|
|
@@ -3944,7 +3959,7 @@ function parseCommand(raw, usagePlace) {
|
|
|
3944
3959
|
}));
|
|
3945
3960
|
}
|
|
3946
3961
|
/**
|
|
3947
|
-
*
|
|
3962
|
+
* @@@
|
|
3948
3963
|
*/
|
|
3949
3964
|
function getSupportedCommandsMessage() {
|
|
3950
3965
|
return COMMANDS.flatMap(function (_a) {
|
|
@@ -3955,7 +3970,7 @@ function getSupportedCommandsMessage() {
|
|
|
3955
3970
|
}).join('\n');
|
|
3956
3971
|
}
|
|
3957
3972
|
/**
|
|
3958
|
-
*
|
|
3973
|
+
* @@@
|
|
3959
3974
|
*/
|
|
3960
3975
|
function parseCommandVariant(input) {
|
|
3961
3976
|
var e_1, _a;
|
|
@@ -4686,7 +4701,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
4686
4701
|
if (command.blockType === 'KNOWLEDGE') {
|
|
4687
4702
|
knowledgeCommandParser.applyToPipelineJson(pipelineJson, {
|
|
4688
4703
|
type: 'KNOWLEDGE',
|
|
4689
|
-
source: content, // <- TODO: !!!!
|
|
4704
|
+
source: content, // <- TODO: [🐝] !!!! Work with KNOWLEDGE which not referring to the source file/wweb, but its content itself
|
|
4690
4705
|
});
|
|
4691
4706
|
return "continue-templates";
|
|
4692
4707
|
}
|
|
@@ -4824,7 +4839,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
4824
4839
|
delete template.modelRequirements;
|
|
4825
4840
|
}
|
|
4826
4841
|
// TODO: [🍧] What actually about preparation and pushing the block into `promptTemplates`
|
|
4827
|
-
pipelineJson.promptTemplates.push(template
|
|
4842
|
+
pipelineJson.promptTemplates.push(template);
|
|
4828
4843
|
};
|
|
4829
4844
|
try {
|
|
4830
4845
|
// =============================================================
|
|
@@ -4961,6 +4976,9 @@ var isRunningInNode = new Function("\n try {\n return this === global;
|
|
|
4961
4976
|
* Detects if the code is running in a web worker
|
|
4962
4977
|
*/
|
|
4963
4978
|
new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
4979
|
+
/**
|
|
4980
|
+
* TODO: [🔼] !!! Export via `@promptbook/utils`
|
|
4981
|
+
*/
|
|
4964
4982
|
|
|
4965
4983
|
/**
|
|
4966
4984
|
* Constructs Promptbook from async sources
|
|
@@ -5271,6 +5289,7 @@ function listAllFiles(path, isRecursive) {
|
|
|
5271
5289
|
}
|
|
5272
5290
|
/**
|
|
5273
5291
|
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
5292
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
5274
5293
|
*/
|
|
5275
5294
|
|
|
5276
5295
|
export { PROMPTBOOK_VERSION, createCollectionFromDirectory };
|