diff --git a/src/hume/empathic_voice/chat/socket_client.py b/src/hume/empathic_voice/chat/socket_client.py index 9aa3f4a..59b53f3 100644 --- a/src/hume/empathic_voice/chat/socket_client.py +++ b/src/hume/empathic_voice/chat/socket_client.py @@ -61,7 +61,7 @@ def __init__( async def __aiter__(self): async for message in self.websocket: - yield message + yield parse_obj_as(SubscribeEvent, json.loads(message)) async def _send(self, data: typing.Any) -> None: if isinstance(data, dict): diff --git a/src/hume/expression_measurement/stream/socket_client.py b/src/hume/expression_measurement/stream/socket_client.py index daa1202..f9c7d30 100644 --- a/src/hume/expression_measurement/stream/socket_client.py +++ b/src/hume/expression_measurement/stream/socket_client.py @@ -38,7 +38,7 @@ def __init__( async def __aiter__(self): async for message in self.websocket: - yield message + yield parse_obj_as(SubscribeEvent, json.loads(message)) # type: ignore # TODO: we can likely coerce the right response model within the union here, if we're # assuming request-response pattern and 1:1 mapping between request and response types