@promptbook/remote-server 0.30.0 → 0.31.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.
- package/esm/typings/execution/PromptResult.d.ts +38 -1
- package/esm/typings/execution/plugins/natural-execution-tools/openai/computeOpenaiUsage.d.ts +3 -0
- package/esm/typings/types/typeAliases.d.ts +16 -0
- package/esm/typings/utils/getCurrentIsoDate.d.ts +7 -0
- package/esm/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
- package/esm/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/typings/execution/PromptResult.d.ts +38 -1
- package/umd/typings/execution/plugins/natural-execution-tools/openai/computeOpenaiUsage.d.ts +3 -0
- package/umd/typings/types/typeAliases.d.ts +16 -0
- package/umd/typings/utils/getCurrentIsoDate.d.ts +7 -0
- package/umd/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
- package/umd/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_model_name } from '.././types/typeAliases';
|
|
1
|
+
import type { number_positive_or_zero, number_tokens, number_usd, string_date_iso8601, string_model_name } from '.././types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Prompt result is the simplest concept of execution.
|
|
4
4
|
* It is the result of executing one prompt _(NOT a template)_.
|
|
@@ -25,12 +25,49 @@ export interface PromptCommonResult {
|
|
|
25
25
|
* Name of the model used to generate the response
|
|
26
26
|
*/
|
|
27
27
|
readonly model: string_model_name;
|
|
28
|
+
/**
|
|
29
|
+
* Timing
|
|
30
|
+
*/
|
|
31
|
+
readonly timing: {
|
|
32
|
+
/**
|
|
33
|
+
* Start of the execution
|
|
34
|
+
*/
|
|
35
|
+
start: string_date_iso8601;
|
|
36
|
+
/**
|
|
37
|
+
* First token generated
|
|
38
|
+
*/
|
|
39
|
+
firstToken?: string_date_iso8601;
|
|
40
|
+
/**
|
|
41
|
+
* End of the execution
|
|
42
|
+
*/
|
|
43
|
+
complete: string_date_iso8601;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Usage of the prompt execution
|
|
47
|
+
*/
|
|
48
|
+
readonly usage: {
|
|
49
|
+
/**
|
|
50
|
+
* Cost of the execution in USD
|
|
51
|
+
*
|
|
52
|
+
* If the cost is unknown, the value is `'UNKNOWN'`
|
|
53
|
+
*/
|
|
54
|
+
price: (number_positive_or_zero & number_usd) | 'UNKNOWN';
|
|
55
|
+
/**
|
|
56
|
+
* Number of tokens used in the input aka. `prompt_tokens`
|
|
57
|
+
*/
|
|
58
|
+
inputTokens: number_tokens;
|
|
59
|
+
/**
|
|
60
|
+
* Number of tokens used in the output aka. `completion_tokens`
|
|
61
|
+
*/
|
|
62
|
+
outputTokens: number_tokens;
|
|
63
|
+
};
|
|
28
64
|
/**
|
|
29
65
|
* Raw response from the model
|
|
30
66
|
*/
|
|
31
67
|
readonly rawResponse: object;
|
|
32
68
|
}
|
|
33
69
|
/**
|
|
70
|
+
* TODO: [🧠] Maybe timing more accurate then seconds?
|
|
34
71
|
* TODO: [🧠] Should here be link to the prompt?
|
|
35
72
|
* TODO: [🧠] Maybe type raw properly - not onject but OpenAI.result.whatever
|
|
36
73
|
* TODO: [🧠] Maybe remove redundant raw.choices.text
|
|
@@ -404,6 +404,22 @@ export type string_license_token = string_token;
|
|
|
404
404
|
export type string_password = string;
|
|
405
405
|
export type string_ssh_key = string;
|
|
406
406
|
export type string_pgp_key = string;
|
|
407
|
+
/**
|
|
408
|
+
* Semantic helper for `Date.toISOString()` result
|
|
409
|
+
*
|
|
410
|
+
* @example "2011-10-05T14:48:00.000Z".
|
|
411
|
+
* @see https://en.wikipedia.org/wiki/ISO_8601
|
|
412
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
|
413
|
+
*/
|
|
414
|
+
export type string_date_iso8601 = `${number}-${number}-${number}${string}${number}:${number}:${number}${string}`;
|
|
415
|
+
/**
|
|
416
|
+
* Semantic helper for US Dollars
|
|
417
|
+
*/
|
|
418
|
+
export type number_usd = number;
|
|
419
|
+
/**
|
|
420
|
+
* Semantic helper for number of tokens
|
|
421
|
+
*/
|
|
422
|
+
export type number_tokens = number_integer & number_positive_or_zero;
|
|
407
423
|
export type number_positive = number;
|
|
408
424
|
export type number_negative = number;
|
|
409
425
|
export type number_positive_or_zero = number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { string_markdown_text } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Function escapeMarkdownBlock will escape markdown block if needed
|
|
4
|
+
* It is useful when you want have block in block
|
|
5
|
+
*/
|
|
6
|
+
export declare function escapeMarkdownBlock(value: string_markdown_text): string_markdown_text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0-1",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"spacetrim": "0.9.21"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@promptbook/core": "0.
|
|
41
|
+
"@promptbook/core": "0.31.0-1"
|
|
42
42
|
},
|
|
43
43
|
"main": "./umd/index.umd.js",
|
|
44
44
|
"module": "./esm/index.es.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_model_name } from '.././types/typeAliases';
|
|
1
|
+
import type { number_positive_or_zero, number_tokens, number_usd, string_date_iso8601, string_model_name } from '.././types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Prompt result is the simplest concept of execution.
|
|
4
4
|
* It is the result of executing one prompt _(NOT a template)_.
|
|
@@ -25,12 +25,49 @@ export interface PromptCommonResult {
|
|
|
25
25
|
* Name of the model used to generate the response
|
|
26
26
|
*/
|
|
27
27
|
readonly model: string_model_name;
|
|
28
|
+
/**
|
|
29
|
+
* Timing
|
|
30
|
+
*/
|
|
31
|
+
readonly timing: {
|
|
32
|
+
/**
|
|
33
|
+
* Start of the execution
|
|
34
|
+
*/
|
|
35
|
+
start: string_date_iso8601;
|
|
36
|
+
/**
|
|
37
|
+
* First token generated
|
|
38
|
+
*/
|
|
39
|
+
firstToken?: string_date_iso8601;
|
|
40
|
+
/**
|
|
41
|
+
* End of the execution
|
|
42
|
+
*/
|
|
43
|
+
complete: string_date_iso8601;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Usage of the prompt execution
|
|
47
|
+
*/
|
|
48
|
+
readonly usage: {
|
|
49
|
+
/**
|
|
50
|
+
* Cost of the execution in USD
|
|
51
|
+
*
|
|
52
|
+
* If the cost is unknown, the value is `'UNKNOWN'`
|
|
53
|
+
*/
|
|
54
|
+
price: (number_positive_or_zero & number_usd) | 'UNKNOWN';
|
|
55
|
+
/**
|
|
56
|
+
* Number of tokens used in the input aka. `prompt_tokens`
|
|
57
|
+
*/
|
|
58
|
+
inputTokens: number_tokens;
|
|
59
|
+
/**
|
|
60
|
+
* Number of tokens used in the output aka. `completion_tokens`
|
|
61
|
+
*/
|
|
62
|
+
outputTokens: number_tokens;
|
|
63
|
+
};
|
|
28
64
|
/**
|
|
29
65
|
* Raw response from the model
|
|
30
66
|
*/
|
|
31
67
|
readonly rawResponse: object;
|
|
32
68
|
}
|
|
33
69
|
/**
|
|
70
|
+
* TODO: [🧠] Maybe timing more accurate then seconds?
|
|
34
71
|
* TODO: [🧠] Should here be link to the prompt?
|
|
35
72
|
* TODO: [🧠] Maybe type raw properly - not onject but OpenAI.result.whatever
|
|
36
73
|
* TODO: [🧠] Maybe remove redundant raw.choices.text
|
|
@@ -404,6 +404,22 @@ export type string_license_token = string_token;
|
|
|
404
404
|
export type string_password = string;
|
|
405
405
|
export type string_ssh_key = string;
|
|
406
406
|
export type string_pgp_key = string;
|
|
407
|
+
/**
|
|
408
|
+
* Semantic helper for `Date.toISOString()` result
|
|
409
|
+
*
|
|
410
|
+
* @example "2011-10-05T14:48:00.000Z".
|
|
411
|
+
* @see https://en.wikipedia.org/wiki/ISO_8601
|
|
412
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
|
413
|
+
*/
|
|
414
|
+
export type string_date_iso8601 = `${number}-${number}-${number}${string}${number}:${number}:${number}${string}`;
|
|
415
|
+
/**
|
|
416
|
+
* Semantic helper for US Dollars
|
|
417
|
+
*/
|
|
418
|
+
export type number_usd = number;
|
|
419
|
+
/**
|
|
420
|
+
* Semantic helper for number of tokens
|
|
421
|
+
*/
|
|
422
|
+
export type number_tokens = number_integer & number_positive_or_zero;
|
|
407
423
|
export type number_positive = number;
|
|
408
424
|
export type number_negative = number;
|
|
409
425
|
export type number_positive_or_zero = number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { string_markdown_text } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Function escapeMarkdownBlock will escape markdown block if needed
|
|
4
|
+
* It is useful when you want have block in block
|
|
5
|
+
*/
|
|
6
|
+
export declare function escapeMarkdownBlock(value: string_markdown_text): string_markdown_text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|