@promptbook/node 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 +801 -531
- 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 +804 -534
- 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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { $Register } from '../../../utils/$Register';
|
|
2
2
|
import type { ScraperConstructor } from './ScraperConstructor';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Registry for all available scrapers in the system.
|
|
5
|
+
* Central point for registering and accessing different types of content scrapers.
|
|
5
6
|
*
|
|
6
7
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
7
|
-
* @singleton Only one instance of each register is created per build, but
|
|
8
|
+
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
8
9
|
* @public exported from `@promptbook/core`
|
|
9
10
|
*/
|
|
10
11
|
export declare const $scrapersRegister: $Register<ScraperConstructor>;
|
|
@@ -4,9 +4,9 @@ import type { string_promptbook_documentation_url } from '../../../types/typeAli
|
|
|
4
4
|
import type { string_title } from '../../../types/typeAliases';
|
|
5
5
|
import type { Registered } from '../../../utils/$Register';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Metadata interface for scrapers and converters in the system.
|
|
8
|
+
* Contains information about the capabilities and requirements of a scraper or converter.
|
|
8
9
|
*
|
|
9
|
-
* @@@
|
|
10
10
|
* x) `Scraper`
|
|
11
11
|
* x) `Converter`
|
|
12
12
|
* x) `ScraperConstructor`
|
|
@@ -19,7 +19,8 @@ import type { Registered } from '../../../utils/$Register';
|
|
|
19
19
|
*/
|
|
20
20
|
export type ScraperAndConverterMetadata = Registered & {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Human-readable title of the scraper or converter.
|
|
23
|
+
* Used for display purposes in logs and interfaces.
|
|
23
24
|
*/
|
|
24
25
|
readonly title: string_title;
|
|
25
26
|
/**
|
|
@@ -27,13 +28,15 @@ export type ScraperAndConverterMetadata = Registered & {
|
|
|
27
28
|
*/
|
|
28
29
|
readonly mimeTypes: ReadonlyArray<string_mime_type>;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* Flag indicating whether this scraper or converter can run in a browser environment.
|
|
32
|
+
* Some scrapers require Node.js capabilities and cannot run client-side.
|
|
31
33
|
*
|
|
32
34
|
* Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
33
35
|
*/
|
|
34
36
|
readonly isAvilableInBrowser: boolean;
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
38
|
+
* List of executables required by this scraper or converter to function properly.
|
|
39
|
+
* For example, PDF scrapers may require 'pandoc' to be installed on the system.
|
|
37
40
|
*/
|
|
38
41
|
readonly requiredExecutables: ReadonlyArray<Capitalize<keyof Executables extends `${infer N}Path` ? N : never>>;
|
|
39
42
|
/**
|
|
@@ -4,7 +4,8 @@ import type { Registered } from '../../../utils/$Register';
|
|
|
4
4
|
import type { Scraper } from '../Scraper';
|
|
5
5
|
import type { ScraperAndConverterMetadata } from './ScraperAndConverterMetadata';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Type definition for a constructor function that creates a Scraper instance.
|
|
8
|
+
* Used for registering scrapers in the system to handle different content types.
|
|
8
9
|
*/
|
|
9
10
|
export type ScraperConstructor = Registered & ScraperAndConverterMetadata & ((tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions) => Scraper);
|
|
10
11
|
/**
|
|
@@ -3,13 +3,15 @@ import type { string_file_extension } from '../../../types/typeAliases';
|
|
|
3
3
|
import type { ScraperSourceHandler } from '../Scraper';
|
|
4
4
|
import type { ScraperIntermediateSource } from '../ScraperIntermediateSource';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Type representing source information for generating intermediate storage.
|
|
7
|
+
* Contains essential file and URL information needed to create a deterministic storage path.
|
|
7
8
|
*
|
|
8
9
|
* @private internal utility of `getScraperIntermediateSource`
|
|
9
10
|
*/
|
|
10
11
|
type GetScraperIntermediateSourceSource = Pick<ScraperSourceHandler, 'filename' | 'url'>;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Options for intermediate source generation and management.
|
|
14
|
+
* Configures how intermediate files are named, stored, and cleaned up.
|
|
13
15
|
*
|
|
14
16
|
* @private internal utility of `getScraperIntermediateSource`
|
|
15
17
|
*/
|
|
@@ -17,9 +19,8 @@ type GetScraperIntermediateSourceHandler = Required<Pick<PrepareAndScrapeOptions
|
|
|
17
19
|
readonly extension: string_file_extension;
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* Note: It also checks if directory exists and creates it if not
|
|
22
|
+
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
23
|
+
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
23
24
|
*
|
|
24
25
|
* @private as internal utility for scrapers
|
|
25
26
|
*/
|
|
@@ -4,7 +4,9 @@ import type { KnowledgeSourceJson } from '../../../pipeline/PipelineJson/Knowled
|
|
|
4
4
|
import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
|
|
5
5
|
import type { ScraperSourceHandler } from '../Scraper';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Factory function that creates a handler for processing knowledge sources.
|
|
8
|
+
* Provides standardized processing of different types of knowledge sources
|
|
9
|
+
* across various scraper implementations.
|
|
8
10
|
*
|
|
9
11
|
* @public exported from `@promptbook/core`
|
|
10
12
|
*/
|
|
@@ -2,7 +2,7 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
|
2
2
|
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
|
|
3
3
|
import { DocumentScraper } from './DocumentScraper';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Creates a scraper for document content.
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/documents`
|
|
8
8
|
*/
|
|
@@ -2,7 +2,8 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
|
2
2
|
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
|
|
3
3
|
import { LegacyDocumentScraper } from './LegacyDocumentScraper';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Creates a scraper for legacy document formats (.doc, .rtf, etc).
|
|
6
|
+
* Uses LibreOffice for conversion to extract content from older document formats.
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/legacy-documents`
|
|
8
9
|
*/
|
|
@@ -2,7 +2,7 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
|
2
2
|
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
|
|
3
3
|
import { MarkdownScraper } from './MarkdownScraper';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Creates a scraper for markdown content.
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/markdown-utils`
|
|
8
8
|
*/
|
|
@@ -13,6 +13,9 @@ export declare const createMarkdownScraper: ((tools: Pick<ExecutionTools, 'llm'>
|
|
|
13
13
|
mimeTypes: string[];
|
|
14
14
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
15
15
|
isAvilableInBrowser: true;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
18
|
+
*/
|
|
16
19
|
requiredExecutables: never[];
|
|
17
20
|
}>;
|
|
18
21
|
/**
|
|
@@ -37,7 +37,7 @@ export declare class MarkitdownScraper implements Converter, Scraper {
|
|
|
37
37
|
*/
|
|
38
38
|
$convert(source: ScraperSourceHandler): Promise<ScraperIntermediateSource>;
|
|
39
39
|
/**
|
|
40
|
-
* Scrapes the
|
|
40
|
+
* Scrapes the source document (PDF, DOCX, etc.) and returns the knowledge pieces or `null` if it can't scrape it.
|
|
41
41
|
*/
|
|
42
42
|
scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>;
|
|
43
43
|
}
|
|
@@ -2,7 +2,8 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
|
2
2
|
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
|
|
3
3
|
import { PdfScraper } from './PdfScraper';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Factory function to create an instance of PdfScraper.
|
|
6
|
+
* It bundles the scraper class with its metadata.
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/pdf`
|
|
8
9
|
*/
|
|
@@ -2,7 +2,8 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
|
2
2
|
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
|
|
3
3
|
import { WebsiteScraper } from './WebsiteScraper';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Factory function to create an instance of WebsiteScraper.
|
|
6
|
+
* It bundles the scraper class with its metadata.
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/website-crawler`
|
|
8
9
|
*/
|
|
@@ -12,9 +13,7 @@ export declare const createWebsiteScraper: ((tools: Pick<ExecutionTools, 'llm'>,
|
|
|
12
13
|
className: string;
|
|
13
14
|
mimeTypes: string[];
|
|
14
15
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
15
|
-
isAvilableInBrowser: false;
|
|
16
|
-
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
17
|
-
*/
|
|
16
|
+
isAvilableInBrowser: false;
|
|
18
17
|
requiredExecutables: never[];
|
|
19
18
|
}>;
|
|
20
19
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JavascriptEvalExecutionTools } from './JavascriptEvalExecutionTools';
|
|
2
2
|
/**
|
|
3
|
-
* Placeholder for better implementation of JavascriptExecutionTools - some
|
|
3
|
+
* Placeholder for better implementation of JavascriptExecutionTools - some proper sandboxing
|
|
4
4
|
*
|
|
5
5
|
* @alias JavascriptExecutionTools
|
|
6
6
|
* @public exported from `@promptbook/javascript`
|
|
@@ -18,7 +18,11 @@ import { trimCodeBlock } from '../../utils/trimCodeBlock';
|
|
|
18
18
|
import { trimEndOfCodeBlock } from '../../utils/trimEndOfCodeBlock';
|
|
19
19
|
import { unwrapResult } from '../../utils/unwrapResult';
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Collection of utility functions that can be used for post-processing model outputs.
|
|
22
|
+
* These functions help transform, extract, or format the raw model responses.
|
|
23
|
+
*
|
|
24
|
+
* These utilities range from simple string manipulations to markdown processing
|
|
25
|
+
* and formatting functions for specific types of output.
|
|
22
26
|
*
|
|
23
27
|
* @public exported from `@promptbook/javascript`
|
|
24
28
|
*/
|
|
@@ -9,6 +9,6 @@ import type { really_any } from '../../../utils/organization/really_any';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function preserve(func: (...params: ReadonlyArray<really_any>) => unknown): void;
|
|
11
11
|
/**
|
|
12
|
-
* TODO:
|
|
12
|
+
* TODO: Probably remove in favour of `keepImported`
|
|
13
13
|
* TODO: [1] This maybe does memory leak
|
|
14
14
|
*/
|
|
@@ -3,7 +3,7 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
* Storage of objects with asynchronous API
|
|
4
4
|
*
|
|
5
5
|
* Note: Naming `PromptbookStorage` not `Storage` to avoid name collision with global `Storage` interface.
|
|
6
|
-
* Note: This is
|
|
6
|
+
* Note: This is similar to Web Storage API interface but everything is asynchronous and can store JSON objects.
|
|
7
7
|
*/
|
|
8
8
|
export type PromptbookStorage<TItem> = {
|
|
9
9
|
/**
|
|
@@ -2,7 +2,10 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
|
2
2
|
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
3
3
|
import type { FileCacheStorageOptions } from './FileCacheStorageOptions';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A storage implementation that caches data in files organized in a directory structure.
|
|
6
|
+
* Provides methods for retrieving, storing, and managing cached data on the filesystem.
|
|
7
|
+
*
|
|
8
|
+
* This class implements the PromptbookStorage interface for filesystem-based caching.
|
|
6
9
|
*
|
|
7
10
|
* @public exported from `@promptbook/node`
|
|
8
11
|
*/
|
|
@@ -11,19 +14,23 @@ export declare class FileCacheStorage<TItem> implements PromptbookStorage<TItem>
|
|
|
11
14
|
private readonly options;
|
|
12
15
|
constructor(tools: Required<Pick<ExecutionTools, 'fs'>>, options: FileCacheStorageOptions);
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
17
|
+
* Converts a storage key to a filesystem path where the data should be stored.
|
|
18
|
+
* Creates a consistent, deterministic file path based on the key string.
|
|
15
19
|
*/
|
|
16
20
|
private getFilenameForKey;
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
|
23
|
+
* Retrieves the cached data from the file system storage.
|
|
19
24
|
*/
|
|
20
25
|
getItem(key: string): Promise<TItem | null>;
|
|
21
26
|
/**
|
|
22
|
-
*
|
|
27
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
28
|
+
* Persists data to the file system, creating necessary directory structure if it doesn't exist.
|
|
23
29
|
*/
|
|
24
30
|
setItem(key: string, value: TItem): Promise<void>;
|
|
25
31
|
/**
|
|
26
|
-
*
|
|
32
|
+
* Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
|
|
33
|
+
* Deletes the corresponding file from the filesystem.
|
|
27
34
|
*/
|
|
28
35
|
removeItem(key: string): Promise<void>;
|
|
29
36
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { string_dirname } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Configuration options for the FileCacheStorage implementation.
|
|
4
|
+
* Defines how and where file cache data should be stored and managed.
|
|
4
5
|
*/
|
|
5
6
|
export type FileCacheStorageOptions = {
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* The absolute path to the root directory where cache files will be stored.
|
|
9
|
+
* This directory must exist and be writable by the application.
|
|
8
10
|
*/
|
|
9
11
|
rootFolderPath: string_dirname;
|
|
10
12
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { string_name } from '../../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
4
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
4
5
|
*
|
|
5
6
|
* @private for `FileCacheStorage`
|
|
6
7
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
import type { IndexedDbStorageOptions } from './utils/IndexedDbStorageOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Gets wrapper around IndexedDB which can be used as PromptbookStorage
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/browser`
|
|
7
|
+
*/
|
|
8
|
+
export declare function getIndexedDbStorage<TItem>(options: IndexedDbStorageOptions): PromptbookStorage<TItem>;
|
|
9
|
+
/**
|
|
10
|
+
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
11
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { string_name } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Options for IndexedDB storage
|
|
4
|
+
*/
|
|
5
|
+
export type IndexedDbStorageOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the database
|
|
8
|
+
*/
|
|
9
|
+
databaseName: string_name;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the object store (table) in the database
|
|
12
|
+
*/
|
|
13
|
+
storeName: string_name;
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../../_common/PromptbookStorage';
|
|
2
|
+
import type { IndexedDbStorageOptions } from './IndexedDbStorageOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a PromptbookStorage backed by IndexedDB.
|
|
5
|
+
* Uses a single object store named 'promptbook'.
|
|
6
|
+
* @private for `getIndexedDbStorage`
|
|
7
|
+
*/
|
|
8
|
+
export declare function makePromptbookStorageFromIndexedDb<TValue>(options: IndexedDbStorageOptions): PromptbookStorage<TValue>;
|
package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PromptbookStorage } from '../../_common/PromptbookStorage';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a Promptbook storage interface from a web storage object.
|
|
4
|
+
* Facilitates using Web Storage (localStorage/sessionStorage) as a storage backend.
|
|
4
5
|
*
|
|
5
6
|
* @private for `getLocalStorage` and `getSessionStorage`
|
|
6
7
|
*/
|
|
@@ -93,9 +93,9 @@ export type CommonModelRequirements = {
|
|
|
93
93
|
readonly maxTokens?: number;
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
|
-
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (
|
|
96
|
+
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (similar that `user` identification is not here)
|
|
97
97
|
* TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
|
|
98
|
-
* [💱]
|
|
98
|
+
* [💱] Probably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
|
|
99
99
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
100
100
|
* TODO: Maybe figure out better word than "variant"
|
|
101
101
|
* TODO: Add here more requirement options like max context size, max tokens, etc.
|
|
@@ -2,14 +2,14 @@ import type { TupleToUnion } from 'type-fest';
|
|
|
2
2
|
/**
|
|
3
3
|
* Model variant describes the very general type of the model
|
|
4
4
|
*
|
|
5
|
-
* There are
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
5
|
+
* There are these supported model variants:
|
|
6
|
+
* - `COMPLETION` - Model that takes prompt and writes the rest of the text
|
|
7
|
+
* - `CHAT` - Model that takes prompt and previous messages and returns response
|
|
8
|
+
* - `EMBEDDING` - Model that convert text into vector representations
|
|
8
9
|
*/
|
|
9
10
|
export type ModelVariant = TupleToUnion<typeof MODEL_VARIANTS>;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* @see {@link ModelVariant}
|
|
13
13
|
* @public exported from `@promptbook/core`
|
|
14
14
|
*/
|
|
15
15
|
export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT", "EMBEDDING"];
|
|
@@ -123,7 +123,8 @@ export type InputParameters = Exclude<Record<string_parameter_name, really_unkno
|
|
|
123
123
|
*/
|
|
124
124
|
export type string_reserved_parameter_name = TupleToUnion<typeof RESERVED_PARAMETER_NAMES>;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* Represents a mapping of reserved parameter names to their values.
|
|
127
|
+
* Reserved parameters are used internally by the pipeline and should not be set by users.
|
|
127
128
|
*
|
|
128
129
|
* Note: [🚉] This is fully serializable as JSON
|
|
129
130
|
*/
|
|
@@ -148,27 +149,29 @@ export type string_persona_description = string;
|
|
|
148
149
|
*/
|
|
149
150
|
export type string_model_description = string;
|
|
150
151
|
/**
|
|
151
|
-
* Source of one knowledge
|
|
152
|
+
* Source of one knowledge piece.
|
|
152
153
|
*
|
|
153
|
-
* It can be a link, a relative path to file or direct text
|
|
154
|
+
* It can be a link, a relative path to file or direct text content.
|
|
154
155
|
*
|
|
155
156
|
* For example `"https://pavolhejny.com/"`
|
|
156
157
|
* For example `"./pavol-hejny-cv.pdf"`
|
|
157
158
|
* For example `"Pavol Hejný has web https://pavolhejny.com/"`
|
|
158
159
|
* For example `"Pavol Hejný is web developer and creator of Promptbook and Collboard"`
|
|
159
160
|
*
|
|
160
|
-
*
|
|
161
|
+
* Note: Distinguishes between `string_knowledge_source_content` and `string_knowledge_source_link`:
|
|
162
|
+
* `string_knowledge_source_content` refers to the actual content or source of knowledge
|
|
163
|
+
* `string_knowledge_source_link` refers to a reference or link to the knowledge source
|
|
161
164
|
*/
|
|
162
165
|
export type string_knowledge_source_content = string_knowledge_source_link | string_markdown;
|
|
163
166
|
/**
|
|
164
|
-
* One link to knowledge source
|
|
167
|
+
* One link to a knowledge source.
|
|
165
168
|
*
|
|
166
|
-
* It can be a
|
|
169
|
+
* It can be a URL or relative path.
|
|
167
170
|
*
|
|
168
171
|
* For example `"https://pavolhejny.com/"`
|
|
169
172
|
* For example `"./pavol-hejny-cv.pdf"`
|
|
170
173
|
*
|
|
171
|
-
*
|
|
174
|
+
* Note: string_knowledge_source_link refers to a reference or link to the knowledge source, while string_knowledge_source_content can be the link or the actual content.
|
|
172
175
|
*/
|
|
173
176
|
export type string_knowledge_source_link = string_url | string_filename;
|
|
174
177
|
/**
|
|
@@ -183,7 +186,7 @@ export type string_html = string;
|
|
|
183
186
|
* For example `"<foo>bar</foo>"`
|
|
184
187
|
*
|
|
185
188
|
*
|
|
186
|
-
* TODO: [🎞️]
|
|
189
|
+
* TODO: [🎞️] Probably use some object-based method for working with XMLs
|
|
187
190
|
*/
|
|
188
191
|
export type string_xml = string;
|
|
189
192
|
/**
|
|
@@ -233,7 +236,9 @@ export type string_markdown_text = string;
|
|
|
233
236
|
*/
|
|
234
237
|
export type string_markdown_codeblock_language = 'book' | 'markdown' | 'text' | 'javascript' | 'css' | 'json';
|
|
235
238
|
/**
|
|
236
|
-
*
|
|
239
|
+
* A URL pointing to Promptbook documentation or a specific discussion.
|
|
240
|
+
*
|
|
241
|
+
* For example: `https://github.com/webgptorg/promptbook/discussions/123`
|
|
237
242
|
*/
|
|
238
243
|
export type string_promptbook_documentation_url = `https://github.com/webgptorg/promptbook/discussions/${number | `@@${string}`}`;
|
|
239
244
|
/**
|
|
@@ -448,15 +453,14 @@ export type string_uuid = string & {
|
|
|
448
453
|
readonly _type: 'uuid';
|
|
449
454
|
};
|
|
450
455
|
/**
|
|
451
|
-
* Application identifier
|
|
456
|
+
* Application identifier, used to distinguish different apps or clients.
|
|
452
457
|
*
|
|
453
|
-
*
|
|
458
|
+
* For example: 'cli', 'playground', or a custom app id.
|
|
454
459
|
*/
|
|
455
460
|
export type string_app_id = id | 'app';
|
|
456
461
|
/**
|
|
457
|
-
* End user identifier
|
|
458
|
-
*
|
|
459
|
-
* @@@
|
|
462
|
+
* End user identifier, can be a user id or email address.
|
|
463
|
+
* Used for tracking and abuse prevention.
|
|
460
464
|
*/
|
|
461
465
|
export type string_user_id = id | string_email;
|
|
462
466
|
/**
|
|
@@ -630,7 +634,7 @@ export type number_integer = number;
|
|
|
630
634
|
export type number_port = number_positive & number_integer;
|
|
631
635
|
/**
|
|
632
636
|
* Semantic helper;
|
|
633
|
-
* Percentage from 0 to 1 (100%) (and
|
|
637
|
+
* Percentage from 0 to 1 (100%) (and below and above)
|
|
634
638
|
*/
|
|
635
639
|
export type number_percent = number;
|
|
636
640
|
/**
|
|
@@ -649,10 +653,9 @@ export type number_seed = number_percent;
|
|
|
649
653
|
/**
|
|
650
654
|
* Likeness of the wallpaper
|
|
651
655
|
*
|
|
652
|
-
* - 👍 is
|
|
653
|
-
* - 👎 is
|
|
654
|
-
* - ❤ is
|
|
655
|
-
* - etc
|
|
656
|
+
* - 👍 is equivalent to 1
|
|
657
|
+
* - 👎 is equivalent to -1
|
|
658
|
+
* - ❤ is equivalent to more than 1
|
|
656
659
|
*/
|
|
657
660
|
export type number_likeness = number;
|
|
658
661
|
export type number_miliseconds = number_integer;
|
|
@@ -2,33 +2,34 @@ import { type IDestroyable } from 'destroyable';
|
|
|
2
2
|
import type { string_name } from '../types/typeAliases';
|
|
3
3
|
import type { TODO_string } from './organization/TODO_string';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Represents an entity in a global registry.
|
|
6
|
+
* Contains identifying information about the package and class.
|
|
6
7
|
*/
|
|
7
8
|
export type Registered = {
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* The name of the package where the registered entity is defined.
|
|
10
11
|
*/
|
|
11
12
|
readonly packageName: TODO_string;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* The name of the class being registered.
|
|
14
15
|
*/
|
|
15
16
|
readonly className: TODO_string;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* Represents a registration record, including destroyable interface and registry name.
|
|
19
20
|
*/
|
|
20
21
|
export type Registration = Registered & IDestroyable & {
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* The name of the register this entity is registered in.
|
|
23
24
|
*/
|
|
24
25
|
readonly registerName: string_name;
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
28
29
|
*
|
|
29
30
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
30
31
|
*
|
|
31
|
-
* @private internal utility, exported are only
|
|
32
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
32
33
|
*/
|
|
33
34
|
export declare class $Register<TRegistered extends Registered> {
|
|
34
35
|
private readonly registerName;
|
|
@@ -5,7 +5,7 @@ type AddPipelineCommandOptions = {
|
|
|
5
5
|
pipelineString: PipelineString;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Adds a new command to a pipeline string in the correct format.
|
|
9
9
|
*
|
|
10
10
|
* @public exported from `@promptbook/editable`
|
|
11
11
|
*/
|
|
@@ -14,4 +14,4 @@ export {};
|
|
|
14
14
|
/**
|
|
15
15
|
* TODO: [🧠] What is the better solution - `- xxx`, - `- xxx` or preserve (see also next TODO)
|
|
16
16
|
* TODO: When existing commands 1) as 2) number 3) list, add 4) new command as next number
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PipelineString } from '../../../pipeline/PipelineString';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Converts a pipeline structure to its string representation.
|
|
4
|
+
*
|
|
5
|
+
* Transforms a flat, simple pipeline into a properly formatted pipeline string
|
|
6
|
+
* with sections for title, prompt, and return statement.
|
|
4
7
|
*
|
|
5
8
|
* @public exported from `@promptbook/editable`
|
|
6
9
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PipelineString } from '../../../pipeline/PipelineString';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Utility to determine if a pipeline string is in flat format.
|
|
4
|
+
* A flat pipeline is a simple text without proper structure (headers, blocks, etc).
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/editable`
|
|
6
7
|
*/
|
|
@@ -9,7 +9,7 @@ import type { string_json } from '../../../types/typeAliases';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function stringifyPipelineJson<TType>(pipeline: TType): string_json<TType>;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🐝] Not Working
|
|
12
|
+
* TODO: [🐝] Not Working properly @see https://promptbook.studio/examples/mixed-knowledge.book
|
|
13
13
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
14
14
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
15
15
|
* TODO: [🍙] Make some standard order of json properties
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { really_any } from '../organization/really_any';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
4
|
+
* regardless of the JavaScript environment in which the code is running
|
|
4
5
|
*
|
|
5
6
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
6
7
|
*
|
|
@@ -7,6 +7,6 @@ import type { ExpectationUnit } from '../../pipeline/PipelineJson/Expectations';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const CountUtils: Record<ExpectationUnit, (text: string) => ExpectationAmount>;
|
|
9
9
|
/**
|
|
10
|
-
* TODO: [🧠][🤠] This should be
|
|
10
|
+
* TODO: [🧠][🤠] This should be probably as part of `TextFormatParser`
|
|
11
11
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12
12
|
*/
|
|
@@ -19,8 +19,8 @@ export type CodeBlock = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Extracts all code blocks from markdown.
|
|
21
21
|
*
|
|
22
|
-
* Note: There are multiple
|
|
23
|
-
* - `extractBlock` just extracts the content of the code block which is also used as
|
|
22
|
+
* Note: There are multiple similar functions:
|
|
23
|
+
* - `extractBlock` just extracts the content of the code block which is also used as built-in function for postprocessing
|
|
24
24
|
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
25
25
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
26
26
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
@@ -9,7 +9,7 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
9
9
|
* Note: It can not work with html syntax and comments
|
|
10
10
|
*
|
|
11
11
|
* @param markdown any valid markdown
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns An array of strings, each representing an individual list item found in the markdown
|
|
13
13
|
* @public exported from `@promptbook/markdown-utils`
|
|
14
14
|
*/
|
|
15
15
|
export declare function extractAllListItemsFromMarkdown(markdown: string_markdown): string_markdown_text[];
|