Skip to content

fix(eval): strip restricted temperature for default-only models in mocks#1741

Open
cotovanu-cristian wants to merge 1 commit into
mainfrom
fix/sre-607465-eval-mock-temperature
Open

fix(eval): strip restricted temperature for default-only models in mocks#1741
cotovanu-cristian wants to merge 1 commit into
mainfrom
fix/sre-607465-eval-mock-temperature

Conversation

@cotovanu-cristian

Copy link
Copy Markdown
Collaborator

Summary

The eval LLM mock generator forwarded the simulation strategy's temperature verbatim to the LLM Gateway. For models that only accept the default temperature (gpt-5 family, o-series reasoning models), an explicit temperature=0 makes the gateway return HTTP 400 (Unsupported value: 'temperature' does not support 0 with this model. Only the default (1) value is supported.). That error collapses through UiPathMockResponseGenerationErrorAgentRuntimeError into an Unknown-category runtime failure.

This normalizes completion kwargs at the structured-output funnel (generate_structured_output), dropping the restricted temperature for those models before calling chat_completions. Both the LLM mocker and the input mocker route through this funnel, so the path is covered once. Standard models are unaffected.

Root cause

  • _llm_mocker.py builds completion_kwargs from ModelSettings and forwards them to chat_completions, which always sends temperature in the request body.
  • gpt-5 / o-series reject any explicit temperature → HTTP 400.
  • Representative job key: 9dc7655c-241d-4a9d-a190-1545df616acc.

Changes

  • _structured_output.py: add _model_supports_only_default_temperature + _normalize_completion_kwargs, applied once in generate_structured_output.
  • test_structured_output.py: parametrized regression tests for gpt-5/o-series (temperature stripped) and a guard that standard models keep it.

Not included

Preserving the underlying HTTP error category on UiPathMockResponseGenerationError was scoped out: it requires new category plumbing on a shared exception type used across the mocker modules and the runtime's category logic (not localized). The temperature fix removes the miscategorized failures at the source.

Testing

ruff check + format clean; mypy clean on changed files; pytest tests/cli/eval/mocks/ = 65 passed.

Refs: SRE-607465, PC-4769

The LLM mock generator forwarded the simulation strategy's temperature
verbatim to the LLM Gateway. For models that only accept the default
temperature (gpt-5 family, o-series reasoning models), an explicit
temperature=0 makes the gateway return HTTP 400, which collapses into an
Unknown-category runtime failure.

Normalize completion kwargs at the structured-output funnel so the
restricted temperature is dropped before calling chat_completions for
those models, leaving standard models untouched.

Refs SRE-607465, PC-4769.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 22, 2026 20:07
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes eval-time LLM mock generation failures by normalizing completion_kwargs in the shared structured-output funnel so that models which only allow the gateway’s default temperature (notably gpt-5 and o* reasoning models) do not receive an explicit temperature parameter that triggers HTTP 400s.

Changes:

  • Added model detection + normalization logic in generate_structured_output() to drop temperature for default-only-temperature models before calling chat_completions.
  • Added regression tests ensuring temperature is stripped for gpt-5 / o1 / o3 models and preserved for standard models.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/uipath/src/uipath/eval/mocks/_structured_output.py Normalizes completion_kwargs to omit temperature for models that reject explicit temperature values.
packages/uipath/tests/cli/eval/mocks/test_structured_output.py Adds regression coverage verifying stripping behavior for default-only models and non-stripping for standard models.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants