@promptbook/browser 0.84.0-9 → 0.85.0-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 +21 -5
- package/esm/index.es.js +7 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -4
- package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
- package/esm/typings/src/_packages/types.index.d.ts +16 -2
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
- package/esm/typings/src/config.d.ts +27 -1
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +71 -0
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -5
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -15
- package/esm/typings/src/execution/PromptbookFetch.d.ts +8 -1
- package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts → assertsTaskSuccessful.d.ts} +4 -3
- package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -3
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -6
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +3 -6
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
- package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
- package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +2 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +2 -1
- package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
- package/esm/typings/src/wizzard/wizzard.d.ts +8 -3
- package/package.json +9 -16
- package/umd/index.umd.js +7 -1
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +0 -10
- package/esm/typings/src/types/TaskProgress.d.ts +0 -43
|
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
|
|
|
2
2
|
/**
|
|
3
3
|
* Initializes `run` command for Promptbook CLI utilities
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
6
|
+
*
|
|
5
7
|
* @private internal function of `promptbookCli`
|
|
6
8
|
*/
|
|
7
|
-
export declare function initializeRunCommand(program: Program): void;
|
|
9
|
+
export declare function $initializeRunCommand(program: Program): void;
|
|
8
10
|
/**
|
|
9
11
|
* TODO: !!5 Catch and wrap all errors from CLI
|
|
10
12
|
* TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
2
1
|
import type { PipelineExecutor } from '../../execution/PipelineExecutor';
|
|
2
|
+
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
3
3
|
/**
|
|
4
4
|
* Options for running the interactive chatbot
|
|
5
5
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Initializes `start-server` command for Promptbook CLI utilities
|
|
4
|
+
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
6
|
+
*
|
|
7
|
+
* @private internal function of `promptbookCli`
|
|
8
|
+
*/
|
|
9
|
+
export declare function $initializeStartServerCommand(program: Program): void;
|
|
10
|
+
/**
|
|
11
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12
|
+
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
13
|
+
*/
|
|
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
|
|
|
2
2
|
/**
|
|
3
3
|
* Initializes `test` command for Promptbook CLI utilities
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
6
|
+
*
|
|
5
7
|
* @private internal function of `promptbookCli`
|
|
6
8
|
*/
|
|
7
|
-
export declare function initializeTestCommand(program: Program): void;
|
|
9
|
+
export declare function $initializeTestCommand(program: Program): void;
|
|
8
10
|
/**
|
|
9
11
|
* TODO: [😶] Unite floder listing
|
|
10
12
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -65,6 +65,24 @@ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
|
65
65
|
* @public exported from `@promptbook/core`
|
|
66
66
|
*/
|
|
67
67
|
export declare const DEFAULT_TASK_TITLE = "Task";
|
|
68
|
+
/**
|
|
69
|
+
* When the title of the prompt task is not provided, the default title is used
|
|
70
|
+
*
|
|
71
|
+
* @public exported from `@promptbook/core`
|
|
72
|
+
*/
|
|
73
|
+
export declare const DEFAULT_PROMPT_TASK_TITLE = "Prompt";
|
|
74
|
+
/**
|
|
75
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
76
|
+
*
|
|
77
|
+
* @public exported from `@promptbook/core`
|
|
78
|
+
*/
|
|
79
|
+
export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
|
|
80
|
+
/**
|
|
81
|
+
* Maximum file size limit
|
|
82
|
+
*
|
|
83
|
+
* @public exported from `@promptbook/core`
|
|
84
|
+
*/
|
|
85
|
+
export declare const DEFAULT_MAX_FILE_SIZE: number;
|
|
68
86
|
/**
|
|
69
87
|
* Warning message for the generated sections and files files
|
|
70
88
|
*
|
|
@@ -166,6 +184,14 @@ export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
|
|
|
166
184
|
* @public exported from `@promptbook/core`
|
|
167
185
|
*/
|
|
168
186
|
export declare const DEFAULT_BOOKS_DIRNAME = "./books";
|
|
187
|
+
/**
|
|
188
|
+
* Where to store the temporary downloads
|
|
189
|
+
*
|
|
190
|
+
* Note: When the folder does not exist, it is created recursively
|
|
191
|
+
*
|
|
192
|
+
* @public exported from `@promptbook/core`
|
|
193
|
+
*/
|
|
194
|
+
export declare const DEFAULT_DOWNLOAD_CACHE_DIRNAME = "./.promptbook/download-cache";
|
|
169
195
|
/**
|
|
170
196
|
* Where to store the cache of executions for promptbook CLI
|
|
171
197
|
*
|
|
@@ -173,7 +199,7 @@ export declare const DEFAULT_BOOKS_DIRNAME = "./books";
|
|
|
173
199
|
*
|
|
174
200
|
* @public exported from `@promptbook/core`
|
|
175
201
|
*/
|
|
176
|
-
export declare const
|
|
202
|
+
export declare const DEFAULT_EXECUTION_CACHE_DIRNAME = "./.promptbook/execution-cache";
|
|
177
203
|
/**
|
|
178
204
|
* Where to store the scrape cache
|
|
179
205
|
*
|
|
@@ -17,5 +17,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
|
|
19
19
|
/**
|
|
20
|
-
* TODO:
|
|
20
|
+
* TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
|
|
21
21
|
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReadonlyDeep } from 'type-fest';
|
|
2
|
+
import type { ErrorJson } from '../errors/utils/ErrorJson';
|
|
3
|
+
/**
|
|
4
|
+
* @@@
|
|
5
|
+
*
|
|
6
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
7
|
+
*/
|
|
8
|
+
export type AbstractTaskResult = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the execution was successful, details are aviable in `executionReport`
|
|
11
|
+
*/
|
|
12
|
+
readonly isSuccessful: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Errors that occured during the execution, details are aviable in `executionReport`
|
|
15
|
+
*/
|
|
16
|
+
readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
|
|
17
|
+
/**
|
|
18
|
+
* Warnings that occured during the execution, details are aviable in `executionReport`
|
|
19
|
+
*/
|
|
20
|
+
readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* TODO: [🧠] Should this file be in /execution or /types folder?
|
|
24
|
+
* TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
|
|
25
|
+
*/
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import { PartialDeep } from 'type-fest';
|
|
3
|
+
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
4
|
+
import type { task_id } from '../types/typeAliases';
|
|
5
|
+
import type { AbstractTaskResult } from './AbstractTaskResult';
|
|
6
|
+
import type { PipelineExecutorResult } from './PipelineExecutorResult';
|
|
7
|
+
/**
|
|
8
|
+
* Options for creating a new task
|
|
9
|
+
*/
|
|
10
|
+
type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
11
|
+
/**
|
|
12
|
+
* The type of task to create
|
|
13
|
+
*/
|
|
14
|
+
readonly taskType: AbstractTask<TTaskResult>['taskType'];
|
|
15
|
+
/**
|
|
16
|
+
* Callback that processes the task and updates the ongoing result
|
|
17
|
+
* @param ongoingResult The partial result of the task processing
|
|
18
|
+
* @returns The final task result
|
|
19
|
+
*/
|
|
20
|
+
taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult>) => void): Promise<TTaskResult>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Helper to create a new task
|
|
24
|
+
*
|
|
25
|
+
* @private internal helper function
|
|
26
|
+
*/
|
|
27
|
+
export declare function createTask<TTaskResult extends AbstractTaskResult>(options: CreateTaskOptions<TTaskResult>): AbstractTask<TTaskResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Represents a task that executes a pipeline
|
|
30
|
+
*/
|
|
31
|
+
export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
|
|
32
|
+
readonly taskType: 'EXECUTION';
|
|
33
|
+
readonly taskId: `execution-${task_id}`;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Represents a task that prepares a pipeline
|
|
37
|
+
* @deprecated TODO: [🐚] Currently unused - use
|
|
38
|
+
*/
|
|
39
|
+
export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
|
|
40
|
+
readonly taskType: 'PREPARATION';
|
|
41
|
+
readonly taskId: `preparation-${task_id}`;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Base interface for all task types
|
|
45
|
+
*/
|
|
46
|
+
export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
47
|
+
/**
|
|
48
|
+
* Type of the task
|
|
49
|
+
*/
|
|
50
|
+
readonly taskType: string_SCREAMING_CASE;
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for the task
|
|
53
|
+
*/
|
|
54
|
+
readonly taskId: task_id;
|
|
55
|
+
/**
|
|
56
|
+
* Gets a promise that resolves with the task result
|
|
57
|
+
*/
|
|
58
|
+
asPromise(options?: {
|
|
59
|
+
readonly isCrashedOnError?: boolean;
|
|
60
|
+
}): Promise<TTaskResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Gets an observable stream of partial task results
|
|
63
|
+
*/
|
|
64
|
+
asObservable(): Observable<PartialDeep<TTaskResult>>;
|
|
65
|
+
};
|
|
66
|
+
export type Task = ExecutionTask | PreparationTask;
|
|
67
|
+
export {};
|
|
68
|
+
/**
|
|
69
|
+
* TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
|
|
70
|
+
* TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
|
|
71
|
+
*/
|
|
@@ -3,7 +3,7 @@ import type fs from 'fs/promises';
|
|
|
3
3
|
/**
|
|
4
4
|
* Container for all the tools needed to manipulate with filesystem
|
|
5
5
|
*/
|
|
6
|
-
export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir'>;
|
|
6
|
+
export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir' | 'mkdir'>;
|
|
7
7
|
/**
|
|
8
8
|
* TODO: Implement destroyable pattern to free resources
|
|
9
9
|
*/
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { Promisable } from 'type-fest';
|
|
2
|
-
import type { TaskProgress } from '../types/TaskProgress';
|
|
3
1
|
import type { InputParameters } from '../types/typeAliases';
|
|
4
|
-
import type {
|
|
2
|
+
import type { ExecutionTask } from './ExecutionTask';
|
|
5
3
|
/**
|
|
6
4
|
* Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
|
|
7
5
|
* Executor is made by combining execution tools and pipeline collection.
|
|
@@ -11,9 +9,8 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
|
|
|
11
9
|
* @see https://github.com/webgptorg/promptbook#executor
|
|
12
10
|
*/
|
|
13
11
|
export type PipelineExecutor = {
|
|
14
|
-
(inputParameters: InputParameters
|
|
12
|
+
(inputParameters: InputParameters): ExecutionTask;
|
|
15
13
|
};
|
|
16
14
|
/**
|
|
17
|
-
* TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
|
|
18
15
|
* TODO: [🧠] Should this file be in /execution or /types folder?
|
|
19
16
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReadonlyDeep } from 'type-fest';
|
|
2
|
-
import type { ErrorJson } from '../errors/utils/ErrorJson';
|
|
3
2
|
import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
4
3
|
import type { Parameters } from '../types/typeAliases';
|
|
4
|
+
import type { AbstractTaskResult } from './AbstractTaskResult';
|
|
5
5
|
import type { ExecutionReportJson } from './execution-report/ExecutionReportJson';
|
|
6
6
|
import type { PromptResultUsage } from './PromptResultUsage';
|
|
7
7
|
/**
|
|
@@ -9,29 +9,17 @@ import type { PromptResultUsage } from './PromptResultUsage';
|
|
|
9
9
|
*
|
|
10
10
|
* Note: [🚉] This is fully serializable as JSON
|
|
11
11
|
*/
|
|
12
|
-
export type PipelineExecutorResult = {
|
|
12
|
+
export type PipelineExecutorResult = AbstractTaskResult & {
|
|
13
13
|
/**
|
|
14
14
|
* Result parameters of the execution
|
|
15
15
|
*
|
|
16
16
|
* Note: If the execution was not successful, there are only some of the result parameters
|
|
17
17
|
*/
|
|
18
18
|
readonly outputParameters: Readonly<Parameters>;
|
|
19
|
-
/**
|
|
20
|
-
* Whether the execution was successful, details are aviable in `executionReport`
|
|
21
|
-
*/
|
|
22
|
-
readonly isSuccessful: boolean;
|
|
23
19
|
/**
|
|
24
20
|
* Added usage of whole execution, detailed usage is aviable in `executionReport`
|
|
25
21
|
*/
|
|
26
22
|
readonly usage: ReadonlyDeep<PromptResultUsage>;
|
|
27
|
-
/**
|
|
28
|
-
* Errors that occured during the execution, details are aviable in `executionReport`
|
|
29
|
-
*/
|
|
30
|
-
readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
|
|
31
|
-
/**
|
|
32
|
-
* Warnings that occured during the execution, details are aviable in `executionReport`
|
|
33
|
-
*/
|
|
34
|
-
readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
|
|
35
23
|
/**
|
|
36
24
|
* The report of the execution with all details
|
|
37
25
|
*/
|
|
@@ -46,5 +34,4 @@ export type PipelineExecutorResult = {
|
|
|
46
34
|
};
|
|
47
35
|
/**
|
|
48
36
|
* TODO: [🧠] Should this file be in /execution or /types folder?
|
|
49
|
-
* TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
|
|
50
37
|
*/
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { string_url } from '../types/typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
* Fetch function
|
|
3
|
+
* Fetch function used in Promptbook engine
|
|
4
|
+
*
|
|
5
|
+
* In most cases it is just native `fetch` function with a lightweight error handling wrapper
|
|
6
|
+
* But it can be replaced with any other fetch function, polyfill, custom implementation, security layer, etc.
|
|
7
|
+
*
|
|
8
|
+
* It is used in theese places:
|
|
9
|
+
* - Fetching knowledge sources
|
|
10
|
+
* - Callbacks from remote server ([👩🏾🤝🧑🏾] Not yet implemented)
|
|
4
11
|
*/
|
|
5
12
|
export type PromptbookFetch = (url: string_url, init?: RequestInit) => Promise<Response>;
|
package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts → assertsTaskSuccessful.d.ts}
RENAMED
|
@@ -2,12 +2,13 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
|
|
|
2
2
|
/**
|
|
3
3
|
* Asserts that the execution of a Promptbook is successful
|
|
4
4
|
*
|
|
5
|
+
* Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
|
|
6
|
+
*
|
|
5
7
|
* @param executionResult - The partial result of the Promptbook execution
|
|
6
8
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
7
|
-
* @
|
|
9
|
+
* @private internal helper function of `asPromise` method of `ExecutionTask`
|
|
8
10
|
*/
|
|
9
|
-
export declare function
|
|
11
|
+
export declare function assertsTaskSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors' | 'warnings'>): void;
|
|
10
12
|
/**
|
|
11
|
-
* TODO: [🐚] This function should be removed OR changed OR be completely rewritten
|
|
12
13
|
* TODO: [🧠] Can this return type be better typed than void
|
|
13
14
|
*/
|
|
@@ -8,6 +8,3 @@ import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorO
|
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
11
|
-
/**
|
|
12
|
-
* TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
|
|
13
|
-
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Promisable, ReadonlyDeep } from 'type-fest';
|
|
1
|
+
import type { PartialDeep, Promisable, ReadonlyDeep } from 'type-fest';
|
|
2
2
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
3
|
-
import type { TaskProgress } from '../../types/TaskProgress';
|
|
4
3
|
import type { InputParameters } from '../../types/typeAliases';
|
|
5
4
|
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
6
5
|
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
|
|
@@ -17,7 +16,7 @@ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
|
|
|
17
16
|
/**
|
|
18
17
|
* @@@
|
|
19
18
|
*/
|
|
20
|
-
onProgress?(
|
|
19
|
+
onProgress?(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>;
|
|
21
20
|
/**
|
|
22
21
|
* @@@
|
|
23
22
|
*/
|
|
@@ -44,6 +43,3 @@ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
|
|
|
44
43
|
*/
|
|
45
44
|
export declare function executePipeline(options: ExecutePipelineOptions): Promise<PipelineExecutorResult>;
|
|
46
45
|
export {};
|
|
47
|
-
/**
|
|
48
|
-
* TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
|
|
49
|
-
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
|
|
1
|
+
import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest';
|
|
2
2
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
3
3
|
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
4
|
-
import type { TaskProgress } from '../../types/TaskProgress';
|
|
5
4
|
import type { Parameters } from '../../types/typeAliases';
|
|
6
5
|
import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
|
|
6
|
+
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
7
7
|
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
|
|
8
8
|
/**
|
|
9
9
|
* @@@
|
|
@@ -26,7 +26,7 @@ type executeSingleTaskOptions = Required<CreatePipelineExecutorOptions> & {
|
|
|
26
26
|
/**
|
|
27
27
|
* @@@
|
|
28
28
|
*/
|
|
29
|
-
readonly onProgress: (
|
|
29
|
+
readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
|
|
30
30
|
/**
|
|
31
31
|
* @@@
|
|
32
32
|
*/
|
|
@@ -46,6 +46,3 @@ export {};
|
|
|
46
46
|
/**
|
|
47
47
|
* TODO: [🤹♂️]
|
|
48
48
|
*/
|
|
49
|
-
/**
|
|
50
|
-
* TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
|
|
51
|
-
*/
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import type { string_filename } from '../../../types/typeAliases';
|
|
1
2
|
import type { string_markdown } from '../../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Pass the `.env` file which was used to configure LLM tools
|
|
5
|
+
*
|
|
6
|
+
* Note: `$` is used to indicate that this variable is making side effect
|
|
7
|
+
*
|
|
8
|
+
* @private internal log of `$provideLlmToolsConfigurationFromEnv` and `$registeredLlmToolsMessage`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $setUsedEnvFilename(filepath: string_filename): void;
|
|
2
11
|
/**
|
|
3
12
|
* Creates a message with all registered LLM tools
|
|
4
13
|
*
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { createDeepSeek } from '@ai-sdk/deepseek';
|
|
2
|
+
import type { VercelExecutionToolsOptions } from '../vercel/VercelExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for `DeepseekExecutionTools`
|
|
5
|
+
*
|
|
6
|
+
* This combines options for Promptbook, Deepseek and Vercel together
|
|
7
|
+
* @public exported from `@promptbook/deepseek`
|
|
8
|
+
*/
|
|
9
|
+
export type DeepseekExecutionToolsOptions = Omit<VercelExecutionToolsOptions, 'title' | 'description' | 'vercelProvider' | 'availableModels'> & Parameters<typeof createDeepSeek>[0];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { DeepseekExecutionToolsOptions } from './DeepseekExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Execution Tools for calling Deepseek API.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/deepseek`
|
|
7
|
+
*/
|
|
8
|
+
export declare const createDeepseekExecutionTools: ((options: DeepseekExecutionToolsOptions) => LlmExecutionTools) & {
|
|
9
|
+
packageName: string;
|
|
10
|
+
className: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
14
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Registration } from '../../utils/$Register';
|
|
2
|
+
/**
|
|
3
|
+
* Registration of LLM provider metadata
|
|
4
|
+
*
|
|
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
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/core`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
9
|
+
* @public exported from `@promptbook/cli`
|
|
10
|
+
*/
|
|
11
|
+
export declare const _DeepseekMetadataRegistration: Registration;
|
|
12
|
+
/**
|
|
13
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14
|
+
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Registration } from '../../utils/$Register';
|
|
2
|
+
/**
|
|
3
|
+
* Registration of LLM provider
|
|
4
|
+
*
|
|
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
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/deepseek`
|
|
8
|
+
* @public exported from `@promptbook/wizzard`
|
|
9
|
+
* @public exported from `@promptbook/cli`
|
|
10
|
+
*/
|
|
11
|
+
export declare const _DeepseekRegistration: Registration;
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
14
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15
|
+
*/
|
|
@@ -2,9 +2,10 @@ import type { PipelineString } from './PipelineString';
|
|
|
2
2
|
/**
|
|
3
3
|
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
4
4
|
*
|
|
5
|
-
* Note: There are
|
|
5
|
+
* Note: There are 3 similar functions:
|
|
6
6
|
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
7
|
-
*
|
|
7
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
8
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
8
9
|
*
|
|
9
10
|
* @param strings @@@
|
|
10
11
|
* @param values @@@
|
|
@@ -2,16 +2,29 @@ import type { string_prompt } from '../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Tag function for notating a prompt as template literal
|
|
4
4
|
*
|
|
5
|
-
* Note: There are
|
|
5
|
+
* Note: There are 3 similar functions:
|
|
6
6
|
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
7
|
-
*
|
|
7
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
8
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
8
9
|
*
|
|
9
|
-
* @param strings
|
|
10
|
-
* @param values
|
|
11
|
-
* @returns the
|
|
10
|
+
* @param strings
|
|
11
|
+
* @param values
|
|
12
|
+
* @returns the prompt string
|
|
12
13
|
* @public exported from `@promptbook/utils`
|
|
13
14
|
*/
|
|
14
15
|
export declare function prompt(strings: TemplateStringsArray, ...values: Array<string>): string_prompt;
|
|
16
|
+
/**
|
|
17
|
+
* Tag function for notating a prompt as template literal
|
|
18
|
+
*
|
|
19
|
+
* Note: There are 3 similar functions:
|
|
20
|
+
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
21
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
22
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
23
|
+
*
|
|
24
|
+
* @alias prompt
|
|
25
|
+
* @public exported from `@promptbook/utils`
|
|
26
|
+
*/
|
|
27
|
+
export declare const promptTemplate: typeof prompt;
|
|
15
28
|
/**
|
|
16
29
|
* TODO: [🧠][🈴] Where is the best location for this file
|
|
17
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -13,5 +13,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function preparePipelineOnRemoteServer<TCustomOptions = undefined>(pipeline: PipelineJson, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
|
|
15
15
|
/**
|
|
16
|
-
* TODO:
|
|
16
|
+
* TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
|
|
17
17
|
*/
|
package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteSer
|
|
|
9
9
|
*/
|
|
10
10
|
export type PromptbookServer_Identification<TCustomOptions> = PromptbookServer_ApplicationIdentification<TCustomOptions> | PromptbookServer_AnonymousIdentification;
|
|
11
11
|
/**
|
|
12
|
-
* Application mode is
|
|
12
|
+
* Application mode is situation when you run known and well-defined books with your own api keys
|
|
13
13
|
*
|
|
14
14
|
* @public exported from `@promptbook/remote-server`
|
|
15
15
|
* @public exported from `@promptbook/remote-client`
|
|
@@ -21,7 +21,10 @@ export type PromptbookServer_ApplicationIdentification<TCustomOptions> = Applica
|
|
|
21
21
|
readonly isAnonymous: false;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* Anonymous mode is
|
|
24
|
+
* Anonymous mode is when you run arbitrary user books without api keys from user
|
|
25
|
+
*
|
|
26
|
+
* Note: This is useful in situations when the LLM provider does not allow to call the API requests from the client side
|
|
27
|
+
* It is kind of a proxy mode
|
|
25
28
|
*
|
|
26
29
|
* @public exported from `@promptbook/remote-server`
|
|
27
30
|
* @public exported from `@promptbook/remote-client`
|
|
@@ -11,6 +11,7 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
|
|
13
13
|
/**
|
|
14
|
+
* TODO: [👩🏾🤝🧑🏾] Allow to pass custom fetch function here - PromptbookFetch
|
|
14
15
|
* TODO: Split this file into multiple functions - handler for each request
|
|
15
16
|
* TODO: Maybe use `$exportJson`
|
|
16
17
|
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
@@ -556,6 +556,7 @@ export type string_javascript_name = string;
|
|
|
556
556
|
*/
|
|
557
557
|
export type string_postprocessing_function_name = string;
|
|
558
558
|
export type id = string | number;
|
|
559
|
+
export type task_id = string;
|
|
559
560
|
export type string_token = string;
|
|
560
561
|
export type string_license_token = string_token;
|
|
561
562
|
export type string_password = string;
|
|
@@ -588,6 +589,7 @@ export type number_tokens = number_integer & (number_positive | 0);
|
|
|
588
589
|
export type number_positive = number;
|
|
589
590
|
export type number_negative = number;
|
|
590
591
|
export type number_integer = number;
|
|
592
|
+
export type number_port = number_positive & number_integer;
|
|
591
593
|
/**
|
|
592
594
|
* Semantic helper;
|
|
593
595
|
* Percentage from 0 to 1 (100%) (and bellow and above)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { string_file_extension } from '../../types/typeAliases';
|
|
2
|
+
import type { string_mime_type } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Convert mime type to file extension
|
|
5
|
+
*
|
|
6
|
+
* Note: If the mime type is invalid, `null` is returned
|
|
7
|
+
*
|
|
8
|
+
* @private within the repository
|
|
9
|
+
*/
|
|
10
|
+
export declare function mimeTypeToExtension(value: string_mime_type): string_file_extension | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import type { number_seed } from '../../types/typeAliases';
|
|
|
4
4
|
*
|
|
5
5
|
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
6
6
|
* Warning: This function is NOT cryptographically secure (it uses Math.random internally)
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* @private internal helper function
|
|
8
9
|
*/
|
|
9
10
|
export declare function $randomSeed(): number_seed;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { string_token } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Generates random token
|
|
4
|
+
*
|
|
5
|
+
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
6
|
+
*
|
|
7
|
+
* @private internal helper function
|
|
8
|
+
* @returns secure random token
|
|
9
|
+
*/
|
|
10
|
+
export declare function $randomToken(randomness: number): string_token;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
13
|
+
*/
|