Skip to content

Commit d8c66fe

Browse files
wukathcopybara-github
authored andcommitted
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
1 parent c6cf11c commit d8c66fe

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/google/adk/flows/llm_flows/_code_execution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ async def _run_post_processor(
305305
)
306306
event_actions.artifact_delta[file_name] = version
307307
part.inline_data = None
308-
part.text = f'artifact: {file_name}'
308+
part.text = f'Saved as artifact: {file_name}. '
309309

310310
yield Event(
311311
invocation_id=invocation_context.invocation_id,

tests/unittests/flows/llm_flows/test_code_execution.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ async def test_builtin_code_executor_image_artifact_creation(mock_datetime):
9595
assert not events[0].content
9696
assert llm_response.content is not None
9797
assert len(llm_response.content.parts) == 3
98-
assert llm_response.content.parts[0].text == 'artifact: image_1.png'
98+
assert (
99+
llm_response.content.parts[0].text == 'Saved as artifact: image_1.png. '
100+
)
99101
assert not llm_response.content.parts[0].inline_data
100102
assert llm_response.content.parts[1].text == 'this is text'
101-
assert llm_response.content.parts[2].text == f'artifact: {expected_filename2}'
103+
assert (
104+
llm_response.content.parts[2].text
105+
== f'Saved as artifact: {expected_filename2}. '
106+
)
102107
assert not llm_response.content.parts[2].inline_data

0 commit comments

Comments
 (0)