google / google/adk-python

Hide certain artifacts from the LLM in LoadArtifactsTool

Offen
#6,873 1 Kommentar 0 Reaktionen 1 zugewiesene Person Beansprucht von @sanketpatil06 Auf GitHub ansehen
needs review tools
Vorherrschende Sprache
Python
Sterne
21.5k
Forks
4k
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
31

Beschreibung

## 🔴 Required Information

### Is your feature request related to a specific problem?

As suggested by [ADK doc](https://adk.dev/graphs/data-handling/#:~:text=limitations-,The,Workflow), I'm using artifacts to persist session-scope states of large sizes. These states are meant to be used within my control code / tools, not read by the LLM.

The stock `LoadArtifactsTool`, which can be used by the agent to read supported file types, exposes all artifacts, including those I don't want the agent to see, to the LLM.

`LoadArtifactsTool` supports a `process_artifact` callback that can be leveraged to prevent artifact data from being exposed. However, the tool also [injects all artifact filenames](https://github.com/google/adk-python/blob/e753651b7df26febe00bde2cb043225e644cd207/src/google/adk/tools/load_artifacts_tool.py#L400) to the context. So it still leaks the information about the existence of artifacts and can pollute the context.

### Describe the Solution You'd Like

Option 1: Provide another callback to process `list_artifacts()` responses before appending them to the context.

Option 2: Provide a mechanism to distinguish (e.g., by naming) LLM-ingestable artifacts and artifacts that are purely used by the control code.

### Impact on your work
I won't say "crucial" because I can reimplement the tool anyway :)

### Willingness to contribute
Are you interested in implementing this feature yourself or submitting a PR? Maybe

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.