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
This commit is contained in:
Kathy Wu
2025-10-22 13:57:41 -07:00
committed by Copybara-Service
parent c6cf11cb74
commit d8c66fe688
2 changed files with 8 additions and 3 deletions
@@ -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,
@@ -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