@promptbook/remote-client 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.
Files changed (25) hide show
  1. package/README.md +35 -14
  2. package/esm/index.es.js +27 -3
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/types.index.d.ts +10 -0
  6. package/esm/typings/src/config.d.ts +1 -1
  7. package/esm/typings/src/errors/PipelineExecutionError.d.ts +5 -0
  8. package/esm/typings/src/errors/utils/ErrorJson.d.ts +5 -0
  9. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +7 -0
  10. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/{countTotalUsage.d.ts → countUsage.d.ts} +1 -1
  11. package/esm/typings/src/playground/BrjappConnector.d.ts +64 -0
  12. package/esm/typings/src/playground/brjapp-api-schema.d.ts +12879 -0
  13. package/esm/typings/src/playground/playground.d.ts +5 -0
  14. package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +2 -1
  15. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +15 -3
  16. package/esm/typings/src/types/typeAliases.d.ts +2 -2
  17. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +3 -0
  18. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +3 -0
  19. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +3 -0
  20. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +3 -0
  21. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +3 -0
  22. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -0
  23. package/package.json +3 -2
  24. package/umd/index.umd.js +30 -7
  25. package/umd/index.umd.js.map +1 -1
@@ -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 = 3;
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 countTotalUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalUsage;
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 {};