Client AI: do not send `temperature` unless explicitly configured by alexey-milovidov · Pull Request #108014 · ClickHouse/ClickHouse · GitHub
Skip to content

Client AI: do not send temperature unless explicitly configured#108014

Merged
alexey-milovidov merged 1 commit into
masterfrom
ai-sql-optional-temperature
Jun 24, 2026
Merged

Client AI: do not send temperature unless explicitly configured#108014
alexey-milovidov merged 1 commit into
masterfrom
ai-sql-optional-temperature

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

The AI SQL generation feature in clickhouse-client / clickhouse-local (the ?? prompt) always sent a temperature parameter to the model, because AIConfiguration::temperature defaulted to 0.0 and was unconditionally copied into the request options.

Some models reject the temperature parameter outright — for example, reasoning models served behind OpenAI-compatible gateways respond with temperature is deprecated for this model — which made AI SQL generation fail for those models regardless of configuration.

This makes temperature a std::optional<double> that is left unset by default and only sent to the model when the user explicitly configures ai.temperature. The request builder already omits the field when the option has no value, so there is no behavior change for users who do set a temperature.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

AI SQL generation in the client no longer sends the temperature parameter unless it is explicitly set via ai.temperature in the configuration. This fixes AI SQL generation for models that reject the temperature parameter.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

The AI SQL generation feature (`??` prompt) always sent a `temperature`
parameter to the model, because `AIConfiguration::temperature` defaulted
to `0.0` and was unconditionally copied into the request options.

Some models reject the `temperature` parameter outright (for example,
reasoning models served behind OpenAI-compatible gateways respond with
`temperature is deprecated for this model`), which made AI SQL generation
fail for those models regardless of configuration.

Make `temperature` a `std::optional<double>` that is left unset by default
and only sent to the model when the user explicitly configures
`ai.temperature` in the client configuration. The request builder already
omits the field when the option has no value, so no behavior changes for
users who do set a temperature.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@clickhouse-gh

clickhouse-gh Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jun 20, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.20% 85.20% +0.00%
Functions 92.50% 92.50% +0.00%
Branches 77.40% 77.50% +0.10%

Changed lines: Changed C/C++ lines covered by tests: 15/15 (100.00%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, fix the test for RabbitMQ and send a PR.

@groeneai

Copy link
Copy Markdown
Contributor

@pamarcos pamarcos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good. Ship it 🚀

@alexey-milovidov alexey-milovidov added this pull request to the merge queue Jun 24, 2026
Merged via the queue into master with commit 87b534e Jun 24, 2026
486 of 490 checks passed
@alexey-milovidov alexey-milovidov deleted the ai-sql-optional-temperature branch June 24, 2026 14:10
ylw510 pushed a commit to ylw510/ClickHouse that referenced this pull request Jun 24, 2026
Direct SELECT from `RabbitMQ` consumes rows, so tests must accumulate returned batches. Reset the polling deadline whenever accumulated rows increase to avoid failing while sanitizer/db-disk runs are still making progress.

CI report:

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108014&sha=ca91c12b238e033b5dc8c7453295e4e7017ac997

Related PR: ClickHouse#108014
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants