fix(openrouter): Force string serialization for openrouter/anthropic/claude-sonnet-4 model (#10454)

This commit is contained in:
suixinio
2025-08-18 23:50:01 +08:00
committed by GitHub
parent 74ba21bad0
commit c64b1ae111

View File

@@ -850,6 +850,8 @@ class LLM(RetryMixin, DebugMixin):
message.force_string_serializer = True
if 'kimi-k2-instruct' in self.config.model and 'groq' in self.config.model:
message.force_string_serializer = True
if 'openrouter/anthropic/claude-sonnet-4' in self.config.model:
message.force_string_serializer = True
# let pydantic handle the serialization
return [message.model_dump() for message in messages]