@promptbook/types 0.86.31 → 0.88.0-10
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 +21 -43
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/cli/cli-commands/common/handleActionErrors.d.ts +11 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +24 -0
- package/esm/typings/src/scrapers/_common/register/$provideScriptingForNode.d.ts +11 -0
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +1 -1
- package/esm/typings/src/utils/serialization/jsonStringsToJsons.d.ts +9 -0
- package/esm/typings/src/utils/serialization/jsonStringsToJsons.test.d.ts +1 -0
- package/package.json +2 -2
- /package/esm/typings/src/_packages/{execute-javascript.index.d.ts → javascript.index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
<blockquote style="color: #ff8811">
|
|
27
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
+
</blockquote>
|
|
29
|
+
|
|
26
30
|
## 📦 Package `@promptbook/types`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -79,8 +83,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
79
83
|
|
|
80
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**!
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
86
|
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!
|
|
85
87
|
|
|
86
88
|
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.
|
|
@@ -137,27 +139,28 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
137
139
|
</tbody>
|
|
138
140
|
</table>
|
|
139
141
|
|
|
142
|
+
Hello world examples:
|
|
143
|
+
|
|
144
|
+
- [Hello world](https://github.com/webgptorg/hello-world)
|
|
145
|
+
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
146
|
+
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
147
|
+
|
|
140
148
|
We also have a community of developers and users of **Promptbook**:
|
|
141
149
|
|
|
142
150
|
- [Discord community](https://discord.gg/x3QWNaa89N)
|
|
143
151
|
- [Landing page `ptbk.io`](https://ptbk.io)
|
|
144
152
|
- [Github discussions](https://github.com/webgptorg/promptbook/discussions)
|
|
145
153
|
- [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
|
|
146
|
-
- [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
|
|
154
|
+
- [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
|
|
147
155
|
|
|
148
156
|
And **Promptbook.studio** branded socials:
|
|
149
157
|
|
|
150
|
-
|
|
151
|
-
|
|
152
158
|
- [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
|
|
153
159
|
|
|
154
160
|
And **Promptujeme** sub-brand:
|
|
155
161
|
|
|
156
162
|
_/Subbrand for Czech clients/_
|
|
157
163
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
164
|
- [Promptujeme.cz](https://www.promptujeme.cz/)
|
|
162
165
|
- [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
|
|
163
166
|
|
|
@@ -175,8 +178,6 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
|
|
|
175
178
|
|
|
176
179
|
## 💙 The Book language
|
|
177
180
|
|
|
178
|
-
|
|
179
|
-
|
|
180
181
|
Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
|
|
181
182
|
|
|
182
183
|
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.
|
|
@@ -226,8 +227,6 @@ Personas can have access to different knowledge, tools and actions. They can als
|
|
|
226
227
|
|
|
227
228
|
- [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
|
|
231
230
|
### **How:** Knowledge, Instruments and Actions
|
|
232
231
|
|
|
233
232
|
The resources used by the personas are used to do the work.
|
|
@@ -274,7 +273,7 @@ Or you can install them separately:
|
|
|
274
273
|
- ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
|
|
275
274
|
- **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown
|
|
276
275
|
- _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
|
|
277
|
-
- **[@promptbook/
|
|
276
|
+
- **[@promptbook/javascript](https://www.npmjs.com/package/@promptbook/javascript)** - Execution tools for javascript inside promptbooks
|
|
278
277
|
- **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
|
|
279
278
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
280
279
|
- **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
|
|
@@ -303,16 +302,9 @@ Or you can install them separately:
|
|
|
303
302
|
|
|
304
303
|
## 📚 Dictionary
|
|
305
304
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
### 📚 Dictionary
|
|
312
|
-
|
|
313
305
|
The following glossary is used to clarify certain concepts:
|
|
314
306
|
|
|
315
|
-
|
|
307
|
+
### General LLM / AI terms
|
|
316
308
|
|
|
317
309
|
- **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.
|
|
318
310
|
- **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.
|
|
@@ -323,13 +315,9 @@ The following glossary is used to clarify certain concepts:
|
|
|
323
315
|
- **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.
|
|
324
316
|
- **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.
|
|
325
317
|
|
|
318
|
+
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
326
319
|
|
|
327
|
-
|
|
328
|
-
_Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
#### 💯 Core concepts
|
|
320
|
+
### 💯 Core concepts
|
|
333
321
|
|
|
334
322
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
|
335
323
|
- [📯 Pipeline](https://github.com/webgptorg/promptbook/discussions/64)
|
|
@@ -342,7 +330,7 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
342
330
|
- [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29)
|
|
343
331
|
- [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32)
|
|
344
332
|
|
|
345
|
-
|
|
333
|
+
#### Advanced concepts
|
|
346
334
|
|
|
347
335
|
- [📚 Knowledge (Retrieval-augmented generation)](https://github.com/webgptorg/promptbook/discussions/41)
|
|
348
336
|
- [🌏 Remote server](https://github.com/webgptorg/promptbook/discussions/89)
|
|
@@ -359,17 +347,9 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
359
347
|
|
|
360
348
|
|
|
361
349
|
|
|
362
|
-
|
|
350
|
+
## 🚂 Promptbook Engine
|
|
363
351
|
|
|
364
|
-
-
|
|
365
|
-
- Application mode
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
## 🔌 Usage in Typescript / Javascript
|
|
370
|
-
|
|
371
|
-
- [Simple usage](./examples/usage/simple-script)
|
|
372
|
-
- [Usage with client and remote server](./examples/usage/remote)
|
|
352
|
+

|
|
373
353
|
|
|
374
354
|
## ➕➖ When to use Promptbook?
|
|
375
355
|
|
|
@@ -430,20 +410,18 @@ Promptbook project is under [BUSL 1.1 is an SPDX license](https://spdx.org/licen
|
|
|
430
410
|
|
|
431
411
|
See [TODO.md](./TODO.md)
|
|
432
412
|
|
|
433
|
-
|
|
434
|
-
|
|
435
413
|
## 🤝 Partners
|
|
436
414
|
|
|
437
415
|
<div style="display: flex; align-items: center; gap: 20px;">
|
|
438
416
|
|
|
439
417
|
<a href="https://promptbook.studio/">
|
|
440
|
-
<img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="
|
|
418
|
+
<img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="70">
|
|
441
419
|
</a>
|
|
442
420
|
|
|
443
421
|
<a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
|
|
444
|
-
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="
|
|
422
|
+
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="70">
|
|
445
423
|
</a>
|
|
446
|
-
|
|
424
|
+
|
|
447
425
|
</div>
|
|
448
426
|
|
|
449
427
|
## 🖋️ Contributing
|
|
@@ -6,6 +6,7 @@ import { $provideLlmToolsConfigurationFromEnv } from '../llm-providers/_common/r
|
|
|
6
6
|
import { $provideLlmToolsFromEnv } from '../llm-providers/_common/register/$provideLlmToolsFromEnv';
|
|
7
7
|
import { $provideFilesystemForNode } from '../scrapers/_common/register/$provideFilesystemForNode';
|
|
8
8
|
import { $provideScrapersForNode } from '../scrapers/_common/register/$provideScrapersForNode';
|
|
9
|
+
import { $provideScriptingForNode } from '../scrapers/_common/register/$provideScriptingForNode';
|
|
9
10
|
import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage';
|
|
10
11
|
import { $execCommand } from '../utils/execCommand/$execCommand';
|
|
11
12
|
import { $execCommands } from '../utils/execCommand/$execCommands';
|
|
@@ -17,6 +18,7 @@ export { $provideLlmToolsConfigurationFromEnv };
|
|
|
17
18
|
export { $provideLlmToolsFromEnv };
|
|
18
19
|
export { $provideFilesystemForNode };
|
|
19
20
|
export { $provideScrapersForNode };
|
|
21
|
+
export { $provideScriptingForNode };
|
|
20
22
|
export { FileCacheStorage };
|
|
21
23
|
export { $execCommand };
|
|
22
24
|
export { $execCommands };
|
|
@@ -40,6 +40,7 @@ import type { ExecutionReportString } from '../execution/execution-report/Execut
|
|
|
40
40
|
import type { ExecutionReportStringOptions } from '../execution/execution-report/ExecutionReportStringOptions';
|
|
41
41
|
import type { ExecutionTask } from '../execution/ExecutionTask';
|
|
42
42
|
import type { PreparationTask } from '../execution/ExecutionTask';
|
|
43
|
+
import type { task_status } from '../execution/ExecutionTask';
|
|
43
44
|
import type { AbstractTask } from '../execution/ExecutionTask';
|
|
44
45
|
import type { Task } from '../execution/ExecutionTask';
|
|
45
46
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
@@ -322,6 +323,7 @@ export type { ExecutionReportString };
|
|
|
322
323
|
export type { ExecutionReportStringOptions };
|
|
323
324
|
export type { ExecutionTask };
|
|
324
325
|
export type { PreparationTask };
|
|
326
|
+
export type { task_status };
|
|
325
327
|
export type { AbstractTask };
|
|
326
328
|
export type { Task };
|
|
327
329
|
export type { ExecutionTools };
|
|
@@ -62,6 +62,7 @@ import { clonePipeline } from '../utils/serialization/clonePipeline';
|
|
|
62
62
|
import { deepClone } from '../utils/serialization/deepClone';
|
|
63
63
|
import { exportJson } from '../utils/serialization/exportJson';
|
|
64
64
|
import { isSerializableAsJson } from '../utils/serialization/isSerializableAsJson';
|
|
65
|
+
import { jsonStringsToJsons } from '../utils/serialization/jsonStringsToJsons';
|
|
65
66
|
import { difference } from '../utils/sets/difference';
|
|
66
67
|
import { intersection } from '../utils/sets/intersection';
|
|
67
68
|
import { union } from '../utils/sets/union';
|
|
@@ -143,6 +144,7 @@ export { clonePipeline };
|
|
|
143
144
|
export { deepClone };
|
|
144
145
|
export { exportJson };
|
|
145
146
|
export { isSerializableAsJson };
|
|
147
|
+
export { jsonStringsToJsons };
|
|
146
148
|
export { difference };
|
|
147
149
|
export { intersection };
|
|
148
150
|
export { union };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
type actionCallbackFunction = Parameters<Program['action']>[0];
|
|
3
|
+
/**
|
|
4
|
+
* Wraps action to handle error console logging and exit process with error code
|
|
5
|
+
*
|
|
6
|
+
* @param action Action to be wrapped in error handling
|
|
7
|
+
* @returns Wrapped action
|
|
8
|
+
* @private internal helper function for CLI commands
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleActionErrors(action: actionCallbackFunction): actionCallbackFunction;
|
|
11
|
+
export {};
|
|
@@ -40,6 +40,10 @@ export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
|
|
|
40
40
|
readonly taskType: 'PREPARATION';
|
|
41
41
|
readonly taskId: `prep-${task_id}`;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Status of a task
|
|
45
|
+
*/
|
|
46
|
+
export type task_status = 'RUNNING' | 'FINISHED' | 'ERROR';
|
|
43
47
|
/**
|
|
44
48
|
* Base interface for all task types
|
|
45
49
|
*/
|
|
@@ -52,6 +56,18 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
52
56
|
* Unique identifier for the task
|
|
53
57
|
*/
|
|
54
58
|
readonly taskId: task_id;
|
|
59
|
+
/**
|
|
60
|
+
* Status of the task
|
|
61
|
+
*/
|
|
62
|
+
readonly status: task_status;
|
|
63
|
+
/**
|
|
64
|
+
* Date when the task was created
|
|
65
|
+
*/
|
|
66
|
+
readonly createdAt: Date;
|
|
67
|
+
/**
|
|
68
|
+
* Date when the task was last updated
|
|
69
|
+
*/
|
|
70
|
+
readonly updatedAt: Date;
|
|
55
71
|
/**
|
|
56
72
|
* Gets a promise that resolves with the task result
|
|
57
73
|
*/
|
|
@@ -66,6 +82,14 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
66
82
|
* Gets just the current value which is mutated during the task processing
|
|
67
83
|
*/
|
|
68
84
|
currentValue: PartialDeep<TTaskResult>;
|
|
85
|
+
/**
|
|
86
|
+
* List of errors that occurred during the task processing
|
|
87
|
+
*/
|
|
88
|
+
readonly errors: Array<Error>;
|
|
89
|
+
/**
|
|
90
|
+
* List of warnings that occurred during the task processing
|
|
91
|
+
*/
|
|
92
|
+
readonly warnings: Array<Error>;
|
|
69
93
|
};
|
|
70
94
|
export type Task = ExecutionTask | PreparationTask;
|
|
71
95
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ScriptExecutionTools } from '../../../execution/ScriptExecutionTools';
|
|
2
|
+
import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Provides script execution tools
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/node`
|
|
7
|
+
*/
|
|
8
|
+
export declare function $provideScriptingForNode(options?: PrepareAndScrapeOptions): Promise<ReadonlyArray<ScriptExecutionTools>>;
|
|
9
|
+
/**
|
|
10
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
11
|
+
*/
|
|
@@ -6,7 +6,7 @@ import type { JavascriptExecutionToolsOptions } from './JavascriptExecutionTools
|
|
|
6
6
|
* Warning: It is used for testing and mocking
|
|
7
7
|
* **NOT intended to use in the production** due to its unsafe nature, use `JavascriptExecutionTools` instead.
|
|
8
8
|
*
|
|
9
|
-
* @public exported from `@promptbook/
|
|
9
|
+
* @public exported from `@promptbook/javascript`
|
|
10
10
|
*/
|
|
11
11
|
export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
|
|
12
12
|
protected readonly options: JavascriptExecutionToolsOptions;
|
|
@@ -3,6 +3,6 @@ import { JavascriptEvalExecutionTools } from './JavascriptEvalExecutionTools';
|
|
|
3
3
|
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
4
4
|
*
|
|
5
5
|
* @alias JavascriptExecutionTools
|
|
6
|
-
* @public exported from `@promptbook/
|
|
6
|
+
* @public exported from `@promptbook/javascript`
|
|
7
7
|
*/
|
|
8
8
|
export declare const JavascriptExecutionTools: typeof JavascriptEvalExecutionTools;
|
|
@@ -20,7 +20,7 @@ import { unwrapResult } from '../../utils/unwrapResult';
|
|
|
20
20
|
/**
|
|
21
21
|
* @@@
|
|
22
22
|
*
|
|
23
|
-
* @public exported from `@promptbook/
|
|
23
|
+
* @public exported from `@promptbook/javascript`
|
|
24
24
|
*/
|
|
25
25
|
export declare const POSTPROCESSING_FUNCTIONS: {
|
|
26
26
|
spaceTrim: typeof spaceTrim;
|
|
@@ -6,7 +6,7 @@ import type { string_javascript_name } from '../../../types/typeAliases';
|
|
|
6
6
|
* @param script from which to extract the variables
|
|
7
7
|
* @returns the list of variable names
|
|
8
8
|
* @throws {ParseError} if the script is invalid
|
|
9
|
-
* @public exported from `@promptbook/
|
|
9
|
+
* @public exported from `@promptbook/javascript`
|
|
10
10
|
*/
|
|
11
11
|
export declare function extractVariablesFromJavascript(script: string_javascript): Set<string_javascript_name>;
|
|
12
12
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0-10",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"homepage": "https://ptbk.io/",
|
|
46
46
|
"typings": "./esm/typings/src/_packages/types.index.d.ts",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@promptbook/core": "0.
|
|
48
|
+
"@promptbook/core": "0.88.0-10"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
File without changes
|