@promptbook/node 0.98.0-9 → 0.98.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 CHANGED
@@ -25,10 +25,6 @@ Write AI applications using plain human language across multiple models and plat
25
25
 
26
26
 
27
27
 
28
- <blockquote style="color: #ff8811">
29
- <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>.
30
- </blockquote>
31
-
32
28
  ## 📦 Package `@promptbook/node`
33
29
 
34
30
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
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.98.0-9';
33
+ const PROMPTBOOK_ENGINE_VERSION = '0.98.0';
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
@@ -10178,6 +10178,46 @@ async function $provideLlmToolsConfigurationFromEnv() {
10178
10178
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
10179
10179
  */
10180
10180
 
10181
+ /**
10182
+ * Detects if the code is running in a browser environment in main thread (Not in a web worker)
10183
+ *
10184
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
10185
+ *
10186
+ * @public exported from `@promptbook/utils`
10187
+ */
10188
+ const $isRunningInBrowser = new Function(`
10189
+ try {
10190
+ return this === window;
10191
+ } catch (e) {
10192
+ return false;
10193
+ }
10194
+ `);
10195
+ /**
10196
+ * TODO: [🎺]
10197
+ */
10198
+
10199
+ /**
10200
+ * Detects if the code is running in a web worker
10201
+ *
10202
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
10203
+ *
10204
+ * @public exported from `@promptbook/utils`
10205
+ */
10206
+ const $isRunningInWebWorker = new Function(`
10207
+ try {
10208
+ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
10209
+ return true;
10210
+ } else {
10211
+ return false;
10212
+ }
10213
+ } catch (e) {
10214
+ return false;
10215
+ }
10216
+ `);
10217
+ /**
10218
+ * TODO: [🎺]
10219
+ */
10220
+
10181
10221
  /**
10182
10222
  * Creates LLM execution tools from provided configuration objects
10183
10223
  *
@@ -10198,9 +10238,10 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
10198
10238
  .list()
10199
10239
  .find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
10200
10240
  if (registeredItem === undefined) {
10201
- console.log('!!! $llmToolsRegister.list()', $llmToolsRegister.list());
10241
+ // console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
10202
10242
  throw new Error(spaceTrim((block) => `
10203
10243
  There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
10244
+ Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
10204
10245
 
10205
10246
  You have probably forgotten install and import the provider package.
10206
10247
  To fix this issue, you can:
@@ -10327,24 +10368,6 @@ async function $provideScrapersForNode(tools, options) {
10327
10368
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
10328
10369
  */
10329
10370
 
10330
- /**
10331
- * Detects if the code is running in a browser environment in main thread (Not in a web worker)
10332
- *
10333
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
10334
- *
10335
- * @public exported from `@promptbook/utils`
10336
- */
10337
- new Function(`
10338
- try {
10339
- return this === window;
10340
- } catch (e) {
10341
- return false;
10342
- }
10343
- `);
10344
- /**
10345
- * TODO: [🎺]
10346
- */
10347
-
10348
10371
  /**
10349
10372
  * Detects if the code is running in jest environment
10350
10373
  *
@@ -10363,28 +10386,6 @@ new Function(`
10363
10386
  * TODO: [🎺]
10364
10387
  */
10365
10388
 
10366
- /**
10367
- * Detects if the code is running in a web worker
10368
- *
10369
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
10370
- *
10371
- * @public exported from `@promptbook/utils`
10372
- */
10373
- new Function(`
10374
- try {
10375
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
10376
- return true;
10377
- } else {
10378
- return false;
10379
- }
10380
- } catch (e) {
10381
- return false;
10382
- }
10383
- `);
10384
- /**
10385
- * TODO: [🎺]
10386
- */
10387
-
10388
10389
  /**
10389
10390
  * Makes first letter of a string uppercase
10390
10391
  *