# ChatGPT

## **Introduction**

This document provides comprehensive and up-to-date instructions for integrating **ChatGPT**, OpenAI's advanced language model, into **Autom Mate** under the **Integration Library**. ChatGPT is designed to understand natural language, generate human-like text, and assist in a wide range of intelligent automation use cases.

Through this integration, Autom Mate users can dynamically interact with ChatGPT during workflows, enabling capabilities such as contextual responses, smart content generation, and decision support — all without writing code.

## **What is ChatGPT?**

ChatGPT is a state-of-the-art **Large Language Model (LLM)** developed by OpenAI, capable of processing and generating natural language across various contexts. It supports use cases including:

* Conversational Q\&A
* Summarization and paraphrasing
* Intelligent recommendation
* Role-based persona simulation
* Multilingual responses

Latest models such as **GPT-4o** and **GPT-3.5-turbo** offer structured reasoning, fast inference, and flexible prompt design, making them ideal for enterprise-grade automation needs.

## **Automate Integration with ChatGPT**

Under the **Integration Library**, Autom Mate provides a built-in action called **New Question**, which enables direct interaction with ChatGPT via OpenAI’s API.

#### 🔐 Prerequisite

Before using this action, you must store your **OpenAI API Key** securely:

1. Navigate to the [**Vault** ](/userguide/product-features/management/vault.md)page in Autom Mate.
2. Create a new Vault item containing your OpenAI key.
3. Use this credential in the **App Credential** field within the action configuration.

This ensures secure communication and credential isolation across your automation environment.

## **Using the Integration**

To use the ChatGPT integration in Autom Mate:

1. Add the `New Question` action from the **Integration Library** to your Autom.
2. Fill in required inputs like **Model**, **Prompt Role**, **Prompt**, and **Question**.
3. Assign variables to **Text Output**.
4. Use these variables in subsequent Autom actions (conditions, updates, messages, etc.).

## How To Use Actions

### **New Question**

<figure><img src="/files/clRys6R2s3P3L1CPl47m" alt=""><figcaption><p>Basic usage of New Question Action</p></figcaption></figure>

#### **Description and Purpose**

The **New Question** action allows Autom Mate users to send structured prompts and questions to **OpenAI’s ChatGPT** via the Integration Library. This action enables the automation of intelligent responses directly within workflows — ideal for use cases like summarization, contextual explanation, decision support, or dynamic text generation.

By defining the model, prompt behavior, and question content, users can receive both a plain text answer and full metadata from ChatGPT. This helps embed natural language understanding and generation into Autom Mate Autom's.

***

#### **Usage Instructions**

{% stepper %}
{% step %}
**Select a ChatGPT Model**

**Model**: Choose the language model to process your request. The default and most advanced option is currently `GPT 4o`.

This setting determines the accuracy, speed, and cost of the response.
{% endstep %}

{% step %}
**Define Prompt Role Context**

**Prompt Role**: Choose the role under which your prompt should be interpreted. Common options include:

* `system`: General instruction for behavior
* `user`: Standard input
* `developer`: Technical tone and deeper insights

This field influences the response tone and detail level.
{% endstep %}

{% step %}
**Provide Prompt Instruction**

**Prompt**: Define how ChatGPT should behave during this session.\
Example: `"You are an expert legal assistant."`

This sets the assistant’s persona and behavioral context for the session.
{% endstep %}

{% step %}
**Enter the Question**

**Question**: Enter the actual user question to be answered by ChatGPT.\
Example: `"Summarize the key requirements of GDPR compliance."`

This will be the primary input evaluated by the model.
{% endstep %}

{% step %}
**Execute and Review**

Run the Autom. After execution, review the assigned variables to verify the response.\
The `Text Output` can be displayed or used in conditions, while the `Output` and `Output Header` can be stored, logged, or used for traceability.
{% endstep %}
{% endstepper %}

***

#### **Inputs**

| Field              | Description                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------- |
| **Model**          | The ChatGPT model to be used (e.g., `GPT 4o`). Determines capability and latency.           |
| **Prompt Role**    | Specifies the role context (`system`, `user`, `developer`) used in the message setup.       |
| **Prompt**         | Instructional context for ChatGPT’s behavior (e.g., `"You are a cybersecurity expert."`).   |
| **Question**       | The user’s actual question (e.g., `"How do I securely store API keys?"`).                   |
| **App Credential** | A reference to the Vault credential storing the OpenAI API key. Required for authorization. |

***

#### **Outputs**

