diff --git a/litellm/a2a_protocol/litellm_completion_bridge/transformation.py b/litellm/a2a_protocol/litellm_completion_bridge/transformation.py index 856978a4439..76d04e9c295 100644 --- a/litellm/a2a_protocol/litellm_completion_bridge/transformation.py +++ b/litellm/a2a_protocol/litellm_completion_bridge/transformation.py @@ -304,55 +304,3 @@ class A2ACompletionBridgeTransformation: }, } - @staticmethod - def openai_chunk_to_a2a_chunk( - chunk: Any, - request_id: Optional[str] = None, - is_final: bool = False, - ) -> Optional[Dict[str, Any]]: - """ - Transform a LiteLLM streaming chunk to A2A streaming format. - - NOTE: This method is deprecated for streaming. Use the event-based - methods (create_task_event, create_status_update_event, - create_artifact_update_event) instead for proper A2A streaming. - - Args: - chunk: LiteLLM ModelResponse chunk - request_id: Original A2A request ID - is_final: Whether this is the final chunk - - Returns: - A2A streaming chunk dict or None if no content - """ - # Extract delta content - content = "" - if chunk is not None and hasattr(chunk, "choices") and chunk.choices: - choice = chunk.choices[0] - if hasattr(choice, "delta") and choice.delta: - content = choice.delta.content or "" - - if not content and not is_final: - return None - - # Build A2A streaming chunk. Mirrors the non-streaming response - # shape (``result`` is the message itself, with ``kind: "message"`` - # as the result-level event discriminator — matching how - # ``create_artifact_update_event`` uses ``kind: "artifact-update"`` - # at the result level). ``final`` is an envelope-level streaming - # property per the A2A spec and is appended alongside the message - # fields so consumers can read a uniform ``result`` shape across - # streaming and non-streaming. - a2a_chunk = { - "jsonrpc": "2.0", - "id": request_id, - "result": { - "kind": "message", - "role": "agent", - "parts": [{"kind": "text", "text": content}], - "messageId": uuid4().hex, - "final": is_final, - }, - } - - return a2a_chunk