Table of Contents

Class GoogleCodeExecution

The code execution tool allows the Gemini model to generate and run Python code. The model can then learn iteratively from the code execution results until it arrives at a final output. You can use code execution to build applications that benefit from code-based reasoning. For example, you can use code execution to solve equations or process text. You can also use the libraries included in the code execution environment to perform more specialized tasks. The code execution tool is available for all languages.

Gemini is only able to execute code in Python. You can still ask Gemini to generate code in another language, but the model can't use the code execution tool to run it.

public class GoogleCodeExecution : Tool
Inheritance
object
GoogleCodeExecution
Inherited Members

Remarks

Supported models (Single Turn): All Gemini 2.0 and 2.5 models
Supported models (Bidirectional - Multimodal Live API): Only Flash experimental models
File input types supported: .png, .jpeg, .csv, .xml, .cpp, .java, .py, .js, .ts
Plotting libraries supported: Matplotlib, seaborn