@promptbook/wizard 0.100.0-3 → 0.100.0-32

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 (59) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +343 -94
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +24 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +30 -0
  7. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  8. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  9. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  10. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
  11. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
  12. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/FrontendRAGService.d.ts +48 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +51 -0
  14. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/RAGService.d.ts +54 -0
  15. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/BaseKnowledgeProcessor.d.ts +45 -0
  16. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/PdfProcessor.d.ts +31 -0
  17. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/ProcessorFactory.d.ts +23 -0
  18. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/TextProcessor.d.ts +18 -0
  19. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/types.d.ts +56 -0
  20. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/utils/ragHelper.d.ts +34 -0
  21. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
  22. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
  23. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
  24. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
  25. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
  26. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
  27. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
  28. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
  29. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
  30. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  31. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
  32. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
  33. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  34. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  35. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  36. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  37. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +61 -0
  38. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +35 -0
  39. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  40. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  41. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  42. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  43. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  44. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +26 -0
  45. package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
  46. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
  47. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -5
  48. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  51. package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  53. package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
  54. package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
  55. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  56. package/esm/typings/src/version.d.ts +1 -1
  57. package/package.json +2 -2
  58. package/umd/index.umd.js +343 -94
  59. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  * @generated
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-3';
52
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-32';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1713,7 +1713,7 @@
1713
1713
  /**
1714
1714
  * List of available Anthropic Claude models with pricing
1715
1715
  *
1716
- * Note: Done at 2025-05-06
1716
+ * Note: Synced with official API docs at 2025-08-20
1717
1717
  *
1718
1718
  * @see https://docs.anthropic.com/en/docs/models-overview
1719
1719
  * @public exported from `@promptbook/anthropic-claude`
@@ -1723,12 +1723,52 @@
1723
1723
  value: [
1724
1724
  {
1725
1725
  modelVariant: 'CHAT',
1726
- modelTitle: 'Claude 3.5 Sonnet',
1727
- modelName: 'claude-3-5-sonnet-20240620',
1728
- modelDescription: 'Latest Claude model with 200K token context window. Features state-of-the-art reasoning capabilities, sophisticated code generation, and enhanced multilingual understanding. Offers superior accuracy with 30% fewer hallucinations than Claude 3 Sonnet. Provides exceptional performance for complex enterprise applications while maintaining fast response times.',
1726
+ modelTitle: 'Claude Opus 4.1',
1727
+ modelName: 'claude-opus-4-1-20250805',
1728
+ modelDescription: 'Most powerful and capable Claude model with 200K token context window. Features superior reasoning capabilities, exceptional coding abilities, and advanced multimodal understanding. Sets new standards in complex reasoning and analytical tasks with enhanced safety measures. Ideal for the most demanding enterprise applications requiring maximum intelligence.',
1729
1729
  pricing: {
1730
- prompt: pricing(`$2.50 / 1M tokens`),
1731
- output: pricing(`$12.50 / 1M tokens`),
1730
+ prompt: pricing(`$15.00 / 1M tokens`),
1731
+ output: pricing(`$75.00 / 1M tokens`),
1732
+ },
1733
+ },
1734
+ {
1735
+ modelVariant: 'CHAT',
1736
+ modelTitle: 'Claude Opus 4',
1737
+ modelName: 'claude-opus-4-20250514',
1738
+ modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications.',
1739
+ pricing: {
1740
+ prompt: pricing(`$15.00 / 1M tokens`),
1741
+ output: pricing(`$75.00 / 1M tokens`),
1742
+ },
1743
+ },
1744
+ {
1745
+ modelVariant: 'CHAT',
1746
+ modelTitle: 'Claude Sonnet 4',
1747
+ modelName: 'claude-sonnet-4-20250514',
1748
+ modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities.',
1749
+ pricing: {
1750
+ prompt: pricing(`$3.00 / 1M tokens`),
1751
+ output: pricing(`$15.00 / 1M tokens`),
1752
+ },
1753
+ },
1754
+ {
1755
+ modelVariant: 'CHAT',
1756
+ modelTitle: 'Claude Sonnet 3.7',
1757
+ modelName: 'claude-3-7-sonnet-20250219',
1758
+ modelDescription: 'High-performance Claude model with early extended thinking capabilities and 200K token context window. Features enhanced reasoning chains, improved factual accuracy, and toggleable extended thinking for complex problem-solving. Ideal for applications requiring deep analytical capabilities.',
1759
+ pricing: {
1760
+ prompt: pricing(`$3.00 / 1M tokens`),
1761
+ output: pricing(`$15.00 / 1M tokens`),
1762
+ },
1763
+ },
1764
+ {
1765
+ modelVariant: 'CHAT',
1766
+ modelTitle: 'Claude Haiku 3.5',
1767
+ modelName: 'claude-3-5-haiku-20241022',
1768
+ modelDescription: 'Fastest Claude model with 200K token context window optimized for intelligence at blazing speeds. Features enhanced reasoning and contextual understanding while maintaining sub-second response times. Perfect for real-time applications, customer-facing deployments, and high-throughput services.',
1769
+ pricing: {
1770
+ prompt: pricing(`$0.80 / 1M tokens`),
1771
+ output: pricing(`$4.00 / 1M tokens`),
1732
1772
  },
1733
1773
  },
1734
1774
  {
@@ -2434,8 +2474,7 @@
2434
2474
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
2435
2475
  const rawRequest = {
2436
2476
  model: modelRequirements.modelName || this.getDefaultChatModel().modelName,
2437
- max_tokens: modelRequirements.maxTokens || 4096,
2438
- // <- TODO: [🌾] Make some global max cap for maxTokens
2477
+ max_tokens: modelRequirements.maxTokens || 8192,
2439
2478
  temperature: modelRequirements.temperature,
2440
2479
  system: modelRequirements.systemMessage,
2441
2480
  messages: [
@@ -2494,59 +2533,6 @@
2494
2533
  },
2495
2534
  });
2496
2535
  }
2497
- /**
2498
- * Calls Anthropic Claude API to use a completion model.
2499
- */
2500
- async callCompletionModel(prompt) {
2501
- if (this.options.isVerbose) {
2502
- console.info('🖋 Anthropic Claude callCompletionModel call');
2503
- }
2504
- const { content, parameters, modelRequirements } = prompt;
2505
- if (modelRequirements.modelVariant !== 'COMPLETION') {
2506
- throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
2507
- }
2508
- const client = await this.getClient();
2509
- const modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
2510
- const rawPromptContent = templateParameters(content, { ...parameters, modelName });
2511
- const rawRequest = {
2512
- model: modelName,
2513
- max_tokens_to_sample: modelRequirements.maxTokens || 2000,
2514
- temperature: modelRequirements.temperature,
2515
- prompt: rawPromptContent,
2516
- };
2517
- const start = $getCurrentDate();
2518
- const rawResponse = await this.limiter
2519
- .schedule(() => client.completions.create(rawRequest))
2520
- .catch((error) => {
2521
- if (this.options.isVerbose) {
2522
- console.info(colors__default["default"].bgRed('error'), error);
2523
- }
2524
- throw error;
2525
- });
2526
- if (this.options.isVerbose) {
2527
- console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
2528
- }
2529
- if (!rawResponse.completion) {
2530
- throw new PipelineExecutionError('No completion from Anthropic Claude');
2531
- }
2532
- const resultContent = rawResponse.completion;
2533
- const complete = $getCurrentDate();
2534
- const usage = computeAnthropicClaudeUsage(rawPromptContent, resultContent, rawResponse);
2535
- return exportJson({
2536
- name: 'promptResult',
2537
- message: `Result of \`AnthropicClaudeExecutionTools.callCompletionModel\``,
2538
- order: [],
2539
- value: {
2540
- content: resultContent,
2541
- modelName: rawResponse.model || modelName,
2542
- timing: { start, complete },
2543
- usage,
2544
- rawPromptContent,
2545
- rawRequest,
2546
- rawResponse,
2547
- },
2548
- });
2549
- }
2550
2536
  // <- Note: [🤖] callXxxModel
