@promptbook/markdown-utils 0.101.0-2 β 0.101.0-20
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 +87 -1
- package/esm/index.es.js +48 -41
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +20 -0
- package/esm/typings/src/_packages/core.index.d.ts +14 -0
- package/esm/typings/src/_packages/types.index.d.ts +14 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -22
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -26
- package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +59 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +45 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +47 -0
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +62 -0
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +31 -4
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +20 -2
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +2 -2
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +63 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +15 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +26 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/hooks/index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +41 -0
- package/esm/typings/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +44 -0
- package/esm/typings/src/book-components/Chat/utils/parseMessageButtons.d.ts +22 -0
- package/esm/typings/src/book-components/icons/PauseIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/PlayIcon.d.ts +8 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -2
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +1 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +1 -1
- 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/$provideLlmToolsForWizardOrCli.d.ts +1 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +8 -2
- package/esm/typings/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +25 -0
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +5 -13
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +11 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +54 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +29 -0
- package/esm/typings/src/llm-providers/agent/playground/playground.d.ts +8 -0
- package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +13 -0
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -5
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -6
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +15 -8
- package/esm/typings/src/personas/preparePersona.d.ts +1 -0
- package/esm/typings/src/remote-server/openapi-types.d.ts +31 -31
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -4
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +48 -41
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +0 -17
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +0 -12
- package/esm/typings/src/llm-providers/mocked/test/joker.test.d.ts +0 -4
- package/esm/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -5
- package/esm/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -4
- package/esm/typings/src/scripting/_test/postprocessing.test.d.ts +0 -1
- /package/esm/typings/src/{cli/test/ptbk.test.d.ts β llm-providers/_common/utils/removeUnsupportedModelRequirements.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -48,7 +48,93 @@ npm i ptbk
|
|
|
48
48
|
npm install @promptbook/markdown-utils
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Comprehensive markdown processing utilities for the Promptbook ecosystem, providing tools for parsing, manipulating, and extracting content from markdown documents.
|
|
52
|
+
|
|
53
|
+
## π― Purpose and Motivation
|
|
54
|
+
|
|
55
|
+
This package provides specialized markdown processing capabilities that are essential for working with promptbooks and LLM-generated content. It handles markdown parsing, content extraction, text humanization, and various markdown transformations that are commonly needed when processing AI-generated text and promptbook documentation.
|
|
56
|
+
|
|
57
|
+
## π§ High-Level Functionality
|
|
58
|
+
|
|
59
|
+
The package offers comprehensive markdown processing capabilities:
|
|
60
|
+
|
|
61
|
+
- **Content Extraction**: Extract code blocks, lists, and sections from markdown
|
|
62
|
+
- **Text Processing**: Parse and manipulate markdown sections and content
|
|
63
|
+
- **AI Text Humanization**: Transform AI-generated text to be more human-readable
|
|
64
|
+
- **Markdown Manipulation**: Add, remove, and modify markdown formatting
|
|
65
|
+
- **Table and Chart Creation**: Generate markdown tables and charts
|
|
66
|
+
- **Scraping Integration**: Markdown-specific content scraping capabilities
|
|
67
|
+
|
|
68
|
+
## β¨ Key Features
|
|
69
|
+
|
|
70
|
+
- π **Content Extraction** - Extract blocks, lists, and sections from markdown documents
|
|
71
|
+
- π¨ **Text Humanization** - Transform AI text with proper quotes, ellipsis, and formatting
|
|
72
|
+
- π§ **Markdown Manipulation** - Add, remove, and modify markdown formatting
|
|
73
|
+
- π **Table Generation** - Create formatted markdown tables and charts
|
|
74
|
+
- π§Ή **Content Cleaning** - Remove comments, links, and unwanted formatting
|
|
75
|
+
- π **Section Parsing** - Parse and split markdown into structured sections
|
|
76
|
+
- π **Block Processing** - Extract and process code blocks and content blocks
|
|
77
|
+
- π€ **AI Integration** - Specialized tools for processing LLM-generated markdown
|
|
78
|
+
|
|
79
|
+
## π¦ Exported Entities
|
|
80
|
+
|
|
81
|
+
### Version Information
|
|
82
|
+
|
|
83
|
+
- `BOOK_LANGUAGE_VERSION` - Current book language version
|
|
84
|
+
- `PROMPTBOOK_ENGINE_VERSION` - Current engine version
|
|
85
|
+
|
|
86
|
+
### Content Extraction
|
|
87
|
+
|
|
88
|
+
- `extractBlock` - Extract specific blocks from content
|
|
89
|
+
- `extractJsonBlock` - Extract JSON blocks from content
|
|
90
|
+
- `extractAllBlocksFromMarkdown` - Extract all code blocks from markdown
|
|
91
|
+
- `extractAllListItemsFromMarkdown` - Extract all list items from markdown
|
|
92
|
+
- `extractOneBlockFromMarkdown` - Extract single code block from markdown
|
|
93
|
+
|
|
94
|
+
### Markdown Scraping
|
|
95
|
+
|
|
96
|
+
- `createMarkdownScraper` - Create markdown content scraper
|
|
97
|
+
- `MarkdownScraper` - Markdown scraper class
|
|
98
|
+
- `_MarkdownScraperRegistration` - Markdown scraper registration
|
|
99
|
+
|
|
100
|
+
### Type Definitions
|
|
101
|
+
|
|
102
|
+
- `string_markdown` - Markdown string type (type)
|
|
103
|
+
- `string_markdown_section` - Markdown section string type (type)
|
|
104
|
+
- `string_markdown_section_content` - Markdown section content type (type)
|
|
105
|
+
- `string_markdown_text` - Markdown text string type (type)
|
|
106
|
+
- `string_markdown_codeblock_language` - Markdown code block language type (type)
|
|
107
|
+
- `MarkdownSection` - Markdown section structure (type)
|
|
108
|
+
|
|
109
|
+
### Content Generation
|
|
110
|
+
|
|
111
|
+
- `addAutoGeneratedSection` - Add auto-generated sections to markdown
|
|
112
|
+
- `createMarkdownChart` - Create markdown charts and diagrams
|
|
113
|
+
- `createMarkdownTable` - Create formatted markdown tables
|
|
114
|
+
|
|
115
|
+
### Text Processing
|
|
116
|
+
|
|
117
|
+
- `escapeMarkdownBlock` - Escape markdown block content
|
|
118
|
+
- `flattenMarkdown` - Flatten markdown structure
|
|
119
|
+
- `parseMarkdownSection` - Parse markdown into sections
|
|
120
|
+
- `splitMarkdownIntoSections` - Split markdown into structured sections
|
|
121
|
+
|
|
122
|
+
### AI Text Humanization
|
|
123
|
+
|
|
124
|
+
- `humanizeAiText` - Comprehensive AI text humanization
|
|
125
|
+
- `humanizeAiTextEllipsis` - Fix ellipsis formatting in AI text
|
|
126
|
+
- `humanizeAiTextEmdashed` - Fix em-dash formatting in AI text
|
|
127
|
+
- `humanizeAiTextQuotes` - Fix quote formatting in AI text
|
|
128
|
+
- `humanizeAiTextWhitespace` - Fix whitespace in AI text
|
|
129
|
+
- `promptbookifyAiText` - Transform AI text for promptbook format
|
|
130
|
+
|
|
131
|
+
### Content Cleaning
|
|
132
|
+
|
|
133
|
+
- `removeMarkdownComments` - Remove comments from markdown
|
|
134
|
+
- `removeMarkdownFormatting` - Remove markdown formatting
|
|
135
|
+
- `removeMarkdownLinks` - Remove links from markdown
|
|
136
|
+
|
|
137
|
+
> π‘ This package provides markdown processing utilities for promptbook applications. For the core functionality, see [@promptbook/core](#-packages) or install all packages with `npm i ptbk`
|
|
52
138
|
|
|
53
139
|
|
|
54
140
|
---
|
package/esm/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-20';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -2625,6 +2625,25 @@ function countUsage(llmTools) {
|
|
|
2625
2625
|
* TODO: [π·ββοΈ] @@@ Manual about construction of llmTools
|
|
2626
2626
|
*/
|
|
2627
2627
|
|
|
2628
|
+
/**
|
|
2629
|
+
* Takes an item or an array of items and returns an array of items
|
|
2630
|
+
*
|
|
2631
|
+
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
2632
|
+
* 2) Undefined returns empty array
|
|
2633
|
+
* 3) Array returns itself
|
|
2634
|
+
*
|
|
2635
|
+
* @private internal utility
|
|
2636
|
+
*/
|
|
2637
|
+
function arrayableToArray(input) {
|
|
2638
|
+
if (input === undefined) {
|
|
2639
|
+
return [];
|
|
2640
|
+
}
|
|
2641
|
+
if (input instanceof Array) {
|
|
2642
|
+
return input;
|
|
2643
|
+
}
|
|
2644
|
+
return [input];
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2628
2647
|
/**
|
|
2629
2648
|
* Predefined profiles for LLM providers to maintain consistency across the application
|
|
2630
2649
|
* These profiles represent each provider as a virtual persona in chat interfaces
|
|
@@ -2705,12 +2724,10 @@ class MultipleLlmExecutionTools {
|
|
|
2705
2724
|
/**
|
|
2706
2725
|
* Gets array of execution tools in order of priority
|
|
2707
2726
|
*/
|
|
2708
|
-
constructor(...llmExecutionTools) {
|
|
2727
|
+
constructor(title, ...llmExecutionTools) {
|
|
2728
|
+
this.title = title;
|
|
2709
2729
|
this.llmExecutionTools = llmExecutionTools;
|
|
2710
2730
|
}
|
|
2711
|
-
get title() {
|
|
2712
|
-
return 'Multiple LLM Providers';
|
|
2713
|
-
}
|
|
2714
2731
|
get description() {
|
|
2715
2732
|
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
2716
2733
|
.map(({ title, description }, index) => {
|
|
@@ -2796,7 +2813,7 @@ class MultipleLlmExecutionTools {
|
|
|
2796
2813
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
2797
2814
|
// <- case [π€]:
|
|
2798
2815
|
default:
|
|
2799
|
-
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}"`);
|
|
2816
|
+
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
2800
2817
|
}
|
|
2801
2818
|
}
|
|
2802
2819
|
catch (error) {
|
|
@@ -2817,7 +2834,7 @@ class MultipleLlmExecutionTools {
|
|
|
2817
2834
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2818
2835
|
// 3) ...
|
|
2819
2836
|
spaceTrim((block) => `
|
|
2820
|
-
All execution tools failed:
|
|
2837
|
+
All execution tools of ${this.title} failed:
|
|
2821
2838
|
|
|
2822
2839
|
${block(errors
|
|
2823
2840
|
.map(({ error, llmExecutionTools }, i) => `${i + 1}) **${llmExecutionTools.title}** thrown **${error.name || 'Error'}:** ${error.message}`)
|
|
@@ -2826,11 +2843,11 @@ class MultipleLlmExecutionTools {
|
|
|
2826
2843
|
`));
|
|
2827
2844
|
}
|
|
2828
2845
|
else if (this.llmExecutionTools.length === 0) {
|
|
2829
|
-
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools
|
|
2846
|
+
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
2830
2847
|
}
|
|
2831
2848
|
else {
|
|
2832
2849
|
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
2833
|
-
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}"
|
|
2850
|
+
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
2834
2851
|
|
|
2835
2852
|
Available \`LlmExecutionTools\`:
|
|
2836
2853
|
${block(this.description)}
|
|
@@ -2860,7 +2877,7 @@ class MultipleLlmExecutionTools {
|
|
|
2860
2877
|
*
|
|
2861
2878
|
* @public exported from `@promptbook/core`
|
|
2862
2879
|
*/
|
|
2863
|
-
function joinLlmExecutionTools(...llmExecutionTools) {
|
|
2880
|
+
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
2864
2881
|
if (llmExecutionTools.length === 0) {
|
|
2865
2882
|
const warningMessage = spaceTrim(`
|
|
2866
2883
|
You have not provided any \`LlmExecutionTools\`
|
|
@@ -2892,30 +2909,27 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
2892
2909
|
};
|
|
2893
2910
|
*/
|
|
2894
2911
|
}
|
|
2895
|
-
return new MultipleLlmExecutionTools(...llmExecutionTools);
|
|
2912
|
+
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
2896
2913
|
}
|
|
2897
2914
|
/**
|
|
2898
2915
|
* TODO: [π·ββοΈ] @@@ Manual about construction of llmTools
|
|
2899
2916
|
*/
|
|
2900
2917
|
|
|
2901
2918
|
/**
|
|
2902
|
-
*
|
|
2903
|
-
*
|
|
2904
|
-
* 1) Any item except array and undefined returns array with that one item (also null)
|
|
2905
|
-
* 2) Undefined returns empty array
|
|
2906
|
-
* 3) Array returns itself
|
|
2919
|
+
* Just returns the given `LlmExecutionTools` or joins multiple into one
|
|
2907
2920
|
*
|
|
2908
|
-
* @
|
|
2921
|
+
* @public exported from `@promptbook/core`
|
|
2909
2922
|
*/
|
|
2910
|
-
function
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
}
|
|
2917
|
-
return [input];
|
|
2923
|
+
function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
2924
|
+
const _llms = arrayableToArray(oneOrMoreLlmExecutionTools);
|
|
2925
|
+
const llmTools = _llms.length === 1
|
|
2926
|
+
? _llms[0]
|
|
2927
|
+
: joinLlmExecutionTools('Multiple LLM Providers joined by `getSingleLlmExecutionTools`', ..._llms);
|
|
2928
|
+
return llmTools;
|
|
2918
2929
|
}
|
|
2930
|
+
/**
|
|
2931
|
+
* TODO: [π·ββοΈ] @@@ Manual about construction of llmTools
|
|
2932
|
+
*/
|
|
2919
2933
|
|
|
2920
2934
|
/**
|
|
2921
2935
|
* Prepares the persona for the pipeline
|
|
@@ -2934,8 +2948,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
2934
2948
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
2935
2949
|
tools,
|
|
2936
2950
|
});
|
|
2937
|
-
const
|
|
2938
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
2951
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
2939
2952
|
const availableModels = (await llmTools.listModels())
|
|
2940
2953
|
.filter(({ modelVariant }) => modelVariant === 'CHAT')
|
|
2941
2954
|
.map(({ modelName, modelDescription }) => ({
|
|
@@ -2979,6 +2992,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
2979
2992
|
};
|
|
2980
2993
|
}
|
|
2981
2994
|
/**
|
|
2995
|
+
* TODO: [π©] DRY `preparePersona` and `selectBestModelFromAvailable`
|
|
2982
2996
|
* TODO: [π][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
2983
2997
|
* TODO: [π’] Check validity of `modelName` in pipeline
|
|
2984
2998
|
* TODO: [π’] Check validity of `systemMessage` in pipeline
|
|
@@ -4097,9 +4111,7 @@ async function preparePipeline(pipeline, tools, options) {
|
|
|
4097
4111
|
if (tools === undefined || tools.llm === undefined) {
|
|
4098
4112
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
4099
4113
|
}
|
|
4100
|
-
|
|
4101
|
-
const _llms = arrayableToArray(tools.llm);
|
|
4102
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
4114
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
4103
4115
|
const llmToolsWithUsage = countUsage(llmTools);
|
|
4104
4116
|
// <- TODO: [π―]
|
|
4105
4117
|
/*
|
|
@@ -5140,9 +5152,7 @@ async function executeAttempts(options) {
|
|
|
5140
5152
|
$scriptPipelineExecutionErrors: [],
|
|
5141
5153
|
$failedResults: [], // Track all failed attempts
|
|
5142
5154
|
};
|
|
5143
|
-
|
|
5144
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5145
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5155
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5146
5156
|
attempts: for (let attemptIndex = -jokerParameterNames.length; attemptIndex < maxAttempts; attemptIndex++) {
|
|
5147
5157
|
const isJokerAttempt = attemptIndex < 0;
|
|
5148
5158
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
@@ -5662,9 +5672,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5662
5672
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5663
5673
|
}
|
|
5664
5674
|
try {
|
|
5665
|
-
|
|
5666
|
-
const _llms = arrayableToArray(tools.llm);
|
|
5667
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5675
|
+
const llmTools = getSingleLlmExecutionTools(tools.llm);
|
|
5668
5676
|
const taskEmbeddingPrompt = {
|
|
5669
5677
|
title: 'Knowledge Search',
|
|
5670
5678
|
modelRequirements: {
|
|
@@ -6265,13 +6273,13 @@ function createPipelineExecutor(options) {
|
|
|
6265
6273
|
// Calculate and update tldr based on pipeline progress
|
|
6266
6274
|
const cv = newOngoingResult;
|
|
6267
6275
|
// Calculate progress based on parameters resolved vs total parameters
|
|
6268
|
-
const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
|
|
6276
|
+
const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
|
|
6269
6277
|
let resolvedParameters = 0;
|
|
6270
6278
|
let currentTaskTitle = '';
|
|
6271
6279
|
// Get the resolved parameters from output parameters
|
|
6272
6280
|
if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
|
|
6273
6281
|
// Count how many output parameters have non-empty values
|
|
6274
|
-
resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6282
|
+
resolvedParameters = Object.values(cv.outputParameters).filter((value) => value !== undefined && value !== null && String(value).trim() !== '').length;
|
|
6275
6283
|
}
|
|
6276
6284
|
// Try to determine current task from execution report
|
|
6277
6285
|
if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
|
|
@@ -6381,9 +6389,7 @@ class MarkdownScraper {
|
|
|
6381
6389
|
throw new MissingToolsError('LLM tools are required for scraping external files');
|
|
6382
6390
|
// <- Note: This scraper is used in all other scrapers, so saying "external files" not "markdown files"
|
|
6383
6391
|
}
|
|
6384
|
-
|
|
6385
|
-
const _llms = arrayableToArray(llm);
|
|
6386
|
-
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
6392
|
+
const llmTools = getSingleLlmExecutionTools(llm);
|
|
6387
6393
|
// TODO: [πΌ] In future use `ptbk make` and made getPipelineCollection
|
|
6388
6394
|
const collection = createCollectionFromJson(...PipelineCollection);
|
|
6389
6395
|
const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
|
|
@@ -6885,6 +6891,7 @@ function humanizeAiText(aiText) {
|
|
|
6885
6891
|
return cleanedText;
|
|
6886
6892
|
}
|
|
6887
6893
|
/**
|
|
6894
|
+
* TODO: [π§ ] Maybe this should be exported from `@promptbook/utils` not `@promptbook/markdown-utils`
|
|
6888
6895
|
* TODO: [π
ΎοΈ] !!! Use this across the project where AI text is involved
|
|
6889
6896
|
*/
|
|
6890
6897
|
|