@promptbook/core 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/core`
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
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.98.0-9';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.98.0';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -10529,6 +10529,24 @@ const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
10529
10529
  * TODO: [®] DRY Register logic
10530
10530
  */
10531
10531
 
10532
+ /**
10533
+ * Detects if the code is running in a browser environment in main thread (Not in a web worker)
10534
+ *
10535
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
10536
+ *
10537
+ * @public exported from `@promptbook/utils`
10538
+ */
10539
+ const $isRunningInBrowser = new Function(`
10540
+ try {
10541
+ return this === window;
10542
+ } catch (e) {
10543
+ return false;
10544
+ }
10545
+ `);
10546
+ /**
10547
+ * TODO: [🎺]
10548
+ */
10549
+
10532
10550
  /**
10533
10551
  * Detects if the code is running in a Node.js environment
10534
10552
  *
@@ -10547,6 +10565,28 @@ const $isRunningInNode = new Function(`
10547
10565
  * TODO: [🎺]
10548
10566
  */
10549
10567
 
10568
+ /**
10569
+ * Detects if the code is running in a web worker
10570
+ *
10571
+ * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
10572
+ *
10573
+ * @public exported from `@promptbook/utils`
10574
+ */
10575
+ const $isRunningInWebWorker = new Function(`
10576
+ try {
10577
+ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
10578
+ return true;
10579
+ } else {
10580
+ return false;
10581
+ }
10582
+ } catch (e) {
10583
+ return false;
10584
+ }
10585
+ `);
10586
+ /**
10587
+ * TODO: [🎺]
10588
+ */
10589
+
10550
10590
  /**
10551
10591
  * Creates a message with all registered LLM tools
10552
10592
  *
@@ -10691,9 +10731,10 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
10691
10731
  .list()
10692
10732
  .find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
10693
10733
  if (registeredItem === undefined) {
10694
- console.log('!!! $llmToolsRegister.list()', $llmToolsRegister.list());
10734
+ // console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
10695
10735
  throw new Error(spaceTrim((block) => `
10696
10736
  There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
10737
+ Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
10697
10738
 
10698
10739
  You have probably forgotten install and import the provider package.
10699
10740
  To fix this issue, you can:
@@ -11410,6 +11451,7 @@ const _OpenAiCompatibleMetadataRegistration = $llmToolsMetadataRegister.register
11410
11451
  options: {
11411
11452
  apiKey: 'sk-',
11412
11453
  baseURL: 'https://api.openai.com/v1',
11454
+ defaultModelName: 'gpt-4-turbo',
11413
11455
  isProxied: false,
11414
11456
  remoteServerUrl: DEFAULT_REMOTE_SERVER_URL,
11415
11457
  maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,