@promptbook/fake-llm 0.92.0-9 → 0.93.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 +140 -88
- package/esm/index.es.js +54 -50
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +26 -14
- package/esm/typings/src/_packages/types.index.d.ts +6 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -2
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- package/esm/typings/src/config.d.ts +41 -11
- package/esm/typings/src/constants.d.ts +43 -2
- package/esm/typings/src/conversion/parsePipeline.d.ts +2 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
- package/esm/typings/src/errors/CollectionError.d.ts +1 -1
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -1
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +2 -1
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +2 -1
- package/esm/typings/src/executables/locateApp.d.ts +2 -2
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +2 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +1 -1
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
- package/esm/typings/src/execution/ExecutionTask.d.ts +19 -1
- package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +2 -1
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +4 -2
- package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +13 -10
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -3
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +21 -15
- package/esm/typings/src/execution/createPipelineExecutor/computeCosineSimilarity.d.ts +13 -0
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +7 -6
- package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +5 -1
- package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +18 -5
- package/esm/typings/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +9 -0
- package/esm/typings/src/execution/execution-report/ExecutionReportJson.d.ts +1 -1
- package/esm/typings/src/execution/execution-report/ExecutionReportString.d.ts +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +4 -4
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +3 -3
- package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +1 -1
- package/esm/typings/src/formats/_common/{FormatDefinition.d.ts → FormatParser.d.ts} +8 -6
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +66 -0
- package/esm/typings/src/formats/csv/CsvFormatParser.d.ts +17 -0
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +2 -2
- package/esm/typings/src/formats/csv/utils/csvParse.d.ts +12 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
- package/esm/typings/src/formats/index.d.ts +2 -2
- package/esm/typings/src/formats/json/JsonFormatParser.d.ts +19 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
- package/esm/typings/src/formats/json/utils/jsonParse.d.ts +0 -3
- package/esm/typings/src/formats/text/{TextFormatDefinition.d.ts → TextFormatParser.d.ts} +7 -7
- package/esm/typings/src/formats/xml/XmlFormatParser.d.ts +19 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +29 -0
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +2 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/index.d.ts +33 -8
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/high-level-abstractions/index.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +18 -5
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +21 -42
- package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +9 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +13 -4
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +10 -5
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +11 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +6 -0
- 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 +4 -4
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/migrations/migratePipeline.d.ts +9 -0
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +10 -7
- package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +3 -2
- package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTasks.d.ts +8 -5
- package/esm/typings/src/remote-server/openapi.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Response.d.ts +1 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +7 -6
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
- package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +11 -0
- package/esm/typings/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +14 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +8 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -2
- package/esm/typings/src/types/ModelVariant.d.ts +5 -5
- package/esm/typings/src/types/typeAliases.d.ts +22 -19
- package/esm/typings/src/utils/$Register.d.ts +8 -7
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
- package/esm/typings/src/utils/editable/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/index.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
- package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
- package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
- package/esm/typings/src/utils/organization/just.d.ts +1 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
- package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
- package/esm/typings/src/utils/removeQuotes.d.ts +2 -2
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
- package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -1
- package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +1 -1
- package/esm/typings/src/utils/unwrapResult.d.ts +2 -2
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +1 -1
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -1
- package/esm/typings/src/version.d.ts +2 -1
- package/esm/typings/src/wizzard/wizzard.d.ts +1 -1
- package/package.json +15 -3
- package/umd/index.umd.js +54 -50
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +0 -31
- package/esm/typings/src/formats/csv/CsvFormatDefinition.d.ts +0 -17
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -19
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -19
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/MultipleLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/joinLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/playground/playground.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
|
|
2
2
|
|
|
3
|
-
# ✨ Promptbook
|
|
3
|
+
# ✨ Promptbook: AI apps in plain Language
|
|
4
|
+
|
|
5
|
+
Write AI applications using plain human language across multiple models and platforms.
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
|
|
@@ -8,24 +10,20 @@
|
|
|
8
10
|
[ Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
|
|
9
11
|
[ Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
|
|
10
12
|
[](https://snyk.io/test/github/webgptorg/promptbook)
|
|
13
|
+
[](https://github.com/webgptorg/promptbook/actions)
|
|
14
|
+
[](https://coveralls.io/github/webgptorg/promptbook?branch=main)
|
|
11
15
|
[](https://github.com/webgptorg/promptbook/issues)
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
19
|
## 🌟 New Features
|
|
18
20
|
|
|
19
|
-
-
|
|
20
|
-
- 🐳
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
21
|
+
- 💡 VS Code support for `.book` files with syntax highlighting and IntelliSense
|
|
22
|
+
- 🐳 Official Docker image (`hejny/promptbook`) for seamless containerized usage
|
|
23
|
+
- 🔥 Native support for OpenAI `o3-mini`, GPT-4 and other leading LLMs
|
|
24
|
+
- 🔍 DeepSeek integration for advanced knowledge search
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
<blockquote style="color: #ff8811">
|
|
27
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
-
</blockquote>
|
|
29
27
|
|
|
30
28
|
## 📦 Package `@promptbook/fake-llm`
|
|
31
29
|
|
|
@@ -130,65 +128,92 @@ Hello world examples:
|
|
|
130
128
|
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
131
129
|
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
132
130
|
|
|
131
|
+
### 🌐 Community & Social Media
|
|
133
132
|
|
|
133
|
+
Join our growing community of developers and users:
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
135
|
+
<table>
|
|
136
|
+
<thead>
|
|
137
|
+
<tr>
|
|
138
|
+
<th>Platform</th>
|
|
139
|
+
<th>Description</th>
|
|
140
|
+
</tr>
|
|
141
|
+
</thead>
|
|
142
|
+
<tbody>
|
|
143
|
+
<tr>
|
|
144
|
+
<td><a href="https://discord.gg/x3QWNaa89N">💬 Discord</a></td>
|
|
145
|
+
<td>Join our active developer community for discussions and support</td>
|
|
146
|
+
</tr>
|
|
147
|
+
<tr>
|
|
148
|
+
<td><a href="https://github.com/webgptorg/promptbook/discussions">🗣️ GitHub Discussions</a></td>
|
|
149
|
+
<td>Technical discussions, feature requests, and community Q&A</td>
|
|
150
|
+
</tr>
|
|
151
|
+
<tr>
|
|
152
|
+
<td><a href="https://linkedin.com/company/promptbook">👔 LinkedIn</a></td>
|
|
153
|
+
<td>Professional updates and industry insights</td>
|
|
154
|
+
</tr>
|
|
155
|
+
<tr>
|
|
156
|
+
<td><a href="https://www.facebook.com/61560776453536">📱 Facebook</a></td>
|
|
157
|
+
<td>General announcements and community engagement</td>
|
|
158
|
+
</tr>
|
|
159
|
+
<tr>
|
|
160
|
+
<td><a href="https://ptbk.io">🔗 ptbk.io</a></td>
|
|
161
|
+
<td>Official landing page with project information</td>
|
|
162
|
+
</tr>
|
|
163
|
+
</tbody>
|
|
164
|
+
</table>
|
|
154
165
|
|
|
166
|
+
### 🖼️ Product & Brand Channels
|
|
155
167
|
|
|
156
|
-
|
|
157
|
-
- [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
|
|
168
|
+
#### Promptbook.studio
|
|
158
169
|
|
|
159
|
-
|
|
170
|
+
<table>
|
|
171
|
+
<tbody>
|
|
172
|
+
<tr>
|
|
173
|
+
<td><a href="https://www.instagram.com/promptbook.studio/">📸 Instagram @promptbook.studio</a></td>
|
|
174
|
+
<td>Visual updates, UI showcases, and design inspiration</td>
|
|
175
|
+
</tr>
|
|
176
|
+
|
|
177
|
+
</tbody>
|
|
178
|
+
</table>
|
|
160
179
|
|
|
161
|
-
_/Sub-brand for images and graphics generated via Promptbook prompting/_
|
|
162
180
|
|
|
163
|
-
- [Instagram `@promptbook.city`](https://www.instagram.com/promptbook.city/)
|
|
164
|
-
- [Facebook `Promptbook City`](https://www.facebook.com/61565718625569)
|
|
165
181
|
|
|
166
182
|
|
|
167
183
|
|
|
168
184
|
|
|
185
|
+
## 📘 Book Language Blueprint
|
|
169
186
|
|
|
187
|
+
_A concise, Markdown-based DSL for crafting AI workflows and automations._
|
|
170
188
|
|
|
171
|
-
|
|
189
|
+
---
|
|
172
190
|
|
|
191
|
+
### 📑 Table of Contents
|
|
173
192
|
|
|
193
|
+
- [Introduction](#introduction)
|
|
194
|
+
- [Example](#example)
|
|
195
|
+
- [1. What: Workflows, Tasks & Parameters](#1-what-workflows-tasks--parameters)
|
|
196
|
+
- [2. Who: Personas](#2-who-personas)
|
|
197
|
+
- [3. How: Knowledge, Instruments & Actions](#3-how-knowledge-instruments-and-actions)
|
|
198
|
+
- [General Principles](#general-principles)
|
|
174
199
|
|
|
175
|
-
|
|
200
|
+
### Introduction
|
|
176
201
|
|
|
177
|
-
Book is a language that
|
|
202
|
+
Book is a Markdown-based language that simplifies the creation of AI applications, workflows, and automations. With human-readable commands, you can define inputs, outputs, personas, knowledge sources, and actions—without needing model-specific details.
|
|
178
203
|
|
|
179
204
|
### Example
|
|
180
205
|
|
|
181
|
-
```
|
|
182
|
-
# 🌟 My
|
|
206
|
+
```book
|
|
207
|
+
# 🌟 My First Book
|
|
183
208
|
|
|
184
209
|
- BOOK VERSION 1.0.0
|
|
185
210
|
- URL https://promptbook.studio/hello.book
|
|
186
211
|
- INPUT PARAMETER {topic}
|
|
187
212
|
- OUTPUT PARAMETER {article}
|
|
188
213
|
|
|
189
|
-
# Write an
|
|
214
|
+
# Write an Article
|
|
190
215
|
|
|
191
|
-
- PERSONA Jane, marketing specialist with prior experience in
|
|
216
|
+
- PERSONA Jane, marketing specialist with prior experience in tech and AI writing
|
|
192
217
|
- KNOWLEDGE https://wikipedia.org/
|
|
193
218
|
- KNOWLEDGE ./journalist-ethics.pdf
|
|
194
219
|
- EXPECT MIN 1 Sentence
|
|
@@ -196,20 +221,20 @@ Book is a language that can be used to write AI applications, agents, workflows,
|
|
|
196
221
|
|
|
197
222
|
> Write an article about {topic}
|
|
198
223
|
|
|
199
|
-
|
|
224
|
+
→ {article}
|
|
200
225
|
```
|
|
201
226
|
|
|
202
227
|
Each part of the book defines one of 3 circles:
|
|
203
228
|
|
|
204
|
-
### **What:** Workflows, Tasks and Parameters
|
|
229
|
+
### **1. What:** Workflows, Tasks and Parameters
|
|
205
230
|
|
|
206
|
-
What work needs to be done. Each book defines a [workflow
|
|
231
|
+
What work needs to be done. Each book defines a [workflow _(scenario or pipeline)_](https://github.com/webgptorg/promptbook/discussions/88), which is one or more tasks. Each workflow has a fixed input and output. For example, you have a book that generates an article from a topic. Once it generates an article about AI, once about marketing, once about cooking. The workflow (= your AI program) is the same, only the input and output change.
|
|
207
232
|
|
|
208
233
|
**Related commands:**
|
|
209
234
|
|
|
210
235
|
- [PARAMETER](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PARAMETER.md)
|
|
211
236
|
|
|
212
|
-
### **Who:** Personas
|
|
237
|
+
### **2. Who:** Personas
|
|
213
238
|
|
|
214
239
|
Who does the work. Each task is performed by a persona. A persona is a description of your virtual employee. It is a higher abstraction than the model, tokens, temperature, top-k, top-p and other model parameters.
|
|
215
240
|
|
|
@@ -223,7 +248,7 @@ Personas can have access to different knowledge, tools and actions. They can als
|
|
|
223
248
|
|
|
224
249
|
|
|
225
250
|
|
|
226
|
-
### **How:** Knowledge, Instruments and Actions
|
|
251
|
+
### **3. How:** Knowledge, Instruments and Actions
|
|
227
252
|
|
|
228
253
|
The resources used by the personas are used to do the work.
|
|
229
254
|
|
|
@@ -233,7 +258,7 @@ The resources used by the personas are used to do the work.
|
|
|
233
258
|
- [INSTRUMENT](https://github.com/webgptorg/promptbook/blob/main/documents/commands/INSTRUMENT.md) for real-time data like time, location, weather, stock prices, searching the internet, calculations, etc.
|
|
234
259
|
- [ACTION](https://github.com/webgptorg/promptbook/blob/main/documents/commands/ACTION.md) for actions like sending emails, creating files, ending a workflow, etc.
|
|
235
260
|
|
|
236
|
-
### General
|
|
261
|
+
### General Principles
|
|
237
262
|
|
|
238
263
|
Book language is based on markdown. It is subset of markdown. It is designed to be easy to read and write. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
|
|
239
264
|
|
|
@@ -247,6 +272,10 @@ But unlike programming languages, it is designed to be understandable by non-pro
|
|
|
247
272
|
|
|
248
273
|
|
|
249
274
|
|
|
275
|
+
## 📚 Documentation
|
|
276
|
+
|
|
277
|
+
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
278
|
+
|
|
250
279
|
## 🔒 Security
|
|
251
280
|
|
|
252
281
|
For information on reporting security vulnerabilities, see our [Security Policy](./SECURITY.md).
|
|
@@ -290,7 +319,7 @@ Or you can install them separately:
|
|
|
290
319
|
- **[@promptbook/legacy-documents](https://www.npmjs.com/package/@promptbook/legacy-documents)** - Read knowledge from legacy documents like `.doc`, `.rtf`,…
|
|
291
320
|
- **[@promptbook/website-crawler](https://www.npmjs.com/package/@promptbook/website-crawler)** - Crawl knowledge from the web
|
|
292
321
|
- **[@promptbook/editable](https://www.npmjs.com/package/@promptbook/editable)** - Editable book as native javascript object with imperative object API
|
|
293
|
-
- **[@promptbook/templates](https://www.npmjs.com/package/@promptbook/templates)** -
|
|
322
|
+
- **[@promptbook/templates](https://www.npmjs.com/package/@promptbook/templates)** - Useful templates and examples of books which can be used as a starting point
|
|
294
323
|
- **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
|
|
295
324
|
- ⭐ **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
|
|
296
325
|
- 🐋 **[Docker image](https://hub.docker.com/r/hejny/promptbook/)** - Promptbook server
|
|
@@ -327,25 +356,56 @@ _Note: This section is not complete dictionary, more list of general AI / LLM te
|
|
|
327
356
|
- [🤼 Personas](https://github.com/webgptorg/promptbook/discussions/22)
|
|
328
357
|
- [⭕ Parameters](https://github.com/webgptorg/promptbook/discussions/83)
|
|
329
358
|
- [🚀 Pipeline execution](https://github.com/webgptorg/promptbook/discussions/84)
|
|
330
|
-
- [🧪 Expectations](https://github.com/webgptorg/promptbook/discussions/30)
|
|
331
|
-
- [✂️ Postprocessing](https://github.com/webgptorg/promptbook/discussions/31)
|
|
332
|
-
- [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29)
|
|
333
|
-
- [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32)
|
|
359
|
+
- [🧪 Expectations](https://github.com/webgptorg/promptbook/discussions/30) - Define what outputs should look like and how they're validated
|
|
360
|
+
- [✂️ Postprocessing](https://github.com/webgptorg/promptbook/discussions/31) - How outputs are refined after generation
|
|
361
|
+
- [🔣 Words not tokens](https://github.com/webgptorg/promptbook/discussions/29) - The human-friendly way to think about text generation
|
|
362
|
+
- [☯ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32) - How Book language organizes different aspects of AI workflows
|
|
334
363
|
|
|
335
|
-
|
|
364
|
+
### Advanced concepts
|
|
365
|
+
|
|
366
|
+
<table>
|
|
367
|
+
<tr>
|
|
368
|
+
<th>Data & Knowledge Management</th>
|
|
369
|
+
<th>Pipeline Control</th>
|
|
370
|
+
</tr>
|
|
371
|
+
<tr>
|
|
372
|
+
<td>
|
|
373
|
+
<ul>
|
|
374
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/41">📚 Knowledge (RAG)</a> - Retrieve and use external information</li>
|
|
375
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/54">📽 Media handling</a> - Working with images, audio, video, spreadsheets</li>
|
|
376
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/40">🔴 Anomaly detection</a> - Identifying unusual patterns or outputs</li>
|
|
377
|
+
</ul>
|
|
378
|
+
</td>
|
|
379
|
+
<td>
|
|
380
|
+
<ul>
|
|
381
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/89">🌏 Remote server</a> - Executing workflows on remote infrastructure</li>
|
|
382
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/66">🃏 Jokers (conditions)</a> - Adding conditional logic to workflows</li>
|
|
383
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/35">🔳 Metaprompting</a> - Creating prompts that generate other prompts</li>
|
|
384
|
+
</ul>
|
|
385
|
+
</td>
|
|
386
|
+
</tr>
|
|
387
|
+
<tr>
|
|
388
|
+
<th>Language & Output Control</th>
|
|
389
|
+
<th>Advanced Generation</th>
|
|
390
|
+
</tr>
|
|
391
|
+
<tr>
|
|
392
|
+
<td>
|
|
393
|
+
<ul>
|
|
394
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/53">🌏 Linguistically typed languages</a> - Type systems for natural language</li>
|
|
395
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/42">🌍 Auto-Translations</a> - Automatic multilingual support</li>
|
|
396
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/39">👮 Agent adversary expectations</a> - Safety and control mechanisms</li>
|
|
397
|
+
</ul>
|
|
398
|
+
</td>
|
|
399
|
+
<td>
|
|
400
|
+
<ul>
|
|
401
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/37">🔙 Expectation-aware generation</a> - Outputs that meet defined criteria</li>
|
|
402
|
+
<li><a href="https://github.com/webgptorg/promptbook/discussions/33">⏳ Just-in-time fine-tuning</a> - Dynamic model adaptation</li>
|
|
403
|
+
</ul>
|
|
404
|
+
</td>
|
|
405
|
+
</tr>
|
|
406
|
+
</table>
|
|
336
407
|
|
|
337
|
-
|
|
338
|
-
- [🌏 Remote server](https://github.com/webgptorg/promptbook/discussions/89)
|
|
339
|
-
- [🃏 Jokers (conditions)](https://github.com/webgptorg/promptbook/discussions/66)
|
|
340
|
-
- [🔳 Metaprompting](https://github.com/webgptorg/promptbook/discussions/35)
|
|
341
|
-
- [🌏 Linguistically typed languages](https://github.com/webgptorg/promptbook/discussions/53)
|
|
342
|
-
- [🌍 Auto-Translations](https://github.com/webgptorg/promptbook/discussions/42)
|
|
343
|
-
- [📽 Images, audio, video, spreadsheets](https://github.com/webgptorg/promptbook/discussions/54)
|
|
344
|
-
- [🔙 Expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37)
|
|
345
|
-
- [⏳ Just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33)
|
|
346
|
-
- [🔴 Anomaly detection](https://github.com/webgptorg/promptbook/discussions/40)
|
|
347
|
-
- [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
|
|
348
|
-
- [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
|
|
408
|
+
<p align="center"><a href="https://github.com/webgptorg/promptbook/discussions/categories/concepts">🔍 View more concepts</a></p>
|
|
349
409
|
|
|
350
410
|
|
|
351
411
|
|
|
@@ -400,36 +460,28 @@ If you have a question [start a discussion](https://github.com/webgptorg/promptb
|
|
|
400
460
|
- [❔ Is Promptbook using RAG _(Retrieval-Augmented Generation)_?](https://github.com/webgptorg/promptbook/discussions/123)
|
|
401
461
|
- [❔ Is Promptbook using function calling?](https://github.com/webgptorg/promptbook/discussions/124)
|
|
402
462
|
|
|
403
|
-
##
|
|
463
|
+
## 📅 Changelog
|
|
404
464
|
|
|
405
465
|
See [CHANGELOG.md](./CHANGELOG.md)
|
|
406
466
|
|
|
407
467
|
## 📜 License
|
|
408
468
|
|
|
409
|
-
|
|
469
|
+
This project is licensed under [BUSL 1.1](./LICENSE.md).
|
|
410
470
|
|
|
411
|
-
##
|
|
471
|
+
## 🤝 Contributing
|
|
412
472
|
|
|
413
|
-
See [
|
|
473
|
+
We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
414
474
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
<div style="display: flex; align-items: center; gap: 20px;">
|
|
418
|
-
|
|
419
|
-
<a href="https://promptbook.studio/">
|
|
420
|
-
<img src="./design/promptbook-studio-logo.png" alt="Partner 3" height="70">
|
|
421
|
-
</a>
|
|
422
|
-
|
|
423
|
-
<a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
|
|
424
|
-
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="70">
|
|
425
|
-
</a>
|
|
426
|
-
|
|
427
|
-
</div>
|
|
475
|
+
You can also ⭐ star the project, [follow us on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).We are open to [pull requests, feedback, and suggestions](./CONTRIBUTING.md).
|
|
428
476
|
|
|
429
|
-
##
|
|
477
|
+
## 🆘 Support & Community
|
|
430
478
|
|
|
431
|
-
|
|
479
|
+
Need help with Book language? We're here for you!
|
|
432
480
|
|
|
433
|
-
|
|
481
|
+
- 💬 [Join our Discord community](https://discord.gg/x3QWNaa89N) for real-time support
|
|
482
|
+
- 📝 [Browse our GitHub discussions](https://github.com/webgptorg/promptbook/discussions) for FAQs and community knowledge
|
|
483
|
+
- 🐛 [Report issues](https://github.com/webgptorg/book/issues) for bugs or feature requests
|
|
484
|
+
- 📚 Visit [ptbk.io](https://ptbk.io) for more resources and documentation
|
|
485
|
+
- 📧 Contact us directly through the channels listed in our [signpost](./SIGNPOST.md)
|
|
434
486
|
|
|
435
|
-
|
|
487
|
+
We welcome contributions and feedback to make Book language better for everyone!
|
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
* @generated
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
23
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.93.0';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -189,7 +189,7 @@ const VALUE_STRINGS = {
|
|
|
189
189
|
const SMALL_NUMBER = 0.001;
|
|
190
190
|
// <- TODO: [🧜♂️]
|
|
191
191
|
/**
|
|
192
|
-
*
|
|
192
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
193
193
|
*
|
|
194
194
|
* @public exported from `@promptbook/core`
|
|
195
195
|
*/
|
|
@@ -274,7 +274,7 @@ class UnexpectedError extends Error {
|
|
|
274
274
|
${block(message)}
|
|
275
275
|
|
|
276
276
|
Note: This error should not happen.
|
|
277
|
-
It's
|
|
277
|
+
It's probably a bug in the pipeline collection
|
|
278
278
|
|
|
279
279
|
Please report issue:
|
|
280
280
|
${block(getErrorReportUrl(new Error(message)).href)}
|
|
@@ -474,8 +474,12 @@ function checkSerializableAsJson(options) {
|
|
|
474
474
|
*/
|
|
475
475
|
|
|
476
476
|
/**
|
|
477
|
-
*
|
|
477
|
+
* Creates a deep clone of the given object
|
|
478
478
|
*
|
|
479
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
480
|
+
*
|
|
481
|
+
* @param objectValue The object to clone.
|
|
482
|
+
* @returns A deep, writable clone of the input object.
|
|
479
483
|
* @public exported from `@promptbook/utils`
|
|
480
484
|
*/
|
|
481
485
|
function deepClone(objectValue) {
|
|
@@ -537,13 +541,13 @@ function exportJson(options) {
|
|
|
537
541
|
*/
|
|
538
542
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
539
543
|
/**
|
|
540
|
-
*
|
|
544
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
541
545
|
*
|
|
542
546
|
* @private within the repository
|
|
543
547
|
*/
|
|
544
548
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
545
549
|
/**
|
|
546
|
-
*
|
|
550
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
547
551
|
*
|
|
548
552
|
* @private within the repository
|
|
549
553
|
*/
|
|
@@ -611,7 +615,7 @@ class PipelineExecutionError extends Error {
|
|
|
611
615
|
super(message);
|
|
612
616
|
this.name = 'PipelineExecutionError';
|
|
613
617
|
// TODO: [🐙] DRY - Maybe $randomId
|
|
614
|
-
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid
|
|
618
|
+
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid similar char conflicts */)}`;
|
|
615
619
|
Object.setPrototypeOf(this, PipelineExecutionError.prototype);
|
|
616
620
|
}
|
|
617
621
|
}
|
|
@@ -1245,10 +1249,10 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
1245
1249
|
*/
|
|
1246
1250
|
|
|
1247
1251
|
/**
|
|
1248
|
-
*
|
|
1252
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
1249
1253
|
*
|
|
1250
|
-
* @param input
|
|
1251
|
-
* @returns
|
|
1254
|
+
* @param input The string containing diacritics to be normalized.
|
|
1255
|
+
* @returns The string with diacritics removed or normalized.
|
|
1252
1256
|
* @public exported from `@promptbook/utils`
|
|
1253
1257
|
*/
|
|
1254
1258
|
function removeDiacritics(input) {
|
|
@@ -1291,14 +1295,14 @@ const CountUtils = {
|
|
|
1291
1295
|
PAGES: countPages,
|
|
1292
1296
|
};
|
|
1293
1297
|
/**
|
|
1294
|
-
* TODO: [🧠][🤠] This should be
|
|
1298
|
+
* TODO: [🧠][🤠] This should be probably as part of `TextFormatParser`
|
|
1295
1299
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1296
1300
|
*/
|
|
1297
1301
|
|
|
1298
1302
|
/**
|
|
1299
1303
|
* Function checkExpectations will check if the expectations on given value are met
|
|
1300
1304
|
*
|
|
1301
|
-
* Note: There are two
|
|
1305
|
+
* Note: There are two similar functions:
|
|
1302
1306
|
* - `checkExpectations` which throws an error if the expectations are not met
|
|
1303
1307
|
* - `isPassingExpectations` which returns a boolean
|
|
1304
1308
|
*
|
|
@@ -1320,7 +1324,7 @@ function checkExpectations(expectations, value) {
|
|
|
1320
1324
|
/**
|
|
1321
1325
|
* Function checkExpectations will check if the expectations on given value are met
|
|
1322
1326
|
*
|
|
1323
|
-
* Note: There are two
|
|
1327
|
+
* Note: There are two similar functions:
|
|
1324
1328
|
* - `checkExpectations` which throws an error if the expectations are not met
|
|
1325
1329
|
* - `isPassingExpectations` which returns a boolean
|
|
1326
1330
|
*
|
|
@@ -1341,16 +1345,16 @@ function isPassingExpectations(expectations, value) {
|
|
|
1341
1345
|
}
|
|
1342
1346
|
/**
|
|
1343
1347
|
* TODO: [💝] Unite object for expecting amount and format
|
|
1344
|
-
* TODO: [🧠][🤠] This should be part of `
|
|
1348
|
+
* TODO: [🧠][🤠] This should be part of `TextFormatParser`
|
|
1345
1349
|
* Note: [💝] and [🤠] are interconnected together
|
|
1346
1350
|
*/
|
|
1347
1351
|
|
|
1348
1352
|
/**
|
|
1349
|
-
*
|
|
1353
|
+
* Normalizes a given text to camelCase format.
|
|
1350
1354
|
*
|
|
1351
|
-
* @param text
|
|
1352
|
-
* @param _isFirstLetterCapital
|
|
1353
|
-
* @returns
|
|
1355
|
+
* @param text The text to be normalized.
|
|
1356
|
+
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
1357
|
+
* @returns The camelCase formatted string.
|
|
1354
1358
|
* @example 'helloWorld'
|
|
1355
1359
|
* @example 'iLovePromptbook'
|
|
1356
1360
|
* @public exported from `@promptbook/utils`
|
|
@@ -1414,10 +1418,10 @@ function removeEmojis(text) {
|
|
|
1414
1418
|
}
|
|
1415
1419
|
|
|
1416
1420
|
/**
|
|
1417
|
-
*
|
|
1421
|
+
* Converts a given text to kebab-case format.
|
|
1418
1422
|
*
|
|
1419
|
-
* @param text
|
|
1420
|
-
* @returns
|
|
1423
|
+
* @param text The text to be converted.
|
|
1424
|
+
* @returns The kebab-case formatted string.
|
|
1421
1425
|
* @example 'hello-world'
|
|
1422
1426
|
* @example 'i-love-promptbook'
|
|
1423
1427
|
* @public exported from `@promptbook/utils`
|
|
@@ -1602,10 +1606,10 @@ function decapitalize(word) {
|
|
|
1602
1606
|
}
|
|
1603
1607
|
|
|
1604
1608
|
/**
|
|
1605
|
-
*
|
|
1609
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
1606
1610
|
*
|
|
1607
|
-
* @param text
|
|
1608
|
-
* @returns
|
|
1611
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
1612
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
1609
1613
|
* @example 'HELLO_WORLD'
|
|
1610
1614
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
1611
1615
|
* @public exported from `@promptbook/utils`
|
|
@@ -1672,11 +1676,11 @@ function parseKeywordsFromString(input) {
|
|
|
1672
1676
|
}
|
|
1673
1677
|
|
|
1674
1678
|
/**
|
|
1675
|
-
*
|
|
1679
|
+
* Converts a name string into a URI-compatible format.
|
|
1676
1680
|
*
|
|
1677
|
-
* @param name
|
|
1678
|
-
* @returns
|
|
1679
|
-
* @example
|
|
1681
|
+
* @param name The string to be converted to a URI-compatible format.
|
|
1682
|
+
* @returns A URI-compatible string derived from the input name.
|
|
1683
|
+
* @example 'Hello World' -> 'hello-world'
|
|
1680
1684
|
* @public exported from `@promptbook/utils`
|
|
1681
1685
|
*/
|
|
1682
1686
|
function nameToUriPart(name) {
|
|
@@ -1690,11 +1694,11 @@ function nameToUriPart(name) {
|
|
|
1690
1694
|
}
|
|
1691
1695
|
|
|
1692
1696
|
/**
|
|
1693
|
-
*
|
|
1697
|
+
* Converts a given name into URI-compatible parts.
|
|
1694
1698
|
*
|
|
1695
|
-
* @param name
|
|
1696
|
-
* @returns
|
|
1697
|
-
* @example
|
|
1699
|
+
* @param name The name to be converted into URI parts.
|
|
1700
|
+
* @returns An array of URI-compatible parts derived from the name.
|
|
1701
|
+
* @example 'Example Name' -> ['example', 'name']
|
|
1698
1702
|
* @public exported from `@promptbook/utils`
|
|
1699
1703
|
*/
|
|
1700
1704
|
function nameToUriParts(name) {
|
|
@@ -1716,10 +1720,10 @@ function normalizeTo_PascalCase(text) {
|
|
|
1716
1720
|
}
|
|
1717
1721
|
|
|
1718
1722
|
/**
|
|
1719
|
-
*
|
|
1723
|
+
* Normalizes a text string to snake_case format.
|
|
1720
1724
|
*
|
|
1721
|
-
* @param text
|
|
1722
|
-
* @returns
|
|
1725
|
+
* @param text The text string to be converted to snake_case format.
|
|
1726
|
+
* @returns The normalized text in snake_case format.
|
|
1723
1727
|
* @example 'hello_world'
|
|
1724
1728
|
* @example 'i_love_promptbook'
|
|
1725
1729
|
* @public exported from `@promptbook/utils`
|
|
@@ -1740,9 +1744,9 @@ function normalizeWhitespaces(sentence) {
|
|
|
1740
1744
|
/**
|
|
1741
1745
|
* Removes quotes from a string
|
|
1742
1746
|
*
|
|
1743
|
-
* Tip: This is very
|
|
1747
|
+
* Tip: This is very useful for post-processing of the result of the LLM model
|
|
1744
1748
|
* Note: This function removes only the same quotes from the beginning and the end of the string
|
|
1745
|
-
* Note: There are two
|
|
1749
|
+
* Note: There are two similar functions:
|
|
1746
1750
|
* - `removeQuotes` which removes only bounding quotes
|
|
1747
1751
|
* - `unwrapResult` which removes whole introduce sentence
|
|
1748
1752
|
*
|
|
@@ -1754,7 +1758,7 @@ function removeQuotes(text) {
|
|
|
1754
1758
|
if (text.startsWith('"') && text.endsWith('"')) {
|
|
1755
1759
|
return text.slice(1, -1);
|
|
1756
1760
|
}
|
|
1757
|
-
if (text.startsWith('
|
|
1761
|
+
if (text.startsWith("'") && text.endsWith("'")) {
|
|
1758
1762
|
return text.slice(1, -1);
|
|
1759
1763
|
}
|
|
1760
1764
|
return text;
|
|
@@ -1763,7 +1767,7 @@ function removeQuotes(text) {
|
|
|
1763
1767
|
/**
|
|
1764
1768
|
* Function trimCodeBlock will trim starting and ending code block from the string if it is present.
|
|
1765
1769
|
*
|
|
1766
|
-
* Note: This is
|
|
1770
|
+
* Note: This is useful for post-processing of the result of the chat LLM model
|
|
1767
1771
|
* when the model wraps the result in the (markdown) code block.
|
|
1768
1772
|
*
|
|
1769
1773
|
* @public exported from `@promptbook/utils`
|
|
@@ -1782,7 +1786,7 @@ function trimCodeBlock(value) {
|
|
|
1782
1786
|
/**
|
|
1783
1787
|
* Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
|
|
1784
1788
|
*
|
|
1785
|
-
* Note: This is
|
|
1789
|
+
* Note: This is useful for post-processing of the result of the completion LLM model
|
|
1786
1790
|
* if you want to start code block in the prompt but you don't want to end it in the result.
|
|
1787
1791
|
*
|
|
1788
1792
|
* @public exported from `@promptbook/utils`
|
|
@@ -1797,9 +1801,9 @@ function trimEndOfCodeBlock(value) {
|
|
|
1797
1801
|
/**
|
|
1798
1802
|
* Removes quotes and optional introduce text from a string
|
|
1799
1803
|
*
|
|
1800
|
-
* Tip: This is very
|
|
1804
|
+
* Tip: This is very useful for post-processing of the result of the LLM model
|
|
1801
1805
|
* Note: This function trims the text and removes whole introduce sentence if it is present
|
|
1802
|
-
* Note: There are two
|
|
1806
|
+
* Note: There are two similar functions:
|
|
1803
1807
|
* - `removeQuotes` which removes only bounding quotes
|
|
1804
1808
|
* - `unwrapResult` which removes whole introduce sentence
|
|
1805
1809
|
*
|
|
@@ -1868,8 +1872,8 @@ function unwrapResult(text, options) {
|
|
|
1868
1872
|
/**
|
|
1869
1873
|
* Extracts all code blocks from markdown.
|
|
1870
1874
|
*
|
|
1871
|
-
* Note: There are multiple
|
|
1872
|
-
* - `extractBlock` just extracts the content of the code block which is also used as
|
|
1875
|
+
* Note: There are multiple similar functions:
|
|
1876
|
+
* - `extractBlock` just extracts the content of the code block which is also used as built-in function for postprocessing
|
|
1873
1877
|
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
1874
1878
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
1875
1879
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
@@ -1919,7 +1923,7 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
1919
1923
|
if (currentCodeBlock.content !== '') {
|
|
1920
1924
|
currentCodeBlock.content += '\n';
|
|
1921
1925
|
}
|
|
1922
|
-
currentCodeBlock.content += line.split('\\`\\`\\`').join('```') /* <- TODO: Maybe make
|
|
1926
|
+
currentCodeBlock.content += line.split('\\`\\`\\`').join('```') /* <- TODO: Maybe make proper unescape */;
|
|
1923
1927
|
}
|
|
1924
1928
|
}
|
|
1925
1929
|
if (currentCodeBlock !== null) {
|
|
@@ -1936,8 +1940,8 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
1936
1940
|
*
|
|
1937
1941
|
* - When there are multiple or no code blocks the function throws a `ParseError`
|
|
1938
1942
|
*
|
|
1939
|
-
* Note: There are multiple
|
|
1940
|
-
* - `extractBlock` just extracts the content of the code block which is also used as
|
|
1943
|
+
* Note: There are multiple similar functions:
|
|
1944
|
+
* - `extractBlock` just extracts the content of the code block which is also used as built-in function for postprocessing
|
|
1941
1945
|
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
1942
1946
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
1943
1947
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
@@ -1967,7 +1971,7 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
1967
1971
|
*
|
|
1968
1972
|
* - When there are multiple or no code blocks the function throws a `ParseError`
|
|
1969
1973
|
*
|
|
1970
|
-
* Note: There are multiple
|
|
1974
|
+
* Note: There are multiple similar function:
|
|
1971
1975
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
1972
1976
|
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
1973
1977
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
@@ -2038,7 +2042,7 @@ function preserve(func) {
|
|
|
2038
2042
|
})();
|
|
2039
2043
|
}
|
|
2040
2044
|
/**
|
|
2041
|
-
* TODO:
|
|
2045
|
+
* TODO: Probably remove in favour of `keepImported`
|
|
2042
2046
|
* TODO: [1] This maybe does memory leak
|
|
2043
2047
|
*/
|
|
2044
2048
|
|
|
@@ -2242,7 +2246,7 @@ class JavascriptEvalExecutionTools {
|
|
|
2242
2246
|
*/
|
|
2243
2247
|
|
|
2244
2248
|
/**
|
|
2245
|
-
* Placeholder for better implementation of JavascriptExecutionTools - some
|
|
2249
|
+
* Placeholder for better implementation of JavascriptExecutionTools - some proper sandboxing
|
|
2246
2250
|
*
|
|
2247
2251
|
* @alias JavascriptExecutionTools
|
|
2248
2252
|
* @public exported from `@promptbook/javascript`
|