@promptbook/editable 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 +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 +2 -2
- package/umd/index.umd.js +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
60
60
|
|
|
61
61
|
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**!
|
|
62
62
|
|
|
63
|
+
|
|
64
|
+
|
|
63
65
|
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!
|
|
64
66
|
|
|
65
67
|
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.
|
|
@@ -70,6 +72,9 @@ This shift is going to happen, whether we are ready for it or not. Our mission i
|
|
|
70
72
|
|
|
71
73
|
|
|
72
74
|
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
73
78
|
## 🚀 Get started
|
|
74
79
|
|
|
75
80
|
Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
|
|
@@ -81,6 +86,8 @@ Take a look at the simple starter kit with books integrated into the **Hello Wor
|
|
|
81
86
|
|
|
82
87
|
|
|
83
88
|
|
|
89
|
+
|
|
90
|
+
|
|
84
91
|
## 💜 The Promptbook Project
|
|
85
92
|
|
|
86
93
|
Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project:
|
|
@@ -116,22 +123,35 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
116
123
|
</tbody>
|
|
117
124
|
</table>
|
|
118
125
|
|
|
126
|
+
Hello world examples:
|
|
127
|
+
|
|
128
|
+
- [Hello world](https://github.com/webgptorg/hello-world)
|
|
129
|
+
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
130
|
+
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
119
134
|
We also have a community of developers and users of **Promptbook**:
|
|
120
135
|
|
|
121
136
|
- [Discord community](https://discord.gg/x3QWNaa89N)
|
|
122
137
|
- [Landing page `ptbk.io`](https://ptbk.io)
|
|
123
138
|
- [Github discussions](https://github.com/webgptorg/promptbook/discussions)
|
|
124
139
|
- [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
|
|
125
|
-
- [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
|
|
140
|
+
- [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
|
|
126
141
|
|
|
127
142
|
And **Promptbook.studio** branded socials:
|
|
128
143
|
|
|
144
|
+
|
|
145
|
+
|
|
129
146
|
- [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
|
|
130
147
|
|
|
131
148
|
And **Promptujeme** sub-brand:
|
|
132
149
|
|
|
133
150
|
_/Subbrand for Czech clients/_
|
|
134
151
|
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
135
155
|
- [Promptujeme.cz](https://www.promptujeme.cz/)
|
|
136
156
|
- [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
|
|
137
157
|
|
|
@@ -149,6 +169,8 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
|
|
|
149
169
|
|
|
150
170
|
## 💙 The Book language
|
|
151
171
|
|
|
172
|
+
|
|
173
|
+
|
|
152
174
|
Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
|
|
153
175
|
|
|
154
176
|
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.
|
|
@@ -198,6 +220,8 @@ Personas can have access to different knowledge, tools and actions. They can als
|
|
|
198
220
|
|
|
199
221
|
- [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
|
|
200
222
|
|
|
223
|
+
|
|
224
|
+
|
|
201
225
|
### **How:** Knowledge, Instruments and Actions
|
|
202
226
|
|
|
203
227
|
The resources used by the personas are used to do the work.
|
|
@@ -273,11 +297,9 @@ Or you can install them separately:
|
|
|
273
297
|
|
|
274
298
|
## 📚 Dictionary
|
|
275
299
|
|
|
276
|
-
### 📚 Dictionary
|
|
277
|
-
|
|
278
300
|
The following glossary is used to clarify certain concepts:
|
|
279
301
|
|
|
280
|
-
|
|
302
|
+
### General LLM / AI terms
|
|
281
303
|
|
|
282
304
|
- **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.
|
|
283
305
|
- **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.
|
|
@@ -288,9 +310,13 @@ The following glossary is used to clarify certain concepts:
|
|
|
288
310
|
- **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.
|
|
289
311
|
- **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.
|
|
290
312
|
|
|
291
|
-
_Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
292
313
|
|
|
293
|
-
|
|
314
|
+
|
|
315
|
+
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
### 💯 Core concepts
|
|
294
320
|
|
|
295
321
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
|
296
322
|
- [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
|
|
@@ -303,7 +329,7 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
303
329
|
- [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29)
|
|
304
330
|
- [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32)
|
|
305
331
|
|
|
306
|
-
|
|
332
|
+
#### Advanced concepts
|
|
307
333
|
|
|
308
334
|
- [📚 Knowledge (Retrieval-augmented generation)](https://github.com/webgptorg/promptbook/discussions/41)
|
|
309
335
|
- [🌏 Remote server](https://github.com/webgptorg/promptbook/discussions/89)
|
|
@@ -318,11 +344,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
318
344
|
- [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
|
|
319
345
|
- [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
|
|
320
346
|
|
|
321
|
-
### Terms specific to Promptbook TypeScript implementation
|
|
322
|
-
|
|
323
|
-
- Anonymous mode
|
|
324
|
-
- Application mode
|
|
325
|
-
|
|
326
347
|
|
|
327
348
|
|
|
328
349
|
## 🚂 Promptbook Engine
|
|
@@ -393,11 +414,11 @@ See [TODO.md](./TODO.md)
|
|
|
393
414
|
<div style="display: flex; align-items: center; gap: 20px;">
|
|
394
415
|
|
|
395
416
|
<a href="https://promptbook.studio/">
|
|
396
|
-
<img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="
|
|
417
|
+
<img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="70">
|
|
397
418
|
</a>
|
|
398
419
|
|
|
399
420
|
<a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
|
|
400
|
-
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="
|
|
421
|
+
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="70">
|
|
401
422
|
</a>
|
|
402
423
|
|
|
403
424
|
</div>
|
package/esm/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
17
17
|
* @generated
|
|
18
18
|
* @see https://github.com/webgptorg/promptbook
|
|
19
19
|
*/
|
|
20
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
20
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-1';
|
|
21
21
|
/**
|
|
22
22
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
23
23
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -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 {};
|