@promptbook/types 0.44.0 → 0.46.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.
Files changed (56) hide show
  1. package/README.md +15 -2
  2. package/esm/typings/_packages/core.index.d.ts +0 -3
  3. package/esm/typings/_packages/langtail.index.d.ts +3 -0
  4. package/esm/typings/_packages/mock.index.d.ts +6 -0
  5. package/esm/typings/conversion/promptbookStringToJson.d.ts +2 -2
  6. package/esm/typings/execution/ExecutionTools.d.ts +3 -3
  7. package/esm/typings/execution/NaturalExecutionTools.d.ts +2 -2
  8. package/esm/typings/execution/ScriptExecutionTools.d.ts +2 -2
  9. package/esm/typings/execution/UserInterfaceTools.d.ts +1 -1
  10. package/esm/typings/execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools.d.ts +10 -0
  11. package/esm/typings/execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
  12. package/esm/typings/execution/plugins/natural-execution-tools/mocked/fakeTextToExpectations.d.ts +1 -1
  13. package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionTools.d.ts +5 -0
  14. package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +7 -7
  15. package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +1 -1
  16. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +3 -3
  17. package/esm/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +1 -1
  18. package/esm/typings/library/PromptbookLibrary.d.ts +1 -1
  19. package/esm/typings/types/ExecutionTypes.d.ts +1 -1
  20. package/esm/typings/types/ModelRequirements.d.ts +1 -1
  21. package/esm/typings/types/Prompt.d.ts +1 -1
  22. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +5 -5
  23. package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +1 -1
  24. package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +3 -3
  25. package/esm/typings/types/ScriptLanguage.d.ts +1 -1
  26. package/esm/typings/types/TaskProgress.d.ts +2 -2
  27. package/esm/typings/types/execution-report/ExecutionReportStringOptions.d.ts +1 -1
  28. package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
  29. package/package.json +2 -2
  30. package/umd/typings/_packages/core.index.d.ts +0 -3
  31. package/umd/typings/_packages/langtail.index.d.ts +3 -0
  32. package/umd/typings/_packages/mock.index.d.ts +6 -0
  33. package/umd/typings/conversion/promptbookStringToJson.d.ts +2 -2
  34. package/umd/typings/execution/ExecutionTools.d.ts +3 -3
  35. package/umd/typings/execution/NaturalExecutionTools.d.ts +2 -2
  36. package/umd/typings/execution/ScriptExecutionTools.d.ts +2 -2
  37. package/umd/typings/execution/UserInterfaceTools.d.ts +1 -1
  38. package/umd/typings/execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools.d.ts +10 -0
  39. package/umd/typings/execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
  40. package/umd/typings/execution/plugins/natural-execution-tools/mocked/fakeTextToExpectations.d.ts +1 -1
  41. package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionTools.d.ts +5 -0
  42. package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +7 -7
  43. package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +1 -1
  44. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +3 -3
  45. package/umd/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +1 -1
  46. package/umd/typings/library/PromptbookLibrary.d.ts +1 -1
  47. package/umd/typings/types/ExecutionTypes.d.ts +1 -1
  48. package/umd/typings/types/ModelRequirements.d.ts +1 -1
  49. package/umd/typings/types/Prompt.d.ts +1 -1
  50. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +5 -5
  51. package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +1 -1
  52. package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +3 -3
  53. package/umd/typings/types/ScriptLanguage.d.ts +1 -1
  54. package/umd/typings/types/TaskProgress.d.ts +2 -2
  55. package/umd/typings/types/execution-report/ExecutionReportStringOptions.d.ts +1 -1
  56. package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
package/README.md CHANGED
@@ -32,6 +32,8 @@ import { promptbookStringToJson } from '@promptbook/core';
32
32
  const promptbook: PromptbookJson = promptbookStringToJson(...);
33
33
  ```
34
34
 
35
+ _Note: `@promptbook/types` does not export brand-specific types like `OpenAiExecutionToolsOptions`, `ClaudeExecutionToolsOptions`, `LangchainExecutionToolsOptions`,... etc._
36
+
35
37
 
36
38
  ---
37
39
 
@@ -313,15 +315,26 @@ _Note: We are using [postprocessing functions](#postprocessing-functions) like `
313
315
 
314
316
  ## 📦 Packages
315
317
 
316
- This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook):
318
+ This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
319
+ You can install all of them at once:
320
+
321
+ ```bash
322
+ npm i ptbk
323
+ ```
324
+
325
+ Or you can install them separately:
317
326
 
318
327
  <!--[🔠]-->
319
328
 
329
+ <!-- Add all new -->
330
+
320
331
  - **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
321
- - **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
332
+ - **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
322
333
  - _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
323
334
  - **[@promptbook/execute-javascript](https://www.npmjs.com/package/@promptbook/execute-javascript)** - Execution tools for javascript inside promptbooks
324
335
  - **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
336
+ - **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
337
+ - **[@promptbook/mock](https://www.npmjs.com/package/@promptbook/mock)** - Mocked execution tools for testing the library and saving the tokens
325
338
  - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
326
339
  - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
327
340
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
@@ -1,8 +1,6 @@
1
1
  import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
2
2
  import { validatePromptbookJson } from '../conversion/validation/validatePromptbookJson';
3
3
  import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
4
- import { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
5
- import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
6
4
  import { CallbackInterfaceTools } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools';
7
5
  import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
8
6
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
@@ -16,6 +14,5 @@ export { ExecutionTypes, PROMPTBOOK_VERSION };
16
14
  export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
17
15
  export { SimplePromptInterfaceTools };
18
16
  export { promptbookStringToJson, validatePromptbookJson };
19
- export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
20
17
  export { createPromptbookExecutor };
21
18
  export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
@@ -0,0 +1,3 @@
1
+ import { LangtailExecutionTools } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools';
2
+ import { LangtailExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions';
3
+ export { LangtailExecutionTools, LangtailExecutionToolsOptions };
@@ -0,0 +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 };
4
+ /**
5
+ * TODO: [🚏] FakeLLM
6
+ */
@@ -1,5 +1,5 @@
1
- import { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
- import { PromptbookString } from '../types/PromptbookString';
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookString } from '../types/PromptbookString';
3
3
  /**
4
4
  * Parse promptbook from string format to JSON format
5
5
  *
@@ -1,6 +1,6 @@
1
- import { NaturalExecutionTools } from './NaturalExecutionTools';
2
- import { ScriptExecutionTools } from './ScriptExecutionTools';
3
- import { UserInterfaceTools } from './UserInterfaceTools';
1
+ import type { NaturalExecutionTools } from './NaturalExecutionTools';
2
+ import type { ScriptExecutionTools } from './ScriptExecutionTools';
3
+ import type { UserInterfaceTools } from './UserInterfaceTools';
4
4
  /**
5
5
  * All the tools needed to execute prompts (template pipelines).
6
6
  *
@@ -1,5 +1,5 @@
1
- import { Prompt } from '../types/Prompt';
2
- import { PromptChatResult, PromptCompletionResult } from './PromptResult';
1
+ import type { Prompt } from '../types/Prompt';
2
+ import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
3
3
  /**
4
4
  * Vontainer for all the tools needed to execute prompts to large language models like GPT-4
5
5
  * On its interface it exposes common methods for prompt execution.
@@ -1,5 +1,5 @@
1
- import { string_name, string_script } from '.././types/typeAliases';
2
- import { ScriptLanguage } from '../types/ScriptLanguage';
1
+ import type { string_name, string_script } from '.././types/typeAliases';
2
+ import type { ScriptLanguage } from '../types/ScriptLanguage';
3
3
  /**
4
4
  * Represents all the tools needed to EXECUTE SCRIPTs
5
5
  *
@@ -1,4 +1,4 @@
1
- import { number_integer, number_positive } from '../types/typeAliases';
1
+ import type { number_integer, number_positive } from '../types/typeAliases';
2
2
  /**
3
3
  * Represents all the tools needed to interact with the user.
4
4
  *
@@ -0,0 +1,10 @@
1
+ import type { NaturalExecutionTools } from '../../../NaturalExecutionTools';
2
+ import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
3
+ /**
4
+ * Execution Tools for calling OpenAI API.
5
+ */
6
+ export declare class LangtailExecutionTools extends OpenAiExecutionTools implements NaturalExecutionTools {
7
+ }
8
+ /**
9
+ * TODO: !!! Make lib which exports this
10
+ */
@@ -0,0 +1,11 @@
1
+ import type { OpenAiExecutionToolsOptions } from '../openai/OpenAiExecutionToolsOptions';
2
+ /**
3
+ * Options for LangtailExecutionTools
4
+ *
5
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
6
+ * Rest is used by the `OpenAiExecutionTools`.
7
+ */
8
+ export type LangtailExecutionToolsOptions = OpenAiExecutionToolsOptions;
9
+ /**
10
+ * TODO: !!! Use or remove
11
+ */
@@ -10,6 +10,6 @@ import { PostprocessingFunction } from '../../script-execution-tools/javascript/
10
10
  */
11
11
  export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
12
12
  /**
13
- * TODO: Implement better - create FakeLLM from this
13
+ * TODO: [🚏] Implement better - create FakeLLM from this
14
14
  * TODO: [💝] Unite object for expecting amount and format - use here also a format
15
15
  */
@@ -11,6 +11,11 @@ export declare class OpenAiExecutionTools implements NaturalExecutionTools {
11
11
  * OpenAI API client.
12
12
  */
13
13
  private readonly openai;
14
+ /**
15
+ * Creates OpenAI Execution Tools.
16
+ *
17
+ * @param options which are relevant are directly passed to the OpenAI client
18
+ */
14
19
  constructor(options: OpenAiExecutionToolsOptions);
15
20
  /**
16
21
  * Calls OpenAI API to use a chat model.
@@ -1,13 +1,13 @@
1
- import { string_token } from '../../../.././types/typeAliases';
2
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
1
+ import type { ClientOptions } from 'openai';
2
+ import type { string_token } from '../../../.././types/typeAliases';
3
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
4
  /**
4
5
  * Options for OpenAiExecutionTools
6
+ *
7
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
8
+ * Rest is used by the `OpenAiExecutionTools`.
5
9
  */
6
- export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & {
7
- /**
8
- * OpenAI API key
9
- */
10
- openAiApiKey: string_token;
10
+ export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & ClientOptions & {
11
11
  /**
12
12
  * A unique identifier representing your end-user, which can help OpenAI to monitor
13
13
  * and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
@@ -1,5 +1,5 @@
1
1
  import type { client_id, string_uri } from '../../../.././types/typeAliases';
2
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
2
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
3
  /**
4
4
  * Options for RemoteNaturalExecutionTools
5
5
  */
@@ -1,6 +1,6 @@
1
- import { Promisable } from 'type-fest';
2
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
- import { UserInterfaceToolsPromptDialogOptions } from '../../../UserInterfaceTools';
1
+ import type { Promisable } from 'type-fest';
2
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
+ import type { UserInterfaceToolsPromptDialogOptions } from '../../../UserInterfaceTools';
4
4
  /**
5
5
  * Options for CallbackInterfaceTools
6
6
  */
@@ -1,4 +1,4 @@
1
- import { Promisable } from 'type-fest';
1
+ import type { Promisable } from 'type-fest';
2
2
  export type AutomaticTranslator = {
3
3
  translate(message: string): Promisable<string>;
4
4
  };
@@ -1,4 +1,4 @@
1
- import { Promisable } from 'type-fest';
1
+ import type { Promisable } from 'type-fest';
2
2
  import type { Prompt } from '../types/Prompt';
3
3
  import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
4
4
  import type { string_promptbook_url } from '../types/typeAliases';
@@ -1,4 +1,4 @@
1
- import { TupleToUnion } from 'type-fest';
1
+ import type { TupleToUnion } from 'type-fest';
2
2
  /**
3
3
  * Execution type describes the way how the block is executed
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_model_name } from './typeAliases';
1
+ import type { string_model_name } from './typeAliases';
2
2
  export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT"];
3
3
  /**
4
4
  * Model variant describes the very general type of the model
@@ -1,5 +1,5 @@
1
1
  import type { string_name, string_prompt, string_promptbook_url_with_hashtemplate, string_title } from '.././types/typeAliases';
2
- import { PostprocessingFunction } from '../execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions';
2
+ import type { PostprocessingFunction } from '../execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions';
3
3
  import type { ModelRequirements } from './ModelRequirements';
4
4
  import type { Expectations } from './PromptbookJson/PromptTemplateJson';
5
5
  /**
@@ -1,8 +1,8 @@
1
- import { ExpectFormatCommand } from '../Command';
2
- import { ExecutionType } from '../ExecutionTypes';
3
- import { ModelRequirements } from '../ModelRequirements';
4
- import { ScriptLanguage } from '../ScriptLanguage';
5
- import { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
1
+ import type { ExpectFormatCommand } from '../Command';
2
+ import type { ExecutionType } from '../ExecutionTypes';
3
+ import type { ModelRequirements } from '../ModelRequirements';
4
+ import type { ScriptLanguage } from '../ScriptLanguage';
5
+ import type { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
6
6
  /**
7
7
  * Describes one prompt template in the promptbook
8
8
  */
@@ -1,4 +1,4 @@
1
- import { string_name } from '../typeAliases';
1
+ import type { string_name } from '../typeAliases';
2
2
  /**
3
3
  * Describes one parameter of the promptbook
4
4
  */
@@ -1,6 +1,6 @@
1
- import { string_promptbook_url, string_version } from '../typeAliases';
2
- import { PromptTemplateJson } from './PromptTemplateJson';
3
- import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
1
+ import type { string_promptbook_url, string_version } from '../typeAliases';
2
+ import type { PromptTemplateJson } from './PromptTemplateJson';
3
+ import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
4
4
  /**
5
5
  * Promptbook is the **core concept of this library**.
6
6
  * It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
@@ -1,4 +1,4 @@
1
- import { TupleToUnion } from 'type-fest';
1
+ import type { TupleToUnion } from 'type-fest';
2
2
  /**
3
3
  * Supported script languages
4
4
  */
@@ -1,5 +1,5 @@
1
- import { ExecutionType } from './ExecutionTypes';
2
- import { string_markdown_text, string_name } from './typeAliases';
1
+ import type { ExecutionType } from './ExecutionTypes';
2
+ import type { string_markdown_text, string_name } from './typeAliases';
3
3
  /**
4
4
  * TaskProgress represents the progress of a Promptbook execution.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { number_percent } from '../typeAliases';
1
+ import type { number_percent } from '../typeAliases';
2
2
  /**
3
3
  * Options for generating an execution report string
4
4
  */
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Single code block inside markdown.
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.44.0",
3
+ "version": "0.46.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.44.0"
38
+ "@promptbook/core": "0.46.0-0"
39
39
  },
40
40
  "main": "./umd/index.umd.js",
41
41
  "module": "./esm/index.es.js",
@@ -1,8 +1,6 @@
1
1
  import { promptbookStringToJson } from '../conversion/promptbookStringToJson';
2
2
  import { validatePromptbookJson } from '../conversion/validation/validatePromptbookJson';
3
3
  import { createPromptbookExecutor } from '../execution/createPromptbookExecutor';
4
- import { MockedEchoNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools';
5
- import { MockedFackedNaturalExecutionTools } from '../execution/plugins/natural-execution-tools/mocked/MockedFackedNaturalExecutionTools';
6
4
  import { CallbackInterfaceTools } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools';
7
5
  import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions';
8
6
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
@@ -16,6 +14,5 @@ export { ExecutionTypes, PROMPTBOOK_VERSION };
16
14
  export { createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
17
15
  export { SimplePromptInterfaceTools };
18
16
  export { promptbookStringToJson, validatePromptbookJson };
19
- export { MockedEchoNaturalExecutionTools, MockedFackedNaturalExecutionTools };
20
17
  export { createPromptbookExecutor };
21
18
  export { CallbackInterfaceTools, CallbackInterfaceToolsOptions };
@@ -0,0 +1,3 @@
1
+ import { LangtailExecutionTools } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionTools';
2
+ import { LangtailExecutionToolsOptions } from '../execution/plugins/natural-execution-tools/langtail/LangtailExecutionToolsOptions';
3
+ export { LangtailExecutionTools, LangtailExecutionToolsOptions };
@@ -0,0 +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 };
4
+ /**
5
+ * TODO: [🚏] FakeLLM
6
+ */
@@ -1,5 +1,5 @@
1
- import { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
- import { PromptbookString } from '../types/PromptbookString';
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookString } from '../types/PromptbookString';
3
3
  /**
4
4
  * Parse promptbook from string format to JSON format
5
5
  *
@@ -1,6 +1,6 @@
1
- import { NaturalExecutionTools } from './NaturalExecutionTools';
2
- import { ScriptExecutionTools } from './ScriptExecutionTools';
3
- import { UserInterfaceTools } from './UserInterfaceTools';
1
+ import type { NaturalExecutionTools } from './NaturalExecutionTools';
2
+ import type { ScriptExecutionTools } from './ScriptExecutionTools';
3
+ import type { UserInterfaceTools } from './UserInterfaceTools';
4
4
  /**
5
5
  * All the tools needed to execute prompts (template pipelines).
6
6
  *
@@ -1,5 +1,5 @@
1
- import { Prompt } from '../types/Prompt';
2
- import { PromptChatResult, PromptCompletionResult } from './PromptResult';
1
+ import type { Prompt } from '../types/Prompt';
2
+ import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
3
3
  /**
4
4
  * Vontainer for all the tools needed to execute prompts to large language models like GPT-4
5
5
  * On its interface it exposes common methods for prompt execution.
@@ -1,5 +1,5 @@
1
- import { string_name, string_script } from '.././types/typeAliases';
2
- import { ScriptLanguage } from '../types/ScriptLanguage';
1
+ import type { string_name, string_script } from '.././types/typeAliases';
2
+ import type { ScriptLanguage } from '../types/ScriptLanguage';
3
3
  /**
4
4
  * Represents all the tools needed to EXECUTE SCRIPTs
5
5
  *
@@ -1,4 +1,4 @@
1
- import { number_integer, number_positive } from '../types/typeAliases';
1
+ import type { number_integer, number_positive } from '../types/typeAliases';
2
2
  /**
3
3
  * Represents all the tools needed to interact with the user.
4
4
  *
@@ -0,0 +1,10 @@
1
+ import type { NaturalExecutionTools } from '../../../NaturalExecutionTools';
2
+ import { OpenAiExecutionTools } from '../openai/OpenAiExecutionTools';
3
+ /**
4
+ * Execution Tools for calling OpenAI API.
5
+ */
6
+ export declare class LangtailExecutionTools extends OpenAiExecutionTools implements NaturalExecutionTools {
7
+ }
8
+ /**
9
+ * TODO: !!! Make lib which exports this
10
+ */
@@ -0,0 +1,11 @@
1
+ import type { OpenAiExecutionToolsOptions } from '../openai/OpenAiExecutionToolsOptions';
2
+ /**
3
+ * Options for LangtailExecutionTools
4
+ *
5
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
6
+ * Rest is used by the `OpenAiExecutionTools`.
7
+ */
8
+ export type LangtailExecutionToolsOptions = OpenAiExecutionToolsOptions;
9
+ /**
10
+ * TODO: !!! Use or remove
11
+ */
@@ -10,6 +10,6 @@ import { PostprocessingFunction } from '../../script-execution-tools/javascript/
10
10
  */
11
11
  export declare function $fakeTextToExpectations(expectations: Expectations, postprocessing?: Array<PostprocessingFunction>): Promise<string>;
12
12
  /**
13
- * TODO: Implement better - create FakeLLM from this
13
+ * TODO: [🚏] Implement better - create FakeLLM from this
14
14
  * TODO: [💝] Unite object for expecting amount and format - use here also a format
15
15
  */
@@ -11,6 +11,11 @@ export declare class OpenAiExecutionTools implements NaturalExecutionTools {
11
11
  * OpenAI API client.
12
12
  */
13
13
  private readonly openai;
14
+ /**
15
+ * Creates OpenAI Execution Tools.
16
+ *
17
+ * @param options which are relevant are directly passed to the OpenAI client
18
+ */
14
19
  constructor(options: OpenAiExecutionToolsOptions);
15
20
  /**
16
21
  * Calls OpenAI API to use a chat model.
@@ -1,13 +1,13 @@
1
- import { string_token } from '../../../.././types/typeAliases';
2
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
1
+ import type { ClientOptions } from 'openai';
2
+ import type { string_token } from '../../../.././types/typeAliases';
3
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
4
  /**
4
5
  * Options for OpenAiExecutionTools
6
+ *
7
+ * This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
8
+ * Rest is used by the `OpenAiExecutionTools`.
5
9
  */
6
- export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & {
7
- /**
8
- * OpenAI API key
9
- */
10
- openAiApiKey: string_token;
10
+ export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & ClientOptions & {
11
11
  /**
12
12
  * A unique identifier representing your end-user, which can help OpenAI to monitor
13
13
  * and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
@@ -1,5 +1,5 @@
1
1
  import type { client_id, string_uri } from '../../../.././types/typeAliases';
2
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
2
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
3
  /**
4
4
  * Options for RemoteNaturalExecutionTools
5
5
  */
@@ -1,6 +1,6 @@
1
- import { Promisable } from 'type-fest';
2
- import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
- import { UserInterfaceToolsPromptDialogOptions } from '../../../UserInterfaceTools';
1
+ import type { Promisable } from 'type-fest';
2
+ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
+ import type { UserInterfaceToolsPromptDialogOptions } from '../../../UserInterfaceTools';
4
4
  /**
5
5
  * Options for CallbackInterfaceTools
6
6
  */
@@ -1,4 +1,4 @@
1
- import { Promisable } from 'type-fest';
1
+ import type { Promisable } from 'type-fest';
2
2
  export type AutomaticTranslator = {
3
3
  translate(message: string): Promisable<string>;
4
4
  };
@@ -1,4 +1,4 @@
1
- import { Promisable } from 'type-fest';
1
+ import type { Promisable } from 'type-fest';
2
2
  import type { Prompt } from '../types/Prompt';
3
3
  import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
4
4
  import type { string_promptbook_url } from '../types/typeAliases';
@@ -1,4 +1,4 @@
1
- import { TupleToUnion } from 'type-fest';
1
+ import type { TupleToUnion } from 'type-fest';
2
2
  /**
3
3
  * Execution type describes the way how the block is executed
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_model_name } from './typeAliases';
1
+ import type { string_model_name } from './typeAliases';
2
2
  export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT"];
3
3
  /**
4
4
  * Model variant describes the very general type of the model
@@ -1,5 +1,5 @@
1
1
  import type { string_name, string_prompt, string_promptbook_url_with_hashtemplate, string_title } from '.././types/typeAliases';
2
- import { PostprocessingFunction } from '../execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions';
2
+ import type { PostprocessingFunction } from '../execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions';
3
3
  import type { ModelRequirements } from './ModelRequirements';
4
4
  import type { Expectations } from './PromptbookJson/PromptTemplateJson';
5
5
  /**
@@ -1,8 +1,8 @@
1
- import { ExpectFormatCommand } from '../Command';
2
- import { ExecutionType } from '../ExecutionTypes';
3
- import { ModelRequirements } from '../ModelRequirements';
4
- import { ScriptLanguage } from '../ScriptLanguage';
5
- import { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
1
+ import type { ExpectFormatCommand } from '../Command';
2
+ import type { ExecutionType } from '../ExecutionTypes';
3
+ import type { ModelRequirements } from '../ModelRequirements';
4
+ import type { ScriptLanguage } from '../ScriptLanguage';
5
+ import type { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
6
6
  /**
7
7
  * Describes one prompt template in the promptbook
8
8
  */
@@ -1,4 +1,4 @@
1
- import { string_name } from '../typeAliases';
1
+ import type { string_name } from '../typeAliases';
2
2
  /**
3
3
  * Describes one parameter of the promptbook
4
4
  */
@@ -1,6 +1,6 @@
1
- import { string_promptbook_url, string_version } from '../typeAliases';
2
- import { PromptTemplateJson } from './PromptTemplateJson';
3
- import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
1
+ import type { string_promptbook_url, string_version } from '../typeAliases';
2
+ import type { PromptTemplateJson } from './PromptTemplateJson';
3
+ import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
4
4
  /**
5
5
  * Promptbook is the **core concept of this library**.
6
6
  * It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
@@ -1,4 +1,4 @@
1
- import { TupleToUnion } from 'type-fest';
1
+ import type { TupleToUnion } from 'type-fest';
2
2
  /**
3
3
  * Supported script languages
4
4
  */
@@ -1,5 +1,5 @@
1
- import { ExecutionType } from './ExecutionTypes';
2
- import { string_markdown_text, string_name } from './typeAliases';
1
+ import type { ExecutionType } from './ExecutionTypes';
2
+ import type { string_markdown_text, string_name } from './typeAliases';
3
3
  /**
4
4
  * TaskProgress represents the progress of a Promptbook execution.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { number_percent } from '../typeAliases';
1
+ import type { number_percent } from '../typeAliases';
2
2
  /**
3
3
  * Options for generating an execution report string
4
4
  */
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Single code block inside markdown.
4
4
  */