> For the complete documentation index, see [llms.txt](https://docs.trymito.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trymito.io/how-to/code-options.md).

# Code Options

Customize your Mito generated code by converting it to a function, selecting parameters and more.

## Configuring Code Options

Adding code options allows you to configure the code to be generated in a way that works for your specific use-case. This includes options for generating the code as a function, and for including the imports from your code when adding custom python code.&#x20;

| Parameter                   | Type                                                                   | Description                                                                                    |
| --------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `as_function`               | `bool`                                                                 | If `True`,  Mito generates a function. If `False`, Mito generates a script.                    |
| `function_name`             | `str`                                                                  | The name of the function Mito generates.                                                       |
| `call_function`             | `bool`                                                                 | If `True` the Mito generated code's last line will call the generated function.                |
| `function_params`           | `Union[Dict[ParamName, ParamValue], ParamSubtype, List[ParamSubtype]]` | A mapping from function parameter name to the original value used in the script.               |
| `import_custom_python_code` | `bool`                                                                 | If `True`, the Mito generated function will import custom importers and spreadsheet functions. |

For example, if you want to generate a function named "my\_function" that receives one input called `file_path`, you could use the following code options:

```python
{
    'as_function': True, 
    'call_function': True, 
    'function_name': 'my_function', 
    'function_params': {'file_path': "original_data.csv"},
    'import_custom_python_code': False, 
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.trymito.io/how-to/code-options.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
