@promptbook/core 0.68.3 → 0.68.5
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 +32 -31
- 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/config.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +5 -5
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -1
- 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/AnthropicClaudeExecutionTools.d.ts +2 -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/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -1
- 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 +32 -31
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/personas/preparePersona.test.d.ts +0 -1
package/README.md
CHANGED
|
@@ -42,6 +42,10 @@ Core of the library, it contains the main logic for promptbooks.
|
|
|
42
42
|
|
|
43
43
|
Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
44
44
|
|
|
45
|
+
# ✨ New Features
|
|
46
|
+
|
|
47
|
+
- ✨ **Support [OpenAI o1 model](https://openai.com/o1/)**
|
|
48
|
+
|
|
45
49
|
## 🤍 The Promptbook Whitepaper
|
|
46
50
|
|
|
47
51
|
|
package/esm/index.es.js
CHANGED
|
@@ -10,8 +10,8 @@ import moment from 'moment';
|
|
|
10
10
|
/**
|
|
11
11
|
* The version of the Promptbook library
|
|
12
12
|
*/
|
|
13
|
-
var PROMPTBOOK_VERSION = '0.68.
|
|
14
|
-
// TODO: !!!! List here all the versions and annotate + put into script
|
|
13
|
+
var PROMPTBOOK_VERSION = '0.68.4';
|
|
14
|
+
// TODO:[main] !!!! List here all the versions and annotate + put into script
|
|
15
15
|
|
|
16
16
|
/*! *****************************************************************************
|
|
17
17
|
Copyright (c) Microsoft Corporation.
|
|
@@ -223,7 +223,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
223
223
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
224
224
|
}
|
|
225
225
|
commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
|
|
226
|
-
// TODO: !!! This increase size of the bundle and is probbably not necessary
|
|
226
|
+
// TODO:[main] !!! This increase size of the bundle and is probbably not necessary
|
|
227
227
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
228
228
|
try {
|
|
229
229
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -371,12 +371,12 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
371
371
|
pipelineString += '```' + contentLanguage;
|
|
372
372
|
pipelineString += '\n';
|
|
373
373
|
pipelineString += spaceTrim(content);
|
|
374
|
-
// <- TODO: !!! Escape
|
|
374
|
+
// <- TODO:[main] !!! Escape
|
|
375
375
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
376
376
|
pipelineString += '\n';
|
|
377
377
|
pipelineString += '```';
|
|
378
378
|
pipelineString += '\n\n';
|
|
379
|
-
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
|
|
379
|
+
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -596,7 +596,7 @@ function checkSerializableAsJson(name, value) {
|
|
|
596
596
|
}
|
|
597
597
|
/**
|
|
598
598
|
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
599
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
599
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
600
600
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
601
601
|
*/
|
|
602
602
|
|
|
@@ -667,14 +667,14 @@ var MAX_EXECUTION_ATTEMPTS = 3;
|
|
|
667
667
|
var MAX_FILENAME_LENGTH = 30;
|
|
668
668
|
/**
|
|
669
669
|
* @@@
|
|
670
|
-
* TODO: [🐝] !!! Use
|
|
670
|
+
* TODO: [🐝][main] !!! Use
|
|
671
671
|
*
|
|
672
672
|
* @public exported from `@promptbook/core`
|
|
673
673
|
*/
|
|
674
674
|
var MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
|
|
675
675
|
/**
|
|
676
676
|
* @@@
|
|
677
|
-
* TODO: [🐝] !!! Use
|
|
677
|
+
* TODO: [🐝][main] !!! Use
|
|
678
678
|
*
|
|
679
679
|
* @public exported from `@promptbook/core`
|
|
680
680
|
*/
|
|
@@ -829,7 +829,7 @@ function isValidPromptbookVersion(version) {
|
|
|
829
829
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
830
830
|
return false;
|
|
831
831
|
}
|
|
832
|
-
// <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
832
|
+
// <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
833
833
|
return true;
|
|
834
834
|
}
|
|
835
835
|
|
|
@@ -978,7 +978,7 @@ function validatePipeline(pipeline) {
|
|
|
978
978
|
// <- Note: [🚲]
|
|
979
979
|
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
980
980
|
}
|
|
981
|
-
if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
981
|
+
if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
982
982
|
// <- Note: [🚲]
|
|
983
983
|
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
984
984
|
}
|
|
@@ -1173,11 +1173,11 @@ function validatePipeline(pipeline) {
|
|
|
1173
1173
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
1174
1174
|
*/
|
|
1175
1175
|
/**
|
|
1176
|
-
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
1177
|
-
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
1178
|
-
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
1179
|
-
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1180
|
-
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
1176
|
+
* TODO: [🐣][main] !!!! Validate that all samples match expectations
|
|
1177
|
+
* TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
|
|
1178
|
+
* TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
|
|
1179
|
+
* TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1180
|
+
* TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
|
|
1181
1181
|
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
1182
1182
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
1183
1183
|
*/
|
|
@@ -1491,7 +1491,7 @@ function createCollectionFromUrl(url, options) {
|
|
|
1491
1491
|
});
|
|
1492
1492
|
}
|
|
1493
1493
|
/**
|
|
1494
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
1494
|
+
* TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
1495
1495
|
*/
|
|
1496
1496
|
|
|
1497
1497
|
/**
|
|
@@ -1788,7 +1788,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1788
1788
|
});
|
|
1789
1789
|
}
|
|
1790
1790
|
|
|
1791
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",
|
|
1791
|
+
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"}];
|
|
1792
1792
|
|
|
1793
1793
|
var defaultDiacriticsRemovalMap = [
|
|
1794
1794
|
{
|
|
@@ -2896,7 +2896,7 @@ function isPipelinePrepared(pipeline) {
|
|
|
2896
2896
|
return true;
|
|
2897
2897
|
}
|
|
2898
2898
|
/**
|
|
2899
|
-
* TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
2899
|
+
* TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
2900
2900
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
2901
2901
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2902
2902
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -3297,7 +3297,7 @@ function createPipelineExecutor(options) {
|
|
|
3297
3297
|
console.warn(spaceTrim$1(function (block) { return "\n Pipeline is not prepared\n\n ".concat(block(pipelineIdentification), "\n\n It will be prepared ad-hoc before the first execution and **returned as `preparedPipeline` in `PipelineExecutorResult`**\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n "); }));
|
|
3298
3298
|
}
|
|
3299
3299
|
var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
3300
|
-
// TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
|
|
3300
|
+
// TODO:[main] !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
|
|
3301
3301
|
function getContextForTemplate(template) {
|
|
3302
3302
|
return __awaiter(this, void 0, void 0, function () {
|
|
3303
3303
|
return __generator(this, function (_a) {
|
|
@@ -4116,7 +4116,7 @@ function createPipelineExecutor(options) {
|
|
|
4116
4116
|
return pipelineExecutor;
|
|
4117
4117
|
}
|
|
4118
4118
|
/**
|
|
4119
|
-
* TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
|
|
4119
|
+
* TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
|
|
4120
4120
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
4121
4121
|
* TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
4122
4122
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
@@ -4179,7 +4179,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
|
|
|
4179
4179
|
outputParameters = result.outputParameters;
|
|
4180
4180
|
knowledgePiecesRaw = outputParameters.knowledgePieces;
|
|
4181
4181
|
knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
|
|
4182
|
-
// <- TODO: !!!!! Smarter split and filter out empty pieces
|
|
4182
|
+
// <- TODO:[main] !!!!! Smarter split and filter out empty pieces
|
|
4183
4183
|
if (isVerbose) {
|
|
4184
4184
|
console.info('knowledgeTextPieces:', knowledgeTextPieces);
|
|
4185
4185
|
}
|
|
@@ -4259,7 +4259,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
|
|
|
4259
4259
|
});
|
|
4260
4260
|
}
|
|
4261
4261
|
/**
|
|
4262
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
4262
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
|
|
4263
4263
|
* TODO: [🪂] Do it in parallel 11:11
|
|
4264
4264
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
4265
4265
|
*/
|
|
@@ -4283,7 +4283,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
|
|
|
4283
4283
|
var partialPieces, pieces;
|
|
4284
4284
|
return __generator(this, function (_a) {
|
|
4285
4285
|
switch (_a.label) {
|
|
4286
|
-
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
|
|
4286
|
+
case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
|
|
4287
4287
|
options)];
|
|
4288
4288
|
case 1:
|
|
4289
4289
|
partialPieces = _a.sent();
|
|
@@ -4475,7 +4475,7 @@ function preparePersona(personaDescription, options) {
|
|
|
4475
4475
|
});
|
|
4476
4476
|
}
|
|
4477
4477
|
/**
|
|
4478
|
-
* TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
4478
|
+
* TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
4479
4479
|
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
4480
4480
|
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
4481
4481
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
@@ -4524,7 +4524,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
4524
4524
|
case 0:
|
|
4525
4525
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
4526
4526
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
4527
|
-
// TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
4527
|
+
// TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
4528
4528
|
TODO_USE(parameters);
|
|
4529
4529
|
templatesPrepared = new Array(
|
|
4530
4530
|
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
@@ -4556,7 +4556,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
4556
4556
|
/**
|
|
4557
4557
|
* TODO: [🧠] Add context to each template (if missing)
|
|
4558
4558
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
4559
|
-
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
4559
|
+
* TODO: [♨][main] !!! Prepare index the samples and maybe templates
|
|
4560
4560
|
* TODO: Write tests for `preparePipeline`
|
|
4561
4561
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
4562
4562
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -4728,7 +4728,7 @@ var knowledgeCommandParser = {
|
|
|
4728
4728
|
if (sourceContent === '') {
|
|
4729
4729
|
throw new ParseError("Source is not defined");
|
|
4730
4730
|
}
|
|
4731
|
-
// TODO: !!!! Following checks should be applied every link in the `sourceContent`
|
|
4731
|
+
// TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
|
|
4732
4732
|
if (sourceContent.startsWith('http://')) {
|
|
4733
4733
|
throw new ParseError("Source is not secure");
|
|
4734
4734
|
}
|
|
@@ -4913,7 +4913,7 @@ var templateCommandParser = {
|
|
|
4913
4913
|
if (command.templateType === 'KNOWLEDGE') {
|
|
4914
4914
|
knowledgeCommandParser.$applyToPipelineJson({
|
|
4915
4915
|
type: 'KNOWLEDGE',
|
|
4916
|
-
sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
4916
|
+
sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
4917
4917
|
}, $pipelineJson);
|
|
4918
4918
|
$templateJson.isTemplate = false;
|
|
4919
4919
|
return;
|
|
@@ -5955,6 +5955,7 @@ var promptbookVersionCommandParser = {
|
|
|
5955
5955
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
5956
5956
|
*/
|
|
5957
5957
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
5958
|
+
// TODO: Warn if the version is overridden
|
|
5958
5959
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
5959
5960
|
},
|
|
5960
5961
|
/**
|
|
@@ -6844,7 +6845,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
6844
6845
|
var $pipelineJson = {
|
|
6845
6846
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
6846
6847
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
6847
|
-
promptbookVersion:
|
|
6848
|
+
promptbookVersion: undefined /* <- Note: By default no explicit version */,
|
|
6848
6849
|
description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
|
|
6849
6850
|
parameters: [],
|
|
6850
6851
|
templates: [],
|
|
@@ -7135,7 +7136,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
7135
7136
|
return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
|
|
7136
7137
|
}
|
|
7137
7138
|
/**
|
|
7138
|
-
* TODO: !!!! Warn if used only sync version
|
|
7139
|
+
* TODO:[main] !!!! Warn if used only sync version
|
|
7139
7140
|
* TODO: [🚞] Report here line/column of error
|
|
7140
7141
|
* TODO: Use spaceTrim more effectively
|
|
7141
7142
|
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
@@ -7410,7 +7411,7 @@ function isSerializableAsJson(value) {
|
|
|
7410
7411
|
}
|
|
7411
7412
|
}
|
|
7412
7413
|
/**
|
|
7413
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
7414
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
7414
7415
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
7415
7416
|
*/
|
|
7416
7417
|
|