Files Processing Workflow #3846
Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: Your approach of using Hi @tdakanalis, Thank you for the detailed explanation of your use case. Your goal of processing files by reference to avoid including them in the model's context is a common and recommended pattern. Based on the ADK documentation, the The symptoms you're describing strongly suggest that the file content is still present in the conversation history when the call to the LLM is made. Here are a few things to investigate:
Your understanding of the workflow is correct, and the issue seems to be in the implementation details rather than the overall design. Verifying that the plugin is correctly replacing the file data is the key next step. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am working on a use case where the user should be able to provide files to the agent via the API. The agent must inject these files into a corpus (RAG Engine) and finally be able to ask questions based on that knowledge base.
I know that the recommended way to implement this would be to handle corpus creation and file injection outside of the agent. However, my goal is to run the entire process using only the agent.
To achieve this, I have configured the
SaveFilesAsArtifactsplugin and theGcsArtifactService. In theory, any uploaded file (sent asinline_data) should be stored in GCS, leaving only a reference to the GCS URL in the conversation history. I have also implemented a corpus injection tool which receives the GCS URLs and callsrag.import_files.However, what I am experiencing is quite different. Sometimes it works, but after the files are injected into the corpus, the Token Usage becomes extremely high (>100K tokens). This suggests that the file payload ends up in the context (even though I have not configured the
load_artifactplugin). Other times, I get a response from the model (gemini-2.5-flash) reporting the following error:This error is another indicator that the payload is ending up in the context. It seems I am missing something regarding how
SaveFilesAsArtifactsworks. I have also opened a related bug report (#3663), but I have not received any feedback yet.Any help would be more than welcome!
Beta Was this translation helpful? Give feedback.
All reactions