Skip to content

fix(llm): make custom provider temperature configurable#849

Merged
H-Chris233 merged 4 commits into
Open-Less:betafrom
Duyi-Wang:dev
Jul 22, 2026
Merged

fix(llm): make custom provider temperature configurable#849
H-Chris233 merged 4 commits into
Open-Less:betafrom
Duyi-Wang:dev

Conversation

@Duyi-Wang

@Duyi-Wang Duyi-Wang commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

User description

This PR re-submits the change from #818 to the active beta branch.

#818 was already merged, but it targeted main. Since current development and release work is happening on beta, this PR reapplies the same custom LLM temperature fix on top of the latest beta.

Summary

The change makes temperature configurable for custom OpenAI-compatible LLM providers.

Previously, the OpenAI-compatible chat completion path always sent temperature: 0.3. Some custom gateways or Azure/OpenAI-compatible proxies reject that field for certain models, which causes provider validation and polish requests to fail with HTTP 400.

Instead of inferring this behavior from model names or provider-specific assumptions, this PR makes it explicitly configurable for custom providers.

For custom providers:

  • leaving Temperature empty omits the temperature field entirely
  • setting a numeric value sends that value
  • valid values are constrained to 0..=2

Built-in OpenAI-compatible providers keep the existing behavior and still send the default 0.3.

Changes

  • Change OpenAICompatibleConfig.temperature to Option<f32>
  • Send temperature only when configured
  • Add ark.temperature credential storage for the active LLM provider
  • Add a Temperature field in Settings for custom LLM providers
  • Use the same temperature config in provider validation and real polish requests
  • Add tests for omitted/configured temperature and input validation
  • Update Settings copy to show the valid temperature range

Why

The original failure surfaced with a custom provider backed by an Azure OpenAI-compatible gateway:

HTTP 400 ... Unsupported value: 'temperature' does not support 0.300...

This appears to be gateway/model-specific behavior rather than something the app should infer from model names.

Making custom provider temperature explicit lets users work with gateways that require the field to be omitted, while preserving current behavior for built-in providers.


PR Type

Bug fix, Enhancement


Description

  • Make temperature configurable for custom LLM providers

  • Omit temperature from API request when unset (fixes HTTP 400)

  • Keep default 0.3 for built-in OpenAI-compatible providers

  • Add UI field and credential storage for custom temperature


Diagram Walkthrough

flowchart LR
  A[CredentialVault::get_active_llm_temperature] --> B{provider_id == "custom"?}
  B -- yes --> C[openai_compatible_temperature_for_provider returns custom value or None]
  B -- no --> D[returns Some(DEFAULT_TEMPERATURE)]
  C --> E[OpenAICompatibleConfig.temperature]
  D --> E
  E --> F[chat_body: omit or include temperature field]
Loading

File Walkthrough

Relevant files
Enhancement
7 files
credentials.rs
Add ark.temperature credential account                                     
+9/-0     
mod.rs
Export temperature helper; add temperature to ProviderConfig
+5/-3     
providers.rs
Integrate temperature into provider config                             
+15/-3   
coordinator.rs
Pass temperature when building active LLM provider             
+8/-2     
credentials.rs
Add temperature storage, parsing, and validation                 
+103/-1 
polish.rs
Change temperature to Option; add with_temperature and policy func
+172/-4 
ProvidersSection.tsx
Add temperature input field for custom providers                 
+17/-8   
Documentation
5 files
en.ts
Add English temperature labels                                                     
+2/-0     
ja.ts
Add Japanese temperature labels                                                   
+2/-0     
ko.ts
Add Korean temperature labels                                                       
+2/-0     
zh-CN.ts
Add Chinese (Simplified) temperature labels                           
+2/-0     
zh-TW.ts
Add Chinese (Traditional) temperature labels                         
+2/-0     

Duyi-Wang and others added 2 commits July 21, 2026 16:31
Allow custom OpenAI-compatible LLM providers to omit or override the temperature parameter instead of always sending the default 0.3.

- Send temperature only when configured in OpenAI-compatible chat bodies
- Keep built-in OpenAI-compatible providers on the existing 0.3 default
- Store active custom LLM temperature via ark.temperature
- Expose a Temperature field for custom LLM providers in Settings
- Reuse the same temperature config for provider validation and real polish
- Add tests for omitted/configured temperature and input validation
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit 00d3b4c)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

818 - Fully compliant

Compliant requirements:

  • Make temperature configurable for custom OpenAI-compatible LLM providers
  • For custom providers: leaving Temperature empty omits the temperature field entirely
  • For custom providers: setting a numeric value sends that value
  • Valid values are constrained to 0..=2
  • Built-in OpenAI-compatible providers keep the existing default behavior and still send 0.3
  • Change OpenAICompatibleConfig.temperature to Option
  • Send temperature only when configured
  • Add ark.temperature credential storage for the active LLM provider
  • Add a Temperature field in Settings for custom LLM providers
  • Use the same temperature config in provider validation and real polish requests
  • Add tests for omitted/configured temperature and input validation
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@H-Chris233 H-Chris233 self-assigned this Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 5df1a95

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 00d3b4c

@H-Chris233
H-Chris233 merged commit f4bb056 into Open-Less:beta Jul 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants