@promptbook/cli 0.75.10 → 0.77.0-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/README.md +6 -9
- package/esm/index.es.js +21 -30
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/gemini.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/vercel.index.d.ts +4 -0
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +9 -0
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +1 -10
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/vercel/createExecutionToolsFromVercelProvider.d.ts +11 -0
- package/esm/typings/src/llm-providers/vercel/playground/playground.d.ts +6 -0
- package/esm/typings/src/utils/{$currentDate.d.ts → $getCurrentDate.d.ts} +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +21 -30
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/getCurrentIsoDate.d.ts +0 -7
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
<blockquote style="color: #ff8811">
|
|
27
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
+
</blockquote>
|
|
29
|
+
|
|
26
30
|
## 📦 Package `@promptbook/cli`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -293,6 +297,8 @@ Or you can install them separately:
|
|
|
293
297
|
- **[@promptbook/execute-javascript](https://www.npmjs.com/package/@promptbook/execute-javascript)** - Execution tools for javascript inside promptbooks
|
|
294
298
|
- **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
|
|
295
299
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
300
|
+
- **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
|
|
301
|
+
- **[@promptbook/gemini](https://www.npmjs.com/package/@promptbook/gemini)** - Integration with Google's Gemini API
|
|
296
302
|
- **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API
|
|
297
303
|
- **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
|
|
298
304
|
- **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
|
|
@@ -312,11 +318,6 @@ Or you can install them separately:
|
|
|
312
318
|
|
|
313
319
|
## 📚 Dictionary
|
|
314
320
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
321
|
### 📚 Dictionary
|
|
321
322
|
|
|
322
323
|
The following glossary is used to clarify certain concepts:
|
|
@@ -332,8 +333,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
332
333
|
- **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
|
|
333
334
|
- **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
|
|
337
336
|
_Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
338
337
|
|
|
339
338
|
#### Promptbook core
|
|
@@ -394,8 +393,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
394
393
|
- [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
|
|
395
394
|
- [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
|
|
396
395
|
|
|
397
|
-
|
|
398
|
-
|
|
399
396
|
### Terms specific to Promptbook TypeScript implementation
|
|
400
397
|
|
|
401
398
|
- Anonymous mode
|
package/esm/index.es.js
CHANGED
|
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
37
37
|
*
|
|
38
38
|
* @see https://github.com/webgptorg/promptbook
|
|
39
39
|
*/
|
|
40
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
40
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.76.0';
|
|
41
41
|
/**
|
|
42
42
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
43
43
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5645,7 +5645,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5645
5645
|
llmToolsWithUsage = countTotalUsage(llmTools);
|
|
5646
5646
|
currentPreparation = {
|
|
5647
5647
|
id: 1,
|
|
5648
|
-
// TODO: [🍥]> date: $
|
|
5648
|
+
// TODO: [🍥]> date: $getCurrentDate(),
|
|
5649
5649
|
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5650
5650
|
usage: ZERO_USAGE,
|
|
5651
5651
|
};
|
|
@@ -10549,7 +10549,7 @@ var MemoryStorage = /** @class */ (function () {
|
|
|
10549
10549
|
* @returns string_date branded type
|
|
10550
10550
|
* @public exported from `@promptbook/utils`
|
|
10551
10551
|
*/
|
|
10552
|
-
function $
|
|
10552
|
+
function $getCurrentDate() {
|
|
10553
10553
|
return new Date().toISOString();
|
|
10554
10554
|
}
|
|
10555
10555
|
|
|
@@ -10624,7 +10624,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
10624
10624
|
// TODO: [🧠] !!!!! How to do timing in mixed cache / non-cache situation
|
|
10625
10625
|
// promptResult.timing: FromtoItems
|
|
10626
10626
|
return [4 /*yield*/, storage.setItem(key, {
|
|
10627
|
-
date: $
|
|
10627
|
+
date: $getCurrentDate(),
|
|
10628
10628
|
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
10629
10629
|
prompt: prompt,
|
|
10630
10630
|
promptResult: promptResult,
|
|
@@ -12198,15 +12198,6 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
12198
12198
|
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
12199
12199
|
*/
|
|
12200
12200
|
|
|
12201
|
-
/**
|
|
12202
|
-
* Get current date in ISO 8601 format
|
|
12203
|
-
*
|
|
12204
|
-
* @private internal utility
|
|
12205
|
-
*/
|
|
12206
|
-
function getCurrentIsoDate() {
|
|
12207
|
-
return new Date().toISOString();
|
|
12208
|
-
}
|
|
12209
|
-
|
|
12210
12201
|
/**
|
|
12211
12202
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
12212
12203
|
*
|
|
@@ -12481,7 +12472,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
12481
12472
|
],
|
|
12482
12473
|
// TODO: Is here some equivalent of user identification?> user: this.options.user,
|
|
12483
12474
|
};
|
|
12484
|
-
start =
|
|
12475
|
+
start = $getCurrentDate();
|
|
12485
12476
|
if (this.options.isVerbose) {
|
|
12486
12477
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
12487
12478
|
}
|
|
@@ -12508,7 +12499,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
12508
12499
|
}
|
|
12509
12500
|
resultContent = contentBlock.text;
|
|
12510
12501
|
// eslint-disable-next-line prefer-const
|
|
12511
|
-
complete =
|
|
12502
|
+
complete = $getCurrentDate();
|
|
12512
12503
|
usage = computeAnthropicClaudeUsage(rawPromptContent || '', resultContent || '', rawResponse);
|
|
12513
12504
|
return [2 /*return*/, $asDeeplyFrozenSerializableJson('AnthropicClaudeExecutionTools ChatPromptResult', {
|
|
12514
12505
|
content: resultContent,
|
|
@@ -12557,7 +12548,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
12557
12548
|
prompt: rawPromptContent,
|
|
12558
12549
|
user: this.options.user,
|
|
12559
12550
|
};
|
|
12560
|
-
const start: string_date_iso8601 =
|
|
12551
|
+
const start: string_date_iso8601 = $getCurrentDate();
|
|
12561
12552
|
let complete: string_date_iso8601;
|
|
12562
12553
|
|
|
12563
12554
|
if (this.options.isVerbose) {
|
|
@@ -12586,7 +12577,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
12586
12577
|
|
|
12587
12578
|
const resultContent = rawResponse.choices[0].text;
|
|
12588
12579
|
// eslint-disable-next-line prefer-const
|
|
12589
|
-
complete =
|
|
12580
|
+
complete = $getCurrentDate();
|
|
12590
12581
|
const usage = { price: 'UNKNOWN', inputTokens: 0, outputTokens: 0 /* <- TODO: [🐞] Compute usage * / } satisfies PromptResultUsage;
|
|
12591
12582
|
|
|
12592
12583
|
|
|
@@ -12648,7 +12639,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
12648
12639
|
*/
|
|
12649
12640
|
var createAnthropicClaudeExecutionTools = Object.assign(function (options) {
|
|
12650
12641
|
if (options.isProxied) {
|
|
12651
|
-
return new RemoteLlmExecutionTools(__assign(__assign({}, options), {
|
|
12642
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { isAnonymous: true, llmToolsConfiguration: [
|
|
12652
12643
|
{
|
|
12653
12644
|
title: 'Anthropic Claude (proxied)',
|
|
12654
12645
|
packageName: '@promptbook/anthropic-claude',
|
|
@@ -13257,7 +13248,7 @@ var AzureOpenAiExecutionTools = /** @class */ (function () {
|
|
|
13257
13248
|
content: rawPromptContent,
|
|
13258
13249
|
},
|
|
13259
13250
|
], false);
|
|
13260
|
-
start =
|
|
13251
|
+
start = $getCurrentDate();
|
|
13261
13252
|
complete = void 0;
|
|
13262
13253
|
if (this.options.isVerbose) {
|
|
13263
13254
|
console.info(colors.bgWhite('messages'), JSON.stringify(messages, null, 4));
|
|
@@ -13286,7 +13277,7 @@ var AzureOpenAiExecutionTools = /** @class */ (function () {
|
|
|
13286
13277
|
}
|
|
13287
13278
|
resultContent = rawResponse.choices[0].message.content;
|
|
13288
13279
|
// eslint-disable-next-line prefer-const
|
|
13289
|
-
complete =
|
|
13280
|
+
complete = $getCurrentDate();
|
|
13290
13281
|
usage = {
|
|
13291
13282
|
price: uncertainNumber() /* <- TODO: [🐞] Compute usage */,
|
|
13292
13283
|
input: __assign({ tokensCount: uncertainNumber((_b = rawResponse.usage) === null || _b === void 0 ? void 0 : _b.promptTokens) }, computeUsageCounts(prompt.content)),
|
|
@@ -13347,7 +13338,7 @@ var AzureOpenAiExecutionTools = /** @class */ (function () {
|
|
|
13347
13338
|
// <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
|
|
13348
13339
|
// <- Note: [🧆]
|
|
13349
13340
|
};
|
|
13350
|
-
start =
|
|
13341
|
+
start = $getCurrentDate();
|
|
13351
13342
|
complete = void 0;
|
|
13352
13343
|
if (this.options.isVerbose) {
|
|
13353
13344
|
console.info(colors.bgWhite('content'), JSON.stringify(content, null, 4));
|
|
@@ -13379,7 +13370,7 @@ var AzureOpenAiExecutionTools = /** @class */ (function () {
|
|
|
13379
13370
|
}
|
|
13380
13371
|
resultContent = rawResponse.choices[0].text;
|
|
13381
13372
|
// eslint-disable-next-line prefer-const
|
|
13382
|
-
complete =
|
|
13373
|
+
complete = $getCurrentDate();
|
|
13383
13374
|
usage = {
|
|
13384
13375
|
price: uncertainNumber() /* <- TODO: [🐞] Compute usage */,
|
|
13385
13376
|
input: __assign({ tokensCount: uncertainNumber((_b = rawResponse.usage) === null || _b === void 0 ? void 0 : _b.promptTokens) }, computeUsageCounts(prompt.content)),
|
|
@@ -13747,7 +13738,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
13747
13738
|
content: rawPromptContent,
|
|
13748
13739
|
},
|
|
13749
13740
|
], false), user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString() });
|
|
13750
|
-
start =
|
|
13741
|
+
start = $getCurrentDate();
|
|
13751
13742
|
if (this.options.isVerbose) {
|
|
13752
13743
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
13753
13744
|
}
|
|
@@ -13771,7 +13762,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
13771
13762
|
}
|
|
13772
13763
|
resultContent = rawResponse.choices[0].message.content;
|
|
13773
13764
|
// eslint-disable-next-line prefer-const
|
|
13774
|
-
complete =
|
|
13765
|
+
complete = $getCurrentDate();
|
|
13775
13766
|
usage = computeOpenAiUsage(content || '', resultContent || '', rawResponse);
|
|
13776
13767
|
if (resultContent === null) {
|
|
13777
13768
|
throw new PipelineExecutionError('No response message from OpenAI');
|
|
@@ -13826,7 +13817,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
13826
13817
|
};
|
|
13827
13818
|
rawPromptContent = replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName }));
|
|
13828
13819
|
rawRequest = __assign(__assign({}, modelSettings), { prompt: rawPromptContent, user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString() });
|
|
13829
|
-
start =
|
|
13820
|
+
start = $getCurrentDate();
|
|
13830
13821
|
if (this.options.isVerbose) {
|
|
13831
13822
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
13832
13823
|
}
|
|
@@ -13850,7 +13841,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
13850
13841
|
}
|
|
13851
13842
|
resultContent = rawResponse.choices[0].text;
|
|
13852
13843
|
// eslint-disable-next-line prefer-const
|
|
13853
|
-
complete =
|
|
13844
|
+
complete = $getCurrentDate();
|
|
13854
13845
|
usage = computeOpenAiUsage(content || '', resultContent || '', rawResponse);
|
|
13855
13846
|
return [2 /*return*/, $asDeeplyFrozenSerializableJson('OpenAiExecutionTools CompletionPromptResult', {
|
|
13856
13847
|
content: resultContent,
|
|
@@ -13896,7 +13887,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
13896
13887
|
input: rawPromptContent,
|
|
13897
13888
|
model: modelName,
|
|
13898
13889
|
};
|
|
13899
|
-
start =
|
|
13890
|
+
start = $getCurrentDate();
|
|
13900
13891
|
if (this.options.isVerbose) {
|
|
13901
13892
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
13902
13893
|
}
|
|
@@ -13916,7 +13907,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
13916
13907
|
}
|
|
13917
13908
|
resultContent = rawResponse.data[0].embedding;
|
|
13918
13909
|
// eslint-disable-next-line prefer-const
|
|
13919
|
-
complete =
|
|
13910
|
+
complete = $getCurrentDate();
|
|
13920
13911
|
usage = computeOpenAiUsage(content || '', '',
|
|
13921
13912
|
// <- Note: Embedding does not have result content
|
|
13922
13913
|
rawResponse);
|
|
@@ -14069,7 +14060,7 @@ var OpenAiAssistantExecutionTools = /** @class */ (function (_super) {
|
|
|
14069
14060
|
},
|
|
14070
14061
|
// <- TODO: Add user identification here> user: this.options.user,
|
|
14071
14062
|
};
|
|
14072
|
-
start =
|
|
14063
|
+
start = $getCurrentDate();
|
|
14073
14064
|
if (this.options.isVerbose) {
|
|
14074
14065
|
console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
|
|
14075
14066
|
}
|
|
@@ -14120,7 +14111,7 @@ var OpenAiAssistantExecutionTools = /** @class */ (function (_super) {
|
|
|
14120
14111
|
resultContent = (_c = rawResponse[0].content[0]) === null || _c === void 0 ? void 0 : _c.text.value;
|
|
14121
14112
|
// <- TODO: [🧠] There are also annotations, maybe use them
|
|
14122
14113
|
// eslint-disable-next-line prefer-const
|
|
14123
|
-
complete =
|
|
14114
|
+
complete = $getCurrentDate();
|
|
14124
14115
|
usage = UNCERTAIN_USAGE;
|
|
14125
14116
|
// <- TODO: [🥘] Compute real usage for assistant
|
|
14126
14117
|
// ?> const usage = computeOpenAiUsage(content, resultContent || '', rawResponse);
|