@promptbook/remote-server 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
|
@@ -16,6 +16,7 @@ import sha256 from 'crypto-js/sha256';
|
|
|
16
16
|
import { SHA256 } from 'crypto-js';
|
|
17
17
|
import { lookup, extension } from 'mime-types';
|
|
18
18
|
import { parse, unparse } from 'papaparse';
|
|
19
|
+
import moment from 'moment';
|
|
19
20
|
import { createElement } from 'react';
|
|
20
21
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
21
22
|
|
|
@@ -33,7 +34,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
33
34
|
* @generated
|
|
34
35
|
* @see https://github.com/webgptorg/promptbook
|
|
35
36
|
*/
|
|
36
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
37
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-15';
|
|
37
38
|
/**
|
|
38
39
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
39
40
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -11755,6 +11756,25 @@ class SerpSearchEngine {
|
|
|
11755
11756
|
}
|
|
11756
11757
|
}
|
|
11757
11758
|
|
|
11759
|
+
/**
|
|
11760
|
+
* @@@
|
|
11761
|
+
*
|
|
11762
|
+
* @private utility for commitments
|
|
11763
|
+
*/
|
|
11764
|
+
function formatOptionalInstructionBlock(label, content) {
|
|
11765
|
+
const trimmedContent = spaceTrim$1(content);
|
|
11766
|
+
if (!trimmedContent) {
|
|
11767
|
+
return '';
|
|
11768
|
+
}
|
|
11769
|
+
return spaceTrim$1((block) => `
|
|
11770
|
+
- ${label}:
|
|
11771
|
+
${block(trimmedContent
|
|
11772
|
+
.split('\n')
|
|
11773
|
+
.map((line) => `- ${line}`)
|
|
11774
|
+
.join('\n'))}
|
|
11775
|
+
`);
|
|
11776
|
+
}
|
|
11777
|
+
|
|
11758
11778
|
/**
|
|
11759
11779
|
* USE SEARCH ENGINE commitment definition
|
|
11760
11780
|
*
|
|
@@ -11776,6 +11796,9 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11776
11796
|
constructor() {
|
|
11777
11797
|
super('USE SEARCH ENGINE', ['USE SEARCH']);
|
|
11778
11798
|
}
|
|
11799
|
+
get requiresContent() {
|
|
11800
|
+
return false;
|
|
11801
|
+
}
|
|
11779
11802
|
/**
|
|
11780
11803
|
* Short one-line description of USE SEARCH ENGINE.
|
|
11781
11804
|
*/
|
|
@@ -11824,6 +11847,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11824
11847
|
`);
|
|
11825
11848
|
}
|
|
11826
11849
|
applyToAgentModelRequirements(requirements, content) {
|
|
11850
|
+
const extraInstructions = formatOptionalInstructionBlock('Search instructions', content);
|
|
11827
11851
|
// Get existing tools array or create new one
|
|
11828
11852
|
const existingTools = requirements.tools || [];
|
|
11829
11853
|
// Add 'web_search' to tools if not already present
|
|
@@ -11882,13 +11906,14 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11882
11906
|
...requirements.metadata,
|
|
11883
11907
|
useSearchEngine: content || true,
|
|
11884
11908
|
},
|
|
11885
|
-
}, spaceTrim$1(`
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11909
|
+
}, spaceTrim$1((block) => `
|
|
11910
|
+
Tool:
|
|
11911
|
+
- You have access to the web search engine via the tool "web_search".
|
|
11912
|
+
- Use it to find up-to-date information or facts that you don't know.
|
|
11913
|
+
- When you need to know some information from the internet, use the tool provided to you.
|
|
11914
|
+
- Do not make up information when you can search for it.
|
|
11915
|
+
- Do not tell the user you cannot search for information, YOU CAN.
|
|
11916
|
+
${block(extraInstructions)}
|
|
11892
11917
|
`));
|
|
11893
11918
|
}
|
|
11894
11919
|
/**
|
|
@@ -11940,6 +11965,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11940
11965
|
*
|
|
11941
11966
|
* ```book
|
|
11942
11967
|
* USE TIME
|
|
11968
|
+
* USE TIME Prefer the user's local timezone.
|
|
11943
11969
|
* ```
|
|
11944
11970
|
*
|
|
11945
11971
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -11948,6 +11974,9 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11948
11974
|
constructor() {
|
|
11949
11975
|
super('USE TIME', ['CURRENT TIME', 'TIME', 'DATE']);
|
|
11950
11976
|
}
|
|
11977
|
+
get requiresContent() {
|
|
11978
|
+
return false;
|
|
11979
|
+
}
|
|
11951
11980
|
/**
|
|
11952
11981
|
* Short one-line description of USE TIME.
|
|
11953
11982
|
*/
|
|
@@ -11974,6 +12003,7 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11974
12003
|
- This tool won't receive any input.
|
|
11975
12004
|
- It outputs the current date and time as an ISO 8601 string.
|
|
11976
12005
|
- Allows the agent to answer questions about the current time or date.
|
|
12006
|
+
- The content following \`USE TIME\` is an arbitrary text that the agent should know (e.g. timezone preference).
|
|
11977
12007
|
|
|
11978
12008
|
## Examples
|
|
11979
12009
|
|
|
@@ -11983,9 +12013,17 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11983
12013
|
PERSONA You are a helpful assistant who knows the current time.
|
|
11984
12014
|
USE TIME
|
|
11985
12015
|
\`\`\`
|
|
12016
|
+
|
|
12017
|
+
\`\`\`book
|
|
12018
|
+
Travel Assistant
|
|
12019
|
+
|
|
12020
|
+
PERSONA You help travelers with planning.
|
|
12021
|
+
USE TIME Prefer the user's local timezone.
|
|
12022
|
+
\`\`\`
|
|
11986
12023
|
`);
|
|
11987
12024
|
}
|
|
11988
12025
|
applyToAgentModelRequirements(requirements, content) {
|
|
12026
|
+
const extraInstructions = formatOptionalInstructionBlock('Time instructions', content);
|
|
11989
12027
|
// Get existing tools array or create new one
|
|
11990
12028
|
const existingTools = requirements.tools || [];
|
|
11991
12029
|
// Add 'get_current_time' to tools if not already present
|
|
@@ -12016,13 +12054,12 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12016
12054
|
metadata: {
|
|
12017
12055
|
...requirements.metadata,
|
|
12018
12056
|
},
|
|
12019
|
-
}, spaceTrim$1(`
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
`));
|
|
12057
|
+
}, spaceTrim$1((block) => `
|
|
12058
|
+
Time and date context:
|
|
12059
|
+
- It is ${moment().format('MMMM YYYY')} now.
|
|
12060
|
+
- If you need more precise current time information, use the tool "get_current_time".
|
|
12061
|
+
${block(extraInstructions)}
|
|
12062
|
+
`));
|
|
12026
12063
|
}
|
|
12027
12064
|
/**
|
|
12028
12065
|
* Gets human-readable titles for tool functions provided by this commitment.
|