@promptbook/browser 0.104.0-11 → 0.104.0-13
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 +65 -26
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +5 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +4 -4
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +1 -1
- package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +65 -26
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
22
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-13';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3185,9 +3185,7 @@ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
3185
3185
|
// Get existing dictionary entries from metadata
|
|
3186
3186
|
const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
|
|
3187
3187
|
// Merge the new dictionary entry with existing entries
|
|
3188
|
-
const mergedDictionary = existingDictionary
|
|
3189
|
-
? `${existingDictionary}\n${trimmedContent}`
|
|
3190
|
-
: trimmedContent;
|
|
3188
|
+
const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
|
|
3191
3189
|
// Store the merged dictionary in metadata for debugging and inspection
|
|
3192
3190
|
const updatedMetadata = {
|
|
3193
3191
|
...requirements.metadata,
|
|
@@ -5716,19 +5714,37 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5716
5714
|
`);
|
|
5717
5715
|
}
|
|
5718
5716
|
applyToAgentModelRequirements(requirements, content) {
|
|
5719
|
-
// We simply mark that browser capability is enabled in metadata
|
|
5720
|
-
// Get existing metadata
|
|
5721
|
-
const existingMetadata = requirements.metadata || {};
|
|
5722
5717
|
// Get existing tools array or create new one
|
|
5723
|
-
const existingTools =
|
|
5724
|
-
// Add '
|
|
5725
|
-
const updatedTools = existingTools.
|
|
5726
|
-
|
|
5718
|
+
const existingTools = requirements.tools || [];
|
|
5719
|
+
// Add 'web_browser' to tools if not already present
|
|
5720
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
|
|
5721
|
+
? existingTools
|
|
5722
|
+
: [
|
|
5723
|
+
...existingTools,
|
|
5724
|
+
{
|
|
5725
|
+
name: 'web_browser',
|
|
5726
|
+
description: spaceTrim$1(`
|
|
5727
|
+
A tool that can browse the web.
|
|
5728
|
+
Use this tool when you need to access specific websites or browse the internet.
|
|
5729
|
+
`),
|
|
5730
|
+
parameters: {
|
|
5731
|
+
type: 'object',
|
|
5732
|
+
properties: {
|
|
5733
|
+
url: {
|
|
5734
|
+
type: 'string',
|
|
5735
|
+
description: 'The URL to browse',
|
|
5736
|
+
},
|
|
5737
|
+
},
|
|
5738
|
+
required: ['url'],
|
|
5739
|
+
},
|
|
5740
|
+
},
|
|
5741
|
+
];
|
|
5742
|
+
// Return requirements with updated tools and metadata
|
|
5727
5743
|
return {
|
|
5728
5744
|
...requirements,
|
|
5745
|
+
tools: updatedTools,
|
|
5729
5746
|
metadata: {
|
|
5730
|
-
...
|
|
5731
|
-
tools: updatedTools,
|
|
5747
|
+
...requirements.metadata,
|
|
5732
5748
|
useBrowser: true,
|
|
5733
5749
|
},
|
|
5734
5750
|
};
|
|
@@ -5821,13 +5837,13 @@ class UseMcpCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5821
5837
|
* The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
|
|
5822
5838
|
* to access and retrieve up-to-date information from the internet when necessary.
|
|
5823
5839
|
*
|
|
5824
|
-
* The content following `USE SEARCH ENGINE` is
|
|
5840
|
+
* The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
5825
5841
|
*
|
|
5826
5842
|
* Example usage in agent source:
|
|
5827
5843
|
*
|
|
5828
5844
|
* ```book
|
|
5829
5845
|
* USE SEARCH ENGINE
|
|
5830
|
-
* USE SEARCH ENGINE
|
|
5846
|
+
* USE SEARCH ENGINE Hledej informace o Přemyslovcích
|
|
5831
5847
|
* ```
|
|
5832
5848
|
*
|
|
5833
5849
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -5859,7 +5875,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5859
5875
|
|
|
5860
5876
|
## Key aspects
|
|
5861
5877
|
|
|
5862
|
-
- The content following \`USE SEARCH ENGINE\` is
|
|
5878
|
+
- The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
5863
5879
|
- The actual search engine tool usage is handled by the agent runtime
|
|
5864
5880
|
- Allows the agent to search for current information from the web
|
|
5865
5881
|
- Useful for research tasks, finding facts, and accessing dynamic content
|
|
@@ -5884,20 +5900,39 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5884
5900
|
`);
|
|
5885
5901
|
}
|
|
5886
5902
|
applyToAgentModelRequirements(requirements, content) {
|
|
5887
|
-
// We simply mark that search engine capability is enabled in metadata
|
|
5888
|
-
// Get existing metadata
|
|
5889
|
-
const existingMetadata = requirements.metadata || {};
|
|
5890
5903
|
// Get existing tools array or create new one
|
|
5891
|
-
const existingTools =
|
|
5892
|
-
// Add '
|
|
5893
|
-
const updatedTools = existingTools.
|
|
5894
|
-
|
|
5904
|
+
const existingTools = requirements.tools || [];
|
|
5905
|
+
// Add 'web_search' to tools if not already present
|
|
5906
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
|
|
5907
|
+
? existingTools
|
|
5908
|
+
: [
|
|
5909
|
+
...existingTools,
|
|
5910
|
+
{
|
|
5911
|
+
name: 'web_search',
|
|
5912
|
+
description: spaceTrim$1(`
|
|
5913
|
+
Search the internet for information.
|
|
5914
|
+
Use this tool when you need to find up-to-date information or facts that you don't know.
|
|
5915
|
+
${!content ? '' : `Search scope / instructions: ${content}`}
|
|
5916
|
+
`),
|
|
5917
|
+
parameters: {
|
|
5918
|
+
type: 'object',
|
|
5919
|
+
properties: {
|
|
5920
|
+
query: {
|
|
5921
|
+
type: 'string',
|
|
5922
|
+
description: 'The search query',
|
|
5923
|
+
},
|
|
5924
|
+
},
|
|
5925
|
+
required: ['query'],
|
|
5926
|
+
},
|
|
5927
|
+
},
|
|
5928
|
+
];
|
|
5929
|
+
// Return requirements with updated tools and metadata
|
|
5895
5930
|
return {
|
|
5896
5931
|
...requirements,
|
|
5932
|
+
tools: updatedTools,
|
|
5897
5933
|
metadata: {
|
|
5898
|
-
...
|
|
5899
|
-
|
|
5900
|
-
useSearchEngine: true,
|
|
5934
|
+
...requirements.metadata,
|
|
5935
|
+
useSearchEngine: content || true,
|
|
5901
5936
|
},
|
|
5902
5937
|
};
|
|
5903
5938
|
}
|
|
@@ -6362,6 +6397,10 @@ function parseAgentSource(agentSource) {
|
|
|
6362
6397
|
meta.image = spaceTrim$2(commitment.content);
|
|
6363
6398
|
continue;
|
|
6364
6399
|
}
|
|
6400
|
+
if (commitment.type === 'META DESCRIPTION') {
|
|
6401
|
+
meta.description = spaceTrim$2(commitment.content);
|
|
6402
|
+
continue;
|
|
6403
|
+
}
|
|
6365
6404
|
if (commitment.type === 'META COLOR') {
|
|
6366
6405
|
meta.color = normalizeSeparator(commitment.content);
|
|
6367
6406
|
continue;
|