@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 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-31';
49
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-33';
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;
@@ -13340,13 +13389,7 @@ function startRemoteServer(options) {
13340
13389
  }
13341
13390
  else if (isAnonymous === false && createLlmExecutionTools !== null) {
13342
13391
  // Note: Application mode
13343
- const { appId, userId, customOptions } = identification;
13344
- llm = await createLlmExecutionTools({
13345
- isAnonymous: false,
13346
- appId,
13347
- userId,
13348
- customOptions,
13349
- });
13392
+ llm = await createLlmExecutionTools(identification);
13350
13393
  }
13351
13394
  else {
13352
13395
  throw new PipelineExecutionError(`You must provide either llmToolsConfiguration or non-anonymous mode must be propperly configured`);
@@ -14183,7 +14226,25 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
14183
14226
  output: computeUsage(`$2.40 / 1M tokens`),
14184
14227
  },
14185
14228
  },
14186
- // TODO: [main] !!3 Claude 1 and 2 has also completion versions - ask Hoagy
14229
+ {
14230
+ modelVariant: 'CHAT',
14231
+ modelTitle: 'Claude 3.7 Sonnet',
14232
+ modelName: 'claude-3-7-sonnet-20250219',
14233
+ pricing: {
14234
+ prompt: computeUsage(`$3.00 / 1M tokens`),
14235
+ output: computeUsage(`$15.00 / 1M tokens`),
14236
+ },
14237
+ },
14238
+ {
14239
+ modelVariant: 'CHAT',
14240
+ modelTitle: 'Claude 3.5 Haiku',
14241
+ modelName: 'claude-3-5-haiku-20241022',
14242
+ pricing: {
14243
+ prompt: computeUsage(`$0.25 / 1M tokens`),
14244
+ output: computeUsage(`$1.25 / 1M tokens`),
14245
+ },
14246
+ },
14247
+ // <- [🕕]
14187
14248
  ],
14188
14249
  });
14189
14250
  /**
@@ -14948,7 +15009,6 @@ const OPENAI_MODELS = exportJson({
14948
15009
  prompt: computeUsage(`$5.00 / 1M tokens`),
14949
15010
  output: computeUsage(`$15.00 / 1M tokens`),
14950
15011
  },
14951
- //TODO: [main] !!3 Add gpt-4o-mini-2024-07-18 and all others to be up to date
14952
15012
  },
14953
15013
  /**/
14954
15014
  /**/
@@ -14963,6 +15023,17 @@ const OPENAI_MODELS = exportJson({
14963
15023
  },
14964
15024
  /**/
14965
15025
  /**/
15026
+ {
15027
+ modelVariant: 'CHAT',
15028
+ modelTitle: 'gpt-4o-mini',
15029
+ modelName: 'gpt-4o-mini',
15030
+ pricing: {
15031
+ prompt: computeUsage(`$3.00 / 1M tokens`),
15032
+ output: computeUsage(`$9.00 / 1M tokens`),
15033
+ },
15034
+ },
15035
+ /**/
15036
+ /**/
14966
15037
  {
14967
15038
  modelVariant: 'CHAT',
14968
15039
  modelTitle: 'o1-preview',
@@ -15042,6 +15113,7 @@ const OPENAI_MODELS = exportJson({
15042
15113
  },
15043
15114
  },
15044
15115
  /**/
15116
+ // <- [🕕]
15045
15117
  ],
15046
15118
  });
15047
15119
  /**
@@ -15610,11 +15682,17 @@ const createDeepseekExecutionTools = Object.assign((options) => {
15610
15682
  description: 'Implementation of Deepseek models',
15611
15683
  vercelProvider: deepseekVercelProvider,
15612
15684
  availableModels: [
15613
- // TODO: [🕘] Maybe list models in same way as in other providers - in separate file with metadata
15614
- 'deepseek-chat',
15615
- 'deepseek-reasoner',
15685
+ {
15686
+ modelName: 'deepseek-chat',
15687
+ modelVariant: 'CHAT',
15688
+ },
15689
+ {
15690
+ modelName: 'deepseek-reasoner',
15691
+ modelVariant: 'CHAT',
15692
+ },
15693
+ // <- [🕕]
15616
15694
  // <- TODO: How picking of the default model looks like in `createExecutionToolsFromVercelProvider`
15617
- ].map((modelName) => ({ modelName, modelVariant: 'CHAT' })),
15695
+ ],
15618
15696
  ...options,
15619
15697
  });
15620
15698
  }, {
@@ -15712,6 +15790,10 @@ const createGoogleExecutionTools = Object.assign((options) => {
15712
15790
  vercelProvider: googleGeminiVercelProvider,
15713
15791
  availableModels: [
15714
15792
  // TODO: [🕘] Maybe list models in same way as in other providers - in separate file with metadata
15793
+ 'gemini-2.5-pro-preview-03-25',
15794
+ 'gemini-2.0-flash',
15795
+ 'gemini-2.0-flash-lite',
15796
+ 'gemini-2.0-flash-thinking-exp-01-21',
15715
15797
  'gemini-1.5-flash',
15716
15798
  'gemini-1.5-flash-latest',
15717
15799
  'gemini-1.5-flash-001',
@@ -15727,6 +15809,7 @@ const createGoogleExecutionTools = Object.assign((options) => {
15727
15809
  'gemini-1.5-pro-002',
15728
15810
  'gemini-1.5-pro-exp-0827',
15729
15811
  'gemini-1.0-pro',
15812
+ // <- [🕕]
15730
15813
  ].map((modelName) => ({ modelName, modelVariant: 'CHAT' })),
15731
15814
  ...options,
15732
15815
  });