| Field                        | Description                                                                                                           |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Text Output** (`string`)   | Contains only the text content from `choices[0].message.content`. Usable in notifications, UI, or further processing. |
| **Output** (`object`)        | The full raw JSON response from the OpenAI API, including message, token usage, and response metadata.                |
| **Output Header** (`object`) | Summary metadata including `model`, `usage`, and response `id`. Useful for logging and diagnostics.                   |

***

#### **Example Output**

<details>

<summary>Text Output</summary>

Formatting a Windows PC involves erasing all data on the drive and reinstalling the operating system. Please make sure to back up all important data before proceeding, as this process will erase everything on the drive. Here's a step-by-step guide for formatting your Windows PC:

#### Preparing for Format

1. **Backup Your Data**: Save important files, documents, photos, and any other data you don’t want to lose to an external hard drive or cloud storage.
2. **Create Windows Installation Media**:
   * Go to the [Microsoft Windows Download page](https://www.microsoft.com/en-us/software-download/windows).
   * Download the **Media Creation Tool**.
   * Run the tool and select "Create installation media (USB flash drive, DVD, or ISO file)".
   * Follow the prompts to create a bootable USB drive or burn a DVD with the Windows installation files.

#### Formatting and Reinstalling Windows

1. **Boot from Installation Media**:
   * Insert the bootable USB drive or DVD into your PC.
   * Restart your computer. You might need to change the boot order in the BIOS/UEFI to boot from the USB or DVD. (Accessing BIOS/UEFI usually involves pressing a key like F2, DEL, or ESC immediately after turning on the computer.)
2. **Start the Installation**:
   * When prompted, select your language, time, and keyboard settings, and click "Next".
   * Click on "Install now".
3. **Choose Installation Type**:
   * When prompted, select "Custom: Install Windows only (advanced)" to perform a clean installation.
4. **Partition the Drive**:
   * You will see a list of partitions on your hard drive. You can delete all existing partitions (this will erase everything, so make sure backups are complete).
   * Select the unallocated space and click "Next". Windows will automatically create a new partition and proceed with the installation.
5. **Follow the Prompts**:
   * Just follow the on-screen instructions to continue with the installation. You'll need to set up your region, keyboard layout, and other preferences.
6. **Complete the Setup**:
   * After installation is complete, you will be guided through the initial setup process. You can connect to Wi-Fi, log in with a Microsoft account, and customize settings.

#### Post-Installation

* **Install Drivers**: After Windows is installed, ensure that you install the necessary drivers for your hardware (graphics card, sound card, network adapter, etc.).
* **Install Windows Updates**: Go to Settings > Update & Security > Windows Update and check for updates to install the latest patches and security fixes.
* **Restore Data**: Once everything is set up, you can restore the data you backed up.

#### Important Notes

* Make sure your PC is plugged into a power source throughout the process.
* If your PC came with a recovery partition or if you have a recovery disk, you might be able to restore it to factory settings without external media.
* This process may vary slightly depending on the version of Windows you are using (Windows 10 or 11).

If you encounter any issues during the process, feel free to ask for more specific assistance!

</details>

<details>

<summary>Output</summary>

```json
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "annotations": [],
        "content": "Formatting a Windows PC involves erasing all data on the drive and reinstalling the operating system. Please make sure to back up all important data before proceeding, as this process will erase everything on the drive. Here's a step-by-step guide for formatting your Windows PC:\n\n### Preparing for Format\n\n1. **Backup Your Data**: Save important files, documents, photos, and any other data you don’t want to lose to an external hard drive or cloud storage.\n\n2. **Create Windows Installation Media**:\n   - Go to the [Microsoft Windows Download page](https://www.microsoft.com/en-us/software-download/windows).\n   - Download the **Media Creation Tool**.\n   - Run the tool and select \"Create installation media (USB flash drive, DVD, or ISO file)\".\n   - Follow the prompts to create a bootable USB drive or burn a DVD with the Windows installation files.\n\n### Formatting and Reinstalling Windows\n\n1. **Boot from Installation Media**:\n   - Insert the bootable USB drive or DVD into your PC.\n   - Restart your computer. You might need to change the boot order in the BIOS/UEFI to boot from the USB or DVD. (Accessing BIOS/UEFI usually involves pressing a key like F2, DEL, or ESC immediately after turning on the computer.)\n\n2. **Start the Installation**:\n   - When prompted, select your language, time, and keyboard settings, and click \"Next\".\n   - Click on \"Install now\".\n\n3. **Choose Installation Type**:\n   - When prompted, select \"Custom: Install Windows only (advanced)\" to perform a clean installation.\n\n4. **Partition the Drive**:\n   - You will see a list of partitions on your hard drive. You can delete all existing partitions (this will erase everything, so make sure backups are complete).\n   - Select the unallocated space and click \"Next\". Windows will automatically create a new partition and proceed with the installation.\n\n5. **Follow the Prompts**:\n   - Just follow the on-screen instructions to continue with the installation. You'll need to set up your region, keyboard layout, and other preferences.\n\n6. **Complete the Setup**:\n   - After installation is complete, you will be guided through the initial setup process. You can connect to Wi-Fi, log in with a Microsoft account, and customize settings.\n\n### Post-Installation\n\n- **Install Drivers**: After Windows is installed, ensure that you install the necessary drivers for your hardware (graphics card, sound card, network adapter, etc.).\n- **Install Windows Updates**: Go to Settings > Update & Security > Windows Update and check for updates to install the latest patches and security fixes.\n- **Restore Data**: Once everything is set up, you can restore the data you backed up.\n\n### Important Notes\n\n- Make sure your PC is plugged into a power source throughout the process.\n- If your PC came with a recovery partition or if you have a recovery disk, you might be able to restore it to factory settings without external media.\n- This process may vary slightly depending on the version of Windows you are using (Windows 10 or 11).\n\nIf you encounter any issues during the process, feel free to ask for more specific assistance!",
        "refusal": null,
        "role": "assistant"
      }
    }
  ],
  "created": 1748871971,
  "id": "chatcmpl-BdzmNzPBRtkht00qvbVvQT2RX3ear",
  "model": "gpt-4o-mini-2024-07-18",
  "object": "chat.completion",
  "service_tier": "default",
  "system_fingerprint": "fp_34a54ae93c",
  "usage": {
    "completion_tokens": 657,
    "completion_tokens_details": {
      "accepted_prediction_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens": 33,
    "prompt_tokens_details": {
      "audio_tokens": 0,
      "cached_tokens": 0
    },
    "total_tokens": 690
  }
}
```

</details>

<details>

<summary>Output Header</summary>

```json
{
  "Access-Control-Expose-Headers": [
    "X-Request-ID"
  ],
  "Alt-Svc": [
    "h3=\":443\"; ma=86400"
  ],
  "Cf-Cache-Status": [
    "DYNAMIC"
  ],
  "Cf-Ray": [
    "9497653db9cd11ed-AMS"
  ],
  "Connection": [
    "keep-alive"
  ],
  "Content-Type": [
    "application/json"
  ],
  "Date": [
    "Mon, 02 Jun 2025 13:46:22 GMT"
  ],
  "Openai-Organization": [
    "autom-mate"
  ],
  "Openai-Processing-Ms": [
    "11102"
  ],
  "Openai-Version": [
    "2020-10-01"
  ],
  "Server": [
    "cloudflare"
  ],
  "Set-Cookie": [
    "__cf_bm=v1iDcv2dyoJZTGvBi3txXJ0npV9uvFPLoW_3UWHlAQU-1748871982-1.0.1.1-IcIoOaW59EfPReq6v3aJgrf84lvMvfV4TV425OwJG.rEHHxpDbiIyIigTowrfYQgg_qHeTy1dqLpZi0ex7imZRrAx_1ZSmHJirAtMQ.8ZaM; path=/; expires=Mon, 02-Jun-25 14:16:22 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None",
    "_cfuvid=HmA5zTMAx7SbQMZR8jHHohtsZriwSGWcb3taCCEcbnY-1748871982958-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
  ],
  "Status-Code": 200,
  "Strict-Transport-Security": [
    "max-age=31536000; includeSubDomains; preload"
  ],
  "X-Content-Type-Options": [
    "nosniff"
  ],
  "X-Envoy-Upstream-Service-Time": [
    "11104"
  ],
  "X-Ratelimit-Limit-Requests": [
    "30000"
  ],
  "X-Ratelimit-Limit-Tokens": [
    "150000000"
  ],
  "X-Ratelimit-Remaining-Requests": [
    "29999"
  ],
  "X-Ratelimit-Remaining-Tokens": [
    "149999973"
  ],
  "X-Ratelimit-Reset-Requests": [
    "2ms"
  ],
  "X-Ratelimit-Reset-Tokens": [
    "0s"
  ],
  "X-Request-Id": [
    "req_d442a66f93d5d07b9cda1d8815dbc1fb"
  ]
}
```

</details>

***

## Additional Tips

### [**Use Cases**](/userguide/use-cases.md)

### [FAQ](/userguide/faq.md)


---

# 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.autommate.com/userguide/libraries/integration/chatgpt.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.
