a2a.utils.parts module

Utility functions for creating and handling A2A Parts objects.

a2a.utils.parts.get_data_parts(parts: list[Part]) list[dict[str, Any]]

Extracts dictionary data from all DataPart objects in a list of Parts.

Parameters:

parts – A list of Part objects.

Returns:

A list of dictionaries containing the data from any DataPart objects found.

a2a.utils.parts.get_file_parts(parts: list[Part]) list[FileWithBytes | FileWithUri]

Extracts file data from all FilePart objects in a list of Parts.

Parameters:

parts – A list of Part objects.

Returns:

A list of FileWithBytes or FileWithUri objects containing the file data from any FilePart objects found.

a2a.utils.parts.get_text_parts(parts: list[Part]) list[str]

Extracts text content from all TextPart objects in a list of Parts.

Parameters:

parts – A list of Part objects.

Returns:

A list of strings containing the text content from any TextPart objects found.