@promptbook/openai 0.60.0-4 → 0.60.0-5
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 -23
- package/esm/index.es.js +3 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +9 -9
- package/esm/typings/src/_packages/node.index.d.ts +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +3 -3
- package/{umd/typings/src/library → esm/typings/src/collection}/PipelineCollection.d.ts +4 -4
- package/{umd/typings/src/library → esm/typings/src/collection}/SimplePipelineCollection.d.ts +5 -5
- package/{umd/typings/src/library/libraryToJson.d.ts → esm/typings/src/collection/collectionToJson.d.ts} +2 -2
- package/esm/typings/src/{library → collection}/constructors/createCollectionFromDirectory.d.ts +3 -3
- package/esm/typings/src/{library → collection}/constructors/createCollectionFromJson.d.ts +1 -1
- package/{umd/typings/src/library → esm/typings/src/collection}/constructors/createCollectionFromPromise.d.ts +1 -1
- package/esm/typings/src/{library → collection}/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createSubcollection.d.ts +12 -0
- package/esm/typings/src/config.d.ts +2 -2
- package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/esm/typings/src/errors/CollectionError.d.ts +1 -1
- package/esm/typings/src/errors/ExecutionError.d.ts +1 -1
- package/esm/typings/src/errors/NotFoundError.d.ts +1 -1
- package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
- package/esm/typings/src/execution/{PromptbookExecutor.d.ts → PipelineExecutor.d.ts} +3 -3
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +2 -2
- package/{umd/typings/src/execution/createPromptbookExecutor.d.ts → esm/typings/src/execution/createPipelineExecutor.d.ts} +13 -13
- package/esm/typings/src/execution/utils/replaceParameters.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/joker.test.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/mocked-completion.test.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +4 -4
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/types/Command.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +5 -5
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +3 -3
- package/esm/typings/src/types/TaskProgress.d.ts +1 -1
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
- package/esm/typings/src/types/execution-report/config.d.ts +1 -1
- package/esm/typings/src/utils/emojis.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +3 -3
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +1 -1
- package/umd/typings/src/_packages/core.index.d.ts +9 -9
- package/umd/typings/src/_packages/node.index.d.ts +1 -1
- package/umd/typings/src/_packages/types.index.d.ts +3 -3
- package/{esm/typings/src/library → umd/typings/src/collection}/PipelineCollection.d.ts +4 -4
- package/{esm/typings/src/library → umd/typings/src/collection}/SimplePipelineCollection.d.ts +5 -5
- package/{esm/typings/src/library/libraryToJson.d.ts → umd/typings/src/collection/collectionToJson.d.ts} +2 -2
- package/umd/typings/src/{library → collection}/constructors/createCollectionFromDirectory.d.ts +3 -3
- package/umd/typings/src/{library → collection}/constructors/createCollectionFromJson.d.ts +1 -1
- package/{esm/typings/src/library → umd/typings/src/collection}/constructors/createCollectionFromPromise.d.ts +1 -1
- package/umd/typings/src/{library → collection}/constructors/createCollectionFromUrl.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createSubcollection.d.ts +12 -0
- package/umd/typings/src/config.d.ts +2 -2
- package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
- package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/umd/typings/src/errors/CollectionError.d.ts +1 -1
- package/umd/typings/src/errors/ExecutionError.d.ts +1 -1
- package/umd/typings/src/errors/NotFoundError.d.ts +1 -1
- package/umd/typings/src/execution/EmbeddingVector.d.ts +1 -1
- package/umd/typings/src/execution/{PromptbookExecutor.d.ts → PipelineExecutor.d.ts} +3 -3
- package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +2 -2
- package/{esm/typings/src/execution/createPromptbookExecutor.d.ts → umd/typings/src/execution/createPipelineExecutor.d.ts} +13 -13
- package/umd/typings/src/execution/utils/replaceParameters.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/joker.test.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/mocked-chat.test.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/mocked-completion.test.d.ts +1 -1
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +4 -4
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/umd/typings/src/types/Command.d.ts +2 -2
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +5 -5
- package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +1 -1
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/Prompt.d.ts +3 -3
- package/umd/typings/src/types/TaskProgress.d.ts +1 -1
- package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -3
- package/umd/typings/src/types/execution-report/config.d.ts +1 -1
- package/umd/typings/src/utils/emojis.d.ts +1 -1
- package/esm/typings/src/library/constructors/createSubcollection.d.ts +0 -12
- package/umd/typings/src/library/constructors/createSubcollection.d.ts +0 -12
- /package/esm/typings/src/{library/constructors/createCollectionFromDirectory.test.d.ts → collection/collectionToJson.test.d.ts} +0 -0
- /package/{umd/typings/src/library → esm/typings/src/collection}/constructors/createCollectionFromDirectory.test.d.ts +0 -0
- /package/esm/typings/src/{library → collection}/constructors/createCollectionFromJson.test.d.ts +0 -0
- /package/esm/typings/src/{library → collection}/constructors/createCollectionFromPromise.test.d.ts +0 -0
- /package/esm/typings/src/{library → collection}/constructors/justTestFsImport.d.ts +0 -0
- /package/{esm/typings/src/library/libraryToJson.test.d.ts → umd/typings/src/collection/collectionToJson.test.d.ts} +0 -0
- /package/umd/typings/src/{library/constructors/createCollectionFromJson.test.d.ts → collection/constructors/createCollectionFromDirectory.test.d.ts} +0 -0
- /package/umd/typings/src/{library/constructors/createCollectionFromPromise.test.d.ts → collection/constructors/createCollectionFromJson.test.d.ts} +0 -0
- /package/umd/typings/src/{library/libraryToJson.test.d.ts → collection/constructors/createCollectionFromPromise.test.d.ts} +0 -0
- /package/umd/typings/src/{library → collection}/constructors/justTestFsImport.d.ts +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type { PipelineCollection } from '../collection/PipelineCollection';
|
|
1
2
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
2
3
|
import { EmbeddingVector } from '../execution/EmbeddingVector';
|
|
3
4
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
4
5
|
import type { AvailableModel, LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
6
|
+
import type { PipelineExecutor } from '../execution/PipelineExecutor';
|
|
5
7
|
import type { PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, UncertainNumber } from '../execution/PromptResult';
|
|
6
|
-
import type { PromptbookExecutor } from '../execution/PromptbookExecutor';
|
|
7
8
|
import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools';
|
|
8
9
|
import type { UserInterfaceTools, UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
|
|
9
|
-
import type { PipelineCollection } from '../library/PipelineCollection';
|
|
10
10
|
import type { ExecutionType } from '../types/ExecutionTypes';
|
|
11
11
|
import type { ModelRequirements, ModelVariant } from '../types/ModelRequirements';
|
|
12
12
|
import type { Parameters } from '../types/Parameters';
|
|
@@ -27,7 +27,7 @@ import type { FromtoItems } from '../utils/FromtoItems';
|
|
|
27
27
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
28
28
|
export { PROMPTBOOK_VERSION };
|
|
29
29
|
export { EXPECTATION_UNITS };
|
|
30
|
-
export type { AvailableModel, CommonExecutionToolsOptions, EmbeddingVector, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, Expectations, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, PipelineCollection, PipelineJson, PipelineString, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson,
|
|
30
|
+
export type { AvailableModel, CommonExecutionToolsOptions, EmbeddingVector, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, Expectations, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, PipelineCollection, PipelineExecutor, PipelineJson, PipelineString, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, };
|
|
31
31
|
/**
|
|
32
32
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
33
33
|
*/
|
|
@@ -5,21 +5,21 @@ import type { string_pipeline_url } from '../types/typeAliases';
|
|
|
5
5
|
/**
|
|
6
6
|
* Collection that groups together pipelines, knowledge, personas, tools and actions
|
|
7
7
|
*
|
|
8
|
-
* @see !!! https://github.com/webgptorg/pipeline#pipeline-
|
|
8
|
+
* @see !!! https://github.com/webgptorg/pipeline#pipeline-collection
|
|
9
9
|
*/
|
|
10
10
|
export type PipelineCollection = {
|
|
11
11
|
/**
|
|
12
|
-
* Gets all pipelines in the
|
|
12
|
+
* Gets all pipelines in the collection
|
|
13
13
|
*/
|
|
14
14
|
listPipelines(): Promisable<Array<string_pipeline_url>>;
|
|
15
15
|
/**
|
|
16
16
|
* Gets pipeline by its URL
|
|
17
17
|
*
|
|
18
|
-
* Note: This is not a direct fetching from the URL, but a lookup in the
|
|
18
|
+
* Note: This is not a direct fetching from the URL, but a lookup in the collection
|
|
19
19
|
*/
|
|
20
20
|
getPipelineByUrl(url: string_pipeline_url): Promisable<PipelineJson>;
|
|
21
21
|
/**
|
|
22
|
-
* Checks whether given prompt was defined in any pipeline in the
|
|
22
|
+
* Checks whether given prompt was defined in any pipeline in the collection
|
|
23
23
|
*/
|
|
24
24
|
isResponsibleForPrompt(prompt: Prompt): Promisable<boolean>;
|
|
25
25
|
};
|
package/{esm/typings/src/library → umd/typings/src/collection}/SimplePipelineCollection.d.ts
RENAMED
|
@@ -10,9 +10,9 @@ import type { PipelineCollection } from './PipelineCollection';
|
|
|
10
10
|
* @see https://github.com/webgptorg/promptbook#promptbook-collection
|
|
11
11
|
*/
|
|
12
12
|
export declare class SimplePipelineCollection implements PipelineCollection {
|
|
13
|
-
private
|
|
13
|
+
private collection;
|
|
14
14
|
/**
|
|
15
|
-
* Constructs a
|
|
15
|
+
* Constructs a pipeline collection from promptbooks
|
|
16
16
|
*
|
|
17
17
|
* @param promptbooks !!!
|
|
18
18
|
*
|
|
@@ -22,17 +22,17 @@ export declare class SimplePipelineCollection implements PipelineCollection {
|
|
|
22
22
|
*/
|
|
23
23
|
constructor(...promptbooks: Array<PipelineJson>);
|
|
24
24
|
/**
|
|
25
|
-
* Gets all promptbooks in the
|
|
25
|
+
* Gets all promptbooks in the collection
|
|
26
26
|
*/
|
|
27
27
|
listPipelines(): Array<string_pipeline_url>;
|
|
28
28
|
/**
|
|
29
29
|
* Gets promptbook by its URL
|
|
30
30
|
*
|
|
31
|
-
* Note: This is not a direct fetching from the URL, but a lookup in the
|
|
31
|
+
* Note: This is not a direct fetching from the URL, but a lookup in the collection
|
|
32
32
|
*/
|
|
33
33
|
getPipelineByUrl(url: string_pipeline_url): PipelineJson;
|
|
34
34
|
/**
|
|
35
|
-
* Checks whether given prompt was defined in any promptbook in the
|
|
35
|
+
* Checks whether given prompt was defined in any promptbook in the collection
|
|
36
36
|
*/
|
|
37
37
|
isResponsibleForPrompt(prompt: Prompt): boolean;
|
|
38
38
|
}
|
|
@@ -3,6 +3,6 @@ import type { PipelineCollection } from './PipelineCollection';
|
|
|
3
3
|
/**
|
|
4
4
|
* Converts PipelineCollection to serialized JSON
|
|
5
5
|
*
|
|
6
|
-
* Note: Functions `
|
|
6
|
+
* Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function collectionToJson(collection: PipelineCollection): Promise<Array<PipelineJson>>;
|
package/umd/typings/src/{library → collection}/constructors/createCollectionFromDirectory.d.ts
RENAMED
|
@@ -11,7 +11,7 @@ type CreatePipelineCollectionFromDirectoryOptions = {
|
|
|
11
11
|
*/
|
|
12
12
|
isRecursive?: boolean;
|
|
13
13
|
/**
|
|
14
|
-
* If true, the
|
|
14
|
+
* If true, the collection creation outputs information about each file it reads
|
|
15
15
|
*
|
|
16
16
|
* @default false
|
|
17
17
|
*/
|
|
@@ -23,7 +23,7 @@ type CreatePipelineCollectionFromDirectoryOptions = {
|
|
|
23
23
|
*/
|
|
24
24
|
isLazyLoaded?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* If true, whole
|
|
26
|
+
* If true, whole collection creation crashes on error in any promptbook
|
|
27
27
|
* If true and isLazyLoaded is true, the error is thrown on first access to the promptbook
|
|
28
28
|
*
|
|
29
29
|
* @default true
|
|
@@ -36,7 +36,7 @@ type CreatePipelineCollectionFromDirectoryOptions = {
|
|
|
36
36
|
* Note: Works only in Node.js environment because it reads the file system
|
|
37
37
|
*
|
|
38
38
|
* @param path - path to the directory with promptbooks
|
|
39
|
-
* @param options - Misc options for the
|
|
39
|
+
* @param options - Misc options for the collection
|
|
40
40
|
* @returns PipelineCollection
|
|
41
41
|
*/
|
|
42
42
|
export declare function createCollectionFromDirectory(path: string_folder_path, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
|
|
@@ -3,7 +3,7 @@ import type { PipelineCollection } from '../PipelineCollection';
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates PipelineCollection from array of PipelineJson or PipelineString
|
|
5
5
|
*
|
|
6
|
-
* Note: Functions `
|
|
6
|
+
* Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
|
|
7
7
|
* Note: During the construction syntax and logic of all sources are validated
|
|
8
8
|
*
|
|
9
9
|
* @param promptbookSources
|
|
@@ -10,7 +10,7 @@ import type { PipelineCollection } from '../PipelineCollection';
|
|
|
10
10
|
* `createCollectionFromUrl` or `createCollectionFromDirectory`
|
|
11
11
|
* Consider using those functions instead of this one
|
|
12
12
|
*
|
|
13
|
-
* Note: The function does NOT return promise it returns the
|
|
13
|
+
* Note: The function does NOT return promise it returns the collection directly which waits for the sources to be resolved
|
|
14
14
|
* when error occurs in given promise or factory function, it is thrown during `listPipelines` or `getPipelineByUrl` call
|
|
15
15
|
*
|
|
16
16
|
* Note: Consider using `createCollectionFromDirectory` or `createCollectionFromUrl`
|
|
@@ -5,7 +5,7 @@ import type { PipelineCollection } from '../PipelineCollection';
|
|
|
5
5
|
*/
|
|
6
6
|
type CreatePipelineCollectionFromUrlyOptions = {
|
|
7
7
|
/**
|
|
8
|
-
* If true, the
|
|
8
|
+
* If true, the collection creation outputs information about each file it reads
|
|
9
9
|
*
|
|
10
10
|
* @default false
|
|
11
11
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { string_pipeline_url } from '../../types/typeAliases';
|
|
2
|
+
import type { PipelineCollection } from '../PipelineCollection';
|
|
3
|
+
/**
|
|
4
|
+
* Creates PipelineCollection as a subset of another PipelineCollection
|
|
5
|
+
*
|
|
6
|
+
* Note: You can use any type of collection as a parent collection - local, remote, etc.
|
|
7
|
+
* Note: This is just a thin wrapper / proxy around the parent collection
|
|
8
|
+
*
|
|
9
|
+
* @param promptbookSources
|
|
10
|
+
* @returns PipelineCollection
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSubcollection(collection: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;
|
|
@@ -7,6 +7,6 @@ export declare const LOOP_LIMIT = 1000;
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const CHARACTER_LOOP_LIMIT = 100000;
|
|
9
9
|
/**
|
|
10
|
-
* The name of the builded
|
|
10
|
+
* The name of the builded pipeline collection made by CLI `promptbook make` and for lookup in `createCollectionFromDirectory`
|
|
11
11
|
*/
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
@@ -5,6 +5,6 @@ import type { PrettifyOptions } from './PrettifyOptions';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function prettifyPipelineString(pipelineString: PipelineString, options: PrettifyOptions): Promise<PipelineString>;
|
|
7
7
|
/**
|
|
8
|
-
* TODO: Maybe use some Mermaid
|
|
8
|
+
* TODO: Maybe use some Mermaid package instead of string templating
|
|
9
9
|
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
10
10
|
*/
|
|
@@ -20,6 +20,6 @@ export type renderPipelineMermaidOptions = {
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function renderPromptbookMermaid(pipelineJson: PipelineJson, options?: renderPipelineMermaidOptions): string;
|
|
22
22
|
/**
|
|
23
|
-
* TODO: Maybe use some Mermaid
|
|
23
|
+
* TODO: Maybe use some Mermaid package instead of string templating
|
|
24
24
|
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
25
25
|
*/
|
|
@@ -5,13 +5,13 @@ import type { string_name } from '../types/typeAliases';
|
|
|
5
5
|
import type { PromptResultUsage } from './PromptResult';
|
|
6
6
|
/**
|
|
7
7
|
* 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)_.
|
|
8
|
-
* Executor is made by combining execution tools and
|
|
8
|
+
* Executor is made by combining execution tools and pipeline collection.
|
|
9
9
|
*
|
|
10
|
-
* It can be created with `
|
|
10
|
+
* It can be created with `createPipelineExecutor` function.
|
|
11
11
|
*
|
|
12
12
|
* @see https://github.com/webgptorg/promptbook#executor
|
|
13
13
|
*/
|
|
14
|
-
export type
|
|
14
|
+
export type PipelineExecutor = {
|
|
15
15
|
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
16
16
|
/**
|
|
17
17
|
* Whether the execution was successful, details are aviable in `executionReport`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineExecutor } from './PipelineExecutor';
|
|
2
2
|
/**
|
|
3
3
|
* Asserts that the execution of a promptnook is successful
|
|
4
4
|
*
|
|
5
5
|
* @param executionResult - The partial result of the promptnook execution
|
|
6
6
|
* @throws {ExecutionError} If the execution is not successful or if multiple errors occurred
|
|
7
7
|
*/
|
|
8
|
-
export declare function assertsExecutionSuccessful(executionResult: Pick<Awaited<ReturnType<
|
|
8
|
+
export declare function assertsExecutionSuccessful(executionResult: Pick<Awaited<ReturnType<PipelineExecutor>>, 'isSuccessful' | 'errors'>): void;
|
|
9
9
|
/**
|
|
10
10
|
* TODO: [🧠] Can this return type be better typed than void
|
|
11
11
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
2
|
import type { ExecutionTools } from './ExecutionTools';
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
3
|
+
import type { PipelineExecutor } from './PipelineExecutor';
|
|
4
|
+
type CreatePipelineExecutorSettings = {
|
|
5
5
|
/**
|
|
6
6
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
7
|
*
|
|
@@ -10,33 +10,33 @@ type CreatePromptbookExecutorSettings = {
|
|
|
10
10
|
readonly maxExecutionAttempts: number;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* Options for creating a
|
|
13
|
+
* Options for creating a pipeline executor
|
|
14
14
|
*/
|
|
15
|
-
interface
|
|
15
|
+
interface CreatePipelineExecutorOptions {
|
|
16
16
|
/**
|
|
17
|
-
* The
|
|
17
|
+
* The pipeline to be executed
|
|
18
18
|
*/
|
|
19
|
-
readonly
|
|
19
|
+
readonly pipeline: PipelineJson;
|
|
20
20
|
/**
|
|
21
|
-
* The execution tools to be used during the execution of the
|
|
21
|
+
* The execution tools to be used during the execution of the pipeline
|
|
22
22
|
*/
|
|
23
23
|
readonly tools: ExecutionTools;
|
|
24
24
|
/**
|
|
25
|
-
* Optional settings for the
|
|
25
|
+
* Optional settings for the pipeline executor
|
|
26
26
|
*/
|
|
27
|
-
readonly settings?: Partial<
|
|
27
|
+
readonly settings?: Partial<CreatePipelineExecutorSettings>;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Creates executor function from
|
|
30
|
+
* Creates executor function from pipeline and execution tools.
|
|
31
31
|
*
|
|
32
32
|
* @returns The executor function
|
|
33
|
-
* @throws {PipelineLogicError} on logical error in the
|
|
33
|
+
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
34
34
|
*/
|
|
35
|
-
export declare function
|
|
35
|
+
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
36
36
|
export {};
|
|
37
37
|
/**
|
|
38
38
|
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
39
39
|
* TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
|
|
40
|
-
* Note:
|
|
40
|
+
* Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
|
|
41
41
|
* TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
42
42
|
*/
|
|
@@ -8,6 +8,6 @@ import type { string_template } from '../../types/typeAliases';
|
|
|
8
8
|
* @returns the template with replaced parameters
|
|
9
9
|
* @throws {TemplateError} if parameter is not defined, not closed, or not opened
|
|
10
10
|
*
|
|
11
|
-
* @private within the
|
|
11
|
+
* @private within the createPipelineExecutor
|
|
12
12
|
*/
|
|
13
13
|
export declare function replaceParameters(template: string_template, parameters: Parameters): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { PipelineCollection } from '../../../collection/PipelineCollection';
|
|
1
2
|
import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
|
|
2
3
|
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
3
|
-
import type { PipelineCollection } from '../../../library/PipelineCollection';
|
|
4
4
|
import type { client_id } from '../../../types/typeAliases';
|
|
5
5
|
import type { string_uri } from '../../../types/typeAliases';
|
|
6
6
|
export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
@@ -16,11 +16,11 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
|
16
16
|
*/
|
|
17
17
|
readonly path: string_uri;
|
|
18
18
|
/**
|
|
19
|
-
* Promptbook
|
|
19
|
+
* Promptbook collection to use
|
|
20
20
|
*
|
|
21
|
-
* This is used to
|
|
21
|
+
* This is used to check validity of the prompt to prevent DDoS
|
|
22
22
|
*/
|
|
23
|
-
readonly
|
|
23
|
+
readonly collection: PipelineCollection;
|
|
24
24
|
/**
|
|
25
25
|
* Creates llm execution tools for each client
|
|
26
26
|
*/
|
|
@@ -10,7 +10,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [⚖] Expose the
|
|
13
|
+
* TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
|
|
14
14
|
* TODO: Handle progress - support streaming
|
|
15
15
|
* TODO: [🤹♂️] Do not hang up immediately but wait until client closes OR timeout
|
|
16
16
|
* TODO: [🤹♂️] Timeout on chat to free up resources
|
|
@@ -17,8 +17,8 @@ export type Command = PromptbookUrlCommand | PromptbookVersionCommand | ExecuteC
|
|
|
17
17
|
* - It is defined per whole .promptbook file in the header
|
|
18
18
|
*/
|
|
19
19
|
export type PromptbookUrlCommand = {
|
|
20
|
-
readonly type: '
|
|
21
|
-
readonly
|
|
20
|
+
readonly type: 'PIPELINE_URL';
|
|
21
|
+
readonly pipelineUrl: URL;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* PromptbookVersion command tells which version is .promptbook file using
|
|
@@ -5,22 +5,22 @@ import type { KnowledgeJson } from './KnowledgeJson';
|
|
|
5
5
|
import type { PromptTemplateJson } from './PromptTemplateJson';
|
|
6
6
|
import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
7
7
|
/**
|
|
8
|
-
* Promptbook is the **core concept of this
|
|
8
|
+
* Promptbook is the **core concept of this package**.
|
|
9
9
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
10
10
|
*
|
|
11
11
|
* @see !!! https://github.com/webgptorg/promptbook#promptbook
|
|
12
12
|
*/
|
|
13
13
|
export type PipelineJson = {
|
|
14
14
|
/**
|
|
15
|
-
* Unique identifier of the
|
|
15
|
+
* Unique identifier of the pipeline
|
|
16
16
|
*
|
|
17
|
-
* Note: It must be unique across all
|
|
17
|
+
* Note: It must be unique across all pipeline collections
|
|
18
18
|
* Note: It must use HTTPs URL
|
|
19
19
|
* Tip: You can do versioning in the URL
|
|
20
20
|
* For example: https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md@1.0.0
|
|
21
21
|
* Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
|
|
22
22
|
*/
|
|
23
|
-
readonly
|
|
23
|
+
readonly pipelineUrl?: string_pipeline_url;
|
|
24
24
|
/**
|
|
25
25
|
* Title of the promptbook
|
|
26
26
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -51,5 +51,5 @@ export type PipelineJson = {
|
|
|
51
51
|
/**
|
|
52
52
|
* Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
|
|
53
53
|
* But then immediately reverted back to the single type
|
|
54
|
-
* With knowledge as part of the promptbook and
|
|
54
|
+
* With knowledge as part of the promptbook and collection just as a collection of promptbooks
|
|
55
55
|
*/
|
|
@@ -81,7 +81,7 @@ interface PromptTemplateJsonCommon {
|
|
|
81
81
|
* Name of the template
|
|
82
82
|
* - It must be unique across the pipeline
|
|
83
83
|
* - It should start uppercase and contain letters and numbers
|
|
84
|
-
* - The
|
|
84
|
+
* - The pipelineUrl together with hash and name are used to identify the prompt template in the pipeline
|
|
85
85
|
*/
|
|
86
86
|
readonly name: string_name;
|
|
87
87
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Promptbook is the **core concept of this
|
|
2
|
+
* Promptbook is the **core concept of this package**.
|
|
3
3
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
4
4
|
*
|
|
5
5
|
* @see !!! https://github.com/webgptorg/promptbook#promptbook
|
|
@@ -48,15 +48,15 @@ export type Prompt = {
|
|
|
48
48
|
*/
|
|
49
49
|
readonly expectFormat?: ExpectFormatCommand['format'];
|
|
50
50
|
/**
|
|
51
|
-
* Unique identifier of the
|
|
51
|
+
* Unique identifier of the pipeline with specific template name as hash
|
|
52
52
|
*
|
|
53
53
|
* @example https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md#keywords
|
|
54
54
|
*/
|
|
55
|
-
readonly
|
|
55
|
+
readonly pipelineUrl: string_pipeline_url_with_hashtemplate;
|
|
56
56
|
/**
|
|
57
57
|
* Parameters used in the prompt
|
|
58
58
|
*
|
|
59
|
-
* Note: This is redundant (same information is in
|
|
59
|
+
* Note: This is redundant (same information is in pipelineUrl+content) but useful for logging and debugging
|
|
60
60
|
*/
|
|
61
61
|
readonly parameters: Record<string_name, string>;
|
|
62
62
|
};
|
|
@@ -29,7 +29,7 @@ export type TaskProgress = {
|
|
|
29
29
|
readonly isDone: boolean;
|
|
30
30
|
/**
|
|
31
31
|
* The type of the execution.
|
|
32
|
-
* Note: The
|
|
32
|
+
* Note: The pipeline executor reports everything, in the app level you can filter out the execution types that you don't want to show to the user.
|
|
33
33
|
*/
|
|
34
34
|
readonly executionType: ExecutionType;
|
|
35
35
|
/**
|
|
@@ -15,9 +15,9 @@ import type { string_version } from '../typeAliases';
|
|
|
15
15
|
*/
|
|
16
16
|
export type ExecutionReportJson = {
|
|
17
17
|
/**
|
|
18
|
-
* Unique identifier of the
|
|
18
|
+
* Unique identifier of the pipeline from promptbook which was executed
|
|
19
19
|
*/
|
|
20
|
-
readonly
|
|
20
|
+
readonly pipelineUrl?: string_pipeline_url;
|
|
21
21
|
/**
|
|
22
22
|
* Title of from promptbook which was executed
|
|
23
23
|
*/
|
|
@@ -41,7 +41,7 @@ export type ExecutionReportJson = {
|
|
|
41
41
|
/**
|
|
42
42
|
* The prompt wich was executed
|
|
43
43
|
*/
|
|
44
|
-
prompt: Omit<Prompt, '
|
|
44
|
+
prompt: Omit<Prompt, 'pipelineUrl' | 'parameters'>;
|
|
45
45
|
/**
|
|
46
46
|
* Result of the prompt execution (if not failed during LLM execution)
|
|
47
47
|
*/
|
|
@@ -18,5 +18,5 @@ export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoj
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const EMOJIS: Set<string_char_emoji>;
|
|
20
20
|
/**
|
|
21
|
-
* TODO: Mirror from Collboard or some common
|
|
21
|
+
* TODO: Mirror from Collboard or some common package
|
|
22
22
|
*/
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { string_pipeline_url } from '../../types/typeAliases';
|
|
2
|
-
import type { PipelineCollection } from '../PipelineCollection';
|
|
3
|
-
/**
|
|
4
|
-
* Creates PipelineCollection as a subset of another PipelineCollection
|
|
5
|
-
*
|
|
6
|
-
* Note: You can use any type of library as a parent library - local, remote, etc.
|
|
7
|
-
* Note: This is just a thin wrapper / proxy around the parent library
|
|
8
|
-
*
|
|
9
|
-
* @param promptbookSources
|
|
10
|
-
* @returns PipelineCollection
|
|
11
|
-
*/
|
|
12
|
-
export declare function createSubcollection(library: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { string_pipeline_url } from '../../types/typeAliases';
|
|
2
|
-
import type { PipelineCollection } from '../PipelineCollection';
|
|
3
|
-
/**
|
|
4
|
-
* Creates PipelineCollection as a subset of another PipelineCollection
|
|
5
|
-
*
|
|
6
|
-
* Note: You can use any type of library as a parent library - local, remote, etc.
|
|
7
|
-
* Note: This is just a thin wrapper / proxy around the parent library
|
|
8
|
-
*
|
|
9
|
-
* @param promptbookSources
|
|
10
|
-
* @returns PipelineCollection
|
|
11
|
-
*/
|
|
12
|
-
export declare function createSubcollection(library: PipelineCollection, predicate: (url: string_pipeline_url) => boolean): PipelineCollection;
|
|
File without changes
|
|
File without changes
|
/package/esm/typings/src/{library → collection}/constructors/createCollectionFromJson.test.d.ts
RENAMED
|
File without changes
|
/package/esm/typings/src/{library → collection}/constructors/createCollectionFromPromise.test.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|