@promptbook/remote-client 0.55.0-1 → 0.55.0-2
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/esm/typings/_packages/core.index.d.ts +3 -2
- package/esm/typings/execution/PromptbookExecutor.d.ts +8 -3
- package/esm/typings/execution/utils/addUsage.d.ts +7 -0
- package/esm/typings/execution/utils/addUsage.test.d.ts +1 -0
- package/esm/typings/execution/{computeUsageCounts.d.ts → utils/computeUsageCounts.d.ts} +1 -1
- package/esm/typings/execution/utils/uncertainNumber.d.ts +9 -0
- package/esm/typings/execution/utils/usageToWorktime.d.ts +10 -0
- package/esm/typings/execution/utils/usageToWorktime.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/typings/_packages/core.index.d.ts +3 -2
- package/umd/typings/execution/PromptbookExecutor.d.ts +8 -3
- package/umd/typings/execution/utils/addUsage.d.ts +7 -0
- package/umd/typings/execution/utils/addUsage.test.d.ts +1 -0
- package/umd/typings/execution/{computeUsageCounts.d.ts → utils/computeUsageCounts.d.ts} +1 -1
- package/umd/typings/execution/utils/uncertainNumber.d.ts +9 -0
- package/umd/typings/execution/utils/usageToWorktime.d.ts +10 -0
- package/umd/typings/execution/utils/usageToWorktime.test.d.ts +1 -0
- package/esm/typings/execution/addPromptResultUsage.d.ts +0 -7
- package/umd/typings/execution/addPromptResultUsage.d.ts +0 -7
|
@@ -11,14 +11,15 @@ import { PromptbookReferenceError } from '../errors/PromptbookReferenceError';
|
|
|
11
11
|
import { PromptbookSyntaxError } from '../errors/PromptbookSyntaxError';
|
|
12
12
|
import { TemplateError } from '../errors/TemplateError';
|
|
13
13
|
import { UnexpectedError } from '../errors/UnexpectedError';
|
|
14
|
-
import { addPromptResultUsage } from '../execution/addPromptResultUsage';
|
|
15
14
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
16
15
|
import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
|
|
17
16
|
import { MultipleLlmExecutionTools } from '../execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools';
|
|
18
17
|
import { CallbackInterfaceTools } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools';
|
|
19
18
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
20
19
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
20
|
+
import { addUsage } from '../execution/utils/addUsage';
|
|
21
21
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
22
|
+
import { usageToWorktime } from '../execution/utils/usageToWorktime';
|
|
22
23
|
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
|
|
23
24
|
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
24
25
|
import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
|
|
@@ -31,7 +32,7 @@ import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
|
31
32
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
32
33
|
export { justTestFsImport };
|
|
33
34
|
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
34
|
-
export {
|
|
35
|
+
export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, usageToWorktime, };
|
|
35
36
|
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
36
37
|
export { SimplePromptInterfaceTools };
|
|
37
38
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
@@ -2,6 +2,7 @@ import type { Promisable } from 'type-fest';
|
|
|
2
2
|
import type { TaskProgress } from '../types/TaskProgress';
|
|
3
3
|
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
|
|
4
4
|
import type { string_name } from '../types/typeAliases';
|
|
5
|
+
import type { PromptResultUsage } from './PromptResult';
|
|
5
6
|
/**
|
|
6
7
|
* Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
|
|
7
8
|
* Executor is made by combining execution tools and promptbook library.
|
|
@@ -13,15 +14,19 @@ import type { string_name } from '../types/typeAliases';
|
|
|
13
14
|
export type PromptbookExecutor = {
|
|
14
15
|
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
15
16
|
/**
|
|
16
|
-
* Whether the execution was successful
|
|
17
|
+
* Whether the execution was successful, details are aviable in `executionReport`
|
|
17
18
|
*/
|
|
18
19
|
isSuccessful: boolean;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Added usage of whole execution, detailed usage is aviable in `executionReport`
|
|
22
|
+
*/
|
|
23
|
+
usage: PromptResultUsage;
|
|
24
|
+
/**
|
|
25
|
+
* Errors that occured during the execution, details are aviable in `executionReport`
|
|
21
26
|
*/
|
|
22
27
|
errors: Array<Error>;
|
|
23
28
|
/**
|
|
24
|
-
* The report of the execution
|
|
29
|
+
* The report of the execution with all details
|
|
25
30
|
*/
|
|
26
31
|
executionReport: ExecutionReportJson;
|
|
27
32
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptResultUsage } from '../PromptResult';
|
|
2
|
+
/**
|
|
3
|
+
* Function `addUsage` will add multiple usages into one
|
|
4
|
+
*
|
|
5
|
+
* Note: If you provide 0 values, it returns void usage
|
|
6
|
+
*/
|
|
7
|
+
export declare function addUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UncertainNumber } from '../PromptResult';
|
|
2
|
+
/**
|
|
3
|
+
* Make UncertainNumber
|
|
4
|
+
*
|
|
5
|
+
* @param value
|
|
6
|
+
*
|
|
7
|
+
* @private utility for initializating UncertainNumber
|
|
8
|
+
*/
|
|
9
|
+
export declare function uncertainNumber(value?: number | typeof NaN | undefined | null): UncertainNumber;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromptResultUsage } from '../PromptResult';
|
|
2
|
+
import type { UncertainNumber } from '../PromptResult';
|
|
3
|
+
/**
|
|
4
|
+
* Function usageToWorktime will take usage and estimate saved worktime in hours of reading / writing
|
|
5
|
+
*
|
|
6
|
+
* Note: This is an estimate based of theese sources:
|
|
7
|
+
* - https://jecas.cz/doba-cteni
|
|
8
|
+
* - https://www.originalnitonery.cz/blog/psani-vsemi-deseti-se-muzete-naucit-i-sami-doma
|
|
9
|
+
*/
|
|
10
|
+
export declare function usageToWorktime(usage: PromptResultUsage): UncertainNumber;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.55.0-
|
|
3
|
+
"version": "0.55.0-2",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.55.0-
|
|
50
|
+
"@promptbook/core": "0.55.0-2"
|
|
51
51
|
},
|
|
52
52
|
"main": "./umd/index.umd.js",
|
|
53
53
|
"module": "./esm/index.es.js",
|
|
@@ -11,14 +11,15 @@ import { PromptbookReferenceError } from '../errors/PromptbookReferenceError';
|
|
|
11
11
|
import { PromptbookSyntaxError } from '../errors/PromptbookSyntaxError';
|
|
12
12
|
import { TemplateError } from '../errors/TemplateError';
|
|
13
13
|
import { UnexpectedError } from '../errors/UnexpectedError';
|
|
14
|
-
import { addPromptResultUsage } from '../execution/addPromptResultUsage';
|
|
15
14
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
16
15
|
import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
|
|
17
16
|
import { MultipleLlmExecutionTools } from '../execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools';
|
|
18
17
|
import { CallbackInterfaceTools } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools';
|
|
19
18
|
import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
|
|
20
19
|
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
|
|
20
|
+
import { addUsage } from '../execution/utils/addUsage';
|
|
21
21
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
22
|
+
import { usageToWorktime } from '../execution/utils/usageToWorktime';
|
|
22
23
|
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
|
|
23
24
|
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
24
25
|
import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
|
|
@@ -31,7 +32,7 @@ import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
|
31
32
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
32
33
|
export { justTestFsImport };
|
|
33
34
|
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
34
|
-
export {
|
|
35
|
+
export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, usageToWorktime, };
|
|
35
36
|
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
36
37
|
export { SimplePromptInterfaceTools };
|
|
37
38
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
@@ -2,6 +2,7 @@ import type { Promisable } from 'type-fest';
|
|
|
2
2
|
import type { TaskProgress } from '../types/TaskProgress';
|
|
3
3
|
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
|
|
4
4
|
import type { string_name } from '../types/typeAliases';
|
|
5
|
+
import type { PromptResultUsage } from './PromptResult';
|
|
5
6
|
/**
|
|
6
7
|
* Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
|
|
7
8
|
* Executor is made by combining execution tools and promptbook library.
|
|
@@ -13,15 +14,19 @@ import type { string_name } from '../types/typeAliases';
|
|
|
13
14
|
export type PromptbookExecutor = {
|
|
14
15
|
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
15
16
|
/**
|
|
16
|
-
* Whether the execution was successful
|
|
17
|
+
* Whether the execution was successful, details are aviable in `executionReport`
|
|
17
18
|
*/
|
|
18
19
|
isSuccessful: boolean;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Added usage of whole execution, detailed usage is aviable in `executionReport`
|
|
22
|
+
*/
|
|
23
|
+
usage: PromptResultUsage;
|
|
24
|
+
/**
|
|
25
|
+
* Errors that occured during the execution, details are aviable in `executionReport`
|
|
21
26
|
*/
|
|
22
27
|
errors: Array<Error>;
|
|
23
28
|
/**
|
|
24
|
-
* The report of the execution
|
|
29
|
+
* The report of the execution with all details
|
|
25
30
|
*/
|
|
26
31
|
executionReport: ExecutionReportJson;
|
|
27
32
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptResultUsage } from '../PromptResult';
|
|
2
|
+
/**
|
|
3
|
+
* Function `addUsage` will add multiple usages into one
|
|
4
|
+
*
|
|
5
|
+
* Note: If you provide 0 values, it returns void usage
|
|
6
|
+
*/
|
|
7
|
+
export declare function addUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UncertainNumber } from '../PromptResult';
|
|
2
|
+
/**
|
|
3
|
+
* Make UncertainNumber
|
|
4
|
+
*
|
|
5
|
+
* @param value
|
|
6
|
+
*
|
|
7
|
+
* @private utility for initializating UncertainNumber
|
|
8
|
+
*/
|
|
9
|
+
export declare function uncertainNumber(value?: number | typeof NaN | undefined | null): UncertainNumber;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromptResultUsage } from '../PromptResult';
|
|
2
|
+
import type { UncertainNumber } from '../PromptResult';
|
|
3
|
+
/**
|
|
4
|
+
* Function usageToWorktime will take usage and estimate saved worktime in hours of reading / writing
|
|
5
|
+
*
|
|
6
|
+
* Note: This is an estimate based of theese sources:
|
|
7
|
+
* - https://jecas.cz/doba-cteni
|
|
8
|
+
* - https://www.originalnitonery.cz/blog/psani-vsemi-deseti-se-muzete-naucit-i-sami-doma
|
|
9
|
+
*/
|
|
10
|
+
export declare function usageToWorktime(usage: PromptResultUsage): UncertainNumber;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PromptResultUsage } from './PromptResult';
|
|
2
|
-
/**
|
|
3
|
-
* Function addPromptResultUsage will add multiple usages into one
|
|
4
|
-
*
|
|
5
|
-
* Note: If you provide 0 values, it returns void usage
|
|
6
|
-
*/
|
|
7
|
-
export declare function addPromptResultUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PromptResultUsage } from './PromptResult';
|
|
2
|
-
/**
|
|
3
|
-
* Function addPromptResultUsage will add multiple usages into one
|
|
4
|
-
*
|
|
5
|
-
* Note: If you provide 0 values, it returns void usage
|
|
6
|
-
*/
|
|
7
|
-
export declare function addPromptResultUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage;
|