# Gemini Code Execution

The Gemini API code execution feature enables the model to generate and run Python code and learn iteratively from the results until it arrives at a final output. [Learn more...](https://ai.google.dev/gemini-api/docs/code-execution?lang=python#limitations)

### How to set up the Gemini Code Execution plugin?

No configuration is required for this plugin. However this plugin can only be used with the Gemini model from Google AI.

### How to use the Gemini Code Execution plugin?

1. Start a new chat with Google AI provider.  Select a model that supports Function Calling. Gemini 1.5 Pro performs the best according to Google&#x20;
2. Enable the plugin.
3. Enter your prompt.

It should look something like this

<figure><img src="https://3493584844-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FynYW2xZqA52spY7XgWis%2Fuploads%2FgWaDNeiouCvYyMo09nrg%2FCleanShot%202024-10-01%20at%2001.42.23%402x.png?alt=media&#x26;token=3202352c-3e91-4281-9d85-ac34ea853139" alt=""><figcaption><p>Gemini Code Execution in BoltAI</p></figcaption></figure>

### Limitation

These are limitations from the official [Google documentation](https://ai.google.dev/gemini-api/docs/code-execution?lang=python#limitations)

* The model can only generate and execute code. It can't return other artifacts like media files.
* The feature doesn't support file I/O or use cases that involve non-text output (for example, data plots or a CSV file upload).
* Code execution can run for a maximum of 30 seconds before timing out.
* In some cases, enabling code execution can lead to regressions in other areas of model output (for example, writing a story).
* There is some variation in the ability of the different models to use code execution successfully. Gemini 1.5 Pro is the best performing model, based on our testing.
