# Mito AI

## What is Mito AI?

Mito AI is ChatGPT for your pandas dataframes. Its the easiest way to apply simple edits, like adding filters or parsing strings, to your data.&#x20;

Like ChatGPT, Mito AI is a chat interface for interacting with OpenAI. Unlike ChatGPT:

1. When you use Mito AI to transform your data, it automatically executes the code in the context of your analysis so you'll immediately see the effects on your data. This makes it easier to decide if the code generated by OpenAI was correct or whether you want to undo the edit and try again.
2. Mito AI has context about your data and your analysis. This additional information, which Mito automatically provides to OpenAI without you having to type it out, helps OpenAI generate code that is useful to you right away.

## Using Mito AI

1. Open the AI taskpane by clicking the `AI` button in the toolbar.
2. Describe the transformation that you want the AI to make, press `Enter`, and wait for the result.
3. Use the results section within the chat, and the difference highlighting within the sheet to understand how the generated code effected your data.
   * Modified dataframes, columns and column headers are colored <mark style="color:yellow;">yellow</mark>.&#x20;
   * Created dataframes and columns are colored <mark style="color:green;">green</mark>.
   * Deleted dataframes and columns are not colored, but are listed in the results section of the chat interface.
4. If the results are incorrect, press the `Undo` button in the Mito toolbar and try updating your command.&#x20;
5. If the results are correct, give Mito AI another command.

And remeber, every edit you make in Mito (including through Mito AI) generates code in the code cell directly below the Mito spreadsheet. Scroll down to see your new Python code.

<figure><img src="https://2294704369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MP_U5ZCmiamDOXEOOTC%2Fuploads%2Fe2v4QrU91qeL1C9oJKKT%2Fezgif.com-video-to-gif-3.gif?alt=media&#x26;token=e3b6903b-e098-437e-9317-de4e26641a7f" alt=""><figcaption><p>Conversationally using Mito AI to edit data.</p></figcaption></figure>

{% hint style="info" %}
Mito AI is currently in open beta. As such, Mito collects additional usage data: including dataframe names, column names, and some values in the dataframe. By using Mito AI, you are agreeing to our [privacy policy](http://privacy.trymito.io) as well as OpenAI's [privacy policy](https://openai.com/policies/privacy-policy).&#x20;
{% endhint %}

## What tasks is Mito AI good for?

Mito AI excels at two types of tasks:

1. Edits to dataframes. This includes adding columns, removing columns, filtering, aggregating, merging, and any other edits that manipulate the underlying data.&#x20;
2. Answering questions about the data. This includes questions like "how many unique values are in column X" or "what is the highest value after this aggregation."

Mito AI does not currently handle formatting changes to the sheet, and may not perform correctly when generating graph code.&#x20;

## Auto Error Correction

When the code generated by Mito AI errors, **Mito feeds your original request, the code it generated, and the error back to OpenAI so that it can try again**. Often this will resolve simple errors. Things like: columns having different dtypes than the generated code orginally assumed or the generated code relying on a package that was not yet imported in the notebook.

If the Mito AI is not able to automatically resolve the error, try breaking your request into small chunks. For example, if you initially asked Mito AI to `Calculate the difference between the start and end times for each trip`, you might instead first tell Mito AI to `Convert the start and end time columns to datetimes`, then `Calculate the difference between the start and end time`. &#x20;

## Mito AI Plans

**Mito AI usage limits**

Mito AI uses the ChatGPT API in order to turn your commands into Python code. To make interacting with ChatGPT a seamless experience for our users, we automatically use our own OpenAI API key. And as a result, Mito incures a charge for each user prompt. Therefore, the following applies:

1. Open Source Mito AI users are allowed 100 free Open AI completions.
2. Mito [Pro](https://www.trymito.io/plans) and [Enterprise](https://www.trymito.io/plans) users are allowed unlimited Open AI completions.
3. All Mito users are able to provide their own OpenAI API key instead of using Mito's. This allows them to generate unlimited AI completions through the Mito interface.&#x20;

#### Providing Your Own OpenAI Key

All Mito users are able to provide their own OpenAI API key instead of using Mito's. This allows them to generate unlimited AI completions through the Mito interface. Simply add the following code above where you create Mito spreadsheet:

```
import os
os.environ['OPENAI_API_KEY'] = '<Key Here>'
```

#### On-Prem AI&#x20;

Some enterprises are uncomfortable sending any data to OpenAI and instead choose to build their own On-Prem AI. [Mito Enterprise](https://www.trymito.io/plans) users are able to configure Mito to connect to On-Prem LLMs instead of OpenAI, giving them unlimited AI completions and complete control over their data.&#x20;

Configuring Mito to use a different LLM is as simple as setting a couple of environment variables.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trymito.io/how-to/mito-ai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
