@promptbook/types 0.46.0 → 0.47.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.
Files changed (70) hide show
  1. package/README.md +18 -8
  2. package/esm/typings/_packages/langtail.index.d.ts +2 -2
  3. package/esm/typings/_packages/mock.index.d.ts +3 -3
  4. package/esm/typings/_packages/openai.index.d.ts +2 -2
  5. package/esm/typings/_packages/remote-client.index.d.ts +4 -4
  6. package/esm/typings/_packages/remote-server.index.d.ts +2 -2
  7. package/esm/typings/_packages/types.index.d.ts +2 -2
  8. package/esm/typings/_packages/utils.index.d.ts +2 -0
  9. package/esm/typings/conversion/prettify/PrettifyOptions.d.ts +9 -3
  10. package/esm/typings/conversion/prettify/prettifyPromptbookString.d.ts +1 -1
  11. package/esm/typings/conversion/prettify/renderPromptbookMermaid.d.ts +11 -0
  12. package/esm/typings/execution/ExecutionTools.d.ts +5 -2
  13. package/esm/typings/execution/{NaturalExecutionTools.d.ts → LlmExecutionTools.d.ts} +2 -2
  14. package/{umd/typings/execution/plugins/natural-execution-tools → esm/typings/execution/plugins/llm-execution-tools}/langtail/LangtailExecutionTools.d.ts +2 -2
  15. 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
  16. 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
  17. package/{umd/typings/execution/plugins/natural-execution-tools → esm/typings/execution/plugins/llm-execution-tools}/mocked/fakeTextToExpectations.d.ts +1 -1
  18. package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionTools.d.ts +2 -2
  19. package/esm/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionTools.d.ts → llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts} +5 -5
  20. package/esm/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts → llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts} +3 -3
  21. package/{umd/typings/execution/plugins/natural-execution-tools → esm/typings/execution/plugins/llm-execution-tools}/remote/interfaces/RemoteServerOptions.d.ts +3 -3
  22. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
  23. package/package.json +12 -2
  24. package/umd/typings/_packages/langtail.index.d.ts +2 -2
  25. package/umd/typings/_packages/mock.index.d.ts +3 -3
  26. package/umd/typings/_packages/openai.index.d.ts +2 -2
  27. package/umd/typings/_packages/remote-client.index.d.ts +4 -4
  28. package/umd/typings/_packages/remote-server.index.d.ts +2 -2
  29. package/umd/typings/_packages/types.index.d.ts +2 -2
  30. package/umd/typings/_packages/utils.index.d.ts +2 -0
  31. package/umd/typings/conversion/prettify/PrettifyOptions.d.ts +9 -3
  32. package/umd/typings/conversion/prettify/prettifyPromptbookString.d.ts +1 -1
  33. package/umd/typings/conversion/prettify/renderPromptbookMermaid.d.ts +11 -0
  34. package/umd/typings/execution/ExecutionTools.d.ts +5 -2
  35. package/umd/typings/execution/{NaturalExecutionTools.d.ts → LlmExecutionTools.d.ts} +2 -2
  36. package/{esm/typings/execution/plugins/natural-execution-tools → umd/typings/execution/plugins/llm-execution-tools}/langtail/LangtailExecutionTools.d.ts +2 -2
  37. 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
  38. 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
  39. package/{esm/typings/execution/plugins/natural-execution-tools → umd/typings/execution/plugins/llm-execution-tools}/mocked/fakeTextToExpectations.d.ts +1 -1
  40. package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionTools.d.ts +2 -2
  41. package/umd/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionTools.d.ts → llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts} +5 -5
  42. package/umd/typings/execution/plugins/{natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts → llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts} +3 -3
  43. package/{esm/typings/execution/plugins/natural-execution-tools → umd/typings/execution/plugins/llm-execution-tools}/remote/interfaces/RemoteServerOptions.d.ts +3 -3
  44. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
  45. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
  46. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/fakeTextToExpectations.test.d.ts +0 -0
  47. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/faked-completion.test.d.ts +0 -0
  48. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/joker.test.d.ts +0 -0
  49. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-chat.test.d.ts +0 -0
  50. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-completion.test.d.ts +0 -0
  51. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
  52. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/computeOpenaiUsage.d.ts +0 -0
  53. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
  54. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
  55. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
  56. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
  57. /package/esm/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/startRemoteServer.d.ts +0 -0
  58. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
  59. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/fakeTextToExpectations.test.d.ts +0 -0
  60. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/faked-completion.test.d.ts +0 -0
  61. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/joker.test.d.ts +0 -0
  62. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-chat.test.d.ts +0 -0
  63. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/mocked/mocked-completion.test.d.ts +0 -0
  64. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
  65. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/openai/computeOpenaiUsage.d.ts +0 -0
  66. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
  67. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
  68. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
  69. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
  70. /package/umd/typings/execution/plugins/{natural-execution-tools → llm-execution-tools}/remote/startRemoteServer.d.ts +0 -0
