Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • update router & evaluator to handle azure creds the same way the agent block does

Type of Change

  • Bug fix

Testing

Tested manually. Added unit tests.

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 Dec 24, 2025

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 24, 2025 5:59pm

@waleedlatif1 waleedlatif1 marked this pull request as ready for review December 24, 2025 18:08
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 24, 2025

Greptile Summary

Updated Router and Evaluator blocks to handle Azure OpenAI credentials consistently with the Agent block implementation.

Key Changes:

  • Added Azure OpenAI credential support (azureEndpoint and azureApiVersion) to Router and Evaluator handlers
  • Centralized credential validation using the getApiKey() utility function for non-Vertex providers
  • Changed default model from gpt-4o to claude-sonnet-4-5 for Router and Evaluator blocks
  • Added vLLM models to the model selection options in block configurations
  • Added comprehensive unit tests covering Azure OpenAI, Vertex AI OAuth, and credential validation scenarios
  • Minor code style cleanup in wait-handler (removed unnecessary braces)

Implementation Quality:
The changes follow the established pattern from the Agent block, ensuring consistent credential handling across all block types. The implementation properly handles three credential scenarios: Vertex AI OAuth (using database-stored tokens), Azure OpenAI (using endpoint + version), and standard providers (using direct credentials). Error handling is consistent with proper logging and informative error messages.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured, follow existing patterns from the Agent block, include comprehensive test coverage for all new credential scenarios, and properly handle error cases. The implementation is consistent across both Router and Evaluator handlers.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/executor/handlers/router/router-handler.ts Added Azure OpenAI credential handling with azureEndpoint and azureApiVersion support, plus centralized API key validation using getApiKey() utility
apps/sim/executor/handlers/evaluator/evaluator-handler.ts Added Azure OpenAI credential handling with azureEndpoint and azureApiVersion support, plus centralized API key validation using getApiKey() utility
apps/sim/executor/handlers/router/router-handler.test.ts Added comprehensive test coverage for Azure OpenAI credentials, Vertex AI OAuth, API key validation, and default model usage
apps/sim/executor/handlers/evaluator/evaluator-handler.test.ts Added comprehensive test coverage for Azure OpenAI credentials, Vertex AI OAuth, API key validation, and default model usage
apps/sim/executor/constants.ts Changed default model from gpt-4o to claude-sonnet-4-5 for both Router and Evaluator blocks

Sequence Diagram

sequenceDiagram
    participant User
    participant RouterBlock
    participant EvaluatorBlock
    participant ValidationUtil
    participant ProviderAPI
    
    Note over User,ProviderAPI: Router/Evaluator Block Execution with Azure Support
    
    User->>RouterBlock: execute(inputs with model)
    RouterBlock->>RouterBlock: getProviderFromModel(model)
    
    alt Vertex AI Model
        RouterBlock->>RouterBlock: resolveVertexCredential(credentialId)
        RouterBlock->>RouterBlock: fetch OAuth token from DB
    else Azure OpenAI Model
        RouterBlock->>ValidationUtil: getApiKey(providerId, model, userInput)
        ValidationUtil-->>RouterBlock: validated credentials
        RouterBlock->>RouterBlock: set azureEndpoint and azureApiVersion
    else Other Providers
        RouterBlock->>ValidationUtil: getApiKey(providerId, model, userInput)
        ValidationUtil-->>RouterBlock: validated credentials
    end
    
    RouterBlock->>ProviderAPI: POST /api/providers (with config)
    ProviderAPI-->>RouterBlock: response
    RouterBlock-->>User: BlockOutput
    
    Note over User,ProviderAPI: Same flow applies to EvaluatorBlock
Loading

@waleedlatif1 waleedlatif1 merged commit cb8b9c5 into staging Dec 24, 2025
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/router branch December 24, 2025 18:22
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.

2 participants