Skip to content

fix & refactor: add supportsTemperature and Responses API flags #6969

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

Closed

Conversation

snipeship
Copy link

@snipeship snipeship commented Aug 12, 2025

Extend ModelInfo schema with supportsTemperature and usesResponsesApi capabilities to control request param inclusion and API selection.

Refactor OpenAiNativeHandler to generically handle Responses API models instead of hardcoded families, normalizing IDs and gating temperature, verbosity, and max token params via getModelParams.

Update GlamaHandler, LiteLLMHandler, UnboundHandler, and XAIHandler to use getModelParams for capability-aware temperature/max token handling.

Enhance tests to cover Responses API flows, conversation continuity, and temperature stripping for unsupported models, replacing SSE mocks with SDK responses.create where applicable.

Related GitHub Issue

Status: Open.
#6965

Closes: #6965

Roo Code Task Context (Optional)

Description

Fixes some slop as well for better maintaineability

Test Procedure

Run GPT-5, o3, and other providers

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

Additional Notes

Get in Touch


Important

Add supportsTemperature and usesResponsesApi flags to ModelInfo schema and refactor handlers to use these capabilities for parameter management.

  • ModelInfo Schema:
    • Added supportsTemperature and usesResponsesApi flags to modelInfoSchema in model.ts.
  • Handlers:
    • Refactored OpenAiNativeHandler to handle Responses API models generically, using getModelParams for parameter gating.
    • Updated GlamaHandler, LiteLLMHandler, UnboundHandler, and XAIHandler to use getModelParams for temperature and max token handling.
  • Tests:
    • Enhanced tests in openai-native.spec.ts to cover Responses API flows and temperature stripping for unsupported models.
    • Updated unbound.spec.ts to test temperature handling for openai/o3-mini.
    • Added tests in model-params.spec.ts for verbosity and reasoning settings.

This description was created by Ellipsis for 301731a. You can customize this summary. It will automatically update as commits are pushed.

Extend ModelInfo schema with supportsTemperature and usesResponsesApi
capabilities to control request param inclusion and API selection.

Refactor OpenAiNativeHandler to generically handle Responses API models
instead of hardcoded families, normalizing IDs and gating temperature,
verbosity, and max token params via getModelParams.

Update GlamaHandler, LiteLLMHandler, UnboundHandler, and XAIHandler to
use getModelParams for capability-aware temperature/max token handling.

Enhance tests to cover Responses API flows, conversation continuity,
and temperature stripping for unsupported models, replacing SSE mocks
with SDK responses.create where applicable.
@snipeship snipeship requested review from mrubens, cte and jr as code owners August 12, 2025 06:08
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request labels Aug 12, 2025
Extend ModelInfo schema with supportsTemperature and usesResponsesApi
capabilities to control request param inclusion and API selection.

Refactor OpenAiNativeHandler to generically handle Responses API models
instead of hardcoded families, normalizing IDs and gating temperature,
verbosity, and max token params via getModelParams.

Update GlamaHandler, LiteLLMHandler, UnboundHandler, and XAIHandler to
use getModelParams for capability-aware temperature/max token handling.

Enhance tests to cover Responses API flows, conversation continuity,
and temperature stripping for unsupported models, replacing SSE mocks
with SDK responses.create where applicable.

test(openai-native.spec): add fallback for unexpected call count

Adds explicit error throwing in mock implementations when
callCount does not match expected cases. Ensures tests fail
with clear messages on unexpected execution paths, improving
debuggability and test reliability.
Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the changes and have some suggestions for improvement. The implementation looks solid overall - good work on extending the ModelInfo schema with capability flags and refactoring the handlers to use these for parameter management.

Suggestions:

  1. Temperature default handling - In openai-native.ts, the logic for defaultTemperature seems backwards. When supportsTemperature is true, you're passing undefined, but when false you're passing OPENAI_NATIVE_DEFAULT_TEMPERATURE. Should this be reversed?

  2. Missing documentation - The new supportsTemperature and usesResponsesApi fields would benefit from more detailed JSDoc comments explaining their purpose and implications.

  3. Unused import - GPT5_DEFAULT_TEMPERATURE is still imported in openai-native.ts but was removed from the exports.

  4. Magic number - Consider extracting the 1.0 temperature value in model-params.ts as a named constant for hybrid reasoning models.

  5. Comment style - The Q&A format comment about GPT-5 temperature could be more concise.

Overall, this is a well-structured refactor that improves the codebase's maintainability. The test coverage is comprehensive.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 12, 2025
Reverses the conditional assignment to defaultTemperature so it
sets the default when supportsTemperature is true, and undefined
otherwise. Prevents models without temperature support from
receiving an unintended default value.
@snipeship snipeship changed the title feat: add supportsTemperature and Responses API flags fix & refactor: add supportsTemperature and Responses API flags Aug 12, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 13, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 13, 2025
@daniel-lxs
Copy link
Collaborator

Hey @snipeship, Thank you for your contribution! I opened this PR which implements the responses API for all models. I'll close this PR in favor of this on #7067.

Again, we appreciate your contributions, and I look forward to seeing more of them!

@daniel-lxs daniel-lxs closed this Aug 18, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 18, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR - Needs Preliminary Review size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

GPT-5 no longer supports the temperature parameter
3 participants