# Generate code

Quadratic AI Chat can build whole analyses from scratch or edit and assist with existing code. Quadratic AI will default to Python, but you can ask for additional languages like JavaScript or Formulas.

## Insert and view code

Quadratic AI will default to inserting generated code. You can always view the code generated, make edits, move the code cell, or re-add the code cell.&#x20;

<figure><img src="/files/r04MkOFqz4AQKVWN4dEw" alt=""><figcaption></figcaption></figure>

## Build models and analytics workflows from scratch

The AI can see and understand the data in your sheet, allowing you to ask almost any question without needing to tell the AI any extra context. It will generate the analysis and automatically place the code in the sheet.&#x20;

Sometimes, the AI generates multiple code cells, data + code, or any possible combination that best answers your query.

<figure><img src="/files/lYIJnIzUXqqfj8fcMJig" alt=""><figcaption></figcaption></figure>

## Create charts

Create infinitely flexible charts with Quadratic AI. If you need to make edits, either do it directly in code or ask the AI to do it directly.

You can ask for edits like chart type, data used, titles, background colors, layouts, axes styling, etc. &#x20;

<figure><img src="/files/0ERMPYejR65neMTN2JMt" alt=""><figcaption></figcaption></figure>

## Fixing errors &#x20;

Quadratic AI is great at fixing errors in your code. Whenever there's an error, you can ask for the fix directly in chat or use the `Fix with AI` button. The AI will attempt to fix it and explain how it works. You can then either accept or reject the code change.

<figure><img src="/files/6YQrVMlOQTCm7GmFjpHm" alt=""><figcaption></figcaption></figure>


---

# 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.quadratichq.com/quadratic-ai/generate-code.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.
