@promptbook/node 0.92.0-20 β 0.92.0-22
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/esm/index.es.js +99 -45
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/config.d.ts +8 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +8 -1
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +11 -1
- package/esm/typings/src/formats/json/utils/jsonParse.d.ts +0 -3
- package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +29 -0
- package/esm/typings/src/formfactors/index.d.ts +28 -3
- package/esm/typings/src/high-level-abstractions/index.d.ts +2 -2
- package/esm/typings/src/migrations/migratePipeline.d.ts +2 -0
- package/package.json +2 -2
- package/umd/index.umd.js +99 -45
- package/umd/index.umd.js.map +1 -1
|
@@ -32,6 +32,7 @@ import { DEFAULT_IS_VERBOSE } from '../config';
|
|
|
32
32
|
import { SET_IS_VERBOSE } from '../config';
|
|
33
33
|
import { DEFAULT_IS_AUTO_INSTALLED } from '../config';
|
|
34
34
|
import { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME } from '../config';
|
|
35
|
+
import { DEFAULT_RPM } from '../config';
|
|
35
36
|
import { ORDER_OF_PIPELINE_JSON } from '../constants';
|
|
36
37
|
import { RESERVED_PARAMETER_NAMES } from '../constants';
|
|
37
38
|
import { compilePipeline } from '../conversion/compilePipeline';
|
|
@@ -81,6 +82,7 @@ import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings';
|
|
|
81
82
|
import { TextFormatParser } from '../formats/text/TextFormatParser';
|
|
82
83
|
import { BoilerplateFormfactorDefinition } from '../formfactors/_boilerplate/BoilerplateFormfactorDefinition';
|
|
83
84
|
import { ChatbotFormfactorDefinition } from '../formfactors/chatbot/ChatbotFormfactorDefinition';
|
|
85
|
+
import { CompletionFormfactorDefinition } from '../formfactors/completion/CompletionFormfactorDefinition';
|
|
84
86
|
import { GeneratorFormfactorDefinition } from '../formfactors/generator/GeneratorFormfactorDefinition';
|
|
85
87
|
import { GenericFormfactorDefinition } from '../formfactors/generic/GenericFormfactorDefinition';
|
|
86
88
|
import { ImageGeneratorFormfactorDefinition } from '../formfactors/image-generator/ImageGeneratorFormfactorDefinition';
|
|
@@ -175,6 +177,7 @@ export { DEFAULT_IS_VERBOSE };
|
|
|
175
177
|
export { SET_IS_VERBOSE };
|
|
176
178
|
export { DEFAULT_IS_AUTO_INSTALLED };
|
|
177
179
|
export { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME };
|
|
180
|
+
export { DEFAULT_RPM };
|
|
178
181
|
export { ORDER_OF_PIPELINE_JSON };
|
|
179
182
|
export { RESERVED_PARAMETER_NAMES };
|
|
180
183
|
export { compilePipeline };
|
|
@@ -224,6 +227,7 @@ export { MANDATORY_CSV_SETTINGS };
|
|
|
224
227
|
export { TextFormatParser };
|
|
225
228
|
export { BoilerplateFormfactorDefinition };
|
|
226
229
|
export { ChatbotFormfactorDefinition };
|
|
230
|
+
export { CompletionFormfactorDefinition };
|
|
227
231
|
export { GeneratorFormfactorDefinition };
|
|
228
232
|
export { GenericFormfactorDefinition };
|
|
229
233
|
export { ImageGeneratorFormfactorDefinition };
|
|
@@ -62,6 +62,7 @@ import type { UsageCounts } from '../execution/Usage';
|
|
|
62
62
|
import type { UserInterfaceTools } from '../execution/UserInterfaceTools';
|
|
63
63
|
import type { UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
|
|
64
64
|
import type { FormatSubvalueParser } from '../formats/_common/FormatSubvalueParser';
|
|
65
|
+
import type { FormatSubvalueParserMapValuesOptions } from '../formats/_common/FormatSubvalueParser';
|
|
65
66
|
import type { CsvSettings } from '../formats/csv/CsvSettings';
|
|
66
67
|
import type { AbstractFormfactorDefinition } from '../formfactors/_common/AbstractFormfactorDefinition';
|
|
67
68
|
import type { FormfactorDefinition } from '../formfactors/_common/FormfactorDefinition';
|
|
@@ -358,6 +359,7 @@ export type { UsageCounts };
|
|
|
358
359
|
export type { UserInterfaceTools };
|
|
359
360
|
export type { UserInterfaceToolsPromptDialogOptions };
|
|
360
361
|
export type { FormatSubvalueParser };
|
|
362
|
+
export type { FormatSubvalueParserMapValuesOptions };
|
|
361
363
|
export type { CsvSettings };
|
|
362
364
|
export type { AbstractFormfactorDefinition };
|
|
363
365
|
export type { FormfactorDefinition };
|
|
@@ -265,6 +265,14 @@ export declare const DEFAULT_IS_AUTO_INSTALLED = false;
|
|
|
265
265
|
* @public exported from `@promptbook/core`
|
|
266
266
|
*/
|
|
267
267
|
export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelineCollection";
|
|
268
|
+
/**
|
|
269
|
+
* Default rate limits (requests per minute)
|
|
270
|
+
*
|
|
271
|
+
* Note: Adjust based on the provider tier you are have
|
|
272
|
+
*
|
|
273
|
+
* @public exported from `@promptbook/core`
|
|
274
|
+
*/
|
|
275
|
+
export declare const DEFAULT_RPM = 60;
|
|
268
276
|
/**
|
|
269
277
|
* @@@
|
|
270
278
|
*
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import type { PartialDeep, Promisable } from 'type-fest';
|
|
1
2
|
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
3
|
+
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
2
4
|
import type { ExecuteAttemptsOptions } from './40-executeAttempts';
|
|
3
5
|
/**
|
|
4
6
|
* @@@
|
|
5
7
|
*
|
|
6
8
|
* @private internal type of `executeFormatSubvalues`
|
|
7
9
|
*/
|
|
8
|
-
type ExecuteFormatCellsOptions = ExecuteAttemptsOptions
|
|
10
|
+
type ExecuteFormatCellsOptions = ExecuteAttemptsOptions & {
|
|
11
|
+
/**
|
|
12
|
+
* @@@
|
|
13
|
+
*/
|
|
14
|
+
readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
|
|
15
|
+
};
|
|
9
16
|
/**
|
|
10
17
|
* @@@
|
|
11
18
|
*
|
|
@@ -24,7 +24,17 @@ export type FormatSubvalueParser<TValue extends string, TSettings extends empty_
|
|
|
24
24
|
* For example, if you have a JSON object and you want to map all values to uppercase
|
|
25
25
|
* Or iterate over all CSV cells @@@
|
|
26
26
|
*/
|
|
27
|
-
mapValues(
|
|
27
|
+
mapValues(options: FormatSubvalueParserMapValuesOptions<TValue, TSettings>): Promise<string>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @@@
|
|
31
|
+
*/
|
|
32
|
+
export type FormatSubvalueParserMapValuesOptions<TValue extends string, TSettings extends empty_object> = {
|
|
33
|
+
readonly value: TValue;
|
|
34
|
+
readonly outputParameterName: string_parameter_name;
|
|
35
|
+
readonly settings: TSettings;
|
|
36
|
+
mapCallback: (subvalues: Parameters, index: number) => Promisable<TValue>;
|
|
37
|
+
onProgress(partialResultString: TValue): Promisable<void>;
|
|
28
38
|
};
|
|
29
39
|
/**
|
|
30
40
|
* Note: [π©πΎβπ€βπ§π½]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion is formfactor that emulates completion models
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const CompletionFormfactorDefinition: {
|
|
7
|
+
readonly name: "COMPLETION";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameters: readonly [{
|
|
12
|
+
readonly name: "inputText";
|
|
13
|
+
readonly description: "Input text to be completed";
|
|
14
|
+
readonly isInput: true;
|
|
15
|
+
readonly isOutput: false;
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "instructions";
|
|
18
|
+
readonly description: "Additional instructions for the model, for example the required length, empty by default";
|
|
19
|
+
readonly isInput: true;
|
|
20
|
+
readonly isOutput: false;
|
|
21
|
+
}];
|
|
22
|
+
readonly outputParameters: readonly [{
|
|
23
|
+
readonly name: "followingText";
|
|
24
|
+
readonly description: "Text that follows the input text";
|
|
25
|
+
readonly isInput: false;
|
|
26
|
+
readonly isOutput: true;
|
|
27
|
+
}];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -36,9 +36,6 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
36
36
|
readonly outputParameters: readonly [{
|
|
37
37
|
readonly name: "title";
|
|
38
38
|
readonly description: "Title of the conversation";
|
|
39
|
-
/**
|
|
40
|
-
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
41
|
-
*/
|
|
42
39
|
readonly isInput: false;
|
|
43
40
|
readonly isOutput: true;
|
|
44
41
|
}, {
|
|
@@ -132,6 +129,11 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
132
129
|
readonly isInput: true;
|
|
133
130
|
readonly isOutput: false;
|
|
134
131
|
}];
|
|
132
|
+
/**
|
|
133
|
+
* All available formfactor definitions
|
|
134
|
+
*
|
|
135
|
+
* @public exported from `@promptbook/core`
|
|
136
|
+
*/
|
|
135
137
|
readonly outputParameters: readonly [{
|
|
136
138
|
readonly name: "prompt";
|
|
137
139
|
readonly description: "Prompt to be used for image generation";
|
|
@@ -139,6 +141,29 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
139
141
|
readonly isOutput: true;
|
|
140
142
|
}];
|
|
141
143
|
};
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "COMPLETION";
|
|
146
|
+
readonly description: "@@@";
|
|
147
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
148
|
+
readonly pipelineInterface: {
|
|
149
|
+
readonly inputParameters: readonly [{
|
|
150
|
+
readonly name: "inputText";
|
|
151
|
+
readonly description: "Input text to be completed";
|
|
152
|
+
readonly isInput: true;
|
|
153
|
+
readonly isOutput: false;
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "instructions";
|
|
156
|
+
readonly description: "Additional instructions for the model, for example the required length, empty by default";
|
|
157
|
+
readonly isInput: true;
|
|
158
|
+
readonly isOutput: false;
|
|
159
|
+
}];
|
|
160
|
+
readonly outputParameters: readonly [{
|
|
161
|
+
readonly name: "followingText";
|
|
162
|
+
readonly description: "Text that follows the input text";
|
|
163
|
+
readonly isInput: false;
|
|
164
|
+
readonly isOutput: true;
|
|
165
|
+
}];
|
|
166
|
+
};
|
|
142
167
|
}];
|
|
143
168
|
/**
|
|
144
169
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -23,7 +23,7 @@ export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
|
|
|
23
23
|
path: string | null;
|
|
24
24
|
content: import("../pipeline/PipelineString").PipelineString;
|
|
25
25
|
}[];
|
|
26
|
-
readonly formfactorName?: "CHATBOT" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
26
|
+
readonly formfactorName?: "CHATBOT" | "COMPLETION" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
27
27
|
}>): void;
|
|
28
28
|
}, {
|
|
29
29
|
type: "SYNC";
|
|
@@ -45,7 +45,7 @@ export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
|
|
|
45
45
|
path: string | null;
|
|
46
46
|
content: import("../pipeline/PipelineString").PipelineString;
|
|
47
47
|
}[];
|
|
48
|
-
readonly formfactorName?: "CHATBOT" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
48
|
+
readonly formfactorName?: "CHATBOT" | "COMPLETION" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
|
|
49
49
|
}>): void;
|
|
50
50
|
}];
|
|
51
51
|
/**
|
|
@@ -2,6 +2,8 @@ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
|
2
2
|
/**
|
|
3
3
|
* Migrates the pipeline to the latest version
|
|
4
4
|
*
|
|
5
|
+
* Note: Migration does not do heavy lifting like calling the LLMs, just lightweight changes of the structure
|
|
6
|
+
*
|
|
5
7
|
* @public exported from `@promptbook/core`
|
|
6
8
|
*/
|
|
7
9
|
export declare function migratePipeline(deprecatedPipeline: PipelineJson): PipelineJson;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.92.0-
|
|
3
|
+
"version": "0.92.0-22",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
52
52
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.92.0-
|
|
54
|
+
"@promptbook/core": "0.92.0-22"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* @generated
|
|
47
47
|
* @see https://github.com/webgptorg/promptbook
|
|
48
48
|
*/
|
|
49
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
49
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-22';
|
|
50
50
|
/**
|
|
51
51
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
52
52
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -344,15 +344,12 @@
|
|
|
344
344
|
}
|
|
345
345
|
throw new Error(spaceTrim__default["default"]((block) => `
|
|
346
346
|
${block(error.message)}
|
|
347
|
-
|
|
347
|
+
|
|
348
348
|
The JSON text:
|
|
349
349
|
${block(value)}
|
|
350
350
|
`));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
/**
|
|
354
|
-
* TODO: !!!! Use in Promptbook.studio
|
|
355
|
-
*/
|
|
356
353
|
|
|
357
354
|
/**
|
|
358
355
|
* Orders JSON object by keys
|
|
@@ -2604,7 +2601,8 @@
|
|
|
2604
2601
|
subvalueParsers: [
|
|
2605
2602
|
{
|
|
2606
2603
|
subvalueName: 'ROW',
|
|
2607
|
-
async mapValues(
|
|
2604
|
+
async mapValues(options) {
|
|
2605
|
+
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
2608
2606
|
const csv = csvParse(value, settings);
|
|
2609
2607
|
if (csv.errors.length !== 0) {
|
|
2610
2608
|
throw new CsvFormatError(spaceTrim__default["default"]((block) => `
|
|
@@ -2620,21 +2618,29 @@
|
|
|
2620
2618
|
${block(value)}
|
|
2621
2619
|
`));
|
|
2622
2620
|
}
|
|
2623
|
-
const mappedData =
|
|
2621
|
+
const mappedData = [];
|
|
2622
|
+
for (let index = 0; index < csv.data.length; index++) {
|
|
2623
|
+
const row = csv.data[index];
|
|
2624
2624
|
if (row[outputParameterName]) {
|
|
2625
2625
|
throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2627
|
+
const mappedRow = {
|
|
2628
2628
|
...row,
|
|
2629
2629
|
[outputParameterName]: await mapCallback(row, index),
|
|
2630
2630
|
};
|
|
2631
|
-
|
|
2631
|
+
mappedData.push(mappedRow);
|
|
2632
|
+
if (onProgress) {
|
|
2633
|
+
// Note: Report the CSV with all rows mapped so far
|
|
2634
|
+
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2632
2637
|
return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
|
|
2633
2638
|
},
|
|
2634
2639
|
},
|
|
2635
2640
|
{
|
|
2636
2641
|
subvalueName: 'CELL',
|
|
2637
|
-
async mapValues(
|
|
2642
|
+
async mapValues(options) {
|
|
2643
|
+
const { value, settings, mapCallback, onProgress } = options;
|
|
2638
2644
|
const csv = csvParse(value, settings);
|
|
2639
2645
|
if (csv.errors.length !== 0) {
|
|
2640
2646
|
throw new CsvFormatError(spaceTrim__default["default"]((block) => `
|
|
@@ -2721,7 +2727,8 @@
|
|
|
2721
2727
|
subvalueParsers: [
|
|
2722
2728
|
{
|
|
2723
2729
|
subvalueName: 'LINE',
|
|
2724
|
-
async mapValues(
|
|
2730
|
+
async mapValues(options) {
|
|
2731
|
+
const { value, mapCallback, onProgress } = options;
|
|
2725
2732
|
const lines = value.split('\n');
|
|
2726
2733
|
const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
|
|
2727
2734
|
// TODO: [π§ ] Maybe option to skip empty line
|
|
@@ -4031,7 +4038,7 @@
|
|
|
4031
4038
|
* @private internal utility of `createPipelineExecutor`
|
|
4032
4039
|
*/
|
|
4033
4040
|
async function executeFormatSubvalues(options) {
|
|
4034
|
-
const { task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification } = options;
|
|
4041
|
+
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
|
|
4035
4042
|
if (task.foreach === undefined) {
|
|
4036
4043
|
return /* not await */ executeAttempts(options);
|
|
4037
4044
|
}
|
|
@@ -4085,21 +4092,32 @@
|
|
|
4085
4092
|
formatSettings = csvSettings;
|
|
4086
4093
|
// <- TODO: [π€ΉββοΈ] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4087
4094
|
}
|
|
4088
|
-
const resultString = await subvalueParser.mapValues(
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4095
|
+
const resultString = await subvalueParser.mapValues({
|
|
4096
|
+
value: parameterValue,
|
|
4097
|
+
outputParameterName: task.foreach.outputSubparameterName,
|
|
4098
|
+
settings: formatSettings,
|
|
4099
|
+
onProgress(partialResultString) {
|
|
4100
|
+
return onProgress(Object.freeze({
|
|
4101
|
+
[task.resultingParameterName]:
|
|
4102
|
+
// <- Note: [π©βπ©βπ§] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
4103
|
+
partialResultString,
|
|
4104
|
+
}));
|
|
4105
|
+
},
|
|
4106
|
+
async mapCallback(subparameters, index) {
|
|
4107
|
+
let mappedParameters;
|
|
4108
|
+
// TODO: [π€ΉββοΈ][πͺ] Limit to N concurrent executions
|
|
4109
|
+
// TODO: When done [π] Report progress also for each subvalue here
|
|
4110
|
+
try {
|
|
4111
|
+
mappedParameters = mapAvailableToExpectedParameters({
|
|
4112
|
+
expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map((subparameterName) => [subparameterName, null])),
|
|
4113
|
+
availableParameters: subparameters,
|
|
4114
|
+
});
|
|
4101
4115
|
}
|
|
4102
|
-
|
|
4116
|
+
catch (error) {
|
|
4117
|
+
if (!(error instanceof PipelineExecutionError)) {
|
|
4118
|
+
throw error;
|
|
4119
|
+
}
|
|
4120
|
+
throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
|
|
4103
4121
|
${error.message}
|
|
4104
4122
|
|
|
4105
4123
|
This is error in FOREACH command
|
|
@@ -4108,23 +4126,24 @@
|
|
|
4108
4126
|
${block(pipelineIdentification)}
|
|
4109
4127
|
Subparameter index: ${index}
|
|
4110
4128
|
`));
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4129
|
+
}
|
|
4130
|
+
const allSubparameters = {
|
|
4131
|
+
...parameters,
|
|
4132
|
+
...mappedParameters,
|
|
4133
|
+
};
|
|
4134
|
+
// Note: [π¨βπ¨βπ§] Now we can freeze `subparameters` because we are sure that all and only used parameters are defined and are not going to be changed
|
|
4135
|
+
Object.freeze(allSubparameters);
|
|
4136
|
+
const subresultString = await executeAttempts({
|
|
4137
|
+
...options,
|
|
4138
|
+
priority: priority + index,
|
|
4139
|
+
parameters: allSubparameters,
|
|
4140
|
+
pipelineIdentification: spaceTrim__default["default"]((block) => `
|
|
4123
4141
|
${block(pipelineIdentification)}
|
|
4124
4142
|
Subparameter index: ${index}
|
|
4125
4143
|
`),
|
|
4126
|
-
|
|
4127
|
-
|
|
4144
|
+
});
|
|
4145
|
+
return subresultString;
|
|
4146
|
+
},
|
|
4128
4147
|
});
|
|
4129
4148
|
return resultString;
|
|
4130
4149
|
}
|
|
@@ -4298,11 +4317,6 @@
|
|
|
4298
4317
|
async function executeTask(options) {
|
|
4299
4318
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
4300
4319
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
4301
|
-
await onProgress({
|
|
4302
|
-
outputParameters: {
|
|
4303
|
-
[currentTask.resultingParameterName]: '', // <- TODO: [π§ ] What is the best value here?
|
|
4304
|
-
},
|
|
4305
|
-
});
|
|
4306
4320
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but itβs good to doublecheck
|
|
4307
4321
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
4308
4322
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
@@ -4377,6 +4391,7 @@
|
|
|
4377
4391
|
preparedPipeline,
|
|
4378
4392
|
tools,
|
|
4379
4393
|
$executionReport,
|
|
4394
|
+
onProgress,
|
|
4380
4395
|
pipelineIdentification,
|
|
4381
4396
|
maxExecutionAttempts,
|
|
4382
4397
|
maxParallelCount,
|
|
@@ -6971,6 +6986,43 @@
|
|
|
6971
6986
|
},
|
|
6972
6987
|
};
|
|
6973
6988
|
|
|
6989
|
+
/**
|
|
6990
|
+
* Completion is formfactor that emulates completion models
|
|
6991
|
+
*
|
|
6992
|
+
* @public exported from `@promptbook/core`
|
|
6993
|
+
*/
|
|
6994
|
+
const CompletionFormfactorDefinition = {
|
|
6995
|
+
name: 'COMPLETION',
|
|
6996
|
+
description: `@@@`,
|
|
6997
|
+
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/@@`,
|
|
6998
|
+
// <- TODO: https://github.com/webgptorg/promptbook/discussions/new?category=concepts
|
|
6999
|
+
// "π Completion Formfactor"
|
|
7000
|
+
pipelineInterface: {
|
|
7001
|
+
inputParameters: [
|
|
7002
|
+
{
|
|
7003
|
+
name: 'inputText',
|
|
7004
|
+
description: `Input text to be completed`,
|
|
7005
|
+
isInput: true,
|
|
7006
|
+
isOutput: false,
|
|
7007
|
+
},
|
|
7008
|
+
{
|
|
7009
|
+
name: 'instructions',
|
|
7010
|
+
description: `Additional instructions for the model, for example the required length, empty by default`,
|
|
7011
|
+
isInput: true,
|
|
7012
|
+
isOutput: false,
|
|
7013
|
+
},
|
|
7014
|
+
],
|
|
7015
|
+
outputParameters: [
|
|
7016
|
+
{
|
|
7017
|
+
name: 'followingText',
|
|
7018
|
+
description: `Text that follows the input text`,
|
|
7019
|
+
isInput: false,
|
|
7020
|
+
isOutput: true,
|
|
7021
|
+
},
|
|
7022
|
+
],
|
|
7023
|
+
},
|
|
7024
|
+
};
|
|
7025
|
+
|
|
6974
7026
|
/**
|
|
6975
7027
|
* Generator is form of app that @@@
|
|
6976
7028
|
*
|
|
@@ -7155,6 +7207,8 @@
|
|
|
7155
7207
|
MatcherFormfactorDefinition,
|
|
7156
7208
|
GeneratorFormfactorDefinition,
|
|
7157
7209
|
ImageGeneratorFormfactorDefinition,
|
|
7210
|
+
CompletionFormfactorDefinition,
|
|
7211
|
+
// <- [π¬] When making new formfactor, copy the _boilerplate and link it here
|
|
7158
7212
|
];
|
|
7159
7213
|
/**
|
|
7160
7214
|
* Note: [π] Ignore a discrepancy between file name and entity name
|