@promptbook/types 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 CHANGED
@@ -83,6 +83,8 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
83
83
 
84
84
  During the computer revolution, we have seen [multiple generations of computer languages](https://github.com/webgptorg/promptbook/discussions/180), from the physical rewiring of the vacuum tubes through low-level machine code to the high-level languages like Python or JavaScript. And now, we're on the edge of the **next revolution**!
85
85
 
86
+
87
+
86
88
  It's a revolution of writing software in **plain human language** that is understandable and executable by both humans and machines – and it's going to change everything!
87
89
 
88
90
  The incredible growth in power of microprocessors and the Moore's Law have been the driving force behind the ever-more powerful languages, and it's been an amazing journey! Similarly, the large language models (like GPT or Claude) are the next big thing in language technology, and they're set to transform the way we interact with computers.
@@ -93,6 +95,9 @@ This shift is going to happen, whether we are ready for it or not. Our mission i
93
95
 
94
96
 
95
97
 
98
+
99
+
100
+
96
101
  ## 🚀 Get started
97
102
 
98
103
  Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
@@ -104,6 +109,8 @@ Take a look at the simple starter kit with books integrated into the **Hello Wor
104
109
 
105
110
 
106
111
 
112
+
113
+
107
114
  ## 💜 The Promptbook Project
108
115
 
109
116
  Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project:
@@ -139,22 +146,35 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
139
146
  </tbody>
140
147
  </table>
141
148
 
149
+ Hello world examples:
150
+
151
+ - [Hello world](https://github.com/webgptorg/hello-world)
152
+ - [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
153
+ - [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
154
+
155
+
156
+
142
157
  We also have a community of developers and users of **Promptbook**:
143
158
 
144
159
  - [Discord community](https://discord.gg/x3QWNaa89N)
145
160
  - [Landing page `ptbk.io`](https://ptbk.io)
146
161
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
147
162
  - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
148
- - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
163
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
149
164
 
150
165
  And **Promptbook.studio** branded socials:
151
166
 
167
+
168
+
152
169
  - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
153
170
 
154
171
  And **Promptujeme** sub-brand:
155
172
 
156
173
  _/Subbrand for Czech clients/_
157
174
 
175
+
176
+
177
+
158
178
  - [Promptujeme.cz](https://www.promptujeme.cz/)
159
179
  - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
160
180
 
@@ -172,6 +192,8 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
172
192
 
173
193
  ## 💙 The Book language
174
194
 
195
+
196
+
175
197
  Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
176
198
 
177
199
  Book is a language that can be used to write AI applications, agents, workflows, automations, knowledgebases, translators, sheet processors, email automations and more. It allows you to harness the power of AI models in human-like terms, without the need to know the specifics and technicalities of the models.
@@ -221,6 +243,8 @@ Personas can have access to different knowledge, tools and actions. They can als
221
243
 
222
244
  - [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
223
245
 
246
+
247
+
224
248
  ### **How:** Knowledge, Instruments and Actions
225
249
 
226
250
  The resources used by the personas are used to do the work.
@@ -296,11 +320,9 @@ Or you can install them separately:
296
320
 
297
321
  ## 📚 Dictionary
298
322
 
299
- ### 📚 Dictionary
300
-
301
323
  The following glossary is used to clarify certain concepts:
302
324
 
303
- #### General LLM / AI terms
325
+ ### General LLM / AI terms
304
326
 
305
327
  - **Prompt drift** is a phenomenon where the AI model starts to generate outputs that are not aligned with the original prompt. This can happen due to the model's training data, the prompt's wording, or the model's architecture.
306
328
  - **Pipeline, workflow or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.
@@ -311,9 +333,13 @@ The following glossary is used to clarify certain concepts:
311
333
  - **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
312
334
  - **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
313
335
 
314
- _Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
315
336
 
316
- #### 💯 Core concepts
337
+
338
+ _Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
339
+
340
+
341
+
342
+ ### 💯 Core concepts
317
343
 
318
344
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
319
345
  - [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
@@ -326,7 +352,7 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
326
352
  - [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29)
327
353
  - [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32)
328
354
 
329
- ##### Advanced concepts
355
+ #### Advanced concepts
330
356
 
331
357
  - [📚 Knowledge (Retrieval-augmented generation)](https://github.com/webgptorg/promptbook/discussions/41)
332
358
  - [🌏 Remote server](https://github.com/webgptorg/promptbook/discussions/89)
@@ -341,11 +367,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
341
367
  - [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
342
368
  - [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
343
369
 
344
- ### Terms specific to Promptbook TypeScript implementation
345
-
346
- - Anonymous mode
347
- - Application mode
348
-
349
370
 
350
371
 
351
372
  ## 🚂 Promptbook Engine
@@ -416,11 +437,11 @@ See [TODO.md](./TODO.md)
416
437
  <div style="display: flex; align-items: center; gap: 20px;">
417
438
 
418
439
  <a href="https://promptbook.studio/">
419
- <img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="100">
440
+ <img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="70">
420
441
  </a>
421
442
 
422
443
  <a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
423
- <img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="100">
444
+ <img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="70">
424
445
  </a>
425
446
 
426
447
  </div>
@@ -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 { countTotalUsage } from '../llm-providers/_common/utils/count-total-usage/countTotalUsage';
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 { countTotalUsage };
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 = 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 {};