Skip to content

Commit 89a547a

Browse files
committed
refactor(formats): remove detect_format from strategy interface and check sentinels in converter
1 parent 3d95cf6 commit 89a547a

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

agent_sdks/python/a2ui_agent/src/a2ui/adk/a2a/part_converter.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ def convert(self, part: genai_types.Part) -> list[a2a_types.Part]:
120120

121121
if function_response.response:
122122
result = function_response.response.get("result")
123-
if isinstance(result, str) and self._format_strategy.detect_format(
124-
result
125-
):
123+
if isinstance(result, str) and "<a2ui" in result:
126124
return parse_response_to_parts(
127125
result,
128126
validator=self._catalog.validator,
@@ -140,7 +138,7 @@ def convert(self, part: genai_types.Part) -> list[a2a_types.Part]:
140138

141139
# 3. Handle Text-based A2UI (TextPart)
142140
if text := part.text:
143-
if self._format_strategy.detect_format(text):
141+
if "<a2ui" in text:
144142
return parse_response_to_parts(
145143
text,
146144
validator=self._catalog.validator,

agent_sdks/python/a2ui_agent/src/a2ui/formats/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ def wrap_decompiled_blocks(self, blocks: List[str]) -> str:
7070
"""Wraps decompiled code blocks in format-specific tags and code block wrappers."""
7171
pass
7272

73-
def detect_format(self, content: str) -> bool:
74-
"""Returns True if the content contains this format's sentinel/payload tags."""
75-
return "<a2ui" in content
76-
7773

7874
class PromptGenerator:
7975
"""Helper to assemble prompt instructions and transform examples."""

0 commit comments

Comments
 (0)