@promptbook/documents 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 +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 +1 -1
package/README.md
CHANGED
|
@@ -61,19 +61,20 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
61
61
|
|
|
62
62
|
## 📖 The Book Whitepaper
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
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.
|
|
65
65
|
|
|
66
|
-
The main challenge
|
|
66
|
+
The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
|
|
67
67
|
|
|
68
|
-
Promptbook
|
|
68
|
+
In Promptbook, you can define your context **using simple Books** that are very explicit, easy to understand and write, reliable, and highly portable.
|
|
69
69
|
|
|
70
70
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
71
71
|
|
|
72
|
-
**<ins>Paul Smith
|
|
72
|
+
**<ins>Paul Smith</ins>**<br/>
|
|
73
73
|
<br/>
|
|
74
74
|
**PERSONA** You are a company lawyer.<br/>
|
|
75
75
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
76
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
76
|
+
**RULE** You are knowledgeable, professional, and detail-oriented.<br/>
|
|
77
|
+
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/>
|
|
77
78
|
|
|
78
79
|
</td></tr></table>
|
|
79
80
|
|
|
@@ -83,7 +84,9 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
83
84
|
|
|
84
85
|
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.
|
|
85
86
|
|
|
86
|
-
You can look at it as prompting (or writing a system message), but decorated by **commitments**.
|
|
87
|
+
You can look at it as "prompting" _(or writing a system message)_, but decorated by **commitments**.
|
|
88
|
+
|
|
89
|
+
**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.
|
|
87
90
|
|
|
88
91
|
#### `Persona` commitment
|
|
89
92
|
|
|
@@ -94,8 +97,6 @@ Personas define the character of your AI persona, its role, and how it should in
|
|
|
94
97
|
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
95
98
|
<br/>
|
|
96
99
|
**PERSONA** You are a company lawyer.<br/>
|
|
97
|
-
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
98
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
99
100
|
|
|
100
101
|
</td></tr></table>
|
|
101
102
|
|
|
@@ -115,7 +116,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
|
|
|
115
116
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
116
117
|
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
117
118
|
<br/>
|
|
118
|
-
**KNOWLEDGE**
|
|
119
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
119
120
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
120
121
|
|
|
121
122
|
</td></tr></table>
|
|
@@ -137,14 +138,14 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
137
138
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
138
139
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
139
140
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
140
|
-
**KNOWLEDGE**
|
|
141
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
141
142
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
142
143
|
|
|
143
144
|
</td></tr></table>
|
|
144
145
|
|
|
145
|
-
#### `
|
|
146
|
+
#### `Team` commitment
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
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.
|
|
148
149
|
|
|
149
150
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
150
151
|
|
|
@@ -157,81 +158,36 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
157
158
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
158
159
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
159
160
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
160
|
-
**KNOWLEDGE**
|
|
161
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
161
162
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
162
|
-
|
|
163
|
+
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/>
|
|
163
164
|
|
|
164
165
|
</td></tr></table>
|
|
165
166
|
|
|
166
|
-
[Read more about the language](./BLUEPRINT.md)
|
|
167
|
-
|
|
168
|
-
<div style="page-break-after: always;"></div>
|
|
169
|
-
|
|
170
|
-
### Where to use your AI agent in book
|
|
171
|
-
|
|
172
|
-
Books can be useful in various applications and scenarios. Here are some examples:
|
|
173
|
-
|
|
174
|
-
#### Chat apps:
|
|
175
167
|
|
|
176
|
-
Create your own chat shopping assistant and place it in your eShop.
|
|
177
|
-
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.
|
|
178
168
|
|
|
179
|
-
|
|
169
|
+
### Promptbook Ecosystem
|
|
180
170
|
|
|
181
|
-
|
|
171
|
+
!!!@@@
|
|
182
172
|
|
|
183
|
-
####
|
|
184
|
-
|
|
185
|
-
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.
|
|
186
|
-
|
|
187
|
-
This can be integrated to almost any Vibecoding platform, like GitHub Copilot, Amazon CodeWhisperer, Cursor, Cline, Kilocode, Roocode,...
|
|
188
|
-
|
|
189
|
-
They will work the same as you are used to, but with your specific rules written in book.
|
|
190
|
-
|
|
191
|
-
#### Internal Expertise
|
|
192
|
-
|
|
193
|
-
Do you have an app written in TypeScript, Python, C#, Java, or any other language, and you are integrating the AI.
|
|
194
|
-
|
|
195
|
-
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.
|
|
196
|
-
|
|
197
|
-
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.
|
|
198
|
-
|
|
199
|
-
Even works in no-code platforms!
|
|
200
|
-
|
|
201
|
-
<div style="page-break-after: always;"></div>
|
|
173
|
+
#### Promptbook Server
|
|
202
174
|
|
|
203
|
-
|
|
175
|
+
!!!@@@
|
|
204
176
|
|
|
205
|
-
|
|
177
|
+
#### Promptbook Engine
|
|
206
178
|
|
|
207
|
-
|
|
179
|
+
!!!@@@
|
|
208
180
|
|
|
209
|
-
We have written ai asistant in book who can help you with writing your first book.
|
|
210
181
|
|
|
211
|
-
#### Your AI twin
|
|
212
182
|
|
|
213
|
-
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.
|
|
214
183
|
|
|
215
|
-
#### AI persona workpool
|
|
216
184
|
|
|
217
|
-
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.
|
|
218
185
|
|
|
219
186
|
|
|
220
187
|
|
|
221
188
|
|
|
222
189
|
|
|
223
190
|
|
|
224
|
-
## 🚀 Get started
|
|
225
|
-
|
|
226
|
-
Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
|
|
227
|
-
|
|
228
|
-
- [Hello Book](https://github.com/webgptorg/hello-world)
|
|
229
|
-
- [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
230
|
-
- [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
191
|
|
|
236
192
|
|
|
237
193
|
## 💜 The Promptbook Project
|
|
@@ -247,33 +203,32 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
247
203
|
</thead>
|
|
248
204
|
<tbody>
|
|
249
205
|
<tr>
|
|
250
|
-
<td><a href="https://
|
|
206
|
+
<td><a href="https://gallery.ptbk.io/">Agents Server</a></td>
|
|
251
207
|
<td>
|
|
252
|
-
|
|
253
|
-
<hr>
|
|
254
|
-
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
208
|
+
Place where you "AI agents live". It allows to create, manage, deploy, and interact with AI agents created in Book language.
|
|
255
209
|
</td>
|
|
256
210
|
</tr>
|
|
257
211
|
<tr>
|
|
258
|
-
<td><a href="https://github.com/webgptorg/
|
|
212
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
259
213
|
<td>
|
|
260
|
-
|
|
214
|
+
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.
|
|
215
|
+
<hr>
|
|
216
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
261
217
|
</td>
|
|
262
218
|
</tr>
|
|
263
219
|
<tr>
|
|
264
|
-
<td><a href="https://promptbook
|
|
220
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
265
221
|
<td>
|
|
266
|
-
Promptbook
|
|
222
|
+
Promptbook engine can run AI agents based on Book language.
|
|
223
|
+
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>
|
|
224
|
+
Agent Server is based on Promptbook Engine.
|
|
267
225
|
</td>
|
|
268
226
|
</tr>
|
|
227
|
+
|
|
269
228
|
</tbody>
|
|
270
229
|
</table>
|
|
271
230
|
|
|
272
|
-
Hello world examples:
|
|
273
231
|
|
|
274
|
-
- [Hello world](https://github.com/webgptorg/hello-world)
|
|
275
|
-
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
276
|
-
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
277
232
|
|
|
278
233
|
### 🌐 Community & Social Media
|
|
279
234
|
|
|
@@ -331,6 +286,8 @@ Join our growing community of developers and users:
|
|
|
331
286
|
|
|
332
287
|
|
|
333
288
|
|
|
289
|
+
|
|
290
|
+
|
|
334
291
|
## 📚 Documentation
|
|
335
292
|
|
|
336
293
|
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
@@ -407,6 +364,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
407
364
|
|
|
408
365
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
409
366
|
|
|
367
|
+
|
|
368
|
+
|
|
410
369
|
### 💯 Core concepts
|
|
411
370
|
|
|
412
371
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
2
|
import { SimplePromptInterfaceTools } from '../dialogs/simple-prompt/SimplePromptInterfaceTools';
|
|
3
3
|
import { $provideScrapersForBrowser } from '../scrapers/_common/register/$provideScrapersForBrowser';
|
|
4
|
+
import { BrowserSpeechRecognition } from '../speech-recognition/BrowserSpeechRecognition';
|
|
4
5
|
import { getIndexedDbStorage } from '../storage/local-storage/getIndexedDbStorage';
|
|
5
6
|
import { getLocalStorage } from '../storage/local-storage/getLocalStorage';
|
|
6
7
|
import { getSessionStorage } from '../storage/local-storage/getSessionStorage';
|
|
@@ -10,6 +11,7 @@ import { ObjectUrl } from '../utils/files/ObjectUrl';
|
|
|
10
11
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
11
12
|
export { SimplePromptInterfaceTools };
|
|
12
13
|
export { $provideScrapersForBrowser };
|
|
14
|
+
export { BrowserSpeechRecognition };
|
|
13
15
|
export { getIndexedDbStorage };
|
|
14
16
|
export { getLocalStorage };
|
|
15
17
|
export { getSessionStorage };
|
|
@@ -183,6 +183,7 @@ import type { PostprocessingFunction } from '../scripting/javascript/JavascriptE
|
|
|
183
183
|
import type { ToolFunction } from '../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
184
184
|
import type { SearchEngine } from '../search-engines/SearchEngine';
|
|
185
185
|
import type { SearchResult } from '../search-engines/SearchResult';
|
|
186
|
+
import type { OpenAiSpeechRecognitionOptions } from '../speech-recognition/OpenAiSpeechRecognition';
|
|
186
187
|
import type { PromptbookStorage } from '../storage/_common/PromptbookStorage';
|
|
187
188
|
import type { FileCacheStorageOptions } from '../storage/file-cache-storage/FileCacheStorageOptions';
|
|
188
189
|
import type { IndexedDbStorageOptions } from '../storage/local-storage/utils/IndexedDbStorageOptions';
|
|
@@ -207,6 +208,10 @@ import type { ImagePrompt } from '../types/Prompt';
|
|
|
207
208
|
import type { EmbeddingPrompt } from '../types/Prompt';
|
|
208
209
|
import type { ScriptLanguage } from '../types/ScriptLanguage';
|
|
209
210
|
import type { SectionType } from '../types/SectionType';
|
|
211
|
+
import type { SpeechRecognition } from '../types/SpeechRecognition';
|
|
212
|
+
import type { SpeechRecognitionStartOptions } from '../types/SpeechRecognition';
|
|
213
|
+
import type { SpeechRecognitionState } from '../types/SpeechRecognition';
|
|
214
|
+
import type { SpeechRecognitionEvent } from '../types/SpeechRecognition';
|
|
210
215
|
import type { TaskType } from '../types/TaskType';
|
|
211
216
|
import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
212
217
|
import type { string_business_category_name } from '../types/typeAliases';
|
|
@@ -316,6 +321,7 @@ import type { string_license_token } from '../types/typeAliases';
|
|
|
316
321
|
import type { string_password } from '../types/typeAliases';
|
|
317
322
|
import type { string_ssh_key } from '../types/typeAliases';
|
|
318
323
|
import type { string_pgp_key } from '../types/typeAliases';
|
|
324
|
+
import type { string_language } from '../types/typeAliases';
|
|
319
325
|
import type { string_date_iso8601 } from '../types/typeAliases';
|
|
320
326
|
import type { number_usd } from '../types/typeAliases';
|
|
321
327
|
import type { number_id } from '../types/typeAliases';
|
|
@@ -557,6 +563,7 @@ export type { PostprocessingFunction };
|
|
|
557
563
|
export type { ToolFunction };
|
|
558
564
|
export type { SearchEngine };
|
|
559
565
|
export type { SearchResult };
|
|
566
|
+
export type { OpenAiSpeechRecognitionOptions };
|
|
560
567
|
export type { PromptbookStorage };
|
|
561
568
|
export type { FileCacheStorageOptions };
|
|
562
569
|
export type { IndexedDbStorageOptions };
|
|
@@ -581,6 +588,10 @@ export type { ImagePrompt };
|
|
|
581
588
|
export type { EmbeddingPrompt };
|
|
582
589
|
export type { ScriptLanguage };
|
|
583
590
|
export type { SectionType };
|
|
591
|
+
export type { SpeechRecognition };
|
|
592
|
+
export type { SpeechRecognitionStartOptions };
|
|
593
|
+
export type { SpeechRecognitionState };
|
|
594
|
+
export type { SpeechRecognitionEvent };
|
|
584
595
|
export type { TaskType };
|
|
585
596
|
export type { string_char_emoji };
|
|
586
597
|
export type { string_business_category_name };
|
|
@@ -690,6 +701,7 @@ export type { string_license_token };
|
|
|
690
701
|
export type { string_password };
|
|
691
702
|
export type { string_ssh_key };
|
|
692
703
|
export type { string_pgp_key };
|
|
704
|
+
export type { string_language };
|
|
693
705
|
export type { string_date_iso8601 };
|
|
694
706
|
export type { number_usd };
|
|
695
707
|
export type { number_id };
|
|
@@ -31,7 +31,7 @@ export type AgentCapability = {
|
|
|
31
31
|
/**
|
|
32
32
|
* The type of the capability
|
|
33
33
|
*/
|
|
34
|
-
type: 'browser' | 'search-engine' | 'knowledge' | 'time';
|
|
34
|
+
type: 'browser' | 'search-engine' | 'knowledge' | 'time' | 'inheritance' | 'import';
|
|
35
35
|
/**
|
|
36
36
|
* The label to display for this capability
|
|
37
37
|
*/
|
|
@@ -40,6 +40,11 @@ export type AgentCapability = {
|
|
|
40
40
|
* The name of the icon to display for this capability
|
|
41
41
|
*/
|
|
42
42
|
iconName: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional link to another agent
|
|
45
|
+
* This is used for 'inheritance' and 'import' types
|
|
46
|
+
*/
|
|
47
|
+
agentUrl?: string_agent_url;
|
|
43
48
|
};
|
|
44
49
|
export type AgentBasicInformation = {
|
|
45
50
|
/**
|
|
@@ -5,6 +5,7 @@ import type { ChatMessage } from '../types/ChatMessage';
|
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
6
|
import { string_color } from '../../../types/typeAliases';
|
|
7
7
|
import { Color } from '../../../_packages/color.index';
|
|
8
|
+
import { SpeechRecognition } from '../../../types/SpeechRecognition';
|
|
8
9
|
/**
|
|
9
10
|
* @public exported from `@promptbook/components`
|
|
10
11
|
*/
|
|
@@ -47,13 +48,9 @@ export type ChatProps = {
|
|
|
47
48
|
*/
|
|
48
49
|
readonly isVoiceRecognitionButtonShown?: boolean;
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
+
* Speech recognition provider
|
|
51
52
|
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The language code to use for voice recognition
|
|
55
|
-
*/
|
|
56
|
-
readonly voiceLanguage?: string;
|
|
53
|
+
readonly speechRecognition?: SpeechRecognition;
|
|
57
54
|
/**
|
|
58
55
|
* Optional placeholder message for the textarea
|
|
59
56
|
*
|
|
@@ -33,6 +33,15 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
|
|
|
33
33
|
* Indicates if the message was sent via a voice call
|
|
34
34
|
*/
|
|
35
35
|
isVoiceCall?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional tool calls made during the execution
|
|
38
|
+
*/
|
|
39
|
+
readonly ongoingToolCalls?: ReadonlyArray<{
|
|
40
|
+
/**
|
|
41
|
+
* Name of the tool
|
|
42
|
+
*/
|
|
43
|
+
readonly name: string;
|
|
44
|
+
}>;
|
|
36
45
|
/**
|
|
37
46
|
* Optional file attachments
|
|
38
47
|
*/
|
|
@@ -56,7 +56,9 @@ export type LlmExecutionTools = {
|
|
|
56
56
|
/**
|
|
57
57
|
* Calls a chat model with streaming
|
|
58
58
|
*/
|
|
59
|
-
callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult
|
|
59
|
+
callChatModelStream?(prompt: Prompt, onProgress: (chunk: ChatPromptResult & {
|
|
60
|
+
isFinished?: boolean;
|
|
61
|
+
}) => void): Promise<ChatPromptResult>;
|
|
60
62
|
/**
|
|
61
63
|
* Calls a voice chat model
|
|
62
64
|
*/
|
|
@@ -39,10 +39,17 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
39
39
|
* List all available OpenAI compatible models that can be used
|
|
40
40
|
*/
|
|
41
41
|
listModels(): Promise<ReadonlyArray<AvailableModel>>;
|
|
42
|
+
/**
|
|
43
|
+
* Calls OpenAI compatible API to use a chat model.
|
|
44
|
+
*/
|
|
42
45
|
/**
|
|
43
46
|
* Calls OpenAI compatible API to use a chat model.
|
|
44
47
|
*/
|
|
45
48
|
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Calls OpenAI compatible API to use a chat model with streaming.
|
|
51
|
+
*/
|
|
52
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>;
|
|
46
53
|
/**
|
|
47
54
|
* Internal method that handles parameter retry for chat model calls
|
|
48
55
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
|
+
import type { SearchEngine } from '../SearchEngine';
|
|
4
|
+
import type { SearchResult } from '../SearchResult';
|
|
5
|
+
/**
|
|
6
|
+
* A search engine implementation that uses the Google Custom Search JSON API.
|
|
7
|
+
*
|
|
8
|
+
* @private <- TODO: !!!! Export via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare class GoogleSearchEngine implements SearchEngine {
|
|
11
|
+
get title(): string_title & string_markdown_text;
|
|
12
|
+
get description(): string_markdown;
|
|
13
|
+
/**
|
|
14
|
+
* @see https://developers.google.com/custom-search/v1/overview
|
|
15
|
+
*/
|
|
16
|
+
checkConfiguration(): Promisable<void>;
|
|
17
|
+
search(query: string): Promise<SearchResult[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_markdown, string_markdown_text, string_title } from '../../types/typeAliases';
|
|
3
|
+
import type { SearchEngine } from '../SearchEngine';
|
|
4
|
+
import type { SearchResult } from '../SearchResult';
|
|
5
|
+
/**
|
|
6
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
7
|
+
*
|
|
8
|
+
* @private <- TODO: !!!! Export via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare class SerpSearchEngine implements SearchEngine {
|
|
11
|
+
get title(): string_title & string_markdown_text;
|
|
12
|
+
get description(): string_markdown;
|
|
13
|
+
checkConfiguration(): Promisable<void>;
|
|
14
|
+
search(query: string): Promise<SearchResult[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SpeechRecognition, SpeechRecognitionEvent, SpeechRecognitionStartOptions, SpeechRecognitionState } from '../types/SpeechRecognition';
|
|
2
|
+
/**
|
|
3
|
+
* Speech recognition using Web Speech API `SpeechRecognition` available in modern browsers
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/browser`
|
|
6
|
+
*/
|
|
7
|
+
export declare class BrowserSpeechRecognition implements SpeechRecognition {
|
|
8
|
+
private recognition;
|
|
9
|
+
private callbacks;
|
|
10
|
+
private _state;
|
|
11
|
+
get state(): SpeechRecognitionState;
|
|
12
|
+
constructor();
|
|
13
|
+
$start(options?: SpeechRecognitionStartOptions): void;
|
|
14
|
+
$stop(): void;
|
|
15
|
+
subscribe(callback: (event: SpeechRecognitionEvent) => void): () => void;
|
|
16
|
+
private emit;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* TODO: !!!! Search ACRY for `window` and put -> [🔵]
|
|
20
|
+
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
21
|
+
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SpeechRecognition, SpeechRecognitionEvent, SpeechRecognitionStartOptions, SpeechRecognitionState } from '../types/SpeechRecognition';
|
|
2
|
+
/**
|
|
3
|
+
* Options for OpenAiSpeechRecognition
|
|
4
|
+
*/
|
|
5
|
+
export type OpenAiSpeechRecognitionOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* OpenAI API base URL or proxy endpoint
|
|
8
|
+
* @default '/api/openai/v1'
|
|
9
|
+
*/
|
|
10
|
+
readonly baseUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Speech recognition using OpenAI Whisper API to transcribe audio into text
|
|
14
|
+
*
|
|
15
|
+
* @private because it requires server-client communication with a proxy endpoint
|
|
16
|
+
*
|
|
17
|
+
* Note: This implementation uses a server-side proxy to avoid exposing the OpenAI API key on the client.
|
|
18
|
+
*/
|
|
19
|
+
export declare class OpenAiSpeechRecognition implements SpeechRecognition {
|
|
20
|
+
private readonly options;
|
|
21
|
+
private mediaRecorder;
|
|
22
|
+
private audioChunks;
|
|
23
|
+
private callbacks;
|
|
24
|
+
private _state;
|
|
25
|
+
get state(): SpeechRecognitionState;
|
|
26
|
+
constructor(options?: OpenAiSpeechRecognitionOptions);
|
|
27
|
+
$start(options?: SpeechRecognitionStartOptions): Promise<void>;
|
|
28
|
+
$stop(): void;
|
|
29
|
+
private transcribe;
|
|
30
|
+
subscribe(callback: (event: SpeechRecognitionEvent) => void): () => void;
|
|
31
|
+
private emit;
|
|
32
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { string_language } from './typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for speech-to-text recognition
|
|
4
|
+
*
|
|
5
|
+
* @🚉 fully serializable as JSON
|
|
6
|
+
*/
|
|
7
|
+
export type SpeechRecognition = {
|
|
8
|
+
/**
|
|
9
|
+
* Start the speech recognition
|
|
10
|
+
*/
|
|
11
|
+
$start(options: SpeechRecognitionStartOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* Stop the speech recognition
|
|
14
|
+
*/
|
|
15
|
+
$stop(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Current state of the speech recognition
|
|
18
|
+
*/
|
|
19
|
+
readonly state: SpeechRecognitionState;
|
|
20
|
+
/**
|
|
21
|
+
* Subscribe to speech recognition events
|
|
22
|
+
*/
|
|
23
|
+
subscribe(callback: (event: SpeechRecognitionEvent) => void): () => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Options for starting speech recognition
|
|
27
|
+
*/
|
|
28
|
+
export type SpeechRecognitionStartOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* Language for speech recognition
|
|
31
|
+
* @default 'en-US'
|
|
32
|
+
*/
|
|
33
|
+
readonly language?: string_language;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to return interim results
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
readonly interimResults?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Current state of the speech recognition
|
|
42
|
+
*/
|
|
43
|
+
export type SpeechRecognitionState = 'IDLE' | 'STARTING' | 'RECORDING' | 'TRANSCRIBING' | 'ERROR';
|
|
44
|
+
/**
|
|
45
|
+
* Event emitted by speech recognition
|
|
46
|
+
*/
|
|
47
|
+
export type SpeechRecognitionEvent = {
|
|
48
|
+
readonly type: 'START';
|
|
49
|
+
} | {
|
|
50
|
+
readonly type: 'RESULT';
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly isFinal: boolean;
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: 'ERROR';
|
|
55
|
+
readonly message: string;
|
|
56
|
+
} | {
|
|
57
|
+
readonly type: 'STOP';
|
|
58
|
+
};
|
|
@@ -668,6 +668,10 @@ export type string_license_token = string_token;
|
|
|
668
668
|
export type string_password = string;
|
|
669
669
|
export type string_ssh_key = string;
|
|
670
670
|
export type string_pgp_key = string;
|
|
671
|
+
/**
|
|
672
|
+
* Language as a string, e.g. 'en-US', 'cs-CZ', 'en'
|
|
673
|
+
*/
|
|
674
|
+
export type string_language = string;
|
|
671
675
|
/**
|
|
672
676
|
* Semantic helper for `Date.toISOString()` result
|
|
673
677
|
*
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.105.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.105.0-4`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/documents",
|
|
3
|
-
"version": "0.105.0-
|
|
3
|
+
"version": "0.105.0-5",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/documents.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.105.0-
|
|
98
|
+
"@promptbook/core": "0.105.0-5"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|