Fix Grok Realtime voice type validation for server responses
The Grok API now returns prefixed voice names (e.g. "human_Ara") in session.updated events, causing Pydantic validation errors. Widen the voice field type from GrokVoice to GrokVoice | str to accept both user-facing names and server-returned values.
This commit is contained in:
@@ -216,7 +216,7 @@ class SessionProperties(BaseModel):
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
instructions: Optional[str] = None
|
||||
voice: Optional[GrokVoice] = "Ara"
|
||||
voice: Optional[GrokVoice | str] = "Ara"
|
||||
turn_detection: Optional[TurnDetection] = Field(
|
||||
default_factory=lambda: TurnDetection(type="server_vad")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user