2551
2537
  /**
2552
2538
  * Get the model that should be used as default
@@ -2568,7 +2554,7 @@
2568
2554
  * Default model for chat variant.
2569
2555
  */
2570
2556
  getDefaultChatModel() {
2571
- return this.getDefaultModel('claude-3-5-sonnet');
2557
+ return this.getDefaultModel('claude-sonnet-4-20250514');
2572
2558
  }
2573
2559
  }
2574
2560
  /**
@@ -2711,7 +2697,7 @@
2711
2697
  /**
2712
2698
  * List of available OpenAI models with pricing
2713
2699
  *
2714
- * Note: Done at 2025-05-06
2700
+ * Note: Synced with official API docs at 2025-08-20
2715
2701
  *
2716
2702
  * @see https://platform.openai.com/docs/models/
2717
2703
  * @see https://openai.com/api/pricing/
@@ -2720,6 +2706,138 @@
2720
2706
  const OPENAI_MODELS = exportJson({
2721
2707
  name: 'OPENAI_MODELS',
2722
2708
  value: [
2709
+ /**/
2710
+ {
2711
+ modelVariant: 'CHAT',
2712
+ modelTitle: 'gpt-5',
2713
+ modelName: 'gpt-5',
2714
+ modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
2715
+ pricing: {
2716
+ prompt: pricing(`$1.25 / 1M tokens`),
2717
+ output: pricing(`$10.00 / 1M tokens`),
2718
+ },
2719
+ },
2720
+ /**/
2721
+ /**/
2722
+ {
2723
+ modelVariant: 'CHAT',
2724
+ modelTitle: 'gpt-5-mini',
2725
+ modelName: 'gpt-5-mini',
2726
+ modelDescription: "A faster, cost-efficient version of GPT-5 for well-defined tasks with 200K context window. Maintains core GPT-5 capabilities while offering 5x faster inference and significantly lower costs. Features enhanced instruction following and reduced latency for production applications requiring quick responses with high quality.",
2727
+ pricing: {
2728
+ prompt: pricing(`$0.25 / 1M tokens`),
2729
+ output: pricing(`$2.00 / 1M tokens`),
2730
+ },
2731
+ },
2732
+ /**/
2733
+ /**/
2734
+ {
2735
+ modelVariant: 'CHAT',
2736
+ modelTitle: 'gpt-5-nano',
2737
+ modelName: 'gpt-5-nano',
2738
+ modelDescription: "The fastest, most cost-efficient version of GPT-5 with 200K context window. Optimized for summarization, classification, and simple reasoning tasks. Features 10x faster inference than base GPT-5 while maintaining good quality for straightforward applications. Ideal for high-volume, cost-sensitive deployments.",
2739
+ pricing: {
2740
+ prompt: pricing(`$0.05 / 1M tokens`),
2741
+ output: pricing(`$0.40 / 1M tokens`),
2742
+ },
2743
+ },
2744
+ /**/
2745
+ /**/
2746
+ {
2747
+ modelVariant: 'CHAT',
2748
+ modelTitle: 'gpt-4.1',
2749
+ modelName: 'gpt-4.1',
2750
+ modelDescription: "Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.",
2751
+ pricing: {
2752
+ prompt: pricing(`$3.00 / 1M tokens`),
2753
+ output: pricing(`$12.00 / 1M tokens`),
2754
+ },
2755
+ },
2756
+ /**/
2757
+ /**/
2758
+ {
2759
+ modelVariant: 'CHAT',
2760
+ modelTitle: 'gpt-4.1-mini',
2761
+ modelName: 'gpt-4.1-mini',
2762
+ modelDescription: "Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.",
2763
+ pricing: {
2764
+ prompt: pricing(`$0.80 / 1M tokens`),
2765
+ output: pricing(`$3.20 / 1M tokens`),
2766
+ },
2767
+ },
2768
+ /**/
2769
+ /**/
2770
+ {
2771
+ modelVariant: 'CHAT',
2772
+ modelTitle: 'gpt-4.1-nano',
2773
+ modelName: 'gpt-4.1-nano',
2774
+ modelDescription: "Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.",
2775
+ pricing: {
2776
+ prompt: pricing(`$0.20 / 1M tokens`),
2777
+ output: pricing(`$0.80 / 1M tokens`),
2778
+ },
2779
+ },
2780
+ /**/
2781
+ /**/
2782
+ {
2783
+ modelVariant: 'CHAT',
2784
+ modelTitle: 'o3',
2785
+ modelName: 'o3',
2786
+ modelDescription: "Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.",
2787
+ pricing: {
2788
+ prompt: pricing(`$15.00 / 1M tokens`),
2789
+ output: pricing(`$60.00 / 1M tokens`),
2790
+ },
2791
+ },
2792
+ /**/
2793
+ /**/
2794
+ {
2795
+ modelVariant: 'CHAT',
2796
+ modelTitle: 'o3-pro',
2797
+ modelName: 'o3-pro',
2798
+ modelDescription: "Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.",
2799
+ pricing: {
2800
+ prompt: pricing(`$30.00 / 1M tokens`),
2801
+ output: pricing(`$120.00 / 1M tokens`),
2802
+ },
2803
+ },
2804
+ /**/
2805
+ /**/
2806
+ {
2807
+ modelVariant: 'CHAT',
2808
+ modelTitle: 'o4-mini',
2809
+ modelName: 'o4-mini',
2810
+ modelDescription: "Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.",
2811
+ pricing: {
2812
+ prompt: pricing(`$4.00 / 1M tokens`),
2813
+ output: pricing(`$16.00 / 1M tokens`),
2814
+ },
2815
+ },
2816
+ /**/
2817
+ /**/
2818
+ {
2819
+ modelVariant: 'CHAT',
2820
+ modelTitle: 'o3-deep-research',
2821
+ modelName: 'o3-deep-research',
2822
+ modelDescription: "Most powerful deep research model with 128K context window. Specialized for comprehensive research tasks, literature analysis, and complex information synthesis. Features advanced citation capabilities and enhanced factual accuracy for academic and professional research applications.",
2823
+ pricing: {
2824
+ prompt: pricing(`$25.00 / 1M tokens`),
2825
+ output: pricing(`$100.00 / 1M tokens`),
2826
+ },
2827
+ },
2828
+ /**/
2829
+ /**/
2830
+ {
2831
+ modelVariant: 'CHAT',
2832
+ modelTitle: 'o4-mini-deep-research',
2833
+ modelName: 'o4-mini-deep-research',
2834
+ modelDescription: "Faster, more affordable deep research model with 128K context window. Balances research capabilities with cost efficiency, offering good performance on literature review, fact-checking, and information synthesis tasks at a more accessible price point.",
2835
+ pricing: {
2836
+ prompt: pricing(`$12.00 / 1M tokens`),
2837
+ output: pricing(`$48.00 / 1M tokens`),
2838
+ },
2839
+ },
2840
+ /**/
2723
2841
  /*/
2724
2842
  {
2725
2843
  modelTitle: 'dall-e-3',
@@ -3240,7 +3358,6 @@
3240
3358
  const modelName = prompt.modelRequirements.modelName || this.options.deploymentName;
3241
3359
  const modelSettings = {
3242
3360
  maxTokens: modelRequirements.maxTokens,
3243
- // <- TODO: [🌾] Make some global max cap for maxTokens
3244
3361
  temperature: modelRequirements.temperature,
3245
3362
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
3246
3363
  // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
@@ -3346,8 +3463,7 @@
3346
3463
  try {
3347
3464
  const modelName = prompt.modelRequirements.modelName || this.options.deploymentName;
3348
3465
  const modelSettings = {
3349
- maxTokens: modelRequirements.maxTokens || 2000,
3350
- // <- TODO: [🌾] Make some global max cap for maxTokens
3466
+ maxTokens: modelRequirements.maxTokens,
3351
3467
  temperature: modelRequirements.temperature,
3352
3468
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
3353
3469
  // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
@@ -3731,7 +3847,7 @@
3731
3847
  /**
3732
3848
  * List of available Deepseek models with descriptions
3733
3849
  *
3734
- * Note: Done at 2025-05-06
3850
+ * Note: Synced with official API docs at 2025-08-20
3735
3851
  *
3736
3852
  * @see https://www.deepseek.com/models
3737
3853
  * @public exported from `@promptbook/deepseek`
@@ -3741,12 +3857,32 @@
3741
3857
  value: [
3742
3858
  {
3743
3859
  modelVariant: 'CHAT',
3744
- modelTitle: 'Deepseek Chat Pro',
3745
- modelName: 'deepseek-chat-pro',
3746
- modelDescription: 'Latest flagship general-purpose model with 256K context window. Enhanced from base Chat model with 40% improvement on complex reasoning tasks and specialized domain knowledge. Features advanced prompt optimization and improved contextual memory. Ideal for enterprise applications requiring highest quality responses.',
3860
+ modelTitle: 'DeepSeek V3',
3861
+ modelName: 'deepseek-chat',
3862
+ modelDescription: 'Latest flagship general-purpose model with 128K context window. Features exceptional reasoning capabilities, advanced code generation, and strong performance across diverse domains. Offers competitive performance with leading models while maintaining cost efficiency. Ideal for complex reasoning, coding, and knowledge-intensive tasks.',
3747
3863
  pricing: {
3748
- prompt: pricing(`$1.20 / 1M tokens`),
3749
- output: pricing(`$2.40 / 1M tokens`),
3864
+ prompt: pricing(`$0.14 / 1M tokens`),
3865
+ output: pricing(`$0.28 / 1M tokens`),
3866
+ },
3867
+ },
3868
+ {
3869
+ modelVariant: 'CHAT',
3870
+ modelTitle: 'DeepSeek R1',
3871
+ modelName: 'deepseek-reasoner',
3872
+ modelDescription: 'Advanced reasoning model with 128K context window specializing in complex problem-solving and analytical thinking. Features explicit reasoning chains, enhanced mathematical capabilities, and superior performance on STEM tasks. Designed for applications requiring deep analytical reasoning and step-by-step problem solving.',
3873
+ pricing: {
3874
+ prompt: pricing(`$0.55 / 1M tokens`),
3875
+ output: pricing(`$2.19 / 1M tokens`),
3876
+ },
3877
+ },
3878
+ {
3879
+ modelVariant: 'CHAT',
3880
+ modelTitle: 'DeepSeek Coder V2',
3881
+ modelName: 'deepseek-coder',
3882
+ modelDescription: 'Specialized coding model with 128K context window optimized for software development tasks. Features exceptional code generation, debugging, and refactoring capabilities across 40+ programming languages. Particularly strong in understanding complex codebases and implementing solutions based on natural language specifications.',
3883
+ pricing: {
3884
+ prompt: pricing(`$0.14 / 1M tokens`),
3885
+ output: pricing(`$0.28 / 1M tokens`),
3750
3886
  },
3751
3887
  },
3752
3888
  {
@@ -3980,7 +4116,7 @@
3980
4116
  /**
3981
4117
  * List of available Google models with descriptions
3982
4118
  *
3983
- * Note: Done at 2025-05-06
4119
+ * Note: Synced with official API docs at 2025-08-20
3984
4120
  *
3985
4121
  * @see https://ai.google.dev/models/gemini
3986
4122
  * @public exported from `@promptbook/google`
@@ -3991,11 +4127,51 @@
3991
4127
  {
3992
4128
  modelVariant: 'CHAT',
3993
4129
  modelTitle: 'Gemini 2.5 Pro',
3994
- modelName: 'gemini-2.5-pro-preview-03-25',
3995
- modelDescription: 'Latest advanced multimodal model with 1M token context window. Features exceptional reasoning across complex tasks, sophisticated function calling, and advanced image analysis (16MP resolution). Demonstrates superior performance in math, coding, and knowledge-intensive tasks with 30% improvement over Gemini 1.5 Pro. Ideal for enterprise applications requiring deep contextual understanding.',
4130
+ modelName: 'gemini-2.5-pro',
4131
+ modelDescription: 'State-of-the-art thinking model with 1M token context window capable of reasoning over complex problems in code, math, and STEM. Features enhanced thinking capabilities, advanced multimodal understanding, and superior performance on analytical tasks. Ideal for complex enterprise applications requiring maximum intelligence and reasoning.',
3996
4132
  pricing: {
3997
- prompt: pricing(`$8.00 / 1M tokens`),
3998
- output: pricing(`$24.00 / 1M tokens`),
4133
+ prompt: pricing(`$7.00 / 1M tokens`),
4134
+ output: pricing(`$21.00 / 1M tokens`),
4135
+ },
4136
+ },
4137
+ {
4138
+ modelVariant: 'CHAT',
4139
+ modelTitle: 'Gemini 2.5 Flash',
4140
+ modelName: 'gemini-2.5-flash',
4141
+ modelDescription: 'Best model in terms of price-performance with 1M token context window offering well-rounded capabilities. Features adaptive thinking, cost efficiency, and enhanced reasoning for large-scale processing. Ideal for low-latency, high-volume tasks that require thinking and agentic use cases.',
4142
+ pricing: {
4143
+ prompt: pricing(`$0.35 / 1M tokens`),
4144
+ output: pricing(`$1.05 / 1M tokens`),
4145
+ },
4146
+ },
4147
+ {
4148
+ modelVariant: 'CHAT',
4149
+ modelTitle: 'Gemini 2.5 Flash Lite',
4150
+ modelName: 'gemini-2.5-flash-lite',
4151
+ modelDescription: 'Cost-efficient Gemini 2.5 Flash model optimized for high throughput with 1M token context window. Features thinking capabilities while maintaining the most cost-efficient pricing. Perfect for real-time, low-latency use cases requiring good quality at scale.',
4152
+ pricing: {
4153
+ prompt: pricing(`$0.20 / 1M tokens`),
4154
+ output: pricing(`$0.60 / 1M tokens`),
4155
+ },
4156
+ },
4157
+ {
4158
+ modelVariant: 'CHAT',
4159
+ modelTitle: 'Gemini 2.0 Flash',
4160
+ modelName: 'gemini-2.0-flash',
4161
+ modelDescription: 'Next-generation model with 1M token context window delivering improved capabilities, superior speed, and realtime streaming. Features enhanced function calling, code execution, and search capabilities. Ideal for applications requiring cutting-edge AI capabilities with fast response times.',
4162
+ pricing: {
4163
+ prompt: pricing(`$0.25 / 1M tokens`),
4164
+ output: pricing(`$0.75 / 1M tokens`),
4165
+ },
4166
+ },
4167
+ {
4168
+ modelVariant: 'CHAT',
4169
+ modelTitle: 'Gemini 2.0 Flash Lite',
4170
+ modelName: 'gemini-2.0-flash-lite',
4171
+ modelDescription: 'Cost-efficient Gemini 2.0 Flash model optimized for low latency with 1M token context window. Balances performance and cost with enhanced efficiency for high-volume applications. Perfect for applications requiring good quality responses at minimal cost.',
4172
+ pricing: {
4173
+ prompt: pricing(`$0.15 / 1M tokens`),
4174
+ output: pricing(`$0.45 / 1M tokens`),
3999
4175
  },
4000
4176
  },
4001
4177
  {
@@ -4436,7 +4612,6 @@
4436
4612
  const modelSettings = {
4437
4613
  model: modelName,
4438
4614
  max_tokens: modelRequirements.maxTokens,
4439
- // <- TODO: [🌾] Make some global max cap for maxTokens
4440
4615
  temperature: modelRequirements.temperature,
4441
4616
  // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
4442
4617
  // <- Note: [🧆]
@@ -4532,8 +4707,7 @@
4532
4707
  const modelName = modelRequirements.modelName || this.getDefaultCompletionModel().modelName;
4533
4708
  const modelSettings = {
4534
4709
  model: modelName,
4535
- max_tokens: modelRequirements.maxTokens || 2000,
4536
- // <- TODO: [🌾] Make some global max cap for maxTokens
4710
+ max_tokens: modelRequirements.maxTokens,
4537
4711
  temperature: modelRequirements.temperature,
4538
4712
  // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
4539
4713
  // <- Note: [🧆]
@@ -4682,7 +4856,7 @@
4682
4856
  /**
4683
4857
  * List of available models in Ollama library
4684
4858
  *
4685
- * Note: Done at 2025-05-19
4859
+ * Note: Synced with official API docs at 2025-08-20
4686
4860
  *
4687
4861
  * @see https://ollama.com/library
4688
4862
  * @public exported from `@promptbook/ollama`
@@ -4690,6 +4864,24 @@
4690
4864
  const OLLAMA_MODELS = exportJson({
4691
4865
  name: 'OLLAMA_MODELS',
4692
4866
  value: [
4867
+ {
4868
+ modelVariant: 'CHAT',
4869
+ modelTitle: 'llama3.3',
4870
+ modelName: 'llama3.3',
4871
+ modelDescription: 'Meta Llama 3.3 (70B parameters) with 128K context window. Latest generation foundation model with significantly enhanced reasoning, instruction following, and multilingual capabilities. Features improved performance on complex tasks and better factual accuracy compared to Llama 3.1.',
4872
+ },
4873
+ {
4874
+ modelVariant: 'CHAT',
4875
+ modelTitle: 'llama3.2',
4876
+ modelName: 'llama3.2',
4877
+ modelDescription: 'Meta Llama 3.2 (1B-90B parameters) with 128K context window. Enhanced model with improved reasoning capabilities, better instruction following, and multimodal support in larger variants. Features significant performance improvements over Llama 3.1 across diverse tasks.',
4878
+ },
4879
+ {
4880
+ modelVariant: 'CHAT',
4881
+ modelTitle: 'llama3.1',
4882
+ modelName: 'llama3.1',
4883
+ modelDescription: 'Meta Llama 3.1 (8B-405B parameters) with 128K context window. Advanced foundation model with enhanced reasoning, improved multilingual capabilities, and better performance on complex tasks. Features significant improvements in code generation and mathematical reasoning.',
4884
+ },
4693
4885
  {
4694
4886
  modelVariant: 'CHAT',
4695
4887
  modelTitle: 'llama3',
@@ -5184,7 +5376,7 @@
5184
5376
  * Default model for chat variant.
5185
5377
  */
5186
5378
  getDefaultChatModel() {
5187
- return this.getDefaultModel('gpt-4-turbo');
5379
+ return this.getDefaultModel('gpt-5');
5188
5380
  }
5189
5381
  /**
5190
5382
  * Default model for completion variant.
@@ -5252,8 +5444,6 @@
5252
5444
  const modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
5253
5445
  const modelSettings = {
5254
5446
  model: modelName,
5255
- max_tokens: modelRequirements.maxTokens,
5256
- // <- TODO: [🌾] Make some global max cap for maxTokens
5257
5447
 
5258
5448
  temperature: modelRequirements.temperature,
5259
5449
 
@@ -5974,7 +6164,23 @@
5974
6164
  .join('/') +
5975
6165
  '.' +
5976
6166
  extension;
5977
- await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
6167
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
6168
+ try {
6169
+ await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
6170
+ }
6171
+ catch (error) {
6172
+ // Note: If we can't create cache directory, continue without it
6173
+ // This handles read-only filesystems, permission issues, and missing parent directories
6174
+ if (error instanceof Error && (error.message.includes('EROFS') ||
6175
+ error.message.includes('read-only') ||
6176
+ error.message.includes('EACCES') ||
6177
+ error.message.includes('EPERM') ||
6178
+ error.message.includes('ENOENT'))) ;
6179
+ else {
6180
+ // Re-throw other unexpected errors
6181
+ throw error;
6182
+ }
6183
+ }
5978
6184
  let isDestroyed = true;
5979
6185
  const fileHandler = {
5980
6186
  filename: cacheFilename,
@@ -7738,7 +7944,23 @@
7738
7944
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
7739
7945
  const rootDirname = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
7740
7946
  const filepath = path.join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
7741
- await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
7947
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
7948
+ try {
7949
+ await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
7950
+ }
7951
+ catch (error) {
7952
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
7953
+ // This handles read-only filesystems, permission issues, and missing parent directories
7954
+ if (error instanceof Error && (error.message.includes('EROFS') ||
7955
+ error.message.includes('read-only') ||
7956
+ error.message.includes('EACCES') ||
7957
+ error.message.includes('EPERM') ||
7958
+ error.message.includes('ENOENT'))) ;
7959
+ else {
7960
+ // Re-throw other unexpected errors
7961
+ throw error;
7962
+ }
7963
+ }
7742
7964
  const fileContent = Buffer.from(await response.arrayBuffer());
7743
7965
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
7744
7966
  throw new LimitReachedError(`File is too large (${Math.round(fileContent.length / 1024 / 1024)}MB). Maximum allowed size is ${Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024)}MB.`);
@@ -7753,7 +7975,8 @@
7753
7975
  if (error instanceof Error && (error.message.includes('EROFS') ||
7754
7976
  error.message.includes('read-only') ||
7755
7977
  error.message.includes('EACCES') ||
7756
- error.message.includes('EPERM'))) {
7978
+ error.message.includes('EPERM') ||
7979
+ error.message.includes('ENOENT'))) {
7757
7980
  // Return a handler that works directly with the downloaded content
7758
7981
  return {
7759
7982
  source: name,
@@ -8898,7 +9121,7 @@
8898
9121
  */
