@promptbook/javascript 0.105.0-3 → 0.105.0-5
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 +36 -77
- package/esm/index.es.js +37 -5
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +12 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +3 -6
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +9 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +7 -0
- package/esm/typings/src/search-engines/_index.d.ts +6 -0
- package/esm/typings/src/search-engines/google/GoogleSearchEngine.d.ts +18 -0
- package/esm/typings/src/search-engines/serp/SerpSearchEngine.d.ts +15 -0
- package/esm/typings/src/speech-recognition/BrowserSpeechRecognition.d.ts +21 -0
- package/esm/typings/src/speech-recognition/OpenAiSpeechRecognition.d.ts +32 -0
- package/esm/typings/src/types/SpeechRecognition.d.ts +58 -0
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +37 -5
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -104,19 +104,20 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
104
104
|
|
|
105
105
|
## 📖 The Book Whitepaper
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
Nowadays, the biggest challenge for most business applications isn't the raw capabilities of AI models. Large language models such as GPT-5.2 and Claude-4.5 are incredibly capable.
|
|
108
108
|
|
|
109
|
-
The main challenge
|
|
109
|
+
The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
|
|
110
110
|
|
|
111
|
-
Promptbook
|
|
111
|
+
In Promptbook, you can define your context **using simple Books** that are very explicit, easy to understand and write, reliable, and highly portable.
|
|
112
112
|
|
|
113
113
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
114
114
|
|
|
115
|
-
**<ins>Paul Smith
|
|
115
|
+
**<ins>Paul Smith</ins>**<br/>
|
|
116
116
|
<br/>
|
|
117
117
|
**PERSONA** You are a company lawyer.<br/>
|
|
118
118
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
119
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
119
|
+
**RULE** You are knowledgeable, professional, and detail-oriented.<br/>
|
|
120
|
+
TEAM You are part of the legal team of Paul Smith & Associés, you discuss with {Emily White}, the head of the compliance department. {George Brown} is expert in corporate law and {Sophia Black} is expert in labor law.<br/>
|
|
120
121
|
|
|
121
122
|
</td></tr></table>
|
|
122
123
|
|
|
@@ -126,7 +127,9 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
126
127
|
|
|
127
128
|
We have created a language called **Book**, which allows you to write AI agents in their native language and create your own AI persona. Book provides a guide to define all the traits and commitments.
|
|
128
129
|
|
|
129
|
-
You can look at it as prompting (or writing a system message), but decorated by **commitments**.
|
|
130
|
+
You can look at it as "prompting" _(or writing a system message)_, but decorated by **commitments**.
|
|
131
|
+
|
|
132
|
+
**Commitments** are special syntax elements that define contracts between you and the AI agent. They are transformed by Promptbook Engine into low-level parameters like which model to use, its temperature, system message, RAG index, MCP servers, and many other parameters. For some commitments _(for example `RULE` commitment)_ Promptbook Engine can even create adversary agents and extra checks to enforce the rules.
|
|
130
133
|
|
|
131
134
|
#### `Persona` commitment
|
|
132
135
|
|
|
@@ -137,8 +140,6 @@ Personas define the character of your AI persona, its role, and how it should in
|
|
|
137
140
|
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
138
141
|
<br/>
|
|
139
142
|
**PERSONA** You are a company lawyer.<br/>
|
|
140
|
-
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
141
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
142
143
|
|
|
143
144
|
</td></tr></table>
|
|
144
145
|
|
|
@@ -158,7 +159,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
|
|
|
158
159
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
159
160
|
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
160
161
|
<br/>
|
|
161
|
-
**KNOWLEDGE**
|
|
162
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
162
163
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
163
164
|
|
|
164
165
|
</td></tr></table>
|
|
@@ -180,14 +181,14 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
180
181
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
181
182
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
182
183
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
183
|
-
**KNOWLEDGE**
|
|
184
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
184
185
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
185
186
|
|
|
186
187
|
</td></tr></table>
|
|
187
188
|
|
|
188
|
-
#### `
|
|
189
|
+
#### `Team` commitment
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
Team commitment allows you to define the team structure and advisory fellow members the AI can consult with. This allows the AI to simulate collaboration and consultation with other experts, enhancing the quality of its responses.
|
|
191
192
|
|
|
192
193
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
193
194
|
|
|
@@ -200,81 +201,36 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
200
201
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
201
202
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
202
203
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
203
|
-
**KNOWLEDGE**
|
|
204
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
204
205
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
205
|
-
|
|
206
|
+
TEAM You are part of the legal team of Paul Smith & Associés, you discuss with {Emily White}, the head of the compliance department. {George Brown} is expert in corporate law and {Sophia Black} is expert in labor law.<br/>
|
|
206
207
|
|
|
207
208
|
</td></tr></table>
|
|
208
209
|
|
|
209
|
-
[Read more about the language](./BLUEPRINT.md)
|
|
210
|
-
|
|
211
|
-
<div style="page-break-after: always;"></div>
|
|
212
|
-
|
|
213
|
-
### Where to use your AI agent in book
|
|
214
|
-
|
|
215
|
-
Books can be useful in various applications and scenarios. Here are some examples:
|
|
216
|
-
|
|
217
|
-
#### Chat apps:
|
|
218
210
|
|
|
219
|
-
Create your own chat shopping assistant and place it in your eShop.
|
|
220
|
-
You will be able to answer customer questions, help them find products, and provide personalized recommendations. Everything is tightly controlled by the book you have written.
|
|
221
211
|
|
|
222
|
-
|
|
212
|
+
### Promptbook Ecosystem
|
|
223
213
|
|
|
224
|
-
|
|
214
|
+
!!!@@@
|
|
225
215
|
|
|
226
|
-
####
|
|
227
|
-
|
|
228
|
-
Do you love Vibecoding, but the AI code is not always aligned with your coding style and architecture, rules, security, etc.? Create your own coding agent to help enforce your specific coding standards and practices.
|
|
229
|
-
|
|
230
|
-
This can be integrated to almost any Vibecoding platform, like GitHub Copilot, Amazon CodeWhisperer, Cursor, Cline, Kilocode, Roocode,...
|
|
231
|
-
|
|
232
|
-
They will work the same as you are used to, but with your specific rules written in book.
|
|
233
|
-
|
|
234
|
-
#### Internal Expertise
|
|
235
|
-
|
|
236
|
-
Do you have an app written in TypeScript, Python, C#, Java, or any other language, and you are integrating the AI.
|
|
237
|
-
|
|
238
|
-
You can avoid struggle with choosing the best model, its settings like temperature, max tokens, etc., by writing a book agent and using it as your AI expertise.
|
|
239
|
-
|
|
240
|
-
Doesn't matter if you do automations, data analysis, customer support, sentiment analysis, classification, or any other task. Your AI agent will be tailored to your specific needs and requirements.
|
|
241
|
-
|
|
242
|
-
Even works in no-code platforms!
|
|
243
|
-
|
|
244
|
-
<div style="page-break-after: always;"></div>
|
|
216
|
+
#### Promptbook Server
|
|
245
217
|
|
|
246
|
-
|
|
218
|
+
!!!@@@
|
|
247
219
|
|
|
248
|
-
|
|
220
|
+
#### Promptbook Engine
|
|
249
221
|
|
|
250
|
-
|
|
222
|
+
!!!@@@
|
|
251
223
|
|
|
252
|
-
We have written ai asistant in book who can help you with writing your first book.
|
|
253
224
|
|
|
254
|
-
#### Your AI twin
|
|
255
225
|
|
|
256
|
-
Copy your own behavior, personality, and knowledge into book and create your AI twin. It can help you with your work, personal life, or any other task.
|
|
257
226
|
|
|
258
|
-
#### AI persona workpool
|
|
259
227
|
|
|
260
|
-
Or you can pick from our library of pre-written books for various roles and tasks. You can find books for customer support, coding, marketing, sales, HR, legal, and many other roles.
|
|
261
228
|
|
|
262
229
|
|
|
263
230
|
|
|
264
231
|
|
|
265
232
|
|
|
266
233
|
|
|
267
|
-
## 🚀 Get started
|
|
268
|
-
|
|
269
|
-
Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
|
|
270
|
-
|
|
271
|
-
- [Hello Book](https://github.com/webgptorg/hello-world)
|
|
272
|
-
- [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
273
|
-
- [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
234
|
|
|
279
235
|
|
|
280
236
|
## 💜 The Promptbook Project
|
|
@@ -290,33 +246,32 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
290
246
|
</thead>
|
|
291
247
|
<tbody>
|
|
292
248
|
<tr>
|
|
293
|
-
<td><a href="https://
|
|
249
|
+
<td><a href="https://gallery.ptbk.io/">Agents Server</a></td>
|
|
294
250
|
<td>
|
|
295
|
-
|
|
296
|
-
<hr>
|
|
297
|
-
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
251
|
+
Place where you "AI agents live". It allows to create, manage, deploy, and interact with AI agents created in Book language.
|
|
298
252
|
</td>
|
|
299
253
|
</tr>
|
|
300
254
|
<tr>
|
|
301
|
-
<td><a href="https://github.com/webgptorg/
|
|
255
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
302
256
|
<td>
|
|
303
|
-
|
|
257
|
+
Human-friendly, high-level language that abstracts away low-level details of AI. It allows to focus on personality, behavior, knowledge, and rules of AI agents rather than on models, parameters, and prompt engineering.
|
|
258
|
+
<hr>
|
|
259
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
304
260
|
</td>
|
|
305
261
|
</tr>
|
|
306
262
|
<tr>
|
|
307
|
-
<td><a href="https://promptbook
|
|
263
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
308
264
|
<td>
|
|
309
|
-
Promptbook
|
|
265
|
+
Promptbook engine can run AI agents based on Book language.
|
|
266
|
+
It is released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Promptbook Agent Server as Docker Package</a>
|
|
267
|
+
Agent Server is based on Promptbook Engine.
|
|
310
268
|
</td>
|
|
311
269
|
</tr>
|
|
270
|
+
|
|
312
271
|
</tbody>
|
|
313
272
|
</table>
|
|
314
273
|
|
|
315
|
-
Hello world examples:
|
|
316
274
|
|
|
317
|
-
- [Hello world](https://github.com/webgptorg/hello-world)
|
|
318
|
-
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
319
|
-
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
320
275
|
|
|
321
276
|
### 🌐 Community & Social Media
|
|
322
277
|
|
|
@@ -374,6 +329,8 @@ Join our growing community of developers and users:
|
|
|
374
329
|
|
|
375
330
|
|
|
376
331
|
|
|
332
|
+
|
|
333
|
+
|
|
377
334
|
## 📚 Documentation
|
|
378
335
|
|
|
379
336
|
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
@@ -450,6 +407,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
450
407
|
|
|
451
408
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
452
409
|
|
|
410
|
+
|
|
411
|
+
|
|
453
412
|
### 💯 Core concepts
|
|
454
413
|
|
|
455
414
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/promptbook
|
|
20
20
|
*/
|
|
21
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
|
|
22
22
|
/**
|
|
23
23
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
24
24
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5799,7 +5799,12 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5799
5799
|
description: 'Get the current date and time in ISO 8601 format.',
|
|
5800
5800
|
parameters: {
|
|
5801
5801
|
type: 'object',
|
|
5802
|
-
properties: {
|
|
5802
|
+
properties: {
|
|
5803
|
+
timezone: {
|
|
5804
|
+
type: 'string',
|
|
5805
|
+
description: 'Optional timezone name (e.g. "Europe/Prague", "UTC", "America/New_York").',
|
|
5806
|
+
},
|
|
5807
|
+
},
|
|
5803
5808
|
required: [],
|
|
5804
5809
|
},
|
|
5805
5810
|
},
|
|
@@ -5819,9 +5824,36 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5819
5824
|
*/
|
|
5820
5825
|
getToolFunctions() {
|
|
5821
5826
|
return {
|
|
5822
|
-
async get_current_time() {
|
|
5823
|
-
|
|
5824
|
-
|
|
5827
|
+
async get_current_time(args) {
|
|
5828
|
+
var _a;
|
|
5829
|
+
console.log('!!!! [Tool] get_current_time called', { args });
|
|
5830
|
+
const { timezone } = args;
|
|
5831
|
+
if (!timezone) {
|
|
5832
|
+
return new Date().toISOString();
|
|
5833
|
+
}
|
|
5834
|
+
try {
|
|
5835
|
+
// Note: Returning ISO 8601 string but in the requested timezone
|
|
5836
|
+
const formatter = new Intl.DateTimeFormat('en-CA', {
|
|
5837
|
+
timeZone: timezone,
|
|
5838
|
+
year: 'numeric',
|
|
5839
|
+
month: '2-digit',
|
|
5840
|
+
day: '2-digit',
|
|
5841
|
+
hour: '2-digit',
|
|
5842
|
+
minute: '2-digit',
|
|
5843
|
+
second: '2-digit',
|
|
5844
|
+
hour12: false,
|
|
5845
|
+
timeZoneName: 'shortOffset',
|
|
5846
|
+
});
|
|
5847
|
+
const parts = formatter.formatToParts(new Date());
|
|
5848
|
+
const part = (type) => { var _a; return (_a = parts.find((p) => p.type === type)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
5849
|
+
// en-CA format is YYYY-MM-DD
|
|
5850
|
+
const isoString = `${part('year')}-${part('month')}-${part('day')}T${part('hour')}:${part('minute')}:${part('second')}${(_a = part('timeZoneName')) === null || _a === void 0 ? void 0 : _a.replace('GMT', '')}`;
|
|
5851
|
+
return isoString;
|
|
5852
|
+
}
|
|
5853
|
+
catch (error) {
|
|
5854
|
+
// Fallback to UTC if timezone is invalid
|
|
5855
|
+
return new Date().toISOString();
|
|
5856
|
+
}
|
|
5825
5857
|
},
|
|
5826
5858
|
};
|
|
5827
5859
|
}
|