@promptbook/core 0.49.1 → 0.50.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +1 -1
- package/esm/typings/execution/LlmExecutionTools.d.ts +22 -2
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +8 -4
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +8 -4
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +6 -1
- package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +8 -4
- package/package.json +1 -1
- package/umd/index.umd.js +1 -1
- package/umd/typings/execution/LlmExecutionTools.d.ts +22 -2
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +8 -4
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +8 -4
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +6 -1
- package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +8 -4
package/esm/index.es.js
CHANGED
|
@@ -440,7 +440,7 @@ function removeContentComments(content) {
|
|
|
440
440
|
/**
|
|
441
441
|
* The version of the Promptbook library
|
|
442
442
|
*/
|
|
443
|
-
var PROMPTBOOK_VERSION = '0.
|
|
443
|
+
var PROMPTBOOK_VERSION = '0.50.0-0';
|
|
444
444
|
|
|
445
445
|
/**
|
|
446
446
|
* Parses the given script and returns the list of all used variables that are not defined in the script
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { ModelVariant } from '../types/ModelRequirements';
|
|
1
3
|
import type { Prompt } from '../types/Prompt';
|
|
4
|
+
import type { string_model_name } from '../types/typeAliases';
|
|
2
5
|
import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* Container for all the tools needed to execute prompts to large language models like GPT-4
|
|
5
8
|
* On its interface it exposes common methods for prompt execution.
|
|
6
9
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
7
10
|
*
|
|
@@ -16,9 +19,26 @@ export type LlmExecutionTools = {
|
|
|
16
19
|
* Use a completion model
|
|
17
20
|
*/
|
|
18
21
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* List all available models that can be used
|
|
24
|
+
*/
|
|
25
|
+
listModels(): Promisable<Array<AviableModel>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a model that can be used for prompt execution
|
|
29
|
+
*/
|
|
30
|
+
export type AviableModel = {
|
|
31
|
+
/**
|
|
32
|
+
* The model name aviailable
|
|
33
|
+
*/
|
|
34
|
+
readonly modelName: string_model_name;
|
|
35
|
+
/**
|
|
36
|
+
* Variant of the model
|
|
37
|
+
*/
|
|
38
|
+
readonly modelVariant: ModelVariant;
|
|
19
39
|
};
|
|
20
40
|
/**
|
|
21
|
-
* TODO: [🍓][♐]
|
|
41
|
+
* TODO: [🍓][♐] Some heuristic to pick the best model in listed models
|
|
22
42
|
* TODO: [🏳] gptChat -> chat, gptComplete -> complete, translate
|
|
23
43
|
* TODO: [🧠] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
24
44
|
*/
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
7
|
*/
|
|
@@ -16,6 +16,10 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
16
16
|
* Mocks completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available mocked-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AviableModel>;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
7
|
*/
|
|
@@ -16,4 +16,8 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
16
16
|
* Fakes completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available fake-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AviableModel>;
|
|
19
23
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
1
2
|
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
4
|
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
5
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
6
|
/**
|
|
@@ -25,6 +26,10 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
25
26
|
* Calls OpenAI API to use a complete model.
|
|
26
27
|
*/
|
|
27
28
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
29
|
+
/**
|
|
30
|
+
* List all available OpenAI models that can be used
|
|
31
|
+
*/
|
|
32
|
+
listModels(): Promisable<Array<AviableModel>>;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
-
import { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
import type { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
5
5
|
/**
|
|
6
6
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
7
7
|
*
|
|
@@ -29,6 +29,10 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
29
29
|
* Calls remote proxy server to use both completion or chat model.
|
|
30
30
|
*/
|
|
31
31
|
private gptCommon;
|
|
32
|
+
/**
|
|
33
|
+
* List all available models that can be used
|
|
34
|
+
*/
|
|
35
|
+
listModels(): Promise<Array<AviableModel>>;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -446,7 +446,7 @@
|
|
|
446
446
|
/**
|
|
447
447
|
* The version of the Promptbook library
|
|
448
448
|
*/
|
|
449
|
-
var PROMPTBOOK_VERSION = '0.
|
|
449
|
+
var PROMPTBOOK_VERSION = '0.50.0-0';
|
|
450
450
|
|
|
451
451
|
/**
|
|
452
452
|
* Parses the given script and returns the list of all used variables that are not defined in the script
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { ModelVariant } from '../types/ModelRequirements';
|
|
1
3
|
import type { Prompt } from '../types/Prompt';
|
|
4
|
+
import type { string_model_name } from '../types/typeAliases';
|
|
2
5
|
import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* Container for all the tools needed to execute prompts to large language models like GPT-4
|
|
5
8
|
* On its interface it exposes common methods for prompt execution.
|
|
6
9
|
* Inside (in constructor) it calls OpenAI, Azure, GPU, proxy, cache, logging,...
|
|
7
10
|
*
|
|
@@ -16,9 +19,26 @@ export type LlmExecutionTools = {
|
|
|
16
19
|
* Use a completion model
|
|
17
20
|
*/
|
|
18
21
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* List all available models that can be used
|
|
24
|
+
*/
|
|
25
|
+
listModels(): Promisable<Array<AviableModel>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a model that can be used for prompt execution
|
|
29
|
+
*/
|
|
30
|
+
export type AviableModel = {
|
|
31
|
+
/**
|
|
32
|
+
* The model name aviailable
|
|
33
|
+
*/
|
|
34
|
+
readonly modelName: string_model_name;
|
|
35
|
+
/**
|
|
36
|
+
* Variant of the model
|
|
37
|
+
*/
|
|
38
|
+
readonly modelVariant: ModelVariant;
|
|
19
39
|
};
|
|
20
40
|
/**
|
|
21
|
-
* TODO: [🍓][♐]
|
|
41
|
+
* TODO: [🍓][♐] Some heuristic to pick the best model in listed models
|
|
22
42
|
* TODO: [🏳] gptChat -> chat, gptComplete -> complete, translate
|
|
23
43
|
* TODO: [🧠] Should or should not there be a word "GPT" in both gptComplete and gptChat
|
|
24
44
|
*/
|
package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just echoing the requests for testing purposes.
|
|
7
7
|
*/
|
|
@@ -16,6 +16,10 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
16
16
|
* Mocks completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available mocked-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AviableModel>;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
4
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
5
5
|
/**
|
|
6
6
|
* Mocked execution Tools for just faking expected responses for testing purposes
|
|
7
7
|
*/
|
|
@@ -16,4 +16,8 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
16
16
|
* Fakes completion model
|
|
17
17
|
*/
|
|
18
18
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* List all available fake-models that can be used
|
|
21
|
+
*/
|
|
22
|
+
listModels(): Array<AviableModel>;
|
|
19
23
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
1
2
|
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import type { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
4
|
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
5
|
import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
|
|
5
6
|
/**
|
|
@@ -25,6 +26,10 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
25
26
|
* Calls OpenAI API to use a complete model.
|
|
26
27
|
*/
|
|
27
28
|
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
29
|
+
/**
|
|
30
|
+
* List all available OpenAI models that can be used
|
|
31
|
+
*/
|
|
32
|
+
listModels(): Promisable<Array<AviableModel>>;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|
package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Prompt } from '../../../../types/Prompt';
|
|
2
|
-
import { LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
-
import { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
-
import { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AviableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
import type { RemoteLlmExecutionToolsOptions } from './RemoteLlmExecutionToolsOptions';
|
|
5
5
|
/**
|
|
6
6
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
7
7
|
*
|
|
@@ -29,6 +29,10 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
29
29
|
* Calls remote proxy server to use both completion or chat model.
|
|
30
30
|
*/
|
|
31
31
|
private gptCommon;
|
|
32
|
+
/**
|
|
33
|
+
* List all available models that can be used
|
|
34
|
+
*/
|
|
35
|
+
listModels(): Promise<Array<AviableModel>>;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* TODO: [🍓][♐] Allow to list compatible models with each variant
|