@promptbook/wizard 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.
Files changed (30) hide show
  1. package/esm/index.es.js +99 -32
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
  5. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +5 -0
  6. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
  7. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  8. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  9. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  10. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  11. package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
  12. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
  13. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  14. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  15. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  17. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  18. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
  19. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  20. package/esm/typings/src/search-engines/SearchResult.d.ts +4 -4
  21. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +1 -1
  22. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +1 -1
  23. package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
  24. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  25. package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
  26. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  27. package/esm/typings/src/version.d.ts +1 -1
  28. package/package.json +2 -2
  29. package/umd/index.umd.js +99 -32
  30. package/umd/index.umd.js.map +1 -1
@@ -188,6 +188,7 @@ import type { BookTranspiler } from '../transpilers/_common/BookTranspiler';
188
188
  import type { BookTranspilerOptions } from '../transpilers/_common/BookTranspilerOptions';
189
189
  import type { IntermediateFilesStrategy } from '../types/IntermediateFilesStrategy';
190
190
  import type { LlmCall } from '../types/LlmCall';
191
+ import type { LlmToolDefinition } from '../types/LlmToolDefinition';
191
192
  import type { Message } from '../types/Message';
192
193
  import type { ModelRequirements } from '../types/ModelRequirements';
193
194
  import type { CompletionModelRequirements } from '../types/ModelRequirements';
@@ -559,6 +560,7 @@ export type { BookTranspiler };
559
560
  export type { BookTranspilerOptions };
560
561
  export type { IntermediateFilesStrategy };
561
562
  export type { LlmCall };
563
+ export type { LlmToolDefinition };
562
564
  export type { Message };
563
565
  export type { ModelRequirements };
564
566
  export type { CompletionModelRequirements };
