@promptbook/openai 0.28.0 → 0.29.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 (19) hide show
  1. package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +3 -0
  2. package/esm/typings/execution/ScriptExecutionTools.d.ts +3 -0
  3. package/esm/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
  4. package/esm/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +4 -0
  5. package/esm/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
  6. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +3 -2
  7. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +2 -2
  8. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +22 -0
  9. package/esm/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +0 -3
  10. package/package.json +2 -2
  11. package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +3 -0
  12. package/umd/typings/execution/ScriptExecutionTools.d.ts +3 -0
  13. package/umd/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
  14. package/umd/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +4 -0
  15. package/umd/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
  16. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +3 -2
  17. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +2 -2
  18. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +22 -0
  19. package/umd/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +0 -3
@@ -4,3 +4,6 @@ export interface CommonExecutionToolsOptions {
4
4
  */
5
5
  readonly isVerbose?: boolean;
6
6
  }
7
+ /**
8
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
9
+ */
@@ -32,3 +32,6 @@ export interface ScriptExecutionToolsExecuteOptions {
32
32
  */
33
33
  script: string_script;
34
34
  }
35
+ /**
36
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
37
+ */
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * TODO: !!!! custom-function-async.test.ts
4
+ */
@@ -1,5 +1,5 @@
1
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
2
1
  import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../../ScriptExecutionTools';
2
+ import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
3
3
  /**
4
4
  * ScriptExecutionTools for JavaScript implemented via eval
5
5
  *
@@ -8,7 +8,7 @@ import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../
8
8
  */
9
9
  export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
10
10
  private readonly options;
11
- constructor(options: CommonExecutionToolsOptions);
11
+ constructor(options: JavascriptExecutionToolsOptions);
12
12
  /**
13
13
  * Executes a JavaScript
14
14
  */
@@ -16,4 +16,5 @@ export declare class JavascriptEvalExecutionTools implements ScriptExecutionTool
16
16
  }
17
17
  /**
18
18
  * TODO: Put predefined functions (like removeQuotes, spaceTrim, etc.) into annotation OR pass into constructor
19
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
19
20
  */
@@ -1,5 +1,5 @@
1
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
2
1
  import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../../ScriptExecutionTools';
2
+ import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
3
3
  /**
4
4
  * ScriptExecutionTools for JavaScript implemented via vm2
5
5
  *
@@ -7,7 +7,7 @@ import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../
7
7
  */
8
8
  export declare class JavascriptExecutionTools implements ScriptExecutionTools {
9
9
  private readonly options;
10
- constructor(options: CommonExecutionToolsOptions);
10
+ constructor(options: JavascriptExecutionToolsOptions);
11
11
  /**
12
12
  * Executes a JavaScript
13
13
  */
@@ -0,0 +1,22 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { string_javascript_name } from '../../../../types/typeAliases';
3
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
4
+ /**
5
+ * Options for javascript execution
6
+ */
7
+ export type JavascriptExecutionToolsOptions = CommonExecutionToolsOptions & {
8
+ /**
9
+ * Functions to be executed in the JavaScript evaluation.
10
+ *
11
+ * This can be used in two ways:
12
+ * 1. To provide custom postprocessing functions. For this case function must receive one string and return a (promise of) string.
13
+ * 2. As environment for the ECECUTE SCRIPT, For this case function can be any function. [0]
14
+ *
15
+ * Note: There are also some built-in functions available:
16
+ * @see ./JavascriptEvalExecutionTools.ts
17
+ */
18
+ functions?: Record<string_javascript_name, (value: string) => Promisable<string> | Function>;
19
+ };
20
+ /**
21
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
22
+ */
@@ -1,4 +1 @@
1
1
  export {};
2
- /**
3
- * TODO: What is the ideal folder for this test?
4
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.28.0",
3
+ "version": "0.29.0-1",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "openai": "4.2.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "@promptbook/core": "0.28.0"
40
+ "@promptbook/core": "0.29.0-1"
41
41
  },
42
42
  "main": "./umd/index.umd.js",
43
43
  "module": "./esm/index.es.js",
@@ -4,3 +4,6 @@ export interface CommonExecutionToolsOptions {
4
4
  */
5
5
  readonly isVerbose?: boolean;
6
6
  }
7
+ /**
8
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
9
+ */
@@ -32,3 +32,6 @@ export interface ScriptExecutionToolsExecuteOptions {
32
32
  */
33
33
  script: string_script;
34
34
  }
35
+ /**
36
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
37
+ */
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * TODO: !!!! custom-function-async.test.ts
4
+ */
@@ -1,5 +1,5 @@
1
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
2
1
  import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../../ScriptExecutionTools';
2
+ import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
3
3
  /**
4
4
  * ScriptExecutionTools for JavaScript implemented via eval
5
5
  *
@@ -8,7 +8,7 @@ import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../
8
8
  */
9
9
  export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
10
10
  private readonly options;
11
- constructor(options: CommonExecutionToolsOptions);
11
+ constructor(options: JavascriptExecutionToolsOptions);
12
12
  /**
13
13
  * Executes a JavaScript
14
14
  */
@@ -16,4 +16,5 @@ export declare class JavascriptEvalExecutionTools implements ScriptExecutionTool
16
16
  }
17
17
  /**
18
18
  * TODO: Put predefined functions (like removeQuotes, spaceTrim, etc.) into annotation OR pass into constructor
19
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
19
20
  */
@@ -1,5 +1,5 @@
1
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
2
1
  import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../../ScriptExecutionTools';
2
+ import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
3
3
  /**
4
4
  * ScriptExecutionTools for JavaScript implemented via vm2
5
5
  *
@@ -7,7 +7,7 @@ import { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../../
7
7
  */
8
8
  export declare class JavascriptExecutionTools implements ScriptExecutionTools {
9
9
  private readonly options;
10
- constructor(options: CommonExecutionToolsOptions);
10
+ constructor(options: JavascriptExecutionToolsOptions);
11
11
  /**
12
12
  * Executes a JavaScript
13
13
  */
@@ -0,0 +1,22 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { string_javascript_name } from '../../../../types/typeAliases';
3
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
4
+ /**
5
+ * Options for javascript execution
6
+ */
7
+ export type JavascriptExecutionToolsOptions = CommonExecutionToolsOptions & {
8
+ /**
9
+ * Functions to be executed in the JavaScript evaluation.
10
+ *
11
+ * This can be used in two ways:
12
+ * 1. To provide custom postprocessing functions. For this case function must receive one string and return a (promise of) string.
13
+ * 2. As environment for the ECECUTE SCRIPT, For this case function can be any function. [0]
14
+ *
15
+ * Note: There are also some built-in functions available:
16
+ * @see ./JavascriptEvalExecutionTools.ts
17
+ */
18
+ functions?: Record<string_javascript_name, (value: string) => Promisable<string> | Function>;
19
+ };
20
+ /**
21
+ * TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
22
+ */
@@ -1,4 +1 @@
1
1
  export {};
2
- /**
3
- * TODO: What is the ideal folder for this test?
4
- */