@promptbook/components 0.104.0-10 β†’ 0.104.0-12

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 (40) hide show
  1. package/esm/index.es.js +159 -38
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -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/types/ChatMessage.d.ts +2 -2
  8. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  9. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
  10. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
  11. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
  12. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
  13. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
  14. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
  15. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
  16. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -2
  17. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -54
  18. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  19. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  20. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  21. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  23. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -1
  24. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  25. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  26. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
  28. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  29. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
  30. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  31. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  32. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  33. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  34. package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
  35. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  36. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +3 -2
  37. package/esm/typings/src/version.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/umd/index.umd.js +159 -38
  40. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
35
35
  * @generated
36
36
  * @see https://github.com/webgptorg/promptbook
37
37
  */
38
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
39
39
  /**
40
40
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
41
41
  * Note: [πŸ’ž] Ignore a discrepancy between file name and entity name
@@ -6713,19 +6713,37 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
6713
6713
  `);
6714
6714
  }
6715
6715
  applyToAgentModelRequirements(requirements, content) {
6716
- // We simply mark that browser capability is enabled in metadata
6717
- // Get existing metadata
6718
- const existingMetadata = requirements.metadata || {};
6719
6716
  // Get existing tools array or create new one
6720
- const existingTools = existingMetadata.tools || [];
6721
- // Add 'browser' to tools if not already present
6722
- const updatedTools = existingTools.includes('browser') ? existingTools : [...existingTools, 'browser'];
6723
- // Return requirements with updated metadata
6717
+ const existingTools = requirements.tools || [];
6718
+ // Add 'web_browser' to tools if not already present
6719
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
6720
+ ? existingTools
6721
+ : [
6722
+ ...existingTools,
6723
+ {
6724
+ name: 'web_browser',
6725
+ description: spaceTrim$1(`
6726
+ A tool that can browse the web.
6727
+ Use this tool when you need to access specific websites or browse the internet.
6728
+ `),
6729
+ parameters: {
6730
+ type: 'object',
6731
+ properties: {
6732
+ url: {
6733
+ type: 'string',
6734
+ description: 'The URL to browse',
6735
+ },
6736
+ },
6737
+ required: ['url'],
6738
+ },
6739
+ },
6740
+ ];
6741
+ // Return requirements with updated tools and metadata
6724
6742
  return {
6725
6743
  ...requirements,
6744
+ tools: updatedTools,
6726
6745
  metadata: {
6727
- ...existingMetadata,
6728
- tools: updatedTools,
6746
+ ...requirements.metadata,
6729
6747
  useBrowser: true,
6730
6748
  },
6731
6749
  };
@@ -6818,13 +6836,13 @@ class UseMcpCommitmentDefinition extends BaseCommitmentDefinition {
6818
6836
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
6819
6837
  * to access and retrieve up-to-date information from the internet when necessary.
6820
6838
  *
6821
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
6839
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
6822
6840
  *
6823
6841
  * Example usage in agent source:
6824
6842
  *
6825
6843
  * ```book
6826
6844
  * USE SEARCH ENGINE
6827
- * USE SEARCH ENGINE This will be ignored
6845
+ * USE SEARCH ENGINE Hledej informace o PΕ™emyslovcΓ­ch
6828
6846
  * ```
6829
6847
  *
6830
6848
  * @private [πŸͺ”] Maybe export the commitments through some package
@@ -6856,7 +6874,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
6856
6874
 
6857
6875
  ## Key aspects
6858
6876
 
6859
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
6877
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
6860
6878
  - The actual search engine tool usage is handled by the agent runtime
6861
6879
  - Allows the agent to search for current information from the web
6862
6880
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -6881,20 +6899,39 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
6881
6899
  `);
6882
6900
  }
6883
6901
  applyToAgentModelRequirements(requirements, content) {
6884
- // We simply mark that search engine capability is enabled in metadata
6885
- // Get existing metadata
6886
- const existingMetadata = requirements.metadata || {};
6887
6902
  // Get existing tools array or create new one
6888
- const existingTools = existingMetadata.tools || [];
6889
- // Add 'search-engine' to tools if not already present
6890
- const updatedTools = existingTools.includes('search-engine') ? existingTools : [...existingTools, 'search-engine'];
6891
- // Return requirements with updated metadata
6903
+ const existingTools = requirements.tools || [];
6904
+ // Add 'web_search' to tools if not already present
6905
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
6906
+ ? existingTools
6907
+ : [
6908
+ ...existingTools,
6909
+ {
6910
+ name: 'web_search',
6911
+ description: spaceTrim$1(`
6912
+ Search the internet for information.
6913
+ Use this tool when you need to find up-to-date information or facts that you don't know.
6914
+ ${!content ? '' : `Search scope / instructions: ${content}`}
6915
+ `),
6916
+ parameters: {
6917
+ type: 'object',
6918
+ properties: {
6919
+ query: {
6920
+ type: 'string',
6921
+ description: 'The search query',
6922
+ },
6923
+ },
6924
+ required: ['query'],
6925
+ },
6926
+ },
6927
+ ];
6928
+ // Return requirements with updated tools and metadata
6892
6929
  return {
6893
6930
  ...requirements,
6931
+ tools: updatedTools,
6894
6932
  metadata: {
6895
- ...existingMetadata,
6896
- tools: updatedTools,
6897
- useSearchEngine: true,
6933
+ ...requirements.metadata,
6934
+ useSearchEngine: content || true,
6898
6935
  },
6899
6936
  };
6900
6937
  }
@@ -7317,7 +7354,57 @@ function parseAgentSource(agentSource) {
7317
7354
  }
7318
7355
  const meta = {};
7319
7356
  const links = [];
7357
+ const capabilities = [];
7320
7358
  for (const commitment of parseResult.commitments) {
7359
+ if (commitment.type === 'USE BROWSER') {
7360
+ capabilities.push({
7361
+ type: 'browser',
7362
+ label: 'Browser',
7363
+ iconName: 'Globe',
7364
+ });
7365
+ continue;
7366
+ }
7367
+ if (commitment.type === 'USE SEARCH ENGINE') {
7368
+ capabilities.push({
7369
+ type: 'search-engine',
7370
+ label: 'Search Internet',
7371
+ iconName: 'Search',
7372
+ });
7373
+ continue;
7374
+ }
7375
+ if (commitment.type === 'KNOWLEDGE') {
7376
+ const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
7377
+ let label = content;
7378
+ let iconName = 'Book';
7379
+ if (content.startsWith('http://') || content.startsWith('https://')) {
7380
+ try {
7381
+ const url = new URL(content);
7382
+ if (url.pathname.endsWith('.pdf')) {
7383
+ label = url.pathname.split('/').pop() || 'Document.pdf';
7384
+ iconName = 'FileText';
7385
+ }
7386
+ else {
7387
+ label = url.hostname.replace(/^www\./, '');
7388
+ }
7389
+ }
7390
+ catch (e) {
7391
+ // Invalid URL, treat as text
7392
+ }
7393
+ }
7394
+ else {
7395
+ // Text content - take first few words
7396
+ const words = content.split(/\s+/);
7397
+ if (words.length > 4) {
7398
+ label = words.slice(0, 4).join(' ') + '...';
7399
+ }
7400
+ }
7401
+ capabilities.push({
7402
+ type: 'knowledge',
7403
+ label,
7404
+ iconName,
7405
+ });
7406
+ continue;
7407
+ }
7321
7408
  if (commitment.type === 'META LINK') {
7322
7409
  const linkValue = spaceTrim$2(commitment.content);
7323
7410
  links.push(linkValue);
@@ -7328,6 +7415,10 @@ function parseAgentSource(agentSource) {
7328
7415
  meta.image = spaceTrim$2(commitment.content);
7329
7416
  continue;
7330
7417
  }
7418
+ if (commitment.type === 'META DESCRIPTION') {
7419
+ meta.description = spaceTrim$2(commitment.content);
7420
+ continue;
7421
+ }
7331
7422
  if (commitment.type === 'META COLOR') {
7332
7423
  meta.color = normalizeSeparator(commitment.content);
7333
7424
  continue;
@@ -7364,6 +7455,7 @@ function parseAgentSource(agentSource) {
7364
7455
  meta,
7365
7456
  links,
7366
7457
  parameters,
7458
+ capabilities,
7367
7459
  };
7368
7460
  }
7369
7461
  /**
@@ -7725,7 +7817,7 @@ var styles$5 = {"MarkdownContent":"MarkdownContent-module_MarkdownContent__2JuyX
7725
7817
  styleInject(css_248z$6);
7726
7818
 
7727
7819
  /**
7728
- * @@@
7820
+ * Creates a showdown converter configured for chat markdown rendering
7729
7821
  *
7730
7822
  * @private utility of `MarkdownContent` component
7731
7823
  */
