@promptbook/openai 0.72.0-0 → 0.72.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.
Files changed (65) hide show
  1. package/README.md +10 -6
  2. package/esm/index.es.js +176 -122
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +11 -1
  6. package/esm/typings/src/_packages/openai.index.d.ts +4 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +12 -0
  8. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  9. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +3 -2
  10. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +23 -0
  11. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
  12. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +16 -1
  13. package/esm/typings/src/config.d.ts +14 -1
  14. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -0
  15. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +2 -1
  16. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +5 -0
  17. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +9 -8
  18. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +45 -0
  19. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +20 -0
  20. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +40 -0
  21. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +10 -0
  22. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +55 -0
  23. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +62 -0
  24. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatCells.d.ts +19 -0
  25. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +74 -0
  26. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +34 -0
  27. package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +10 -0
  28. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +27 -0
  29. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +30 -0
  30. package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +10 -0
  31. package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
  32. package/esm/typings/src/execution/utils/usageToHuman.d.ts +3 -4
  33. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +14 -15
  34. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +30 -0
  35. package/esm/typings/src/formats/csv/{ListFormatDefinition.d.ts → CsvFormatDefinition.d.ts} +6 -3
  36. package/esm/typings/src/formats/csv/CsvSettings.d.ts +13 -0
  37. package/esm/typings/src/formats/index.d.ts +1 -1
  38. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +4 -3
  39. package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +19 -0
  40. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +4 -3
  41. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +9 -0
  44. package/esm/typings/src/llm-providers/openai/createOpenAiAssistantExecutionTools.d.ts +15 -0
  45. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +9 -0
  46. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +9 -0
  47. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +1 -0
  48. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +5 -0
  49. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -0
  50. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -0
  51. package/esm/typings/src/utils/organization/{f.d.ts → empty_object.d.ts} +5 -1
  52. package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
  53. package/esm/typings/src/utils/{extractParameterNames.d.ts → parameters/extractParameterNames.d.ts} +2 -2
  54. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +27 -0
  55. package/esm/typings/src/utils/{replaceParameters.d.ts → parameters/replaceParameters.d.ts} +2 -2
  56. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +10 -0
  57. package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +1 -0
  58. package/package.json +17 -13
  59. package/umd/index.umd.js +181 -125
  60. package/umd/index.umd.js.map +1 -1
  61. package/esm/typings/src/execution/createPipelineExecutor.d.ts +0 -72
  62. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +0 -16
  63. /package/esm/typings/src/utils/{extractParameterNames.test.d.ts → parameters/extractParameterNames.test.d.ts} +0 -0
  64. /package/esm/typings/src/{execution/utils/usageToHuman.test.d.ts → utils/parameters/mapAvailableToExpectedParameters.test.d.ts} +0 -0
  65. /package/esm/typings/src/utils/{replaceParameters.test.d.ts → parameters/replaceParameters.test.d.ts} +0 -0
package/README.md CHANGED
@@ -16,6 +16,10 @@ Supercharge your use of large language models
16
16
 
17
17
 
18
18
 
19
+ ## ✨ New Features
20
+
21
+ - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
22
+
19
23
  ## 📦 Package `@promptbook/openai`
20
24
 
21
25
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -28,7 +32,7 @@ To install this package, run:
28
32
  npm i ptbk
29
33
 
30
34
  # Install just this package to save space
31
- npm i @promptbook/openai
35
+ npm install @promptbook/openai
32
36
  ```
33
37
 
34
38
  `@promptbook/openai` integrates [OpenAI's API](https://openai.com/) with [Promptbook](https://github.com/webgptorg/promptbook). It allows to execute Promptbooks with OpenAI GPT models.
@@ -79,6 +83,11 @@ const { isSuccessful, errors, outputParameters, executionReport } = result;
79
83
  console.info(outputParameters);
80
84
  ```
81
85
 
86
+ ## 🤺 Usage with OpenAI`s Assistants (GPTs)
87
+
88
+ !!!!!!
89
+ OpenAiExecutionTools.createAssistantSubtools
90
+
82
91
  ## 🧙‍♂️ Connect to LLM providers automatically
83
92
 
84
93
  You can just use `createLlmToolsFromEnv` function to create LLM tools from environment variables like `OPENAI_API_KEY` and `ANTHROPIC_CLAUDE_API_KEY` automatically.
@@ -202,10 +211,6 @@ See the other models available in the Promptbook package:
202
211
 
203
212
  Rest of the documentation is common for **entire promptbook ecosystem**:
204
213
 
