@promptbook/cli 0.69.0-14 → 0.69.0-16
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/README.md +4 -0
- package/esm/index.es.js +91 -49
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +0 -3
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -1
- package/esm/typings/src/config.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +91 -49
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/{personas/preparePersona.test.d.ts → collection/constructors/createCollectionFromDirectory.test.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
/**
|
|
40
40
|
* The version of the Promptbook library
|
|
41
41
|
*/
|
|
42
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
43
|
-
// TODO: !!!! List here all the versions and annotate + put into script
|
|
42
|
+
var PROMPTBOOK_VERSION = '0.69.0-15';
|
|
43
|
+
// TODO:[main] !!!! List here all the versions and annotate + put into script
|
|
44
44
|
|
|
45
45
|
/*! *****************************************************************************
|
|
46
46
|
Copyright (c) Microsoft Corporation.
|
|
@@ -375,7 +375,7 @@
|
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
377
|
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
378
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
378
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
379
379
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
380
380
|
*/
|
|
381
381
|
|
|
@@ -700,7 +700,7 @@
|
|
|
700
700
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
701
701
|
}
|
|
702
702
|
commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
|
|
703
|
-
// TODO: !!! This increase size of the bundle and is probbably not necessary
|
|
703
|
+
// TODO:[main] !!! This increase size of the bundle and is probbably not necessary
|
|
704
704
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
705
705
|
try {
|
|
706
706
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -848,12 +848,12 @@
|
|
|
848
848
|
pipelineString += '```' + contentLanguage;
|
|
849
849
|
pipelineString += '\n';
|
|
850
850
|
pipelineString += spaceTrim__default["default"](content);
|
|
851
|
-
// <- TODO: !!! Escape
|
|
851
|
+
// <- TODO:[main] !!! Escape
|
|
852
852
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
853
853
|
pipelineString += '\n';
|
|
854
854
|
pipelineString += '```';
|
|
855
855
|
pipelineString += '\n\n';
|
|
856
|
-
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
|
|
856
|
+
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
859
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -1080,7 +1080,7 @@
|
|
|
1080
1080
|
});
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",
|
|
1083
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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- Title should be concise and clear\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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",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}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",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- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the 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\nPick from the following models:\n\n- {availableModelNames}\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:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1084
1084
|
|
|
1085
1085
|
/**
|
|
1086
1086
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1155,7 +1155,7 @@
|
|
|
1155
1155
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
1156
1156
|
return false;
|
|
1157
1157
|
}
|
|
1158
|
-
// <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
1158
|
+
// <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
1159
1159
|
return true;
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
@@ -1324,7 +1324,7 @@
|
|
|
1324
1324
|
// <- Note: [🚲]
|
|
1325
1325
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1326
1326
|
}
|
|
1327
|
-
if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
1327
|
+
if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
1328
1328
|
// <- Note: [🚲]
|
|
1329
1329
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1330
1330
|
}
|
|
@@ -1507,7 +1507,7 @@
|
|
|
1507
1507
|
}
|
|
1508
1508
|
}
|
|
1509
1509
|
/**
|
|
1510
|
-
* TODO:
|
|
1510
|
+
* TODO: !!!!! [🧞♀️] Do not allow joker + foreach
|
|
1511
1511
|
* TODO: [🧠] Work with promptbookVersion
|
|
1512
1512
|
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
1513
1513
|
* > /**
|
|
@@ -1519,11 +1519,11 @@
|
|
|
1519
1519
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
1520
1520
|
*/
|
|
1521
1521
|
/**
|
|
1522
|
-
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
1523
|
-
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
1524
|
-
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
1525
|
-
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1526
|
-
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
1522
|
+
* TODO: [🐣][main] !!!! Validate that all samples match expectations
|
|
1523
|
+
* TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
|
|
1524
|
+
* TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
|
|
1525
|
+
* TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1526
|
+
* TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
|
|
1527
1527
|
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
1528
1528
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
1529
1529
|
*/
|
|
@@ -2251,7 +2251,7 @@
|
|
|
2251
2251
|
return true;
|
|
2252
2252
|
}
|
|
2253
2253
|
/**
|
|
2254
|
-
* TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
2254
|
+
* TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
2255
2255
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
2256
2256
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2257
2257
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -2303,9 +2303,10 @@
|
|
|
2303
2303
|
});
|
|
2304
2304
|
Object.defineProperty(MultipleLlmExecutionTools.prototype, "description", {
|
|
2305
2305
|
get: function () {
|
|
2306
|
-
return this.llmExecutionTools
|
|
2307
|
-
|
|
2308
|
-
.
|
|
2306
|
+
return this.llmExecutionTools.map(function (_a, index) {
|
|
2307
|
+
var title = _a.title;
|
|
2308
|
+
return "".concat(index + 1, ") `").concat(title, "`");
|
|
2309
|
+
}).join('\n');
|
|
2309
2310
|
},
|
|
2310
2311
|
enumerable: false,
|
|
2311
2312
|
configurable: true
|
|
@@ -2503,7 +2504,7 @@
|
|
|
2503
2504
|
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
2504
2505
|
}
|
|
2505
2506
|
else {
|
|
2506
|
-
throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\"\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.
|
|
2507
|
+
throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\"\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.description), "\n\n "); }));
|
|
2507
2508
|
}
|
|
2508
2509
|
}
|
|
2509
2510
|
});
|
|
@@ -4661,7 +4662,7 @@
|
|
|
4661
4662
|
outputParameters = result.outputParameters;
|
|
4662
4663
|
knowledgePiecesRaw = outputParameters.knowledgePieces;
|
|
4663
4664
|
knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
|
|
4664
|
-
// <- TODO: !!!!! Smarter split and filter out empty pieces
|
|
4665
|
+
// <- TODO:[main] !!!!! Smarter split and filter out empty pieces
|
|
4665
4666
|
if (isVerbose) {
|
|
4666
4667
|
console.info('knowledgeTextPieces:', knowledgeTextPieces);
|
|
4667
4668
|
}
|
|
@@ -4746,7 +4747,7 @@
|
|
|
4746
4747
|
});
|
|
4747
4748
|
}
|
|
4748
4749
|
/**
|
|
4749
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
4750
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
|
|
4750
4751
|
* TODO: [🪂] Do it in parallel 11:11
|
|
4751
4752
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
4752
4753
|
*/
|
|
@@ -4770,7 +4771,7 @@
|
|
|
4770
4771
|
var partialPieces, pieces;
|
|
4771
4772
|
return __generator(this, function (_a) {
|
|
4772
4773
|
switch (_a.label) {
|
|
4773
|
-
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
|
|
4774
|
+
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
|
|
4774
4775
|
options)];
|
|
4775
4776
|
case 1:
|
|
4776
4777
|
partialPieces = _a.sent();
|
|
@@ -4962,7 +4963,7 @@
|
|
|
4962
4963
|
});
|
|
4963
4964
|
}
|
|
4964
4965
|
/**
|
|
4965
|
-
* TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
4966
|
+
* TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
4966
4967
|
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
4967
4968
|
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
4968
4969
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
@@ -5011,7 +5012,7 @@
|
|
|
5011
5012
|
case 0:
|
|
5012
5013
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
5013
5014
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5014
|
-
// TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
5015
|
+
// TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
5015
5016
|
TODO_USE(parameters);
|
|
5016
5017
|
templatesPrepared = new Array(
|
|
5017
5018
|
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
@@ -5043,7 +5044,7 @@
|
|
|
5043
5044
|
/**
|
|
5044
5045
|
* TODO: [🧠] Add context to each template (if missing)
|
|
5045
5046
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
5046
|
-
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
5047
|
+
* TODO: [♨][main] !!! Prepare index the samples and maybe templates
|
|
5047
5048
|
* TODO: Write tests for `preparePipeline`
|
|
5048
5049
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
5049
5050
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -5215,7 +5216,7 @@
|
|
|
5215
5216
|
if (sourceContent === '') {
|
|
5216
5217
|
throw new ParseError("Source is not defined");
|
|
5217
5218
|
}
|
|
5218
|
-
// TODO: !!!! Following checks should be applied every link in the `sourceContent`
|
|
5219
|
+
// TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
|
|
5219
5220
|
if (sourceContent.startsWith('http://')) {
|
|
5220
5221
|
throw new ParseError("Source is not secure");
|
|
5221
5222
|
}
|
|
@@ -5418,7 +5419,7 @@
|
|
|
5418
5419
|
if (command.templateType === 'KNOWLEDGE') {
|
|
5419
5420
|
knowledgeCommandParser.$applyToPipelineJson({
|
|
5420
5421
|
type: 'KNOWLEDGE',
|
|
5421
|
-
sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
5422
|
+
sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
5422
5423
|
}, $pipelineJson);
|
|
5423
5424
|
$templateJson.isTemplate = false;
|
|
5424
5425
|
return;
|
|
@@ -5936,7 +5937,7 @@
|
|
|
5936
5937
|
/**
|
|
5937
5938
|
* Link to discussion
|
|
5938
5939
|
*/
|
|
5939
|
-
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions
|
|
5940
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/148',
|
|
5940
5941
|
/**
|
|
5941
5942
|
* Example usages of the FOREACH command
|
|
5942
5943
|
*/
|
|
@@ -5944,7 +5945,6 @@
|
|
|
5944
5945
|
'FOREACH Text Line `{customers}` -> `{customer}`',
|
|
5945
5946
|
'FOR Csv Row `{customers}` -> `{firstName}`, `{lastName}`',
|
|
5946
5947
|
'EACH Csv Cell `{customers}` -> `{cell}`',
|
|
5947
|
-
// <- TODO: [🍭] !!!!!! More
|
|
5948
5948
|
],
|
|
5949
5949
|
/**
|
|
5950
5950
|
* Parses the FOREACH command
|
|
@@ -5959,7 +5959,6 @@
|
|
|
5959
5959
|
return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(formatName);
|
|
5960
5960
|
});
|
|
5961
5961
|
if (formatDefinition === undefined) {
|
|
5962
|
-
console.info({ args: args, formatName: formatName });
|
|
5963
5962
|
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unsupported format \"".concat(formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
|
|
5964
5963
|
.map(function (formatName) { return "- ".concat(formatName); })
|
|
5965
5964
|
.join('\n')), "\n "); }));
|
|
@@ -5969,7 +5968,6 @@
|
|
|
5969
5968
|
return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(cellName);
|
|
5970
5969
|
});
|
|
5971
5970
|
if (subvalueDefinition === undefined) {
|
|
5972
|
-
console.info({ args: args, cellName: cellName });
|
|
5973
5971
|
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unsupported cell name \"".concat(cellName, "\" for format \"").concat(formatName, "\"\n\n Available cell names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
|
|
5974
5972
|
.map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
|
|
5975
5973
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
@@ -5977,14 +5975,12 @@
|
|
|
5977
5975
|
// <- TODO: [🏢] List all supported cell names for the format
|
|
5978
5976
|
}
|
|
5979
5977
|
if (assignSign !== '->') {
|
|
5980
|
-
console.info({ args: args, assignSign: assignSign });
|
|
5981
5978
|
throw new ParseError("FOREACH command must have '->' to assign the value to the parameter");
|
|
5982
5979
|
}
|
|
5983
|
-
// TODO:
|
|
5980
|
+
// TODO: !!! Replace with propper parameter name validation `validateParameterName`
|
|
5984
5981
|
if ((parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(0, 1)) !== '{' ||
|
|
5985
5982
|
(parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(parameterNameWrapped.length - 1, parameterNameWrapped.length)) !== '}') {
|
|
5986
|
-
|
|
5987
|
-
throw new ParseError("!!!!!! 1 Here will be error (with rules and precise error) from validateParameterName");
|
|
5983
|
+
throw new ParseError("Invalid parameter name \"".concat(parameterNameWrapped, "\" - must be wrapped in curly brackets: {parameterName}"));
|
|
5988
5984
|
}
|
|
5989
5985
|
var parameterName = parameterNameWrapped.substring(1, parameterNameWrapped.length - 1);
|
|
5990
5986
|
var subparameterNames = args
|
|
@@ -6013,7 +6009,7 @@
|
|
|
6013
6009
|
// TODO: !!!!!! Detect double use
|
|
6014
6010
|
// TODO: !!!!!! Detect usage with JOKER and don't allow it
|
|
6015
6011
|
$templateJson.foreach = { formatName: formatName, cellName: cellName, parameterName: parameterName, subparameterNames: subparameterNames };
|
|
6016
|
-
keepUnused($pipelineJson); // <- TODO:
|
|
6012
|
+
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6017
6013
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6018
6014
|
},
|
|
6019
6015
|
/**
|
|
@@ -6036,7 +6032,6 @@
|
|
|
6036
6032
|
},
|
|
6037
6033
|
};
|
|
6038
6034
|
/**
|
|
6039
|
-
* TODO: !!!!!! Remove console logs
|
|
6040
6035
|
* TODO: [🧠][🦥] Better (less confusing) name for "cell" / "subvalue" / "subparameter"
|
|
6041
6036
|
* TODO: [🍭] !!!!!! Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
|
|
6042
6037
|
*/
|
|
@@ -6721,6 +6716,7 @@
|
|
|
6721
6716
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
6722
6717
|
*/
|
|
6723
6718
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6719
|
+
// TODO: Warn if the version is overridden
|
|
6724
6720
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
6725
6721
|
},
|
|
6726
6722
|
/**
|
|
@@ -7541,7 +7537,7 @@
|
|
|
7541
7537
|
var $pipelineJson = {
|
|
7542
7538
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
7543
7539
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
7544
|
-
promptbookVersion:
|
|
7540
|
+
promptbookVersion: undefined /* <- Note: By default no explicit version */,
|
|
7545
7541
|
description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
|
|
7546
7542
|
parameters: [],
|
|
7547
7543
|
templates: [],
|
|
@@ -7832,7 +7828,7 @@
|
|
|
7832
7828
|
return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
|
|
7833
7829
|
}
|
|
7834
7830
|
/**
|
|
7835
|
-
* TODO: !!!! Warn if used only sync version
|
|
7831
|
+
* TODO:[main] !!!! Warn if used only sync version
|
|
7836
7832
|
* TODO: [🚞] Report here line/column of error
|
|
7837
7833
|
* TODO: Use spaceTrim more effectively
|
|
7838
7834
|
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
@@ -8337,7 +8333,7 @@
|
|
|
8337
8333
|
}
|
|
8338
8334
|
}
|
|
8339
8335
|
/**
|
|
8340
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
8336
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
8341
8337
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
8342
8338
|
*/
|
|
8343
8339
|
|
|
@@ -9198,7 +9194,7 @@
|
|
|
9198
9194
|
});
|
|
9199
9195
|
}
|
|
9200
9196
|
/**
|
|
9201
|
-
* TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
|
|
9197
|
+
* TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
|
|
9202
9198
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
9203
9199
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
9204
9200
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
@@ -9616,7 +9612,7 @@
|
|
|
9616
9612
|
socket.on('connect', function () {
|
|
9617
9613
|
resolve(socket);
|
|
9618
9614
|
});
|
|
9619
|
-
// TODO: !!!! Better timeout handling
|
|
9615
|
+
// TODO:[main] !!!! Better timeout handling
|
|
9620
9616
|
setTimeout(function () {
|
|
9621
9617
|
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
9622
9618
|
}, CONNECTION_TIMEOUT_MS);
|
|
@@ -9796,11 +9792,11 @@
|
|
|
9796
9792
|
output: computeUsage("$2.40 / 1M tokens"),
|
|
9797
9793
|
},
|
|
9798
9794
|
},
|
|
9799
|
-
// TODO: !!! Claude 1 and 2 has also completion versions - ask Hoagy
|
|
9795
|
+
// TODO:[main] !!! Claude 1 and 2 has also completion versions - ask Hoagy
|
|
9800
9796
|
]);
|
|
9801
9797
|
/**
|
|
9802
9798
|
* Note: [🤖] Add models of new variant
|
|
9803
|
-
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
9799
|
+
* TODO: [🧠][main] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
9804
9800
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
9805
9801
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
9806
9802
|
* TODO: [🎰] Some mechanism to auto-update available models
|
|
@@ -10156,8 +10152,8 @@
|
|
|
10156
10152
|
className: 'AnthropicClaudeExecutionTools',
|
|
10157
10153
|
});
|
|
10158
10154
|
/**
|
|
10159
|
-
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
10160
|
-
* TODO: [🧠][🧱] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
10155
|
+
* TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
|
|
10156
|
+
* TODO: [🧠][🧱][main] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
10161
10157
|
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
10162
10158
|
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
10163
10159
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
@@ -10535,6 +10531,7 @@
|
|
|
10535
10531
|
prompt: computeUsage("$5.00 / 1M tokens"),
|
|
10536
10532
|
output: computeUsage("$15.00 / 1M tokens"),
|
|
10537
10533
|
},
|
|
10534
|
+
//TODO:[main] !!!!!! Add gpt-4o-mini-2024-07-18 and all others to be up to date
|
|
10538
10535
|
},
|
|
10539
10536
|
/**/
|
|
10540
10537
|
/**/
|
|
@@ -10549,6 +10546,51 @@
|
|
|
10549
10546
|
},
|
|
10550
10547
|
/**/
|
|
10551
10548
|
/**/
|
|
10549
|
+
{
|
|
10550
|
+
modelVariant: 'CHAT',
|
|
10551
|
+
modelTitle: 'o1-preview',
|
|
10552
|
+
modelName: 'o1-preview',
|
|
10553
|
+
pricing: {
|
|
10554
|
+
prompt: computeUsage("$15.00 / 1M tokens"),
|
|
10555
|
+
output: computeUsage("$60.00 / 1M tokens"),
|
|
10556
|
+
},
|
|
10557
|
+
},
|
|
10558
|
+
/**/
|
|
10559
|
+
/**/
|
|
10560
|
+
{
|
|
10561
|
+
modelVariant: 'CHAT',
|
|
10562
|
+
modelTitle: 'o1-preview-2024-09-12',
|
|
10563
|
+
modelName: 'o1-preview-2024-09-12',
|
|
10564
|
+
// <- TODO:[main] !!!!!! Some better system to organize theese date suffixes and versions
|
|
10565
|
+
pricing: {
|
|
10566
|
+
prompt: computeUsage("$15.00 / 1M tokens"),
|
|
10567
|
+
output: computeUsage("$60.00 / 1M tokens"),
|
|
10568
|
+
},
|
|
10569
|
+
},
|
|
10570
|
+
/**/
|
|
10571
|
+
/**/
|
|
10572
|
+
{
|
|
10573
|
+
modelVariant: 'CHAT',
|
|
10574
|
+
modelTitle: 'o1-mini',
|
|
10575
|
+
modelName: 'o1-mini',
|
|
10576
|
+
pricing: {
|
|
10577
|
+
prompt: computeUsage("$3.00 / 1M tokens"),
|
|
10578
|
+
output: computeUsage("$12.00 / 1M tokens"),
|
|
10579
|
+
},
|
|
10580
|
+
},
|
|
10581
|
+
/**/
|
|
10582
|
+
/**/
|
|
10583
|
+
{
|
|
10584
|
+
modelVariant: 'CHAT',
|
|
10585
|
+
modelTitle: 'o1-mini-2024-09-12',
|
|
10586
|
+
modelName: 'o1-mini-2024-09-12',
|
|
10587
|
+
pricing: {
|
|
10588
|
+
prompt: computeUsage("$3.00 / 1M tokens"),
|
|
10589
|
+
output: computeUsage("$12.00 / 1M tokens"),
|
|
10590
|
+
},
|
|
10591
|
+
},
|
|
10592
|
+
/**/
|
|
10593
|
+
/**/
|
|
10552
10594
|
{
|
|
10553
10595
|
modelVariant: 'CHAT',
|
|
10554
10596
|
modelTitle: 'gpt-3.5-turbo-16k-0613',
|
|
@@ -10637,7 +10679,7 @@
|
|
|
10637
10679
|
AzureOpenAiExecutionTools.prototype.listModels = function () {
|
|
10638
10680
|
return __awaiter(this, void 0, void 0, function () {
|
|
10639
10681
|
return __generator(this, function (_a) {
|
|
10640
|
-
// TODO: !!! Do here some filtering which models are really available as deployment
|
|
10682
|
+
// TODO:[main] !!! Do here some filtering which models are really available as deployment
|
|
10641
10683
|
// @see https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments?api-version=2023-05-01
|
|
10642
10684
|
return [2 /*return*/, OPENAI_MODELS.map(function (_a) {
|
|
10643
10685
|
var modelTitle = _a.modelTitle, modelName = _a.modelName, modelVariant = _a.modelVariant;
|
|
@@ -11328,7 +11370,7 @@
|
|
|
11328
11370
|
* @public exported from `@promptbook/openai`
|
|
11329
11371
|
*/
|
|
11330
11372
|
var createOpenAiExecutionTools = Object.assign(function (options) {
|
|
11331
|
-
// TODO: [🧠] !!!! If browser, auto add `dangerouslyAllowBrowser`
|
|
11373
|
+
// TODO: [🧠][main] !!!! If browser, auto add `dangerouslyAllowBrowser`
|
|
11332
11374
|
if (($isRunningInBrowser() || $isRunningInWebWorker()) && !options.dangerouslyAllowBrowser) {
|
|
11333
11375
|
options = __assign(__assign({}, options), { dangerouslyAllowBrowser: true });
|
|
11334
11376
|
}
|