@@ -7773,13 +7865,13 @@ function createChatMarkdownConverter() {
7773
7865
  });
7774
7866
  }
7775
7867
  /**
7776
- * @@@
7868
+ * Pre-configured showdown converter for chat markdown
7777
7869
  *
7778
7870
  * @private utility of `MarkdownContent` component
7779
7871
  */
7780
7872
  const chatMarkdownConverter = createChatMarkdownConverter();
7781
7873
  /**
7782
- * @@@
7874
+ * Renders math expressions in markdown using KaTeX
7783
7875
  *
7784
7876
  * @private utility of `MarkdownContent` component
7785
7877
  */
@@ -7976,7 +8068,7 @@ function AboutPromptbookInformation(props) {
7976
8068
  }
7977
8069
 
7978
8070
  /**
7979
- * @@@
8071
+ * Renders an about icon
7980
8072
  *
7981
8073
  * @private internal subcomponent used by various components
7982
8074
  */
@@ -7986,7 +8078,7 @@ function AboutIcon(props) {
7986
8078
  }
7987
8079
 
7988
8080
  /**
7989
- * @@@
8081
+ * Renders an attachment icon
7990
8082
  *
7991
8083
  * @public exported from `@promptbook/components`
7992
8084
  */
@@ -7995,7 +8087,7 @@ function AttachmentIcon({ size = 24, color = 'currentColor' }) {
7995
8087
  }
