Skip to content

Commit 8f74b2e

Browse files
dpageclaude
andauthored
Fixed an issue where AI Reports fail with OpenAI models that do not support the temperature parameter. #9719
Removed the temperature parameter from all LLM provider clients and pipeline calls, allowing each model to use its default. This fixes compatibility with GPT-5-mini/nano and future models that don't support user-configurable temperature. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c8cb744 commit 8f74b2e

File tree

7 files changed

+6
-27
lines changed

7 files changed

+6
-27
lines changed

docs/en_US/release_notes_9_14.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ Bug fixes
3232
| `Issue #9729 <https://github.com/pgadmin-org/pgadmin4/issues/9729>`_ - Fixed an issue where some LLM models would not use database tools in the AI assistant, instead returning text descriptions of tool calls.
3333
| `Issue #9279 <https://github.com/pgadmin-org/pgadmin4/issues/9279>`_ - Fixed an issue where OAuth2 authentication fails with 'object has no attribute' if OAUTH2_AUTO_CREATE_USER is False.
3434
| `Issue #9392 <https://github.com/pgadmin-org/pgadmin4/issues/9392>`_ - Ensure that the Geometry Viewer refreshes when re-running queries or switching geometry columns, preventing stale data from being displayed.
35+
| `Issue #9719 <https://github.com/pgadmin-org/pgadmin4/issues/9719>`_ - Fixed an issue where AI Reports fail with OpenAI models that do not support the temperature parameter.
3536
| `Issue #9721 <https://github.com/pgadmin-org/pgadmin4/issues/9721>`_ - Fixed an issue where permissions page is not completely accessible on full scroll.
3637
| `Issue #9740 <https://github.com/pgadmin-org/pgadmin4/issues/9740>`_ - Fixed an issue where the AI Assistant input textbox sometimes swallows the first character of input.

