@promptbook/openai 0.52.0-6 → 0.52.0-8
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 +2 -2
- package/esm/typings/_packages/core.index.d.ts +2 -1
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +4 -17
- package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +16 -1
- package/package.json +2 -2
- package/umd/typings/_packages/core.index.d.ts +2 -1
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +4 -17
- package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +16 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
createPromptbookLibraryFromDirectory,
|
|
43
43
|
assertsExecutionSuccessful,
|
|
44
44
|
} from '@promptbook/core';
|
|
45
|
-
import {
|
|
45
|
+
import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
|
|
46
46
|
import { OpenAiExecutionTools } from '@promptbook/openai';
|
|
47
47
|
|
|
48
48
|
// Create whole Promptbook library
|
|
@@ -56,7 +56,7 @@ const tools = {
|
|
|
56
56
|
llm: new OpenAiExecutionTools({
|
|
57
57
|
apiKey: process.env.OPENAI_API_KEY,
|
|
58
58
|
}),
|
|
59
|
-
script: [new
|
|
59
|
+
script: [new JavascriptExecutionTools()],
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// Create executor - the function that will execute the Promptbook
|
|
@@ -9,6 +9,7 @@ import { CallbackInterfaceTools } from '../execution/plugins/user-interface-exec
|
|
|
9
9
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
10
10
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
11
11
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
12
|
+
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
|
|
12
13
|
import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
|
|
13
14
|
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
14
15
|
import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
|
|
@@ -19,7 +20,7 @@ import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
|
19
20
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
20
21
|
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
21
22
|
export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, };
|
|
22
|
-
export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
23
|
+
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
23
24
|
export { SimplePromptInterfaceTools };
|
|
24
25
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
25
26
|
export { createPromptbookExecutor, MultipleLlmExecutionTools };
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
|
|
1
|
+
import { JavascriptEvalExecutionTools } from './JavascriptEvalExecutionTools';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare class JavascriptExecutionTools implements ScriptExecutionTools {
|
|
9
|
-
private readonly options;
|
|
10
|
-
constructor(options?: JavascriptExecutionToolsOptions);
|
|
11
|
-
/**
|
|
12
|
-
* Executes a JavaScript
|
|
13
|
-
*/
|
|
14
|
-
execute(options: ScriptExecutionToolsExecuteOptions): Promise<string>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* TODO: !! Pass isVerbose to constructor and use it
|
|
18
|
-
* TODO: !! Probbably make some common util createStatementToEvaluate
|
|
19
|
-
* TODO: !! Implement via vm2
|
|
5
|
+
* @alias JavascriptExecutionTools
|
|
20
6
|
*/
|
|
7
|
+
export declare const JavascriptExecutionTools: typeof JavascriptEvalExecutionTools;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
import { string_folder_path } from '../../types/typeAliases';
|
|
1
2
|
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
3
|
+
/**
|
|
4
|
+
* Options for `createPromptbookLibraryFromDirectory` function
|
|
5
|
+
*/
|
|
6
|
+
type CreatePromptbookLibraryFromDirectoryOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* If true, the directory is searched recursively for promptbooks
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
isRecursive?: boolean;
|
|
13
|
+
};
|
|
2
14
|
/**
|
|
3
15
|
* Constructs Promptbook from given directory
|
|
4
16
|
*
|
|
@@ -6,9 +18,12 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
|
6
18
|
* Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
|
|
7
19
|
* SO during the construction syntax and logic sources IS NOT validated
|
|
8
20
|
*
|
|
21
|
+
* @param path - path to the directory with promptbooks
|
|
22
|
+
* @param options - Misc options for the library
|
|
9
23
|
* @returns PromptbookLibrary
|
|
10
24
|
*/
|
|
11
|
-
export declare function createPromptbookLibraryFromDirectory(): PromptbookLibrary;
|
|
25
|
+
export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): PromptbookLibrary;
|
|
26
|
+
export {};
|
|
12
27
|
/***
|
|
13
28
|
* TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
|
|
14
29
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/openai",
|
|
3
|
-
"version": "0.52.0-
|
|
3
|
+
"version": "0.52.0-8",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@promptbook/core": "0.52.0-
|
|
51
|
+
"@promptbook/core": "0.52.0-8"
|
|
52
52
|
},
|
|
53
53
|
"main": "./umd/index.umd.js",
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
@@ -9,6 +9,7 @@ import { CallbackInterfaceTools } from '../execution/plugins/user-interface-exec
|
|
|
9
9
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
10
10
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
11
11
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
12
|
+
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
|
|
12
13
|
import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
|
|
13
14
|
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
14
15
|
import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
|
|
@@ -19,7 +20,7 @@ import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
|
19
20
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
20
21
|
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
21
22
|
export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, };
|
|
22
|
-
export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
23
|
+
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
23
24
|
export { SimplePromptInterfaceTools };
|
|
24
25
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
25
26
|
export { createPromptbookExecutor, MultipleLlmExecutionTools };
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
|
|
1
|
+
import { JavascriptEvalExecutionTools } from './JavascriptEvalExecutionTools';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare class JavascriptExecutionTools implements ScriptExecutionTools {
|
|
9
|
-
private readonly options;
|
|
10
|
-
constructor(options?: JavascriptExecutionToolsOptions);
|
|
11
|
-
/**
|
|
12
|
-
* Executes a JavaScript
|
|
13
|
-
*/
|
|
14
|
-
execute(options: ScriptExecutionToolsExecuteOptions): Promise<string>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* TODO: !! Pass isVerbose to constructor and use it
|
|
18
|
-
* TODO: !! Probbably make some common util createStatementToEvaluate
|
|
19
|
-
* TODO: !! Implement via vm2
|
|
5
|
+
* @alias JavascriptExecutionTools
|
|
20
6
|
*/
|
|
7
|
+
export declare const JavascriptExecutionTools: typeof JavascriptEvalExecutionTools;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
import { string_folder_path } from '../../types/typeAliases';
|
|
1
2
|
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
3
|
+
/**
|
|
4
|
+
* Options for `createPromptbookLibraryFromDirectory` function
|
|
5
|
+
*/
|
|
6
|
+
type CreatePromptbookLibraryFromDirectoryOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* If true, the directory is searched recursively for promptbooks
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
isRecursive?: boolean;
|
|
13
|
+
};
|
|
2
14
|
/**
|
|
3
15
|
* Constructs Promptbook from given directory
|
|
4
16
|
*
|
|
@@ -6,9 +18,12 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
|
6
18
|
* Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
|
|
7
19
|
* SO during the construction syntax and logic sources IS NOT validated
|
|
8
20
|
*
|
|
21
|
+
* @param path - path to the directory with promptbooks
|
|
22
|
+
* @param options - Misc options for the library
|
|
9
23
|
* @returns PromptbookLibrary
|
|
10
24
|
*/
|
|
11
|
-
export declare function createPromptbookLibraryFromDirectory(): PromptbookLibrary;
|
|
25
|
+
export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): PromptbookLibrary;
|
|
26
|
+
export {};
|
|
12
27
|
/***
|
|
13
28
|
* TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
|
|
14
29
|
*/
|