Skip to content

Commit 238472d

Browse files
boyangsvlcopybara-github
authored andcommitted
fix: Updates the load_artifacts tool so that the model can reliability call it for follow up questions about the same artifact
PiperOrigin-RevId: 816025399
1 parent f1abdb1 commit 238472d

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/google/adk/tools/load_artifacts_tool.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ async def run_async(
6262
self, *, args: dict[str, Any], tool_context: ToolContext
6363
) -> Any:
6464
artifact_names: list[str] = args.get('artifact_names', [])
65-
return {'artifact_names': artifact_names}
65+
return {
66+
'artifact_names': artifact_names,
67+
'status': (
68+
'artifact contents temporarily inserted and removed. to access'
69+
' these artifacts, call load_artifacts tool again.'
70+
),
71+
}
6672

6773
@override
6874
async def process_llm_request(
@@ -88,8 +94,10 @@ async def _append_artifacts_to_llm_request(
8894
{json.dumps(artifact_names)}
8995
9096
When the user asks questions about any of the artifacts, you should call the
91-
`load_artifacts` function to load the artifact. Do not generate any text other
92-
than the function call.
97+
`load_artifacts` function to load the artifact. Always call load_artifacts
98+
before answering questions related to the artifacts, regardless of whether the
99+
artifacts have been loaded before. Do not depend on prior answers about the
100+
artifacts.
93101
"""])
94102

95103
# Attach the content of the artifacts if the model requests them.

0 commit comments

Comments
 (0)