web/pgadmin/llm/client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def chat(
5454
tools: Optional[list[Tool]] = None,
5555
system_prompt: Optional[str] = None,
5656
max_tokens: int = 4096,
57-
temperature: float = 0.0,
5857
**kwargs
5958
) -> LLMResponse:
6059
"""
@@ -65,7 +64,6 @@ def chat(
6564
tools: Optional list of tools the LLM can use.
6665
system_prompt: Optional system prompt to set context.
6766
max_tokens: Maximum tokens in the response.
68-
temperature: Sampling temperature (0.0 = deterministic).
6967
**kwargs: Additional provider-specific parameters.
7068
7169
Returns:

web/pgadmin/llm/providers/anthropic.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def chat(
9090
tools: Optional[list[Tool]] = None,
9191
system_prompt: Optional[str] = None,
9292
max_tokens: int = 4096,
93-
temperature: float = 0.0,
9493
**kwargs
9594
) -> LLMResponse:
9695
"""
@@ -101,7 +100,6 @@ def chat(
101100
tools: Optional list of tools Claude can use.
102101
system_prompt: Optional system prompt.
103102
max_tokens: Maximum tokens in response.
104-
temperature: Sampling temperature.
105103
**kwargs: Additional parameters.
106104
107105
Returns:
@@ -120,9 +118,6 @@ def chat(
120118
if system_prompt:
121119
payload['system'] = system_prompt
122120

123-
if temperature > 0:
124-
payload['temperature'] = temperature
125-
126121
if tools:
127122
payload['tools'] = self._convert_tools(tools)
128123

web/pgadmin/llm/providers/docker.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def chat(
8383
tools: Optional[list[Tool]] = None,
8484
system_prompt: Optional[str] = None,
8585
max_tokens: int = 4096,
86-
temperature: float = 0.0,
8786
**kwargs
8887
) -> LLMResponse:
8988
"""
@@ -94,7 +93,6 @@ def chat(
9493
tools: Optional list of tools the model can use.
9594
system_prompt: Optional system prompt.
9695
max_tokens: Maximum tokens in response.
97-
temperature: Sampling temperature.
9896
**kwargs: Additional parameters.
9997
10098
Returns:
@@ -117,7 +115,6 @@ def chat(
117115
'model': self._model,
118116
'messages': converted_messages,
119117
'max_completion_tokens': max_tokens,
120-
'temperature': temperature
121118
}
122119

123120
if tools:

web/pgadmin/llm/providers/ollama.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def chat(
8181
tools: Optional[list[Tool]] = None,
8282
system_prompt: Optional[str] = None,
8383
max_tokens: int = 4096,
84-
temperature: float = 0.0,
8584
**kwargs
8685
) -> LLMResponse:
8786
"""
@@ -92,7 +91,6 @@ def chat(
9291
tools: Optional list of tools the model can use.
9392
system_prompt: Optional system prompt.
9493
max_tokens: Maximum tokens in response (num_predict in Ollama).
95-
temperature: Sampling temperature.
9694
**kwargs: Additional parameters.
9795
9896
Returns:
@@ -117,7 +115,6 @@ def chat(
117115
'stream': False,
118116
'options': {
119117
'num_predict': max_tokens,
120-
'temperature': temperature
121118
}
122119
}
123120

web/pgadmin/llm/providers/openai.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def chat(
9090
tools: Optional[list[Tool]] = None,
9191
system_prompt: Optional[str] = None,
9292
max_tokens: int = 4096,
93-
temperature: float = 0.0,
9493
**kwargs
9594
) -> LLMResponse:
9695
"""
@@ -101,7 +100,6 @@ def chat(
101100
tools: Optional list of tools the model can use.
102101
system_prompt: Optional system prompt.
103102
max_tokens: Maximum tokens in response.
104-
temperature: Sampling temperature.
105103
**kwargs: Additional parameters.
106104
107105
Returns:
@@ -124,7 +122,6 @@ def chat(
124122
'model': self._model,
125123
'messages': converted_messages,
126124
'max_completion_tokens': max_tokens,
127-
'temperature': temperature
128125
}
129126

130127
if tools:

web/pgadmin/llm/reports/pipeline.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ def _planning_stage(self, context: dict) -> list[str]:
218218
response = self._call_llm_with_retry(
219219
messages=[Message.user(user_prompt)],
220220
system_prompt=PLANNING_SYSTEM_PROMPT,
221-
max_tokens=500,
222-
temperature=0.0
221+
max_tokens=500
223222
)
224223

225224
# Parse JSON response
@@ -292,8 +291,7 @@ def _analyze_section_with_retry(
292291
response = self.client.chat(
293292
messages=[Message.user(user_prompt)],
294293
system_prompt=SECTION_ANALYSIS_SYSTEM_PROMPT,
295-
max_tokens=1500,
296-
temperature=0.3
294+
max_tokens=1500
297295
)
298296

299297
# Determine severity from content
@@ -374,8 +372,7 @@ def _synthesize_with_retry(
374372
response = self.client.chat(
375373
messages=[Message.user(user_prompt)],
376374
system_prompt=SYNTHESIS_SYSTEM_PROMPT,
377-
max_tokens=4096,
378-
temperature=0.3
375+
max_tokens=4096
379376
)
380377

381378
yield {'type': 'result', 'result': response.content}
@@ -408,16 +405,14 @@ def _call_llm_with_retry(
408405
self,
409406
messages: list[Message],
410407
system_prompt: str,
411-
max_tokens: int = 4096,
412-
temperature: float = 0.3
408+
max_tokens: int = 4096
413409
):
414410
"""Call LLM with exponential backoff retry.
415411
416412
Args:
417413
messages: Messages to send.
418414
system_prompt: System prompt.
419415
max_tokens: Maximum response tokens.
420-
temperature: Sampling temperature.
421416
422417
Returns:
423418
LLMResponse from the client.
@@ -430,8 +425,7 @@ def _call_llm_with_retry(
430425
return self.client.chat(
431426
messages=messages,
432427
system_prompt=system_prompt,
433-
max_tokens=max_tokens,
434-
temperature=temperature
428+
max_tokens=max_tokens
435429
)
436430
except LLMClientError as e:
437431
if e.error.retryable and attempt < self.max_retries - 1:

0 commit comments

Comments
 (0)