fix(schemas): ChatMessage.content accepts str | list for multimodal
OpenAI ChatMessage content can be either a string (simple text) or a list of content parts (multimodal: text + image_url, etc.). Updated the type annotation to match the actual API. No behavioral change; this is a type-hint-only widening so callers can pass multimodal content via ChatMessage instead of dicts. Required by tests/test_openai_compatible.py::test_vision_multimodal_message which was passing raw dicts to OpenAICompatibleRequest (wrong - the field is typed list[ChatMessage]). With this widening, that test can now use ChatMessage(role='user', content=[...multimodal parts]) without losing type fidelity.
This commit is contained in:
@@ -48,7 +48,7 @@ class ToolCall:
|
||||
@dataclass(frozen=True)
|
||||
class ChatMessage:
|
||||
role: str
|
||||
content: str
|
||||
content: str | list # str for text; list of content parts for multimodal (text + image_url, etc.)
|
||||
tool_calls: Optional[tuple[ToolCall, ...]] = None
|
||||
tool_call_id: Optional[str] = None
|
||||
name: Optional[str] = None
|
||||
|
||||
Reference in New Issue
Block a user