Skip to content

Conversation

@bojan2501
Copy link

Addresses 3558
Refactored code for better readability.
Bumped version of ag-ui libs.

Refactored code for better readability.
Bumped version of ag-ui libs.
@DouweM
Copy link
Collaborator

DouweM commented Dec 12, 2025

@bojan2501 Can you have a look at the missing test coverage please?

bojan2501 and others added 4 commits December 12, 2025 09:32
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.
@bojan2501
Copy link
Author

I think this is it.
Let me know if I break something.
Also if something needs to be fixed. Will try to find some time to work on it.

@bojan2501
Copy link
Author

@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:
Copy link
Collaborator

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()
Copy link
Collaborator

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:
Copy link
Collaborator

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:
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants