@promptbook/cli 0.89.0-31 → 0.89.0-33
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 +99 -16
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +9 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.test.d.ts +1 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +3 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +9 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.test.d.ts +1 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/Identification.d.ts +7 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +7 -0
- package/package.json +1 -1
- package/umd/index.umd.js +99 -16
- package/umd/index.umd.js.map +1 -1
|
@@ -210,6 +210,7 @@ import type { string_uri_part } from '../types/typeAliases';
|
|
|
210
210
|
import type { string_hostname } from '../types/typeAliases';
|
|
211
211
|
import type { string_host } from '../types/typeAliases';
|
|
212
212
|
import type { string_protocol } from '../types/typeAliases';
|
|
213
|
+
import type { string_ip_address } from '../types/typeAliases';
|
|
213
214
|
import type { string_email } from '../types/typeAliases';
|
|
214
215
|
import type { string_emails } from '../types/typeAliases';
|
|
215
216
|
import type { string_uuid } from '../types/typeAliases';
|
|
@@ -505,6 +506,7 @@ export type { string_uri_part };
|
|
|
505
506
|
export type { string_hostname };
|
|
506
507
|
export type { string_host };
|
|
507
508
|
export type { string_protocol };
|
|
509
|
+
export type { string_ip_address };
|
|
508
510
|
export type { string_email };
|
|
509
511
|
export type { string_emails };
|
|
510
512
|
export type { string_uuid };
|
|
@@ -5,7 +5,9 @@ import { renderPromptbookMermaid } from '../conversion/prettify/renderPipelineMe
|
|
|
5
5
|
import { deserializeError } from '../errors/utils/deserializeError';
|
|
6
6
|
import { serializeError } from '../errors/utils/serializeError';
|
|
7
7
|
import { forEachAsync } from '../execution/utils/forEachAsync';
|
|
8
|
+
import { isValidCsvString } from '../formats/csv/utils/isValidCsvString';
|
|
8
9
|
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
|
|
10
|
+
import { isValidXmlString } from '../formats/xml/utils/isValidXmlString';
|
|
9
11
|
import { prompt } from '../pipeline/prompt-notation';
|
|
10
12
|
import { promptTemplate } from '../pipeline/prompt-notation';
|
|
11
13
|
import { $getCurrentDate } from '../utils/$getCurrentDate';
|
|
@@ -87,7 +89,9 @@ export { renderPromptbookMermaid };
|
|
|
87
89
|
export { deserializeError };
|
|
88
90
|
export { serializeError };
|
|
89
91
|
export { forEachAsync };
|
|
92
|
+
export { isValidCsvString };
|
|
90
93
|
export { isValidJsonString };
|
|
94
|
+
export { isValidXmlString };
|
|
91
95
|
export { prompt };
|
|
92
96
|
export { promptTemplate };
|
|
93
97
|
export { $getCurrentDate };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to check if a string is valid CSV
|
|
3
|
+
*
|
|
4
|
+
* @param value The string to check
|
|
5
|
+
* @returns True if the string is a valid CSV string, false otherwise
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/utils`
|
|
8
|
+
*/
|
|
9
|
+
export declare function isValidCsvString(value: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
3
3
|
*
|
|
4
|
+
* @param value The string to check
|
|
5
|
+
* @returns True if the string is a valid JSON string, false otherwise
|
|
6
|
+
*
|
|
4
7
|
* @public exported from `@promptbook/utils`
|
|
5
8
|
*/
|
|
6
9
|
export declare function isValidJsonString(value: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to check if a string is valid XML
|
|
3
|
+
*
|
|
4
|
+
* @param value
|
|
5
|
+
* @returns True if the string is a valid XML string, false otherwise
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/utils`
|
|
8
|
+
*/
|
|
9
|
+
export declare function isValidXmlString(value: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LlmToolsConfiguration } from '../../../llm-providers/_common/register/LlmToolsConfiguration';
|
|
2
|
+
import type { string_ip_address } from '../../../types/typeAliases';
|
|
2
3
|
import type { string_user_id } from '../../../types/typeAliases';
|
|
3
4
|
import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteServerOptions';
|
|
4
5
|
/**
|
|
@@ -7,7 +8,12 @@ import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteSer
|
|
|
7
8
|
* @public exported from `@promptbook/remote-server`
|
|
8
9
|
* @public exported from `@promptbook/remote-client`
|
|
9
10
|
*/
|
|
10
|
-
export type Identification<TCustomOptions> = ApplicationModeIdentification<TCustomOptions> | AnonymousModeIdentification
|
|
11
|
+
export type Identification<TCustomOptions> = (ApplicationModeIdentification<TCustomOptions> | AnonymousModeIdentification) & {
|
|
12
|
+
/**
|
|
13
|
+
* Identifier of the IP address of the client
|
|
14
|
+
*/
|
|
15
|
+
readonly ipAddress?: string_ip_address;
|
|
16
|
+
};
|
|
11
17
|
/**
|
|
12
18
|
* Application mode is situation when you run known and well-defined books with your own api keys
|
|
13
19
|
*
|
|
@@ -8,6 +8,7 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
|
8
8
|
import type { string_app_id } from '../../types/typeAliases';
|
|
9
9
|
import type { string_email } from '../../types/typeAliases';
|
|
10
10
|
import type { string_password } from '../../types/typeAliases';
|
|
11
|
+
import type { string_token } from '../../types/typeAliases';
|
|
11
12
|
import type { string_user_id } from '../../types/typeAliases';
|
|
12
13
|
import type { ApplicationModeIdentification } from '../socket-types/_subtypes/Identification';
|
|
13
14
|
import type { Identification } from '../socket-types/_subtypes/Identification';
|
|
@@ -101,7 +102,7 @@ export type ApplicationRemoteServerClientOptions<TCustomOptions> = {
|
|
|
101
102
|
*
|
|
102
103
|
* Note: This is passed for example to `createLlmExecutionTools`
|
|
103
104
|
*/
|
|
104
|
-
readonly userToken?:
|
|
105
|
+
readonly userToken?: string_token;
|
|
105
106
|
/**
|
|
106
107
|
* Additional arbitrary options to identify the client or to pass custom metadata
|
|
107
108
|
*/
|
|
@@ -414,6 +414,13 @@ export type string_host = string;
|
|
|
414
414
|
* Semantic helper
|
|
415
415
|
*/
|
|
416
416
|
export type string_protocol = 'http:' | 'https:';
|
|
417
|
+
/**
|
|
418
|
+
* Semantic helper
|
|
419
|
+
*
|
|
420
|
+
* For example `"192.168.1.1"` (IPv4)
|
|
421
|
+
* For example `"2001:0db8:85a3:0000:0000:8a2e:0370:7334"` (IPv6)
|
|
422
|
+
*/
|
|
423
|
+
export type string_ip_address = string;
|
|
417
424
|
/**
|
|
418
425
|
* Semantic helper
|
|
419
426
|
*
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @generated
|
|
57
57
|
* @see https://github.com/webgptorg/promptbook
|
|
58
58
|
*/
|
|
59
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
59
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-33';
|
|
60
60
|
/**
|
|
61
61
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
62
62
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4476,6 +4476,9 @@
|
|
|
4476
4476
|
/**
|
|
4477
4477
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
4478
4478
|
*
|
|
4479
|
+
* @param value The string to check
|
|
4480
|
+
* @returns True if the string is a valid JSON string, false otherwise
|
|
4481
|
+
*
|
|
4479
4482
|
* @public exported from `@promptbook/utils`
|
|
4480
4483
|
*/
|
|
4481
4484
|
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
@@ -5360,6 +5363,28 @@
|
|
|
5360
5363
|
// encoding: 'utf-8',
|
|
5361
5364
|
});
|
|
5362
5365
|
|
|
5366
|
+
/**
|
|
5367
|
+
* Function to check if a string is valid CSV
|
|
5368
|
+
*
|
|
5369
|
+
* @param value The string to check
|
|
5370
|
+
* @returns True if the string is a valid CSV string, false otherwise
|
|
5371
|
+
*
|
|
5372
|
+
* @public exported from `@promptbook/utils`
|
|
5373
|
+
*/
|
|
5374
|
+
function isValidCsvString(value) {
|
|
5375
|
+
try {
|
|
5376
|
+
// A simple check for CSV format: at least one comma and no invalid characters
|
|
5377
|
+
if (value.includes(',') && /^[\w\s,"']+$/.test(value)) {
|
|
5378
|
+
return true;
|
|
5379
|
+
}
|
|
5380
|
+
return false;
|
|
5381
|
+
}
|
|
5382
|
+
catch (error) {
|
|
5383
|
+
assertsError(error);
|
|
5384
|
+
return false;
|
|
5385
|
+
}
|
|
5386
|
+
}
|
|
5387
|
+
|
|
5363
5388
|
/**
|
|
5364
5389
|
* Definition for CSV spreadsheet
|
|
5365
5390
|
*
|
|
@@ -5370,7 +5395,7 @@
|
|
|
5370
5395
|
formatName: 'CSV',
|
|
5371
5396
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
5372
5397
|
isValid(value, settings, schema) {
|
|
5373
|
-
return
|
|
5398
|
+
return isValidCsvString(value);
|
|
5374
5399
|
},
|
|
5375
5400
|
canBeValid(partialValue, settings, schema) {
|
|
5376
5401
|
return true;
|
|
@@ -5524,6 +5549,30 @@
|
|
|
5524
5549
|
* TODO: [🏢] Allow to expect something inside each item of list and other formats
|
|
5525
5550
|
*/
|
|
5526
5551
|
|
|
5552
|
+
/**
|
|
5553
|
+
* Function to check if a string is valid XML
|
|
5554
|
+
*
|
|
5555
|
+
* @param value
|
|
5556
|
+
* @returns True if the string is a valid XML string, false otherwise
|
|
5557
|
+
*
|
|
5558
|
+
* @public exported from `@promptbook/utils`
|
|
5559
|
+
*/
|
|
5560
|
+
function isValidXmlString(value) {
|
|
5561
|
+
try {
|
|
5562
|
+
const parser = new DOMParser();
|
|
5563
|
+
const parsedDocument = parser.parseFromString(value, 'application/xml');
|
|
5564
|
+
const parserError = parsedDocument.getElementsByTagName('parsererror');
|
|
5565
|
+
if (parserError.length > 0) {
|
|
5566
|
+
return false;
|
|
5567
|
+
}
|
|
5568
|
+
return true;
|
|
5569
|
+
}
|
|
5570
|
+
catch (error) {
|
|
5571
|
+
assertsError(error);
|
|
5572
|
+
return false;
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
|
|
5527
5576
|
/**
|
|
5528
5577
|
* Definition for XML format
|
|
5529
5578
|
*
|
|
@@ -5533,7 +5582,7 @@
|
|
|
5533
5582
|
formatName: 'XML',
|
|
5534
5583
|
mimeType: 'application/xml',
|
|
5535
5584
|
isValid(value, settings, schema) {
|
|
5536
|
-
return
|
|
5585
|
+
return isValidXmlString(value);
|
|
5537
5586
|
},
|
|
5538
5587
|
canBeValid(partialValue, settings, schema) {
|
|
5539
5588
|
return true;
|
|
@@ -13350,13 +13399,7 @@
|
|
|
13350
13399
|
}
|
|
13351
13400
|
else if (isAnonymous === false && createLlmExecutionTools !== null) {
|
|
13352
13401
|
// Note: Application mode
|
|
13353
|
-
|
|
13354
|
-
llm = await createLlmExecutionTools({
|
|
13355
|
-
isAnonymous: false,
|
|
13356
|
-
appId,
|
|
13357
|
-
userId,
|
|
13358
|
-
customOptions,
|
|
13359
|
-
});
|
|
13402
|
+
llm = await createLlmExecutionTools(identification);
|
|
13360
13403
|
}
|
|
13361
13404
|
else {
|
|
13362
13405
|
throw new PipelineExecutionError(`You must provide either llmToolsConfiguration or non-anonymous mode must be propperly configured`);
|
|
@@ -14193,7 +14236,25 @@
|
|
|
14193
14236
|
output: computeUsage(`$2.40 / 1M tokens`),
|
|
14194
14237
|
},
|
|
14195
14238
|
},
|
|
14196
|
-
|
|
14239
|
+
{
|
|
14240
|
+
modelVariant: 'CHAT',
|
|
14241
|
+
modelTitle: 'Claude 3.7 Sonnet',
|
|
14242
|
+
modelName: 'claude-3-7-sonnet-20250219',
|
|
14243
|
+
pricing: {
|
|
14244
|
+
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
14245
|
+
output: computeUsage(`$15.00 / 1M tokens`),
|
|
14246
|
+
},
|
|
14247
|
+
},
|
|
14248
|
+
{
|
|
14249
|
+
modelVariant: 'CHAT',
|
|
14250
|
+
modelTitle: 'Claude 3.5 Haiku',
|
|
14251
|
+
modelName: 'claude-3-5-haiku-20241022',
|
|
14252
|
+
pricing: {
|
|
14253
|
+
prompt: computeUsage(`$0.25 / 1M tokens`),
|
|
14254
|
+
output: computeUsage(`$1.25 / 1M tokens`),
|
|
14255
|
+
},
|
|
14256
|
+
},
|
|
14257
|
+
// <- [🕕]
|
|
14197
14258
|
],
|
|
14198
14259
|
});
|
|
14199
14260
|
/**
|
|
@@ -14958,7 +15019,6 @@
|
|
|
14958
15019
|
prompt: computeUsage(`$5.00 / 1M tokens`),
|
|
14959
15020
|
output: computeUsage(`$15.00 / 1M tokens`),
|
|
14960
15021
|
},
|
|
14961
|
-
//TODO: [main] !!3 Add gpt-4o-mini-2024-07-18 and all others to be up to date
|
|
14962
15022
|
},
|
|
14963
15023
|
/**/
|
|
14964
15024
|
/**/
|
|
@@ -14973,6 +15033,17 @@
|
|
|
14973
15033
|
},
|
|
14974
15034
|
/**/
|
|
14975
15035
|
/**/
|
|
15036
|
+
{
|
|
15037
|
+
modelVariant: 'CHAT',
|
|
15038
|
+
modelTitle: 'gpt-4o-mini',
|
|
15039
|
+
modelName: 'gpt-4o-mini',
|
|
15040
|
+
pricing: {
|
|
15041
|
+
prompt: computeUsage(`$3.00 / 1M tokens`),
|
|
15042
|
+
output: computeUsage(`$9.00 / 1M tokens`),
|
|
15043
|
+
},
|
|
15044
|
+
},
|
|
15045
|
+
/**/
|
|
15046
|
+
/**/
|
|
14976
15047
|
{
|
|
14977
15048
|
modelVariant: 'CHAT',
|
|
14978
15049
|
modelTitle: 'o1-preview',
|
|
@@ -15052,6 +15123,7 @@
|
|
|
15052
15123
|
},
|
|
15053
15124
|
},
|
|
15054
15125
|
/**/
|
|
15126
|
+
// <- [🕕]
|
|
15055
15127
|
],
|
|
15056
15128
|
});
|
|
15057
15129
|
/**
|
|
@@ -15620,11 +15692,17 @@
|
|
|
15620
15692
|
description: 'Implementation of Deepseek models',
|
|
15621
15693
|
vercelProvider: deepseekVercelProvider,
|
|
15622
15694
|
availableModels: [
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15695
|
+
{
|
|
15696
|
+
modelName: 'deepseek-chat',
|
|
15697
|
+
modelVariant: 'CHAT',
|
|
15698
|
+
},
|
|
15699
|
+
{
|
|
15700
|
+
modelName: 'deepseek-reasoner',
|
|
15701
|
+
modelVariant: 'CHAT',
|
|
15702
|
+
},
|
|
15703
|
+
// <- [🕕]
|
|
15626
15704
|
// <- TODO: How picking of the default model looks like in `createExecutionToolsFromVercelProvider`
|
|
15627
|
-
]
|
|
15705
|
+
],
|
|
15628
15706
|
...options,
|
|
15629
15707
|
});
|
|
15630
15708
|
}, {
|
|
@@ -15722,6 +15800,10 @@
|
|
|
15722
15800
|
vercelProvider: googleGeminiVercelProvider,
|
|
15723
15801
|
availableModels: [
|
|
15724
15802
|
// TODO: [🕘] Maybe list models in same way as in other providers - in separate file with metadata
|
|
15803
|
+
'gemini-2.5-pro-preview-03-25',
|
|
15804
|
+
'gemini-2.0-flash',
|
|
15805
|
+
'gemini-2.0-flash-lite',
|
|
15806
|
+
'gemini-2.0-flash-thinking-exp-01-21',
|
|
15725
15807
|
'gemini-1.5-flash',
|
|
15726
15808
|
'gemini-1.5-flash-latest',
|
|
15727
15809
|
'gemini-1.5-flash-001',
|
|
@@ -15737,6 +15819,7 @@
|
|
|
15737
15819
|
'gemini-1.5-pro-002',
|
|
15738
15820
|
'gemini-1.5-pro-exp-0827',
|
|
15739
15821
|
'gemini-1.0-pro',
|
|
15822
|
+
// <- [🕕]
|
|
15740
15823
|
].map((modelName) => ({ modelName, modelVariant: 'CHAT' })),
|
|
15741
15824
|
...options,
|
|
15742
15825
|
});
|