@promptbook/fake-llm 0.105.0-12 → 0.105.0-15

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
@@ -5,6 +5,7 @@ import { LoremIpsum } from 'lorem-ipsum';
5
5
  import 'path';
6
6
  import 'crypto-js';
7
7
  import 'crypto-js/enc-hex';
8
+ import moment from 'moment';
8
9
 
9
10
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
10
11
  /**
@@ -20,7 +21,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
20
21
  * @generated
21
22
  * @see https://github.com/webgptorg/promptbook
22
23
  */
23
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-12';
24
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-15';
24
25
  /**
25
26
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
27
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6369,6 +6370,25 @@ class SerpSearchEngine {
6369
6370
  }
6370
6371
  }
6371
6372
 
6373
+ /**
6374
+ * @@@
6375
+ *
6376
+ * @private utility for commitments
6377
+ */
6378
+ function formatOptionalInstructionBlock(label, content) {
6379
+ const trimmedContent = spaceTrim$1(content);
6380
+ if (!trimmedContent) {
6381
+ return '';
6382
+ }
6383
+ return spaceTrim$1((block) => `
6384
+ - ${label}:
6385
+ ${block(trimmedContent
6386
+ .split('\n')
6387
+ .map((line) => `- ${line}`)
6388
+ .join('\n'))}
6389
+ `);
6390
+ }
6391
+
6372
6392
  /**
6373
6393
  * USE SEARCH ENGINE commitment definition
6374
6394
  *
@@ -6390,6 +6410,9 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
6390
6410
  constructor() {
6391
6411
  super('USE SEARCH ENGINE', ['USE SEARCH']);
6392
6412
  }
6413
+ get requiresContent() {
6414
+ return false;
6415
+ }
6393
6416
  /**
6394
6417
  * Short one-line description of USE SEARCH ENGINE.
6395
6418
  */
@@ -6438,6 +6461,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
6438
6461
  `);
6439
6462
  }
6440
6463
  applyToAgentModelRequirements(requirements, content) {
6464
+ const extraInstructions = formatOptionalInstructionBlock('Search instructions', content);
6441
6465
  // Get existing tools array or create new one
6442
6466
  const existingTools = requirements.tools || [];
6443
6467
  // Add 'web_search' to tools if not already present
@@ -6496,13 +6520,14 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
6496
6520
  ...requirements.metadata,
6497
6521
  useSearchEngine: content || true,
6498
6522
  },
6499
- }, spaceTrim$1(`
6500
- Tools:
6501
- You have access to the web search engine via the tool "web_search".
6502
- Use it to find up-to-date information or facts that you don't know.
6503
- When you need to know some information from the internet, use the tool provided to you.
6504
- Do not make up information when you can search for it.
6505
- Do not tell the user you cannot search for information, YOU CAN.
6523
+ }, spaceTrim$1((block) => `
6524
+ Tool:
6525
+ - You have access to the web search engine via the tool "web_search".
6526
+ - Use it to find up-to-date information or facts that you don't know.
6527
+ - When you need to know some information from the internet, use the tool provided to you.
6528
+ - Do not make up information when you can search for it.
6529
+ - Do not tell the user you cannot search for information, YOU CAN.
6530
+ ${block(extraInstructions)}
6506
6531
  `));
6507
6532
  }
6508
6533
  /**
@@ -6554,6 +6579,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
6554
6579
  *
6555
6580
  * ```book
6556
6581
  * USE TIME
6582
+ * USE TIME Prefer the user's local timezone.
6557
6583
  * ```
6558
6584
  *
6559
6585
  * @private [🪔] Maybe export the commitments through some package
@@ -6562,6 +6588,9 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
6562
6588
  constructor() {
6563
6589
  super('USE TIME', ['CURRENT TIME', 'TIME', 'DATE']);
6564
6590
  }
6591
+ get requiresContent() {
6592
+ return false;
6593
+ }
6565
6594
  /**
6566
6595
  * Short one-line description of USE TIME.
6567
6596
  */
@@ -6588,6 +6617,7 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
6588
6617
  - This tool won't receive any input.
6589
6618
  - It outputs the current date and time as an ISO 8601 string.
6590
6619
  - Allows the agent to answer questions about the current time or date.
6620
+ - The content following \`USE TIME\` is an arbitrary text that the agent should know (e.g. timezone preference).
6591
6621
 
6592
6622
  ## Examples
6593
6623
 
@@ -6597,9 +6627,17 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
6597
6627
  PERSONA You are a helpful assistant who knows the current time.
6598
6628
  USE TIME
6599
6629
  \`\`\`
6630
+
6631
+ \`\`\`book
6632
+ Travel Assistant
6633
+
6634
+ PERSONA You help travelers with planning.
6635
+ USE TIME Prefer the user's local timezone.
6636
+ \`\`\`
6600
6637
  `);
6601
6638
  }
6602
6639
  applyToAgentModelRequirements(requirements, content) {
6640
+ const extraInstructions = formatOptionalInstructionBlock('Time instructions', content);
6603
6641
  // Get existing tools array or create new one
6604
6642
  const existingTools = requirements.tools || [];
6605
6643
  // Add 'get_current_time' to tools if not already present
@@ -6630,13 +6668,12 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
6630
6668
  metadata: {
6631
6669
  ...requirements.metadata,
6632
6670
  },
6633
- }, spaceTrim$1(`
6634
- Tool:
6635
- You have access to the current date and time via the tool "get_current_time".
6636
- Use it to answer questions about the current date and time.
6637
- When you need to know the current date or time, use the tool provided to you.
6638
- Do not make up the current date or time; always use the tool to get accurate information.
6639
- `));
6671
+ }, spaceTrim$1((block) => `
6672
+ Time and date context:
6673
+ - It is ${moment().format('MMMM YYYY')} now.
6674
+ - If you need more precise current time information, use the tool "get_current_time".
6675
+ ${block(extraInstructions)}
6676
+ `));
6640
6677
  }
6641
6678
  /**
6642
6679
  * Gets human-readable titles for tool functions provided by this commitment.