fix(sample): Correct text artifact saving in artifact_save_text sample

Copybara import of the project:
--
95292471f6dba29b55a17239670cdc6cc14619b5 by Yongsul Kim <ystory84@gmail.com>:

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/936 from ystory:fix/artifact-sample-save 7b0babc53266afadb8421ccafa0f3de092eeeae5
PiperOrigin-RevId: 766220649
This commit is contained in:
Yongsul Kim 2025-06-02 09:18:39 -07:00 committed by Copybara-Service
parent 2409c3ef19
commit 5c6001d90f

View File

@ -19,8 +19,15 @@ from google.genai import types
async def log_query(tool_context: ToolContext, query: str):
"""Roll a die with the specified number of sides."""
await tool_context.save_artifact('query', types.Part(text=query))
"""Saves the provided query string as a 'text/plain' artifact named 'query'."""
query_bytes = query.encode('utf-8')
artifact_part = types.Part(
inline_data=types.Blob(
mime_type='text/plain',
data=query_bytes
)
)
await tool_context.save_artifact('query', artifact_part)
root_agent = Agent(