Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions samples/agent/adk/contact_lookup/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
from tools import get_contact_info
from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.core.schema.manager import A2uiSchemaManager
from a2ui.core.parser.parser import parse_response, ResponsePart
from a2ui.core.parser.parser import parse_response
from a2ui.basic_catalog.provider import BasicCatalog
from a2ui.a2a import (
get_a2ui_agent_extension,
parse_response_to_parts,
stream_response_to_parts,
)

Expand Down Expand Up @@ -358,16 +357,13 @@ async def token_stream():

if is_valid:
logger.info(
"--- ContactAgent.stream: Response is valid. Sending final response"
f" (Attempt {attempt}). ---"
)
final_parts = parse_response_to_parts(
final_response_content, fallback_text="OK."
"--- ContactAgent.stream: Response is valid. Task complete (Attempt"
f" {attempt}). ---"
)

yield {
"is_task_complete": True,
"parts": final_parts,
"parts": [],
}
return # We're done, exit the generator

Expand Down
10 changes: 3 additions & 7 deletions samples/agent/adk/restaurant_finder/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@
from tools import get_restaurants
from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.core.schema.manager import A2uiSchemaManager
from a2ui.core.parser.parser import parse_response, ResponsePart
from a2ui.core.parser.parser import parse_response
from a2ui.basic_catalog.provider import BasicCatalog
from a2ui.core.schema.common_modifiers import remove_strict_validation
from a2ui.a2a import (
get_a2ui_agent_extension,
parse_response_to_parts,
stream_response_to_parts,
)

Expand Down Expand Up @@ -327,16 +326,13 @@ async def token_stream():

if is_valid:
logger.info(
"--- RestaurantAgent.stream: Response is valid. Sending final response"
"--- RestaurantAgent.stream: Response is valid. Task complete"
f" (Attempt {attempt}). ---"
)
final_parts = parse_response_to_parts(
final_response_content, fallback_text="OK."
)

yield {
"is_task_complete": True,
"parts": final_parts,
"parts": [],
}
return # We're done, exit the generator

Expand Down
Loading