@promptbook/cli 0.66.0-4 → 0.66.0-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.
@@ -47,15 +47,15 @@ import { CallbackInterfaceTools } from '../knowledge/dialogs/callback/CallbackIn
47
47
  import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
48
48
  import { prepareKnowledgePieces } from '../knowledge/prepare-knowledge/_common/prepareKnowledgePieces';
49
49
  import { prepareKnowledgeFromMarkdown } from '../knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown';
50
- import { $llmToolsConfigurationBoilerplatesRegister } from '../llm-providers/_common/$llmToolsConfigurationBoilerplatesRegister';
50
+ import { $llmToolsMetadataRegister } from '../llm-providers/_common/$llmToolsMetadataRegister';
51
51
  import { $llmToolsRegister } from '../llm-providers/_common/$llmToolsRegister';
52
52
  import { createLlmToolsFromConfiguration } from '../llm-providers/_common/createLlmToolsFromConfiguration';
53
53
  import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTools';
54
54
  import { countTotalUsage } from '../llm-providers/_common/utils/count-total-usage/countTotalUsage';
55
55
  import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
56
- import { _AnthropicClaudeConfigurationRegistration } from '../llm-providers/anthropic-claude/register-configuration';
56
+ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
57
57
  import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
58
- import { _OpenAiConfigurationRegistration } from '../llm-providers/openai/register-configuration';
58
+ import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
59
59
  import { preparePersona } from '../personas/preparePersona';
60
60
  import { isPipelinePrepared } from '../prepare/isPipelinePrepared';
61
61
  import { preparePipeline } from '../prepare/preparePipeline';
@@ -117,15 +117,15 @@ export { CallbackInterfaceTools };
117
117
  export type { CallbackInterfaceToolsOptions };
118
118
  export { prepareKnowledgePieces };
119
119
  export { prepareKnowledgeFromMarkdown };
120
- export { $llmToolsConfigurationBoilerplatesRegister };
120
+ export { $llmToolsMetadataRegister };
121
121
  export { $llmToolsRegister };
122
122
  export { createLlmToolsFromConfiguration };
123
123
  export { cacheLlmTools };
124
124
  export { countTotalUsage };
125
125
  export { limitTotalUsage };
126
- export { _AnthropicClaudeConfigurationRegistration };
126
+ export { _AnthropicClaudeMetadataRegistration };
127
127
  export { joinLlmExecutionTools };
128
- export { _OpenAiConfigurationRegistration };
128
+ export { _OpenAiMetadataRegistration };
129
129
  export { preparePersona };
130
130
  export { isPipelinePrepared };
131
131
  export { preparePipeline };
