@promptbook/openai 0.61.0-14 → 0.61.0-16
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 +2 -2
- package/esm/index.es.js +148 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +12 -15
- package/esm/typings/src/_packages/core.index.d.ts +2 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -3
- package/esm/typings/src/_packages/utils.index.d.ts +4 -3
- package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -3
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +28 -3
- package/esm/typings/src/config.d.ts +26 -1
- package/esm/typings/src/config.test.d.ts +4 -0
- package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +3 -0
- package/esm/typings/src/execution/PipelineExecutor.d.ts +5 -5
- package/esm/typings/src/execution/PromptResultUsage.d.ts +3 -3
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +2 -3
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +16 -3
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +27 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -3
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +9 -0
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +2 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +3 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +4 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +5 -3
- package/esm/typings/src/types/Prompt.d.ts +7 -10
- package/esm/typings/src/types/typeAliases.d.ts +44 -4
- package/esm/typings/src/utils/deepFreeze.d.ts +10 -1
- package/esm/typings/src/utils/extractParameters.d.ts +2 -2
- package/esm/typings/src/{execution/utils → utils}/replaceParameters.d.ts +2 -4
- package/esm/typings/src/utils/sets/difference.d.ts +3 -0
- package/package.json +2 -2
- package/umd/index.umd.js +148 -10
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +12 -15
- package/umd/typings/src/_packages/core.index.d.ts +2 -1
- package/umd/typings/src/_packages/types.index.d.ts +2 -3
- package/umd/typings/src/_packages/utils.index.d.ts +4 -3
- package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -3
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +28 -3
- package/umd/typings/src/config.d.ts +26 -1
- package/umd/typings/src/config.test.d.ts +4 -0
- package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +3 -0
- package/umd/typings/src/execution/PipelineExecutor.d.ts +5 -5
- package/umd/typings/src/execution/PromptResultUsage.d.ts +3 -3
- package/umd/typings/src/execution/ScriptExecutionTools.d.ts +2 -3
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +16 -3
- package/umd/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +27 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -2
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -3
- package/umd/typings/src/prepare/isPipelinePrepared.d.ts +9 -0
- package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +1 -0
- package/umd/typings/src/prepare/preparePipeline.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +2 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +3 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +4 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +5 -3
- package/umd/typings/src/types/Prompt.d.ts +7 -10
- package/umd/typings/src/types/typeAliases.d.ts +44 -4
- package/umd/typings/src/utils/deepFreeze.d.ts +10 -1
- package/umd/typings/src/utils/extractParameters.d.ts +2 -2
- package/umd/typings/src/{execution/utils → utils}/replaceParameters.d.ts +2 -4
- package/umd/typings/src/utils/replaceParameters.test.d.ts +1 -0
- package/umd/typings/src/utils/sets/difference.d.ts +3 -0
- package/esm/typings/src/types/Parameters.d.ts +0 -14
- package/umd/typings/src/types/Parameters.d.ts +0 -14
- /package/esm/typings/src/{execution/utils/replaceParameters.test.d.ts → prepare/isPipelinePrepared.test.d.ts} +0 -0
- /package/{umd/typings/src/execution → esm/typings/src}/utils/replaceParameters.test.d.ts +0 -0
|
@@ -5,10 +5,10 @@ import type { CompletionModelRequirements } from './ModelRequirements';
|
|
|
5
5
|
import type { EmbeddingModelRequirements } from './ModelRequirements';
|
|
6
6
|
import type { ModelRequirements } from './ModelRequirements';
|
|
7
7
|
import type { Expectations } from './PipelineJson/Expectations';
|
|
8
|
-
import type {
|
|
9
|
-
import type { string_parameter_value } from './typeAliases';
|
|
8
|
+
import type { Parameters } from './typeAliases';
|
|
10
9
|
import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
|
|
11
10
|
import type { string_prompt } from './typeAliases';
|
|
11
|
+
import type { string_template } from './typeAliases';
|
|
12
12
|
import type { string_title } from './typeAliases';
|
|
13
13
|
/**
|
|
14
14
|
* Prompt in a text along with model requirements, but without any execution or templating logic.
|
|
@@ -63,12 +63,11 @@ export type CommonPrompt = {
|
|
|
63
63
|
*/
|
|
64
64
|
readonly title: string_title;
|
|
65
65
|
/**
|
|
66
|
-
* The text of the prompt
|
|
66
|
+
* The text of the prompt with placeholders for parameters
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
* @example "What is the capital of France?"
|
|
68
|
+
* @example "What is the capital of {country}?"
|
|
70
69
|
*/
|
|
71
|
-
readonly content: string_prompt;
|
|
70
|
+
readonly content: string_prompt & string_template;
|
|
72
71
|
/**
|
|
73
72
|
* Requirements for the model
|
|
74
73
|
*/
|
|
@@ -98,11 +97,9 @@ export type CommonPrompt = {
|
|
|
98
97
|
*/
|
|
99
98
|
readonly pipelineUrl?: string_pipeline_url_with_hashtemplate;
|
|
100
99
|
/**
|
|
101
|
-
* Parameters used in the
|
|
102
|
-
*
|
|
103
|
-
* Note: This is redundant (same information is in pipelineUrl+content) but useful for logging and debugging
|
|
100
|
+
* Parameters used in the `content`
|
|
104
101
|
*/
|
|
105
|
-
readonly parameters:
|
|
102
|
+
readonly parameters: Parameters;
|
|
106
103
|
};
|
|
107
104
|
/**
|
|
108
105
|
* TODO: [🔼] !!!! Export all from `@promptbook/types`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RESERVED_PARAMETER_NAMES } from '../config';
|
|
1
2
|
/**
|
|
2
3
|
* Semantic helper
|
|
3
4
|
*/
|
|
@@ -17,7 +18,7 @@ export type string_prompt = string;
|
|
|
17
18
|
/**
|
|
18
19
|
* Semantic helper
|
|
19
20
|
*
|
|
20
|
-
* For example `"A cat wearing a {
|
|
21
|
+
* For example `"A cat wearing a {item}"`
|
|
21
22
|
*/
|
|
22
23
|
export type string_template = string;
|
|
23
24
|
/**
|
|
@@ -85,14 +86,36 @@ export type string_name = string;
|
|
|
85
86
|
*
|
|
86
87
|
* For example `"eventName"`
|
|
87
88
|
*/
|
|
88
|
-
export type string_parameter_name =
|
|
89
|
+
export type string_parameter_name = string_name;
|
|
89
90
|
/**
|
|
90
91
|
* Semantic helper
|
|
91
|
-
* Unique identifier of
|
|
92
|
+
* Unique identifier of parameter
|
|
92
93
|
*
|
|
93
94
|
* For example `"DevConf 2024"`
|
|
94
95
|
*/
|
|
95
96
|
export type string_parameter_value = string;
|
|
97
|
+
/**
|
|
98
|
+
* Parameters of the pipeline
|
|
99
|
+
*
|
|
100
|
+
* There are three types of parameters:
|
|
101
|
+
* - **INPUT PARAMETERs** are required to execute the pipeline.
|
|
102
|
+
* - **Intermediate parameters** are used internally in the pipeline.
|
|
103
|
+
* - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
|
|
104
|
+
*
|
|
105
|
+
* @see https://ptbk.io/parameters
|
|
106
|
+
*/
|
|
107
|
+
export type Parameters = Exclude<Record<string_parameter_name, string_parameter_value>, ReservedParameters>;
|
|
108
|
+
/**
|
|
109
|
+
* Semantic helper
|
|
110
|
+
* Unique identifier of reserved parameter
|
|
111
|
+
*
|
|
112
|
+
* For example `"context"`
|
|
113
|
+
*/
|
|
114
|
+
export type string_reserved_parameter_name = typeof RESERVED_PARAMETER_NAMES[number];
|
|
115
|
+
/**
|
|
116
|
+
* @@@
|
|
117
|
+
*/
|
|
118
|
+
export type ReservedParameters = Record<string_reserved_parameter_name, string_parameter_value>;
|
|
96
119
|
/**
|
|
97
120
|
* Semantic helper
|
|
98
121
|
* Title of anything
|
|
@@ -115,8 +138,21 @@ export type string_persona_description = string;
|
|
|
115
138
|
* For example `"./pavol-hejny-cv.pdf"`
|
|
116
139
|
* For example `"Pavol Hejný has web https://pavolhejny.com/"`
|
|
117
140
|
* For example `"Pavol Hejný is web developer and creator of Promptbook and Collboard"`
|
|
141
|
+
*
|
|
142
|
+
* @@@ string_knowledge_source vs string_knowledge_source_link
|
|
143
|
+
*/
|
|
144
|
+
export type string_knowledge_source = string_knowledge_source_link | string_markdown;
|
|
145
|
+
/**
|
|
146
|
+
* One link to knowledge source
|
|
147
|
+
*
|
|
148
|
+
* It can be a link or relative path
|
|
149
|
+
*
|
|
150
|
+
* For example `"https://pavolhejny.com/"`
|
|
151
|
+
* For example `"./pavol-hejny-cv.pdf"`
|
|
152
|
+
*
|
|
153
|
+
* @@@ string_knowledge_source vs string_knowledge_source_link
|
|
118
154
|
*/
|
|
119
|
-
export type
|
|
155
|
+
export type string_knowledge_source_link = string_url | string_file_path;
|
|
120
156
|
/**
|
|
121
157
|
* Semantic helper
|
|
122
158
|
*
|
|
@@ -160,6 +196,10 @@ export type string_markdown_section_content = string;
|
|
|
160
196
|
* For example `"**Hello** World!"`
|
|
161
197
|
*/
|
|
162
198
|
export type string_markdown_text = string;
|
|
199
|
+
/**
|
|
200
|
+
* @@@
|
|
201
|
+
*/
|
|
202
|
+
export type string_promptbook_documentation_url = `https://github.com/webgptorg/promptbook/discussions/${number | '@@'}`;
|
|
163
203
|
/**
|
|
164
204
|
* Semantic helper
|
|
165
205
|
*
|
|
@@ -4,9 +4,18 @@ import type { ReadonlyDeep } from 'type-fest';
|
|
|
4
4
|
*
|
|
5
5
|
* @returns The same object as the input, but deeply frozen
|
|
6
6
|
*
|
|
7
|
-
* Note: This function mutates the object
|
|
7
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
8
8
|
*/
|
|
9
9
|
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
|
|
10
|
+
/**
|
|
11
|
+
* @@@
|
|
12
|
+
* @@@
|
|
13
|
+
*
|
|
14
|
+
* @returns The same object as the input, but deeply frozen
|
|
15
|
+
*
|
|
16
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
17
|
+
*/
|
|
18
|
+
export declare function deepFreezeWithSameType<TObject>(objectValue: TObject): TObject;
|
|
10
19
|
/**
|
|
11
20
|
* TODO: [🔼] Export from `@promptbook/utils`
|
|
12
21
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { string_parameter_name } from '../types/typeAliases';
|
|
2
2
|
import type { string_template } from '../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the template and returns the list of all parameter names
|
|
@@ -6,4 +6,4 @@ import type { string_template } from '../types/typeAliases';
|
|
|
6
6
|
* @param template the template with parameters in {curly} braces
|
|
7
7
|
* @returns the list of parameter names
|
|
8
8
|
*/
|
|
9
|
-
export declare function extractParameters(template: string_template): Set<
|
|
9
|
+
export declare function extractParameters(template: string_template): Set<string_parameter_name>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Parameters } from '
|
|
2
|
-
import type { string_template } from '
|
|
1
|
+
import type { Parameters } from '../types/typeAliases';
|
|
2
|
+
import type { string_template } from '../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Replaces parameters in template with values from parameters object
|
|
5
5
|
*
|
|
@@ -7,7 +7,5 @@ import type { string_template } from '../../types/typeAliases';
|
|
|
7
7
|
* @param parameters the object with parameters
|
|
8
8
|
* @returns the template with replaced parameters
|
|
9
9
|
* @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
|
|
10
|
-
*
|
|
11
|
-
* @private within the createPipelineExecutor
|
|
12
10
|
*/
|
|
13
11
|
export declare function replaceParameters(template: string_template, parameters: Parameters): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,3 +4,6 @@
|
|
|
4
4
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
5
5
|
*/
|
|
6
6
|
export declare function difference<TItem>(a: Set<TItem>, b: Set<TItem>, isEqual?: (a: TItem, b: TItem) => boolean): Set<TItem>;
|
|
7
|
+
/**
|
|
8
|
+
* TODO: [🧠][💯] Maybe also implement symmetricDifference
|
|
9
|
+
*/
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parameters of the pipeline
|
|
3
|
-
*
|
|
4
|
-
* There are three types of parameters:
|
|
5
|
-
* - **INPUT PARAMETERs** are required to execute the pipeline.
|
|
6
|
-
* - **Intermediate parameters** are used internally in the pipeline.
|
|
7
|
-
* - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/webgptorg/promptbook#parameters
|
|
10
|
-
*/
|
|
11
|
-
export type Parameters = object;
|
|
12
|
-
/**
|
|
13
|
-
* TODO: Constrain type to Simple key-value object, only string keys and string values and no index signature + only camelCase keys and spaceTrimmed values
|
|
14
|
-
*/
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parameters of the pipeline
|
|
3
|
-
*
|
|
4
|
-
* There are three types of parameters:
|
|
5
|
-
* - **INPUT PARAMETERs** are required to execute the pipeline.
|
|
6
|
-
* - **Intermediate parameters** are used internally in the pipeline.
|
|
7
|
-
* - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/webgptorg/promptbook#parameters
|
|
10
|
-
*/
|
|
11
|
-
export type Parameters = object;
|
|
12
|
-
/**
|
|
13
|
-
* TODO: Constrain type to Simple key-value object, only string keys and string values and no index signature + only camelCase keys and spaceTrimmed values
|
|
14
|
-
*/
|
|
File without changes
|
|
File without changes
|