Add support for 'developer' role in chat messages

- Add 'developer' to accepted role literals in ChatMessage model
- Existing normalization in chat.py converts developer → system before watsonx API call
- Fixes 422 validation errors when clients send developer role messages
- Maintains backward compatibility with all existing roles
This commit is contained in:
2026-02-23 12:50:23 -05:00
parent 0ed0ae9ce8
commit 27d9bfbad8

View File

@@ -10,7 +10,7 @@ from pydantic import BaseModel, Field
class ChatMessage(BaseModel): class ChatMessage(BaseModel):
"""A chat message in the conversation.""" """A chat message in the conversation."""
role: Literal["system", "user", "assistant", "function", "tool"] role: Literal["system", "user", "assistant", "function", "tool", "developer"]
content: Optional[str] = None content: Optional[str] = None
name: Optional[str] = None name: Optional[str] = None
function_call: Optional[Dict[str, Any]] = None function_call: Optional[Dict[str, Any]] = None