@promptbook/core 0.52.0-1 → 0.52.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/esm/index.es.js +133 -2
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/anthropic-claude.index.d.ts +3 -0
- package/esm/typings/_packages/azure-openai.index.d.ts +3 -0
- package/esm/typings/_packages/core.index.d.ts +2 -1
- package/esm/typings/_packages/openai.index.d.ts +1 -1
- package/esm/typings/execution/PromptResult.d.ts +3 -3
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +42 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +8 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +20 -0
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +41 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +34 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/langtail/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +2 -2
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +35 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +23 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +3 -3
- package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +3 -1
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +6 -3
- package/esm/typings/execution/plugins/llm-execution-tools/openai/{models.d.ts → openai-models.d.ts} +2 -1
- package/esm/typings/execution/plugins/llm-execution-tools/openai/playground/playground.d.ts +2 -0
- package/package.json +1 -1
- package/umd/index.umd.js +133 -1
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/anthropic-claude.index.d.ts +3 -0
- package/umd/typings/_packages/azure-openai.index.d.ts +3 -0
- package/umd/typings/_packages/core.index.d.ts +2 -1
- package/umd/typings/_packages/openai.index.d.ts +1 -1
- package/umd/typings/execution/PromptResult.d.ts +3 -3
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +42 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +8 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +20 -0
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +41 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +34 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/langtail/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +2 -2
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +35 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +23 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +3 -3
- package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +3 -1
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +6 -3
- package/umd/typings/execution/plugins/llm-execution-tools/openai/{models.d.ts → openai-models.d.ts} +2 -1
- package/umd/typings/execution/plugins/llm-execution-tools/openai/playground/playground.d.ts +2 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { string_name, string_token } from '../../../../types/typeAliases';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for AzureOpenAiExecutionTools
|
|
5
|
+
*
|
|
6
|
+
* @see https://oai.azure.com/portal/
|
|
7
|
+
*/
|
|
8
|
+
export type AzureOpenAiExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
9
|
+
/**
|
|
10
|
+
* The resource name of the Azure OpenAI resource
|
|
11
|
+
*
|
|
12
|
+
* Note: Typically you have one resource and multiple deployments.
|
|
13
|
+
*/
|
|
14
|
+
resourceName: string_name;
|
|
15
|
+
/**
|
|
16
|
+
* The deployment name
|
|
17
|
+
*
|
|
18
|
+
* Note: If you specify modelName in prompt, it will be used instead of deploymentName
|
|
19
|
+
* Note: This is kind of a modelName in OpenAI terms
|
|
20
|
+
* Note: Typically you have one resource and multiple deployments.
|
|
21
|
+
*/
|
|
22
|
+
deploymentName: string_name;
|
|
23
|
+
/**
|
|
24
|
+
* The API key of the Azure OpenAI resource
|
|
25
|
+
*/
|
|
26
|
+
apiKey: string_token;
|
|
27
|
+
/**
|
|
28
|
+
* A unique identifier representing your end-user, which can help Azure OpenAI to monitor
|
|
29
|
+
* and detect abuse.
|
|
30
|
+
*
|
|
31
|
+
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids (document from OpenAI not Azure, but same concept)
|
|
32
|
+
*/
|
|
33
|
+
user?: string_token;
|
|
34
|
+
};
|
package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
11
11
|
/**
|
|
12
12
|
* Mocks chat model
|
|
13
13
|
*/
|
|
14
|
-
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
14
|
+
gptChat(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptChatResult>;
|
|
15
15
|
/**
|
|
16
16
|
* Mocks completion model
|
|
17
17
|
*/
|
|
18
|
-
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
18
|
+
gptComplete(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
19
19
|
/**
|
|
20
20
|
* List all available mocked-models that can be used
|
|
21
21
|
*/
|
package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
11
11
|
/**
|
|
12
12
|
* Fakes chat model
|
|
13
13
|
*/
|
|
14
|
-
gptChat(prompt: Prompt): Promise<PromptChatResult & PromptCompletionResult>;
|
|
14
|
+
gptChat(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<PromptChatResult & PromptCompletionResult>;
|
|
15
15
|
/**
|
|
16
16
|
* Fakes completion model
|
|
17
17
|
*/
|
|
18
|
-
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
18
|
+
gptComplete(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<PromptCompletionResult>;
|
|
19
19
|
/**
|
|
20
20
|
* List all available fake-models that can be used
|
|
21
21
|
*/
|
package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
/**
|
|
5
|
+
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook#multiple-server
|
|
8
|
+
*/
|
|
9
|
+
export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
|
|
10
|
+
/**
|
|
11
|
+
* Array of execution tools in order of priority
|
|
12
|
+
*/
|
|
13
|
+
private llmExecutionTools;
|
|
14
|
+
/**
|
|
15
|
+
* Gets array of execution tools in order of priority
|
|
16
|
+
*/
|
|
17
|
+
constructor(...llmExecutionTools: Array<LlmExecutionTools>);
|
|
18
|
+
/**
|
|
19
|
+
* Calls the best available chat model
|
|
20
|
+
*/
|
|
21
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Calls the best available completion model
|
|
24
|
+
*/
|
|
25
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Calls the best available model
|
|
28
|
+
*/
|
|
29
|
+
private gptCommon;
|
|
30
|
+
/**
|
|
31
|
+
* List all available models that can be used
|
|
32
|
+
* This liost is a combination of all available models from all execution tools
|
|
33
|
+
*/
|
|
34
|
+
listModels(): Promise<Array<AvailableModel>>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { client_id, string_uri } from '../../../../types/typeAliases';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for MultipleLlmExecutionTools
|
|
5
|
+
*/
|
|
6
|
+
export type MultipleLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* URL of the multiple PROMPTBOOK server
|
|
9
|
+
* On this server will be connected to the socket.io server
|
|
10
|
+
*/
|
|
11
|
+
readonly multipleUrl: URL;
|
|
12
|
+
/**
|
|
13
|
+
* Path for the Socket.io server to listen
|
|
14
|
+
*
|
|
15
|
+
* @default '/socket.io'
|
|
16
|
+
* @example '/promptbook/socket.io'
|
|
17
|
+
*/
|
|
18
|
+
readonly path: string_uri;
|
|
19
|
+
/**
|
|
20
|
+
* Your client ID
|
|
21
|
+
*/
|
|
22
|
+
readonly clientId: client_id;
|
|
23
|
+
};
|
|
@@ -10,7 +10,7 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
10
10
|
/**
|
|
11
11
|
* OpenAI API client.
|
|
12
12
|
*/
|
|
13
|
-
private readonly
|
|
13
|
+
private readonly client;
|
|
14
14
|
/**
|
|
15
15
|
* Creates OpenAI Execution Tools.
|
|
16
16
|
*
|
|
@@ -20,11 +20,11 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
20
20
|
/**
|
|
21
21
|
* Calls OpenAI API to use a chat model.
|
|
22
22
|
*/
|
|
23
|
-
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
23
|
+
gptChat(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptChatResult>;
|
|
24
24
|
/**
|
|
25
25
|
* Calls OpenAI API to use a complete model.
|
|
26
26
|
*/
|
|
27
|
-
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
27
|
+
gptComplete(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
28
28
|
/**
|
|
29
29
|
* Default model for chat variant.
|
|
30
30
|
*/
|
package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsO
|
|
|
10
10
|
export type OpenAiExecutionToolsOptions = CommonExecutionToolsOptions & ClientOptions & {
|
|
11
11
|
/**
|
|
12
12
|
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
13
|
-
* and detect abuse.
|
|
13
|
+
* and detect abuse.
|
|
14
|
+
*
|
|
15
|
+
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
14
16
|
*/
|
|
15
17
|
user?: string_token;
|
|
16
18
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* String value found on
|
|
2
|
+
* String value found on OpenAI and Anthropic Claude page
|
|
3
|
+
*
|
|
4
|
+
* @see https://openai.com/api/pricing/
|
|
5
|
+
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
3
6
|
*
|
|
4
7
|
* @private within the library, used only as internal helper for `OPENAI_MODELS` and `computeUsage`
|
|
5
8
|
*/
|
|
6
|
-
type
|
|
9
|
+
type string_model_price = `$${number}.${number} / ${number}M tokens`;
|
|
7
10
|
/**
|
|
8
11
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
9
12
|
*
|
|
10
13
|
* @private within the library, used only as internal helper for `OPENAI_MODELS`
|
|
11
14
|
*/
|
|
12
|
-
export declare function computeUsage(value:
|
|
15
|
+
export declare function computeUsage(value: string_model_price): number;
|
|
13
16
|
export {};
|
package/umd/typings/execution/plugins/llm-execution-tools/openai/{models.d.ts → openai-models.d.ts}
RENAMED
|
@@ -16,7 +16,8 @@ export declare const OPENAI_MODELS: Array<AvailableModel & {
|
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
19
|
-
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
19
|
+
* TODO: [🕚][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
20
|
+
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
20
21
|
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
21
22
|
* @see https://openai.com/api/pricing/
|
|
22
23
|
* @see /other/playground/playground.ts
|