Class PartConverter
java.lang.Object
com.google.adk.a2a.converters.PartConverter
Utility class for converting between Google GenAI Parts and A2A DataParts.
**EXPERIMENTAL:** Subject to change, rename, or removal in any future patch release. Do not use in production code.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<io.a2a.spec.DataPart> convertGenaiPartToA2aPart(com.google.genai.types.Part part) Convert a Google GenAI Part to an A2A Part.static Optional<io.a2a.spec.Part<?>> fromGenaiPart(com.google.genai.types.Part part) Convert a GenAI part into the A2A JSON representation.static Optional<com.google.genai.types.Part> toGenaiPart(io.a2a.spec.Part<?> a2aPart) Convert an A2A JSON part into a Google GenAI part representation.
-
Field Details
-
A2A_DATA_PART_METADATA_TYPE_KEY
- See Also:
-
A2A_DATA_PART_METADATA_IS_LONG_RUNNING_KEY
- See Also:
-
A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
- See Also:
-
A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
- See Also:
-
A2A_DATA_PART_METADATA_TYPE_CODE_EXECUTION_RESULT
- See Also:
-
A2A_DATA_PART_METADATA_TYPE_EXECUTABLE_CODE
- See Also:
-
-
Method Details
-
toGenaiPart
Convert an A2A JSON part into a Google GenAI part representation. -
convertGenaiPartToA2aPart
public static Optional<io.a2a.spec.DataPart> convertGenaiPartToA2aPart(com.google.genai.types.Part part) Convert a Google GenAI Part to an A2A Part.- Parameters:
part- The GenAI part to convert.- Returns:
- Optional containing the converted A2A Part, or empty if conversion fails.
-
fromGenaiPart
Convert a GenAI part into the A2A JSON representation.
-