7996
8088
 
7997
8089
  /**
7998
- * @@@
8090
+ * Renders a camera icon
7999
8091
  *
8000
8092
  * @public exported from `@promptbook/components`
8001
8093
  */
@@ -8004,7 +8096,7 @@ function CameraIcon({ size = 24, color = 'currentColor' }) {
8004
8096
  }
8005
8097
 
8006
8098
  /**
8007
- * @@@
8099
+ * Renders a download icon
8008
8100
  *
8009
8101
  * @private internal subcomponent used by various components
8010
8102
  */
@@ -8098,7 +8190,7 @@ var styles$4 = {"MenuHamburger":"HamburgerMenu-module_MenuHamburger__Jd-wk","Men
8098
8190
  styleInject(css_248z$5);
8099
8191
 
8100
8192
  /**
8101
- * @@@
8193
+ * An animated hamburger menu button component.
8102
8194
  *
8103
8195
  * @private Internal component
8104
8196
  */
@@ -8111,7 +8203,7 @@ var styles$3 = {"dropdown":"Dropdown-module_dropdown__ZShv1","button":"Dropdown-
8111
8203
  styleInject(css_248z$4);
8112
8204
 
8113
8205
  /**
8114
- * @@@
8206
+ * A dropdown menu component that displays a list of actions triggered by a hamburger menu button.
8115
8207
  *
8116
8208
  * @private internal subcomponent used by various components
8117
8209
  */
@@ -9034,7 +9126,7 @@ const MicIcon = ({ size }) => (jsxs("svg", { width: size, height: size, viewBox:
9034
9126
  const ResetIcon = () => (jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4L17.65,6.35z" }) }));
9035
9127
 
9036
9128
  /**
9037
- * @@@
9129
+ * Renders a save icon
9038
9130
  *
9039
9131
  * @public exported from `@promptbook/components`
9040
9132
  */
@@ -11387,7 +11479,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
11387
11479
  }
11388
11480
  /**
11389
11481
  * TODO: [πŸ™†] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
11390
- * TODO: [πŸ‘·β€β™‚οΈ] @@@ Manual about construction of llmTools
11482
+ * TODO: [πŸ‘·β€β™‚οΈ] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
11391
11483
  */
11392
11484
 
11393
11485
  /**
@@ -11404,7 +11496,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
11404
11496
  }
11405
11497
  /**
11406
11498
  * TODO: [πŸ™†] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
11407
- * TODO: [πŸ‘·β€β™‚οΈ] @@@ Manual about construction of llmTools
11499
+ * TODO: [πŸ‘·β€β™‚οΈ] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
11408
11500
  */
11409
11501
 
11410
11502
  var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [πŸ†] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [πŸ†] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
@@ -12476,7 +12568,7 @@ function countUsage(llmTools) {
12476
12568
  * TODO: [🧠] Is there some meaningfull way how to test this util
12477
12569
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
12478
12570
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
12479
- * TODO: [πŸ‘·β€β™‚οΈ] @@@ Manual about construction of llmTools
12571
+ * TODO: [πŸ‘·β€β™‚οΈ] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
12480
12572
  */
12481
12573
 
12482
12574
  /**
@@ -16174,6 +16266,22 @@ resultContent, rawResponse) {
16174
16266
  * TODO: [🀝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
16175
16267
  */
16176
16268
 
16269
+ /**
16270
+ * Maps Promptbook tools to OpenAI tools.
16271
+ *
16272
+ * @private
16273
+ */
16274
+ function mapToolsToOpenAi(tools) {
16275
+ return tools.map((tool) => ({
16276
+ type: 'function',
16277
+ function: {
16278
+ name: tool.name,
16279
+ description: tool.description,
16280
+ parameters: tool.parameters,
16281
+ },
16282
+ }));
16283
+ }
16284
+
16177
16285
  /**
16178
16286
  * Parses an OpenAI error message to identify which parameter is unsupported
16179
16287
  *
@@ -16371,6 +16479,9 @@ class OpenAiCompatibleExecutionTools {
16371
16479
  },
16372
16480
  ],
16373
16481
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
16482
+ tools: currentModelRequirements.tools === undefined
16483
+ ? undefined
16484
+ : mapToolsToOpenAi(currentModelRequirements.tools),
16374
16485
  };
16375
16486
  const start = $getCurrentDate();
16376
16487
  if (this.options.isVerbose) {
@@ -16515,6 +16626,7 @@ class OpenAiCompatibleExecutionTools {
16515
16626
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
16516
16627
  const rawRequest = {
16517
16628
  ...modelSettings,
16629
+ model: modelName,
16518
16630
  prompt: rawPromptContent,
16519
16631
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
16520
16632
  };
@@ -16769,8 +16881,8 @@ class OpenAiCompatibleExecutionTools {
16769
16881
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
16770
16882
  const rawRequest = {
16771
16883
  ...modelSettings,
16772
- size: modelSettings.size || '1024x1024',
16773
16884
  prompt: rawPromptContent,
16885
+ size: modelSettings.size || '1024x1024',
16774
16886
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
16775
16887
  response_format: 'url', // TODO: [🧠] Maybe allow b64_json
16776
16888
  };
@@ -17172,6 +17284,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
17172
17284
  thread: {
17173
17285
  messages: threadMessages,
17174
17286
  },
17287
+ tools: modelRequirements.tools === undefined ? undefined : mapToolsToOpenAi(modelRequirements.tools),
17175
17288
  // <- TODO: Add user identification here> user: this.options.user,
17176
17289
  };
17177
17290
  const start = $getCurrentDate();
@@ -17695,6 +17808,8 @@ class AgentLlmExecutionTools {
17695
17808
  modelRequirements: {
17696
17809
  ...chatPrompt.modelRequirements,
17697
17810
  ...modelRequirements,
17811
+ // Spread tools to convert readonly array to mutable
17812
+ tools: modelRequirements.tools ? [...modelRequirements.tools] : chatPrompt.modelRequirements.tools,
17698
17813
  // Prepend agent system message to existing system message
17699
17814
  systemMessage: modelRequirements.systemMessage +
17700
17815
  (chatPrompt.modelRequirements.systemMessage
@@ -17788,6 +17903,11 @@ class Agent extends AgentLlmExecutionTools {
17788
17903
  * Links found in the agent source
17789
17904
  */
17790
17905
  this.links = [];
17906
+ /**
17907
+ * Capabilities of the agent
17908
+ * This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
17909
+ */
17910
+ this.capabilities = [];
17791
17911
  /**
17792
17912
  * Metadata like image or color
17793
17913
  */
@@ -17797,11 +17917,12 @@ class Agent extends AgentLlmExecutionTools {
17797
17917
  this.agentSource = agentSource;
17798
17918
  this.agentSource.subscribe((source) => {
17799
17919
  this.updateAgentSource(source);
17800
- const { agentName, personaDescription, initialMessage, links, meta } = parseAgentSource(source);
17920
+ const { agentName, personaDescription, initialMessage, links, meta, capabilities } = parseAgentSource(source);
17801
17921
  this._agentName = agentName;
17802
17922
  this.personaDescription = personaDescription;
17803
17923
  this.initialMessage = initialMessage;
17804
17924
  this.links = links;
17925
+ this.capabilities = capabilities;
17805
17926
  this.meta = { ...this.meta, ...meta };
17806
17927
  });
17807
17928
  }