Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
fix(ai): drop temperature for all Claude 5 models (#1100) (#1101)
Aniansh Raj Singh262b9dfba1fd
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex 580edd9f..9fcd2e55 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -3383,17 +3383,37 @@ final class SettingsStore: ObservableObject {/// Whether the model rejects the `temperature` parameter./// Covers reasoning models plus Anthropic models that have deprecated temperature- /// (Opus 4.7+, Sonnet 5, Fable/Mythos 5 — Sonnet 4.6 and older still accept it).+ /// (Opus 4.7+, every Claude 5 model, Fable/Mythos — Sonnet 4.6 and older still accept it).func isTemperatureUnsupported(_ model: String) -> Bool {if self.isReasoningModel(model) { return true }// Normalize version separators so dotted IDs (e.g. OpenRouter's// anthropic/claude-opus-4.8) match the hyphenated forms below.let modelLower = model.lowercased().replacingOccurrences(of: ".", with: "-")- return modelLower.contains("claude-opus-4-7")- || modelLower.contains("claude-opus-4-8")- || modelLower.contains("claude-sonnet-5")- || modelLower.contains("claude-fable")- || modelLower.contains("claude-mythos")+ if modelLower.contains("claude-fable") || modelLower.contains("claude-mythos") { return true }+ // Compare versions instead of listing model IDs: each new Claude release+ // otherwise fails with HTTP 400 until its ID is added here.+ guard let version = Self.claudeVersion(in: modelLower) else { return false }+ if version.major >= 5 { return true }+ return version.family == "opus" && version.major == 4 && version.minor >= 7+ }++ /// The minor group is capped at two digits so a date suffix+ /// (claude-sonnet-4-20250514) is not read as a minor version.+ private static let claudeVersionRegex = try? NSRegularExpression(+ pattern: #"claude-(opus|sonnet|haiku)-(\d+)(?:-(\d{1,2}))?(?!\d)"#+ )++ /// Family and version of a family-first Claude ID (claude-haiku-5-5). Older+ /// version-first IDs (claude-3-5-haiku) return nil; they all accept temperature.+ private static func claudeVersion(in modelLower: String) -> (family: String, major: Int, minor: Int)? {+ let range = NSRange(modelLower.startIndex..., in: modelLower)+ guard let match = self.claudeVersionRegex?.firstMatch(in: modelLower, range: range),+ let familyRange = Range(match.range(at: 1), in: modelLower),+ let majorRange = Range(match.range(at: 2), in: modelLower),+ let major = Int(modelLower[majorRange])+ else { return nil }+ let minor = Range(match.range(at: 3), in: modelLower).flatMap { Int(modelLower[$0]) } ?? 0+ return (String(modelLower[familyRange]), major, minor)}/// Whether to display thinking tokens in the UI (Command Mode, Rewrite Mode)diff --git a/Tests/FluidDictationIntegrationTests/TemperatureSupportTests.swift b/Tests/FluidDictationIntegrationTests/TemperatureSupportTests.swiftindex 1c319a9b..ad3ff7cb 100644--- a/Tests/FluidDictationIntegrationTests/TemperatureSupportTests.swift+++ b/Tests/FluidDictationIntegrationTests/TemperatureSupportTests.swift@@ -2,10 +2,11 @@import XCTest// Regression tests for the Anthropic `temperature` deprecation handling.-// Newer Anthropic models (Opus 4.7+, Sonnet 5, Fable/Mythos 5) reject the `temperature`-// parameter with HTTP 400 "`temperature` is deprecated for this model."+// Newer Anthropic models (Opus 4.7+, every Claude 5 model, Fable/Mythos) reject the+// `temperature` parameter with HTTP 400 "`temperature` is deprecated for this model."// See https://github.com/altic-dev/FluidVoice/issues/285 (Opus 4.7) — the same failure-// recurred for Sonnet 5 because the check only matched claude-opus-4-7.+// recurred for Sonnet 5 and then Haiku 5.5 (issue #1100) because the check listed+// individual model IDs, so it is now version-based.// Sonnet 4.6 and older still accept `temperature` (verified against the live API)// and must keep receiving the app's tuned values.@@ -23,6 +24,16 @@ final class TemperatureSupportTests: XCTestCase {"anthropic/claude-opus-4.7","anthropic/claude-opus-4.8","anthropic/claude-opus-4.8-fast",+ // Issue #1100: Claude 5 models that were never listed individually+ "claude-haiku-5-5",+ "claude-opus-5-5",+ "claude-sonnet-5-5",+ "claude-opus-5",+ "anthropic/claude-haiku-5.5",+ "us.anthropic.claude-haiku-5-5-v1:0",+ // Future versions must not need another code change+ "claude-opus-4-10",+ "claude-haiku-6",]for model in unsupported {XCTAssertTrue(@@ -84,6 +95,13 @@ final class TemperatureSupportTests: XCTestCase {"gpt-4.1","claude-sonnet-4-6","claude-sonnet-4-20250514",+ "claude-haiku-4-5",+ "claude-haiku-4-5-20251001",+ "claude-opus-4-6",+ "claude-opus-4-1-20250805",+ "claude-opus-4-20250514",+ "claude-3-5-haiku-20241022",+ "claude-3-7-sonnet-20250219","gemini-2.5-flash","llama3",// OpenRouter-prefixed non-reasoning OpenAI models keep temperature