@promptbook/core 0.50.0-1 → 0.50.0-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/esm/index.es.js +13 -9
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/_packages/types.index.d.ts +3 -3
  4. package/esm/typings/execution/ExecutionTools.d.ts +3 -1
  5. package/esm/typings/execution/LlmExecutionTools.d.ts +7 -3
  6. package/esm/typings/execution/PromptbookExecutor.d.ts +1 -1
  7. package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +1 -1
  8. package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
  9. package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +4 -4
  10. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +10 -3
  11. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +2 -2
  12. package/esm/typings/types/ModelRequirements.d.ts +2 -1
  13. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +3 -3
  14. package/package.json +1 -1
  15. package/umd/index.umd.js +13 -9
  16. package/umd/index.umd.js.map +1 -1
  17. package/umd/typings/_packages/types.index.d.ts +3 -3
  18. package/umd/typings/execution/ExecutionTools.d.ts +3 -1
  19. package/umd/typings/execution/LlmExecutionTools.d.ts +7 -3
  20. package/umd/typings/execution/PromptbookExecutor.d.ts +1 -1
  21. package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +1 -1
  22. package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
  23. package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +4 -4
  24. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +10 -3
  25. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +2 -2
  26. package/umd/typings/types/ModelRequirements.d.ts +2 -1
  27. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +3 -3
@@ -1,6 +1,6 @@
1
1
  import type { Prompt } from '../../../../types/Prompt';
2
2
  import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
- import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
3
+ import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
4
4
  import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
5
5
  /**
6
6
  * Mocked execution Tools for just echoing the requests for testing purposes.
@@ -19,7 +19,7 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
19
19
  /**
20
20
  * List all available mocked-models that can be used
21
21
  */
22
- listModels(): Array<AviableModel>;
22
+ listModels(): Array<AvailableModel>;
23
23
  }
24
24
  /**
25
25
  * TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
@@ -1,6 +1,6 @@
1
1
  import type { Prompt } from '../../../../types/Prompt';
2
2
  import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
3
- import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
3
+ import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
4
4
  import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
5
5
  /**
6
6
  * Mocked execution Tools for just faking expected responses for testing purposes
@@ -17,7 +17,7 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
17
17
  */
18
18
  gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
19
19
  /**
20
- * List all available fake-models that can be used
21
- */
22
- listModels(): Array<AviableModel>;
20
+ * List all available fake-models that can be used
21
+ */
22
+ listModels(): Array<AvailableModel>;
23
23
  }
@@ -1,6 +1,5 @@
1
- import type { Promisable } from 'type-fest';
2
1
  import type { Prompt } from '../../../../types/Prompt';
3
- import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
2
+ import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
4
3
  import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
5
4
  import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
6
5
  /**
@@ -26,10 +25,18 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
26
25
  * Calls OpenAI API to use a complete model.
27
26
  */
28
27
  gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
28
+ /**
29
+ * Default model for chat variant.
30
+ */
31
+ private getDefaultChatModel;
32
+ /**
33
+ * Default model for completion variant.
34
+ */
35
+ private getDefaultCompletionModel;
29
36
  /**
30
37
  * List all available OpenAI models that can be used
31
38
  */
32
- listModels(): Promisable<Array<AviableModel>>;
39
+ listModels(): Array<AvailableModel>;
33
40
  }
34
41
  /**
35
42
  * TODO: [🍓][♐] Allow to list compatible models with each variant
@@ -1,5 +1,5 @@
1
1
  import type { Prompt } from '../../../../types/Prompt';
2
- import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
2
+ import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
3
3
  import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
4
4
  import type { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
5
5
  /**
@@ -32,7 +32,7 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
32
32
  /**
33
33
  * List all available models that can be used
34
34
  */
35
- listModels(): Promise<Array<AviableModel>>;
35
+ listModels(): Promise<Array<AvailableModel>>;
36
36
  }
37
37
  /**
38
38
  * TODO: [🍓][♐] Allow to list compatible models with each variant
@@ -26,10 +26,11 @@ export type ModelRequirements = {
26
26
  * The model for text prompt
27
27
  *
28
28
  * Note: Model must be compatible with the model variant
29
+ * Note: If not specified, the best model for the variant will be used
29
30
  *
30
31
  * @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
31
32
  */
32
- readonly modelName: string_model_name;
33
+ readonly modelName?: string_model_name;
33
34
  /**
34
35
  * Maximum number of tokens that can be generated by the model
35
36
  */
@@ -44,13 +44,13 @@ export type ExpectationAmount = number_integer & number_positive_or_zero;
44
44
  /**
45
45
  * Template for simple concatenation of strings
46
46
  */
47
- interface SimpleTemplateJson extends PromptTemplateJsonCommon {
47
+ export interface SimpleTemplateJson extends PromptTemplateJsonCommon {
48
48
  readonly executionType: 'SIMPLE_TEMPLATE';
49
49
  }
50
50
  /**
51
51
  * Template for script execution
52
52
  */
53
- interface ScriptJson extends PromptTemplateJsonCommon {
53
+ export interface ScriptJson extends PromptTemplateJsonCommon {
54
54
  readonly executionType: 'SCRIPT';
55
55
  /**
56
56
  * Language of the script
@@ -62,7 +62,7 @@ interface ScriptJson extends PromptTemplateJsonCommon {
62
62
  /**
63
63
  * Template for prompt to user
64
64
  */
65
- interface PromptDialogJson extends PromptTemplateJsonCommon {
65
+ export interface PromptDialogJson extends PromptTemplateJsonCommon {
66
66
  readonly executionType: 'PROMPT_DIALOG';
67
67
  }
68
68
  /**