-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Added support for AG-UI Multi-modal Messages #3715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added support for AG-UI Multi-modal Messages #3715
Conversation
Refactored code for better readability. Bumped version of ag-ui libs.
|
@bojan2501 Can you have a look at the missing test coverage please? |
…Modal-Messages-AG-UI
…Modal-Messages-AG-UI
Moved private helper methods below public ones. Removed part where vendor metadata is used to populate filename together with url.
Also refactored code, made helper function public. As the type checker was complaining.
|
I think this is it. |
Added test for unsupported ActivityMessage.
…essage. Adjusted test.
|
@DouweM To be honest I do not understand why the checks are failing now. |
| return builder.messages | ||
|
|
||
| @classmethod | ||
| def load_binary_part(cls, part: BinaryInputContent) -> BinaryContent | ImageUrl | VideoUrl | AudioUrl | DocumentUrl: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods really shouldn't be part of the public interface, so please make them private, either has class methods, or if that doesn't work, as private functions in the module, outside of the class
| ) | ||
| events = await run_and_collect_events(agent, run_input) | ||
|
|
||
| assert events == simple_result() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop all of the tests above because they're not verifying that the binary content actually made it through. I'd rather expand the test_messages test
| assert not loaded_messages | ||
|
|
||
|
|
||
| def test_load_binary_part() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather test this at the load_messages level so we can verify these end up in the correct Pydantic AI message history, not just individual parts
| AGUIAdapter.load_binary_part(BinaryInputContent(id='some_id', mime_type='text/plain')) | ||
|
|
||
|
|
||
| def test_add_assistant_tool_parts() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need to test these helper methods directly, as all of these features have already been tested through the existing tests, except for the new binary content. So I'd expect for the only new tests to be related to those binary parts.
If these tests were necessary because of the refactoring of the original massive method into separate ones, I'd prefer to revert that and have a massive method again, which was 100% test-covered.
Addresses 3558
Refactored code for better readability.
Bumped version of ag-ui libs.