# AI Generator

<figure><img src="/files/1rng9S7WXK7p9OPWtE1E" alt=""><figcaption></figcaption></figure>

## Using the AI Function Generator in Function Junction

Welcome to Function Junction's AI Function Generator! This powerful tool allows you to create a variety of functions tailored to your Shopify shop's needs effortlessly. Follow the steps below to harness the full potential of this feature.

### Step-by-Step Guide

#### 1. Accessing the AI Function Generator

* **Navigate to the AI Generator**: Open Function Junction and head to the AI Generator section. This can be found on your main dashboard or in the tools menu.

#### 2. Describe Your Desired Function

* **Chat Modal**: A chat modal will appear, prompting you to describe what you want your function to achieve. Be as detailed as possible to ensure the AI understands your requirements.

<figure><img src="/files/55Aq3I1E4vtbD2BBC4l1" alt=""><figcaption></figcaption></figure>

* **Function Types**: Our AI supports creating seven different types of functions:
  * [**Discounts**](/function-types/discounts.md)
  * [**Payment**](broken://pages/BySTG5BjH8YkdVnIEnPt)
  * [**Delivery**](/function-types/delivery.md)
  * [**Cart Validations**](/function-types/cart-and-checkout-validations.md)
  * [**Order Routing**](/function-types/order-routing.md)
  * [**Bundling**](/function-types/discounts/bundle-fixed-price.md)
  * [**Fulfillment Constraints**](/function-types/fulfillment-constraints.md)

#### 3. Generating the Function

* **AI Processing**: Once you've described your function, the AI will generate an initial version based on your input.
* **Prompt to View Function**: You will receive a prompt to 'View your function.'

<div align="left"><figure><img src="/files/AfdHpiQSnI5IGeTdcVgj" alt=""><figcaption></figcaption></figure></div>

#### 4. Viewing and Editing Your Function

* **Function Builder**: Clicking 'View your function' will open the Function Builder. Here, you can view and edit various assets associated with your function:
  * **Campaign Name**: Assign a name to your campaign for easy identification.
  * **Function**: Review the generated function code or logic.
  * **Triggers**: Set conditions that will trigger the function.
  * **Actions**: Define what actions will be taken when the function is triggered.
  * **Details**: Add any additional details or notes about the function.
  * **Campaign Dates**: Set start and end dates for your campaign or function to be active.

<figure><img src="/files/qgezpYzgZMjdNdtzj3zR" alt="" width="317"><figcaption></figcaption></figure>

#### 5. Publishing Your Function

* **Save as Draft**: Not ready? Save your function as a draft and come back to it later.
* **Publish**: Everything looks good? Click the 'Publish' button to activate your function. :tada:

#### Tips for Optimal Use

* **Be Specific**: The more specific your description, the better the AI can tailor the function to your needs.
* **Review Thoroughly**: Always review the generated function and make necessary adjustments before publishing.
* **Utilize All Assets**: Make full use of the triggers, actions, and other settings to create a robust and effective function.

#### Troubleshooting

* **Unexpected Results**: If the function generated by the AI does not meet your expectations, try rephrasing your description or adding more detail.
* **Editing Issues**: If you encounter issues while editing, ensure that all required fields are filled out and that there are no syntax errors in the function code.

We hope this guide helps you make the most of the AI Function Generator in Function Junction. If you have any further questions or need additional support, please visit our Help Center or contact our customer support team.

Happy Function Building!

***


---

# 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://support.functionjunctionapp.com/function-builder/ai-generator.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.
