@promptbook/types 0.46.0 → 0.47.0-0
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 +13 -7
- package/esm/typings/_packages/langtail.index.d.ts +2 -2
- package/esm/typings/_packages/mock.index.d.ts +3 -3
- package/esm/typings/_packages/openai.index.d.ts +2 -2
- package/esm/typings/_packages/remote-client.index.d.ts +4 -4
- package/esm/typings/_packages/remote-server.index.d.ts +2 -2
- package/esm/typings/_packages/types.index.d.ts +2 -2
- package/esm/typings/_packages/utils.index.d.ts +2 -0
- package/esm/typings/conversion/prettify/PrettifyOptions.d.ts +9 -3
- package/esm/typings/conversion/prettify/prettifyPromptbookString.d.ts +1 -1
- package/esm/typings/conversion/prettify/renderPromptbookMermaid.d.ts +11 -0
- package/esm/typings/execution/ExecutionTools.d.ts +5 -2
- package/esm/typings/execution/{NaturalExecutionTools.d.ts → LlmExecutionTools.d.ts} +2 -2
- package/{umd/typings/execution/plugins/natural-execution-tools → esm/typings/execution/plugins/llm-execution-tools}/langtail/LangtailExecutionTools.d.ts +2 -2
- package/{umd/typings/execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools.d.ts → esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts} +2 -2
- package/{umd/typings/execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools.d.ts → esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts} +2 -2
- package/{umd/typings/execution/plugins/natural-execution-tools → esm/typings/execution/plugins/llm-execution-tools}/mocked/fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionTools.d.ts +2 -2
- package/esm/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionTools.d.ts → llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts} +5 -5
- package/esm/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts → llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts} +3 -3
- package/{umd/typings/execution/plugins/natural-execution-tools → esm/typings/execution/plugins/llm-execution-tools}/remote/interfaces/RemoteServerOptions.d.ts +3 -3
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
- package/package.json +2 -2
- package/umd/typings/_packages/langtail.index.d.ts +2 -2
- package/umd/typings/_packages/mock.index.d.ts +3 -3
- package/umd/typings/_packages/openai.index.d.ts +2 -2
- package/umd/typings/_packages/remote-client.index.d.ts +4 -4
- package/umd/typings/_packages/remote-server.index.d.ts +2 -2
- package/umd/typings/_packages/types.index.d.ts +2 -2
- package/umd/typings/_packages/utils.index.d.ts +2 -0
- package/umd/typings/conversion/prettify/PrettifyOptions.d.ts +9 -3
- package/umd/typings/conversion/prettify/prettifyPromptbookString.d.ts +1 -1
- package/umd/typings/conversion/prettify/renderPromptbookMermaid.d.ts +11 -0
- package/umd/typings/execution/ExecutionTools.d.ts +5 -2
- package/umd/typings/execution/{NaturalExecutionTools.d.ts → LlmExecutionTools.d.ts} +2 -2
- package/{esm/typings/execution/plugins/natural-execution-tools → umd/typings/execution/plugins/llm-execution-tools}/langtail/LangtailExecutionTools.d.ts +2 -2
- package/{esm/typings/execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools.d.ts → umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts} +2 -2
- package/{esm/typings/execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools.d.ts → umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts} +2 -2
- package/{esm/typings/execution/plugins/natural-execution-tools → umd/typings/execution/plugins/llm-execution-tools}/mocked/fakeTextToExpectations.d.ts +1 -1
- package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionTools.d.ts +2 -2
- package/umd/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionTools.d.ts → llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts} +5 -5
- package/umd/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts → llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts} +3 -3
- package/{esm/typings/execution/plugins/natural-execution-tools → umd/typings/execution/plugins/llm-execution-tools}/remote/interfaces/RemoteServerOptions.d.ts +3 -3
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/fakeTextToExpectations.test.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/faked-completion.test.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/joker.test.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-chat.test.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-completion.test.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/computeOpenaiUsage.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
- /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/startRemoteServer.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/fakeTextToExpectations.test.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/faked-completion.test.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/joker.test.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-chat.test.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-completion.test.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/computeOpenaiUsage.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
- /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/startRemoteServer.d.ts +0 -0
package/README.md
CHANGED
|
@@ -464,22 +464,24 @@ For example:
|
|
|
464
464
|
|
|
465
465
|
### Execution Tools
|
|
466
466
|
|
|
467
|
+
|
|
468
|
+
|
|
467
469
|
`ExecutionTools` is an interface which contains all the tools needed to execute prompts.
|
|
468
470
|
It contais 3 subtools:
|
|
469
471
|
|
|
470
|
-
- `
|
|
472
|
+
- `LlmExecutionTools`
|
|
471
473
|
- `ScriptExecutionTools`
|
|
472
474
|
- `UserInterfaceTools`
|
|
473
475
|
|
|
474
476
|
Which are described below:
|
|
475
477
|
|
|
476
|
-
####
|
|
478
|
+
#### LLM Execution Tools
|
|
477
479
|
|
|
478
|
-
`
|
|
480
|
+
`LlmExecutionTools` is a container for all the tools needed to execute prompts to large language models like GPT-4.
|
|
479
481
|
On its interface it exposes common methods for prompt execution.
|
|
480
482
|
Internally it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
481
483
|
|
|
482
|
-
`
|
|
484
|
+
`LlmExecutionTools` an abstract interface that is implemented by concrete execution tools:
|
|
483
485
|
|
|
484
486
|
- `OpenAiExecutionTools`
|
|
485
487
|
- _(Not implemented yet)_ `AnthropicClaudeExecutionTools`
|
|
@@ -487,9 +489,9 @@ Internally it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
|
487
489
|
- _(Not implemented yet)_ `BardExecutionTools`
|
|
488
490
|
- _(Not implemented yet)_ `LamaExecutionTools`
|
|
489
491
|
- _(Not implemented yet)_ `GpuExecutionTools`
|
|
490
|
-
- And a special case are `
|
|
491
|
-
- The second special case is `
|
|
492
|
-
- The third special case is `
|
|
492
|
+
- And a special case are `RemoteLlmExecutionTools` that connect to a remote server and run one of the above execution tools on that server.
|
|
493
|
+
- The second special case is `MockedEchoLlmExecutionTools` that is used for testing and mocking.
|
|
494
|
+
- The third special case is `LogLlmExecutionToolsWrapper` that is technically also an execution tools but it is more proxy wrapper around other execution tools that logs all calls to execution tools.
|
|
493
495
|
|
|
494
496
|
#### Script Execution Tools
|
|
495
497
|
|
|
@@ -686,6 +688,10 @@ See [CHANGELOG.md](./CHANGELOG.md)
|
|
|
686
688
|
|
|
687
689
|
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://github.com/webgptorg/promptbook">Promptbook</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://github.com/hejny/">Pavol Hejný</a> is licensed under <a href="https://creativecommons.org/licenses/by/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY 4.0</a></p>
|
|
688
690
|
|
|
691
|
+
## 🎯 Todos
|
|
692
|
+
|
|
693
|
+
See [TODO.md](./TODO.md)
|
|
694
|
+
|
|
689
695
|
|
|
690
696
|
|
|
691
697
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LangtailExecutionTools } from '../execution/plugins/
|
|
2
|
-
import { LangtailExecutionToolsOptions } from '../execution/plugins/
|
|
1
|
+
import { LangtailExecutionTools } from '../execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools';
|
|
2
|
+
import { LangtailExecutionToolsOptions } from '../execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions';
|
|
3
3
|
export { LangtailExecutionTools, LangtailExecutionToolsOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import { MockedEchoLlmExecutionTools } from '../execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools';
|
|
2
|
+
import { MockedFackedLlmExecutionTools } from '../execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools';
|
|
3
|
+
export { MockedEchoLlmExecutionTools, MockedFackedLlmExecutionTools };
|
|
4
4
|
/**
|
|
5
5
|
* TODO: [🚏] FakeLLM
|
|
6
6
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { OpenAiExecutionTools } from '../execution/plugins/
|
|
2
|
-
import { OpenAiExecutionToolsOptions } from '../execution/plugins/
|
|
1
|
+
import { OpenAiExecutionTools } from '../execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools';
|
|
2
|
+
import { OpenAiExecutionToolsOptions } from '../execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions';
|
|
3
3
|
export { OpenAiExecutionTools, OpenAiExecutionToolsOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RemoteServerOptions } from '../execution/plugins/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { RemoteServerOptions } from '../execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions';
|
|
2
|
+
import { RemoteLlmExecutionTools } from '../execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools';
|
|
3
|
+
import { RemoteLlmExecutionToolsOptions } from '../execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions';
|
|
4
|
+
export { RemoteLlmExecutionTools, RemoteLlmExecutionToolsOptions, RemoteServerOptions };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RemoteServerOptions } from '../execution/plugins/
|
|
2
|
-
import { startRemoteServer } from '../execution/plugins/
|
|
1
|
+
import { RemoteServerOptions } from '../execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions';
|
|
2
|
+
import { startRemoteServer } from '../execution/plugins/llm-execution-tools/remote/startRemoteServer';
|
|
3
3
|
export { RemoteServerOptions, startRemoteServer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
2
2
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
3
|
-
import type {
|
|
3
|
+
import type { 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';
|
|
@@ -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 {
|
|
23
|
+
export { client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, FromtoItems, LlmExecutionTools as LlmExecutionTools, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, 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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spaceTrim } from 'spacetrim';
|
|
2
2
|
import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString';
|
|
3
|
+
import { renderPromptbookMermaid } from '../conversion/prettify/renderPromptbookMermaid';
|
|
3
4
|
import { parseNumber } from '../conversion/utils/parseNumber';
|
|
4
5
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
5
6
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
@@ -56,6 +57,7 @@ export declare const normalizeTo: {
|
|
|
56
57
|
'kebab-case': typeof normalizeToKebabCase;
|
|
57
58
|
};
|
|
58
59
|
export { capitalize, decapitalize, DIACRITIC_VARIANTS_LETTERS, IKeywords, isValidKeyword, nameToUriPart, nameToUriParts, normalizeTo_camelCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_snake_case, normalizeToKebabCase, normalizeWhitespaces, parseKeywords, parseKeywordsFromString, removeDiacritics, searchKeywords, string_keyword, };
|
|
60
|
+
export { renderPromptbookMermaid };
|
|
59
61
|
/**
|
|
60
62
|
* TODO: [🧠] Maybe create some indipendent package like `markdown-tools` from both here exported and @private utilities
|
|
61
63
|
* Note: [🕙] It does not make sence to have simple lower / UPPER case normalization
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for `prettifyPromptbookString` function
|
|
3
|
+
*/
|
|
1
4
|
export type PrettifyOptions = {
|
|
5
|
+
/***
|
|
6
|
+
* If true, adds Mermaid graph to the Promptbook string
|
|
7
|
+
*/
|
|
2
8
|
isGraphAdded?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If true, the string is prettifyed as markdown
|
|
11
|
+
*/
|
|
3
12
|
isPrettifyed?: boolean;
|
|
4
13
|
};
|
|
5
|
-
/**
|
|
6
|
-
* TODO: !!! Annotate all
|
|
7
|
-
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PromptbookString } from '../../types/PromptbookString';
|
|
2
2
|
import type { PrettifyOptions } from './PrettifyOptions';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Prettyfies Promptbook string and adds Mermaid graph
|
|
5
5
|
*/
|
|
6
6
|
export declare function prettifyPromptbookString(promptbookString: PromptbookString, options: PrettifyOptions): PromptbookString;
|
|
7
7
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PromptbookJson } from '../../_packages/types.index';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Mermaid graph based on the promptbook
|
|
4
|
+
*
|
|
5
|
+
* Note: The result is not wrapped in a Markdown code block
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderPromptbookMermaid(promptbookJson: PromptbookJson): string;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: Maybe use some Mermaid library instead of string templating
|
|
10
|
+
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
11
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LlmExecutionTools } from './LlmExecutionTools';
|
|
2
2
|
import type { ScriptExecutionTools } from './ScriptExecutionTools';
|
|
3
3
|
import type { UserInterfaceTools } from './UserInterfaceTools';
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ export type ExecutionTools = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Tools for executing prompts to large language models like GPT-4
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
llm: LlmExecutionTools;
|
|
14
14
|
/**
|
|
15
15
|
* Tools for executing scripts
|
|
16
16
|
*
|
|
@@ -23,3 +23,6 @@ export type ExecutionTools = {
|
|
|
23
23
|
*/
|
|
24
24
|
userInterface: UserInterfaceTools;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* TODO: !!!! Allow more
|
|
28
|
+
*/
|
|
@@ -5,9 +5,9 @@ import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
|
5
5
|
* On its interface it exposes common methods for prompt execution.
|
|
6
6
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
7
7
|
*
|
|
8
|
-
* @see https://github.com/webgptorg/promptbook#
|
|
8
|
+
* @see https://github.com/webgptorg/promptbook#llm-execution-tools
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type LlmExecutionTools = {
|
|
11
11
|
/**
|
|
12
12
|
* Use a chat model
|
|
13
13
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
2
2
|
import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
|
|
3
3
|
/**
|
|
4
4
|
* Execution Tools for calling OpenAI API.
|
|
5
5
|
*/
|
|
6
|
-
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements
|
|
6
|
+
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* TODO: !!! Make lib which exports this
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Prompt } from '../../../../types/Prompt';
|
|
2
2
|
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import {
|
|
3
|
+
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
4
|
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
9
9
|
private readonly options;
|
|
10
10
|
constructor(options: CommonExecutionToolsOptions);
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Prompt } from '../../../../types/Prompt';
|
|
2
2
|
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import {
|
|
3
|
+
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
4
|
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools {
|
|
9
9
|
private readonly options;
|
|
10
10
|
constructor(options: CommonExecutionToolsOptions);
|
|
11
11
|
/**
|
|
@@ -6,7 +6,7 @@ import { PostprocessingFunction } from '../../script-execution-tools/javascript/
|
|
|
6
6
|
* Note: You can provide postprocessing functions to modify the text before checking the expectations
|
|
7
7
|
* The result will be the text BEFORE the postprocessing
|
|
8
8
|
*
|
|
9
|
-
* @private internal util for
|
|
9
|
+
* @private internal util for MockedFackedLlmExecutionTools
|
|
10
10
|
*/
|
|
11
11
|
export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
|
|
12
12
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
3
|
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
4
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
5
|
/**
|
|
6
6
|
* Execution Tools for calling OpenAI API.
|
|
7
7
|
*/
|
|
8
|
-
export declare class OpenAiExecutionTools implements
|
|
8
|
+
export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
9
9
|
private readonly options;
|
|
10
10
|
/**
|
|
11
11
|
* OpenAI API client.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import {
|
|
2
|
+
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
3
|
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
-
import {
|
|
4
|
+
import { 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
|
*
|
|
@@ -10,9 +10,9 @@ import { RemoteNaturalExecutionToolsOptions } from './RemoteNaturalExecutionTool
|
|
|
10
10
|
*
|
|
11
11
|
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
12
12
|
*/
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
14
14
|
private readonly options;
|
|
15
|
-
constructor(options:
|
|
15
|
+
constructor(options: RemoteLlmExecutionToolsOptions);
|
|
16
16
|
/**
|
|
17
17
|
* Creates a connection to the remote proxy server.
|
|
18
18
|
*/
|
|
@@ -31,5 +31,5 @@ export declare class RemoteNaturalExecutionTools implements NaturalExecutionTool
|
|
|
31
31
|
private gptCommon;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* TODO: [🤹♂️]
|
|
34
|
+
* TODO: [🤹♂️] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
35
35
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { client_id, string_uri } from '
|
|
1
|
+
import type { client_id, string_uri } from '../../../../types/typeAliases';
|
|
2
2
|
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
3
|
/**
|
|
4
|
-
* Options for
|
|
4
|
+
* Options for RemoteLlmExecutionTools
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
7
|
/**
|
|
8
8
|
* URL of the remote PROMPTBOOK server
|
|
9
9
|
* On this server will be connected to the socket.io server
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PromptbookLibrary } from '../../../../../library/PromptbookLibrary';
|
|
2
2
|
import type { client_id, string_uri } from '../../../../../types/typeAliases';
|
|
3
3
|
import type { CommonExecutionToolsOptions } from '../../../../CommonExecutionToolsOptions';
|
|
4
|
-
import type {
|
|
4
|
+
import type { LlmExecutionTools } from '../../../../LlmExecutionTools';
|
|
5
5
|
export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
6
6
|
/**
|
|
7
7
|
* Port on which the server will listen
|
|
@@ -21,7 +21,7 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
|
21
21
|
*/
|
|
22
22
|
readonly library: PromptbookLibrary;
|
|
23
23
|
/**
|
|
24
|
-
* Creates
|
|
24
|
+
* Creates llm execution tools for each client
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
createLlmExecutionTools(clientId: client_id): LlmExecutionTools;
|
|
27
27
|
};
|
|
@@ -6,11 +6,11 @@ import type { number_integer, number_positive_or_zero, string_javascript, string
|
|
|
6
6
|
/**
|
|
7
7
|
* Describes one prompt template in the promptbook
|
|
8
8
|
*/
|
|
9
|
-
export type PromptTemplateJson =
|
|
9
|
+
export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
|
|
10
10
|
/**
|
|
11
11
|
* Template for prompt to LLM
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
14
14
|
readonly executionType: 'PROMPT_TEMPLATE';
|
|
15
15
|
/**
|
|
16
16
|
* Requirements for the model
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0-0",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"homepage": "https://www.npmjs.com/package/@promptbook/core",
|
|
36
36
|
"dependencies": {},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@promptbook/core": "0.
|
|
38
|
+
"@promptbook/core": "0.47.0-0"
|
|
39
39
|
},
|
|
40
40
|
"main": "./umd/index.umd.js",
|
|
41
41
|
"module": "./esm/index.es.js",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LangtailExecutionTools } from '../execution/plugins/
|
|
2
|
-
import { LangtailExecutionToolsOptions } from '../execution/plugins/
|
|
1
|
+
import { LangtailExecutionTools } from '../execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools';
|
|
2
|
+
import { LangtailExecutionToolsOptions } from '../execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions';
|
|
3
3
|
export { LangtailExecutionTools, LangtailExecutionToolsOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import { MockedEchoLlmExecutionTools } from '../execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools';
|
|
2
|
+
import { MockedFackedLlmExecutionTools } from '../execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools';
|
|
3
|
+
export { MockedEchoLlmExecutionTools, MockedFackedLlmExecutionTools };
|
|
4
4
|
/**
|
|
5
5
|
* TODO: [🚏] FakeLLM
|
|
6
6
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { OpenAiExecutionTools } from '../execution/plugins/
|
|
2
|
-
import { OpenAiExecutionToolsOptions } from '../execution/plugins/
|
|
1
|
+
import { OpenAiExecutionTools } from '../execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools';
|
|
2
|
+
import { OpenAiExecutionToolsOptions } from '../execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions';
|
|
3
3
|
export { OpenAiExecutionTools, OpenAiExecutionToolsOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RemoteServerOptions } from '../execution/plugins/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { RemoteServerOptions } from '../execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions';
|
|
2
|
+
import { RemoteLlmExecutionTools } from '../execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools';
|
|
3
|
+
import { RemoteLlmExecutionToolsOptions } from '../execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions';
|
|
4
|
+
export { RemoteLlmExecutionTools, RemoteLlmExecutionToolsOptions, RemoteServerOptions };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RemoteServerOptions } from '../execution/plugins/
|
|
2
|
-
import { startRemoteServer } from '../execution/plugins/
|
|
1
|
+
import { RemoteServerOptions } from '../execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions';
|
|
2
|
+
import { startRemoteServer } from '../execution/plugins/llm-execution-tools/remote/startRemoteServer';
|
|
3
3
|
export { RemoteServerOptions, startRemoteServer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
|
|
2
2
|
import type { ExecutionTools } from '../execution/ExecutionTools';
|
|
3
|
-
import type {
|
|
3
|
+
import type { 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';
|
|
@@ -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 {
|
|
23
|
+
export { client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, FromtoItems, LlmExecutionTools as LlmExecutionTools, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, 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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spaceTrim } from 'spacetrim';
|
|
2
2
|
import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString';
|
|
3
|
+
import { renderPromptbookMermaid } from '../conversion/prettify/renderPromptbookMermaid';
|
|
3
4
|
import { parseNumber } from '../conversion/utils/parseNumber';
|
|
4
5
|
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
|
|
5
6
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
@@ -56,6 +57,7 @@ export declare const normalizeTo: {
|
|
|
56
57
|
'kebab-case': typeof normalizeToKebabCase;
|
|
57
58
|
};
|
|
58
59
|
export { capitalize, decapitalize, DIACRITIC_VARIANTS_LETTERS, IKeywords, isValidKeyword, nameToUriPart, nameToUriParts, normalizeTo_camelCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_snake_case, normalizeToKebabCase, normalizeWhitespaces, parseKeywords, parseKeywordsFromString, removeDiacritics, searchKeywords, string_keyword, };
|
|
60
|
+
export { renderPromptbookMermaid };
|
|
59
61
|
/**
|
|
60
62
|
* TODO: [🧠] Maybe create some indipendent package like `markdown-tools` from both here exported and @private utilities
|
|
61
63
|
* Note: [🕙] It does not make sence to have simple lower / UPPER case normalization
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for `prettifyPromptbookString` function
|
|
3
|
+
*/
|
|
1
4
|
export type PrettifyOptions = {
|
|
5
|
+
/***
|
|
6
|
+
* If true, adds Mermaid graph to the Promptbook string
|
|
7
|
+
*/
|
|
2
8
|
isGraphAdded?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If true, the string is prettifyed as markdown
|
|
11
|
+
*/
|
|
3
12
|
isPrettifyed?: boolean;
|
|
4
13
|
};
|
|
5
|
-
/**
|
|
6
|
-
* TODO: !!! Annotate all
|
|
7
|
-
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PromptbookString } from '../../types/PromptbookString';
|
|
2
2
|
import type { PrettifyOptions } from './PrettifyOptions';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Prettyfies Promptbook string and adds Mermaid graph
|
|
5
5
|
*/
|
|
6
6
|
export declare function prettifyPromptbookString(promptbookString: PromptbookString, options: PrettifyOptions): PromptbookString;
|
|
7
7
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PromptbookJson } from '../../_packages/types.index';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Mermaid graph based on the promptbook
|
|
4
|
+
*
|
|
5
|
+
* Note: The result is not wrapped in a Markdown code block
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderPromptbookMermaid(promptbookJson: PromptbookJson): string;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: Maybe use some Mermaid library instead of string templating
|
|
10
|
+
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
11
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LlmExecutionTools } from './LlmExecutionTools';
|
|
2
2
|
import type { ScriptExecutionTools } from './ScriptExecutionTools';
|
|
3
3
|
import type { UserInterfaceTools } from './UserInterfaceTools';
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ export type ExecutionTools = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Tools for executing prompts to large language models like GPT-4
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
llm: LlmExecutionTools;
|
|
14
14
|
/**
|
|
15
15
|
* Tools for executing scripts
|
|
16
16
|
*
|
|
@@ -23,3 +23,6 @@ export type ExecutionTools = {
|
|
|
23
23
|
*/
|
|
24
24
|
userInterface: UserInterfaceTools;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* TODO: !!!! Allow more
|
|
28
|
+
*/
|
|
@@ -5,9 +5,9 @@ import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
|
5
5
|
* On its interface it exposes common methods for prompt execution.
|
|
6
6
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
7
7
|
*
|
|
8
|
-
* @see https://github.com/webgptorg/promptbook#
|
|
8
|
+
* @see https://github.com/webgptorg/promptbook#llm-execution-tools
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type LlmExecutionTools = {
|
|
11
11
|
/**
|
|
12
12
|
* Use a chat model
|
|
13
13
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
2
2
|
import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
|
|
3
3
|
/**
|
|
4
4
|
* Execution Tools for calling OpenAI API.
|
|
5
5
|
*/
|
|
6
|
-
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements
|
|
6
|
+
export declare class LangtailExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* TODO: !!! Make lib which exports this
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Prompt } from '../../../../types/Prompt';
|
|
2
2
|
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import {
|
|
3
|
+
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
4
|
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
9
9
|
private readonly options;
|
|
10
10
|
constructor(options: CommonExecutionToolsOptions);
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Prompt } from '../../../../types/Prompt';
|
|
2
2
|
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import {
|
|
3
|
+
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
4
|
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools {
|
|
9
9
|
private readonly options;
|
|
10
10
|
constructor(options: CommonExecutionToolsOptions);
|
|
11
11
|
/**
|
|
@@ -6,7 +6,7 @@ import { PostprocessingFunction } from '../../script-execution-tools/javascript/
|
|
|
6
6
|
* Note: You can provide postprocessing functions to modify the text before checking the expectations
|
|
7
7
|
* The result will be the text BEFORE the postprocessing
|
|
8
8
|
*
|
|
9
|
-
* @private internal util for
|
|
9
|
+
* @private internal util for MockedFackedLlmExecutionTools
|
|
10
10
|
*/
|
|
11
11
|
export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
|
|
12
12
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
3
|
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
4
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
5
|
/**
|
|
6
6
|
* Execution Tools for calling OpenAI API.
|
|
7
7
|
*/
|
|
8
|
-
export declare class OpenAiExecutionTools implements
|
|
8
|
+
export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
9
9
|
private readonly options;
|
|
10
10
|
/**
|
|
11
11
|
* OpenAI API client.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import {
|
|
2
|
+
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
3
|
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
-
import {
|
|
4
|
+
import { 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
|
*
|
|
@@ -10,9 +10,9 @@ import { RemoteNaturalExecutionToolsOptions } from './RemoteNaturalExecutionTool
|
|
|
10
10
|
*
|
|
11
11
|
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
12
12
|
*/
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
14
14
|
private readonly options;
|
|
15
|
-
constructor(options:
|
|
15
|
+
constructor(options: RemoteLlmExecutionToolsOptions);
|
|
16
16
|
/**
|
|
17
17
|
* Creates a connection to the remote proxy server.
|
|
18
18
|
*/
|
|
@@ -31,5 +31,5 @@ export declare class RemoteNaturalExecutionTools implements NaturalExecutionTool
|
|
|
31
31
|
private gptCommon;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* TODO: [🤹♂️]
|
|
34
|
+
* TODO: [🤹♂️] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
35
35
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { client_id, string_uri } from '
|
|
1
|
+
import type { client_id, string_uri } from '../../../../types/typeAliases';
|
|
2
2
|
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
3
|
/**
|
|
4
|
-
* Options for
|
|
4
|
+
* Options for RemoteLlmExecutionTools
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
7
|
/**
|
|
8
8
|
* URL of the remote PROMPTBOOK server
|
|
9
9
|
* On this server will be connected to the socket.io server
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PromptbookLibrary } from '../../../../../library/PromptbookLibrary';
|
|
2
2
|
import type { client_id, string_uri } from '../../../../../types/typeAliases';
|
|
3
3
|
import type { CommonExecutionToolsOptions } from '../../../../CommonExecutionToolsOptions';
|
|
4
|
-
import type {
|
|
4
|
+
import type { LlmExecutionTools } from '../../../../LlmExecutionTools';
|
|
5
5
|
export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
6
6
|
/**
|
|
7
7
|
* Port on which the server will listen
|
|
@@ -21,7 +21,7 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
|
21
21
|
*/
|
|
22
22
|
readonly library: PromptbookLibrary;
|
|
23
23
|
/**
|
|
24
|
-
* Creates
|
|
24
|
+
* Creates llm execution tools for each client
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
createLlmExecutionTools(clientId: client_id): LlmExecutionTools;
|
|
27
27
|
};
|
|
@@ -6,11 +6,11 @@ import type { number_integer, number_positive_or_zero, string_javascript, string
|
|
|
6
6
|
/**
|
|
7
7
|
* Describes one prompt template in the promptbook
|
|
8
8
|
*/
|
|
9
|
-
export type PromptTemplateJson =
|
|
9
|
+
export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
|
|
10
10
|
/**
|
|
11
11
|
* Template for prompt to LLM
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
14
14
|
readonly executionType: 'PROMPT_TEMPLATE';
|
|
15
15
|
/**
|
|
16
16
|
* Requirements for the model
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|