@promptbook/cli 0.89.0-30 → 0.89.0-32

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 CHANGED
@@ -46,7 +46,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
46
46
  * @generated
47
47
  * @see https://github.com/webgptorg/promptbook
48
48
  */
49
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-30';
49
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-32';
50
50
  /**
51
51
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
52
52
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4466,6 +4466,9 @@ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"
4466
4466
  /**
4467
4467
  * Function isValidJsonString will tell you if the string is valid JSON or not
4468
4468
  *
4469
+ * @param value The string to check
4470
+ * @returns True if the string is a valid JSON string, false otherwise
4471
+ *
4469
4472
  * @public exported from `@promptbook/utils`
4470
4473
  */
4471
4474
  function isValidJsonString(value /* <- [👨‍⚖️] */) {
@@ -5350,6 +5353,28 @@ const MANDATORY_CSV_SETTINGS = Object.freeze({
5350
5353
  // encoding: 'utf-8',
5351
5354
  });
5352
5355
 
5356
+ /**
5357
+ * Function to check if a string is valid CSV
5358
+ *
5359
+ * @param value The string to check
5360
+ * @returns True if the string is a valid CSV string, false otherwise
5361
+ *
5362
+ * @public exported from `@promptbook/utils`
5363
+ */
5364
+ function isValidCsvString(value) {
5365
+ try {
5366
+ // A simple check for CSV format: at least one comma and no invalid characters
5367
+ if (value.includes(',') && /^[\w\s,"']+$/.test(value)) {
5368
+ return true;
5369
+ }
5370
+ return false;
5371
+ }
5372
+ catch (error) {
5373
+ assertsError(error);
5374
+ return false;
5375
+ }
5376
+ }
5377
+
5353
5378
  /**
5354
5379
  * Definition for CSV spreadsheet
5355
5380
  *
@@ -5360,7 +5385,7 @@ const CsvFormatDefinition = {
5360
5385
  formatName: 'CSV',
5361
5386
  aliases: ['SPREADSHEET', 'TABLE'],
5362
5387
  isValid(value, settings, schema) {
5363
- return true;
5388
+ return isValidCsvString(value);
5364
5389
  },
5365
5390
  canBeValid(partialValue, settings, schema) {
5366
5391
  return true;
@@ -5514,6 +5539,30 @@ const TextFormatDefinition = {
5514
5539
  * TODO: [🏢] Allow to expect something inside each item of list and other formats
5515
5540
  */
5516
5541
 
5542
+ /**
5543
+ * Function to check if a string is valid XML
5544
+ *
5545
+ * @param value
5546
+ * @returns True if the string is a valid XML string, false otherwise
5547
+ *
5548
+ * @public exported from `@promptbook/utils`
5549
+ */
5550
+ function isValidXmlString(value) {
5551
+ try {
5552
+ const parser = new DOMParser();
5553
+ const parsedDocument = parser.parseFromString(value, 'application/xml');
5554
+ const parserError = parsedDocument.getElementsByTagName('parsererror');
5555
+ if (parserError.length > 0) {
5556
+ return false;
5557
+ }
5558
+ return true;
5559
+ }
5560
+ catch (error) {
5561
+ assertsError(error);
5562
+ return false;
5563
+ }
5564
+ }
5565
+
5517
5566
  /**
5518
5567
  * Definition for XML format
5519
5568
  *
@@ -5523,7 +5572,7 @@ const XmlFormatDefinition = {
5523
5572
  formatName: 'XML',
5524
5573
  mimeType: 'application/xml',
5525
5574
  isValid(value, settings, schema) {
5526
- return true;
5575
+ return isValidXmlString(value);
5527
5576
  },
5528
5577
  canBeValid(partialValue, settings, schema) {
5529
5578
  return true;
@@ -14183,7 +14232,25 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
14183
14232
  output: computeUsage(`$2.40 / 1M tokens`),
14184
14233
  },
14185
14234
  },
14186
- // TODO: [main] !!3 Claude 1 and 2 has also completion versions - ask Hoagy
14235
+ {
14236
+ modelVariant: 'CHAT',
14237
+ modelTitle: 'Claude 3.7 Sonnet',
14238
+ modelName: 'claude-3-7-sonnet-20250219',
14239
+ pricing: {
14240
+ prompt: computeUsage(`$3.00 / 1M tokens`),
14241
+ output: computeUsage(`$15.00 / 1M tokens`),
14242
+ },
14243
+ },
14244
+ {
14245
+ modelVariant: 'CHAT',
14246
+ modelTitle: 'Claude 3.5 Haiku',
14247
+ modelName: 'claude-3-5-haiku-20241022',
14248
+ pricing: {
14249
+ prompt: computeUsage(`$0.25 / 1M tokens`),
14250
+ output: computeUsage(`$1.25 / 1M tokens`),
14251
+ },
14252
+ },
14253
+ // <- [🕕]
14187
14254
  ],
14188
14255
  });
14189
14256
  /**
@@ -14948,7 +15015,6 @@ const OPENAI_MODELS = exportJson({
14948
15015
  prompt: computeUsage(`$5.00 / 1M tokens`),
14949
15016
  output: computeUsage(`$15.00 / 1M tokens`),
14950
15017
  },
14951
- //TODO: [main] !!3 Add gpt-4o-mini-2024-07-18 and all others to be up to date
14952
15018
  },
14953
15019
  /**/
14954
15020
  /**/
@@ -14963,6 +15029,17 @@ const OPENAI_MODELS = exportJson({
14963
15029
  },
14964
15030
  /**/
14965
15031
  /**/
15032
+ {
15033
+ modelVariant: 'CHAT',
15034
+ modelTitle: 'gpt-4o-mini',
15035
+ modelName: 'gpt-4o-mini',
15036
+ pricing: {
15037
+ prompt: computeUsage(`$3.00 / 1M tokens`),
15038
+ output: computeUsage(`$9.00 / 1M tokens`),
15039
+ },
15040
+ },
15041
+ /**/
15042
+ /**/
14966
15043
  {
14967
15044
  modelVariant: 'CHAT',
14968
15045
  modelTitle: 'o1-preview',
@@ -15042,6 +15119,7 @@ const OPENAI_MODELS = exportJson({
15042
15119
  },
15043
15120
  },
15044
15121
  /**/
15122
+ // <- [🕕]
15045
15123
  ],
15046
15124
  });
15047
15125
  /**
@@ -15610,11 +15688,17 @@ const createDeepseekExecutionTools = Object.assign((options) => {
15610
15688
  description: 'Implementation of Deepseek models',
15611
15689
  vercelProvider: deepseekVercelProvider,
15612
15690
  availableModels: [
15613
- // TODO: [🕘] Maybe list models in same way as in other providers - in separate file with metadata
15614
- 'deepseek-chat',
15615
- 'deepseek-reasoner',
15691
+ {
15692
+ modelName: 'deepseek-chat',
15693
+ modelVariant: 'CHAT',
15694
+ },
15695
+ {
15696
+ modelName: 'deepseek-reasoner',
15697
+ modelVariant: 'CHAT',
15698
+ },
15699
+ // <- [🕕]
15616
15700
  // <- TODO: How picking of the default model looks like in `createExecutionToolsFromVercelProvider`
15617
- ].map((modelName) => ({ modelName, modelVariant: 'CHAT' })),
15701
+ ],
15618
15702
  ...options,
15619
15703
  });
15620
15704
  }, {
@@ -15712,6 +15796,10 @@ const createGoogleExecutionTools = Object.assign((options) => {
15712
15796
  vercelProvider: googleGeminiVercelProvider,
15713
15797
  availableModels: [
15714
15798
  // TODO: [🕘] Maybe list models in same way as in other providers - in separate file with metadata
15799
+ 'gemini-2.5-pro-preview-03-25',
15800
+ 'gemini-2.0-flash',
15801
+ 'gemini-2.0-flash-lite',
15802
+ 'gemini-2.0-flash-thinking-exp-01-21',
15715
15803
  'gemini-1.5-flash',
15716
15804
  'gemini-1.5-flash-latest',
15717
15805
  'gemini-1.5-flash-001',
@@ -15727,6 +15815,7 @@ const createGoogleExecutionTools = Object.assign((options) => {
15727
15815
  'gemini-1.5-pro-002',
15728
15816
  'gemini-1.5-pro-exp-0827',
15729
15817
  'gemini-1.0-pro',
15818
+ // <- [🕕]
15730
15819
  ].map((modelName) => ({ modelName, modelVariant: 'CHAT' })),
15731
15820
  ...options,
15732
15821
  });