@promptbook/openai 0.92.0-26 → 0.92.0-28
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 +20 -12
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -4
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/constants.d.ts +35 -0
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -1
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +2 -1
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +2 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +2 -1
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +20 -14
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +7 -6
- package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +5 -1
- package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +8 -11
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +4 -4
- package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +2 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +2 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/index.d.ts +5 -5
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +17 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +21 -42
- package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +5 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +12 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -0
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +20 -12
- package/umd/index.umd.js.map +1 -1
|
@@ -7,55 +7,61 @@ import type { TODO_string } from '../../utils/organization/TODO_string';
|
|
|
7
7
|
import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson';
|
|
8
8
|
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Options for executing attempts of a pipeline task, including configuration for jokers, priority,
|
|
11
|
+
* maximum attempts, prepared content, parameters, the task itself, the prepared pipeline, execution report,
|
|
12
|
+
* and pipeline identification. Used internally by the pipeline executor.
|
|
11
13
|
*
|
|
12
14
|
* @private internal type of `executeAttempts`
|
|
13
15
|
*/
|
|
14
16
|
export type ExecuteAttemptsOptions = Required<Omit<CreatePipelineExecutorOptions, 'pipeline'>> & {
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* Names of parameters that act as jokers, which can be used to bypass normal execution if their value meets requirements.
|
|
17
19
|
*/
|
|
18
20
|
readonly jokerParameterNames: Readonly<ReadonlyArray<string_parameter_name>>;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Priority of the current execution attempt, used to influence UI or execution order.
|
|
21
23
|
*/
|
|
22
24
|
readonly priority: number;
|
|
23
25
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
+
* Maximum number of attempts allowed for this task, including retries and joker attempts.
|
|
26
27
|
* Note: [💂] There are two distinct variabiles
|
|
27
|
-
* 1) `maxExecutionAttempts` -
|
|
28
|
-
* 2) `maxAttempts` -
|
|
28
|
+
* 1) `maxExecutionAttempts` - attempts for LLM model
|
|
29
|
+
* 2) `maxAttempts` - attempts for any task (LLM, SCRIPT, DIALOG, etc.)
|
|
29
30
|
*/
|
|
30
31
|
readonly maxAttempts: number;
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* The content prepared for execution, with parameters already substituted.
|
|
33
34
|
*/
|
|
34
35
|
readonly preparedContent: TODO_string;
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* The parameters provided for this execution attempt.
|
|
37
38
|
*/
|
|
38
39
|
readonly parameters: Readonly<Parameters>;
|
|
39
40
|
/**
|
|
40
|
-
*
|
|
41
|
+
* The task being executed, as a deeply immutable TaskJson object.
|
|
42
|
+
* Note: Naming should be unified between `task` and `currentTask`.
|
|
41
43
|
*/
|
|
42
44
|
readonly task: ReadonlyDeep<TaskJson>;
|
|
43
45
|
/**
|
|
44
|
-
*
|
|
46
|
+
* The pipeline structure prepared for execution, as a deeply immutable PipelineJson object.
|
|
45
47
|
*/
|
|
46
48
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
47
49
|
/**
|
|
48
|
-
*
|
|
50
|
+
* The execution report object, which is updated during execution.
|
|
49
51
|
*/
|
|
50
52
|
readonly $executionReport: WritableDeep<ExecutionReportJson>;
|
|
51
53
|
/**
|
|
52
|
-
*
|
|
54
|
+
* String identifier for the pipeline, used for logging and error reporting.
|
|
53
55
|
*/
|
|
54
56
|
readonly pipelineIdentification: string;
|
|
55
57
|
};
|
|
56
58
|
/**
|
|
57
|
-
*
|
|
59
|
+
* Executes a pipeline task with multiple attempts, including joker and retry logic. Handles different task types
|
|
60
|
+
* (prompt, script, dialog, etc.), applies postprocessing, checks expectations, and updates the execution report.
|
|
61
|
+
* Throws errors if execution fails after all attempts.
|
|
58
62
|
*
|
|
63
|
+
* @param options - The options for execution, including task, parameters, pipeline, and configuration.
|
|
64
|
+
* @returns The result string of the executed task.
|
|
59
65
|
* @private internal utility of `createPipelineExecutor`
|
|
60
66
|
*/
|
|
61
67
|
export declare function executeAttempts(options: ExecuteAttemptsOptions): Promise<TODO_string>;
|
|
@@ -3,30 +3,31 @@ import { PipelineExecutionError } from '../../errors/PipelineExecutionError';
|
|
|
3
3
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
4
4
|
import type { Parameters } from '../../types/typeAliases';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Options for filtering and extracting only output parameters from a pipeline execution.
|
|
7
7
|
*
|
|
8
8
|
* @private internal type of `createPipelineExecutor`
|
|
9
9
|
*/
|
|
10
10
|
type FilterJustOutputParametersOptions = {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The fully prepared pipeline containing parameter definitions.
|
|
13
13
|
*/
|
|
14
14
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The parameters passed to the pipeline, including both input and output values.
|
|
17
17
|
*/
|
|
18
18
|
readonly parametersToPass: Readonly<Parameters>;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Array to collect warnings encountered during parameter extraction.
|
|
21
21
|
*/
|
|
22
22
|
readonly $warnings: PipelineExecutionError[];
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* String identifier for the pipeline, used in warning messages.
|
|
25
25
|
*/
|
|
26
26
|
readonly pipelineIdentification: string;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Filters and returns only the output parameters from the provided pipeline execution options.
|
|
30
|
+
* Adds warnings for any expected output parameters that are missing.
|
|
30
31
|
*
|
|
31
32
|
* @private internal utility of `createPipelineExecutor`
|
|
32
33
|
*/
|
|
@@ -3,8 +3,12 @@ import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
|
3
3
|
import type { string_markdown } from '../../types/typeAliases';
|
|
4
4
|
import type { string_parameter_value } from '../../types/typeAliases';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Returns the context for a given task, typically used to provide additional information or variables
|
|
7
|
+
* required for the execution of the task within a pipeline. The context is returned as a string value
|
|
8
|
+
* that may include markdown formatting.
|
|
7
9
|
*
|
|
10
|
+
* @param task - The task for which the context is being generated. This should be a deeply immutable TaskJson object.
|
|
11
|
+
* @returns The context as a string, formatted as markdown and parameter value.
|
|
8
12
|
* @private internal utility of `createPipelineExecutor`
|
|
9
13
|
*/
|
|
10
14
|
export declare function getContextForTask(task: ReadonlyDeep<TaskJson>): Promise<string_parameter_value & string_markdown>;
|
|
@@ -3,7 +3,7 @@ import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
|
3
3
|
import type { string_markdown } from '../../types/typeAliases';
|
|
4
4
|
import type { string_parameter_value } from '../../types/typeAliases';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Retrieves example values or templates for a given task, used to guide or validate pipeline execution.
|
|
7
7
|
*
|
|
8
8
|
* @private internal utility of `createPipelineExecutor`
|
|
9
9
|
*/
|
|
@@ -6,34 +6,31 @@ import type { string_markdown } from '../../types/typeAliases';
|
|
|
6
6
|
import type { string_parameter_value } from '../../types/typeAliases';
|
|
7
7
|
import type { ExecutionTools } from '../ExecutionTools';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Options for retrieving relevant knowledge for a specific task during pipeline execution.
|
|
10
10
|
*
|
|
11
|
-
* @private internal type of `
|
|
11
|
+
* @private internal type of `getKnowledgeForTask`
|
|
12
12
|
*/
|
|
13
13
|
type GetKnowledgeForTaskOptions = {
|
|
14
14
|
/**
|
|
15
|
-
* The execution tools to be used during the execution of the pipeline
|
|
15
|
+
* The execution tools to be used during the execution of the pipeline.
|
|
16
16
|
*/
|
|
17
17
|
readonly tools: ExecutionTools;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The fully prepared pipeline containing all tasks and knowledge pieces.
|
|
20
20
|
*/
|
|
21
21
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The current task for which knowledge is being retrieved.
|
|
24
24
|
*/
|
|
25
25
|
readonly task: ReadonlyDeep<TaskJson>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* Parameters to complete the content of the task for embedding
|
|
27
|
+
* Parameters used to complete the content of the task for embedding and knowledge retrieval.
|
|
30
28
|
*/
|
|
31
29
|
readonly parameters: Readonly<Parameters>;
|
|
32
30
|
};
|
|
33
31
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* Here is the place where RAG (retrieval-augmented generation) happens
|
|
32
|
+
* Retrieves the most relevant knowledge pieces for a given task using embedding-based similarity search.
|
|
33
|
+
* This is where retrieval-augmented generation (RAG) is performed to enhance the task with external knowledge.
|
|
37
34
|
*
|
|
38
35
|
* @private internal utility of `createPipelineExecutor`
|
|
39
36
|
*/
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { AutomaticTranslator } from './AutomaticTranslator';
|
|
2
2
|
import type { TranslatorOptions } from './TranslatorOptions';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Options for configuring the Lindat automatic translator, including API URL and language settings.
|
|
5
5
|
*/
|
|
6
6
|
type LindatAutomaticTranslatorOptions = TranslatorOptions & {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Optional URL of the Lindat translation API endpoint.
|
|
9
9
|
*/
|
|
10
10
|
readonly apiUrl?: URL;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Automatic translator implementation using the Lindat translation API.
|
|
14
14
|
*
|
|
15
|
-
* @private still in development [
|
|
15
|
+
* @private still in development [🏳️]
|
|
16
16
|
*/
|
|
17
17
|
export declare class LindatAutomaticTranslator implements AutomaticTranslator {
|
|
18
18
|
protected readonly options: LindatAutomaticTranslatorOptions;
|
|
@@ -2,8 +2,9 @@ import type { UncertainNumber } from '../UncertainNumber';
|
|
|
2
2
|
/**
|
|
3
3
|
* Make UncertainNumber
|
|
4
4
|
*
|
|
5
|
-
* @param value
|
|
5
|
+
* @param value value of the uncertain number, if `NaN` or `undefined`, it will be set to 0 and `isUncertain=true`
|
|
6
|
+
* @param isUncertain if `true`, the value is uncertain, otherwise depends on the value
|
|
6
7
|
*
|
|
7
8
|
* @private utility for initializating UncertainNumber
|
|
8
9
|
*/
|
|
9
|
-
export declare function uncertainNumber(value?: number | typeof NaN | undefined | null): UncertainNumber;
|
|
10
|
+
export declare function uncertainNumber(value?: number | typeof NaN | undefined | null, isUncertain?: boolean): UncertainNumber;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ParseConfig, UnparseConfig } from 'papaparse';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Settings and configuration options for CSV format handling within the application.
|
|
4
4
|
*/
|
|
5
5
|
export type CsvSettings = Pick<ParseConfig & UnparseConfig, 'delimiter' | 'quoteChar' | 'newline' | 'skipEmptyLines'>;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Contains configuration options for parsing and generating CSV files, such as delimiters and quoting rules.
|
|
8
8
|
*
|
|
9
9
|
* @public exported from `@promptbook/core`
|
|
10
10
|
*/
|
|
@@ -4,34 +4,43 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
4
4
|
import type { string_promptbook_documentation_url } from '../../types/typeAliases';
|
|
5
5
|
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* AbstractFormfactorDefinition provides the base structure for all form factor implementations
|
|
8
|
+
* in the Promptbook system. It defines common properties and interfaces that must be
|
|
9
|
+
* implemented by specific form factors.
|
|
8
10
|
*
|
|
9
11
|
* Note: [🚉] This is fully serializable as JSON
|
|
10
12
|
* @see https://github.com/webgptorg/promptbook/discussions/172
|
|
11
13
|
*/
|
|
12
14
|
export type AbstractFormfactorDefinition = {
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Unique identifier for the form factor in SCREAMING_CASE format
|
|
17
|
+
* Used for programmatic identification and reference
|
|
15
18
|
*/
|
|
16
19
|
readonly name: string_name & string_SCREAMING_CASE;
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
21
|
+
* Alternative names that can be used to reference this form factor
|
|
22
|
+
* Also in SCREAMING_CASE format for consistency
|
|
19
23
|
*/
|
|
20
24
|
readonly aliasNames?: ReadonlyArray<string_name & string_SCREAMING_CASE>;
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* Previous names that were used for this form factor but are now deprecated
|
|
27
|
+
* These are maintained for backward compatibility purposes
|
|
23
28
|
*/
|
|
24
29
|
readonly deprecatedNames?: ReadonlyArray<string_name & string_SCREAMING_CASE>;
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
31
|
+
* Human-readable description of the form factor in markdown format
|
|
32
|
+
* Explains the purpose, functionality, and use cases of this form factor
|
|
27
33
|
*/
|
|
28
34
|
readonly description: string_markdown_text;
|
|
29
35
|
/**
|
|
30
|
-
*
|
|
36
|
+
* URL pointing to detailed documentation for this form factor
|
|
37
|
+
* Provides additional resources and guidance for implementation and usage
|
|
31
38
|
*/
|
|
32
39
|
readonly documentationUrl: string_promptbook_documentation_url;
|
|
33
40
|
/**
|
|
34
|
-
*
|
|
41
|
+
* Defines the interface structure for this form factor's pipeline
|
|
42
|
+
* Specifies how inputs and outputs are handled, processed, and formatted
|
|
43
|
+
* Required for properly configuring and executing the form factor's functionality
|
|
35
44
|
*/
|
|
36
45
|
readonly pipelineInterface: PipelineInterface;
|
|
37
46
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FORMFACTOR_DEFINITIONS } from '../index';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* FormfactorDefinition is a type that defines the structure and capabilities of a specific
|
|
4
|
+
* application form factor in the Promptbook system. It encapsulates all properties needed
|
|
5
|
+
* to represent how a particular interface handles inputs, outputs, and behaviors.
|
|
4
6
|
*
|
|
5
7
|
* Note: [🚉] This is fully serializable as JSON
|
|
6
8
|
* @see https://github.com/webgptorg/promptbook/discussions/172
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Chatbot form factor definition for conversational interfaces that interact with users in a chat-like manner.
|
|
3
3
|
*
|
|
4
4
|
* @public exported from `@promptbook/core`
|
|
5
5
|
*/
|
|
6
6
|
export declare const ChatbotFormfactorDefinition: {
|
|
7
7
|
readonly name: "CHATBOT";
|
|
8
8
|
readonly aliasNames: readonly ["CHAT"];
|
|
9
|
-
readonly description: "
|
|
9
|
+
readonly description: "A chatbot form factor for conversational user interfaces.";
|
|
10
10
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174";
|
|
11
11
|
readonly pipelineInterface: {
|
|
12
12
|
readonly inputParameters: readonly [{
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const CompletionFormfactorDefinition: {
|
|
7
7
|
readonly name: "COMPLETION";
|
|
8
|
-
readonly description: "
|
|
8
|
+
readonly description: "Completion is formfactor that emulates completion models";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
10
|
readonly pipelineInterface: {
|
|
11
11
|
readonly inputParameters: readonly [{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generator
|
|
2
|
+
* Generator form factor represents an application that generates content or data based on user input or predefined rules.
|
|
3
|
+
* This form factor is used for apps that produce outputs, such as text, images, or other media, based on provided input.
|
|
3
4
|
*
|
|
4
5
|
* @public exported from `@promptbook/core`
|
|
5
6
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A generic pipeline
|
|
3
3
|
*
|
|
4
4
|
* @public exported from `@promptbook/core`
|
|
5
5
|
*/
|
|
6
6
|
export declare const GenericFormfactorDefinition: {
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
|
-
readonly description: "
|
|
8
|
+
readonly description: "A generic pipeline";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173";
|
|
10
10
|
readonly pipelineInterface: {
|
|
11
11
|
readonly inputParameters: readonly [];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
|
-
readonly description: "
|
|
8
|
+
readonly description: "A generic pipeline";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173";
|
|
10
10
|
readonly pipelineInterface: {
|
|
11
11
|
readonly inputParameters: readonly [];
|
|
@@ -14,7 +14,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
14
14
|
}, {
|
|
15
15
|
readonly name: "CHATBOT";
|
|
16
16
|
readonly aliasNames: readonly ["CHAT"];
|
|
17
|
-
readonly description: "
|
|
17
|
+
readonly description: "A chatbot form factor for conversational user interfaces.";
|
|
18
18
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174";
|
|
19
19
|
readonly pipelineInterface: {
|
|
20
20
|
readonly inputParameters: readonly [{
|
|
@@ -52,7 +52,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
52
52
|
};
|
|
53
53
|
}, {
|
|
54
54
|
readonly name: "TRANSLATOR";
|
|
55
|
-
readonly description: "
|
|
55
|
+
readonly description: "A text transformation system that converts input content into different forms,\n including language translations, paraphrasing, style conversions, and tone adjustments.\n This form factor takes one input and produces one transformed output.";
|
|
56
56
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175";
|
|
57
57
|
readonly pipelineInterface: {
|
|
58
58
|
readonly inputParameters: readonly [{
|
|
@@ -89,7 +89,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
89
89
|
};
|
|
90
90
|
}, {
|
|
91
91
|
readonly name: "EXPERIMENTAL_MATCHER";
|
|
92
|
-
readonly description: "
|
|
92
|
+
readonly description: "An evaluation system that determines whether content meets specific criteria or patterns.\n Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.";
|
|
93
93
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
|
|
94
94
|
readonly pipelineInterface: {
|
|
95
95
|
readonly inputParameters: readonly [{
|
|
@@ -143,7 +143,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
143
143
|
};
|
|
144
144
|
}, {
|
|
145
145
|
readonly name: "COMPLETION";
|
|
146
|
-
readonly description: "
|
|
146
|
+
readonly description: "Completion is formfactor that emulates completion models";
|
|
147
147
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
148
148
|
readonly pipelineInterface: {
|
|
149
149
|
readonly inputParameters: readonly [{
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Matcher is form of app that
|
|
2
|
+
* Matcher is form of app that evaluates (spreadsheet) content against defined criteria or patterns,
|
|
3
|
+
* determining if it matches or meets specific requirements. Used for classification,
|
|
4
|
+
* validation, filtering, and quality assessment of inputs.
|
|
3
5
|
*
|
|
4
6
|
* @public exported from `@promptbook/core`
|
|
5
7
|
*/
|
|
6
8
|
export declare const MatcherFormfactorDefinition: {
|
|
7
9
|
readonly name: "EXPERIMENTAL_MATCHER";
|
|
8
|
-
readonly description: "
|
|
10
|
+
readonly description: "An evaluation system that determines whether content meets specific criteria or patterns.\n Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.";
|
|
9
11
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
|
|
10
12
|
readonly pipelineInterface: {
|
|
11
13
|
readonly inputParameters: readonly [{
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Translator is form of app that
|
|
2
|
+
* Translator is form of app that transforms input text from one form to another,
|
|
3
|
+
* such as language translation, style conversion, tone modification, or other text transformations.
|
|
3
4
|
*
|
|
4
5
|
* @public exported from `@promptbook/core`
|
|
5
6
|
*/
|
|
6
7
|
export declare const TranslatorFormfactorDefinition: {
|
|
7
8
|
readonly name: "TRANSLATOR";
|
|
8
|
-
readonly description: "
|
|
9
|
+
readonly description: "A text transformation system that converts input content into different forms,\n including language translations, paraphrasing, style conversions, and tone adjustments.\n This form factor takes one input and produces one transformed output.";
|
|
9
10
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175";
|
|
10
11
|
readonly pipelineInterface: {
|
|
11
12
|
readonly inputParameters: readonly [{
|
|
@@ -3,7 +3,8 @@ import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage
|
|
|
3
3
|
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
|
|
4
4
|
type GetLlmToolsForTestingAndScriptsAndPlaygroundOptions = CreateLlmToolsFromConfigurationOptions & {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Flag indicating whether the cache should be reloaded or reused
|
|
7
|
+
* When set to true, the existing cache will not be used but thinks will be still saved to the cache
|
|
7
8
|
*
|
|
8
9
|
* @default false
|
|
9
10
|
*/
|
|
@@ -22,5 +23,5 @@ export {};
|
|
|
22
23
|
* Note: [⚪] This should never be in any released package
|
|
23
24
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
24
25
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
25
|
-
* TODO: [®] DRY Register
|
|
26
|
-
*/
|
|
26
|
+
* TODO: [®] DRY Register logi
|
|
27
|
+
*/
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { MultipleLlmExecutionTools } from '../../multiple/MultipleLlmExecutionTools';
|
|
2
2
|
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Automatically configures LLM tools from environment variables in Node.js
|
|
5
|
+
*
|
|
6
|
+
* This utility function detects available LLM providers based on environment variables
|
|
7
|
+
* and creates properly configured LLM execution tools for each detected provider.
|
|
5
8
|
*
|
|
6
9
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
7
10
|
*
|
|
8
|
-
*
|
|
11
|
+
* Supports environment variables from .env files when dotenv is configured
|
|
9
12
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
10
13
|
*
|
|
11
14
|
* It looks for environment variables:
|
|
@@ -13,12 +16,22 @@ import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFro
|
|
|
13
16
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
14
17
|
* - ...
|
|
15
18
|
*
|
|
16
|
-
* @
|
|
19
|
+
* @param options Configuration options for the LLM tools
|
|
20
|
+
* @returns A unified interface containing all detected and configured LLM tools
|
|
17
21
|
* @public exported from `@promptbook/node`
|
|
18
22
|
*/
|
|
19
23
|
export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConfigurationOptions): Promise<MultipleLlmExecutionTools>;
|
|
20
24
|
/**
|
|
21
|
-
* TODO:
|
|
25
|
+
* TODO: The architecture for LLM tools configuration consists of three key functions:
|
|
26
|
+
* 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
|
|
27
|
+
* 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
|
|
28
|
+
* 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
|
|
29
|
+
*
|
|
30
|
+
* This layered approach allows flexibility in how tools are configured:
|
|
31
|
+
* - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
|
|
32
|
+
* - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
|
|
33
|
+
* - Use createLlmToolsFromConfiguration for explicit control over tool configurations
|
|
34
|
+
*
|
|
22
35
|
* TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
|
|
23
36
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
24
37
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
@@ -2,17 +2,24 @@ import type { string_title } from '../../../types/typeAliases';
|
|
|
2
2
|
import type { Registered } from '../../../utils/$Register';
|
|
3
3
|
import type { LlmToolsOptions } from './LlmToolsOptions';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Configuration definition for LLM execution tools, containing provider-specific settings
|
|
6
|
+
* that can be passed during runtime to instantiate and configure LLM tools properly.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* The Promptbook LLM tools architecture involves several related types:
|
|
9
|
+
* - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
|
|
10
|
+
* - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
|
|
11
|
+
* - `LlmToolsOptions`: Provider-specific options for instantiating tools
|
|
12
|
+
* - `Registered`: The record of a registered tool in the global registry
|
|
8
13
|
*/
|
|
9
14
|
export type LlmToolsConfiguration = ReadonlyArray<Registered & {
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
16
|
+
* Human-readable name for this specific provider configuration
|
|
17
|
+
* Used in UI components and logs for identifying this particular configuration
|
|
12
18
|
*/
|
|
13
19
|
readonly title: string_title;
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
21
|
+
* Provider-specific configuration options used for instantiating and configuring LLM tools
|
|
22
|
+
* Contains values like API keys, model preferences, endpoint URLs, and other settings
|
|
16
23
|
*/
|
|
17
24
|
readonly options: LlmToolsOptions;
|
|
18
25
|
}>;
|
|
@@ -1,61 +1,34 @@
|
|
|
1
|
+
import { MODEL_ORDERS } from '../../../constants';
|
|
2
|
+
import { MODEL_TRUST_LEVELS } from '../../../constants';
|
|
1
3
|
import type { string_name } from '../../../types/typeAliases';
|
|
2
4
|
import type { string_title } from '../../../types/typeAliases';
|
|
3
5
|
import type { Registered } from '../../../utils/$Register';
|
|
4
6
|
import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
7
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
9
|
+
* Metadata definition for LLM execution tools that provides information about a provider's capabilities,
|
|
10
|
+
* configuration options, and relationships within the registry system.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly PARTIALLY_OPEN: "Model is open source, but training data and model weights are not (fully) known";
|
|
15
|
-
readonly CLOSED_LOCAL: "Model can be run locally, but it is not open source";
|
|
16
|
-
readonly CLOSED_FREE: "Model is behind API gateway but free to use";
|
|
17
|
-
readonly CLOSED_BUSINESS: "Model is behind API gateway and paid but has good SLA, TOS, privacy policy and in general is a good to use in business applications";
|
|
18
|
-
readonly CLOSED: "Model is behind API gateway and paid";
|
|
19
|
-
readonly UNTRUSTED: "Model has questions about the training data and ethics, but it is not known if it is a problem or not";
|
|
20
|
-
readonly VURNABLE: "Model has some known serious vulnerabilities, leaks, ethical problems, etc.";
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* How is the model provider important?
|
|
24
|
-
*
|
|
25
|
-
* @public exported from `@promptbook/core`
|
|
26
|
-
*/
|
|
27
|
-
export declare const MODEL_ORDER: {
|
|
28
|
-
/**
|
|
29
|
-
* Top-tier models, e.g. OpenAI, Anthropic,...
|
|
30
|
-
*/
|
|
31
|
-
readonly TOP_TIER: 333;
|
|
32
|
-
/**
|
|
33
|
-
* Mid-tier models, e.g. Llama, Mistral, etc.
|
|
34
|
-
*/
|
|
35
|
-
readonly NORMAL: 100;
|
|
36
|
-
/**
|
|
37
|
-
* Low-tier models, e.g. Phi, Tiny, etc.
|
|
38
|
-
*/
|
|
39
|
-
readonly LOW_TIER: 0;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* @@@
|
|
43
|
-
*
|
|
44
|
-
* @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
|
|
12
|
+
* The Promptbook LLM tools architecture involves several related types:
|
|
13
|
+
* - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
|
|
14
|
+
* - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
|
|
15
|
+
* - `LlmToolsOptions`: Provider-specific options for instantiating tools
|
|
16
|
+
* - `Registered`: The record of a registered tool in the global registry
|
|
45
17
|
*/
|
|
46
18
|
export type LlmToolsMetadata = Registered & {
|
|
47
19
|
/**
|
|
48
|
-
*
|
|
20
|
+
* Human-readable display name for the LLM provider
|
|
21
|
+
* Used in UI components and documentation references
|
|
49
22
|
*/
|
|
50
23
|
readonly title: string_title;
|
|
51
24
|
/**
|
|
52
25
|
* How is the model is trusted?
|
|
53
26
|
*/
|
|
54
|
-
readonly trustLevel: keyof typeof
|
|
27
|
+
readonly trustLevel: keyof typeof MODEL_TRUST_LEVELS;
|
|
55
28
|
/**
|
|
56
29
|
* How is the model provider important and should be sorted in the list of available providers?
|
|
57
30
|
*/
|
|
58
|
-
readonly order: typeof
|
|
31
|
+
readonly order: typeof MODEL_ORDERS[keyof typeof MODEL_ORDERS] | number;
|
|
59
32
|
/**
|
|
60
33
|
* List of environment variables that can be used to configure the provider
|
|
61
34
|
*
|
|
@@ -64,11 +37,17 @@ export type LlmToolsMetadata = Registered & {
|
|
|
64
37
|
*/
|
|
65
38
|
readonly envVariables: ReadonlyArray<string_name & string_SCREAMING_CASE> | null;
|
|
66
39
|
/**
|
|
67
|
-
*
|
|
40
|
+
* Provides a default configuration template for this LLM provider
|
|
41
|
+
* Used to generate example configurations or as fallback when no specific configuration is provided
|
|
42
|
+
* @returns A standardized configuration object for this LLM provider
|
|
68
43
|
*/
|
|
69
44
|
getBoilerplateConfiguration(): LlmToolsConfiguration[number];
|
|
70
45
|
/**
|
|
71
|
-
*
|
|
46
|
+
* Creates a provider-specific configuration object from environment variables
|
|
47
|
+
* Used to automatically configure LLM tools based on available environment settings
|
|
48
|
+
*
|
|
49
|
+
* @param env Dictionary of environment variables (key-value pairs)
|
|
50
|
+
* @returns Configuration object for this LLM provider if required variables are present, or null if configuration is not possible
|
|
72
51
|
*/
|
|
73
52
|
createConfigurationFromEnv(env: Record<string_name, string>): LlmToolsConfiguration[number] | null;
|
|
74
53
|
};
|
|
@@ -5,7 +5,11 @@ import type { TODO_object } from '../../../utils/organization/TODO_object';
|
|
|
5
5
|
* This type is used to pass provider-specific options to LLM execution tools.
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* The Promptbook LLM tools architecture involves several related types:
|
|
9
|
+
* - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
|
|
10
|
+
* - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
|
|
11
|
+
* - `LlmToolsOptions`: Provider-specific options for instantiating tools
|
|
12
|
+
* - `Registered`: The record of a registered tool in the global registry
|
|
9
13
|
*/
|
|
10
14
|
export type LlmToolsOptions = TODO_object;
|
|
11
15
|
/**
|