8899
9122
  async function executeAttempts(options) {
8900
9123
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
8901
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, } = options;
9124
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
8902
9125
  const $ongoingTaskResult = {
8903
9126
  $result: null,
8904
9127
  $resultString: null,
@@ -9142,6 +9365,10 @@
9142
9365
  result: $ongoingTaskResult.$resultString,
9143
9366
  error: error,
9144
9367
  });
9368
+ // Report failed attempt
9369
+ onProgress({
9370
+ errors: [error],
9371
+ });
9145
9372
  }
9146
9373
  finally {
9147
9374
  if (!isJokerAttempt &&
@@ -10860,7 +11087,8 @@
10860
11087
  if (error instanceof Error && (error.message.includes('EROFS') ||
10861
11088
  error.message.includes('read-only') ||
10862
11089
  error.message.includes('EACCES') ||
10863
- error.message.includes('EPERM'))) ;
11090
+ error.message.includes('EPERM') ||
11091
+ error.message.includes('ENOENT'))) ;
10864
11092
  else {
10865
11093
  // Re-throw other unexpected errors
10866
11094
  throw error;
@@ -11163,7 +11391,8 @@
11163
11391
  if (error instanceof Error && (error.message.includes('EROFS') ||
11164
11392
  error.message.includes('read-only') ||
11165
11393
  error.message.includes('EACCES') ||
11166
- error.message.includes('EPERM'))) ;
11394
+ error.message.includes('EPERM') ||
11395
+ error.message.includes('ENOENT'))) ;
11167
11396
  else {
11168
11397
  // Re-throw other unexpected errors
11169
11398
  throw error;
@@ -11909,8 +12138,27 @@
11909
12138
  throw new UnexpectedError(`The "${key}" you want to store in JSON file is not serializable as JSON`);
11910
12139
  }
11911
12140
  const fileContent = stringifyPipelineJson(value);
11912
- await promises.mkdir(path.dirname(filename), { recursive: true }); // <- [0]
11913
- await promises.writeFile(filename, fileContent, 'utf-8');
12141
+ // Note: Try to create cache directory and write file, but don't fail if filesystem is read-only or has permission issues
12142
+ try {
12143
+ await promises.mkdir(path.dirname(filename), { recursive: true }); // <- [0]
12144
+ await promises.writeFile(filename, fileContent, 'utf-8');
12145
+ }
12146
+ catch (error) {
12147
+ // Note: If we can't write to cache, silently ignore the error
12148
+ // This handles read-only filesystems, permission issues, and missing parent directories
12149
+ if (error instanceof Error && (error.message.includes('EROFS') ||
12150
+ error.message.includes('read-only') ||
12151
+ error.message.includes('EACCES') ||
12152
+ error.message.includes('EPERM') ||
12153
+ error.message.includes('ENOENT'))) {
12154
+ // Silently ignore filesystem errors - caching is optional
12155
+ return;
12156
+ }
12157
+ else {
12158
+ // Re-throw other unexpected errors
12159
+ throw error;
12160
+ }
12161
+ }
11914
12162
  }
11915
12163
  /**
11916
12164
  * Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
@@ -16790,7 +17038,8 @@
16790
17038
  if (error instanceof Error && (error.message.includes('EROFS') ||
16791
17039
  error.message.includes('read-only') ||
16792
17040
  error.message.includes('EACCES') ||
16793
- error.message.includes('EPERM'))) ;
17041
+ error.message.includes('EPERM') ||
17042
+ error.message.includes('ENOENT'))) ;
16794
17043
  else {
16795
17044
  // Re-throw other unexpected errors
16796
17045
  throw error;