@promptbook/node 0.105.0-14 → 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
|
@@ -13,6 +13,7 @@ import { SHA256 } from 'crypto-js';
|
|
|
13
13
|
import { lookup, extension } from 'mime-types';
|
|
14
14
|
import { spawn } from 'child_process';
|
|
15
15
|
import * as dotenv from 'dotenv';
|
|
16
|
+
import moment from 'moment';
|
|
16
17
|
|
|
17
18
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
18
19
|
/**
|
|
@@ -28,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
28
29
|
* @generated
|
|
29
30
|
* @see https://github.com/webgptorg/promptbook
|
|
30
31
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-15';
|
|
32
33
|
/**
|
|
33
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -15458,6 +15459,25 @@ class SerpSearchEngine {
|
|
|
15458
15459
|
}
|
|
15459
15460
|
}
|
|
15460
15461
|
|
|
15462
|
+
/**
|
|
15463
|
+
* @@@
|
|
15464
|
+
*
|
|
15465
|
+
* @private utility for commitments
|
|
15466
|
+
*/
|
|
15467
|
+
function formatOptionalInstructionBlock(label, content) {
|
|
15468
|
+
const trimmedContent = spaceTrim$1(content);
|
|
15469
|
+
if (!trimmedContent) {
|
|
15470
|
+
return '';
|
|
15471
|
+
}
|
|
15472
|
+
return spaceTrim$1((block) => `
|
|
15473
|
+
- ${label}:
|
|
15474
|
+
${block(trimmedContent
|
|
15475
|
+
.split('\n')
|
|
15476
|
+
.map((line) => `- ${line}`)
|
|
15477
|
+
.join('\n'))}
|
|
15478
|
+
`);
|
|
15479
|
+
}
|
|
15480
|
+
|
|
15461
15481
|
/**
|
|
15462
15482
|
* USE SEARCH ENGINE commitment definition
|
|
15463
15483
|
*
|
|
@@ -15479,6 +15499,9 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15479
15499
|
constructor() {
|
|
15480
15500
|
super('USE SEARCH ENGINE', ['USE SEARCH']);
|
|
15481
15501
|
}
|
|
15502
|
+
get requiresContent() {
|
|
15503
|
+
return false;
|
|
15504
|
+
}
|
|
15482
15505
|
/**
|
|
15483
15506
|
* Short one-line description of USE SEARCH ENGINE.
|
|
15484
15507
|
*/
|
|
@@ -15527,6 +15550,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15527
15550
|
`);
|
|
15528
15551
|
}
|
|
15529
15552
|
applyToAgentModelRequirements(requirements, content) {
|
|
15553
|
+
const extraInstructions = formatOptionalInstructionBlock('Search instructions', content);
|
|
15530
15554
|
// Get existing tools array or create new one
|
|
15531
15555
|
const existingTools = requirements.tools || [];
|
|
15532
15556
|
// Add 'web_search' to tools if not already present
|
|
@@ -15585,13 +15609,14 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15585
15609
|
...requirements.metadata,
|
|
15586
15610
|
useSearchEngine: content || true,
|
|
15587
15611
|
},
|
|
15588
|
-
}, spaceTrim$1(`
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15612
|
+
}, spaceTrim$1((block) => `
|
|
15613
|
+
Tool:
|
|
15614
|
+
- You have access to the web search engine via the tool "web_search".
|
|
15615
|
+
- Use it to find up-to-date information or facts that you don't know.
|
|
15616
|
+
- When you need to know some information from the internet, use the tool provided to you.
|
|
15617
|
+
- Do not make up information when you can search for it.
|
|
15618
|
+
- Do not tell the user you cannot search for information, YOU CAN.
|
|
15619
|
+
${block(extraInstructions)}
|
|
15595
15620
|
`));
|
|
15596
15621
|
}
|
|
15597
15622
|
/**
|
|
@@ -15643,6 +15668,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15643
15668
|
*
|
|
15644
15669
|
* ```book
|
|
15645
15670
|
* USE TIME
|
|
15671
|
+
* USE TIME Prefer the user's local timezone.
|
|
15646
15672
|
* ```
|
|
15647
15673
|
*
|
|
15648
15674
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -15651,6 +15677,9 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15651
15677
|
constructor() {
|
|
15652
15678
|
super('USE TIME', ['CURRENT TIME', 'TIME', 'DATE']);
|
|
15653
15679
|
}
|
|
15680
|
+
get requiresContent() {
|
|
15681
|
+
return false;
|
|
15682
|
+
}
|
|
15654
15683
|
/**
|
|
15655
15684
|
* Short one-line description of USE TIME.
|
|
15656
15685
|
*/
|
|
@@ -15677,6 +15706,7 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15677
15706
|
- This tool won't receive any input.
|
|
15678
15707
|
- It outputs the current date and time as an ISO 8601 string.
|
|
15679
15708
|
- Allows the agent to answer questions about the current time or date.
|
|
15709
|
+
- The content following \`USE TIME\` is an arbitrary text that the agent should know (e.g. timezone preference).
|
|
15680
15710
|
|
|
15681
15711
|
## Examples
|
|
15682
15712
|
|
|
@@ -15686,9 +15716,17 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15686
15716
|
PERSONA You are a helpful assistant who knows the current time.
|
|
15687
15717
|
USE TIME
|
|
15688
15718
|
\`\`\`
|
|
15719
|
+
|
|
15720
|
+
\`\`\`book
|
|
15721
|
+
Travel Assistant
|
|
15722
|
+
|
|
15723
|
+
PERSONA You help travelers with planning.
|
|
15724
|
+
USE TIME Prefer the user's local timezone.
|
|
15725
|
+
\`\`\`
|
|
15689
15726
|
`);
|
|
15690
15727
|
}
|
|
15691
15728
|
applyToAgentModelRequirements(requirements, content) {
|
|
15729
|
+
const extraInstructions = formatOptionalInstructionBlock('Time instructions', content);
|
|
15692
15730
|
// Get existing tools array or create new one
|
|
15693
15731
|
const existingTools = requirements.tools || [];
|
|
15694
15732
|
// Add 'get_current_time' to tools if not already present
|
|
@@ -15719,13 +15757,12 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15719
15757
|
metadata: {
|
|
15720
15758
|
...requirements.metadata,
|
|
15721
15759
|
},
|
|
15722
|
-
}, spaceTrim$1(`
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
`));
|
|
15760
|
+
}, spaceTrim$1((block) => `
|
|
15761
|
+
Time and date context:
|
|
15762
|
+
- It is ${moment().format('MMMM YYYY')} now.
|
|
15763
|
+
- If you need more precise current time information, use the tool "get_current_time".
|
|
15764
|
+
${block(extraInstructions)}
|
|
15765
|
+
`));
|
|
15729
15766
|
}
|
|
15730
15767
|
/**
|
|
15731
15768
|
* Gets human-readable titles for tool functions provided by this commitment.
|