Is it possible to provide built_in_code_execution ability to read from a file? #774
-
| 
         The tile basically. I am looking for a way to allow built_in_code_execution to read a csv file to run analysis rather than me providing the data in the context as the file is bigger than the context window😆. Any way of doing this atm? Or will i have to write custom code executor? Any thoughts/helps are appreciated. Thanks!  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
| 
         To anyone who ends up here with the same issue as above, i figured it out. Its not documented anywhere. You NEED to use  Agent(
    name='agent_name',
    model='gemini-2.0-flash',
    description=<description goes here>,
    instruction="""<instruction goes here>""",
    # tools=[built_in_code_execution]
    code_executor=VertexAiCodeExecutor(
        optimize_data_file=True,
        stateful=True,
    )
)csv_artifact = types.Part(
        inline_data=types.Blob(
            display_name="test_data.csv",
            mime_type="text/csv",
            data=csv_bytes
        )
    )
content = types.Content(role='user', parts=[types.Part(text=query), csv_artifact])
# pass the content into runner 
runner.run_async(user_id=USER_ID, session_id=session.id, new_message=content) | 
  
Beta Was this translation helpful? Give feedback.
To anyone who ends up here with the same issue as above, i figured it out. Its not documented anywhere. You NEED to use
VertexAiCodeExecutorin order for the code executor to read artifacts/files and pass the artifact aspartto be able to read the generated artifacts within the code executor.