@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 +52 -15
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +10 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +2 -7
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +1 -6
- package/esm/typings/src/book-components/Chat/Chat/ClockIcon.d.ts +9 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +10 -37
- package/esm/typings/src/book-components/Chat/utils/getToolCallChipletText.d.ts +2 -5
- package/esm/typings/src/book-components/Chat/utils/toolCallParsing.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +1 -0
- package/esm/typings/src/commitments/USE_TIME/USE_TIME.d.ts +2 -0
- package/esm/typings/src/commitments/_base/formatOptionalInstructionBlock.d.ts +6 -0
- package/esm/typings/src/constants.d.ts +125 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -19
- package/esm/typings/src/types/ToolCall.d.ts +37 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -2
- package/umd/index.umd.js +56 -19
- package/umd/index.umd.js.map +1 -1
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-
|
|
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
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
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
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
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.
|