Compare commits

...

1 Commits

Author SHA1 Message Date
Peter Steinberger
bbd3badf8a
fix: align Claude refusal streaming aliases 2026-06-11 14:07:42 -07:00
2 changed files with 12 additions and 3 deletions

View File

@ -860,13 +860,16 @@ public enum LanguageModel: Sendable, CustomStringConvertible, Hashable {
if case let .anthropicCompatible(modelId, _) = self {
return !Anthropic.hasStreamingRefusalRisk(modelId: modelId)
}
if case let .openRouter(modelId) = self, modelId.lowercased().hasPrefix("anthropic/") {
if case let .openRouter(modelId) = self {
return !Anthropic.hasStreamingRefusalRisk(modelId: modelId)
}
if case let .together(modelId) = self, modelId.lowercased().hasPrefix("anthropic/") {
if case let .together(modelId) = self {
return !Anthropic.hasStreamingRefusalRisk(modelId: modelId)
}
if case let .openaiCompatible(modelId, _) = self {
guard !Anthropic.hasStreamingRefusalRisk(modelId: modelId) else {
return false
}
let normalized = modelId.lowercased()
guard
normalized.contains("claude") ||
@ -875,7 +878,7 @@ public enum LanguageModel: Sendable, CustomStringConvertible, Hashable {
{
return true
}
return !Anthropic.hasStreamingRefusalRisk(modelId: modelId)
return true
}
if
case let .custom(provider) = self,

View File

@ -175,11 +175,17 @@ struct ProviderSystemTests {
#expect(Model.anthropic(.opus48).supportsStreaming == false)
#expect(Model.anthropic(.fable5).supportsStreaming == false)
#expect(Model.openRouter(modelId: "anthropic/claude-fable-5").supportsStreaming == false)
#expect(Model.openRouter(modelId: "fable5").supportsStreaming == false)
#expect(Model.openRouter(modelId: "anthropic/claude-opus-4-8").supportsStreaming == false)
#expect(Model.together(modelId: "claude-fable-5").supportsStreaming == false)
#expect(Model.openaiCompatible(
modelId: "anthropic/claude-fable-5",
baseURL: "https://example.test",
).supportsStreaming == false)
#expect(Model.openaiCompatible(
modelId: "fable5",
baseURL: "https://example.test",
).supportsStreaming == false)
#expect(Model.openaiCompatible(
modelId: "sonnet4-local",
baseURL: "https://example.test",