@promptbook/node 0.86.31 → 0.88.0-1
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 +5 -3
- package/esm/index.es.js +23 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/scrapers/_common/register/$provideScriptingForNode.d.ts +11 -0
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +23 -5
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/_packages/{execute-javascript.index.d.ts → javascript.index.d.ts} +0 -0
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/node`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -253,7 +257,7 @@ Or you can install them separately:
|
|
|
253
257
|
- ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
|
|
254
258
|
- **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
|
|
255
259
|
- _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
|
|
256
|
-
- **[@promptbook/
|
|
260
|
+
- **[@promptbook/javascript](https://www.npmjs.com/package/@promptbook/javascript)** - Execution tools for javascript inside promptbooks
|
|
257
261
|
- **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
|
|
258
262
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
259
263
|
- **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
|
|
@@ -409,8 +413,6 @@ Promptbook project is under [BUSL 1.1 is an SPDX license](https://spdx.org/licen
|
|
|
409
413
|
|
|
410
414
|
See [TODO.md](./TODO.md)
|
|
411
415
|
|
|
412
|
-
|
|
413
|
-
|
|
414
416
|
## 🤝 Partners
|
|
415
417
|
|
|
416
418
|
<div style="display: flex; align-items: center; gap: 20px;">
|
package/esm/index.es.js
CHANGED
|
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.88.0-1';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2122,7 +2122,7 @@ function addUsage(...usageItems) {
|
|
|
2122
2122
|
* @param script from which to extract the variables
|
|
2123
2123
|
* @returns the list of variable names
|
|
2124
2124
|
* @throws {ParseError} if the script is invalid
|
|
2125
|
-
* @public exported from `@promptbook/
|
|
2125
|
+
* @public exported from `@promptbook/javascript`
|
|
2126
2126
|
*/
|
|
2127
2127
|
function extractVariablesFromJavascript(script) {
|
|
2128
2128
|
const variables = new Set();
|
|
@@ -9905,7 +9905,7 @@ function preserve(func) {
|
|
|
9905
9905
|
* Warning: It is used for testing and mocking
|
|
9906
9906
|
* **NOT intended to use in the production** due to its unsafe nature, use `JavascriptExecutionTools` instead.
|
|
9907
9907
|
*
|
|
9908
|
-
* @public exported from `@promptbook/
|
|
9908
|
+
* @public exported from `@promptbook/javascript`
|
|
9909
9909
|
*/
|
|
9910
9910
|
class JavascriptEvalExecutionTools {
|
|
9911
9911
|
constructor(options) {
|
|
@@ -10011,7 +10011,8 @@ class JavascriptEvalExecutionTools {
|
|
|
10011
10011
|
// Note: Custom functions are exposed to the current scope as variables
|
|
10012
10012
|
`const ${functionName} = customFunctions.${functionName};`)
|
|
10013
10013
|
.join('\n');
|
|
10014
|
-
script = templateParameters(script, parameters);
|
|
10014
|
+
// script = templateParameters(script, parameters);
|
|
10015
|
+
// <- TODO: [🧠][🥳] Should be this is one of two variants how to use parameters in script
|
|
10015
10016
|
const statementToEvaluate = spaceTrim((block) => `
|
|
10016
10017
|
|
|
10017
10018
|
// Build-in functions:
|
|
@@ -10102,7 +10103,7 @@ class JavascriptEvalExecutionTools {
|
|
|
10102
10103
|
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
10103
10104
|
*
|
|
10104
10105
|
* @alias JavascriptExecutionTools
|
|
10105
|
-
* @public exported from `@promptbook/
|
|
10106
|
+
* @public exported from `@promptbook/javascript`
|
|
10106
10107
|
*/
|
|
10107
10108
|
const JavascriptExecutionTools = JavascriptEvalExecutionTools;
|
|
10108
10109
|
|
|
@@ -10445,6 +10446,22 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
10445
10446
|
* TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
|
|
10446
10447
|
*/
|
|
10447
10448
|
|
|
10449
|
+
/**
|
|
10450
|
+
* Provides script execution tools
|
|
10451
|
+
*
|
|
10452
|
+
* @public exported from `@promptbook/node`
|
|
10453
|
+
*/
|
|
10454
|
+
async function $provideScriptingForNode(options) {
|
|
10455
|
+
if (!$isRunningInNode()) {
|
|
10456
|
+
throw new EnvironmentMismatchError('Function `$provideScriptingForNode` works only in Node.js environment');
|
|
10457
|
+
}
|
|
10458
|
+
// TODO: [🔱] Do here auto-installation
|
|
10459
|
+
return [new JavascriptExecutionTools(options)];
|
|
10460
|
+
}
|
|
10461
|
+
/**
|
|
10462
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10463
|
+
*/
|
|
10464
|
+
|
|
10448
10465
|
/**
|
|
10449
10466
|
* Stringify the PipelineJson with proper formatting
|
|
10450
10467
|
*
|
|
@@ -10563,5 +10580,5 @@ async function $execCommands({ commands, cwd, crashOnError, }) {
|
|
|
10563
10580
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10564
10581
|
*/
|
|
10565
10582
|
|
|
10566
|
-
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, BOOK_LANGUAGE_VERSION, FileCacheStorage, PROMPTBOOK_ENGINE_VERSION, createCollectionFromDirectory };
|
|
10583
|
+
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, $provideScriptingForNode, BOOK_LANGUAGE_VERSION, FileCacheStorage, PROMPTBOOK_ENGINE_VERSION, createCollectionFromDirectory };
|
|
10567
10584
|
//# sourceMappingURL=index.es.js.map
|