@promptbook/markdown-utils 0.81.0-9 → 0.81.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 +25 -8
- package/esm/index.es.js +141 -59
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +38 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -4
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- package/esm/typings/src/_packages/templates.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +44 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +2 -2
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +11 -0
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/config.d.ts +3 -3
- package/esm/typings/src/conversion/compilePipeline.d.ts +1 -4
- package/esm/typings/src/conversion/{precompilePipeline.d.ts → parsePipeline.d.ts} +3 -3
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +7 -7
- package/esm/typings/src/errors/utils/getErrorReportUrl.d.ts +1 -1
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +9 -4
- package/esm/typings/src/formfactors/image-generator/ImageGeneratorFormfactorDefinition.d.ts +24 -0
- package/esm/typings/src/formfactors/index.d.ts +31 -9
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/index.d.ts +3 -3
- package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +3 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForCli.d.ts → $provideLlmToolsForWizzardOrCli.d.ts} +2 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +2 -0
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -0
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
- package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -0
- package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -0
- package/esm/typings/src/llm-providers/vercel/playground/playground.d.ts +1 -1
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +22 -0
- package/esm/typings/src/personas/preparePersona.d.ts +4 -4
- package/esm/typings/src/pipeline/PipelineString.d.ts +0 -3
- package/esm/typings/src/pipeline/book-notation.d.ts +14 -0
- package/esm/typings/src/pipeline/isValidPipelineString.d.ts +13 -0
- package/esm/typings/src/pipeline/isValidPipelineString.test.d.ts +4 -0
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +14 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -0
- package/esm/typings/src/prepare/prepareTasks.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +1 -0
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +3 -0
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -0
- package/esm/typings/src/scrapers/_common/utils/scraperFetch.d.ts +3 -0
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -0
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -0
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -1
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +8 -2
- package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts} +2 -2
- package/esm/typings/src/utils/organization/$sideEffect.d.ts +9 -0
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -2
- package/esm/typings/src/utils/validators/filePath/isRootPath.d.ts +12 -0
- package/esm/typings/src/utils/validators/filePath/isRootPath.test.d.ts +4 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +3 -0
- package/esm/typings/src/wizzard/$getCompiledBook.d.ts +16 -0
- package/esm/typings/src/wizzard/wizzard.d.ts +51 -7
- package/package.json +1 -1
- package/umd/index.umd.js +141 -59
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/other/templates/getBookTemplate.d.ts +0 -21
- package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
- /package/esm/typings/src/conversion/{precompilePipeline.test.d.ts → parsePipeline.test.d.ts} +0 -0
- /package/esm/typings/src/utils/markdown/{removeContentComments.test.d.ts → removeMarkdownComments.test.d.ts} +0 -0
|
@@ -15,7 +15,7 @@ import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFro
|
|
|
15
15
|
* @returns @@@
|
|
16
16
|
* @public exported from `@promptbook/node`
|
|
17
17
|
*/
|
|
18
|
-
export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConfigurationOptions): MultipleLlmExecutionTools
|
|
18
|
+
export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConfigurationOptions): Promise<MultipleLlmExecutionTools>;
|
|
19
19
|
/**
|
|
20
20
|
* TODO: @@@ write `$provideLlmToolsFromEnv` vs `$provideLlmToolsConfigurationFromEnv` vs `createLlmToolsFromConfiguration`
|
|
21
21
|
* TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
|
|
@@ -16,7 +16,7 @@ export declare const ANTHROPIC_CLAUDE_MODELS: ReadonlyArray<AvailableModel & {
|
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Note: [🤖] Add models of new variant
|
|
19
|
-
* TODO: [🧠][main]
|
|
19
|
+
* TODO: [🧠][main] !!3 Add embedding models OR Anthropic has only chat+completion models?
|
|
20
20
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
21
21
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
22
22
|
* TODO: [🎰] Some mechanism to auto-update available models
|
package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export declare const createAnthropicClaudeExecutionTools: ((options: AnthropicCl
|
|
|
11
11
|
className: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* TODO: [🧠][main]
|
|
15
|
-
* TODO: [🧠][🧱][main]
|
|
14
|
+
* TODO: [🧠][main] !!4 Make anonymous this with all LLM providers
|
|
15
|
+
* TODO: [🧠][🧱][main] !!4 Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
16
16
|
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
17
17
|
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
18
18
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
export {};
|
|
3
3
|
/**
|
|
4
|
-
* TODO: [main]
|
|
5
|
-
* TODO: [main]
|
|
4
|
+
* TODO: [main] !!3 Playground with WebGPT / Promptbook.studio anonymous server
|
|
5
|
+
* TODO: [main] !!3 Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
6
6
|
* Note: [⚫] Code in this file should never be published in any package
|
|
7
7
|
*/
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/core`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _AnthropicClaudeMetadataRegistration: Registration;
|
|
@@ -5,7 +5,9 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/anthropic-claude`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
10
|
+
*
|
|
9
11
|
*/
|
|
10
12
|
export declare const _AnthropicClaudeRegistration: Registration;
|
|
11
13
|
/**
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/core`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _AzureOpenAiMetadataRegistration: Registration;
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/azure-openai`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _AzureOpenAiRegistration: Registration;
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/core`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _GoogleMetadataRegistration: Registration;
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/google`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _GoogleRegistration: Registration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
export {};
|
|
3
3
|
/**
|
|
4
|
-
* TODO: [main]
|
|
4
|
+
* TODO: [main] !!3 Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
5
5
|
* Note: [⚫] Code in this file should never be published in any package
|
|
6
6
|
*/
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/core`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _OpenAiMetadataRegistration: Registration;
|
|
@@ -14,6 +15,7 @@ export declare const _OpenAiMetadataRegistration: Registration;
|
|
|
14
15
|
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
15
16
|
*
|
|
16
17
|
* @public exported from `@promptbook/core`
|
|
18
|
+
* @public exported from `@promptbook/wizzard`
|
|
17
19
|
* @public exported from `@promptbook/cli`
|
|
18
20
|
*/
|
|
19
21
|
export declare const _OpenAiAssistantMetadataRegistration: Registration;
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/openai`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _OpenAiRegistration: Registration;
|
|
@@ -14,6 +15,7 @@ export declare const _OpenAiRegistration: Registration;
|
|
|
14
15
|
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
15
16
|
*
|
|
16
17
|
* @public exported from `@promptbook/openai`
|
|
18
|
+
* @public exported from `@promptbook/wizzard`
|
|
17
19
|
* @public exported from `@promptbook/cli`
|
|
18
20
|
*/
|
|
19
21
|
export declare const _OpenAiAssistantRegistration: Registration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
export {};
|
|
3
3
|
/**
|
|
4
|
-
* TODO: [main]
|
|
4
|
+
* TODO: [main] !!3 Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
5
5
|
* Note: [⚫] Code in this file should never be published in any package
|
|
6
6
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { string_formfactor_name } from '../../formfactors/_common/string_formfactor_name';
|
|
2
|
+
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
3
|
+
/**
|
|
4
|
+
* @@@
|
|
5
|
+
*
|
|
6
|
+
* @singleton
|
|
7
|
+
* @private internal cache of `getBookTemplate`
|
|
8
|
+
*/
|
|
9
|
+
export declare let pipelines: Array<PipelineJson> | null;
|
|
10
|
+
/**
|
|
11
|
+
* Get template for new book
|
|
12
|
+
*
|
|
13
|
+
* @param formfactorName - optional filter for FORMFACTOR - get only pipelines for this formfactor
|
|
14
|
+
* @returns list of pipelines
|
|
15
|
+
* @public exported from `@promptbook/templates`
|
|
16
|
+
*/
|
|
17
|
+
export declare function getBookTemplates(formfactorName?: string_formfactor_name): ReadonlyArray<PipelineJson>;
|
|
18
|
+
/**
|
|
19
|
+
* TODO: Unit test
|
|
20
|
+
* TODO: [🧠] Which is the best place for this function
|
|
21
|
+
* TODO: !!6 For GENERIC template ensure at least one pipeline is present for typescript in `getBookTemplates`
|
|
22
|
+
*/
|
|
@@ -10,8 +10,8 @@ import type { string_persona_description } from '../types/typeAliases';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function preparePersona(personaDescription: string_persona_description, tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions): Promise<PersonaPreparedJson['modelRequirements']>;
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [🔃][main]
|
|
14
|
-
* TODO: [🏢]
|
|
15
|
-
* TODO: [🏢]
|
|
16
|
-
* TODO: [🏢]
|
|
13
|
+
* TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
14
|
+
* TODO: [🏢] Check validity of `modelName` in pipeline
|
|
15
|
+
* TODO: [🏢] Check validity of `systemMessage` in pipeline
|
|
16
|
+
* TODO: [🏢] Check validity of `temperature` in pipeline
|
|
17
17
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PipelineString } from './PipelineString';
|
|
2
|
+
/**
|
|
3
|
+
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
4
|
+
*
|
|
5
|
+
* @param strings @@@
|
|
6
|
+
* @param values @@@
|
|
7
|
+
* @returns the pipeline string
|
|
8
|
+
* @public exported from `@promptbook/core`
|
|
9
|
+
*/
|
|
10
|
+
export declare function book(strings: TemplateStringsArray, ...values: Array<string>): PipelineString;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
13
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14
|
+
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PipelineString } from './PipelineString';
|
|
2
|
+
/**
|
|
3
|
+
* Function `isValidPipelineString` will validate the if the string is a valid pipeline string
|
|
4
|
+
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} pipelineString the candidate for a pipeline string
|
|
7
|
+
* @returns {boolean} if the string is a valid pipeline string
|
|
8
|
+
* @public exported from `@promptbook/core`
|
|
9
|
+
*/
|
|
10
|
+
export declare function isValidPipelineString(pipelineString: string): pipelineString is PipelineString;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
13
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PipelineString } from './PipelineString';
|
|
2
|
+
/**
|
|
3
|
+
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
4
|
+
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} pipelineString the candidate for a pipeline string
|
|
7
|
+
* @returns {PipelineString} the same string as input, but validated as valid
|
|
8
|
+
* @throws {ParseError} if the string is not a valid pipeline string
|
|
9
|
+
* @public exported from `@promptbook/core`
|
|
10
|
+
*/
|
|
11
|
+
export declare function validatePipelineString(pipelineString: string): PipelineString;
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
14
|
+
*/
|
|
@@ -2,11 +2,13 @@ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
|
2
2
|
/**
|
|
3
3
|
* Determine if the pipeline is fully prepared
|
|
4
4
|
*
|
|
5
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
6
|
+
*
|
|
5
7
|
* @public exported from `@promptbook/core`
|
|
6
8
|
*/
|
|
7
9
|
export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
|
|
8
10
|
/**
|
|
9
|
-
* TODO: [🔃][main]
|
|
11
|
+
* TODO: [🔃][main] If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
10
12
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
11
13
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
12
14
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -4,6 +4,8 @@ import type { PrepareAndScrapeOptions } from './PrepareAndScrapeOptions';
|
|
|
4
4
|
/**
|
|
5
5
|
* Prepare pipeline from string (markdown) format to JSON format
|
|
6
6
|
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
8
|
+
*
|
|
7
9
|
* Note: This function does not validate logic of the pipeline
|
|
8
10
|
* Note: This function acts as part of compilation process
|
|
9
11
|
* Note: When the pipeline is already prepared, it returns the same pipeline
|
|
@@ -25,7 +25,7 @@ export {};
|
|
|
25
25
|
* TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
|
|
26
26
|
* TODO: [🧠] Add context to each task (if missing)
|
|
27
27
|
* TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
28
|
-
* TODO: [♨][main]
|
|
28
|
+
* TODO: [♨][main] !!3 Prepare index the examples and maybe tasks
|
|
29
29
|
* TODO: Write tests for `preparePipeline`
|
|
30
30
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
31
31
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -7,7 +7,6 @@ import type { string_url } from '../../types/typeAliases';
|
|
|
7
7
|
import type { ScraperAndConverterMetadata } from './register/ScraperAndConverterMetadata';
|
|
8
8
|
/**
|
|
9
9
|
* @@@
|
|
10
|
-
*
|
|
11
10
|
*/
|
|
12
11
|
export type Scraper = {
|
|
13
12
|
/**
|
|
@@ -53,6 +52,7 @@ export type ScraperSourceHandler = {
|
|
|
53
52
|
asText(): Promisable<string>;
|
|
54
53
|
};
|
|
55
54
|
/**
|
|
55
|
+
* TODO: [🧠] Maybe split `ScraperSourceHandler` into `ScraperWebsiteSourceHandler` + `ScraperFileSourceHandler`
|
|
56
56
|
* TODO: [🥽] Add ` asBlob(): Promisable<Blob>;` or asFile
|
|
57
57
|
* TODO: [🐝] @@@ Annotate all
|
|
58
58
|
* TODO: [🔼] Export via types
|
|
@@ -28,6 +28,8 @@ export type ScraperAndConverterMetadata = Registered & {
|
|
|
28
28
|
readonly mimeTypes: ReadonlyArray<string_mime_type>;
|
|
29
29
|
/**
|
|
30
30
|
* @@@
|
|
31
|
+
*
|
|
32
|
+
* Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
31
33
|
*/
|
|
32
34
|
readonly isAvilableInBrowser: boolean;
|
|
33
35
|
/**
|
|
@@ -5,3 +5,6 @@ import type { PromptbookFetch } from '../../../execution/PromptbookFetch';
|
|
|
5
5
|
* @private as default `fetch` function used in Promptbook scrapers
|
|
6
6
|
*/
|
|
7
7
|
export declare const scraperFetch: PromptbookFetch;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
|
|
10
|
+
*/
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/documents`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _DocumentScraperRegistration: Registration;
|
|
@@ -19,6 +19,7 @@ export declare const documentScraperMetadata: import("type-fest/source/readonly-
|
|
|
19
19
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
|
+
* @public exported from `@promptbook/wizzard`
|
|
22
23
|
* @public exported from `@promptbook/cli`
|
|
23
24
|
*/
|
|
24
25
|
export declare const _DocumentScraperMetadataRegistration: Registration;
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/legacy-documents`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _LegacyDocumentScraperRegistration: Registration;
|
|
@@ -19,6 +19,7 @@ export declare const legacyDocumentScraperMetadata: import("type-fest/source/rea
|
|
|
19
19
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
|
+
* @public exported from `@promptbook/wizzard`
|
|
22
23
|
* @public exported from `@promptbook/cli`
|
|
23
24
|
*/
|
|
24
25
|
export declare const _LegacyDocumentScraperMetadataRegistration: Registration;
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/markdown-utils`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _MarkdownScraperRegistration: Registration;
|
|
@@ -19,6 +19,7 @@ export declare const markdownScraperMetadata: import("type-fest/source/readonly-
|
|
|
19
19
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
|
+
* @public exported from `@promptbook/wizzard`
|
|
22
23
|
* @public exported from `@promptbook/cli`
|
|
23
24
|
*/
|
|
24
25
|
export declare const _MarkdownScraperMetadataRegistration: Registration;
|
|
@@ -37,4 +37,5 @@ export declare class PdfScraper implements Converter, Scraper {
|
|
|
37
37
|
* TODO: [👣] Converted pdf documents can act as cached items - there is no need to run conversion each time
|
|
38
38
|
* TODO: [🪂] Do it in parallel 11:11
|
|
39
39
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
40
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
40
41
|
*/
|
|
@@ -12,7 +12,7 @@ export declare const createPdfScraper: ((tools: Pick<ExecutionTools, 'llm'>, opt
|
|
|
12
12
|
className: string;
|
|
13
13
|
mimeTypes: string[];
|
|
14
14
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
15
|
-
isAvilableInBrowser:
|
|
15
|
+
isAvilableInBrowser: false;
|
|
16
16
|
requiredExecutables: never[];
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/pdf`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _PdfScraperRegistration: Registration;
|
|
@@ -10,7 +10,7 @@ export declare const pdfScraperMetadata: import("type-fest/source/readonly-deep"
|
|
|
10
10
|
className: string;
|
|
11
11
|
mimeTypes: string[];
|
|
12
12
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
13
|
-
isAvilableInBrowser:
|
|
13
|
+
isAvilableInBrowser: false;
|
|
14
14
|
requiredExecutables: never[];
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
@@ -19,6 +19,7 @@ export declare const pdfScraperMetadata: import("type-fest/source/readonly-deep"
|
|
|
19
19
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
|
+
* @public exported from `@promptbook/wizzard`
|
|
22
23
|
* @public exported from `@promptbook/cli`
|
|
23
24
|
*/
|
|
24
25
|
export declare const _PdfScraperMetadataRegistration: Registration;
|
|
@@ -12,7 +12,9 @@ export declare const createWebsiteScraper: ((tools: Pick<ExecutionTools, 'llm'>,
|
|
|
12
12
|
className: string;
|
|
13
13
|
mimeTypes: string[];
|
|
14
14
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
15
|
-
isAvilableInBrowser: false;
|
|
15
|
+
isAvilableInBrowser: false; /**
|
|
16
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
17
|
+
*/
|
|
16
18
|
requiredExecutables: never[];
|
|
17
19
|
}>;
|
|
18
20
|
/**
|
|
@@ -5,6 +5,7 @@ import type { Registration } from '../../utils/$Register';
|
|
|
5
5
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/website-crawler`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
8
9
|
* @public exported from `@promptbook/cli`
|
|
9
10
|
*/
|
|
10
11
|
export declare const _WebsiteScraperRegistration: Registration;
|
|
@@ -19,6 +19,7 @@ export declare const websiteScraperMetadata: import("type-fest/source/readonly-d
|
|
|
19
19
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
|
+
* @public exported from `@promptbook/wizzard`
|
|
22
23
|
* @public exported from `@promptbook/cli`
|
|
23
24
|
*/
|
|
24
25
|
export declare const _WebsiteScraperMetadataRegistration: Registration;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export {};
|
|
2
2
|
/**
|
|
3
|
-
* TODO:
|
|
3
|
+
* TODO: Make shared test between JavascriptEvalExecutionTools and JavascriptExecutionTools to test the same functionality when implemented via vm2
|
|
4
4
|
*/
|
|
@@ -9,5 +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: Probbably remove in favour of `keepImported`
|
|
13
|
+
* TODO: [1] This maybe does memory leak
|
|
13
14
|
*/
|
|
@@ -319,6 +319,12 @@ export type string_url = string;
|
|
|
319
319
|
* For example `"https://collboard.com"`
|
|
320
320
|
*/
|
|
321
321
|
export type string_base_url = string;
|
|
322
|
+
/**
|
|
323
|
+
* Semantic helper
|
|
324
|
+
*
|
|
325
|
+
* For example `"https://promptbook.studio/webgpt/"`
|
|
326
|
+
*/
|
|
327
|
+
export type string_pipeline_root_url = string;
|
|
322
328
|
/**
|
|
323
329
|
* Semantic helper
|
|
324
330
|
*
|
|
@@ -623,8 +629,8 @@ export type number_megabytes = number_positive;
|
|
|
623
629
|
export type number_gigabytes = number_positive;
|
|
624
630
|
export type number_terabytes = number_positive;
|
|
625
631
|
/**.
|
|
626
|
-
* TODO: [main]
|
|
627
|
-
* TODO:
|
|
632
|
+
* TODO: [main] !!3 Change "For example" to @example
|
|
633
|
+
* TODO: Change to branded types
|
|
628
634
|
* TODO: Delete type aliases that are not exported or used internally
|
|
629
635
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
630
636
|
*/
|
|
@@ -2,7 +2,7 @@ import type { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Normalizes the markdown by flattening the structure
|
|
4
4
|
*
|
|
5
|
-
* - It always have h1 - if there is no h1 in the markdown, it will be added
|
|
5
|
+
* - It always have h1 - if there is no h1 in the markdown, it will be added `DEFAULT_BOOK_TITLE`
|
|
6
6
|
* - All other headings are normalized to h2
|
|
7
7
|
*
|
|
8
8
|
* @public exported from `@promptbook/markdown-utils`
|
package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { string_html } from '../../types/typeAliases';
|
|
2
2
|
import type { string_markdown } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
|
-
* Removes
|
|
4
|
+
* Removes Markdown (or HTML) comments
|
|
5
5
|
*
|
|
6
6
|
* @param {string} content - The string to remove comments from.
|
|
7
7
|
* @returns {string} The input string with all comments removed.
|
|
8
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function removeMarkdownComments<TContent extends string_html | string_markdown>(content: TContent): TContent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { really_any } from './really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Just says that the variable is not used directlys but should be kept because the existence of the variable is important
|
|
4
|
+
*
|
|
5
|
+
* @param value any values
|
|
6
|
+
* @returns void
|
|
7
|
+
* @private within the repository
|
|
8
|
+
*/
|
|
9
|
+
export declare function $sideEffect(...sideEffectSubjects: ReadonlyArray<really_any>): void;
|
|
@@ -40,6 +40,6 @@ export type CheckSerializableAsJsonOptions = {
|
|
|
40
40
|
export declare function checkSerializableAsJson(options: CheckSerializableAsJsonOptions): void;
|
|
41
41
|
/**
|
|
42
42
|
* TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
|
|
43
|
-
* TODO: [🧠][main]
|
|
43
|
+
* TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
|
|
44
44
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
45
45
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonValue } from 'type-fest';
|
|
1
|
+
import type { JsonValue } from 'type-fest';
|
|
2
2
|
/**
|
|
3
3
|
* Tests if the value is [🚉] serializable as JSON
|
|
4
4
|
*
|
|
@@ -20,6 +20,6 @@ import { JsonValue } from 'type-fest';
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function isSerializableAsJson(value: unknown): value is JsonValue;
|
|
22
22
|
/**
|
|
23
|
-
* TODO: [🧠][main]
|
|
23
|
+
* TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
|
|
24
24
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
25
25
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { string_dirname } from '../../../types/typeAliases';
|
|
2
|
+
import type { string_filename } from '../../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Determines if the given path is a root path.
|
|
5
|
+
*
|
|
6
|
+
* Note: This does not check if the file exists only if the path is valid
|
|
7
|
+
* @public exported from `@promptbook/utils`
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRootPath(value: string_dirname | string_filename): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🍏] Make for MacOS paths
|
|
12
|
+
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
2
|
+
import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
3
|
+
import type { PipelineString } from '../pipeline/PipelineString';
|
|
4
|
+
import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
|
|
5
|
+
import type { string_filename } from '../types/typeAliases';
|
|
6
|
+
import type { string_pipeline_url } from '../types/typeAliases';
|
|
7
|
+
/**
|
|
8
|
+
* @see ./wizzard.ts `getPipeline` method
|
|
9
|
+
*
|
|
10
|
+
* @private usable through `ptbk run` and `@prompbook/wizzard`
|
|
11
|
+
*/
|
|
12
|
+
export declare function $getCompiledBook(tools: Required<Pick<ExecutionTools, 'fs' | 'fetch'>>, pipelineSource: string_filename | string_pipeline_url | PipelineString, options?: PrepareAndScrapeOptions): Promise<PipelineJson>;
|
|
13
|
+
/**
|
|
14
|
+
* TODO: Write unit test
|
|
15
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
16
|
+
*/
|