Skip to content

fix(gen): filter unsupported OpenAI reasoning and Responses parameters - #232

Open
tanweersalah wants to merge 1 commit into
SAP:mainfrom
tanweersalah:fix/gen-openai-reasoning-parameters-231
Open

tanweersalah wants to merge 1 commit into
SAP:mainfrom
tanweersalah:fix/gen-openai-reasoning-parameters-231

Conversation

@tanweersalah

Copy link
Copy Markdown

Context

Fixes #231.

What this PR does and why it is needed

The native OpenAI proxy currently recognizes only the original gpt-5, gpt-5-mini, and gpt-5-nano names as temperature-incompatible GPT models. Versioned GPT-5 reasoning models and GPT-6 reasoning models can therefore receive an unsupported temperature parameter. Separately, the proxy accepts arbitrary keyword arguments and forwards LangChain's default n=1 to the Responses SDK, whose create and parse methods do not accept n.

This change:

  • Shares the temperature compatibility logic across sync/async Chat Completions and Responses.
  • Recognizes GPT-5/6 reasoning family names, including dotted versions, dated snapshots, and -pro/-sol variants, without matching unrelated names such as gpt-50 or gpt-60.
  • Preserves temperature for GPT chat variants and newer GPT requests explicitly using non-reasoning effort (reasoning_effort="none" for Chat Completions, reasoning={"effort": "none"} for Responses).
  • Preserves GPT-6 Astra's existing temperature forwarding behavior. Azure explicitly documents Astra as an exception to its reasoning temperature restrictions: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/reasoning#unsupported-parameters.
  • Keeps the original GPT-5, o-series, and Cohere reasoning temperature filtering, and the existing Cohere Chat Completions parameter filtering.
  • Drops n for every Responses create/parse request, independent of model or provider, while preserving supported Chat Completions n behavior.
  • Documents the compatibility behavior in packages/gen/PYPIDESCRIPTION.md.

The fix uses the selected deployment's model name, so it also works when the native client is called by deployment ID rather than model name. No consumer-side monkeypatch, dependency change, or new public API is required. This does not attempt to validate reasoning-effort values or add a model capability registry.

Regression coverage

Adds 182 parameterized checks covering:

  • Existing and newer reasoning model names, chat variants, Astra, unrelated models, and family-name boundaries.
  • Native sync/async create and parse for both Chat Completions and Responses, asserting the actual outgoing HTTP payload, preserved token limits/reasoning configuration, and parsed structured output.
  • LangChain tool-bound invoke and ainvoke using gpt-6.1-sol, exercising automatic Responses routing and the raw-response client path.

Validation

  • Python 3.14.6, repository lockfile dependencies (OpenAI 2.49.0 / LangChain OpenAI 1.7.2):
    • PYTHONPATH=packages/gen uv run --no-sync pytest packages/gen/tests -q --tb=short — 1,188 passed (existing deprecation warnings).
    • uv run --no-sync pylint ai_api_client_sdk ai_core_sdk gen_ai_hub --errors-only — passed.
    • git diff --check — passed.
  • Issue-reported OpenAI 3.24.0 / LangChain OpenAI 1.6.7 in an isolated temporary environment: 26 additional mocked HTTP checks passed across native sync/async create/parse and LangChain tool-bound invoke/ainvoke. Used an injected HTTPX2 mock transport because the repository's RESPX fixtures target HTTPX, whereas OpenAI 3 uses HTTPX2. These extra checks are not committed as a separate test harness.
  • Before the fix, the initial regression matrix reproduced both failures (74 failed / 88 passed).
  • Live SAP AI Core integration tests were not run. Backend capability assumptions, especially Astra, should be confirmed by maintainers against available deployments.

Contributor review

This is an AI-assisted draft pending the contributor's code review, confirmation of compliance with SAP's AI contribution guidelines, and required DCO sign-off. No DCO attestation has been added on the contributor's behalf.

Definition of Done

  • Affected behavior covered by unit tests, including mocked native/LangChain HTTP flows
  • Error cases reproduced and covered
  • Documentation updated
  • Local pylint passes
  • Live integration validation / CI confirmation
  • Contributor review and DCO sign-off

@cla-assistant

cla-assistant Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@tanweersalah
tanweersalah marked this pull request as ready for review November 13, 2026 15:14

This branch has not been deployed

No deployments
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.

OpenAI proxy forwards unsupported 'temperature' and 'n' to gpt-6/reasoning models (gpt-6.1-sol)

1 participant