@promptbook/templates 0.98.0-6 → 0.98.0-9
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 +10 -10
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
- package/esm/typings/src/_packages/openai.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +10 -2
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +1 -0
- package/esm/typings/src/execution/utils/validatePromptResult.d.ts +53 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +4 -4
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +42 -1
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +58 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +10 -10
package/esm/index.es.js
CHANGED
|
@@ -16,7 +16,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
16
16
|
* @generated
|
|
17
17
|
* @see https://github.com/webgptorg/promptbook
|
|
18
18
|
*/
|
|
19
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-
|
|
19
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-9';
|
|
20
20
|
/**
|
|
21
21
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
22
22
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1571,7 +1571,7 @@ function getTemplatesPipelineCollection() {
|
|
|
1571
1571
|
"preparations": [
|
|
1572
1572
|
{
|
|
1573
1573
|
"id": 1,
|
|
1574
|
-
"promptbookVersion": "0.98.0-
|
|
1574
|
+
"promptbookVersion": "0.98.0-8",
|
|
1575
1575
|
"usage": {
|
|
1576
1576
|
"price": {
|
|
1577
1577
|
"value": 0.027675
|
|
@@ -2107,7 +2107,7 @@ function getTemplatesPipelineCollection() {
|
|
|
2107
2107
|
"preparations": [
|
|
2108
2108
|
{
|
|
2109
2109
|
"id": 1,
|
|
2110
|
-
"promptbookVersion": "0.98.0-
|
|
2110
|
+
"promptbookVersion": "0.98.0-8",
|
|
2111
2111
|
"usage": {
|
|
2112
2112
|
"price": {
|
|
2113
2113
|
"value": 0.027675
|
|
@@ -2784,7 +2784,7 @@ function getTemplatesPipelineCollection() {
|
|
|
2784
2784
|
"preparations": [
|
|
2785
2785
|
{
|
|
2786
2786
|
"id": 1,
|
|
2787
|
-
"promptbookVersion": "0.98.0-
|
|
2787
|
+
"promptbookVersion": "0.98.0-8",
|
|
2788
2788
|
"usage": {
|
|
2789
2789
|
"price": {
|
|
2790
2790
|
"value": 0.026485
|
|
@@ -2926,7 +2926,7 @@ function getTemplatesPipelineCollection() {
|
|
|
2926
2926
|
"preparations": [
|
|
2927
2927
|
{
|
|
2928
2928
|
"id": 1,
|
|
2929
|
-
"promptbookVersion": "0.98.0-
|
|
2929
|
+
"promptbookVersion": "0.98.0-8",
|
|
2930
2930
|
"usage": {
|
|
2931
2931
|
"price": {
|
|
2932
2932
|
"value": 0.026710000000000005
|
|
@@ -3022,7 +3022,7 @@ function getTemplatesPipelineCollection() {
|
|
|
3022
3022
|
"preparations": [
|
|
3023
3023
|
{
|
|
3024
3024
|
"id": 1,
|
|
3025
|
-
"promptbookVersion": "0.98.0-
|
|
3025
|
+
"promptbookVersion": "0.98.0-8",
|
|
3026
3026
|
"usage": {
|
|
3027
3027
|
"price": {
|
|
3028
3028
|
"value": 0
|
|
@@ -3159,7 +3159,7 @@ function getTemplatesPipelineCollection() {
|
|
|
3159
3159
|
"preparations": [
|
|
3160
3160
|
{
|
|
3161
3161
|
"id": 1,
|
|
3162
|
-
"promptbookVersion": "0.98.0-
|
|
3162
|
+
"promptbookVersion": "0.98.0-8",
|
|
3163
3163
|
"usage": {
|
|
3164
3164
|
"price": {
|
|
3165
3165
|
"value": 0.026382500000000003
|
|
@@ -3303,7 +3303,7 @@ function getTemplatesPipelineCollection() {
|
|
|
3303
3303
|
"preparations": [
|
|
3304
3304
|
{
|
|
3305
3305
|
"id": 1,
|
|
3306
|
-
"promptbookVersion": "0.98.0-
|
|
3306
|
+
"promptbookVersion": "0.98.0-8",
|
|
3307
3307
|
"usage": {
|
|
3308
3308
|
"price": {
|
|
3309
3309
|
"value": 0.0253325
|
|
@@ -3630,7 +3630,7 @@ function getTemplatesPipelineCollection() {
|
|
|
3630
3630
|
"preparations": [
|
|
3631
3631
|
{
|
|
3632
3632
|
"id": 1,
|
|
3633
|
-
"promptbookVersion": "0.98.0-
|
|
3633
|
+
"promptbookVersion": "0.98.0-8",
|
|
3634
3634
|
"usage": {
|
|
3635
3635
|
"price": {
|
|
3636
3636
|
"value": 0.026247500000000003
|
|
@@ -3777,7 +3777,7 @@ function getTemplatesPipelineCollection() {
|
|
|
3777
3777
|
"preparations": [
|
|
3778
3778
|
{
|
|
3779
3779
|
"id": 1,
|
|
3780
|
-
"promptbookVersion": "0.98.0-
|
|
3780
|
+
"promptbookVersion": "0.98.0-8",
|
|
3781
3781
|
"usage": {
|
|
3782
3782
|
"price": {
|
|
3783
3783
|
"value": 0.026670000000000003
|
|
@@ -2,7 +2,7 @@ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
|
2
2
|
import { ANTHROPIC_CLAUDE_MODELS } from '../llm-providers/anthropic-claude/anthropic-claude-models';
|
|
3
3
|
import { AnthropicClaudeExecutionTools } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionTools';
|
|
4
4
|
import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
|
5
|
-
import type {
|
|
5
|
+
import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
|
6
6
|
import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
|
7
7
|
import { createAnthropicClaudeExecutionTools } from '../llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools';
|
|
8
8
|
import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
|
|
@@ -10,7 +10,7 @@ export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
|
10
10
|
export { ANTHROPIC_CLAUDE_MODELS };
|
|
11
11
|
export { AnthropicClaudeExecutionTools };
|
|
12
12
|
export type { AnthropicClaudeExecutionToolsOptions };
|
|
13
|
-
export type {
|
|
13
|
+
export type { AnthropicClaudeExecutionToolsNonProxiedOptions };
|
|
14
14
|
export type { AnthropicClaudeExecutionToolsProxiedOptions };
|
|
15
15
|
export { createAnthropicClaudeExecutionTools };
|
|
16
16
|
export { _AnthropicClaudeRegistration };
|
|
@@ -7,6 +7,8 @@ import { OpenAiAssistantExecutionTools } from '../llm-providers/openai/OpenAiAss
|
|
|
7
7
|
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
8
8
|
import { OpenAiCompatibleExecutionTools } from '../llm-providers/openai/OpenAiCompatibleExecutionTools';
|
|
9
9
|
import type { OpenAiCompatibleExecutionToolsOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
10
|
+
import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
11
|
+
import type { OpenAiCompatibleExecutionToolsProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
10
12
|
import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionTools';
|
|
11
13
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
12
14
|
import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
|
|
@@ -21,6 +23,8 @@ export { OpenAiAssistantExecutionTools };
|
|
|
21
23
|
export type { OpenAiAssistantExecutionToolsOptions };
|
|
22
24
|
export { OpenAiCompatibleExecutionTools };
|
|
23
25
|
export type { OpenAiCompatibleExecutionToolsOptions };
|
|
26
|
+
export type { OpenAiCompatibleExecutionToolsNonProxiedOptions };
|
|
27
|
+
export type { OpenAiCompatibleExecutionToolsProxiedOptions };
|
|
24
28
|
export { OpenAiExecutionTools };
|
|
25
29
|
export type { OpenAiExecutionToolsOptions };
|
|
26
30
|
export { _OpenAiRegistration };
|
|
@@ -61,6 +61,8 @@ import type { Usage } from '../execution/Usage';
|
|
|
61
61
|
import type { UsageCounts } from '../execution/Usage';
|
|
62
62
|
import type { UserInterfaceTools } from '../execution/UserInterfaceTools';
|
|
63
63
|
import type { UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
|
|
64
|
+
import type { ValidatePromptResultOptions } from '../execution/utils/validatePromptResult';
|
|
65
|
+
import type { ValidatePromptResultResult } from '../execution/utils/validatePromptResult';
|
|
64
66
|
import type { FormatSubvalueParser } from '../formats/_common/FormatSubvalueParser';
|
|
65
67
|
import type { FormatSubvalueParserMapValuesOptions } from '../formats/_common/FormatSubvalueParser';
|
|
66
68
|
import type { CsvSettings } from '../formats/csv/CsvSettings';
|
|
@@ -74,7 +76,7 @@ import type { CacheItem } from '../llm-providers/_common/utils/cache/CacheItem';
|
|
|
74
76
|
import type { CacheLlmToolsOptions } from '../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
|
|
75
77
|
import type { LlmExecutionToolsWithTotalUsage } from '../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
|
|
76
78
|
import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
|
77
|
-
import type {
|
|
79
|
+
import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
|
78
80
|
import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
|
|
79
81
|
import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
|
|
80
82
|
import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
|
|
@@ -82,6 +84,8 @@ import type { GoogleExecutionToolsOptions } from '../llm-providers/google/Google
|
|
|
82
84
|
import type { OllamaExecutionToolsOptions } from '../llm-providers/ollama/OllamaExecutionToolsOptions';
|
|
83
85
|
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
|
|
84
86
|
import type { OpenAiCompatibleExecutionToolsOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
87
|
+
import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
88
|
+
import type { OpenAiCompatibleExecutionToolsProxiedOptions } from '../llm-providers/openai/OpenAiCompatibleExecutionToolsOptions';
|
|
85
89
|
import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
|
|
86
90
|
import type { VercelExecutionToolsOptions } from '../llm-providers/vercel/VercelExecutionToolsOptions';
|
|
87
91
|
import type { VercelProvider } from '../llm-providers/vercel/VercelProvider';
|
|
@@ -361,6 +365,8 @@ export type { Usage };
|
|
|
361
365
|
export type { UsageCounts };
|
|
362
366
|
export type { UserInterfaceTools };
|
|
363
367
|
export type { UserInterfaceToolsPromptDialogOptions };
|
|
368
|
+
export type { ValidatePromptResultOptions };
|
|
369
|
+
export type { ValidatePromptResultResult };
|
|
364
370
|
export type { FormatSubvalueParser };
|
|
365
371
|
export type { FormatSubvalueParserMapValuesOptions };
|
|
366
372
|
export type { CsvSettings };
|
|
@@ -374,7 +380,7 @@ export type { CacheItem };
|
|
|
374
380
|
export type { CacheLlmToolsOptions };
|
|
375
381
|
export type { LlmExecutionToolsWithTotalUsage };
|
|
376
382
|
export type { AnthropicClaudeExecutionToolsOptions };
|
|
377
|
-
export type {
|
|
383
|
+
export type { AnthropicClaudeExecutionToolsNonProxiedOptions };
|
|
378
384
|
export type { AnthropicClaudeExecutionToolsProxiedOptions };
|
|
379
385
|
export type { AzureOpenAiExecutionToolsOptions };
|
|
380
386
|
export type { DeepseekExecutionToolsOptions };
|
|
@@ -382,6 +388,8 @@ export type { GoogleExecutionToolsOptions };
|
|
|
382
388
|
export type { OllamaExecutionToolsOptions };
|
|
383
389
|
export type { OpenAiAssistantExecutionToolsOptions };
|
|
384
390
|
export type { OpenAiCompatibleExecutionToolsOptions };
|
|
391
|
+
export type { OpenAiCompatibleExecutionToolsNonProxiedOptions };
|
|
392
|
+
export type { OpenAiCompatibleExecutionToolsProxiedOptions };
|
|
385
393
|
export type { OpenAiExecutionToolsOptions };
|
|
386
394
|
export type { VercelExecutionToolsOptions };
|
|
387
395
|
export type { VercelProvider };
|
|
@@ -176,7 +176,7 @@ export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
|
|
|
176
176
|
*
|
|
177
177
|
* @public exported from `@promptbook/core`
|
|
178
178
|
*/
|
|
179
|
-
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS =
|
|
179
|
+
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7;
|
|
180
180
|
/**
|
|
181
181
|
* The maximum depth to which knowledge sources will be scraped when building a knowledge base.
|
|
182
182
|
* This prevents infinite recursion and limits resource usage.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
|
|
2
|
+
import { ExpectError } from '../../errors/ExpectError';
|
|
3
|
+
import type { Expectations } from '../../pipeline/PipelineJson/Expectations';
|
|
4
|
+
import type { string_postprocessing_function_name } from '../../types/typeAliases';
|
|
5
|
+
/**
|
|
6
|
+
* Options for validating a prompt result
|
|
7
|
+
*/
|
|
8
|
+
export interface ValidatePromptResultOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The result string to validate
|
|
11
|
+
*/
|
|
12
|
+
resultString: string;
|
|
13
|
+
/**
|
|
14
|
+
* Expectations for the result (word count, sentence count, etc.)
|
|
15
|
+
*/
|
|
16
|
+
expectations?: Expectations;
|
|
17
|
+
/**
|
|
18
|
+
* Expected format of the result (e.g., 'JSON')
|
|
19
|
+
*/
|
|
20
|
+
format?: FormatCommand['format'];
|
|
21
|
+
/**
|
|
22
|
+
* List of postprocessing function names that should be applied
|
|
23
|
+
* Note: This is for validation purposes only - postprocessing should be done before calling this function
|
|
24
|
+
*/
|
|
25
|
+
postprocessingFunctionNames?: ReadonlyArray<string_postprocessing_function_name>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result of prompt result validation
|
|
29
|
+
*/
|
|
30
|
+
export interface ValidatePromptResultResult {
|
|
31
|
+
/**
|
|
32
|
+
* Whether the result is valid (passes all expectations and format checks)
|
|
33
|
+
*/
|
|
34
|
+
isValid: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The processed result string (may be modified if format extraction was needed)
|
|
37
|
+
*/
|
|
38
|
+
processedResultString: string;
|
|
39
|
+
/**
|
|
40
|
+
* Error that occurred during validation, if any
|
|
41
|
+
*/
|
|
42
|
+
error?: ExpectError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validates a prompt result against expectations and format requirements.
|
|
46
|
+
* This function provides a common abstraction for result validation that can be used
|
|
47
|
+
* by both execution logic and caching logic to ensure consistency.
|
|
48
|
+
*
|
|
49
|
+
* @param options - The validation options including result string, expectations, and format
|
|
50
|
+
* @returns Validation result with processed string and validity status
|
|
51
|
+
* @private internal function of `createPipelineExecutor` and `cacheLlmTools`
|
|
52
|
+
*/
|
|
53
|
+
export declare function validatePromptResult(options: ValidatePromptResultOptions): ValidatePromptResultResult;
|
|
@@ -7,7 +7,7 @@ import type { Prompt } from '../../types/Prompt';
|
|
|
7
7
|
import type { string_markdown } from '../../types/typeAliases';
|
|
8
8
|
import type { string_markdown_text } from '../../types/typeAliases';
|
|
9
9
|
import type { string_title } from '../../types/typeAliases';
|
|
10
|
-
import type {
|
|
10
|
+
import type { AnthropicClaudeExecutionToolsNonProxiedOptions } from './AnthropicClaudeExecutionToolsOptions';
|
|
11
11
|
/**
|
|
12
12
|
* Execution Tools for calling Anthropic Claude API.
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@ import type { AnthropicClaudeExecutionToolsDirectOptions } from './AnthropicClau
|
|
|
15
15
|
* @deprecated use `createAnthropicClaudeExecutionTools` instead
|
|
16
16
|
*/
|
|
17
17
|
export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools {
|
|
18
|
-
protected readonly options:
|
|
18
|
+
protected readonly options: AnthropicClaudeExecutionToolsNonProxiedOptions;
|
|
19
19
|
/**
|
|
20
20
|
* Anthropic Claude API client.
|
|
21
21
|
*/
|
|
@@ -26,7 +26,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
26
26
|
*
|
|
27
27
|
* @param options which are relevant are directly passed to the Anthropic Claude client
|
|
28
28
|
*/
|
|
29
|
-
constructor(options?:
|
|
29
|
+
constructor(options?: AnthropicClaudeExecutionToolsNonProxiedOptions);
|
|
30
30
|
get title(): string_title & string_markdown_text;
|
|
31
31
|
get description(): string_markdown;
|
|
32
32
|
getClient(): Promise<Anthropic>;
|
package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ import type { RemoteClientOptions } from '../../remote-server/types/RemoteClient
|
|
|
7
7
|
* This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
|
|
8
8
|
* @public exported from `@promptbook/anthropic-claude`
|
|
9
9
|
*/
|
|
10
|
-
export type AnthropicClaudeExecutionToolsOptions =
|
|
10
|
+
export type AnthropicClaudeExecutionToolsOptions = AnthropicClaudeExecutionToolsNonProxiedOptions | AnthropicClaudeExecutionToolsProxiedOptions;
|
|
11
11
|
/**
|
|
12
12
|
* Options for directly used `AnthropicClaudeExecutionTools`
|
|
13
13
|
*
|
|
14
14
|
* This extends Anthropic's `ClientOptions` with are directly passed to the Anthropic client.
|
|
15
15
|
* @public exported from `@promptbook/anthropic-claude`
|
|
16
16
|
*/
|
|
17
|
-
export type
|
|
17
|
+
export type AnthropicClaudeExecutionToolsNonProxiedOptions = CommonToolsOptions & ClientOptions & {
|
|
18
18
|
isProxied?: false;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -11,14 +11,14 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
11
11
|
import type { string_model_name } from '../../types/typeAliases';
|
|
12
12
|
import type { string_title } from '../../types/typeAliases';
|
|
13
13
|
import { computeOpenAiUsage } from './computeOpenAiUsage';
|
|
14
|
-
import type {
|
|
14
|
+
import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
15
15
|
/**
|
|
16
|
-
* Execution Tools for calling OpenAI API or other
|
|
16
|
+
* Execution Tools for calling OpenAI API or other OpenAI compatible provider
|
|
17
17
|
*
|
|
18
18
|
* @public exported from `@promptbook/openai`
|
|
19
19
|
*/
|
|
20
20
|
export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecutionTools {
|
|
21
|
-
protected readonly options:
|
|
21
|
+
protected readonly options: OpenAiCompatibleExecutionToolsNonProxiedOptions;
|
|
22
22
|
/**
|
|
23
23
|
* OpenAI API client.
|
|
24
24
|
*/
|
|
@@ -32,7 +32,7 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
32
32
|
*
|
|
33
33
|
* @param options which are relevant are directly passed to the OpenAI compatible client
|
|
34
34
|
*/
|
|
35
|
-
constructor(options:
|
|
35
|
+
constructor(options: OpenAiCompatibleExecutionToolsNonProxiedOptions);
|
|
36
36
|
abstract get title(): string_title & string_markdown_text;
|
|
37
37
|
abstract get description(): string_markdown;
|
|
38
38
|
getClient(): Promise<OpenAI>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClientOptions } from 'openai';
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
|
+
import type { RemoteClientOptions } from '../../remote-server/types/RemoteClientOptions';
|
|
3
4
|
/**
|
|
4
5
|
* Options for `createOpenAiCompatibleExecutionTools` and `OpenAiCompatibleExecutionTools`
|
|
5
6
|
*
|
|
@@ -8,4 +9,44 @@ import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
|
8
9
|
*
|
|
9
10
|
* @public exported from `@promptbook/openai`
|
|
10
11
|
*/
|
|
11
|
-
export type OpenAiCompatibleExecutionToolsOptions =
|
|
12
|
+
export type OpenAiCompatibleExecutionToolsOptions = OpenAiCompatibleExecutionToolsNonProxiedOptions | OpenAiCompatibleExecutionToolsProxiedOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Options for directly used `OpenAiCompatibleExecutionTools`
|
|
15
|
+
*
|
|
16
|
+
* This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
|
|
17
|
+
* @public exported from `@promptbook/openai`
|
|
18
|
+
*/
|
|
19
|
+
export type OpenAiCompatibleExecutionToolsNonProxiedOptions = CommonToolsOptions & ClientOptions & {
|
|
20
|
+
/**
|
|
21
|
+
* Base URL for the OpenAI-compatible API endpoint
|
|
22
|
+
*
|
|
23
|
+
* This allows connecting to any OpenAI-compatible LLM service by specifying their API endpoint.
|
|
24
|
+
*
|
|
25
|
+
* @example 'https://https://promptbook.s5.ptbk.io/' (Promptbook)
|
|
26
|
+
* @example 'https://api.openai.com/v1' (OpenAI)
|
|
27
|
+
* @example 'http://localhost:11434/v1' (Ollama)
|
|
28
|
+
* @example 'https://api.deepseek.com/v1' (DeepSeek)
|
|
29
|
+
*/
|
|
30
|
+
baseURL?: string;
|
|
31
|
+
isProxied?: false;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Options for proxied `OpenAiCompatibleExecutionTools`
|
|
35
|
+
*
|
|
36
|
+
* This extends OpenAI's `ClientOptions` with are directly passed to the OpenAI client.
|
|
37
|
+
* @public exported from `@promptbook/openai`
|
|
38
|
+
*/
|
|
39
|
+
export type OpenAiCompatibleExecutionToolsProxiedOptions = CommonToolsOptions & ClientOptions & {
|
|
40
|
+
/**
|
|
41
|
+
* Base URL for the OpenAI-compatible API endpoint
|
|
42
|
+
*
|
|
43
|
+
* This allows connecting to any OpenAI-compatible LLM service by specifying their API endpoint.
|
|
44
|
+
*
|
|
45
|
+
* @example 'https://https://promptbook.s5.ptbk.io/' (Promptbook)
|
|
46
|
+
* @example 'https://api.openai.com/v1' (OpenAI)
|
|
47
|
+
* @example 'http://localhost:11434/v1' (Ollama)
|
|
48
|
+
* @example 'https://api.deepseek.com/v1' (DeepSeek)
|
|
49
|
+
*/
|
|
50
|
+
baseURL?: string;
|
|
51
|
+
isProxied: true;
|
|
52
|
+
} & Pick<RemoteClientOptions<undefined>, 'remoteServerUrl'>;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import type { AvailableModel } from '../../execution/AvailableModel';
|
|
2
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
|
+
import type { Usage } from '../../execution/Usage';
|
|
4
|
+
import type { string_markdown } from '../../types/typeAliases';
|
|
5
|
+
import type { string_markdown_text } from '../../types/typeAliases';
|
|
6
|
+
import type { string_model_name } from '../../types/typeAliases';
|
|
7
|
+
import type { string_title } from '../../types/typeAliases';
|
|
8
|
+
import { RemoteLlmExecutionTools } from '../remote/RemoteLlmExecutionTools';
|
|
9
|
+
import { computeOpenAiUsage } from './computeOpenAiUsage';
|
|
1
10
|
import { OpenAiCompatibleExecutionTools } from './OpenAiCompatibleExecutionTools';
|
|
11
|
+
import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
2
12
|
import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleExecutionToolsOptions';
|
|
3
13
|
/**
|
|
4
14
|
* Execution Tools for calling OpenAI compatible API
|
|
@@ -7,10 +17,57 @@ import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleEx
|
|
|
7
17
|
*
|
|
8
18
|
* @public exported from `@promptbook/openai`
|
|
9
19
|
*/
|
|
10
|
-
export declare const createOpenAiCompatibleExecutionTools: ((options: OpenAiCompatibleExecutionToolsOptions
|
|
20
|
+
export declare const createOpenAiCompatibleExecutionTools: ((options: OpenAiCompatibleExecutionToolsOptions & {
|
|
21
|
+
/**
|
|
22
|
+
* The model name to use for all operations
|
|
23
|
+
*
|
|
24
|
+
* This will be the only model available through this LLM provider and it will be a chat model.
|
|
25
|
+
* Other variants won't be available for now.
|
|
26
|
+
*/
|
|
27
|
+
defaultModelName: string_model_name;
|
|
28
|
+
}) => OpenAiCompatibleExecutionTools | RemoteLlmExecutionTools) & {
|
|
11
29
|
packageName: string;
|
|
12
30
|
className: string;
|
|
13
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Execution Tools for calling ONE SPECIFIC PRECONFIGURED OpenAI compatible provider
|
|
34
|
+
*
|
|
35
|
+
* @private for `createOpenAiCompatibleExecutionTools`
|
|
36
|
+
*/
|
|
37
|
+
export declare class HardcodedOpenAiCompatibleExecutionTools extends OpenAiCompatibleExecutionTools implements LlmExecutionTools {
|
|
38
|
+
private readonly defaultModelName;
|
|
39
|
+
protected readonly options: OpenAiCompatibleExecutionToolsNonProxiedOptions;
|
|
40
|
+
/**
|
|
41
|
+
* Creates OpenAI compatible Execution Tools.
|
|
42
|
+
*
|
|
43
|
+
* @param options which are relevant are directly passed to the OpenAI compatible client
|
|
44
|
+
*/
|
|
45
|
+
constructor(defaultModelName: string_model_name, options: OpenAiCompatibleExecutionToolsNonProxiedOptions);
|
|
46
|
+
get title(): string_title & string_markdown_text;
|
|
47
|
+
get description(): string_markdown;
|
|
48
|
+
/**
|
|
49
|
+
* List all available models (non dynamically)
|
|
50
|
+
*
|
|
51
|
+
* Note: Purpose of this is to provide more information about models than standard listing from API
|
|
52
|
+
*/
|
|
53
|
+
protected get HARDCODED_MODELS(): ReadonlyArray<AvailableModel>;
|
|
54
|
+
/**
|
|
55
|
+
* Computes the usage
|
|
56
|
+
*/
|
|
57
|
+
protected computeUsage(...args: Parameters<typeof computeOpenAiUsage>): Usage;
|
|
58
|
+
/**
|
|
59
|
+
* Default model for chat variant.
|
|
60
|
+
*/
|
|
61
|
+
protected getDefaultChatModel(): AvailableModel;
|
|
62
|
+
/**
|
|
63
|
+
* Default model for completion variant.
|
|
64
|
+
*/
|
|
65
|
+
protected getDefaultCompletionModel(): AvailableModel;
|
|
66
|
+
/**
|
|
67
|
+
* Default model for completion variant.
|
|
68
|
+
*/
|
|
69
|
+
protected getDefaultEmbeddingModel(): AvailableModel;
|
|
70
|
+
}
|
|
14
71
|
/**
|
|
15
72
|
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
16
73
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.98.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.98.0-8`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/templates",
|
|
3
|
-
"version": "0.98.0-
|
|
3
|
+
"version": "0.98.0-9",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"module": "./esm/index.es.js",
|
|
75
75
|
"typings": "./esm/typings/src/_packages/templates.index.d.ts",
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@promptbook/core": "0.98.0-
|
|
77
|
+
"@promptbook/core": "0.98.0-9"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"prettier": "2.8.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-9';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1578,7 +1578,7 @@
|
|
|
1578
1578
|
"preparations": [
|
|
1579
1579
|
{
|
|
1580
1580
|
"id": 1,
|
|
1581
|
-
"promptbookVersion": "0.98.0-
|
|
1581
|
+
"promptbookVersion": "0.98.0-8",
|
|
1582
1582
|
"usage": {
|
|
1583
1583
|
"price": {
|
|
1584
1584
|
"value": 0.027675
|
|
@@ -2114,7 +2114,7 @@
|
|
|
2114
2114
|
"preparations": [
|
|
2115
2115
|
{
|
|
2116
2116
|
"id": 1,
|
|
2117
|
-
"promptbookVersion": "0.98.0-
|
|
2117
|
+
"promptbookVersion": "0.98.0-8",
|
|
2118
2118
|
"usage": {
|
|
2119
2119
|
"price": {
|
|
2120
2120
|
"value": 0.027675
|
|
@@ -2791,7 +2791,7 @@
|
|
|
2791
2791
|
"preparations": [
|
|
2792
2792
|
{
|
|
2793
2793
|
"id": 1,
|
|
2794
|
-
"promptbookVersion": "0.98.0-
|
|
2794
|
+
"promptbookVersion": "0.98.0-8",
|
|
2795
2795
|
"usage": {
|
|
2796
2796
|
"price": {
|
|
2797
2797
|
"value": 0.026485
|
|
@@ -2933,7 +2933,7 @@
|
|
|
2933
2933
|
"preparations": [
|
|
2934
2934
|
{
|
|
2935
2935
|
"id": 1,
|
|
2936
|
-
"promptbookVersion": "0.98.0-
|
|
2936
|
+
"promptbookVersion": "0.98.0-8",
|
|
2937
2937
|
"usage": {
|
|
2938
2938
|
"price": {
|
|
2939
2939
|
"value": 0.026710000000000005
|
|
@@ -3029,7 +3029,7 @@
|
|
|
3029
3029
|
"preparations": [
|
|
3030
3030
|
{
|
|
3031
3031
|
"id": 1,
|
|
3032
|
-
"promptbookVersion": "0.98.0-
|
|
3032
|
+
"promptbookVersion": "0.98.0-8",
|
|
3033
3033
|
"usage": {
|
|
3034
3034
|
"price": {
|
|
3035
3035
|
"value": 0
|
|
@@ -3166,7 +3166,7 @@
|
|
|
3166
3166
|
"preparations": [
|
|
3167
3167
|
{
|
|
3168
3168
|
"id": 1,
|
|
3169
|
-
"promptbookVersion": "0.98.0-
|
|
3169
|
+
"promptbookVersion": "0.98.0-8",
|
|
3170
3170
|
"usage": {
|
|
3171
3171
|
"price": {
|
|
3172
3172
|
"value": 0.026382500000000003
|
|
@@ -3310,7 +3310,7 @@
|
|
|
3310
3310
|
"preparations": [
|
|
3311
3311
|
{
|
|
3312
3312
|
"id": 1,
|
|
3313
|
-
"promptbookVersion": "0.98.0-
|
|
3313
|
+
"promptbookVersion": "0.98.0-8",
|
|
3314
3314
|
"usage": {
|
|
3315
3315
|
"price": {
|
|
3316
3316
|
"value": 0.0253325
|
|
@@ -3637,7 +3637,7 @@
|
|
|
3637
3637
|
"preparations": [
|
|
3638
3638
|
{
|
|
3639
3639
|
"id": 1,
|
|
3640
|
-
"promptbookVersion": "0.98.0-
|
|
3640
|
+
"promptbookVersion": "0.98.0-8",
|
|
3641
3641
|
"usage": {
|
|
3642
3642
|
"price": {
|
|
3643
3643
|
"value": 0.026247500000000003
|
|
@@ -3784,7 +3784,7 @@
|
|
|
3784
3784
|
"preparations": [
|
|
3785
3785
|
{
|
|
3786
3786
|
"id": 1,
|
|
3787
|
-
"promptbookVersion": "0.98.0-
|
|
3787
|
+
"promptbookVersion": "0.98.0-8",
|
|
3788
3788
|
"usage": {
|
|
3789
3789
|
"price": {
|
|
3790
3790
|
"value": 0.026670000000000003
|