Open
Description
It's a little annoying that the defined events expect a single type, but I still have to provide that type when instantiating the event object.
Doesn't work
>>> from ag_ui.core.events import TextMessageStartEvent
>>> TextMessageStartEvent(message_id="hello", role="assistant")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/loganmarkewich/giant_change/llama_index/.venv/lib/python3.12/site-packages/pydantic/main.py", line 253, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for TextMessageStartEvent
type
Field required [type=missing, input_value={'message_id': 'hello', 'role': 'assistant'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.11/v/missing
Works
>>> TextMessageStartEvent(message_id="hello", role="assistant", type="TEXT_MESSAGE_START")
TextMessageStartEvent(type=<EventType.TEXT_MESSAGE_START: 'TEXT_MESSAGE_START'>, timestamp=None, raw_event=None, message_id='hello', role='assistant')
Should the SDK just hardcode the type since there is only one option? It'd be more user friendly imo
Metadata
Metadata
Assignees
Labels
No labels