@@ -32,6 +32,8 @@ import type { UserInterfaceTools } from '../execution/UserInterfaceTools';
32
32
  import type { UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
33
33
  import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
34
34
  import type { LlmToolsConfiguration } from '../llm-providers/_common/LlmToolsConfiguration';
35
+ import type { LlmToolsMetadata } from '../llm-providers/_common/LlmToolsMetadata';
36
+ import type { LlmToolsOptions } from '../llm-providers/_common/LlmToolsOptions';
35
37
  import type { CacheItem } from '../llm-providers/_common/utils/cache/CacheItem';
36
38
  import type { CacheLlmToolsOptions } from '../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
37
39
  import type { LlmExecutionToolsWithTotalUsage } from '../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
@@ -249,6 +251,8 @@ export type { UserInterfaceTools };
249
251
  export type { UserInterfaceToolsPromptDialogOptions };
250
252
  export type { CallbackInterfaceToolsOptions };
251
253
  export type { LlmToolsConfiguration };
254
+ export type { LlmToolsMetadata };
255
+ export type { LlmToolsOptions };
252
256
  export type { CacheItem };
253
257
  export type { CacheLlmToolsOptions };
254
258
  export type { LlmExecutionToolsWithTotalUsage };
@@ -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 llm tools
9
+ * TODO: [🥃] !!! 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`
@@ -1 +1 @@
1
- export {};
1
+ import '../../../_packages/core.index';
@@ -1,4 +1,4 @@
1
- export {};
1
+ import '../../../_packages/core.index';
2
2
  /**
3
3
  * TODO: [📓] Maybe test all file in samples (not just 10-simple.md)
4
4
  */
@@ -1 +1 @@
1
- export {};
1
+ import '../../../_packages/core.index';
@@ -1,4 +1,5 @@
1
1
  import { Register } from '../../utils/Register';
2
+ import type { LlmToolsMetadata } from './LlmToolsMetadata';
2
3
  /**
3
4
  * @@@
4
5
  *
@@ -6,7 +7,4 @@ import { Register } from '../../utils/Register';
6
7
  * @singleton Only one instance of each register is created per build, but thare can be more @@@
7
8
  * @public exported from `@promptbook/core`
8
9
  */
9
- export declare const $llmToolsConfigurationBoilerplatesRegister: Register<import("../../utils/Register").Registered & {
10
- title: string;
11
- options: object;
12
- }>;
10
+ export declare const $llmToolsMetadataRegister: Register<LlmToolsMetadata>;
@@ -1,8 +1,10 @@
1
1
  import type { string_title } from '../../types/typeAliases';
2
- import type { TODO_object } from '../../utils/organization/TODO_object';
3
2
  import type { Registered } from '../../utils/Register';
3
+ import type { LlmToolsOptions } from './LlmToolsOptions';
4
4
  /**
5
5
  * @@@
6
+ *
7
+ * @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
6
8
  */
7
9
  export type LlmToolsConfiguration = Array<Registered & {
8
10
  /**
@@ -12,9 +14,9 @@ export type LlmToolsConfiguration = Array<Registered & {
12
14
  /**
13
15
  * @@@
14
16
  */
15
- options: TODO_object;
17
+ options: LlmToolsOptions;
16
18
  }>;
17
19
  /**
18
20
  * TODO: [🧠][🌰] `title` is redundant BUT maybe allow each provider pass it's own title for tracking purposes
19
- * TODO: [🧠] Maybe add option for `constructorName` instead of `className`
21
+ * TODO: Maybe instead of `LlmToolsConfiguration[number]` make `LlmToolsConfigurationItem`
20
22
  */
@@ -0,0 +1,27 @@
1
+ import type { string_name } from '../../types/typeAliases';
2
+ import type { string_title } from '../../types/typeAliases';
3
+ import type { Registered } from '../../utils/Register';
4
+ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
5
+ /**
6
+ * @@@
7
+ *
8
+ * @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
9
+ */
10
+ export type LlmToolsMetadata = Registered & {
11
+ /**
12
+ * @@@
13
+ */
14
+ title: string_title;
15
+ /**
16
+ * @@@
17
+ */
18
+ getBoilerplateConfiguration(): LlmToolsConfiguration[number];
19
+ /**
20
+ * @@@
21
+ */
22
+ createConfigurationFromEnv(env: Record<string_name, string>): LlmToolsConfiguration[number] | null;
23
+ };
24
+ /**
25
+ * TODO: Add configuration schema and maybe some documentation link
26
+ * TODO: Maybe constrain LlmToolsConfiguration[number] by generic to ensure that `createConfigurationFromEnv` and `getBoilerplateConfiguration` always create same `packageName` and `className`
27
+ */
@@ -0,0 +1,7 @@
1
+ import type { TODO_object } from '../../utils/organization/TODO_object';
2
+ /**
3
+ * @@@
4
+ *
5
+ * @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
6
+ */
7
+ export type LlmToolsOptions = TODO_object;
@@ -3,7 +3,7 @@ import type { TODO_any } from '../../utils/organization/TODO_any';
3
3
  /**
4
4
  * @@@
5
5
  *
6
- * TODO: !!!!!! Not centralized - register each provider to each package
6
+ * TODO: !!!!!! Remove EXECUTION_TOOLS_CLASSES and use $llmToolsRegister instead
7
7
  *
8
8
  * @private internal type for `createLlmToolsFromConfiguration`
9
9
  */
@@ -5,4 +5,4 @@
5
5
  *
6
6
  * @public exported from `@promptbook/core`
7
7
  */
8
- export declare const _AnthropicClaudeConfigurationRegistration: void;
8
+ export declare const _AnthropicClaudeMetadataRegistration: void;
@@ -8,4 +8,4 @@
8
8
  export declare const _AnthropicClaudeRegistration: void;
9
9
  /**
10
10
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
11
- */
11
+ */
@@ -5,4 +5,4 @@
5
5
  *
6
6
  * @public exported from `@promptbook/core`
7
7
  */
8
- export declare const _OpenAiConfigurationRegistration: void;
8
+ export declare const _OpenAiMetadataRegistration: void;
@@ -8,4 +8,4 @@
8
8
  export declare const _OpenAiRegistration: void;
9
9
  /**
10
10
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
11
- */
11
+ */
@@ -1 +1 @@
1
- export {};
1
+ import '../../src/_packages/core.index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.66.0-4",
3
+ "version": "0.66.0-5",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -39,7 +39,7 @@
39
39
  /**
40
40
  * The version of the Promptbook library
41
41
  */
42
- var PROMPTBOOK_VERSION = '0.66.0-3';
42
+ var PROMPTBOOK_VERSION = '0.66.0-4';
43
43
  // TODO: !!!! List here all the versions and annotate + put into script
44
44
 
45
45
  /*! *****************************************************************************
@@ -854,7 +854,7 @@
854
854
  });
855
855
  }
856
856
 
857
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-3",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.66.0-3",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.66.0-3",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.66.0-3",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:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
857
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-4",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.66.0-4",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.66.0-4",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.66.0-4",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:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
858
858
 
859
859
  /**
860
860
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -8130,7 +8130,7 @@
8130
8130
  /**
8131
8131
  * @@@
8132
8132
  *
8133
- * TODO: !!!!!! Not centralized - register each provider to each package
8133
+ * TODO: !!!!!! Remove EXECUTION_TOOLS_CLASSES and use $llmToolsRegister instead
8134
8134
  *
8135
8135
  * @private internal type for `createLlmToolsFromConfiguration`
8136
8136
  */
@@ -8178,6 +8178,38 @@
8178
8178
  * TODO: This should be maybe not under `_common` but under `utils`
8179
8179
  */
8180
8180
 
8181
+ /**
8182
+ * Register is @@@
8183
+ *
8184
+ * @private internal utility, exported are only signleton instances of this class
8185
+ */
8186
+ var Register = /** @class */ (function () {
8187
+ function Register(storage) {
8188
+ this.storage = storage;
8189
+ }
8190
+ Register.prototype.list = function () {
8191
+ // <- TODO: ReadonlyDeep<Array<TRegistered>>
8192
+ return this.storage;
8193
+ };
8194
+ Register.prototype.register = function (registered) {
8195
+ // !!!!!! <- TODO: What to return here
8196
+ // TODO: !!!!!! Compare if same is not already registered
8197
+ this.storage.push(registered);
8198
+ };
8199
+ return Register;
8200
+ }());
8201
+
8202
+ /**
8203
+ * @@@
8204
+ *
8205
+ * Note: `$` is used to indicate that this interacts with the global scope
8206
+ * @singleton Only one instance of each register is created per build, but thare can be more @@@
8207
+ * @public exported from `@promptbook/core`
8208
+ */
8209
+ var $llmToolsMetadataRegister = new Register([
8210
+ // TODO: !!!!!! Take from global scope
8211
+ ]);
8212
+
8181
8213
  /**
8182
8214
  * @@@
8183
8215
  *
@@ -8195,28 +8227,10 @@
8195
8227
  throw new EnvironmentMismatchError('Function `createLlmToolsFromEnv` works only in Node.js environment');
8196
8228
  }
8197
8229
  dotenv__namespace.config();
8198
- var llmToolsConfiguration = [];
8199
- if (typeof process.env.OPENAI_API_KEY === 'string') {
8200
- llmToolsConfiguration.push({
8201
- title: 'OpenAI (from env)',
8202
- packageName: '@promptbook/openai',
8203
- className: 'OpenAiExecutionTools',
8204
- options: {
8205
- apiKey: process.env.OPENAI_API_KEY,
8206
- },
8207
- });
8208
- }
8209
- if (typeof process.env.ANTHROPIC_CLAUDE_API_KEY === 'string') {
8210
- llmToolsConfiguration.push({
8211
- title: 'Claude (from env)',
8212
- packageName: '@promptbook/antrhopic-claude',
8213
- className: 'AnthropicClaudeExecutionTools',
8214
- options: {
8215
- apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
8216
- },
8217
- });
8218
- }
8219
- // <- Note: [🦑] Add here new LLM provider
8230
+ var llmToolsConfiguration = $llmToolsMetadataRegister
8231
+ .list()
8232
+ .map(function (metadata) { return metadata.createConfigurationFromEnv(process.env); })
8233
+ .filter(function (configuration) { return configuration !== null; });
8220
8234
  return llmToolsConfiguration;
8221
8235
  }
8222
8236
  /**
@@ -8251,7 +8265,7 @@
8251
8265
  var configuration = createLlmToolsFromConfigurationFromEnv();
8252
8266
  if (configuration.length === 0) {
8253
8267
  // TODO: [🥃]
8254
- throw new Error(spaceTrim__default["default"]("\n No LLM tools found in the environment\n\n Please set one of environment variables:\n - OPENAI_API_KEY\n - ANTHROPIC_CLAUDE_API_KEY\n "));
8268
+ throw new Error(spaceTrim__default["default"]("\n No LLM tools found in the environment\n\n !!!!!!!@@@@You have maybe forgotten to two things:\n\n Please set one of environment variables:\n - OPENAI_API_KEY\n - ANTHROPIC_CLAUDE_API_KEY\n "));
8255
8269
  }
8256
8270
  return createLlmToolsFromConfiguration(configuration, options);
8257
8271
  }
@@ -8469,6 +8483,7 @@
8469
8483
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
8470
8484
  */
8471
8485
 
8486
+ // TODO: !!!!!! Probbably all LLM tools should be registered in `@promptbook/cli`
8472
8487
  /**
8473
8488
  * Initializes `make` command for Promptbook CLI utilities
8474
8489
  *
@@ -8653,7 +8668,7 @@
8653
8668
  });
8654
8669
  }
8655
8670
  /**
8656
- * TODO: [🥃] !!! Allow `ptbk make` without llm tools
8671
+ * TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
8657
8672
  * TODO: Maybe remove this command - "about" command should be enough?
8658
8673
  * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
8659
8674
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`