@promptbook/core 0.62.0-0 → 0.62.0
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 +7 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +3 -3
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +3 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -1
- package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +6 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +3 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +3 -0
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +3 -0
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +7 -6
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +3 -3
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +1 -1
- package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +3 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -1
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -1
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +6 -0
- package/umd/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +3 -2
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +3 -0
- package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +1 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +2 -1
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +3 -0
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
|
@@ -26,7 +26,7 @@ declare const _default: ({
|
|
|
26
26
|
preparations: {
|
|
27
27
|
id: number;
|
|
28
28
|
promptbookVersion: string;
|
|
29
|
-
|
|
29
|
+
usage: {
|
|
30
30
|
price: {
|
|
31
31
|
value: number;
|
|
32
32
|
};
|
|
@@ -113,7 +113,7 @@ declare const _default: ({
|
|
|
113
113
|
preparations: {
|
|
114
114
|
id: number;
|
|
115
115
|
promptbookVersion: string;
|
|
116
|
-
|
|
116
|
+
usage: {
|
|
117
117
|
price: {
|
|
118
118
|
value: number;
|
|
119
119
|
};
|
|
@@ -195,7 +195,7 @@ declare const _default: ({
|
|
|
195
195
|
preparations: {
|
|
196
196
|
id: number;
|
|
197
197
|
promptbookVersion: string;
|
|
198
|
-
|
|
198
|
+
usage: {
|
|
199
199
|
price: {
|
|
200
200
|
value: number;
|
|
201
201
|
};
|
|
@@ -58,7 +58,7 @@ export declare function createPipelineExecutor(options: CreatePipelineExecutorOp
|
|
|
58
58
|
export {};
|
|
59
59
|
/**
|
|
60
60
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
61
|
-
* TODO: [🧠] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
61
|
+
* TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
62
62
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
63
63
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
64
64
|
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
@@ -12,6 +12,8 @@ export type CreateLlmToolsFromEnvOptions = {
|
|
|
12
12
|
*
|
|
13
13
|
* Note: This function is not cached, every call creates new instance of `LlmExecutionTools`
|
|
14
14
|
*
|
|
15
|
+
* @@@ .env
|
|
16
|
+
*
|
|
15
17
|
* It looks for environment variables:
|
|
16
18
|
* - `process.env.OPENAI_API_KEY`
|
|
17
19
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
@@ -20,6 +22,7 @@ export type CreateLlmToolsFromEnvOptions = {
|
|
|
20
22
|
*/
|
|
21
23
|
export declare function createLlmToolsFromEnv(options?: CreateLlmToolsFromEnvOptions): LlmExecutionTools;
|
|
22
24
|
/**
|
|
25
|
+
* TODO: [🍜] Use `createLlmToolsFromConfiguration`
|
|
23
26
|
* TODO: [🔼] !!! Export via `@promptbook/node`
|
|
24
27
|
* TODO: @@@ write discussion about this - wizzard
|
|
25
28
|
* TODO: Add Azure
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { LlmExecutionToolsWithTotalUsage } from './utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
|
2
|
+
type GetLlmToolsForCliOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* @@@
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
isCacheReloaded?: boolean;
|
|
9
|
+
};
|
|
2
10
|
/**
|
|
3
11
|
* Returns LLM tools for CLI
|
|
4
12
|
*
|
|
5
13
|
* @private within the repository - for CLI utils
|
|
6
14
|
*/
|
|
7
|
-
export declare function getLlmToolsForCli(): LlmExecutionToolsWithTotalUsage;
|
|
15
|
+
export declare function getLlmToolsForCli(options?: GetLlmToolsForCliOptions): LlmExecutionToolsWithTotalUsage;
|
|
16
|
+
export {};
|
|
8
17
|
/**
|
|
9
18
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
10
19
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { CreateLlmToolsFromEnvOptions } from './createLlmToolsFromEnv';
|
|
2
2
|
import type { LlmExecutionToolsWithTotalUsage } from './utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
|
3
|
+
type GetLlmToolsForTestingAndScriptsAndPlaygroundOptions = CreateLlmToolsFromEnvOptions & {
|
|
4
|
+
/**
|
|
5
|
+
* @@@
|
|
6
|
+
*
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
isCacheReloaded?: boolean;
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Returns LLM tools for testing purposes
|
|
5
13
|
*
|
|
6
14
|
* @private within the repository - JUST FOR TESTS, SCRIPTS AND PLAYGROUND
|
|
7
15
|
*/
|
|
8
|
-
export declare function getLlmToolsForTestingAndScriptsAndPlayground(options?:
|
|
16
|
+
export declare function getLlmToolsForTestingAndScriptsAndPlayground(options?: GetLlmToolsForTestingAndScriptsAndPlaygroundOptions): LlmExecutionToolsWithTotalUsage;
|
|
17
|
+
export {};
|
|
9
18
|
/**
|
|
10
19
|
* Note: [⚪] This should never be in any released package
|
|
11
20
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
@@ -5,10 +5,11 @@ import type { PromptResultUsage } from '../../../../execution/PromptResultUsage'
|
|
|
5
5
|
*/
|
|
6
6
|
export type LlmExecutionToolsWithTotalUsage = LlmExecutionTools & {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Get total cost of the execution up to this point
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
getTotalUsage(): PromptResultUsage;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
14
|
+
* Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
14
15
|
*/
|
|
@@ -46,4 +46,5 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
46
46
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
47
47
|
* TODO: Maybe make custom OpenaiError
|
|
48
48
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
49
|
+
* TODO: [🍜] Auto use anonymous server in browser
|
|
49
50
|
*/
|
package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts
CHANGED
|
@@ -6,3 +6,6 @@ import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutio
|
|
|
6
6
|
* This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
|
|
7
7
|
*/
|
|
8
8
|
export type AnthropicClaudeExecutionToolsOptions = CommonExecutionToolsOptions & ClientOptions;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: [🍜] Auto add WebGPT / Promptbook.studio anonymous server in browser
|
|
11
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -51,4 +51,5 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
51
51
|
/**
|
|
52
52
|
* TODO: [🍓] Allow to list compatible models with each variant
|
|
53
53
|
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
54
|
-
|
|
54
|
+
* TODO: [🍜] Add anonymous option
|
|
55
|
+
*/
|
|
@@ -10,6 +10,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
|
|
12
12
|
/**
|
|
13
|
+
* TODO: [🍜] Add anonymous option
|
|
13
14
|
* TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
|
|
14
15
|
* TODO: Handle progress - support streaming
|
|
15
16
|
* TODO: [🗯] Do not hang up immediately but wait until client closes OR timeout
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -1525,7 +1525,7 @@
|
|
|
1525
1525
|
});
|
|
1526
1526
|
}
|
|
1527
1527
|
|
|
1528
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.
|
|
1528
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.62.0-1",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",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> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0-1",usage:{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.62.0-1",parameters:[{name:"knowledgePieceContent",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> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0-1",usage:{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.62.0-1",parameters:[{name:"knowledgePieceContent",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> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0-1",usage:{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.62.0-1",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.62.0-1",usage:{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"}];
|
|
1529
1529
|
|
|
1530
1530
|
var defaultDiacriticsRemovalMap = [
|
|
1531
1531
|
{
|
|
@@ -2533,7 +2533,7 @@
|
|
|
2533
2533
|
/**
|
|
2534
2534
|
* The version of the Promptbook library
|
|
2535
2535
|
*/
|
|
2536
|
-
var PROMPTBOOK_VERSION = '0.
|
|
2536
|
+
var PROMPTBOOK_VERSION = '0.62.0-1';
|
|
2537
2537
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
2538
2538
|
|
|
2539
2539
|
/**
|
|
@@ -3447,7 +3447,7 @@
|
|
|
3447
3447
|
}
|
|
3448
3448
|
/**
|
|
3449
3449
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
3450
|
-
* TODO: [🧠] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
3450
|
+
* TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
3451
3451
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
3452
3452
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
3453
3453
|
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
@@ -3677,7 +3677,8 @@
|
|
|
3677
3677
|
listModels: function () {
|
|
3678
3678
|
return /* not await */ llmTools.listModels();
|
|
3679
3679
|
},
|
|
3680
|
-
|
|
3680
|
+
getTotalUsage: function () {
|
|
3681
|
+
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
3681
3682
|
return totalUsage;
|
|
3682
3683
|
},
|
|
3683
3684
|
};
|
|
@@ -3875,7 +3876,7 @@
|
|
|
3875
3876
|
id: 1,
|
|
3876
3877
|
// TODO: [🍥]> date: $currentDate(),
|
|
3877
3878
|
promptbookVersion: PROMPTBOOK_VERSION,
|
|
3878
|
-
|
|
3879
|
+
usage: ZERO_USAGE,
|
|
3879
3880
|
};
|
|
3880
3881
|
preparations = [
|
|
3881
3882
|
// ...preparations
|
|
@@ -3924,7 +3925,7 @@
|
|
|
3924
3925
|
promptTemplatesPrepared = (_c.sent()).promptTemplatesPrepared;
|
|
3925
3926
|
// ----- /Templates preparation -----
|
|
3926
3927
|
// Note: Count total usage
|
|
3927
|
-
currentPreparation.
|
|
3928
|
+
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
3928
3929
|
return [2 /*return*/, __assign(__assign({}, pipeline), { promptTemplates: promptTemplatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
|
|
3929
3930
|
}
|
|
3930
3931
|
});
|