promptbook 0.72.0 → 0.74.0-0

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.
Files changed (2) hide show
  1. package/README.md +84 -241
  2. package/package.json +23 -22
package/README.md CHANGED
@@ -18,6 +18,8 @@ Build responsible, controlled and transparent applications on top of LLM models!
18
18
 
19
19
  ## ✨ New Features
20
20
 
21
+ - 💙 Working on [the **Book** language v1](https://github.com/webgptorg/book)
22
+ - 📚 Support of `.docx`, `.doc` and `.pdf` documents
21
23
  - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
22
24
 
23
25
 
@@ -30,7 +32,7 @@ Build responsible, controlled and transparent applications on top of LLM models!
30
32
 
31
33
  If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 3, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
32
34
 
33
- But often you will struggle with the **limitations of LLMs**, such as **hallucinations, off-topic responses, poor quality output, language and prompt drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd responses**. When this happens, you generally have three options:
35
+ But often you will struggle with the **limitations of LLMs**, such as **hallucinations, off-topic responses, poor quality output, language and prompt drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd resp0nses**. When this happens, you generally have three options:
34
36
 
35
37
  1. **Fine-tune** the model to your specifications or even train your own.
36
38
  2. **Prompt-engineer** the prompt to the best shape you can achieve.
@@ -38,248 +40,87 @@ But often you will struggle with the **limitations of LLMs**, such as **hallucin
38
40
 
39
41
  In all of these situations, but especially in 3., the **✨ Promptbook can make your life waaaaaaaaaay easier**.
40
42
 
41
- - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic.
42
- - Establishes a [**common format `.ptbk.md`**](https://github.com/webgptorg/promptbook/discussions/85) that can be used to describe your prompt business logic without having to write code or deal with the technicalities of LLMs.
43
- - **Forget** about **low-level details** like choosing the right model, tokens, context size, temperature, top-k, top-p, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
44
- - Has built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
43
+ - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic. For this purpose, it introduces a new language called [the **💙 Book**](https://github.com/webgptorg/book).
44
+ - Book allows you to **focus on the business** logic without having to write code or deal with the technicalities of LLMs.
45
+ - **Forget** about **low-level details** like choosing the right model, tokens, context size, `temperature`, `top-k`, `top-p`, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
46
+ - We have built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
45
47
  - Sometimes even the best prompts with the best framework like Promptbook `:)` can't avoid the problems. In this case, the library has built-in **[anomaly detection](https://github.com/webgptorg/promptbook/discussions/40) and logging** to help you find and fix the problems.
46
- - Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
47
- - Promptbook is designed to do [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques. You can use **knowledge** to improve the quality of the output.
48
-
49
-
50
-
51
- ## 🧔 Pipeline _(for prompt-engeneers)_
52
-
53
- **P**romp**t** **b**oo**k** markdown file (or `.ptbk.md` file) is document that describes a **pipeline** - a series of prompts that are chained together to form somewhat reciepe for transforming natural language input.
54
-
55
- - Multiple pipelines forms a **collection** which will handle core **know-how of your LLM application**.
56
- - Theese pipelines are designed such as they **can be written by non-programmers**.
57
-
58
-
59
-
60
- ### Sample:
61
-
62
- File `write-website-content.ptbk.md`:
63
-
64
-
65
-
66
-
67
-
68
- > # 🌍 Create website content
69
- >
70
- > Instructions for creating web page content.
71
- >
72
- > - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
73
- > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
74
- > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
75
- > - OUTPUT PARAM `{websiteContent}` Web content
76
- > - OUTPUT PARAM `{keywords}` Keywords
77
- >
78
- > ## 👤 Specifying the assigment
79
- >
80
- > What is your web about?
81
- >
82
- > - DIALOG TEMPLATE
83
- >
84
- > ```
85
- > {rawAssigment}
86
- > ```
87
- >
88
- > `-> {assigment}` Website assignment and specification
89
- >
90
- > ## ✨ Improving the title
91
- >
92
- > - PERSONA Jane, Copywriter and Marketing Specialist.
93
- >
94
- > ```
95
- > As an experienced marketing specialist, you have been entrusted with improving the name of your client's business.
96
- >
97
- > A suggested name from a client:
98
- > "{rawTitle}"
99
- >
100
- > Assignment from customer:
101
- >
102
- > > {assigment}
103
- >
104
- > ## Instructions:
105
- >
106
- > - Write only one name suggestion
107
- > - The name will be used on the website, business cards, visuals, etc.
108
- > ```
109
- >
110
- > `-> {enhancedTitle}` Enhanced title
111
- >
112
- > ## 👤 Website title approval
113
- >
114
- > Is the title for your website okay?
115
- >
116
- > - DIALOG TEMPLATE
117
- >
118
- > ```
119
- > {enhancedTitle}
120
- > ```
121
- >
122
- > `-> {title}` Title for the website
123
- >
124
- > ## 🐰 Cunning subtitle
125
- >
126
- > - PERSONA Josh, a copywriter, tasked with creating a claim for the website.
127
- >
128
- > ```
129
- > As an experienced copywriter, you have been entrusted with creating a claim for the "{title}" web page.
130
- >
131
- > A website assignment from a customer:
132
- >
133
- > > {assigment}
134
- >
135
- > ## Instructions:
136
- >
137
- > - Write only one name suggestion
138
- > - Claim will be used on website, business cards, visuals, etc.
139
- > - Claim should be punchy, funny, original
140
- > ```
141
- >
142
- > `-> {claim}` Claim for the web
143
- >
144
- > ## 🚦 Keyword analysis
145
- >
146
- > - PERSONA Paul, extremely creative SEO specialist.
147
- >
148
- > ```
149
- > As an experienced SEO specialist, you have been entrusted with creating keywords for the website "{title}".
150
- >
151
- > Website assignment from the customer:
152
- >
153
- > > {assigment}
154
- >
155
- > ## Instructions:
156
- >
157
- > - Write a list of keywords
158
- > - Keywords are in basic form
159
- >
160
- > ## Example:
161
- >
162
- > - Ice cream
163
- > - Olomouc
164
- > - Quality
165
- > - Family
166
- > - Tradition
167
- > - Italy
168
- > - Craft
169
- >
170
- > ```
171
- >
172
- > `-> {keywords}` Keywords
173
- >
174
- > ## 🔗 Combine the beginning
175
- >
176
- > - SIMPLE TEMPLATE
177
- >
178
- > ```
179
- >
180
- > # {title}
181
- >
182
- > > {claim}
183
- >
184
- > ```
185
- >
186
- > `-> {contentBeginning}` Beginning of web content
187
- >
188
- > ## 🖋 Write the content
189
- >
190
- > - PERSONA Jane
191
- >
192
- > ```
193
- > As an experienced copywriter and web designer, you have been entrusted with creating text for a new website {title}.
194
- >
195
- > A website assignment from a customer:
196
- >
197
- > > {assigment}
198
- >
199
- > ## Instructions:
200
- >
201
- > - Text formatting is in Markdown
202
- > - Be concise and to the point
203
- > - Use keywords, but they should be naturally in the text
204
- > - This is the complete content of the page, so don't forget all the important information and elements the page should contain
205
- > - Use headings, bullets, text formatting
206
- >
207
- > ## Keywords:
208
- >
209
- > {keywords}
210
- >
211
- > ## Web Content:
212
- >
213
- > {contentBeginning}
214
- > ```
215
- >
216
- > `-> {contentBody}` Middle of the web content
217
- >
218
- > ## 🔗 Combine the content
219
- >
220
- > - SIMPLE TEMPLATE
221
- >
222
- > ```markdown
223
- > {contentBeginning}
224
- >
225
- > {contentBody}
226
- > ```
227
- >
228
- > `-> {websiteContent}`
229
-
230
-
231
-
232
- Following is the scheme how the promptbook above is executed:
233
-
234
- ```mermaid
235
- %% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
236
-
237
- flowchart LR
238
- subgraph "🌍 Create website content"
239
-
240
- direction TB
241
-
242
- input((Input)):::input
243
- templateSpecifyingTheAssigment(👤 Specifying the assigment)
244
- input--"{rawAssigment}"-->templateSpecifyingTheAssigment
245
- templateImprovingTheTitle(✨ Improving the title)
246
- input--"{rawTitle}"-->templateImprovingTheTitle
247
- templateSpecifyingTheAssigment--"{assigment}"-->templateImprovingTheTitle
248
- templateWebsiteTitleApproval(👤 Website title approval)
249
- templateImprovingTheTitle--"{enhancedTitle}"-->templateWebsiteTitleApproval
250
- templateCunningSubtitle(🐰 Cunning subtitle)
251
- templateWebsiteTitleApproval--"{title}"-->templateCunningSubtitle
252
- templateSpecifyingTheAssigment--"{assigment}"-->templateCunningSubtitle
253
- templateKeywordAnalysis(🚦 Keyword analysis)
254
- templateWebsiteTitleApproval--"{title}"-->templateKeywordAnalysis
255
- templateSpecifyingTheAssigment--"{assigment}"-->templateKeywordAnalysis
256
- templateCombineTheBeginning(🔗 Combine the beginning)
257
- templateWebsiteTitleApproval--"{title}"-->templateCombineTheBeginning
258
- templateCunningSubtitle--"{claim}"-->templateCombineTheBeginning
259
- templateWriteTheContent(🖋 Write the content)
260
- templateWebsiteTitleApproval--"{title}"-->templateWriteTheContent
261
- templateSpecifyingTheAssigment--"{assigment}"-->templateWriteTheContent
262
- templateKeywordAnalysis--"{keywords}"-->templateWriteTheContent
263
- templateCombineTheBeginning--"{contentBeginning}"-->templateWriteTheContent
264
- templateCombineTheContent(🔗 Combine the content)
265
- templateCombineTheBeginning--"{contentBeginning}"-->templateCombineTheContent
266
- templateWriteTheContent--"{contentBody}"-->templateCombineTheContent
267
-
268
- templateCombineTheContent--"{websiteContent}"-->output
269
- output((Output)):::output
270
-
271
- classDef input color: grey;
272
- classDef output color: grey;
273
-
274
- end;
275
- ```
48
+ - Versioning is build in. You can test multiple **A/B versions** of pipelines and see which one works best.
49
+ - Promptbook is designed to use [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques to bring the context of your business to generic LLM. You can use **knowledge** to improve the quality of the output.
50
+
51
+
52
+
53
+ ## 💜 The Promptbook Project
54
+
55
+
56
+
57
+ <table>
58
+ <tbody>
59
+ <tr>
60
+ <td>Promptbook whitepaper</td>
61
+ <td>Basic motivations and problems which we are trying to solve</td>
62
+ <td rowspan=3>https://github.com/webgptorg/book</td>
63
+ </tr>
64
+ <tr>
65
+ <td>Promptbook <i>(system)</i></td>
66
+ <td>Promptbook ...</td>
67
+ </tr>
68
+ <tr>
69
+ <td>Book language</td>
70
+ <td>
71
+ Book is a markdown-like language to define projects, pipelines, knowledge,... in the Promptbook system. It is designed to be understandable by non-programmers and non-technical people
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <td>Promptbook typescript project</td>
76
+ <td>Implementation of Promptbook in TypeScript published into multiple packages to NPM</td>
77
+ <td>https://github.com/webgptorg/promptbook</td>
78
+ </tr>
79
+ <tr>
80
+ <td>Promptbook studio</td>
81
+ <td>Promptbook studio</td>
82
+ <td rowspan=2>https://github.com/hejny/promptbook-studio</td>
83
+ </tr>
84
+ <tr>
85
+ <td>Promptbook miniapps</td>
86
+ <td>Promptbook miniapps</td>
87
+ </tr>
88
+ </tbody>
89
+ </table>
90
+
91
+ ## 💙 Book language _(for prompt-engineer)_
92
+
93
+ Promptbook [pipelines](https://github.com/webgptorg/promptbook/discussions/64) are written in markdown-like language called [Book](https://github.com/webgptorg/book). It is designed to be understandable by non-programmers and non-technical people.
94
+
276
95
 
277
- - [More template samples](./samples/pipelines/)
278
- - [Read more about `.ptbk.md` file format here](https://github.com/webgptorg/promptbook/discussions/categories/concepts?discussions_q=is%3Aopen+label%3A.ptbk.md+category%3AConcepts)
279
96
 
280
- _Note: We are using [postprocessing functions](#postprocessing-functions) like `unwrapResult` that can be used to postprocess the result._
97
+ ```markdown
98
+ # 🌟 My first Book
281
99
 
282
- ## 📦 Packages
100
+ - INPUT PARAMETER {subject}
101
+ - OUTPUT PARAMETER {article}
102
+
103
+ ## Sample subject
104
+
105
+ > Promptbook
106
+
107
+ -> {subject}
108
+
109
+ ## Write an article
110
+
111
+ - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
112
+ - KNOWLEDGE https://ptbk.io
113
+ - KNOWLEDGE ./promptbook.pdf
114
+ - EXPECT MIN 1 Sentence
115
+ - EXPECT MAX 1 Paragraph
116
+
117
+ > Write an article about the future of artificial intelligence in the next 10 years and how metalanguages will change the way AI is used in the world.
118
+ > Look specifically at the impact of {subject} on the AI industry.
119
+
120
+ -> {article}
121
+ ```
122
+
123
+ ## 📦 Packages _(for developers)_
283
124
 
284
125
  This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
285
126
  You can install all of them at once:
@@ -321,6 +162,8 @@ Or you can install them separately:
321
162
 
322
163
  The following glossary is used to clarify certain concepts:
323
164
 
165
+ ### Basic terms
166
+
324
167
 
325
168
 
326
169
  ### Core concepts
@@ -353,8 +196,8 @@ The following glossary is used to clarify certain concepts:
353
196
 
354
197
  ## 🔌 Usage in Typescript / Javascript
355
198
 
356
- - [Simple usage](./samples/usage/simple-script)
357
- - [Usage with client and remote server](./samples/usage/remote)
199
+ - [Simple usage](./examples/usage/simple-script)
200
+ - [Usage with client and remote server](./examples/usage/remote)
358
201
 
359
202
  ## ➕➖ When to use Promptbook?
360
203
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptbook",
3
- "version": "0.72.0",
3
+ "version": "0.74.0-0",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -31,7 +31,8 @@
31
31
  "o1",
32
32
  "o1-mini",
33
33
  "o1-preview",
34
- "anthropic"
34
+ "anthropic",
35
+ "LLMOps"
35
36
  ],
36
37
  "license": "CC-BY-4.0",
37
38
  "bugs": {
@@ -49,27 +50,27 @@
49
50
  }
50
51
  ],
51
52
  "peerDependencies": {
52
- "@promptbook/core": "0.72.0"
53
+ "@promptbook/core": "0.74.0-0"
53
54
  },
54
55
  "dependencies": {
55
- "@promptbook/anthropic-claude": "0.72.0",
56
- "@promptbook/azure-openai": "0.72.0",
57
- "@promptbook/browser": "0.72.0",
58
- "@promptbook/cli": "0.72.0",
59
- "@promptbook/core": "0.72.0",
60
- "@promptbook/documents": "0.72.0",
61
- "@promptbook/execute-javascript": "0.72.0",
62
- "@promptbook/fake-llm": "0.72.0",
63
- "@promptbook/langtail": "0.72.0",
64
- "@promptbook/legacy-documents": "0.72.0",
65
- "@promptbook/markdown-utils": "0.72.0",
66
- "@promptbook/node": "0.72.0",
67
- "@promptbook/openai": "0.72.0",
68
- "@promptbook/pdf": "0.72.0",
69
- "@promptbook/remote-client": "0.72.0",
70
- "@promptbook/remote-server": "0.72.0",
71
- "@promptbook/types": "0.72.0",
72
- "@promptbook/utils": "0.72.0",
73
- "@promptbook/website-crawler": "0.72.0"
56
+ "@promptbook/anthropic-claude": "0.74.0-0",
57
+ "@promptbook/azure-openai": "0.74.0-0",
58
+ "@promptbook/browser": "0.74.0-0",
59
+ "@promptbook/cli": "0.74.0-0",
60
+ "@promptbook/core": "0.74.0-0",
61
+ "@promptbook/documents": "0.74.0-0",
62
+ "@promptbook/execute-javascript": "0.74.0-0",
63
+ "@promptbook/fake-llm": "0.74.0-0",
64
+ "@promptbook/langtail": "0.74.0-0",
65
+ "@promptbook/legacy-documents": "0.74.0-0",
66
+ "@promptbook/markdown-utils": "0.74.0-0",
67
+ "@promptbook/node": "0.74.0-0",
68
+ "@promptbook/openai": "0.74.0-0",
69
+ "@promptbook/pdf": "0.74.0-0",
70
+ "@promptbook/remote-client": "0.74.0-0",
71
+ "@promptbook/remote-server": "0.74.0-0",
72
+ "@promptbook/types": "0.74.0-0",
73
+ "@promptbook/utils": "0.74.0-0",
74
+ "@promptbook/website-crawler": "0.74.0-0"
74
75
  }
75
76
  }