@promptbook/markdown-utils 0.88.0-9 → 0.89.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/README.md +35 -14
- package/esm/index.es.js +62 -26
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +5 -0
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +5 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/{countTotalUsage.d.ts → countUsage.d.ts} +1 -1
- package/esm/typings/src/playground/BrjappConnector.d.ts +64 -0
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +12879 -0
- package/esm/typings/src/playground/playground.d.ts +5 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +2 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +15 -3
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -0
- package/package.json +1 -1
- package/umd/index.umd.js +65 -29
- package/umd/index.umd.js.map +1 -1
|
@@ -87,7 +87,7 @@ import { $llmToolsMetadataRegister } from '../llm-providers/_common/register/$ll
|
|
|
87
87
|
import { $llmToolsRegister } from '../llm-providers/_common/register/$llmToolsRegister';
|
|
88
88
|
import { createLlmToolsFromConfiguration } from '../llm-providers/_common/register/createLlmToolsFromConfiguration';
|
|
89
89
|
import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTools';
|
|
90
|
-
import {
|
|
90
|
+
import { countUsage } from '../llm-providers/_common/utils/count-total-usage/countUsage';
|
|
91
91
|
import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
|
|
92
92
|
import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
|
|
93
93
|
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
|
@@ -217,7 +217,7 @@ export { $llmToolsMetadataRegister };
|
|
|
217
217
|
export { $llmToolsRegister };
|
|
218
218
|
export { createLlmToolsFromConfiguration };
|
|
219
219
|
export { cacheLlmTools };
|
|
220
|
-
export {
|
|
220
|
+
export { countUsage };
|
|
221
221
|
export { limitTotalUsage };
|
|
222
222
|
export { _AnthropicClaudeMetadataRegistration };
|
|
223
223
|
export { _AzureOpenAiMetadataRegistration };
|
|
@@ -106,6 +106,11 @@ import type { ScriptTaskJson } from '../pipeline/PipelineJson/ScriptTaskJson';
|
|
|
106
106
|
import type { SimpleTaskJson } from '../pipeline/PipelineJson/SimpleTaskJson';
|
|
107
107
|
import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
|
|
108
108
|
import type { PipelineString } from '../pipeline/PipelineString';
|
|
109
|
+
import type { paths } from '../playground/brjapp-api-schema';
|
|
110
|
+
import type { webhooks } from '../playground/brjapp-api-schema';
|
|
111
|
+
import type { components } from '../playground/brjapp-api-schema';
|
|
112
|
+
import type { $defs } from '../playground/brjapp-api-schema';
|
|
113
|
+
import type { operations } from '../playground/brjapp-api-schema';
|
|
109
114
|
import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
|
|
110
115
|
import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
111
116
|
import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
|
|
@@ -389,6 +394,11 @@ export type { ScriptTaskJson };
|
|
|
389
394
|
export type { SimpleTaskJson };
|
|
390
395
|
export type { TaskJson };
|
|
391
396
|
export type { PipelineString };
|
|
397
|
+
export type { paths };
|
|
398
|
+
export type { webhooks };
|
|
399
|
+
export type { components };
|
|
400
|
+
export type { $defs };
|
|
401
|
+
export type { operations };
|
|
392
402
|
export type { PrepareAndScrapeOptions };
|
|
393
403
|
export type { PromptbookServer_Identification };
|
|
394
404
|
export type { PromptbookServer_ApplicationIdentification };
|
|
@@ -162,7 +162,7 @@ export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
|
|
|
162
162
|
*
|
|
163
163
|
* @public exported from `@promptbook/core`
|
|
164
164
|
*/
|
|
165
|
-
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
165
|
+
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10;
|
|
166
166
|
/**
|
|
167
167
|
* @@@
|
|
168
168
|
* TODO: [🐝][main] !!3 Use
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { task_id } from '../types/typeAliases';
|
|
1
2
|
/**
|
|
2
3
|
* This error indicates errors during the execution of the pipeline
|
|
3
4
|
*
|
|
@@ -5,5 +6,9 @@
|
|
|
5
6
|
*/
|
|
6
7
|
export declare class PipelineExecutionError extends Error {
|
|
7
8
|
readonly name = "PipelineExecutionError";
|
|
9
|
+
readonly id?: task_id;
|
|
8
10
|
constructor(message: string);
|
|
9
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* TODO: !!!!!! Add id to all errors
|
|
14
|
+
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { task_id } from '../../types/typeAliases';
|
|
1
2
|
import type { ALL_ERRORS } from '../0-index';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a serialized error or custom Promptbook error
|
|
@@ -5,6 +6,10 @@ import type { ALL_ERRORS } from '../0-index';
|
|
|
5
6
|
* Note: [🚉] This is fully serializable as JSON
|
|
6
7
|
*/
|
|
7
8
|
export type ErrorJson = {
|
|
9
|
+
/**
|
|
10
|
+
* The unique identifier of the error
|
|
11
|
+
*/
|
|
12
|
+
readonly id?: task_id;
|
|
8
13
|
/**
|
|
9
14
|
* The type of the error
|
|
10
15
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
1
2
|
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
3
|
import type { PromptResultUsage } from '../../../../execution/PromptResultUsage';
|
|
3
4
|
/**
|
|
@@ -8,6 +9,12 @@ export type LlmExecutionToolsWithTotalUsage = LlmExecutionTools & {
|
|
|
8
9
|
* Get total cost of the execution up to this point
|
|
9
10
|
*/
|
|
10
11
|
getTotalUsage(): PromptResultUsage;
|
|
12
|
+
/**
|
|
13
|
+
* Observable of total cost of the execution up to this point
|
|
14
|
+
*
|
|
15
|
+
* Note: This does report the cost of the last prompt, not the total cost of the execution up to this point
|
|
16
|
+
*/
|
|
17
|
+
spending(): Observable<PromptResultUsage>;
|
|
11
18
|
};
|
|
12
19
|
/**
|
|
13
20
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
@@ -7,7 +7,7 @@ import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTot
|
|
|
7
7
|
* @returns LLM tools with same functionality with added total cost counting
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function countUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalUsage;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
13
13
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
type BrjappOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Add user to these groups
|
|
4
|
+
*/
|
|
5
|
+
readonly userGroups: Array<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Add this amount of credits to new users
|
|
8
|
+
*/
|
|
9
|
+
readonly initialCredits: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Note: Credit = 1 Word to generate or read
|
|
13
|
+
* Note: What we call here "user" is on BRJ.APP "customer"
|
|
14
|
+
*
|
|
15
|
+
* @private - this will be moved to Promptbook studio
|
|
16
|
+
*/
|
|
17
|
+
export declare class BrjappConnector {
|
|
18
|
+
private readonly apiKey;
|
|
19
|
+
private options;
|
|
20
|
+
private readonly client;
|
|
21
|
+
constructor(apiKey: string, options: BrjappOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Login or register user
|
|
24
|
+
*
|
|
25
|
+
* TODO: [🧠] Probbably better name for this method
|
|
26
|
+
*
|
|
27
|
+
* @param options
|
|
28
|
+
* @returns user token or null if user needs to verify email
|
|
29
|
+
*/
|
|
30
|
+
loginOrRegister(options: {
|
|
31
|
+
email: string;
|
|
32
|
+
password: string;
|
|
33
|
+
customerRealIp: string;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
isSuccess: boolean;
|
|
36
|
+
message: string;
|
|
37
|
+
token: string | null;
|
|
38
|
+
isEmailVerificationRequired: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
private addInitailCredits;
|
|
41
|
+
buyCredits(options: {
|
|
42
|
+
email: string;
|
|
43
|
+
customerRealIp: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
isSuccess: boolean;
|
|
46
|
+
message: string;
|
|
47
|
+
payLink: string | null;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @returns true if credits were spent, false if not enough credits or another error
|
|
52
|
+
*/
|
|
53
|
+
spendCredits(options: {
|
|
54
|
+
email: string;
|
|
55
|
+
token: string;
|
|
56
|
+
creditsAmount: number;
|
|
57
|
+
description: string;
|
|
58
|
+
customerRealIp: string;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
isSuccess: boolean;
|
|
61
|
+
message: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export {};
|