-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(evaluator): fix evaluator to handle temperature gracefully like router #1792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Fixed temperature handling in evaluator block to prevent type errors by hardcoding the value to 0.1, matching the router block's approach.
Key Changes:
- Removed
value: () => '0.1'from temperature slider definition in evaluator block, which was returning a string instead of a number - Hardcoded
temperature: 0.1in the evaluator handler's provider request, consistent with router handler implementation - Removed unused
temperaturefield from router config object for cleaner code
Technical Context:
The evaluator block had a value: () => '0.1' function that returned a string, but the handler expected a number type. This caused type mismatches when inputs.temperature || 0 was used. The router block already handled this correctly by hardcoding the temperature value in the provider request. This fix aligns both blocks to use the same pattern.
Confidence Score: 5/5
- This PR is safe to merge with no risk
- The fix is straightforward and correct - it removes a type mismatch issue by hardcoding temperature to 0.1 (consistent with router implementation). The changes are minimal, well-scoped, and follow existing patterns in the codebase. No logical errors, security issues, or breaking changes introduced.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/blocks/blocks/evaluator.ts | 5/5 | Removed string return value from temperature slider, allowing it to return proper number type |
| apps/sim/executor/handlers/evaluator/evaluator-handler.ts | 5/5 | Hardcoded temperature to 0.1, matching router pattern and avoiding type issues from input |
| apps/sim/executor/handlers/router/router-handler.ts | 5/5 | Removed unused temperature from config object for cleaner code |
Sequence Diagram
sequenceDiagram
participant UI as Evaluator Block UI
participant Handler as EvaluatorBlockHandler
participant API as Provider API
Note over UI: Temperature slider removed<br/>value: () => '0.1'
UI->>Handler: execute(block, inputs, context)
Note over Handler: inputs.temperature could be string<br/>causing type errors
Handler->>Handler: Create evaluatorConfig<br/>{model, apiKey}
Handler->>Handler: Process content & metrics
Handler->>Handler: Build providerRequest<br/>temperature: 0.1 (hardcoded)
Handler->>API: POST /api/providers
API-->>Handler: Response with evaluation
Handler-->>UI: BlockOutput with scores
3 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Fixed type mismatch in evaluator temperature handling by removing string default value and hardcoding numeric constant.
Key Changes:
- Removed
value: () => '0.1'from temperature slider inevaluator.tsthat was returning string instead of number - Hardcoded
temperature: 0.1inevaluator-handler.tsto match router pattern and ensure correct type - Changed content field from
short-inputtolong-inputfor better UX - Enhanced eval-input component with tag dropdown support for variable references and drag-drop functionality
- Added text overlay rendering to variables-input for improved visibility of references in object/array types
Impact:
The temperature value was previously passed as a string "0.1" to the Provider API, which could cause type errors or unexpected behavior. The fix ensures temperature is consistently passed as a number 0.1, matching the router block implementation.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are well-structured and fix a clear type mismatch bug. The temperature fix follows the established router pattern, the UI enhancements are isolated and follow existing patterns in the codebase, and the author has manually tested the changes
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/blocks/blocks/evaluator.ts | 5/5 | Removed problematic string default value for temperature field and changed content input from short to long |
| apps/sim/executor/handlers/evaluator/evaluator-handler.ts | 5/5 | Hardcoded temperature to 0.1 as number, matching router pattern and fixing type mismatch |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/eval-input.tsx | 5/5 | Enhanced with tag dropdown support, variable references, and drag-drop functionality for description field |
Sequence Diagram
sequenceDiagram
participant UI as Evaluator Block UI
participant Config as Block Config
participant Handler as Evaluator Handler
participant API as Provider API
Note over Config: Temperature field removed<br/>default value: "0.1" (string)
UI->>Config: User configures evaluator
Config->>Config: Content type: short-input → long-input
Config->>Config: Temperature hidden slider (no default)
UI->>Handler: Execute evaluator block
Note over Handler: inputs.temperature would be<br/>string "0.1" (type error)
Handler->>Handler: FIX: Hardcode temperature: 0.1 (number)
Handler->>Handler: Create evaluatorConfig
Handler->>API: POST /api/providers
Note over API: Request with<br/>temperature: 0.1 (number)
API-->>Handler: Return evaluation results
Handler-->>UI: Return output with metrics
4 files reviewed, no comments
…outer (#1792) * fix(evaluator): fix evaluator to handle temperature gracefully like router * apps/sim * fix eval-input subblock
Summary
Type of Change
Testing
Tested manually.
Checklist