@@ -73,6 +73,7 @@ export type AgentBasicInformation = {
73
73
  */
74
74
  meta: {
75
75
  fullname?: string;
76
+ description?: string;
76
77
  image?: string_url_image;
77
78
  font?: string_fonts;
78
79
  color?: string_color;
@@ -1,3 +1,4 @@
1
+ import type { LlmToolDefinition } from '../../types/LlmToolDefinition';
1
2
  import type { string_knowledge_source_link } from '../../types/typeAliases';
2
3
  import type { TODO_any } from '../../utils/organization/TODO_any';
3
4
  /**
@@ -45,6 +46,10 @@ export type AgentModelRequirements = {
45
46
  * Top-k sampling value for the agent's responses
46
47
  */
47
48
  readonly topK?: number;
49
+ /**
50
+ * Tools available for the agent
51
+ */
52
+ readonly tools?: ReadonlyArray<LlmToolDefinition>;
48
53
  /**
49
54
  * Arbitrary metadata storage for commitments
50
55
  * Each commitment can store its own data here
@@ -3,4 +3,4 @@ import { CHAT_SAVE_FORMATS } from '../index';
3
3
  * Supported chat export formatNames
4
4
  * @public exported from `@promptbook/components`
5
5
  */
6
- export type string_chat_format_name = typeof CHAT_SAVE_FORMATS[number]['formatName'];
6
+ export type string_chat_format_name = (typeof CHAT_SAVE_FORMATS)[number]['formatName'];
@@ -3,4 +3,4 @@ import { COMMANDS } from '../../index';
3
3
  * Command is one piece of the book file section which adds some logic to the task or the whole pipeline.
4
4
  * It is parsed from the markdown from ul/ol items - one command per one item.
5
5
  */
6
- export type Command = ReturnType<typeof COMMANDS[number]['parse']>;
6
+ export type Command = ReturnType<(typeof COMMANDS)[number]['parse']>;
@@ -0,0 +1,41 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * META DESCRIPTION commitment definition
5
+ *
6
+ * The META DESCRIPTION commitment sets the agent's meta description for the profile page.
7
+ * This commitment is special because it doesn't affect the system message,
8
+ * but is handled separately in the parsing logic.
9
+ *
10
+ * Example usage in agent source:
11
+ *
12
+ * ```book
13
+ * META DESCRIPTION An AI assistant specialized in business tasks
14
+ * ```
15
+ *
16
+ * @private [🪔] Maybe export the commitments through some package
17
+ */
18
+ export declare class MetaDescriptionCommitmentDefinition extends BaseCommitmentDefinition<'META DESCRIPTION'> {
19
+ constructor();
20
+ /**
21
+ * Short one-line description of META DESCRIPTION.
22
+ */
23
+ get description(): string;
24
+ /**
25
+ * Icon for this commitment.
26
+ */
27
+ get icon(): string;
28
+ /**
29
+ * Markdown documentation for META DESCRIPTION commitment.
30
+ */
31
+ get documentation(): string;
32
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
33
+ /**
34
+ * Extracts the meta description from the content
35
+ * This is used by the parsing logic
36
+ */
37
+ extractMetaDescription(content: string): string | null;
38
+ }
39
+ /**
40
+ * Note: [💞] Ignore a discrepancy between file name and entity name
41
+ */
@@ -6,13 +6,13 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
6
6
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
7
7
  * to access and retrieve up-to-date information from the internet when necessary.
8
8
  *
9
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
9
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
10
10
  *
11
11
  * Example usage in agent source:
12
12
  *
13
13
  * ```book
14
14
  * USE SEARCH ENGINE
15
- * USE SEARCH ENGINE This will be ignored
15
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
16
16
  * ```
17
17
  *
18
18
  * @private [🪔] Maybe export the commitments through some package
@@ -2,4 +2,4 @@ import { COMMITMENT_REGISTRY } from '../index';
2
2
  /**
3
3
  * All available book commitment types
4
4
  */
5
- export type BookCommitment = typeof COMMITMENT_REGISTRY[number]['type'];
5
+ export type BookCommitment = (typeof COMMITMENT_REGISTRY)[number]['type'];
@@ -7,4 +7,4 @@ import { FORMFACTOR_DEFINITIONS } from '../index';
7
7
  * Note: [🚉] This is fully serializable as JSON
8
8
  * @see https://github.com/webgptorg/promptbook/discussions/172
9
9
  */
10
- export type FormfactorDefinition = typeof FORMFACTOR_DEFINITIONS[number];
10
+ export type FormfactorDefinition = (typeof FORMFACTOR_DEFINITIONS)[number];
@@ -21,7 +21,7 @@ export declare function $provideLlmToolsForTestingAndScriptsAndPlayground(option
21
21
  export {};
22
22
  /**
23
23
  * Note: [⚪] This should never be in any released package
24
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
24
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
25
25
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
26
26
  * TODO: [®] DRY Register logi
27
27
  */
@@ -51,7 +51,7 @@ export declare function $provideLlmToolsForWizardOrCli(options?: ProvideLlmTools
51
51
  export {};
52
52
  /**
53
53
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
54
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
54
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
55
55
  * TODO: [🥃] Allow `ptbk make` without llm tools
56
56
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
57
57
  * TODO: [®] DRY Register logic
@@ -17,6 +17,6 @@ export type LlmExecutionToolsWithTotalUsage = LlmExecutionTools & {
17
17
  spending(): Observable<Usage>;
18
18
  };
19
19
  /**
20
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
20
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
21
21
  * Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
22
22
  */
@@ -32,5 +32,5 @@ export {};
32
32
  * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
33
33
  * TODO: [🧠] Is there some meaningfull way how to test this util
34
34
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
35
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
35
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
36
36
  */
@@ -8,5 +8,5 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
8
8
  export declare function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools: undefined | LlmExecutionTools | ReadonlyArray<LlmExecutionTools>): LlmExecutionTools | MultipleLlmExecutionTools;
9
9
  /**
10
10
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
11
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
11
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
12
12
  */
@@ -19,5 +19,5 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
19
19
  export declare function joinLlmExecutionTools(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
20
20
  /**
21
21
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
22
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
22
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
23
23
  */
@@ -0,0 +1,8 @@
1
+ import type OpenAI from 'openai';
2
+ import type { LlmToolDefinition } from '../../../types/LlmToolDefinition';
3
+ /**
4
+ * Maps Promptbook tools to OpenAI tools.
5
+ *
6
+ * @private
7
+ */
8
+ export declare function mapToolsToOpenAi(tools: ReadonlyArray<LlmToolDefinition>): Array<OpenAI.Chat.Completions.ChatCompletionTool>;
@@ -1,18 +1,18 @@
1
1
  import type { string_url } from '../types/typeAliases';
2
2
  /**
3
- * @@@
3
+ * Represents a search result from a search engine.
4
4
  */
5
5
  export type SearchResult = {
6
6
  /**
7
- * @@@
7
+ * The title of the search result.
8
8
  */
9
9
  title: string;
10
10
  /**
11
- * @@@
11
+ * The URL of the search result.
12
12
  */
13
13
  url: string_url;
14
14
  /**
15
- * @@@
15
+ * A short snippet or description of the search result.
16
16
  */
17
17
  snippet: string;
18
18
  };
@@ -3,7 +3,7 @@ import type { string_markdown, string_markdown_text, string_title } from '../../
3
3
  import type { SearchEngine } from '../SearchEngine';
4
4
  import type { SearchResult } from '../SearchResult';
5
5
  /**
6
- * @@@
6
+ * A search engine implementation that uses the Bing Web Search API.
7
7
  *
8
8
  * @private <- TODO: !!!! Export via some package
9
9
  */
@@ -3,7 +3,7 @@ import type { string_markdown, string_markdown_text, string_title } from '../../
3
3
  import type { SearchEngine } from '../SearchEngine';
4
4
  import type { SearchResult } from '../SearchResult';
5
5
  /**
6
- * @@@
6
+ * A dummy implementation of SearchEngine for testing purposes.
7
7
  *
8
8
  * @private <- TODO: !!!! Export via some package, maybe `@promptbook/search-engines` or `@promptbook/fake-llm`
9
9
  */
@@ -0,0 +1,20 @@
1
+ import type { string_markdown_text, string_name } from './typeAliases';
2
+ /**
3
+ * Definition of a tool that can be used by the model
4
+ *
5
+ * Note: [🚉] This is fully serializable as JSON
6
+ */
7
+ export type LlmToolDefinition = {
8
+ /**
9
+ * Name of the tool
10
+ */
11
+ readonly name: string_name;
12
+ /**
13
+ * Description of the tool
14
+ */
15
+ readonly description: string_markdown_text;
16
+ /**
17
+ * Parameters of the tool in JSON Schema format
18
+ */
19
+ readonly parameters: Record<string, unknown>;
20
+ };
@@ -1,3 +1,4 @@
1
+ import type { LlmToolDefinition } from './LlmToolDefinition';
1
2
  import type { ModelVariant } from './ModelVariant';
2
3
  import type { number_model_temperature, number_seed, string_model_name, string_system_message } from './typeAliases';
3
4
  /**
@@ -28,6 +29,12 @@ export type CompletionModelRequirements = CommonModelRequirements & {
28
29
  * Maximum number of tokens that can be generated by the model
29
30
  */
30
31
  readonly maxTokens?: number;
32
+ /**
33
+ * Tools available for the model
34
+ *
35
+ * Note: [🚉] This is fully serializable as JSON
36
+ */
37
+ readonly tools?: LlmToolDefinition[];
31
38
  };
32
39
  /**
33
40
  * Model requirements for the chat variant
@@ -53,6 +60,12 @@ export type ChatModelRequirements = CommonModelRequirements & {
53
60
  * Maximum number of tokens that can be generated by the model
54
61
  */
55
62
  readonly maxTokens?: number;
63
+ /**
64
+ * Tools available for the model
65
+ *
66
+ * Note: [🚉] This is fully serializable as JSON
67
+ */
68
+ readonly tools?: LlmToolDefinition[];
56
69
  };
57
70
  /**
58
71
  * Model requirements for the image generation variant
@@ -6,4 +6,4 @@
6
6
  export declare function $randomItem<TItem>(...items: Array<TItem>): TItem;
7
7
  /**
8
8
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
9
- */
9
+ */
@@ -10,4 +10,4 @@ import type { number_seed } from '../../types/typeAliases';
10
10
  export declare function $randomSeed(): number_seed;
11
11
  /**
12
12
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
13
- */
13
+ */
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.104.0-10`).
18
+ * It follows semantic versioning (e.g., `0.104.0-12`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/wizard",
3
- "version": "0.104.0-11",
3
+ "version": "0.104.0-13",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/wizard.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.104.0-11"
98
+ "@promptbook/core": "0.104.0-13"
99
99
  },
100
100
  "dependencies": {
101
101
  "@ai-sdk/deepseek": "0.1.17",
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-11';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-13';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -5668,6 +5668,22 @@
5668
5668
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
5669
5669
  */
5670
5670
 
5671
+ /**
5672
+ * Maps Promptbook tools to OpenAI tools.
5673
+ *
5674
+ * @private
5675
+ */
5676
+ function mapToolsToOpenAi(tools) {
5677
+ return tools.map((tool) => ({
5678
+ type: 'function',
5679
+ function: {
5680
+ name: tool.name,
5681
+ description: tool.description,
5682
+ parameters: tool.parameters,
5683
+ },
5684
+ }));
5685
+ }
5686
+
5671
5687
  /**
5672
5688
  * Parses an OpenAI error message to identify which parameter is unsupported
5673
5689
  *
@@ -5865,6 +5881,9 @@
5865
5881
  },
5866
5882
  ],
5867
5883
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
5884
+ tools: currentModelRequirements.tools === undefined
5885
+ ? undefined
5886
+ : mapToolsToOpenAi(currentModelRequirements.tools),
5868
5887
  };
5869
5888
  const start = $getCurrentDate();
5870
5889
  if (this.options.isVerbose) {
@@ -6009,6 +6028,7 @@
6009
6028
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
6010
6029
  const rawRequest = {
6011
6030
  ...modelSettings,
6031
+ model: modelName,
6012
6032
  prompt: rawPromptContent,
6013
6033
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
6014
6034
  };
@@ -6263,8 +6283,8 @@
6263
6283
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
6264
6284
  const rawRequest = {
6265
6285
  ...modelSettings,
6266
- size: modelSettings.size || '1024x1024',
6267
6286
  prompt: rawPromptContent,
6287
+ size: modelSettings.size || '1024x1024',
6268
6288
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
6269
6289
  response_format: 'url', // TODO: [🧠] Maybe allow b64_json
6270
6290
  };
@@ -7162,6 +7182,7 @@
7162
7182
  thread: {
7163
7183
  messages: threadMessages,
7164
7184
  },
7185
+ tools: modelRequirements.tools === undefined ? undefined : mapToolsToOpenAi(modelRequirements.tools),
7165
7186
  // <- TODO: Add user identification here> user: this.options.user,
7166
7187
  };
7167
7188
  const start = $getCurrentDate();
@@ -9690,7 +9711,7 @@
9690
9711
  }
9691
9712
  /**
9692
9713
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
9693
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
9714
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
9694
9715
  */
9695
9716
 
9696
9717
  /**
@@ -9707,7 +9728,7 @@
9707
9728
  }
9708
9729
  /**
9709
9730
  * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
9710
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
9731
+ * TODO: [👷‍♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
9711
9732
  */
9712
9733
 
9713
9734
  /**
@@ -14248,9 +14269,7 @@
14248
14269
  // Get existing dictionary entries from metadata
14249
14270
  const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
14250
14271
  // Merge the new dictionary entry with existing entries
14251
- const mergedDictionary = existingDictionary
14252
- ? `${existingDictionary}\n${trimmedContent}`
14253
- : trimmedContent;
14272
+ const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
14254
14273
  // Store the merged dictionary in metadata for debugging and inspection
14255
14274
  const updatedMetadata = {
14256
14275
  ...requirements.metadata,
@@ -16779,19 +16798,37 @@
16779
16798
  `);
16780
16799
  }
16781
16800
  applyToAgentModelRequirements(requirements, content) {
16782
- // We simply mark that browser capability is enabled in metadata
16783
- // Get existing metadata
16784
- const existingMetadata = requirements.metadata || {};
16785
16801
  // Get existing tools array or create new one
16786
- const existingTools = existingMetadata.tools || [];
16787
- // Add 'browser' to tools if not already present
16788
- const updatedTools = existingTools.includes('browser') ? existingTools : [...existingTools, 'browser'];
16789
- // Return requirements with updated metadata
16802
+ const existingTools = requirements.tools || [];
16803
+ // Add 'web_browser' to tools if not already present
16804
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
16805
+ ? existingTools
16806
+ : [
16807
+ ...existingTools,
16808
+ {
16809
+ name: 'web_browser',
16810
+ description: spaceTrim$1.spaceTrim(`
16811
+ A tool that can browse the web.
16812
+ Use this tool when you need to access specific websites or browse the internet.
16813
+ `),
16814
+ parameters: {
16815
+ type: 'object',
16816
+ properties: {
16817
+ url: {
16818
+ type: 'string',
16819
+ description: 'The URL to browse',
16820
+ },
16821
+ },
16822
+ required: ['url'],
16823
+ },
16824
+ },
16825
+ ];
16826
+ // Return requirements with updated tools and metadata
16790
16827
  return {
16791
16828
  ...requirements,
16829
+ tools: updatedTools,
16792
16830
  metadata: {
16793
- ...existingMetadata,
16794
- tools: updatedTools,
16831
+ ...requirements.metadata,
16795
16832
  useBrowser: true,
16796
16833
  },
16797
16834
  };
@@ -16884,13 +16921,13 @@
16884
16921
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
16885
16922
  * to access and retrieve up-to-date information from the internet when necessary.
16886
16923
  *
16887
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
16924
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
16888
16925
  *
16889
16926
  * Example usage in agent source:
16890
16927
  *
16891
16928
  * ```book
16892
16929
  * USE SEARCH ENGINE
16893
- * USE SEARCH ENGINE This will be ignored
16930
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
16894
16931
  * ```
16895
16932
  *
16896
16933
  * @private [🪔] Maybe export the commitments through some package
@@ -16922,7 +16959,7 @@
16922
16959
 
16923
16960
  ## Key aspects
16924
16961
 
16925
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
16962
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
16926
16963
  - The actual search engine tool usage is handled by the agent runtime
16927
16964
  - Allows the agent to search for current information from the web
16928
16965
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -16947,20 +16984,39 @@
16947
16984
  `);
16948
16985
  }
16949
16986
  applyToAgentModelRequirements(requirements, content) {
16950
- // We simply mark that search engine capability is enabled in metadata
16951
- // Get existing metadata
16952
- const existingMetadata = requirements.metadata || {};
16953
16987
  // Get existing tools array or create new one
16954
- const existingTools = existingMetadata.tools || [];
16955
- // Add 'search-engine' to tools if not already present
16956
- const updatedTools = existingTools.includes('search-engine') ? existingTools : [...existingTools, 'search-engine'];
16957
- // Return requirements with updated metadata
16988
+ const existingTools = requirements.tools || [];
16989
+ // Add 'web_search' to tools if not already present
16990
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
16991
+ ? existingTools
16992
+ : [
16993
+ ...existingTools,
16994
+ {
16995
+ name: 'web_search',
16996
+ description: spaceTrim$1.spaceTrim(`
16997
+ Search the internet for information.
16998
+ Use this tool when you need to find up-to-date information or facts that you don't know.
16999
+ ${!content ? '' : `Search scope / instructions: ${content}`}
17000
+ `),
17001
+ parameters: {
17002
+ type: 'object',
17003
+ properties: {
17004
+ query: {
17005
+ type: 'string',
17006
+ description: 'The search query',
17007
+ },
17008
+ },
17009
+ required: ['query'],
17010
+ },
17011
+ },
17012
+ ];
17013
+ // Return requirements with updated tools and metadata
16958
17014
  return {
16959
17015
  ...requirements,
17016
+ tools: updatedTools,
16960
17017
  metadata: {
16961
- ...existingMetadata,
16962
- tools: updatedTools,
16963
- useSearchEngine: true,
17018
+ ...requirements.metadata,
17019
+ useSearchEngine: content || true,
16964
17020
  },
16965
17021
  };
16966
17022
  }
@@ -18006,6 +18062,10 @@
18006
18062
  meta.image = spaceTrim__default["default"](commitment.content);
18007
18063
  continue;
18008
18064
  }
18065
+ if (commitment.type === 'META DESCRIPTION') {
18066
+ meta.description = spaceTrim__default["default"](commitment.content);
18067
+ continue;
18068
+ }
18009
18069
  if (commitment.type === 'META COLOR') {
18010
18070
  meta.color = normalizeSeparator(commitment.content);
18011
18071
  continue;
@@ -19481,7 +19541,7 @@
19481
19541
  }
19482
19542
  /**
19483
19543
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
19484
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
19544
+ * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
19485
19545
  * TODO: [🥃] Allow `ptbk make` without llm tools
19486
19546
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
19487
19547
  * TODO: [®] DRY Register logic
@@ -21254,7 +21314,12 @@
21254
21314
  * @see {@link ModelVariant}
21255
21315
  * @public exported from `@promptbook/core`
21256
21316
  */
21257
- const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'IMAGE_GENERATION', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
21317
+ const MODEL_VARIANTS = [
21318
+ 'COMPLETION',
21319
+ 'CHAT',
21320
+ 'IMAGE_GENERATION',
21321
+ 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */,
21322
+ ];
21258
21323
 
21259
21324
  /**
21260
21325
  * Parses the model command
@@ -23780,7 +23845,9 @@
23780
23845
  // ▶ Create executor - the function that will execute the Pipeline
23781
23846
  const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
23782
23847
  // 🚀▶ Execute the Pipeline
23783
- const result = await pipelineExecutor(inputParameters).asPromise({ isCrashedOnError: true });
23848
+ const result = await pipelineExecutor(inputParameters).asPromise({
23849
+ isCrashedOnError: true,
23850
+ });
23784
23851
  const { outputParameters } = result;
23785
23852
  const outputParametersLength = Object.keys(outputParameters).length;
23786
23853
  let resultString;