Skip to content

Fix reasoning model support (gpt-5.2-pro) by making temperature conditional#472

Open
kanlanc wants to merge 2 commits intoAsyncFuncAI:mainfrom
kanlanc:fix/reasoning-model-temperature-support
Open

Fix reasoning model support (gpt-5.2-pro) by making temperature conditional#472
kanlanc wants to merge 2 commits intoAsyncFuncAI:mainfrom
kanlanc:fix/reasoning-model-temperature-support

Conversation

@kanlanc
Copy link

@kanlanc kanlanc commented Feb 14, 2026

Summary

  • Reasoning models like gpt-5.2-pro do not support the temperature parameter and return a 400 Bad Request when it is included
  • gpt-5.2-pro only supports the Responses API (/v1/responses), not the Chat Completions API (/v1/chat/completions) — sending requests to chat completions returns a 404
  • Added gpt-5.2 and gpt-5.2-pro to generator.json with a use_responses_api flag for models that require the Responses API
  • Made temperature/top_p conditional in websocket_wiki.py and simple_chat.py for the OpenAI provider, only including them when present in model config
  • Added Responses API streaming code path using client.responses.create(stream=True) for flagged models, extracting text from response.output_text.delta events

Test plan

  • Use gpt-5.2-pro as a custom model with OpenAI provider — works end-to-end
  • Verify gpt-5.2 still works (uses Chat Completions API with temperature: 1.0)
  • Verify other OpenAI models (gpt-4o, gpt-5, etc.) still work with temperature as before

🤖 Generated with Claude Code

…tional

Reasoning models like gpt-5.2-pro do not support the temperature parameter
and return a 400 Bad Request when it is included. Previously, the OpenAI
provider path always sent temperature from the model config, which broke
any reasoning model used as a custom model.

- Add gpt-5.2 and gpt-5.2-pro to generator.json (pro with empty config)
- Make temperature/top_p conditional in websocket_wiki.py and simple_chat.py
  for the OpenAI provider, only including them when present in model config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kanlanc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical compatibility issue with certain reasoning models, specifically gpt-5.2-pro, by preventing the unconditional sending of unsupported parameters like temperature. The changes ensure that the API requests are correctly formed based on the model's capabilities, thereby eliminating 400 Bad Request errors and allowing these models to function as intended within the system.

Highlights

  • Reasoning Model Compatibility: Addressed an issue where reasoning models like gpt-5.2-pro would return a 400 Bad Request error due to not supporting the temperature parameter.
  • Conditional Parameter Handling: Modified the OpenAI provider logic in simple_chat.py and websocket_wiki.py to conditionally include temperature and top_p parameters only if they are present in the model's configuration.
  • Model Configuration Updates: Included gpt-5.2 and gpt-5.2-pro in generator.json, with gpt-5.2-pro having an empty configuration to ensure temperature is not sent.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • api/config/generator.json
    • Added configurations for new models: gpt-5.2 and gpt-5.2-pro.
  • api/simple_chat.py
    • Modified the model_kwargs dictionary construction to conditionally add temperature and top_p based on their presence in model_config.
  • api/websocket_wiki.py
    • Modified the model_kwargs dictionary construction to conditionally add temperature and top_p based on their presence in model_config.
Activity
  • The pull request was generated using Claude Code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses a bug where reasoning models like gpt-5.2-pro would fail due to the temperature parameter being sent unconditionally. The changes in generator.json and the conditional logic added to simple_chat.py and websocket_wiki.py for the OpenAI provider are a good fix. I've included a couple of minor suggestions to improve code maintainability by refactoring how optional parameters are handled.

Comment on lines 390 to 393
if "temperature" in model_config:
model_kwargs["temperature"] = model_config["temperature"]
if "top_p" in model_config:
model_kwargs["top_p"] = model_config["top_p"]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve maintainability and make it easier to add more optional parameters in the future, you could use a loop to iterate over the optional parameters and add them to model_kwargs if they exist in model_config. This avoids repeating the if ... in ... block for each parameter.

Suggested change
if "temperature" in model_config:
model_kwargs["temperature"] = model_config["temperature"]
if "top_p" in model_config:
model_kwargs["top_p"] = model_config["top_p"]
for param in ["temperature", "top_p"]:
if param in model_config:
model_kwargs[param] = model_config[param]

Comment on lines 500 to 503
if "temperature" in model_config:
model_kwargs["temperature"] = model_config["temperature"]
if "top_p" in model_config:
model_kwargs["top_p"] = model_config["top_p"]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the other file, you can use a loop here to handle optional parameters. This will make the code more concise and easier to maintain if more optional parameters are added later.

Suggested change
if "temperature" in model_config:
model_kwargs["temperature"] = model_config["temperature"]
if "top_p" in model_config:
model_kwargs["top_p"] = model_config["top_p"]
for param in ["temperature", "top_p"]:
if param in model_config:
model_kwargs[param] = model_config[param]

gpt-5.2-pro only supports the Responses API (/v1/responses), not the
Chat Completions API (/v1/chat/completions). Added a use_responses_api
flag in generator.json and updated websocket_wiki.py and simple_chat.py
to use client.responses.create() with streaming for flagged models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sashimikun
Copy link

Curious if this works with 5.3 codex... do you mind verifying it?

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