@promptbook/anthropic-claude 0.72.0-9 → 0.73.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.
- package/README.md +40 -254
- package/esm/index.es.js +13 -5
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +24 -18
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +18 -12
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +2 -2
- package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
- package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -5
- package/esm/typings/src/config.d.ts +22 -15
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -2
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +12 -0
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +11 -0
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +11 -0
- package/esm/typings/src/executables/locateApp.d.ts +33 -0
- package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +12 -0
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +12 -0
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +12 -0
- package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
- package/esm/typings/src/execution/Executables.d.ts +18 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +9 -3
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -2
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -2
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +29 -6
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -11
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +4 -13
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +9 -14
- package/esm/typings/src/execution/createPipelineExecutor/{getSamplesForTemplate.d.ts → getExamplesForTemplate.d.ts} +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
- package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +4 -4
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +7 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +4 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +0 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +4 -4
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +15 -6
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +4 -4
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +6 -12
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +3 -3
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +9 -14
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -8
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/personas/preparePersona.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -23
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +2 -9
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +2 -2
- package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +1 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.test.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +6 -3
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.test.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
- package/esm/typings/src/types/Arrayable.d.ts +1 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +7 -0
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +4 -4
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
- package/esm/typings/src/types/Prompt.d.ts +2 -1
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +11 -8
- package/esm/typings/src/utils/$Register.d.ts +1 -1
- package/esm/typings/src/utils/FromtoItems.d.ts +1 -1
- package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
- package/esm/typings/src/utils/emojis.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +4 -2
- package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +12 -0
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -0
- package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +45 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
- package/esm/typings/src/utils/normalization/IKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +2 -2
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +2 -2
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/sets/intersection.d.ts +1 -1
- package/esm/typings/src/utils/sets/union.d.ts +1 -1
- package/esm/typings/src/utils/unwrapResult.d.ts +4 -4
- package/package.json +6 -4
- package/umd/index.umd.js +13 -5
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
- package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +0 -12
- package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +0 -23
- package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +0 -10
- /package/esm/typings/src/{scrapers/website/WebsiteScraper.test.d.ts → executables/apps/locateLibreoffice.test.d.ts} +0 -0
- /package/esm/typings/src/{scrapers/website/utils/markdownConverter.test.d.ts → executables/apps/locatePandoc.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#  Promptbook
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Build responsible, controlled and transparent applications on top of LLM models!
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -18,12 +18,10 @@ Supercharge your use of large language 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
|
-
<blockquote style="color: #ff8811">
|
|
24
|
-
<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>.
|
|
25
|
-
</blockquote>
|
|
26
|
-
|
|
27
25
|
|
|
28
26
|
|
|
29
27
|
## 📦 Package `@promptbook/anthropic-claude`
|
|
@@ -64,10 +62,11 @@ const llm = new AnthropicClaudeExecutionTools(
|
|
|
64
62
|
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
|
|
65
63
|
},
|
|
66
64
|
);
|
|
65
|
+
const executables = await $provideExecutablesForNode();
|
|
67
66
|
const tools = {
|
|
68
67
|
llm,
|
|
69
68
|
fs,
|
|
70
|
-
scrapers: await $provideScrapersForNode({ fs, llm }),
|
|
69
|
+
scrapers: await $provideScrapersForNode({ fs, llm, executables }),
|
|
71
70
|
script: [new JavascriptExecutionTools()],
|
|
72
71
|
};
|
|
73
72
|
|
|
@@ -167,10 +166,11 @@ const llm = [
|
|
|
167
166
|
},
|
|
168
167
|
),
|
|
169
168
|
];
|
|
169
|
+
const executables = await $provideExecutablesForNode();
|
|
170
170
|
const tools = {
|
|
171
171
|
llm,
|
|
172
172
|
fs,
|
|
173
|
-
scrapers: await $provideScrapersForNode({ fs, llm }),
|
|
173
|
+
scrapers: await $provideScrapersForNode({ fs, llm, executables }),
|
|
174
174
|
script: [new JavascriptExecutionTools()],
|
|
175
175
|
};
|
|
176
176
|
|
|
@@ -213,260 +213,48 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
213
213
|
|
|
214
214
|
## 🤍 The Promptbook Whitepaper
|
|
215
215
|
|
|
216
|
+
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.
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, 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.
|
|
219
|
-
|
|
220
|
-
But often you will struggle with the limitations of LLMs, such as hallucinations, off-topic responses, poor quality output, language 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:
|
|
218
|
+
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:
|
|
221
219
|
|
|
222
220
|
1. **Fine-tune** the model to your specifications or even train your own.
|
|
223
221
|
2. **Prompt-engineer** the prompt to the best shape you can achieve.
|
|
224
222
|
3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
|
|
225
223
|
|
|
226
|
-
In all of these situations, but especially in 3., the Promptbook
|
|
224
|
+
In all of these situations, but especially in 3., the **✨ Promptbook can make your life waaaaaaaaaay easier**.
|
|
227
225
|
|
|
228
|
-
- [**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.
|
|
229
|
-
-
|
|
230
|
-
- **Forget** about **low-level details** like choosing the right model, tokens, context size, temperature
|
|
231
|
-
-
|
|
226
|
+
- [**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).
|
|
227
|
+
- Book allows you to **focus on the business** logic without having to write code or deal with the technicalities of LLMs.
|
|
228
|
+
- **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.
|
|
229
|
+
- 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.
|
|
232
230
|
- 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.
|
|
233
|
-
-
|
|
234
|
-
- Promptbook is designed to
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
##
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
- Multiple pipelines forms a **collection** which will handle core **know-how of your LLM application**.
|
|
243
|
-
- Theese pipelines are designed such as they **can be written by non-programmers**.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
### Sample:
|
|
248
|
-
|
|
249
|
-
File `write-website-content.ptbk.md`:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
> # 🌍 Create website content
|
|
256
|
-
>
|
|
257
|
-
> Instructions for creating web page content.
|
|
258
|
-
>
|
|
259
|
-
> - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
|
|
260
|
-
> - INPUT PARAM `{rawTitle}` Automatically suggested a site name or empty text
|
|
261
|
-
> - INPUT PARAM `{rawAssigment}` Automatically generated site entry from image recognition
|
|
262
|
-
> - OUTPUT PARAM `{websiteContent}` Web content
|
|
263
|
-
> - OUTPUT PARAM `{keywords}` Keywords
|
|
264
|
-
>
|
|
265
|
-
> ## 👤 Specifying the assigment
|
|
266
|
-
>
|
|
267
|
-
> What is your web about?
|
|
268
|
-
>
|
|
269
|
-
> - DIALOG TEMPLATE
|
|
270
|
-
>
|
|
271
|
-
> ```
|
|
272
|
-
> {rawAssigment}
|
|
273
|
-
> ```
|
|
274
|
-
>
|
|
275
|
-
> `-> {assigment}` Website assignment and specification
|
|
276
|
-
>
|
|
277
|
-
> ## ✨ Improving the title
|
|
278
|
-
>
|
|
279
|
-
> - PERSONA Jane, Copywriter and Marketing Specialist.
|
|
280
|
-
>
|
|
281
|
-
> ```
|
|
282
|
-
> As an experienced marketing specialist, you have been entrusted with improving the name of your client's business.
|
|
283
|
-
>
|
|
284
|
-
> A suggested name from a client:
|
|
285
|
-
> "{rawTitle}"
|
|
286
|
-
>
|
|
287
|
-
> Assignment from customer:
|
|
288
|
-
>
|
|
289
|
-
> > {assigment}
|
|
290
|
-
>
|
|
291
|
-
> ## Instructions:
|
|
292
|
-
>
|
|
293
|
-
> - Write only one name suggestion
|
|
294
|
-
> - The name will be used on the website, business cards, visuals, etc.
|
|
295
|
-
> ```
|
|
296
|
-
>
|
|
297
|
-
> `-> {enhancedTitle}` Enhanced title
|
|
298
|
-
>
|
|
299
|
-
> ## 👤 Website title approval
|
|
300
|
-
>
|
|
301
|
-
> Is the title for your website okay?
|
|
302
|
-
>
|
|
303
|
-
> - DIALOG TEMPLATE
|
|
304
|
-
>
|
|
305
|
-
> ```
|
|
306
|
-
> {enhancedTitle}
|
|
307
|
-
> ```
|
|
308
|
-
>
|
|
309
|
-
> `-> {title}` Title for the website
|
|
310
|
-
>
|
|
311
|
-
> ## 🐰 Cunning subtitle
|
|
312
|
-
>
|
|
313
|
-
> - PERSONA Josh, a copywriter, tasked with creating a claim for the website.
|
|
314
|
-
>
|
|
315
|
-
> ```
|
|
316
|
-
> As an experienced copywriter, you have been entrusted with creating a claim for the "{title}" web page.
|
|
317
|
-
>
|
|
318
|
-
> A website assignment from a customer:
|
|
319
|
-
>
|
|
320
|
-
> > {assigment}
|
|
321
|
-
>
|
|
322
|
-
> ## Instructions:
|
|
323
|
-
>
|
|
324
|
-
> - Write only one name suggestion
|
|
325
|
-
> - Claim will be used on website, business cards, visuals, etc.
|
|
326
|
-
> - Claim should be punchy, funny, original
|
|
327
|
-
> ```
|
|
328
|
-
>
|
|
329
|
-
> `-> {claim}` Claim for the web
|
|
330
|
-
>
|
|
331
|
-
> ## 🚦 Keyword analysis
|
|
332
|
-
>
|
|
333
|
-
> - PERSONA Paul, extremely creative SEO specialist.
|
|
334
|
-
>
|
|
335
|
-
> ```
|
|
336
|
-
> As an experienced SEO specialist, you have been entrusted with creating keywords for the website "{title}".
|
|
337
|
-
>
|
|
338
|
-
> Website assignment from the customer:
|
|
339
|
-
>
|
|
340
|
-
> > {assigment}
|
|
341
|
-
>
|
|
342
|
-
> ## Instructions:
|
|
343
|
-
>
|
|
344
|
-
> - Write a list of keywords
|
|
345
|
-
> - Keywords are in basic form
|
|
346
|
-
>
|
|
347
|
-
> ## Example:
|
|
348
|
-
>
|
|
349
|
-
> - Ice cream
|
|
350
|
-
> - Olomouc
|
|
351
|
-
> - Quality
|
|
352
|
-
> - Family
|
|
353
|
-
> - Tradition
|
|
354
|
-
> - Italy
|
|
355
|
-
> - Craft
|
|
356
|
-
>
|
|
357
|
-
> ```
|
|
358
|
-
>
|
|
359
|
-
> `-> {keywords}` Keywords
|
|
360
|
-
>
|
|
361
|
-
> ## 🔗 Combine the beginning
|
|
362
|
-
>
|
|
363
|
-
> - SIMPLE TEMPLATE
|
|
364
|
-
>
|
|
365
|
-
> ```
|
|
366
|
-
>
|
|
367
|
-
> # {title}
|
|
368
|
-
>
|
|
369
|
-
> > {claim}
|
|
370
|
-
>
|
|
371
|
-
> ```
|
|
372
|
-
>
|
|
373
|
-
> `-> {contentBeginning}` Beginning of web content
|
|
374
|
-
>
|
|
375
|
-
> ## 🖋 Write the content
|
|
376
|
-
>
|
|
377
|
-
> - PERSONA Jane
|
|
378
|
-
>
|
|
379
|
-
> ```
|
|
380
|
-
> As an experienced copywriter and web designer, you have been entrusted with creating text for a new website {title}.
|
|
381
|
-
>
|
|
382
|
-
> A website assignment from a customer:
|
|
383
|
-
>
|
|
384
|
-
> > {assigment}
|
|
385
|
-
>
|
|
386
|
-
> ## Instructions:
|
|
387
|
-
>
|
|
388
|
-
> - Text formatting is in Markdown
|
|
389
|
-
> - Be concise and to the point
|
|
390
|
-
> - Use keywords, but they should be naturally in the text
|
|
391
|
-
> - This is the complete content of the page, so don't forget all the important information and elements the page should contain
|
|
392
|
-
> - Use headings, bullets, text formatting
|
|
393
|
-
>
|
|
394
|
-
> ## Keywords:
|
|
395
|
-
>
|
|
396
|
-
> {keywords}
|
|
397
|
-
>
|
|
398
|
-
> ## Web Content:
|
|
399
|
-
>
|
|
400
|
-
> {contentBeginning}
|
|
401
|
-
> ```
|
|
402
|
-
>
|
|
403
|
-
> `-> {contentBody}` Middle of the web content
|
|
404
|
-
>
|
|
405
|
-
> ## 🔗 Combine the content
|
|
406
|
-
>
|
|
407
|
-
> - SIMPLE TEMPLATE
|
|
408
|
-
>
|
|
409
|
-
> ```markdown
|
|
410
|
-
> {contentBeginning}
|
|
411
|
-
>
|
|
412
|
-
> {contentBody}
|
|
413
|
-
> ```
|
|
414
|
-
>
|
|
415
|
-
> `-> {websiteContent}`
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
Following is the scheme how the promptbook above is executed:
|
|
420
|
-
|
|
421
|
-
```mermaid
|
|
422
|
-
%% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
|
|
423
|
-
|
|
424
|
-
flowchart LR
|
|
425
|
-
subgraph "🌍 Create website content"
|
|
426
|
-
|
|
427
|
-
direction TB
|
|
428
|
-
|
|
429
|
-
input((Input)):::input
|
|
430
|
-
templateSpecifyingTheAssigment(👤 Specifying the assigment)
|
|
431
|
-
input--"{rawAssigment}"-->templateSpecifyingTheAssigment
|
|
432
|
-
templateImprovingTheTitle(✨ Improving the title)
|
|
433
|
-
input--"{rawTitle}"-->templateImprovingTheTitle
|
|
434
|
-
templateSpecifyingTheAssigment--"{assigment}"-->templateImprovingTheTitle
|
|
435
|
-
templateWebsiteTitleApproval(👤 Website title approval)
|
|
436
|
-
templateImprovingTheTitle--"{enhancedTitle}"-->templateWebsiteTitleApproval
|
|
437
|
-
templateCunningSubtitle(🐰 Cunning subtitle)
|
|
438
|
-
templateWebsiteTitleApproval--"{title}"-->templateCunningSubtitle
|
|
439
|
-
templateSpecifyingTheAssigment--"{assigment}"-->templateCunningSubtitle
|
|
440
|
-
templateKeywordAnalysis(🚦 Keyword analysis)
|
|
441
|
-
templateWebsiteTitleApproval--"{title}"-->templateKeywordAnalysis
|
|
442
|
-
templateSpecifyingTheAssigment--"{assigment}"-->templateKeywordAnalysis
|
|
443
|
-
templateCombineTheBeginning(🔗 Combine the beginning)
|
|
444
|
-
templateWebsiteTitleApproval--"{title}"-->templateCombineTheBeginning
|
|
445
|
-
templateCunningSubtitle--"{claim}"-->templateCombineTheBeginning
|
|
446
|
-
templateWriteTheContent(🖋 Write the content)
|
|
447
|
-
templateWebsiteTitleApproval--"{title}"-->templateWriteTheContent
|
|
448
|
-
templateSpecifyingTheAssigment--"{assigment}"-->templateWriteTheContent
|
|
449
|
-
templateKeywordAnalysis--"{keywords}"-->templateWriteTheContent
|
|
450
|
-
templateCombineTheBeginning--"{contentBeginning}"-->templateWriteTheContent
|
|
451
|
-
templateCombineTheContent(🔗 Combine the content)
|
|
452
|
-
templateCombineTheBeginning--"{contentBeginning}"-->templateCombineTheContent
|
|
453
|
-
templateWriteTheContent--"{contentBody}"-->templateCombineTheContent
|
|
454
|
-
|
|
455
|
-
templateCombineTheContent--"{websiteContent}"-->output
|
|
456
|
-
output((Output)):::output
|
|
457
|
-
|
|
458
|
-
classDef input color: grey;
|
|
459
|
-
classDef output color: grey;
|
|
460
|
-
|
|
461
|
-
end;
|
|
462
|
-
```
|
|
231
|
+
- Versioning is build in. You can test multiple **A/B versions** of pipelines and see which one works best.
|
|
232
|
+
- 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.
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
## 💙 Book language _(for prompt-engineer)_
|
|
237
|
+
|
|
238
|
+
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.
|
|
463
239
|
|
|
464
|
-
- [More template samples](./samples/pipelines/)
|
|
465
|
-
- [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)
|
|
466
240
|
|
|
467
|
-
_Note: We are using [postprocessing functions](#postprocessing-functions) like `unwrapResult` that can be used to postprocess the result._
|
|
468
241
|
|
|
469
|
-
|
|
242
|
+
```markdown
|
|
243
|
+
# 🌟 My first Book
|
|
244
|
+
|
|
245
|
+
- PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
|
|
246
|
+
- KNOWLEDGE https://ptbk.io
|
|
247
|
+
- KNOWLEDGE ./promptbook.pdf
|
|
248
|
+
- EXPECT MIN 1 Sentence
|
|
249
|
+
- EXPECT MAX 1 Paragraph
|
|
250
|
+
|
|
251
|
+
> 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.
|
|
252
|
+
> Look specifically at the impact of Promptbook on the AI industry.
|
|
253
|
+
|
|
254
|
+
-> {article}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## 📦 Packages _(for developers)_
|
|
470
258
|
|
|
471
259
|
This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
472
260
|
You can install all of them at once:
|
|
@@ -508,8 +296,6 @@ Or you can install them separately:
|
|
|
508
296
|
|
|
509
297
|
The following glossary is used to clarify certain concepts:
|
|
510
298
|
|
|
511
|
-
|
|
512
|
-
|
|
513
299
|
### Core concepts
|
|
514
300
|
|
|
515
301
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
|
@@ -540,8 +326,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
540
326
|
|
|
541
327
|
## 🔌 Usage in Typescript / Javascript
|
|
542
328
|
|
|
543
|
-
- [Simple usage](./
|
|
544
|
-
- [Usage with client and remote server](./
|
|
329
|
+
- [Simple usage](./examples/usage/simple-script)
|
|
330
|
+
- [Usage with client and remote server](./examples/usage/remote)
|
|
545
331
|
|
|
546
332
|
## ➕➖ When to use Promptbook?
|
|
547
333
|
|
package/esm/index.es.js
CHANGED
|
@@ -7,7 +7,7 @@ import { io } from 'socket.io-client';
|
|
|
7
7
|
/**
|
|
8
8
|
* The version of the Promptbook library
|
|
9
9
|
*/
|
|
10
|
-
var PROMPTBOOK_VERSION = '0.72.0
|
|
10
|
+
var PROMPTBOOK_VERSION = '0.72.0';
|
|
11
11
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
12
12
|
|
|
13
13
|
/*! *****************************************************************************
|
|
@@ -442,6 +442,7 @@ var LOOP_LIMIT = 1000;
|
|
|
442
442
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
443
443
|
*/
|
|
444
444
|
var CONNECTION_TIMEOUT_MS = 7 * 1000;
|
|
445
|
+
// <- TODO: [⏳] Standartize timeouts, Make DEFAULT_TIMEOUT_MS as global constant
|
|
445
446
|
/**
|
|
446
447
|
* How many times to retry the connections
|
|
447
448
|
*
|
|
@@ -463,10 +464,10 @@ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
|
|
|
463
464
|
'content',
|
|
464
465
|
'context',
|
|
465
466
|
'knowledge',
|
|
466
|
-
'
|
|
467
|
+
'examples',
|
|
467
468
|
'modelName',
|
|
468
469
|
'currentDate',
|
|
469
|
-
// <- TODO:
|
|
470
|
+
// <- TODO: list here all command names
|
|
470
471
|
// <- TODO: Add more like 'date', 'modelName',...
|
|
471
472
|
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
472
473
|
]);
|
|
@@ -1448,6 +1449,7 @@ function deserializeError(error) {
|
|
|
1448
1449
|
* @public exported from `@promptbook/remote-client`
|
|
1449
1450
|
*/
|
|
1450
1451
|
var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
1452
|
+
/* <- TODO: [🍚] `, Destroyable` */
|
|
1451
1453
|
function RemoteLlmExecutionTools(options) {
|
|
1452
1454
|
this.options = options;
|
|
1453
1455
|
}
|
|
@@ -1497,12 +1499,16 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1497
1499
|
if (this.options.isAnonymous) {
|
|
1498
1500
|
socket.emit('listModels-request', {
|
|
1499
1501
|
isAnonymous: true,
|
|
1502
|
+
userId: this.options.userId,
|
|
1500
1503
|
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
1501
1504
|
} /* <- TODO: [🤛] */);
|
|
1502
1505
|
}
|
|
1503
1506
|
else {
|
|
1504
1507
|
socket.emit('listModels-request', {
|
|
1505
1508
|
isAnonymous: false,
|
|
1509
|
+
appId: this.options.appId,
|
|
1510
|
+
userId: this.options.userId,
|
|
1511
|
+
customOptions: this.options.customOptions,
|
|
1506
1512
|
} /* <- TODO: [🤛] */);
|
|
1507
1513
|
}
|
|
1508
1514
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
@@ -1596,7 +1602,9 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1596
1602
|
else {
|
|
1597
1603
|
socket.emit('prompt-request', {
|
|
1598
1604
|
isAnonymous: false,
|
|
1605
|
+
appId: this.options.appId,
|
|
1599
1606
|
userId: this.options.userId,
|
|
1607
|
+
customOptions: this.options.customOptions,
|
|
1600
1608
|
prompt: prompt,
|
|
1601
1609
|
} /* <- TODO: [🤛] */);
|
|
1602
1610
|
}
|
|
@@ -1636,7 +1644,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
1636
1644
|
*/
|
|
1637
1645
|
var createAnthropicClaudeExecutionTools = Object.assign(function (options) {
|
|
1638
1646
|
if (options.isProxied) {
|
|
1639
|
-
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { isAnonymous: true, llmToolsConfiguration: [
|
|
1647
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { userId: null, isAnonymous: true, llmToolsConfiguration: [
|
|
1640
1648
|
{
|
|
1641
1649
|
title: 'Anthropic Claude (proxied)',
|
|
1642
1650
|
packageName: '@promptbook/anthropic-claude',
|
|
@@ -1769,7 +1777,7 @@ var $Register = /** @class */ (function () {
|
|
|
1769
1777
|
this.storage = globalScope[storageName];
|
|
1770
1778
|
}
|
|
1771
1779
|
$Register.prototype.list = function () {
|
|
1772
|
-
// <- TODO: ReadonlyDeep<
|
|
1780
|
+
// <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
|
|
1773
1781
|
return this.storage;
|
|
1774
1782
|
};
|
|
1775
1783
|
$Register.prototype.register = function (registered) {
|