@promptbook/remote-client 0.61.0-15 → 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/esm/index.es.js +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 +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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ScriptLanguage } from '../types/ScriptLanguage';
|
|
2
|
-
import type {
|
|
3
|
-
import type { string_parameter_value } from '../types/typeAliases';
|
|
2
|
+
import type { Parameters } from '../types/typeAliases';
|
|
4
3
|
import type { string_script } from '../types/typeAliases';
|
|
5
4
|
/**
|
|
6
5
|
* Represents all the tools needed to EXECUTE SCRIPTs
|
|
@@ -23,7 +22,7 @@ export type ScriptExecutionToolsExecuteOptions = {
|
|
|
23
22
|
* Theese parameters are passed to the script as variables
|
|
24
23
|
* For example: { "name": "John" } => const name = "John";
|
|
25
24
|
*/
|
|
26
|
-
readonly parameters:
|
|
25
|
+
readonly parameters: Parameters;
|
|
27
26
|
/**
|
|
28
27
|
* The content of the script to execute
|
|
29
28
|
* - It can be a single statement
|
|
@@ -5,9 +5,21 @@ type CreatePipelineExecutorSettings = {
|
|
|
5
5
|
/**
|
|
6
6
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
7
7
|
*
|
|
8
|
-
* @default
|
|
8
|
+
* @default MAX_EXECUTION_ATTEMPTS
|
|
9
9
|
*/
|
|
10
|
-
readonly maxExecutionAttempts
|
|
10
|
+
readonly maxExecutionAttempts?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of tasks running in parallel
|
|
13
|
+
*
|
|
14
|
+
* @default MAX_PARALLEL_COUNT
|
|
15
|
+
*/
|
|
16
|
+
readonly maxParallelCount?: number;
|
|
17
|
+
/**
|
|
18
|
+
* If true, the preparation logs additional information
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
readonly isVerbose?: boolean;
|
|
11
23
|
};
|
|
12
24
|
/**
|
|
13
25
|
* Options for `createPipelineExecutor`
|
|
@@ -35,7 +47,8 @@ interface CreatePipelineExecutorOptions {
|
|
|
35
47
|
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
36
48
|
export {};
|
|
37
49
|
/**
|
|
38
|
-
* TODO:
|
|
50
|
+
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
51
|
+
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
39
52
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
40
53
|
* TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user
|
|
41
54
|
* TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
|
|
@@ -65,5 +65,5 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
|
|
|
65
65
|
* TODO: [🍓][👨⚖️] Compute TPartialValue dynamically - PartialString<TValue>
|
|
66
66
|
* TODO: [🍓][🧠] Should execution tools be aviable to heal, canBeValid and isValid?
|
|
67
67
|
* TODO: [🍓][🧠] llm Provider Bindings
|
|
68
|
-
* TODO: [🍓]Export via some package
|
|
68
|
+
* TODO: [🍓][🔼] Export via some package
|
|
69
69
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { string_file_path } from '../../../types/typeAliases';
|
|
3
|
+
import type { string_knowledge_source_link } from '../../../types/typeAliases';
|
|
4
|
+
import type { string_markdown } from '../../../types/typeAliases';
|
|
5
|
+
import type { string_markdown_text } from '../../../types/typeAliases';
|
|
6
|
+
import type { string_mime_type } from '../../../types/typeAliases';
|
|
7
|
+
import type { string_mime_type_with_wildcard } from '../../../types/typeAliases';
|
|
8
|
+
import type { string_promptbook_documentation_url } from '../../../types/typeAliases';
|
|
9
|
+
import type { really_unknown } from '../../../utils/organization/really_unknown';
|
|
10
|
+
export type Scraper = {
|
|
11
|
+
readonly description: string_markdown_text;
|
|
12
|
+
readonly documentationUrl: string_promptbook_documentation_url;
|
|
13
|
+
readonly examples: Array<string_file_path>;
|
|
14
|
+
readonly mimeTypes: Array<string_mime_type_with_wildcard>;
|
|
15
|
+
scrape(source: ScraperSourceOptions): Promisable<string_markdown>;
|
|
16
|
+
};
|
|
17
|
+
export type ScraperSourceOptions = {
|
|
18
|
+
readonly source: string_knowledge_source_link;
|
|
19
|
+
readonly mimeType: string_mime_type;
|
|
20
|
+
asJson(): Promise<really_unknown>;
|
|
21
|
+
asText(): Promise<really_unknown>;
|
|
22
|
+
asBlob(): Promise<really_unknown>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* TODO: [🐝] @@@ Annotate all
|
|
26
|
+
* TODO: [🔼] Export via types
|
|
27
|
+
*/
|
|
@@ -8,7 +8,7 @@ import type { KnowledgeSourceJson } from '../../../types/PipelineJson/KnowledgeS
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function prepareKnowledgePieces(knowledgeSources: Array<KnowledgeSourceJson>, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
11
|
+
* TODO: [🐝][🔼] !!! Export via `@promptbook/core`
|
|
12
12
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
13
13
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
14
14
|
* TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
|
package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function prepareKnowledgeFromMarkdown(content: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🔼] !!! Export via `@promptbook/markdown`
|
|
9
|
+
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
10
10
|
* TODO: [🪂] Do it in parallel 11:11
|
|
11
11
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
12
12
|
*/
|
|
@@ -6,7 +6,7 @@ import type { string_base64 } from '../../../types/typeAliases';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function prepareKnowledgeFromPdf(content: string_base64, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🔼] !!! Export via `@promptbook/pdf`
|
|
9
|
+
* TODO: [🐝][🔼] !!! Export via `@promptbook/pdf`
|
|
10
10
|
* TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
|
|
11
11
|
* @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
|
|
12
12
|
* TODO: [🪂] Do it in parallel
|
|
@@ -26,7 +26,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
26
26
|
/**
|
|
27
27
|
* Calls Anthropic Claude API to use a chat model.
|
|
28
28
|
*/
|
|
29
|
-
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
29
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
30
30
|
/**
|
|
31
31
|
* Get the model that should be used as default
|
|
32
32
|
*/
|
|
@@ -27,11 +27,11 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
27
27
|
/**
|
|
28
28
|
* Calls OpenAI API to use a chat model.
|
|
29
29
|
*/
|
|
30
|
-
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
30
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
31
31
|
/**
|
|
32
32
|
* Calls Azure OpenAI API to use a complete model.
|
|
33
33
|
*/
|
|
34
|
-
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
34
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
35
35
|
/**
|
|
36
36
|
* Changes Azure error (which is not propper Error but object) to propper Error
|
|
37
37
|
*/
|
|
@@ -18,11 +18,11 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
18
18
|
/**
|
|
19
19
|
* Mocks chat model
|
|
20
20
|
*/
|
|
21
|
-
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
21
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
|
|
22
22
|
/**
|
|
23
23
|
* Mocks completion model
|
|
24
24
|
*/
|
|
25
|
-
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
25
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
26
26
|
/**
|
|
27
27
|
* List all available mocked-models that can be used
|
|
28
28
|
*/
|
|
@@ -19,15 +19,15 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
19
19
|
/**
|
|
20
20
|
* Fakes chat model
|
|
21
21
|
*/
|
|
22
|
-
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<ChatPromptResult & CompletionPromptResult>;
|
|
22
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<ChatPromptResult & CompletionPromptResult>;
|
|
23
23
|
/**
|
|
24
24
|
* Fakes completion model
|
|
25
25
|
*/
|
|
26
|
-
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<CompletionPromptResult>;
|
|
26
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<CompletionPromptResult>;
|
|
27
27
|
/**
|
|
28
28
|
* Fakes embedding model
|
|
29
29
|
*/
|
|
30
|
-
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<EmbeddingPromptResult>;
|
|
30
|
+
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<EmbeddingPromptResult>;
|
|
31
31
|
/**
|
|
32
32
|
* List all available fake-models that can be used
|
|
33
33
|
*/
|
|
@@ -28,15 +28,15 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
28
28
|
/**
|
|
29
29
|
* Calls OpenAI API to use a chat model.
|
|
30
30
|
*/
|
|
31
|
-
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectFormat'>): Promise<ChatPromptResult>;
|
|
31
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectFormat'>): Promise<ChatPromptResult>;
|
|
32
32
|
/**
|
|
33
33
|
* Calls OpenAI API to use a complete model.
|
|
34
34
|
*/
|
|
35
|
-
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
35
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
|
|
36
36
|
/**
|
|
37
37
|
* Calls OpenAI API to use a embedding model
|
|
38
38
|
*/
|
|
39
|
-
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<EmbeddingPromptResult>;
|
|
39
|
+
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<EmbeddingPromptResult>;
|
|
40
40
|
/**
|
|
41
41
|
* Get the model that should be used as default
|
|
42
42
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
+
/**
|
|
3
|
+
* Determine if the pipeline is fully prepared
|
|
4
|
+
*/
|
|
5
|
+
export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* TODO: [🔼] Export via core or utils
|
|
8
|
+
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
9
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,6 +8,7 @@ import type { PrepareOptions } from './PrepareOptions';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function preparePipeline(pipeline: PipelineJson, options: PrepareOptions): Promise<PipelineJson>;
|
|
10
10
|
/**
|
|
11
|
+
* TODO: !!!!! Index the samples and maybe templates
|
|
11
12
|
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
12
13
|
* TODO: Write tests for `preparePipeline`
|
|
13
14
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
@@ -9,7 +9,7 @@ export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
|
9
9
|
/**
|
|
10
10
|
* Name of the persona who will be responding to this prompt
|
|
11
11
|
*/
|
|
12
|
-
readonly personaName
|
|
12
|
+
readonly personaName?: string_name;
|
|
13
13
|
/**
|
|
14
14
|
* Requirements for the model
|
|
15
15
|
* - This is required only for blockType PROMPT_TEMPLATE
|
|
@@ -17,6 +17,7 @@ export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
|
17
17
|
readonly modelRequirements: ModelRequirements;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
+
* TODO: [🧠][🥜]
|
|
20
21
|
* TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
|
|
21
22
|
* @see https://github.com/webgptorg/promptbook/discussions/79
|
|
22
23
|
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
@@ -79,6 +79,7 @@ export type PipelineJson = {
|
|
|
79
79
|
readonly preparations: Array<PreparationJson>;
|
|
80
80
|
};
|
|
81
81
|
/**
|
|
82
|
+
* TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
|
|
82
83
|
* Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
|
|
83
84
|
* But then immediately reverted back to the single type
|
|
84
85
|
* With knowledge as part of the promptbook and collection just as a collection of promptbooks
|
|
@@ -7,3 +7,7 @@ import type { SimpleTemplateJson } from './SimpleTemplateJson';
|
|
|
7
7
|
* Describes one prompt template in the promptbook
|
|
8
8
|
*/
|
|
9
9
|
export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptJson | PromptDialogJson | ___ | ___ | ___ | ___;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🧠][🥜] What is propper name for this - "Template", "Prompt template",...
|
|
12
|
+
* TODO: [🧠][🥜] Reduce confusion of `PromptTemplateJson` vs (`LlmTemplateJson` which is 'PROMPT_TEMPLATE')
|
|
13
|
+
*/
|
|
@@ -5,6 +5,7 @@ import type { string_javascript_name } from '../typeAliases';
|
|
|
5
5
|
import type { string_markdown } from '../typeAliases';
|
|
6
6
|
import type { string_markdown_text } from '../typeAliases';
|
|
7
7
|
import type { string_name } from '../typeAliases';
|
|
8
|
+
import type { string_parameter_name } from '../typeAliases';
|
|
8
9
|
import type { string_prompt } from '../typeAliases';
|
|
9
10
|
import type { string_template } from '../typeAliases';
|
|
10
11
|
import type { Expectations } from './Expectations';
|
|
@@ -34,13 +35,13 @@ export interface PromptTemplateJsonCommon {
|
|
|
34
35
|
*
|
|
35
36
|
* Note: Joker is one of the dependent parameters
|
|
36
37
|
*/
|
|
37
|
-
readonly dependentParameterNames: Array<
|
|
38
|
+
readonly dependentParameterNames: Array<string_parameter_name>;
|
|
38
39
|
/**
|
|
39
40
|
* If theese parameters meet the expectations requirements, they are used instead of executing this prompt template
|
|
40
41
|
*
|
|
41
42
|
* @see https://github.com/webgptorg/promptbook/discussions/66
|
|
42
43
|
*/
|
|
43
|
-
readonly
|
|
44
|
+
readonly jokerParameterNames?: Array<string_parameter_name>;
|
|
44
45
|
/**
|
|
45
46
|
* Type of the execution
|
|
46
47
|
* This determines if the prompt template is send to LLM, user or some scripting evaluation
|
|
@@ -55,7 +56,7 @@ export interface PromptTemplateJsonCommon {
|
|
|
55
56
|
*
|
|
56
57
|
* @see https://github.com/webgptorg/promptbook/discussions/31
|
|
57
58
|
*/
|
|
58
|
-
readonly
|
|
59
|
+
readonly postprocessingFunctionNames?: Array<string_javascript_name>;
|
|
59
60
|
/**
|
|
60
61
|
* Expect this amount of each unit in the answer
|
|
61
62
|
*
|
|
@@ -79,6 +80,7 @@ export interface PromptTemplateJsonCommon {
|
|
|
79
80
|
readonly resultingParameterName: string_name;
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
83
|
+
* TODO: [🧠][🥜]
|
|
82
84
|
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
83
85
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
84
86
|
*/
|
|
@@ -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
|