@promptbook/core 0.61.0-18 → 0.61.0-19
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 +83 -77
- package/esm/index.es.js.map +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +83 -77
- package/umd/index.umd.js.map +1 -1
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -965,17 +965,23 @@
|
|
|
965
965
|
try {
|
|
966
966
|
for (var pipelines_1 = __values(pipelines), pipelines_1_1 = pipelines_1.next(); !pipelines_1_1.done; pipelines_1_1 = pipelines_1.next()) {
|
|
967
967
|
var pipeline = pipelines_1_1.value;
|
|
968
|
+
// TODO: [👠] DRY
|
|
968
969
|
if (pipeline.pipelineUrl === undefined) {
|
|
969
970
|
throw new ReferenceError$1(spaceTrim.spaceTrim("\n Pipeline with name \"".concat(pipeline.title, "\" does not have defined URL\n\n File:\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines without URLs are called anonymous pipelines\n They can be used as standalone pipelines, but they cannot be referenced by other pipelines\n And also they cannot be used in the pipeline collection\n\n ")));
|
|
970
971
|
}
|
|
972
|
+
// Note: [🐨]
|
|
971
973
|
validatePipeline(pipeline);
|
|
974
|
+
// TODO: [🦄] DRY
|
|
972
975
|
// Note: [🦄]
|
|
973
|
-
if (
|
|
976
|
+
if (
|
|
977
|
+
// TODO: [🐽]
|
|
978
|
+
this.collection.has(pipeline.pipelineUrl) &&
|
|
974
979
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
975
980
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
976
981
|
var existing = this.collection.get(pipeline.pipelineUrl);
|
|
977
982
|
throw new ReferenceError$1(spaceTrim.spaceTrim("\n Pipeline with URL \"".concat(pipeline.pipelineUrl, "\" is already in the collection\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
|
|
978
983
|
}
|
|
984
|
+
// Note: [🧠] Overwrite existing pipeline with the same URL
|
|
979
985
|
this.collection.set(pipeline.pipelineUrl, pipeline);
|
|
980
986
|
}
|
|
981
987
|
}
|
|
@@ -1446,7 +1452,7 @@
|
|
|
1446
1452
|
});
|
|
1447
1453
|
}
|
|
1448
1454
|
|
|
1449
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
1455
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-18",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-18",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-18",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-18",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-18",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-18",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-18",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:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-18",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"}];
|
|
1450
1456
|
|
|
1451
1457
|
var defaultDiacriticsRemovalMap = [
|
|
1452
1458
|
{
|
|
@@ -1826,39 +1832,6 @@
|
|
|
1826
1832
|
* TODO: [🧠] Can this return type be better typed than void
|
|
1827
1833
|
*/
|
|
1828
1834
|
|
|
1829
|
-
/**
|
|
1830
|
-
* Create difference set of two sets.
|
|
1831
|
-
*
|
|
1832
|
-
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1833
|
-
*/
|
|
1834
|
-
function difference(a, b, isEqual) {
|
|
1835
|
-
var e_1, _a;
|
|
1836
|
-
if (isEqual === void 0) { isEqual = function (a, b) { return a === b; }; }
|
|
1837
|
-
var diff = new Set();
|
|
1838
|
-
var _loop_1 = function (itemA) {
|
|
1839
|
-
if (!Array.from(b).some(function (itemB) { return isEqual(itemA, itemB); })) {
|
|
1840
|
-
diff.add(itemA);
|
|
1841
|
-
}
|
|
1842
|
-
};
|
|
1843
|
-
try {
|
|
1844
|
-
for (var _b = __values(Array.from(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1845
|
-
var itemA = _c.value;
|
|
1846
|
-
_loop_1(itemA);
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1850
|
-
finally {
|
|
1851
|
-
try {
|
|
1852
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1853
|
-
}
|
|
1854
|
-
finally { if (e_1) throw e_1.error; }
|
|
1855
|
-
}
|
|
1856
|
-
return diff;
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
* TODO: [🧠][💯] Maybe also implement symmetricDifference
|
|
1860
|
-
*/
|
|
1861
|
-
|
|
1862
1835
|
/**
|
|
1863
1836
|
* Parses the template and returns the list of all parameter names
|
|
1864
1837
|
*
|
|
@@ -1992,46 +1965,6 @@
|
|
|
1992
1965
|
* TODO: [🔣] If script require contentLanguage
|
|
1993
1966
|
*/
|
|
1994
1967
|
|
|
1995
|
-
/**
|
|
1996
|
-
* Creates a new set with all elements that are present in either set
|
|
1997
|
-
*
|
|
1998
|
-
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
1999
|
-
*/
|
|
2000
|
-
function union() {
|
|
2001
|
-
var e_1, _a, e_2, _b;
|
|
2002
|
-
var sets = [];
|
|
2003
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2004
|
-
sets[_i] = arguments[_i];
|
|
2005
|
-
}
|
|
2006
|
-
var union = new Set();
|
|
2007
|
-
try {
|
|
2008
|
-
for (var sets_1 = __values(sets), sets_1_1 = sets_1.next(); !sets_1_1.done; sets_1_1 = sets_1.next()) {
|
|
2009
|
-
var set = sets_1_1.value;
|
|
2010
|
-
try {
|
|
2011
|
-
for (var _c = (e_2 = void 0, __values(Array.from(set))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2012
|
-
var item = _d.value;
|
|
2013
|
-
union.add(item);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2017
|
-
finally {
|
|
2018
|
-
try {
|
|
2019
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
2020
|
-
}
|
|
2021
|
-
finally { if (e_2) throw e_2.error; }
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2026
|
-
finally {
|
|
2027
|
-
try {
|
|
2028
|
-
if (sets_1_1 && !sets_1_1.done && (_a = sets_1.return)) _a.call(sets_1);
|
|
2029
|
-
}
|
|
2030
|
-
finally { if (e_1) throw e_1.error; }
|
|
2031
|
-
}
|
|
2032
|
-
return union;
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
1968
|
/**
|
|
2036
1969
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
2037
1970
|
*
|
|
@@ -2437,10 +2370,83 @@
|
|
|
2437
2370
|
return replacedTemplate;
|
|
2438
2371
|
}
|
|
2439
2372
|
|
|
2373
|
+
/**
|
|
2374
|
+
* Create difference set of two sets.
|
|
2375
|
+
*
|
|
2376
|
+
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
2377
|
+
*/
|
|
2378
|
+
function difference(a, b, isEqual) {
|
|
2379
|
+
var e_1, _a;
|
|
2380
|
+
if (isEqual === void 0) { isEqual = function (a, b) { return a === b; }; }
|
|
2381
|
+
var diff = new Set();
|
|
2382
|
+
var _loop_1 = function (itemA) {
|
|
2383
|
+
if (!Array.from(b).some(function (itemB) { return isEqual(itemA, itemB); })) {
|
|
2384
|
+
diff.add(itemA);
|
|
2385
|
+
}
|
|
2386
|
+
};
|
|
2387
|
+
try {
|
|
2388
|
+
for (var _b = __values(Array.from(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2389
|
+
var itemA = _c.value;
|
|
2390
|
+
_loop_1(itemA);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2394
|
+
finally {
|
|
2395
|
+
try {
|
|
2396
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2397
|
+
}
|
|
2398
|
+
finally { if (e_1) throw e_1.error; }
|
|
2399
|
+
}
|
|
2400
|
+
return diff;
|
|
2401
|
+
}
|
|
2402
|
+
/**
|
|
2403
|
+
* TODO: [🧠][💯] Maybe also implement symmetricDifference
|
|
2404
|
+
*/
|
|
2405
|
+
|
|
2406
|
+
/**
|
|
2407
|
+
* Creates a new set with all elements that are present in either set
|
|
2408
|
+
*
|
|
2409
|
+
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
2410
|
+
*/
|
|
2411
|
+
function union() {
|
|
2412
|
+
var e_1, _a, e_2, _b;
|
|
2413
|
+
var sets = [];
|
|
2414
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2415
|
+
sets[_i] = arguments[_i];
|
|
2416
|
+
}
|
|
2417
|
+
var union = new Set();
|
|
2418
|
+
try {
|
|
2419
|
+
for (var sets_1 = __values(sets), sets_1_1 = sets_1.next(); !sets_1_1.done; sets_1_1 = sets_1.next()) {
|
|
2420
|
+
var set = sets_1_1.value;
|
|
2421
|
+
try {
|
|
2422
|
+
for (var _c = (e_2 = void 0, __values(Array.from(set))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2423
|
+
var item = _d.value;
|
|
2424
|
+
union.add(item);
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2428
|
+
finally {
|
|
2429
|
+
try {
|
|
2430
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
2431
|
+
}
|
|
2432
|
+
finally { if (e_2) throw e_2.error; }
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2437
|
+
finally {
|
|
2438
|
+
try {
|
|
2439
|
+
if (sets_1_1 && !sets_1_1.done && (_a = sets_1.return)) _a.call(sets_1);
|
|
2440
|
+
}
|
|
2441
|
+
finally { if (e_1) throw e_1.error; }
|
|
2442
|
+
}
|
|
2443
|
+
return union;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2440
2446
|
/**
|
|
2441
2447
|
* The version of the Promptbook library
|
|
2442
2448
|
*/
|
|
2443
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
2449
|
+
var PROMPTBOOK_VERSION = '0.61.0-18';
|
|
2444
2450
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
2445
2451
|
|
|
2446
2452
|
/**
|
|
@@ -2591,7 +2597,7 @@
|
|
|
2591
2597
|
pipeline = rawPipeline;
|
|
2592
2598
|
}
|
|
2593
2599
|
else {
|
|
2594
|
-
console.warn(spaceTrim.spaceTrim("\n Pipeline is not prepared\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n "));
|
|
2600
|
+
console.warn(spaceTrim.spaceTrim("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
|
|
2595
2601
|
}
|
|
2596
2602
|
var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
2597
2603
|
function getContextForTemplate(// <- TODO: [🧠][🥜]
|