> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(13).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=7518d082701b1fee16b8addbe380e8ba" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(3).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=6a6aa787806659f6131c193c9f38a2b1" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(9).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=6500f64bfe15c61130bcab6f2a0a6a1e" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/import-from-library.gif?s=eef222817699f7e8c26391256f26eb40" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(8).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=c4d2e13be4d591f3f56878c9f2ae51b6" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/stream-1.jpg?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=7793899d1eb7cadf9504237093056164" 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.

   <img src="https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(6).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=c2a180d09d959aa535bc9d90feb5d0c5" 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 (e.g., `content`). The Platform generates a **Response Path** for that location. Click **Save**.

   <img src="https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/selectkey.jpg?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=4a2e6f69bcfab1cd14ab5fbe129b999a" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/responsepath.jpg?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=b93fc5e7a1a0025c32f390dc20bd8238" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(2).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=f5dcbe2fef35a83b0e84f9304f1227a6" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(12).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=51bb008b090cf8f7c9cfbdc6da7e7dfd" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(11).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=1e201d5203096337ef4d1d2378cae35b" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/prl(4).png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=82831155d912247ddb93866b40fd4fe1" 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/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/token-mapping.png?fit=max&auto=format&n=s3bkaKmzowgJ31et&q=85&s=6b54a3dac98bec774c074e7d8561f12a" 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.