package/README.md CHANGED
@@ -5,9 +5,13 @@ Library to supercharge your use of large language models
5
5
 
6
6
 
7
7
 
8
- [![License of 📖 Prompt book](https://img.shields.io/github/license/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/blob/main/LICENSE)
8
+
9
+ [![NPM Version of ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
10
+ [![Quality of package ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
9
11
  [![Known Vulnerabilities](https://snyk.io/test/github/webgptorg/promptbook/badge.svg)](https://snyk.io/test/github/webgptorg/promptbook)
10
12
  [![Issues](https://img.shields.io/github/issues/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/issues)
13
+ [![Socket](https://socket.dev/api/badge/npm/package/promptbook)](https://socket.dev/npm/package/promptbook)
14
+
11
15
  [![Socket Badge](https://socket.dev/api/badge/npm/package/@promptbook/types)](https://socket.dev/npm/package/@promptbook/types)
12
16
 
13
17
 
@@ -464,22 +468,24 @@ For example:
464
468
 
465
469
  ### Execution Tools
466
470
 
471
+
472
+
467
473
  `ExecutionTools` is an interface which contains all the tools needed to execute prompts.
468
474
  It contais 3 subtools:
469
475
 
470
- - `NaturalExecutionTools`
476
+ - `LlmExecutionTools`
471
477
  - `ScriptExecutionTools`
472
478
  - `UserInterfaceTools`
473
479
 
474
480
  Which are described below:
475
481
 
476
- #### Natural Execution Tools
482
+ #### LLM Execution Tools
477
483
 
478
- `NaturalExecutionTools` is a container for all the tools needed to execute prompts to large language models like GPT-4.
484
+ `LlmExecutionTools` is a container for all the tools needed to execute prompts to large language models like GPT-4.
479
485
  On its interface it exposes common methods for prompt execution.
480
486
  Internally it calls OpenAI, Azure, GPU, proxy, cache, logging,...
481
487
 
482
- `NaturalExecutionTools` an abstract interface that is implemented by concrete execution tools:
488
+ `LlmExecutionTools` an abstract interface that is implemented by concrete execution tools:
483
489
 
484
490
  - `OpenAiExecutionTools`
485
491
  - _(Not implemented yet)_ `AnthropicClaudeExecutionTools`
@@ -487,9 +493,9 @@ Internally it calls OpenAI, Azure, GPU, proxy, cache, logging,...
487
493
  - _(Not implemented yet)_ `BardExecutionTools`
488
494
  - _(Not implemented yet)_ `LamaExecutionTools`
489
495
  - _(Not implemented yet)_ `GpuExecutionTools`
490
- - And a special case are `RemoteNaturalExecutionTools` that connect to a remote server and run one of the above execution tools on that server.
491
- - The second special case is `MockedEchoNaturalExecutionTools` that is used for testing and mocking.
492
- - The third special case is `LogNaturalExecutionToolsWrapper` that is technically also an execution tools but it is more proxy wrapper around other execution tools that logs all calls to execution tools.
496
+ - And a special case are `RemoteLlmExecutionTools` that connect to a remote server and run one of the above execution tools on that server.
497
+ - The second special case is `MockedEchoLlmExecutionTools` that is used for testing and mocking.
498
+ - 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
499
 
494
500
  #### Script Execution Tools
495
501
 
@@ -686,6 +692,10 @@ See [CHANGELOG.md](./CHANGELOG.md)
686
692
 
687
693
  <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
694
 
695
+ ## 🎯 Todos
696
+
697
+ See [TODO.md](./TODO.md)
698
+
689
699
 
690
700
 
691
701
 
@@ -1,3 +1,3 @@
1
- import { LangtailExecutionTools } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools';
2
- import { LangtailExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions';
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 { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
2
- import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
3
- export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
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/natural-execution-tools/openai/OpenAiExecutionTools';
2
- import { OpenAiExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions';
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/natural-execution-tools/remote/interfaces/RemoteServerOptions';
2
- import { RemoteNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionTools';
3
- import { RemoteNaturalExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions';
4
- export { RemoteNaturalExecutionTools, RemoteNaturalExecutionToolsOptions, RemoteServerOptions };
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/natural-execution-tools/remote/interfaces/RemoteServerOptions';
2
- import { startRemoteServer } from '../execution/plugins/natural-execution-tools/remote/startRemoteServer';
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 { NaturalExecutionTools } from '../execution/NaturalExecutionTools';
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 { CommonExecutionToolsOptions, EXPECTATION_UNITS, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, FromtoItems, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, 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, };
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 { NaturalExecutionTools } from './NaturalExecutionTools';
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
- natural: NaturalExecutionTools;
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#natural-execution-tools
8
+ * @see https://github.com/webgptorg/promptbook#llm-execution-tools
9
9
  */
10
- export type NaturalExecutionTools = {
10
+ export type LlmExecutionTools = {
11
11
  /**
12
12
  * Use a chat model
13
13
  */
@@ -1,9 +1,9 @@
1
- import type { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 NaturalExecutionTools {
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 MockedEchoNaturalExecutionTools implements NaturalExecutionTools {
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 MockedFackedNaturalExecutionTools implements NaturalExecutionTools {
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 MockedFackedNaturalExecutionTools
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 NaturalExecutionTools {
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
2
+ import { LlmExecutionTools } from '../../../LlmExecutionTools';
3
3
  import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
4
- import { RemoteNaturalExecutionToolsOptions } from './RemoteNaturalExecutionToolsOptions';
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 RemoteNaturalExecutionTools implements NaturalExecutionTools {
13
+ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
14
14
  private readonly options;
15
- constructor(options: RemoteNaturalExecutionToolsOptions);
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: [🤹‍♂️] RemoteNaturalExecutionTools should extend Destroyable and implement IDestroyable
34
+ * TODO: [🤹‍♂️] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
35
35
  */
@@ -1,9 +1,9 @@
1
- import type { client_id, string_uri } from '../../../.././types/typeAliases';
1
+ import type { client_id, string_uri } from '../../../../types/typeAliases';
2
2
  import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
3
  /**
4
- * Options for RemoteNaturalExecutionTools
4
+ * Options for RemoteLlmExecutionTools
5
5
  */
6
- export type RemoteNaturalExecutionToolsOptions = CommonExecutionToolsOptions & {
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 { NaturalExecutionTools } from '../../../../NaturalExecutionTools';
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 natural execution tools for each client
24
+ * Creates llm execution tools for each client
25
25
  */
26
- createNaturalExecutionTools(clientId: client_id): NaturalExecutionTools;
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 = NaturalTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
9
+ export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
10
10
  /**
11
11
  * Template for prompt to LLM
12
12
  */
13
- export type NaturalTemplateJson = PromptTemplateJsonCommon & {
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.46.0",
3
+ "version": "0.47.0",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -34,8 +34,18 @@
34
34
  },
35
35
  "homepage": "https://www.npmjs.com/package/@promptbook/core",
36
36
  "dependencies": {},
37
+ "funding": [
38
+ {
39
+ "type": "individual",
40
+ "url": "https://buymeacoffee.com/hejny"
41
+ },
42
+ {
43
+ "type": "github",
44
+ "url": "https://github.com/webgptorg/promptbook/blob/main/README.md#%EF%B8%8F-contributing"
45
+ }
46
+ ],
37
47
  "peerDependencies": {
38
- "@promptbook/core": "0.46.0"
48
+ "@promptbook/core": "0.47.0"
39
49
  },
40
50
  "main": "./umd/index.umd.js",
41
51
  "module": "./esm/index.es.js",
@@ -1,3 +1,3 @@
1
- import { LangtailExecutionTools } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools';
2
- import { LangtailExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions';
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 { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
2
- import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
3
- export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
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/natural-execution-tools/openai/OpenAiExecutionTools';
2
- import { OpenAiExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions';
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/natural-execution-tools/remote/interfaces/RemoteServerOptions';
2
- import { RemoteNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionTools';
3
- import { RemoteNaturalExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions';
4
- export { RemoteNaturalExecutionTools, RemoteNaturalExecutionToolsOptions, RemoteServerOptions };
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/natural-execution-tools/remote/interfaces/RemoteServerOptions';
2
- import { startRemoteServer } from '../execution/plugins/natural-execution-tools/remote/startRemoteServer';
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 { NaturalExecutionTools } from '../execution/NaturalExecutionTools';
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 { CommonExecutionToolsOptions, EXPECTATION_UNITS, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, FromtoItems, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, 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, };
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 { NaturalExecutionTools } from './NaturalExecutionTools';
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
- natural: NaturalExecutionTools;
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#natural-execution-tools
8
+ * @see https://github.com/webgptorg/promptbook#llm-execution-tools
9
9
  */
10
- export type NaturalExecutionTools = {
10
+ export type LlmExecutionTools = {
11
11
  /**
12
12
  * Use a chat model
13
13
  */
@@ -1,9 +1,9 @@
1
- import type { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 NaturalExecutionTools {
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 MockedEchoNaturalExecutionTools implements NaturalExecutionTools {
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 MockedFackedNaturalExecutionTools implements NaturalExecutionTools {
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 MockedFackedNaturalExecutionTools
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
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 NaturalExecutionTools {
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 { NaturalExecutionTools } from '../../../NaturalExecutionTools';
2
+ import { LlmExecutionTools } from '../../../LlmExecutionTools';
3
3
  import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
4
- import { RemoteNaturalExecutionToolsOptions } from './RemoteNaturalExecutionToolsOptions';
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 RemoteNaturalExecutionTools implements NaturalExecutionTools {
13
+ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
14
14
  private readonly options;
15
- constructor(options: RemoteNaturalExecutionToolsOptions);
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: [🤹‍♂️] RemoteNaturalExecutionTools should extend Destroyable and implement IDestroyable
34
+ * TODO: [🤹‍♂️] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
35
35
  */
@@ -1,9 +1,9 @@
1
- import type { client_id, string_uri } from '../../../.././types/typeAliases';
1
+ import type { client_id, string_uri } from '../../../../types/typeAliases';
2
2
  import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
3
  /**
4
- * Options for RemoteNaturalExecutionTools
4
+ * Options for RemoteLlmExecutionTools
5
5
  */
6
- export type RemoteNaturalExecutionToolsOptions = CommonExecutionToolsOptions & {
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 { NaturalExecutionTools } from '../../../../NaturalExecutionTools';
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 natural execution tools for each client
24
+ * Creates llm execution tools for each client
25
25
  */
26
- createNaturalExecutionTools(clientId: client_id): NaturalExecutionTools;
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 = NaturalTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
9
+ export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
10
10
  /**
11
11
  * Template for prompt to LLM
12
12
  */
13
- export type NaturalTemplateJson = PromptTemplateJsonCommon & {
13
+ export type LlmTemplateJson = PromptTemplateJsonCommon & {
14
14
  readonly executionType: 'PROMPT_TEMPLATE';
15
15
  /**
16
16
  * Requirements for the model