> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-content-gov.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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(13).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=830f71ce6c61bbaeb6dd68efb940cb31" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(3).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=fb30756745124890f6896b2094e4c706" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(9).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=4689fa136dc53057b0b37a80e5bcd5d5" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/import-from-library.gif?s=5b35def0d01e37249a036f097921c732" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(8).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=0d51264be8b7490a9dfd1540d5e88eaa" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/stream-1.jpg?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=8746fba599a12605bd95a74f04e9dc5d" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(6).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=894f0779eeab0e8ecf490bfa888d2870" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/selectkey.jpg?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=9d445dee25d6442745be6e09581c6f2e" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/responsepath.jpg?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=39a5ee8e32e322a19a2cdad44e7e97cb" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(2).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=8c06aaf48fbdb0108e5360f97f031915" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(12).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=bfd3d366eb41692098b254f5abb41ec4" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(11).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=8be29ea18c7d5c3a1726ac29a3daa1e9" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/prl(4).png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=a041447dc16be795c13c77e04bbbdadf" 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-content-gov/p0ZZ6JYe_at1gZSG/ai-for-service/generative-ai-tools/images/token-mapping.png?fit=max&auto=format&n=p0ZZ6JYe_at1gZSG&q=85&s=0c64fa03c078650790d9151c381fc651" 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.
