@promptbook/cli 0.69.0-15 → 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 +81 -34
- 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/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 +81 -34
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/personas/preparePersona.test.d.ts +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
declare const _default: ({
|
|
2
2
|
title: string;
|
|
3
3
|
pipelineUrl: string;
|
|
4
|
-
promptbookVersion: string;
|
|
5
4
|
parameters: {
|
|
6
5
|
name: string;
|
|
7
6
|
description: string;
|
|
@@ -24,7 +23,6 @@ declare const _default: ({
|
|
|
24
23
|
} | {
|
|
25
24
|
title: string;
|
|
26
25
|
pipelineUrl: string;
|
|
27
|
-
promptbookVersion: string;
|
|
28
26
|
parameters: {
|
|
29
27
|
name: string;
|
|
30
28
|
description: string;
|
|
@@ -53,7 +51,6 @@ declare const _default: ({
|
|
|
53
51
|
} | {
|
|
54
52
|
title: string;
|
|
55
53
|
pipelineUrl: string;
|
|
56
|
-
promptbookVersion: string;
|
|
57
54
|
parameters: {
|
|
58
55
|
name: string;
|
|
59
56
|
description: string;
|
|
@@ -6,7 +6,7 @@ import type { Command as Program } from 'commander';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function initializeMakeCommand(program: Program): void;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
|
|
9
|
+
* TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
|
|
10
10
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
11
11
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
12
12
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
@@ -25,5 +25,5 @@ type CreatePipelineCollectionFromUrlyOptions = {
|
|
|
25
25
|
export declare function createCollectionFromUrl(url: string_url | URL, options: CreatePipelineCollectionFromUrlyOptions): Promise<PipelineCollection>;
|
|
26
26
|
export {};
|
|
27
27
|
/**
|
|
28
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
28
|
+
* TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
29
29
|
*/
|
|
@@ -69,14 +69,14 @@ export declare const MAX_EXECUTION_ATTEMPTS = 3;
|
|
|
69
69
|
export declare const MAX_FILENAME_LENGTH = 30;
|
|
70
70
|
/**
|
|
71
71
|
* @@@
|
|
72
|
-
* TODO: [🐝] !!! Use
|
|
72
|
+
* TODO: [🐝][main] !!! Use
|
|
73
73
|
*
|
|
74
74
|
* @public exported from `@promptbook/core`
|
|
75
75
|
*/
|
|
76
76
|
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
|
|
77
77
|
/**
|
|
78
78
|
* @@@
|
|
79
|
-
* TODO: [🐝] !!! Use
|
|
79
|
+
* TODO: [🐝][main] !!! Use
|
|
80
80
|
*
|
|
81
81
|
* @public exported from `@promptbook/core`
|
|
82
82
|
*/
|
|
@@ -18,7 +18,7 @@ import type { PipelineString } from '../types/PipelineString';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function pipelineStringToJsonSync(pipelineString: PipelineString): PipelineJson;
|
|
20
20
|
/**
|
|
21
|
-
* TODO: !!!! Warn if used only sync version
|
|
21
|
+
* TODO:[main] !!!! Warn if used only sync version
|
|
22
22
|
* TODO: [🚞] Report here line/column of error
|
|
23
23
|
* TODO: Use spaceTrim more effectively
|
|
24
24
|
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
@@ -32,11 +32,11 @@ export declare function validatePipelineCore(pipeline: PipelineJson): void;
|
|
|
32
32
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
33
33
|
*/
|
|
34
34
|
/**
|
|
35
|
-
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
36
|
-
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
37
|
-
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
38
|
-
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
39
|
-
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
35
|
+
* TODO: [🐣][main] !!!! Validate that all samples match expectations
|
|
36
|
+
* TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
|
|
37
|
+
* TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
|
|
38
|
+
* TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
39
|
+
* TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
|
|
40
40
|
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
41
41
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
42
42
|
*/
|
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function prepareKnowledgeFromMarkdown(knowledgeContent: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
11
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
|
|
12
12
|
* TODO: [🪂] Do it in parallel 11:11
|
|
13
13
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@ import type { string_base64 } from '../../../types/typeAliases';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function prepareKnowledgeFromPdf(content: string_base64, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/pdf`
|
|
11
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/pdf`
|
|
12
12
|
* TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
|
|
13
13
|
* @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
|
|
14
14
|
* TODO: [🪂] Do it in parallel
|
|
@@ -16,7 +16,7 @@ export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
|
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Note: [🤖] Add models of new variant
|
|
19
|
-
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
19
|
+
* TODO: [🧠][main] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
20
20
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
21
21
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
22
22
|
* TODO: [🎰] Some mechanism to auto-update available models
|
package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export declare const createAnthropicClaudeExecutionTools: ((options: AnthropicCl
|
|
|
11
11
|
className: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
15
|
-
* TODO: [🧠][🧱] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
14
|
+
* TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
|
|
15
|
+
* TODO: [🧠][🧱][main] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
16
16
|
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
17
17
|
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
18
18
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
export {};
|
|
3
3
|
/**
|
|
4
|
-
* TODO: !!! Playground with WebGPT / Promptbook.studio anonymous server
|
|
5
|
-
* TODO: !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
4
|
+
* TODO:[main] !!! Playground with WebGPT / Promptbook.studio anonymous server
|
|
5
|
+
* TODO:[main] !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@ import type { string_persona_description } from '../types/typeAliases';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function preparePersona(personaDescription: string_persona_description, options: PrepareOptions): Promise<PersonaPreparedJson['modelRequirements']>;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
12
|
+
* TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
|
|
13
13
|
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
14
14
|
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
15
15
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
@@ -6,7 +6,7 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
9
|
+
* TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
10
10
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
11
11
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
12
12
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -23,7 +23,7 @@ export {};
|
|
|
23
23
|
/**
|
|
24
24
|
* TODO: [🧠] Add context to each template (if missing)
|
|
25
25
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
26
|
-
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
26
|
+
* TODO: [♨][main] !!! Prepare index the samples and maybe templates
|
|
27
27
|
* TODO: Write tests for `preparePipeline`
|
|
28
28
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
29
29
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -42,7 +42,7 @@ export type PipelineJson = {
|
|
|
42
42
|
/**
|
|
43
43
|
* Version of the .ptbk.json file
|
|
44
44
|
*/
|
|
45
|
-
readonly promptbookVersion
|
|
45
|
+
readonly promptbookVersion?: string_semantic_version;
|
|
46
46
|
/**
|
|
47
47
|
* Description of the promptbook
|
|
48
48
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -592,7 +592,7 @@ export type number_megabytes = number_positive;
|
|
|
592
592
|
export type number_gigabytes = number_positive;
|
|
593
593
|
export type number_terabytes = number_positive;
|
|
594
594
|
/**.
|
|
595
|
-
* TODO: !!! Change "For example" to @example
|
|
595
|
+
* TODO:[main] !!! Change "For example" to @example
|
|
596
596
|
* TODO: !! Change to branded types
|
|
597
597
|
* TODO: Delete type aliases that are not exported or used internally
|
|
598
598
|
*/
|
|
@@ -22,6 +22,6 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
22
22
|
export declare function checkSerializableAsJson(name: string_name, value: unknown): void;
|
|
23
23
|
/**
|
|
24
24
|
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
25
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
25
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
26
26
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
27
27
|
*/
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function isSerializableAsJson(value: unknown): boolean;
|
|
21
21
|
/**
|
|
22
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
22
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
23
23
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
24
24
|
*/
|
package/package.json
CHANGED
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
|
}
|
|
@@ -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`
|
|
@@ -4662,7 +4662,7 @@
|
|
|
4662
4662
|
outputParameters = result.outputParameters;
|
|
4663
4663
|
knowledgePiecesRaw = outputParameters.knowledgePieces;
|
|
4664
4664
|
knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
|
|
4665
|
-
// <- TODO: !!!!! Smarter split and filter out empty pieces
|
|
4665
|
+
// <- TODO:[main] !!!!! Smarter split and filter out empty pieces
|
|
4666
4666
|
if (isVerbose) {
|
|
4667
4667
|
console.info('knowledgeTextPieces:', knowledgeTextPieces);
|
|
4668
4668
|
}
|
|
@@ -4747,7 +4747,7 @@
|
|
|
4747
4747
|
});
|
|
4748
4748
|
}
|
|
4749
4749
|
/**
|
|
4750
|
-
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
4750
|
+
* TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
|
|
4751
4751
|
* TODO: [🪂] Do it in parallel 11:11
|
|
4752
4752
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
4753
4753
|
*/
|
|
@@ -4771,7 +4771,7 @@
|
|
|
4771
4771
|
var partialPieces, pieces;
|
|
4772
4772
|
return __generator(this, function (_a) {
|
|
4773
4773
|
switch (_a.label) {
|
|
4774
|
-
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
|
|
4775
4775
|
options)];
|
|
4776
4776
|
case 1:
|
|
4777
4777
|
partialPieces = _a.sent();
|
|
@@ -4963,7 +4963,7 @@
|
|
|
4963
4963
|
});
|
|
4964
4964
|
}
|
|
4965
4965
|
/**
|
|
4966
|
-
* 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
|
|
4967
4967
|
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
4968
4968
|
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
4969
4969
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
@@ -5012,7 +5012,7 @@
|
|
|
5012
5012
|
case 0:
|
|
5013
5013
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
5014
5014
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5015
|
-
// 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)
|
|
5016
5016
|
TODO_USE(parameters);
|
|
5017
5017
|
templatesPrepared = new Array(
|
|
5018
5018
|
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
@@ -5044,7 +5044,7 @@
|
|
|
5044
5044
|
/**
|
|
5045
5045
|
* TODO: [🧠] Add context to each template (if missing)
|
|
5046
5046
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
5047
|
-
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
5047
|
+
* TODO: [♨][main] !!! Prepare index the samples and maybe templates
|
|
5048
5048
|
* TODO: Write tests for `preparePipeline`
|
|
5049
5049
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
5050
5050
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -5216,7 +5216,7 @@
|
|
|
5216
5216
|
if (sourceContent === '') {
|
|
5217
5217
|
throw new ParseError("Source is not defined");
|
|
5218
5218
|
}
|
|
5219
|
-
// TODO: !!!! Following checks should be applied every link in the `sourceContent`
|
|
5219
|
+
// TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
|
|
5220
5220
|
if (sourceContent.startsWith('http://')) {
|
|
5221
5221
|
throw new ParseError("Source is not secure");
|
|
5222
5222
|
}
|
|
@@ -5419,7 +5419,7 @@
|
|
|
5419
5419
|
if (command.templateType === 'KNOWLEDGE') {
|
|
5420
5420
|
knowledgeCommandParser.$applyToPipelineJson({
|
|
5421
5421
|
type: 'KNOWLEDGE',
|
|
5422
|
-
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
|
|
5423
5423
|
}, $pipelineJson);
|
|
5424
5424
|
$templateJson.isTemplate = false;
|
|
5425
5425
|
return;
|
|
@@ -6716,6 +6716,7 @@
|
|
|
6716
6716
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
6717
6717
|
*/
|
|
6718
6718
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6719
|
+
// TODO: Warn if the version is overridden
|
|
6719
6720
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
6720
6721
|
},
|
|
6721
6722
|
/**
|
|
@@ -7536,7 +7537,7 @@
|
|
|
7536
7537
|
var $pipelineJson = {
|
|
7537
7538
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
7538
7539
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
7539
|
-
promptbookVersion:
|
|
7540
|
+
promptbookVersion: undefined /* <- Note: By default no explicit version */,
|
|
7540
7541
|
description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
|
|
7541
7542
|
parameters: [],
|
|
7542
7543
|
templates: [],
|
|
@@ -7827,7 +7828,7 @@
|
|
|
7827
7828
|
return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
|
|
7828
7829
|
}
|
|
7829
7830
|
/**
|
|
7830
|
-
* TODO: !!!! Warn if used only sync version
|
|
7831
|
+
* TODO:[main] !!!! Warn if used only sync version
|
|
7831
7832
|
* TODO: [🚞] Report here line/column of error
|
|
7832
7833
|
* TODO: Use spaceTrim more effectively
|
|
7833
7834
|
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
@@ -8332,7 +8333,7 @@
|
|
|
8332
8333
|
}
|
|
8333
8334
|
}
|
|
8334
8335
|
/**
|
|
8335
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
8336
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
8336
8337
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
8337
8338
|
*/
|
|
8338
8339
|
|
|
@@ -9193,7 +9194,7 @@
|
|
|
9193
9194
|
});
|
|
9194
9195
|
}
|
|
9195
9196
|
/**
|
|
9196
|
-
* TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
|
|
9197
|
+
* TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
|
|
9197
9198
|
* TODO: Maybe remove this command - "about" command should be enough?
|
|
9198
9199
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
9199
9200
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
@@ -9611,7 +9612,7 @@
|
|
|
9611
9612
|
socket.on('connect', function () {
|
|
9612
9613
|
resolve(socket);
|
|
9613
9614
|
});
|
|
9614
|
-
// TODO: !!!! Better timeout handling
|
|
9615
|
+
// TODO:[main] !!!! Better timeout handling
|
|
9615
9616
|
setTimeout(function () {
|
|
9616
9617
|
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
9617
9618
|
}, CONNECTION_TIMEOUT_MS);
|
|
@@ -9791,11 +9792,11 @@
|
|
|
9791
9792
|
output: computeUsage("$2.40 / 1M tokens"),
|
|
9792
9793
|
},
|
|
9793
9794
|
},
|
|
9794
|
-
// TODO: !!! Claude 1 and 2 has also completion versions - ask Hoagy
|
|
9795
|
+
// TODO:[main] !!! Claude 1 and 2 has also completion versions - ask Hoagy
|
|
9795
9796
|
]);
|
|
9796
9797
|
/**
|
|
9797
9798
|
* Note: [🤖] Add models of new variant
|
|
9798
|
-
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
9799
|
+
* TODO: [🧠][main] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
9799
9800
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
9800
9801
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
9801
9802
|
* TODO: [🎰] Some mechanism to auto-update available models
|
|
@@ -10151,8 +10152,8 @@
|
|
|
10151
10152
|
className: 'AnthropicClaudeExecutionTools',
|
|
10152
10153
|
});
|
|
10153
10154
|
/**
|
|
10154
|
-
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
10155
|
-
* 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
|
|
10156
10157
|
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
10157
10158
|
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
10158
10159
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
@@ -10530,6 +10531,7 @@
|
|
|
10530
10531
|
prompt: computeUsage("$5.00 / 1M tokens"),
|
|
10531
10532
|
output: computeUsage("$15.00 / 1M tokens"),
|
|
10532
10533
|
},
|
|
10534
|
+
//TODO:[main] !!!!!! Add gpt-4o-mini-2024-07-18 and all others to be up to date
|
|
10533
10535
|
},
|
|
10534
10536
|
/**/
|
|
10535
10537
|
/**/
|
|
@@ -10544,6 +10546,51 @@
|
|
|
10544
10546
|
},
|
|
10545
10547
|
/**/
|
|
10546
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
|
+
/**/
|
|
10547
10594
|
{
|
|
10548
10595
|
modelVariant: 'CHAT',
|
|
10549
10596
|
modelTitle: 'gpt-3.5-turbo-16k-0613',
|
|
@@ -10632,7 +10679,7 @@
|
|
|
10632
10679
|
AzureOpenAiExecutionTools.prototype.listModels = function () {
|
|
10633
10680
|
return __awaiter(this, void 0, void 0, function () {
|
|
10634
10681
|
return __generator(this, function (_a) {
|
|
10635
|
-
// 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
|
|
10636
10683
|
// @see https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments?api-version=2023-05-01
|
|
10637
10684
|
return [2 /*return*/, OPENAI_MODELS.map(function (_a) {
|
|
10638
10685
|
var modelTitle = _a.modelTitle, modelName = _a.modelName, modelVariant = _a.modelVariant;
|
|
@@ -11323,7 +11370,7 @@
|
|
|
11323
11370
|
* @public exported from `@promptbook/openai`
|
|
11324
11371
|
*/
|
|
11325
11372
|
var createOpenAiExecutionTools = Object.assign(function (options) {
|
|
11326
|
-
// TODO: [🧠] !!!! If browser, auto add `dangerouslyAllowBrowser`
|
|
11373
|
+
// TODO: [🧠][main] !!!! If browser, auto add `dangerouslyAllowBrowser`
|
|
11327
11374
|
if (($isRunningInBrowser() || $isRunningInWebWorker()) && !options.dangerouslyAllowBrowser) {
|
|
11328
11375
|
options = __assign(__assign({}, options), { dangerouslyAllowBrowser: true });
|
|
11329
11376
|
}
|