Skip to content

v0.5.84: model request sanitization#3166

Merged
waleedlatif1 merged 1 commit intomainfrom
staging
Feb 8, 2026
Merged

v0.5.84: model request sanitization#3166
waleedlatif1 merged 1 commit intomainfrom
staging

Conversation

@waleedlatif1
Copy link
Collaborator

@vercel
Copy link

vercel bot commented Feb 8, 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 8, 2026 3:05am

Request Review

@waleedlatif1 waleedlatif1 merged commit 6c66521 into main Feb 8, 2026
15 checks passed
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 8, 2026

Greptile Overview

Greptile Summary

Extended request sanitization to filter out model-specific parameters (reasoningEffort, verbosity, thinkingLevel) based on model capabilities, preventing API errors when unsupported parameters are sent to providers.

  • Added three new capability check functions (supportsReasoningEffort, supportsVerbosity, supportsThinking) that determine if a model supports specific parameters
  • Updated sanitizeRequest function to strip unsupported parameters before sending requests to providers
  • Added comprehensive test coverage for all three new capability check functions

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes follow established patterns (similar to existing supportsTemperature function), include comprehensive test coverage with multiple test cases for each new function, and implement defensive parameter sanitization that prevents API errors without changing existing behavior
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/providers/utils.ts Added three capability check functions (supportsReasoningEffort, supportsVerbosity, supportsThinking) and corresponding model constant arrays to enable model-specific feature filtering
apps/sim/providers/utils.test.ts Added comprehensive test coverage for the three new capability check functions with positive, negative, and case-insensitivity test cases
apps/sim/providers/index.ts Extended sanitizeRequest to strip unsupported model parameters (reasoningEffort, verbosity, thinkingLevel) based on model capabilities, preventing API errors

Sequence Diagram

sequenceDiagram
    participant Client
    participant executeProviderRequest
    participant sanitizeRequest
    participant supportsTemperature
    participant supportsReasoningEffort
    participant supportsVerbosity
    participant supportsThinking
    participant Provider

    Client->>executeProviderRequest: ProviderRequest
    executeProviderRequest->>sanitizeRequest: request
    
    sanitizeRequest->>supportsTemperature: model
    supportsTemperature-->>sanitizeRequest: boolean
    alt temperature not supported
        sanitizeRequest->>sanitizeRequest: remove temperature
    end
    
    sanitizeRequest->>supportsReasoningEffort: model
    supportsReasoningEffort-->>sanitizeRequest: boolean
    alt reasoningEffort not supported
        sanitizeRequest->>sanitizeRequest: remove reasoningEffort
    end
    
    sanitizeRequest->>supportsVerbosity: model
    supportsVerbosity-->>sanitizeRequest: boolean
    alt verbosity not supported
        sanitizeRequest->>sanitizeRequest: remove verbosity
    end
    
    sanitizeRequest->>supportsThinking: model
    supportsThinking-->>sanitizeRequest: boolean
    alt thinkingLevel not supported
        sanitizeRequest->>sanitizeRequest: remove thinkingLevel
    end
    
    sanitizeRequest-->>executeProviderRequest: sanitizedRequest
    executeProviderRequest->>Provider: sanitizedRequest
    Provider-->>executeProviderRequest: response
    executeProviderRequest-->>Client: response
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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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