Skip to content

feat(models): updated model configs, updated anthropic provider to propagate errors back to user if any#3159

Merged
waleedlatif1 merged 9 commits intostagingfrom
feat/tool-calls
Feb 7, 2026
Merged

feat(models): updated model configs, updated anthropic provider to propagate errors back to user if any#3159
waleedlatif1 merged 9 commits intostagingfrom
feat/tool-calls

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • updated model configs
  • updated anthropic provider to propagate errors back to user if any & to stream under the hood and wait for the final message to avoid low non-streaming limit
  • added custom base url support for openai

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 7, 2026 5:00am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 7, 2026

Greptile Overview

Greptile Summary

Updated model configurations and improved error handling across multiple AI providers. Key changes include:

Model Configuration Updates

  • Simplified maxOutputTokens from object structure to single number across all models
  • Updated context windows (o3: 128k→200k, o4-mini: 128k→200k, o1-preview: 400k→128k)
  • Changed default thinking levels from 'medium' to 'high' for Claude Sonnet models
  • Added 'auto' option for reasoning effort and verbosity parameters
  • Added 'none' option for thinking level to allow explicit disabling
  • Moved reasoning effort, verbosity, thinking level, temperature, and max tokens to advanced mode in agent block UI
  • Updated pricing for various models (Azure o3, Claude 3 Haiku cached input)

Anthropic Provider Improvements

  • Added createMessage() helper that automatically uses streaming internally when max_tokens exceeds 21,333 (SDK non-streaming threshold) to prevent HTTP timeouts
  • Enhanced thinking configuration with proper constraint handling (budget_tokens must be less than max_tokens, adjusted automatically)
  • Added compatibility checks: thinking mode disables temperature and limits tool_choice to 'auto'/'none' only
  • Preserved thinking blocks during tool use loops to maintain reasoning continuity
  • Improved type safety with proper Anthropic SDK types throughout
  • Error handling now propagates errors with enhanced timing metadata

OpenAI/Azure Provider Improvements

  • Added checks to skip 'auto' values for reasoningEffort and verbosity to prevent sending invalid parameter values to API
  • Improved type safety by replacing any with proper OpenAI SDK types and Record<string, unknown>
  • Enhanced schema validation with stricter typing in enforceStrictSchema function

Other Provider Updates

  • Bedrock: added support for 'any' tool choice type, included pricing in cost objects
  • Gemini: changed to only activate thinking when user explicitly selects level (no longer uses model defaults)

Type Safety & Code Quality

  • Replaced numerous any types with proper typed interfaces and Records
  • Removed redundant comments and improved code clarity
  • Fixed OpenAI model pattern regex from /^o1/ to /^o\d/ to properly match o-series models

Confidence Score: 4/5

  • This PR is safe to merge with low risk - primarily configuration updates and type safety improvements
  • Score reflects well-structured refactoring with improved type safety and error handling. The changes address real API constraints (Anthropic SDK streaming threshold, thinking mode compatibility rules). Minor concern: temperature silently overridden when thinking enabled without warning user
  • Pay attention to apps/sim/providers/anthropic/core.ts for the temperature override behavior when thinking is enabled

Important Files Changed

Filename Overview
apps/sim/providers/anthropic/core.ts Improved type safety with proper Anthropic SDK types, added createMessage helper to handle SDK streaming threshold (21333 tokens), enhanced thinking configuration with temperature/tool_choice compatibility checks, preserved thinking blocks during tool loops
apps/sim/providers/models.ts Simplified maxOutputTokens from object to number, updated model configurations (context windows, default thinking levels), added 'auto' option for reasoning effort/verbosity, fixed OpenAI model pattern regex, updated pricing
apps/sim/providers/openai/core.ts Enhanced type safety with proper typing for schema operations, added checks to skip 'auto' values for reasoningEffort and verbosity parameters to avoid sending invalid values to API
apps/sim/executor/handlers/agent/agent-handler.ts Added thinkingLevel parameter to agent handler, removed redundant comments, propagated thinking level through provider requests
apps/sim/blocks/blocks/agent.ts Added 'auto' option to reasoning effort and verbosity dropdowns, 'none' option to thinking level, moved these fields to advanced mode, removed default values to let users choose explicitly
apps/sim/providers/gemini/core.ts Changed thinking configuration to only activate when user explicitly selects thinking level (instead of using model defaults), added 'none' check

Sequence Diagram

sequenceDiagram
    participant User
    participant AgentBlock
    participant AgentHandler
    participant ProviderRegistry
    participant AnthropicProvider
    participant OpenAIProvider
    participant ModelConfig

    User->>AgentBlock: Configure agent (model, thinkingLevel, reasoningEffort, etc)
    AgentBlock->>AgentHandler: Execute with inputs
    
    AgentHandler->>AgentHandler: Build provider request
    Note over AgentHandler: Add thinkingLevel parameter
    
    AgentHandler->>ProviderRegistry: Route request to provider
    
    alt Anthropic Provider
        ProviderRegistry->>AnthropicProvider: executeRequest()
        AnthropicProvider->>ModelConfig: getMaxOutputTokensForModel()
        ModelConfig-->>AnthropicProvider: maxTokens (simplified from object to number)
        
        AnthropicProvider->>AnthropicProvider: Build thinking config (if thinkingLevel !== 'none')
        Note over AnthropicProvider: Check compatibility:<br/>- Adjust max_tokens for budget_tokens<br/>- Set temperature=undefined<br/>- Limit tool_choice to 'auto'/'none'
        
        AnthropicProvider->>AnthropicProvider: createMessage() helper
        Note over AnthropicProvider: Auto-switch to streaming<br/>if max_tokens > 21333
        
        AnthropicProvider->>AnthropicProvider: Preserve thinking blocks in tool loops
        AnthropicProvider-->>AgentHandler: Response with enhanced error handling
    else OpenAI/Azure Provider
        ProviderRegistry->>OpenAIProvider: executeRequest()
        OpenAIProvider->>OpenAIProvider: Skip 'auto' for reasoningEffort/verbosity
        Note over OpenAIProvider: Prevent invalid API values
        OpenAIProvider-->>AgentHandler: Response with improved typing
    end
    
    AgentHandler-->>User: Final response with tokens, cost, timing
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 99ae543 into staging Feb 7, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/tool-calls branch February 7, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant