# Util & Helpers

We have two files to put helper functions:

* `Util` (`/lib/petal_pro/util/util.ex`) - utility functions used anywhere, eg. `random_string()`
* `PetalProWeb.Helpers` (`lib/petal_pro_web/helpers.ex`)- utilities functions imported into views (templates and live views), eg. `main_menu_items()`, `is_admin?`

If you want to add new helpers, ask "is this only going to be used in templates and live views?". If yes then put it in `helpers.ex`. If "no", put it in `util.ex`.&#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.petal.build/petal-pro-documentation/v1.7.0/fundamentals/util-and-helpers.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.
