> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-ai-for-work-dev.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Custom Prompts

<Badge icon="arrow-left" color="gray">[Back to Prompts Library](/ai-for-service/generative-ai-tools/prompts-library)</Badge>

Reference and procedures for managing Custom prompts in the Prompts Library.

***

## Add a Custom Prompt

### Prerequisites

Integrate a pre-built or custom LLM before creating a prompt. See [LLM Integration](/ai-for-service/generative-ai-tools/llm-integration).

### Steps

1. Go to **Generative AI Tools** > **Prompts Library**.

2. Click **+ New Prompt** (top right).

3. Enter the **Prompt Name**, then select the **Feature** and **Model**.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(13).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=69ee5ca1bc4ee3968603e0805bd191fb" alt="New prompt — name, feature, model" width="1922" height="846" data-path="ai-for-service/generative-ai-tools/images/prl(13).png" />

4. The **Configuration** section (endpoint URL, auth, headers) is auto-populated from the model integration and is read-only.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(3).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=880cdee8a94541888ff3245ab1e9232a" alt="Configuration section" width="1857" height="600" data-path="ai-for-service/generative-ai-tools/images/prl(3).png" />

5. In the **Request** section, create a prompt or import an existing one.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(9).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=f0993fa32feafd212d07927eb9bd9a87" alt="Request section" width="1922" height="851" data-path="ai-for-service/generative-ai-tools/images/prl(9).png" />

   **To import an existing prompt:**

   1. Click **Import from Prompts and Requests Library**.

      <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/import-from-library.gif?s=890a5541a8670882f8bea689aeb838a1" alt="Import from Prompts and Requests Library" width="1910" height="824" data-path="ai-for-service/generative-ai-tools/images/import-from-library.gif" />

   2. Select the **Feature**, **Model**, and **Prompt**. Hover and click **Preview Prompt** to review before importing.

      <Note>You can interchange prompts between features.</Note>

   3. Click **Confirm** to import the prompt into the JSON body.

   **To create from scratch:**

   Click **Start from scratch** and enter the JSON request for the LLM.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(8).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=89254af10bd4f4550efa7e3bf78a5a11" alt="Start from scratch" width="1887" height="593" data-path="ai-for-service/generative-ai-tools/images/prl(8).png" />

6. (Optional) Toggle **Stream Response** to enable streaming. Responses are sent incrementally in real time instead of waiting for the full response.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/stream-1.jpg?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=2a8ad0f2a60723f41b253eba140f4bbe" alt="Stream Response toggle" width="1920" height="827" data-path="ai-for-service/generative-ai-tools/images/stream-1.jpg" />

<Note>
  * Add `"stream": true` to the custom prompt when streaming is enabled. The saved prompt displays a "streaming" tag.
  * Enabling streaming disables the "Exit Scenario" field.
    Streaming applies only to Agent Node and Prompt Node features using OpenAI and Azure OpenAI models.
</Note>

7. Fill in the **Sample Context Values** and click **Test**. If successful, the LLM response is displayed; otherwise an error appears. See [Dynamic Variables](/ai-for-service/automation/agent-node#reference-dynamic-variables)

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(6).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=8187ccaad6e49e643c8d2a95a6e795bb" alt="Test response" width="1920" height="854" data-path="ai-for-service/generative-ai-tools/images/prl(6).png" />

8. **Map the response key:** In the JSON response, double-click the key that holds the relevant information (for example, `content`). The Platform generates a **Response Path** for that location. Click **Save**.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/selectkey.jpg?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=c45d8894b5a2f7aeb17c2ba57a52a48b" alt="Select response key" width="1911" height="904" data-path="ai-for-service/generative-ai-tools/images/selectkey.jpg" />

9. Click **Lookup Path** to validate the path.

   <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/responsepath.jpg?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=8cb966745bf3401354dc6d96eb582af5" alt="Response path" width="1909" height="910" data-path="ai-for-service/generative-ai-tools/images/responsepath.jpg" />

10. Review the **Actual Response** and **Expected Response**:

    * **Green (match):** Click **Save**. Skip to step 12.

      <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(2).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=ac2d26250b627a3a048718a4fd42c7a5" alt="Matching responses" width="1922" height="842" data-path="ai-for-service/generative-ai-tools/images/prl(2).png" />

    * **Red (mismatch):** Click **Configure** to open the Post Processor Script editor.

      <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(12).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=b87d6bf8b73f22e8dfc9ee0c0390f033" alt="Mismatched responses" width="1137" height="411" data-path="ai-for-service/generative-ai-tools/images/prl(12).png" />

      1. Enter the **Post Processor Script** and click **Save & Test**.

         <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(11).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=9a1ed5f28268ae9efbe2359a961d4c6e" alt="Post processor script" width="1536" height="842" data-path="ai-for-service/generative-ai-tools/images/prl(11).png" />

      2. Verify the result, then click **Save**. The responses turn green.

         <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/prl(4).png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=4ff388047e393ae07bd13ba3993760d4" alt="Post processor result" width="1542" height="840" data-path="ai-for-service/generative-ai-tools/images/prl(4).png" />

11. (Optional) If **Token Usage Limits** are enabled for your custom model, map the token keys for accurate tracking:

    * **Request Tokens key:** `usage.input_tokens`
    * **Response Tokens key:** `usage.output_tokens`

    <img src="https://mintcdn.com/koreai-ai-for-work-dev/o0iG_cZ6W1HNumoO/ai-for-service/generative-ai-tools/images/token-mapping.png?fit=max&auto=format&n=o0iG_cZ6W1HNumoO&q=85&s=2e414ebed4012f627b2c601bbe0e9dc3" alt="Token key mapping" width="1920" height="717" data-path="ai-for-service/generative-ai-tools/images/token-mapping.png" />

    <Note>Without this mapping, the Platform can't calculate token consumption, which may lead to untracked usage and unexpected costs.</Note>

12. Click **Save**. The prompt appears in the Prompts Library.
