diff --git a/contributing/samples/artifact_save_text/agent.py b/contributing/samples/artifact_save_text/agent.py index 1f62dcc..e8f05ff 100755 --- a/contributing/samples/artifact_save_text/agent.py +++ b/contributing/samples/artifact_save_text/agent.py @@ -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(