@promptbook/types 0.50.0-0 → 0.50.0-10
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/typings/_packages/types.index.d.ts +3 -3
- package/esm/typings/execution/ExecutionTools.d.ts +3 -1
- package/esm/typings/execution/LlmExecutionTools.d.ts +26 -2
- package/esm/typings/execution/PromptbookExecutor.d.ts +1 -1
- package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +1 -1
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +8 -4
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +8 -4
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +13 -1
- package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +8 -4
- package/esm/typings/types/ModelRequirements.d.ts +2 -1
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +3 -3
- package/package.json +2 -2
- package/umd/typings/_packages/types.index.d.ts +3 -3
- package/umd/typings/execution/ExecutionTools.d.ts +3 -1
- package/umd/typings/execution/LlmExecutionTools.d.ts +26 -2
- package/umd/typings/execution/PromptbookExecutor.d.ts +1 -1
- package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +1 -1
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +8 -4
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +8 -4
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +13 -1
- package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +8 -4
- package/umd/typings/types/ModelRequirements.d.ts +2 -1
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
2
2
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
3
|
-
import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
4
4
|
import type { PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult } from '../execution/PromptResult';
|
|
5
5
|
import type { PromptbookExecutor } from '../execution/PromptbookExecutor';
|
|
6
6
|
import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools';
|
|
@@ -10,7 +10,7 @@ import type { ExecutionType } from '../types/ExecutionTypes';
|
|
|
10
10
|
import type { ModelRequirements, ModelVariant } from '../types/ModelRequirements';
|
|
11
11
|
import type { Parameters } from '../types/Parameters';
|
|
12
12
|
import type { Prompt } from '../types/Prompt';
|
|
13
|
-
import type { EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, PromptTemplateJson } from '../types/PromptbookJson/PromptTemplateJson';
|
|
13
|
+
import type { EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, LlmTemplateJson, PromptDialogJson, PromptTemplateJson, ScriptJson, SimpleTemplateJson } from '../types/PromptbookJson/PromptTemplateJson';
|
|
14
14
|
import type { PromptTemplateParameterJson } from '../types/PromptbookJson/PromptTemplateParameterJson';
|
|
15
15
|
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
16
16
|
import type { PromptbookString } from '../types/PromptbookString';
|
|
@@ -20,7 +20,7 @@ import type { ExecutionReportJson } from '../types/execution-report/ExecutionRep
|
|
|
20
20
|
import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
21
21
|
import type { client_id, string_char, 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_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, 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 } from '../types/typeAliases';
|
|
22
22
|
import { FromtoItems } from '../utils/FromtoItems';
|
|
23
|
-
export { client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, FromtoItems, LlmExecutionTools
|
|
23
|
+
export { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, FromtoItems, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, 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_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, 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, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
|
|
24
24
|
/**
|
|
25
25
|
* TODO: [🧠][🆔] Is this the best package to export custom errors from?
|
|
26
26
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
@@ -20,8 +20,10 @@ export type ExecutionTools = {
|
|
|
20
20
|
script: Array<ScriptExecutionTools>;
|
|
21
21
|
/**
|
|
22
22
|
* Tools for interacting with the user
|
|
23
|
+
*
|
|
24
|
+
* Note: When undefined, the user interface is disabled and promptbook which requires user interaction will fail
|
|
23
25
|
*/
|
|
24
|
-
userInterface
|
|
26
|
+
userInterface?: UserInterfaceTools;
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
27
29
|
* TODO: [🍓] !!!! Allow to have more LlmExecutionTools
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { ModelVariant } from '../types/ModelRequirements';
|
|
1
3
|
import type { Prompt } from '../types/Prompt';
|
|
4
|
+
import type { string_model_name, string_title } from '../types/typeAliases';
|
|
2
5
|
import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* Container for all the tools needed to execute prompts to large language models like GPT-4
|
|
5
8
|
* On its interface it exposes common methods for prompt execution.
|
|
6
9
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
7
10
|
*
|
|
@@ -16,9 +19,30 @@ export type LlmExecutionTools = {
|
|
|
16
19
|
* Use a completion model
|
|
17
20
|
*/
|
|
18
21
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* List all available models that can be used
|
|
24
|
+
*/
|
|
25
|
+
listModels(): Promisable<Array<AvailableModel>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a model that can be used for prompt execution
|
|
29
|
+
*/
|
|
30
|
+
export type AvailableModel = {
|
|
31
|
+
/**
|
|
32
|
+
* The model title
|
|
33
|
+
*/
|
|
34
|
+
readonly modelTitle: string_title;
|
|
35
|
+
/**
|
|
36
|
+
* The model name aviailable
|
|
37
|
+
*/
|
|
38
|
+
readonly modelName: string_model_name;
|
|
39
|
+
/**
|
|
40
|
+
* Variant of the model
|
|
41
|
+
*/
|
|
42
|
+
readonly modelVariant: ModelVariant;
|
|
19
43
|
};
|
|
20
44
|
/**
|
|
21
|
-
* TODO: [🍓][♐]
|
|
45
|
+
* TODO: [🍓][♐] Some heuristic to pick the best model in listed models
|
|
22
46
|
* TODO: [🏳] gptChat -> chat, gptComplete -> complete, translate
|
|
23
47
|
* TODO: [🧠] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
24
48
|
*/
|
|
@@ -11,7 +11,7 @@ import type { string_name } from '../types/typeAliases';
|
|
|
11
11
|
* @see https://github.com/webgptorg/promptbook#executor
|
|
12
12
|
*/
|
|
13
13
|
export type PromptbookExecutor = {
|
|
14
|
-
(inputParameters: Record<string_name, string>, onProgress
|
|
14
|
+
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
15
15
|
/**
|
|
16
16
|
* Whether the execution was successful
|
|
17
17
|
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
|
|
|
6
6
|
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🍓][♐] Allow to list the
|
|
9
|
+
* TODO: [🍓][♐] Allow to list the available prompts in Langtail
|
|
10
10
|
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
7
|
*/
|
|
@@ -16,6 +16,10 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
16
16
|
* Mocks completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available mocked-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AvailableModel>;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
7
|
*/
|
|
@@ -16,4 +16,8 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
16
16
|
* Fakes completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available fake-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AvailableModel>;
|
|
19
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
3
|
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
4
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
5
|
/**
|
|
@@ -25,6 +25,18 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
25
25
|
* Calls OpenAI API to use a complete model.
|
|
26
26
|
*/
|
|
27
27
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Default model for chat variant.
|
|
30
|
+
*/
|
|
31
|
+
private getDefaultChatModel;
|
|
32
|
+
/**
|
|
33
|
+
* Default model for completion variant.
|
|
34
|
+
*/
|
|
35
|
+
private getDefaultCompletionModel;
|
|
36
|
+
/**
|
|
37
|
+
* List all available OpenAI models that can be used
|
|
38
|
+
*/
|
|
39
|
+
listModels(): Array<AvailableModel>;
|
|
28
40
|
}
|
|
29
41
|
/**
|
|
30
42
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
-
import { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
import type { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
5
5
|
/**
|
|
6
6
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
7
7
|
*
|
|
@@ -29,6 +29,10 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
29
29
|
* Calls remote proxy server to use both completion or chat model.
|
|
30
30
|
*/
|
|
31
31
|
private gptCommon;
|
|
32
|
+
/**
|
|
33
|
+
* List all available models that can be used
|
|
34
|
+
*/
|
|
35
|
+
listModels(): Promise<Array<AvailableModel>>;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
|
@@ -26,10 +26,11 @@ export type ModelRequirements = {
|
|
|
26
26
|
* The model for text prompt
|
|
27
27
|
*
|
|
28
28
|
* Note: Model must be compatible with the model variant
|
|
29
|
+
* Note: If not specified, the best model for the variant will be used
|
|
29
30
|
*
|
|
30
31
|
* @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
|
|
31
32
|
*/
|
|
32
|
-
readonly modelName
|
|
33
|
+
readonly modelName?: string_model_name;
|
|
33
34
|
/**
|
|
34
35
|
* Maximum number of tokens that can be generated by the model
|
|
35
36
|
*/
|
|
@@ -44,13 +44,13 @@ export type ExpectationAmount = number_integer & number_positive_or_zero;
|
|
|
44
44
|
/**
|
|
45
45
|
* Template for simple concatenation of strings
|
|
46
46
|
*/
|
|
47
|
-
interface SimpleTemplateJson extends PromptTemplateJsonCommon {
|
|
47
|
+
export interface SimpleTemplateJson extends PromptTemplateJsonCommon {
|
|
48
48
|
readonly executionType: 'SIMPLE_TEMPLATE';
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Template for script execution
|
|
52
52
|
*/
|
|
53
|
-
interface ScriptJson extends PromptTemplateJsonCommon {
|
|
53
|
+
export interface ScriptJson extends PromptTemplateJsonCommon {
|
|
54
54
|
readonly executionType: 'SCRIPT';
|
|
55
55
|
/**
|
|
56
56
|
* Language of the script
|
|
@@ -62,7 +62,7 @@ interface ScriptJson extends PromptTemplateJsonCommon {
|
|
|
62
62
|
/**
|
|
63
63
|
* Template for prompt to user
|
|
64
64
|
*/
|
|
65
|
-
interface PromptDialogJson extends PromptTemplateJsonCommon {
|
|
65
|
+
export interface PromptDialogJson extends PromptTemplateJsonCommon {
|
|
66
66
|
readonly executionType: 'PROMPT_DIALOG';
|
|
67
67
|
}
|
|
68
68
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.50.0-
|
|
3
|
+
"version": "0.50.0-10",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@promptbook/core": "0.50.0-
|
|
48
|
+
"@promptbook/core": "0.50.0-10"
|
|
49
49
|
},
|
|
50
50
|
"main": "./umd/index.umd.js",
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
2
2
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
3
|
-
import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
4
4
|
import type { PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult } from '../execution/PromptResult';
|
|
5
5
|
import type { PromptbookExecutor } from '../execution/PromptbookExecutor';
|
|
6
6
|
import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools';
|
|
@@ -10,7 +10,7 @@ import type { ExecutionType } from '../types/ExecutionTypes';
|
|
|
10
10
|
import type { ModelRequirements, ModelVariant } from '../types/ModelRequirements';
|
|
11
11
|
import type { Parameters } from '../types/Parameters';
|
|
12
12
|
import type { Prompt } from '../types/Prompt';
|
|
13
|
-
import type { EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, PromptTemplateJson } from '../types/PromptbookJson/PromptTemplateJson';
|
|
13
|
+
import type { EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, LlmTemplateJson, PromptDialogJson, PromptTemplateJson, ScriptJson, SimpleTemplateJson } from '../types/PromptbookJson/PromptTemplateJson';
|
|
14
14
|
import type { PromptTemplateParameterJson } from '../types/PromptbookJson/PromptTemplateParameterJson';
|
|
15
15
|
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
16
16
|
import type { PromptbookString } from '../types/PromptbookString';
|
|
@@ -20,7 +20,7 @@ import type { ExecutionReportJson } from '../types/execution-report/ExecutionRep
|
|
|
20
20
|
import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
21
21
|
import type { client_id, string_char, 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_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, 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 } from '../types/typeAliases';
|
|
22
22
|
import { FromtoItems } from '../utils/FromtoItems';
|
|
23
|
-
export { client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, FromtoItems, LlmExecutionTools
|
|
23
|
+
export { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, FromtoItems, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, 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_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, 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, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, };
|
|
24
24
|
/**
|
|
25
25
|
* TODO: [🧠][🆔] Is this the best package to export custom errors from?
|
|
26
26
|
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
|
|
@@ -20,8 +20,10 @@ export type ExecutionTools = {
|
|
|
20
20
|
script: Array<ScriptExecutionTools>;
|
|
21
21
|
/**
|
|
22
22
|
* Tools for interacting with the user
|
|
23
|
+
*
|
|
24
|
+
* Note: When undefined, the user interface is disabled and promptbook which requires user interaction will fail
|
|
23
25
|
*/
|
|
24
|
-
userInterface
|
|
26
|
+
userInterface?: UserInterfaceTools;
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
27
29
|
* TODO: [🍓] !!!! Allow to have more LlmExecutionTools
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { ModelVariant } from '../types/ModelRequirements';
|
|
1
3
|
import type { Prompt } from '../types/Prompt';
|
|
4
|
+
import type { string_model_name, string_title } from '../types/typeAliases';
|
|
2
5
|
import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* Container for all the tools needed to execute prompts to large language models like GPT-4
|
|
5
8
|
* On its interface it exposes common methods for prompt execution.
|
|
6
9
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
7
10
|
*
|
|
@@ -16,9 +19,30 @@ export type LlmExecutionTools = {
|
|
|
16
19
|
* Use a completion model
|
|
17
20
|
*/
|
|
18
21
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* List all available models that can be used
|
|
24
|
+
*/
|
|
25
|
+
listModels(): Promisable<Array<AvailableModel>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a model that can be used for prompt execution
|
|
29
|
+
*/
|
|
30
|
+
export type AvailableModel = {
|
|
31
|
+
/**
|
|
32
|
+
* The model title
|
|
33
|
+
*/
|
|
34
|
+
readonly modelTitle: string_title;
|
|
35
|
+
/**
|
|
36
|
+
* The model name aviailable
|
|
37
|
+
*/
|
|
38
|
+
readonly modelName: string_model_name;
|
|
39
|
+
/**
|
|
40
|
+
* Variant of the model
|
|
41
|
+
*/
|
|
42
|
+
readonly modelVariant: ModelVariant;
|
|
19
43
|
};
|
|
20
44
|
/**
|
|
21
|
-
* TODO: [🍓][♐]
|
|
45
|
+
* TODO: [🍓][♐] Some heuristic to pick the best model in listed models
|
|
22
46
|
* TODO: [🏳] gptChat -> chat, gptComplete -> complete, translate
|
|
23
47
|
* TODO: [🧠] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
24
48
|
*/
|
|
@@ -11,7 +11,7 @@ import type { string_name } from '../types/typeAliases';
|
|
|
11
11
|
* @see https://github.com/webgptorg/promptbook#executor
|
|
12
12
|
*/
|
|
13
13
|
export type PromptbookExecutor = {
|
|
14
|
-
(inputParameters: Record<string_name, string>, onProgress
|
|
14
|
+
(inputParameters: Record<string_name, string>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
|
|
15
15
|
/**
|
|
16
16
|
* Whether the execution was successful
|
|
17
17
|
*/
|
package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
|
|
|
6
6
|
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* TODO: [🍓][♐] Allow to list the
|
|
9
|
+
* TODO: [🍓][♐] Allow to list the available prompts in Langtail
|
|
10
10
|
*/
|
package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
7
|
*/
|
|
@@ -16,6 +16,10 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
16
16
|
* Mocks completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available mocked-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AvailableModel>;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
7
|
*/
|
|
@@ -16,4 +16,8 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
16
16
|
* Fakes completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available fake-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AvailableModel>;
|
|
19
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
3
|
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
4
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
5
|
/**
|
|
@@ -25,6 +25,18 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
25
25
|
* Calls OpenAI API to use a complete model.
|
|
26
26
|
*/
|
|
27
27
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Default model for chat variant.
|
|
30
|
+
*/
|
|
31
|
+
private getDefaultChatModel;
|
|
32
|
+
/**
|
|
33
|
+
* Default model for completion variant.
|
|
34
|
+
*/
|
|
35
|
+
private getDefaultCompletionModel;
|
|
36
|
+
/**
|
|
37
|
+
* List all available OpenAI models that can be used
|
|
38
|
+
*/
|
|
39
|
+
listModels(): Array<AvailableModel>;
|
|
28
40
|
}
|
|
29
41
|
/**
|
|
30
42
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
-
import { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
import type { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
5
5
|
/**
|
|
6
6
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
7
7
|
*
|
|
@@ -29,6 +29,10 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
29
29
|
* Calls remote proxy server to use both completion or chat model.
|
|
30
30
|
*/
|
|
31
31
|
private gptCommon;
|
|
32
|
+
/**
|
|
33
|
+
* List all available models that can be used
|
|
34
|
+
*/
|
|
35
|
+
listModels(): Promise<Array<AvailableModel>>;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
|
@@ -26,10 +26,11 @@ export type ModelRequirements = {
|
|
|
26
26
|
* The model for text prompt
|
|
27
27
|
*
|
|
28
28
|
* Note: Model must be compatible with the model variant
|
|
29
|
+
* Note: If not specified, the best model for the variant will be used
|
|
29
30
|
*
|
|
30
31
|
* @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
|
|
31
32
|
*/
|
|
32
|
-
readonly modelName
|
|
33
|
+
readonly modelName?: string_model_name;
|
|
33
34
|
/**
|
|
34
35
|
* Maximum number of tokens that can be generated by the model
|
|
35
36
|
*/
|
|
@@ -44,13 +44,13 @@ export type ExpectationAmount = number_integer & number_positive_or_zero;
|
|
|
44
44
|
/**
|
|
45
45
|
* Template for simple concatenation of strings
|
|
46
46
|
*/
|
|
47
|
-
interface SimpleTemplateJson extends PromptTemplateJsonCommon {
|
|
47
|
+
export interface SimpleTemplateJson extends PromptTemplateJsonCommon {
|
|
48
48
|
readonly executionType: 'SIMPLE_TEMPLATE';
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Template for script execution
|
|
52
52
|
*/
|
|
53
|
-
interface ScriptJson extends PromptTemplateJsonCommon {
|
|
53
|
+
export interface ScriptJson extends PromptTemplateJsonCommon {
|
|
54
54
|
readonly executionType: 'SCRIPT';
|
|
55
55
|
/**
|
|
56
56
|
* Language of the script
|
|
@@ -62,7 +62,7 @@ interface ScriptJson extends PromptTemplateJsonCommon {
|
|
|
62
62
|
/**
|
|
63
63
|
* Template for prompt to user
|
|
64
64
|
*/
|
|
65
|
-
interface PromptDialogJson extends PromptTemplateJsonCommon {
|
|
65
|
+
export interface PromptDialogJson extends PromptTemplateJsonCommon {
|
|
66
66
|
readonly executionType: 'PROMPT_DIALOG';
|
|
67
67
|
}
|
|
68
68
|
/**
|