205
- # ✨ New Features
206
-
207
- - ✨ **Support [OpenAI o1 model](https://openai.com/o1/)**
208
-
209
214
  ## 🤍 The Promptbook Whitepaper
210
215
 
211
216
 
@@ -252,7 +257,6 @@ File `write-website-content.ptbk.md`:
252
257
  > Instructions for creating web page content.
253
258
  >
254
259
  > - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
255
- > - PROMPTBOOK VERSION 0.0.1
256
260
  > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
257
261
  > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
258
262
  > - OUTPUT PARAM `{websiteContent}` Web content
package/esm/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import colors from 'colors';
2
- import OpenAI from 'openai';
3
2
  import spaceTrim$1, { spaceTrim } from 'spacetrim';
3
+ import OpenAI from 'openai';
4
4
 
5
5
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
6
6
  /**
7
7
  * The version of the Promptbook library
8
8
  */
9
- var PROMPTBOOK_VERSION = '0.68.5';
9
+ var PROMPTBOOK_VERSION = '0.72.0-0';
10
10
  // TODO:[main] !!!! List here all the versions and annotate + put into script
11
11
 
12
12
  /*! *****************************************************************************
@@ -147,46 +147,37 @@ var $isRunningInBrowser = new Function("\n try {\n return this === win
147
147
  var $isRunningInWebWorker = new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
148
148
 
149
149
  /**
150
- * This error indicates errors during the execution of the pipeline
150
+ * This error type indicates that some part of the code is not implemented yet
151
151
  *
152
152
  * @public exported from `@promptbook/core`
153
153
  */
154
- var PipelineExecutionError = /** @class */ (function (_super) {
155
- __extends(PipelineExecutionError, _super);
156
- function PipelineExecutionError(message) {
157
- var _this = _super.call(this, message) || this;
158
- _this.name = 'PipelineExecutionError';
159
- Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
154
+ var NotYetImplementedError = /** @class */ (function (_super) {
155
+ __extends(NotYetImplementedError, _super);
156
+ function NotYetImplementedError(message) {
157
+ var _this = _super.call(this, spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
158
+ _this.name = 'NotYetImplementedError';
159
+ Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
160
160
  return _this;
161
161
  }
162
- return PipelineExecutionError;
162
+ return NotYetImplementedError;
163
163
  }(Error));
164
164
 
165
165
  /**
166
- * This error type indicates that the error should not happen and its last check before crashing with some other error
166
+ * This error indicates errors during the execution of the pipeline
167
167
  *
168
168
  * @public exported from `@promptbook/core`
169
169
  */
170
- var UnexpectedError = /** @class */ (function (_super) {
171
- __extends(UnexpectedError, _super);
172
- function UnexpectedError(message) {
173
- var _this = _super.call(this, spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
174
- _this.name = 'UnexpectedError';
175
- Object.setPrototypeOf(_this, UnexpectedError.prototype);
170
+ var PipelineExecutionError = /** @class */ (function (_super) {
171
+ __extends(PipelineExecutionError, _super);
172
+ function PipelineExecutionError(message) {
173
+ var _this = _super.call(this, message) || this;
174
+ _this.name = 'PipelineExecutionError';
175
+ Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
176
176
  return _this;
177
177
  }
178
- return UnexpectedError;
178
+ return PipelineExecutionError;
179
179
  }(Error));
180
180
 
181
- /**
182
- * Get current date in ISO 8601 format
183
- *
184
- * @private internal utility
185
- */
186
- function getCurrentIsoDate() {
187
- return new Date().toISOString();
188
- }
189
-
190
181
  /**
191
182
  * @@@
192
183
  *
@@ -221,6 +212,84 @@ function $deepFreeze(objectValue) {
221
212
  * TODO: [🧠] Is there a way how to meaningfully test this utility
222
213
  */
223
214
 
215
+ /**
216
+ * Represents the usage with no resources consumed
217
+ *
218
+ * @public exported from `@promptbook/core`
219
+ */
220
+ $deepFreeze({
221
+ price: { value: 0 },
222
+ input: {
223
+ tokensCount: { value: 0 },
224
+ charactersCount: { value: 0 },
225
+ wordsCount: { value: 0 },
226
+ sentencesCount: { value: 0 },
227
+ linesCount: { value: 0 },
228
+ paragraphsCount: { value: 0 },
229
+ pagesCount: { value: 0 },
230
+ },
231
+ output: {
232
+ tokensCount: { value: 0 },
233
+ charactersCount: { value: 0 },
234
+ wordsCount: { value: 0 },
235
+ sentencesCount: { value: 0 },
236
+ linesCount: { value: 0 },
237
+ paragraphsCount: { value: 0 },
238
+ pagesCount: { value: 0 },
239
+ },
240
+ });
241
+ /**
242
+ * Represents the usage with unknown resources consumed
243
+ *
244
+ * @public exported from `@promptbook/core`
245
+ */
246
+ var UNCERTAIN_USAGE = $deepFreeze({
247
+ price: { value: 0, isUncertain: true },
248
+ input: {
249
+ tokensCount: { value: 0, isUncertain: true },
250
+ charactersCount: { value: 0, isUncertain: true },
251
+ wordsCount: { value: 0, isUncertain: true },
252
+ sentencesCount: { value: 0, isUncertain: true },
253
+ linesCount: { value: 0, isUncertain: true },
254
+ paragraphsCount: { value: 0, isUncertain: true },
255
+ pagesCount: { value: 0, isUncertain: true },
256
+ },
257
+ output: {
258
+ tokensCount: { value: 0, isUncertain: true },
259
+ charactersCount: { value: 0, isUncertain: true },
260
+ wordsCount: { value: 0, isUncertain: true },
261
+ sentencesCount: { value: 0, isUncertain: true },
262
+ linesCount: { value: 0, isUncertain: true },
263
+ paragraphsCount: { value: 0, isUncertain: true },
264
+ pagesCount: { value: 0, isUncertain: true },
265
+ },
266
+ });
267
+
268
+ /**
269
+ * Get current date in ISO 8601 format
270
+ *
271
+ * @private internal utility
272
+ */
273
+ function getCurrentIsoDate() {
274
+ return new Date().toISOString();
275
+ }
276
+
277
+ /**
278
+ * This error type indicates that the error should not happen and its last check before crashing with some other error
279
+ *
280
+ * @public exported from `@promptbook/core`
281
+ */
282
+ var UnexpectedError = /** @class */ (function (_super) {
283
+ __extends(UnexpectedError, _super);
284
+ function UnexpectedError(message) {
285
+ var _this = _super.call(this, spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
286
+ _this.name = 'UnexpectedError';
287
+ Object.setPrototypeOf(_this, UnexpectedError.prototype);
288
+ return _this;
289
+ }
290
+ return UnexpectedError;
291
+ }(Error));
292
+
224
293
  /**
225
294
  * Checks if the value is [🚉] serializable as JSON
226
295
  * If not, throws an UnexpectedError with a rich error message and tracking
@@ -389,6 +458,7 @@ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
389
458
  'samples',
390
459
  'modelName',
391
460
  'currentDate',
461
+ // <- TODO: !!!!! list here all command names
392
462
  // <- TODO: Add more like 'date', 'modelName',...
393
463
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
394
464
  ]);
@@ -404,6 +474,18 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
404
474
  * @private within the repository
405
475
  */
406
476
  var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
477
+ // <- TODO: [🧜‍♂️]
478
+ /**
479
+ * @@@
480
+ *
481
+ * @public exported from `@promptbook/core`
482
+ */
483
+ Object.freeze({
484
+ delimiter: ',',
485
+ quoteChar: '"',
486
+ newline: '\n',
487
+ skipEmptyLines: true,
488
+ });
407
489
  /**
408
490
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
409
491
  */
@@ -1366,6 +1448,15 @@ var OpenAiExecutionTools = /** @class */ (function () {
1366
1448
  });
1367
1449
  });
1368
1450
  };
1451
+ /**
1452
+ * Create (sub)tools for calling OpenAI API Assistants
1453
+ *
1454
+ * @param assistantId Which assistant to use
1455
+ * @returns Tools for calling OpenAI API Assistants with same token
1456
+ */
1457
+ OpenAiExecutionTools.prototype.createAssistantSubtools = function (assistantId) {
1458
+ return new OpenAiAssistantExecutionTools(__assign(__assign({}, this.options), { assistantId: assistantId }));
1459
+ };
1369
1460
  /**
1370
1461
  * Check the `options` passed to `constructor`
1371
1462
  */
@@ -1462,7 +1553,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
1462
1553
  resultContent = rawResponse.choices[0].message.content;
1463
1554
  // eslint-disable-next-line prefer-const
1464
1555
  complete = getCurrentIsoDate();
1465
- usage = computeOpenAiUsage(content, resultContent || '', rawResponse);
1556
+ usage = computeOpenAiUsage(content || '', resultContent || '', rawResponse);
1466
1557
  if (resultContent === null) {
1467
1558
  throw new PipelineExecutionError('No response message from OpenAI');
1468
1559
  }
@@ -1534,7 +1625,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
1534
1625
  resultContent = rawResponse.choices[0].text;
1535
1626
  // eslint-disable-next-line prefer-const
1536
1627
  complete = getCurrentIsoDate();
1537
- usage = computeOpenAiUsage(content, resultContent || '', rawResponse);
1628
+ usage = computeOpenAiUsage(content || '', resultContent || '', rawResponse);
1538
1629
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('OpenAiExecutionTools CompletionPromptResult', {
1539
1630
  content: resultContent,
1540
1631
  modelName: rawResponse.model || modelName,
@@ -1594,7 +1685,9 @@ var OpenAiExecutionTools = /** @class */ (function () {
1594
1685
  resultContent = rawResponse.data[0].embedding;
1595
1686
  // eslint-disable-next-line prefer-const
1596
1687
  complete = getCurrentIsoDate();
1597
- usage = computeOpenAiUsage(content, '', rawResponse);
1688
+ usage = computeOpenAiUsage(content || '', '',
1689
+ // <- Note: Embedding does not have result content
1690
+ rawResponse);
1598
1691
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('OpenAiExecutionTools EmbeddingPromptResult', {
1599
1692
  content: resultContent,
1600
1693
  modelName: rawResponse.model || modelName,
@@ -1659,95 +1752,6 @@ var OpenAiExecutionTools = /** @class */ (function () {
1659
1752
  * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
1660
1753
  */
1661
1754
 
1662
- /**
1663
- * Execution Tools for calling OpenAI API
1664
- *
1665
- * @public exported from `@promptbook/openai`
1666
- */
1667
- var createOpenAiExecutionTools = Object.assign(function (options) {
1668
- // TODO: [🧠][main] !!!! If browser, auto add `dangerouslyAllowBrowser`
1669
- if (($isRunningInBrowser() || $isRunningInWebWorker()) && !options.dangerouslyAllowBrowser) {
1670
- options = __assign(__assign({}, options), { dangerouslyAllowBrowser: true });
1671
- }
1672
- return new OpenAiExecutionTools(options);
1673
- }, {
1674
- packageName: '@promptbook/openai',
1675
- className: 'OpenAiExecutionTools',
1676
- });
1677
- /**
1678
- * TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
1679
- * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
1680
- */
1681
-
1682
- /**
1683
- * This error type indicates that some part of the code is not implemented yet
1684
- *
1685
- * @public exported from `@promptbook/core`
1686
- */
1687
- var NotYetImplementedError = /** @class */ (function (_super) {
1688
- __extends(NotYetImplementedError, _super);
1689
- function NotYetImplementedError(message) {
1690
- var _this = _super.call(this, spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
1691
- _this.name = 'NotYetImplementedError';
1692
- Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
1693
- return _this;
1694
- }
1695
- return NotYetImplementedError;
1696
- }(Error));
1697
-
1698
- /**
1699
- * Represents the usage with no resources consumed
1700
- *
1701
- * @public exported from `@promptbook/core`
1702
- */
1703
- $deepFreeze({
1704
- price: { value: 0 },
1705
- input: {
1706
- tokensCount: { value: 0 },
1707
- charactersCount: { value: 0 },
1708
- wordsCount: { value: 0 },
1709
- sentencesCount: { value: 0 },
1710
- linesCount: { value: 0 },
1711
- paragraphsCount: { value: 0 },
1712
- pagesCount: { value: 0 },
1713
- },
1714
- output: {
1715
- tokensCount: { value: 0 },
1716
- charactersCount: { value: 0 },
1717
- wordsCount: { value: 0 },
1718
- sentencesCount: { value: 0 },
1719
- linesCount: { value: 0 },
1720
- paragraphsCount: { value: 0 },
1721
- pagesCount: { value: 0 },
1722
- },
1723
- });
1724
- /**
1725
- * Represents the usage with unknown resources consumed
1726
- *
1727
- * @public exported from `@promptbook/core`
1728
- */
1729
- var UNCERTAIN_USAGE = $deepFreeze({
1730
- price: { value: 0, isUncertain: true },
1731
- input: {
1732
- tokensCount: { value: 0, isUncertain: true },
1733
- charactersCount: { value: 0, isUncertain: true },
1734
- wordsCount: { value: 0, isUncertain: true },
1735
- sentencesCount: { value: 0, isUncertain: true },
1736
- linesCount: { value: 0, isUncertain: true },
1737
- paragraphsCount: { value: 0, isUncertain: true },
1738
- pagesCount: { value: 0, isUncertain: true },
1739
- },
1740
- output: {
1741
- tokensCount: { value: 0, isUncertain: true },
1742
- charactersCount: { value: 0, isUncertain: true },
1743
- wordsCount: { value: 0, isUncertain: true },
1744
- sentencesCount: { value: 0, isUncertain: true },
1745
- linesCount: { value: 0, isUncertain: true },
1746
- paragraphsCount: { value: 0, isUncertain: true },
1747
- pagesCount: { value: 0, isUncertain: true },
1748
- },
1749
- });
1750
-
1751
1755
  /**
1752
1756
  * Execution Tools for calling OpenAI API Assistants
1753
1757
  *
@@ -1763,8 +1767,9 @@ var OpenAiAssistantExecutionTools = /** @class */ (function (_super) {
1763
1767
  * @param options which are relevant are directly passed to the OpenAI client
1764
1768
  */
1765
1769
  function OpenAiAssistantExecutionTools(options) {
1766
- if (options === void 0) { options = {}; }
1767
- return _super.call(this, options) || this;
1770
+ var _this = _super.call(this, options) || this;
1771
+ _this.assistantId = options.assistantId;
1772
+ return _this;
1768
1773
  }
1769
1774
  Object.defineProperty(OpenAiAssistantExecutionTools.prototype, "title", {
1770
1775
  get: function () {
@@ -1918,6 +1923,46 @@ var OpenAiAssistantExecutionTools = /** @class */ (function (_super) {
1918
1923
  * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
1919
1924
  */
1920
1925
 
1926
+ /**
1927
+ * Execution Tools for calling OpenAI API
1928
+ *
1929
+ * @public exported from `@promptbook/openai`
1930
+ */
1931
+ var createOpenAiAssistantExecutionTools = Object.assign(function (options) {
1932
+ // TODO: [🧠][main] !!!! If browser, auto add `dangerouslyAllowBrowser`
1933
+ if (($isRunningInBrowser() || $isRunningInWebWorker()) && !options.dangerouslyAllowBrowser) {
1934
+ options = __assign(__assign({}, options), { dangerouslyAllowBrowser: true });
1935
+ }
1936
+ return new OpenAiAssistantExecutionTools(options);
1937
+ }, {
1938
+ packageName: '@promptbook/openai',
1939
+ className: 'OpenAiAssistantExecutionTools',
1940
+ });
1941
+ /**
1942
+ * TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
1943
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
1944
+ */
1945
+
1946
+ /**
1947
+ * Execution Tools for calling OpenAI API
1948
+ *
1949
+ * @public exported from `@promptbook/openai`
1950
+ */
1951
+ var createOpenAiExecutionTools = Object.assign(function (options) {
1952
+ // TODO: [🧠][main] !!!! If browser, auto add `dangerouslyAllowBrowser`
1953
+ if (($isRunningInBrowser() || $isRunningInWebWorker()) && !options.dangerouslyAllowBrowser) {
1954
+ options = __assign(__assign({}, options), { dangerouslyAllowBrowser: true });
1955
+ }
1956
+ return new OpenAiExecutionTools(options);
1957
+ }, {
1958
+ packageName: '@promptbook/openai',
1959
+ className: 'OpenAiExecutionTools',
1960
+ });
1961
+ /**
1962
+ * TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
1963
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
1964
+ */
1965
+
1921
1966
  /**
1922
1967
  * @@@
1923
1968
  *
@@ -1986,9 +2031,18 @@ var $llmToolsRegister = new $Register('llm_execution_tools_constructors');
1986
2031
  * @public exported from `@promptbook/cli`
1987
2032
  */
1988
2033
  var _OpenAiRegistration = $llmToolsRegister.register(createOpenAiExecutionTools);
2034
+ /**
2035
+ * @@@ registration2
2036
+ *
2037
+ * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
2038
+ *
2039
+ * @public exported from `@promptbook/openai`
2040
+ * @public exported from `@promptbook/cli`
2041
+ */
2042
+ var _OpenAiAssistantRegistration = $llmToolsRegister.register(createOpenAiAssistantExecutionTools);
1989
2043
  /**
1990
2044
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
1991
2045
  */
1992
2046
 
1993
- export { OPENAI_MODELS, OpenAiAssistantExecutionTools, OpenAiExecutionTools, PROMPTBOOK_VERSION, _OpenAiRegistration, createOpenAiExecutionTools };
2047
+ export { OPENAI_MODELS, OpenAiAssistantExecutionTools, OpenAiExecutionTools, PROMPTBOOK_VERSION, _OpenAiAssistantRegistration, _OpenAiRegistration, createOpenAiAssistantExecutionTools, createOpenAiExecutionTools };
1994
2048
  //# sourceMappingURL=index.es.js.map