From d8c66fe6881622036254f7329f21a4214a1c257c Mon Sep 17 00:00:00 2001 From: Kathy Wu Date: Wed, 22 Oct 2025 13:57:06 -0700 Subject: [PATCH] fix: Update the saving artifact text for BuiltInCodeExecutor to be more human readable Since it appears in the same bubble as the rest of the LLM's response text, make it more human readable so it doesn't look out of place. PiperOrigin-RevId: 822729061 --- src/google/adk/flows/llm_flows/_code_execution.py | 2 +- tests/unittests/flows/llm_flows/test_code_execution.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/google/adk/flows/llm_flows/_code_execution.py b/src/google/adk/flows/llm_flows/_code_execution.py index d37e773c..b7c1e5b9 100644 --- a/src/google/adk/flows/llm_flows/_code_execution.py +++ b/src/google/adk/flows/llm_flows/_code_execution.py @@ -305,7 +305,7 @@ async def _run_post_processor( ) event_actions.artifact_delta[file_name] = version part.inline_data = None - part.text = f'artifact: {file_name}' + part.text = f'Saved as artifact: {file_name}. ' yield Event( invocation_id=invocation_context.invocation_id, diff --git a/tests/unittests/flows/llm_flows/test_code_execution.py b/tests/unittests/flows/llm_flows/test_code_execution.py index 4212e19a..9277c6bd 100644 --- a/tests/unittests/flows/llm_flows/test_code_execution.py +++ b/tests/unittests/flows/llm_flows/test_code_execution.py @@ -95,8 +95,13 @@ async def test_builtin_code_executor_image_artifact_creation(mock_datetime): assert not events[0].content assert llm_response.content is not None assert len(llm_response.content.parts) == 3 - assert llm_response.content.parts[0].text == 'artifact: image_1.png' + assert ( + llm_response.content.parts[0].text == 'Saved as artifact: image_1.png. ' + ) assert not llm_response.content.parts[0].inline_data assert llm_response.content.parts[1].text == 'this is text' - assert llm_response.content.parts[2].text == f'artifact: {expected_filename2}' + assert ( + llm_response.content.parts[2].text + == f'Saved as artifact: {expected_filename2}. ' + ) assert not llm_response.content.parts[2].inline_data