> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompts

> Build, version, and manage prompts for LLM applications. Configure models, variables, and structured outputs through AI Studio or the API.

**Prompts** store all configuration for interacting with a model: system instructions, messages, model selection, and parameters. A Prompt can be reused across [Playgrounds](/docs/playground/overview), [Experiments](/docs/experiments/overview), [Deployments](/docs/deployments/creating), and [Agents](/docs/agents/build).

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/2bHNizT-Lic?si=9NEWmAiNwUpxPNjI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen />

## Use Cases

<AccordionGroup>
  <Accordion title="Standardize AI Behavior Across Teams" icon="users">
    Use prompts as shared instructions so every team and application produces consistent, aligned outputs.
  </Accordion>

  <Accordion title="Turn AI Use Cases into Reusable Assets" icon="layer-group">
    Package prompts as configurable building blocks that can be reused across products, workflows, and experiments.
  </Accordion>

  <Accordion title="Control Model Output Without Code Changes" icon="sliders">
    Adjust behavior, tone, and structure by editing prompts instead of modifying application logic.
  </Accordion>

  <Accordion title="Scale AI Features Safely" icon="display-chart-up">
    Roll out improvements, A/B test variations, and manage risk through prompt versioning and controlled updates.
  </Accordion>

  <Accordion title="Connect AI to Business Context" icon="link">
    Embed domain rules, policies, and structured outputs directly into prompts to align AI with business needs.
  </Accordion>
</AccordionGroup>

## Create a Prompt

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    <Steps>
      <Step title="Navigate to a Project">
        Open a [Project](/docs/projects/overview) and click the **`+`** button at the top.
      </Step>

      <Step title="Select Prompt">
        Choose **Prompt** from the menu. The Prompt editor opens in AI Studio.
      </Step>
    </Steps>

    Standalone prompts are stored in the Project and can be reused across [Playgrounds](/docs/playground/overview), [Experiments](/docs/experiments/overview), [Agents](/docs/agents/build), and [Deployments](/docs/deployments/creating).
  </Tab>

  <Tab title="API & SDK" icon="code">
    Create a Prompt using the [Create a Prompt API](/reference/prompts/create-a-prompt). The payload defines the name, model, messages, parameters, and metadata.

    <CodeGroup>
      ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
      curl --request POST \
           --url https://api.orq.ai/v2/prompts \
           --header 'accept: application/json' \
           --header 'authorization: Bearer ORQ_API_KEY' \
           --header 'content-type: application/json' \
           --data '{
        "prompt_config": {
          "model_parameters": {
            "responseFormat": null,
            "temperature": 1,
            "maxTokens": 256,
            "topP": 0.7,
            "frequencyPenalty": 0,
            "presencePenalty": 0
          },
          "model": "openai/gpt-4o",
          "model_type": "vision",
          "provider": "openai",
          "messages": [
            {
              "role": "system",
              "content": "You are a helpful assistant"
            }
          ]
        },
        "display_name": "MyPrompt",
        "path": "Default/Prompts",
        "metadata": {
          "language": "English"
        },
        "description": "Prompt Description"
      }'
      ```

      ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
      import { Orq } from "@orq-ai/node";

      const orq = new Orq({
        apiKey: process.env["ORQ_API_KEY"] ?? "",
      });

      const result = await orq.prompts.create({
        displayName: "MyPrompt",
        promptConfig: {
          modelParameters: {
            responseFormat: null,
            temperature: 1,
            maxTokens: 256,
            topP: 0.7,
            frequencyPenalty: 0,
            presencePenalty: 0,
          },
          model: "openai/gpt-4o",
          modelType: "vision",
          provider: "openai",
          messages: [
            {
              role: "system",
              content: "You are a helpful assistant",
            },
          ],
        },
        path: "Default/Prompts",
        metadata: {
          language: "English",
        },
      });

      console.log(result);
      ```

      ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
      from orq_ai_sdk import Orq
      import os

      with Orq(
          api_key=os.getenv("ORQ_API_KEY", ""),
      ) as orq:
          res = orq.prompts.create(request={
              "display_name": "MyPrompt",
              "prompt_config": {
                  "model_parameters": {
                      "responseFormat": None,
                      "temperature": 1,
                      "maxTokens": 256,
                      "topP": 0.7,
                      "frequencyPenalty": 0,
                      "presencePenalty": 0,
                  },
                  "model": "openai/gpt-4o",
                  "model_type": "vision",
                  "provider": "openai",
                  "messages": [{
                      "role": "system",
                      "content": "You are a helpful assistant"
                  }],
              },
              "path": "Default/Prompts",
              "metadata": {"language": "English"},
              "description": "Prompt Description",
          })

          print(res)
      ```
    </CodeGroup>

    The response includes the prompt `_id` needed for future updates or retrieval.

    <Tip>See the full [Create a Prompt API reference](/reference/prompts/create-a-prompt).</Tip>
  </Tab>
</Tabs>

### Choose a Model

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    Select a model from the model picker at the top of the Prompt editor.

    <Info>
      A model must be available through the [AI Router](/docs/model-garden/overview) to appear in the picker.
    </Info>

    <img src="https://mintcdn.com/orqai/x_6IXnot9ETOc_0g/images/docs/302ec21162916d2110717c8ed1e43f76ecc404892fcfd34e89b13944da70a9e5-Screenshot_2025-03-03_at_16.26.16.png?fit=max&auto=format&n=x_6IXnot9ETOc_0g&q=85&s=46de0d08fb6172c25ff5cd73edd900c2" alt="Choose a Model" width="2270" height="322" data-path="images/docs/302ec21162916d2110717c8ed1e43f76ecc404892fcfd34e89b13944da70a9e5-Screenshot_2025-03-03_at_16.26.16.png" />
  </Tab>
</Tabs>

### Model Parameters

<AccordionGroup>
  <Accordion title="Temperature" icon="flame">
    Controls creativity and predictability. Higher values produce more diverse, surprising responses. Lower values produce more predictable output that sticks closely to learned patterns.
  </Accordion>

  <Accordion title="Max Tokens" icon="hashtag">
    Sets the upper limit on tokens the model can produce in a single output. Prevents excessively long responses while ensuring enough room for a complete answer.
  </Accordion>

  <Accordion title="Top K" icon="arrow-up-right">
    Narrows the model's choices to the k most likely tokens at each generation step. Helps refine output to follow particular patterns or meet specific criteria.
  </Accordion>

  <Accordion title="Top P" icon="sliders">
    Nucleus sampling. Selects a pool of likely words based on a probability threshold, balancing creativity with coherence.
  </Accordion>

  <Accordion title="Frequency Penalty" icon="repeat">
    Discourages the model from reusing the same words or phrases, encouraging richer and more varied language.
  </Accordion>

  <Accordion title="Presence Penalty" icon="megaphone">
    Discourages repeated topics or ideas rather than specific words. Higher values lead to more creative and diverse responses.
  </Accordion>
</AccordionGroup>

### Messages

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    Select **Add Message** in the Prompt Template panel to add a message. Messages define the context the model receives before generating a response.

    <Frame caption="The prompt template used as context for the language model.">
      <img src="https://mintcdn.com/orqai/x_6IXnot9ETOc_0g/images/docs/3aa4d7f-Screenshot_2024-04-15_at_13.20.17.png?fit=max&auto=format&n=x_6IXnot9ETOc_0g&q=85&s=80ce77debe2b6cdeb1be80b90a8d7415" alt="The prompt template used as context for the language model." width="1204" height="408" data-path="images/docs/3aa4d7f-Screenshot_2024-04-15_at_13.20.17.png" />
    </Frame>
  </Tab>
</Tabs>

#### Roles

When adding a message, choose a role to define how the model interprets it:

| Role          | Description                                                                                               | Example                                                                            |
| ------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| **System**    | A guideline or context for the language model, directing how it should interpret and respond to requests. | "You are an expert botanist. Respond briefly to questions with one-line answers."  |
| **User**      | An actual query posed by the user.                                                                        | "Which plants thrive in shady environments?"                                       |
| **Assistant** | Responses to user queries by the language model.                                                          | "Ferns, Hostas, and Hydrangeas are some plants that thrive in shady environments." |

#### Variables

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    Use `{{variable_name}}` syntax inside a message to declare a dynamic input. All declared inputs appear in the **Inputs** block at the top-right of the page, where default values can be set for testing.

    <Frame caption="Insert an input and override its value during generation.">
      ![Insert an input and override its value during generation.](https://files.readme.io/a4e6f3a-inputs720fps30.gif)
    </Frame>

    In a **Deployment**, populate variables through the `inputs` field when invoking.

    <img src="https://mintcdn.com/orqai/E8L3R46ivX7g9-QI/images/docs/d18fbe49e7ab62bac4003851e372d05bcb238286ad07f0de637b0beca34a97e2-image.png?fit=max&auto=format&n=E8L3R46ivX7g9-QI&q=85&s=53ad396c49e4261fc0b9b813446dcbcf" alt="Code example showing how to populate input variables through the inputs field when invoking a Deployment." width="1662" height="1454" data-path="images/docs/d18fbe49e7ab62bac4003851e372d05bcb238286ad07f0de637b0beca34a97e2-image.png" />
  </Tab>
</Tabs>

### Prompt Generator

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    Select the **Generate Prompt** button next to the Role Selector to open the prompt generation assistant.

    <img src="https://mintcdn.com/orqai/x_6IXnot9ETOc_0g/images/docs/2848e0072c425d598d2d841d3531d6d6283420cb9cc34eb90f570dd1944ed2e8-Screenshot_2024-10-07_at_17.19.38.png?fit=max&auto=format&n=x_6IXnot9ETOc_0g&q=85&s=54ce93127c4d908b6cc16bcfeeb77b39" alt="The Generate Prompt button located next to the Role Selector in the prompt editor." width="2294" height="230" data-path="images/docs/2848e0072c425d598d2d841d3531d6d6283420cb9cc34eb90f570dd1944ed2e8-Screenshot_2024-10-07_at_17.19.38.png" />

    * Select **Copy** to copy the generated prompt to the clipboard.
    * Select **Apply** to overwrite the current prompt with the generated one.

          <img src="https://mintcdn.com/orqai/x_6IXnot9ETOc_0g/images/docs/89bca8898d1f275fad5a4a605e2bead1dac8af431ce4c90d34313a6ed6635884-d57d9c6-Screenshot_2024-04-25_at_14.36.39.png?fit=max&auto=format&n=x_6IXnot9ETOc_0g&q=85&s=2c358eedc6a5d375818c178fa79d2717" alt="The prompt generation assistant showing a generated prompt with Copy and Apply buttons." width="1426" height="997" data-path="images/docs/89bca8898d1f275fad5a4a605e2bead1dac8af431ce4c90d34313a6ed6635884-d57d9c6-Screenshot_2024-04-25_at_14.36.39.png" />
  </Tab>
</Tabs>

### Image Generation

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    Image generation models create images from text descriptions. Select a model with an `image` tag in the model picker.

    **Selecting an Image Generation Model**

    <Frame caption="The image tag identifies models capable of generating images.">
      <img src="https://mintcdn.com/orqai/E8L3R46ivX7g9-QI/images/docs/9b5900a-image_models.jpg?fit=max&auto=format&n=E8L3R46ivX7g9-QI&q=85&s=7aa10cf541cbd0993c2e4b3a7410700c" alt="The image tag identifies models capable of generating images." width="1273" height="765" data-path="images/docs/9b5900a-image_models.jpg" />
    </Frame>

    **Configuring Parameters for Image Models**

    Image generation models have different parameters compared to chat models. Parameters vary per model and affect the generated output.

    <Frame caption="Example parameters for the DALL-E 3 model.">
      <img src="https://mintcdn.com/orqai/E8L3R46ivX7g9-QI/images/docs/ac65031-Screenshot_2024-04-15_at_17.44.22.png?fit=max&auto=format&n=E8L3R46ivX7g9-QI&q=85&s=3ac79298a0879ac3bafad9250863365b" alt="Example parameters for the DALL-E 3 model." width="1196" height="266" data-path="images/docs/ac65031-Screenshot_2024-04-15_at_17.44.22.png" />
    </Frame>

    **Using Image Generation in Playground**

    Use image models in the Playground like any other model. Generated images appear as regular messages and can be viewed fullscreen.

    <Frame caption="Example of image generation using Leonardo AI.">
      <img src="https://mintcdn.com/orqai/mDs6v2JrTlXp9Ikl/images/docs/e5ff6a2-image_gen_example.jpg?fit=max&auto=format&n=mDs6v2JrTlXp9Ikl&q=85&s=452583f2c0ec566e804a9cfe87003504" alt="Example of image generation using Leonardo AI." width="2291" height="1499" data-path="images/docs/e5ff6a2-image_gen_example.jpg" />
    </Frame>

    **Use Cases**

    * **Creative Content**: Generate artwork, illustrations, and visual content for marketing materials
    * **Product Design**: Create mockups and visual prototypes based on descriptions
    * **Content Creation**: Generate images for blogs, social media, and presentations
    * **Concept Visualization**: Turn abstract ideas into visual representations

    **Best Practices**

    * **Be Specific**: Provide detailed descriptions for better results
    * **Style Guidelines**: Include artistic style, mood, and visual elements in your prompts
    * **Parameter Tuning**: Experiment with model-specific parameters to achieve desired output quality
    * **Iterative Refinement**: Use generated images as starting points for further refinement
  </Tab>
</Tabs>

### Vision

<Tabs>
  <Tab title="AI Studio" icon="https://mintcdn.com/orqai/My16MDKJXrKALEHC/images/logos/ai-studio-round.svg?fit=max&auto=format&n=My16MDKJXrKALEHC&q=85&s=ac04dd509320d58ab9701cb6d6137733" width="100" height="100" data-path="images/logos/ai-studio-round.svg">
    Vision models analyze and interpret images. Select a model with a `vision` tag in the model picker.

    <Frame caption="The vision label identifies models that can interpret images.">
      <img src="https://mintcdn.com/orqai/E8L3R46ivX7g9-QI/images/docs/9b2f041-vision_models2.jpg?fit=max&auto=format&n=E8L3R46ivX7g9-QI&q=85&s=10971cc6aecba6ded85c22a8a16a491b" alt="The vision label identifies models that can interpret images." width="1265" height="743" data-path="images/docs/9b2f041-vision_models2.jpg" />
    </Frame>

    To include an image as input in the Playground, click the **image icon** at the top-right of the message. Share a link or upload a file to pass to the model.

    <Frame caption="An example use case using a vision model.">
      <img src="https://mintcdn.com/orqai/E8L3R46ivX7g9-QI/images/docs/ab478c4-vision_model_insurance_example.jpeg?fit=max&auto=format&n=E8L3R46ivX7g9-QI&q=85&s=3930bf9180dbab646cf7c9eb42d303b9" alt="An example use case using a vision model for insurance claims processing." width="3209" height="2065" data-path="images/docs/ab478c4-vision_model_insurance_example.jpeg" />
    </Frame>

    **Use Cases**

    * **Document Processing**: Extract text and information from scanned documents and forms
    * **Visual Quality Control**: Analyze product images for defects or compliance
    * **Content Moderation**: Automatically review images for inappropriate content
    * **Medical Imaging**: Analyze medical scans and diagnostic images (with appropriate models)
    * **Insurance Claims**: Process damage assessment photos and documentation

    **Best Practices**

    * **Image Quality**: Ensure images are clear and well-lit for best analysis results
    * **Specific Questions**: Ask focused questions about what you want to extract or understand
    * **Context Provision**: Provide context about what the image represents for better interpretation
    * **Multiple Angles**: For complex analysis, consider providing multiple views of the same subject
  </Tab>

  <Tab title="API & SDK" icon="code">
    Pass images to a vision-capable model via a Deployment invocation using the `image_url` content type with a URL or base64-encoded data URI.

    <CodeGroup>
      ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
      curl --request POST \
           --url https://api.orq.ai/v2/deployments/invoke \
           --header 'accept: application/json' \
           --header 'content-type: application/json' \
           --data '
      {
        "messages": [
          {
            "role": "user",
            "content": "describe what you see in this image"
          },
          {
            "content": [
              {
                "type": "image_url",
                "image_url": {
                  "url": "Either a URL of the image or the base64 encoded image data."
                }
              }
            ]
          }
        ]
      }
      '
      ```
    </CodeGroup>

    <Tip>See the full [Invoke API reference](/reference/deployments/invoke).</Tip>
  </Tab>
</Tabs>

## Fetch a Prompt

<Tabs>
  <Tab title="API & SDK" icon="code">
    Retrieve a Prompt by its ID using the [Retrieve a Prompt API](/reference/prompts/retrieve-a-prompt).

    <CodeGroup>
      ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
      curl --request GET \
           --url https://api.orq.ai/v2/prompts/PROMPT_ID \
           --header 'accept: application/json' \
           --header 'authorization: Bearer ORQ_API_KEY'
      ```

      ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
      import { Orq } from "@orq-ai/node";

      const orq = new Orq({
        apiKey: process.env["ORQ_API_KEY"] ?? "",
      });

      const result = await orq.prompts.retrieve({
        id: "<id>",
      });

      console.log(result);
      ```

      ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
      from orq_ai_sdk import Orq
      import os

      with Orq(
          api_key=os.getenv("ORQ_API_KEY", ""),
      ) as orq:
          res = orq.prompts.retrieve(id="<id>")
          print(res)
      ```
    </CodeGroup>

    <Tip>See the full [Retrieve a Prompt API reference](/reference/prompts/retrieve-a-prompt).</Tip>
  </Tab>
</Tabs>

## Using Skills

Reference [Skills](/docs/prompt-snippets/overview) with `{{skill.key}}` syntax. Inject reusable templates into prompts for modular LLM configuration and DRY prompt engineering.

<Frame caption="Using a Skill to enrich a configured prompt.">
  <img src="https://mintcdn.com/orqai/x_6IXnot9ETOc_0g/images/docs/7374b405d08210a64a932ad62b8c2a5bb54b6ace9b694fd1d9d81912c3bfae79-Screenshot_2024-10-11_at_16.15.21.png?fit=max&auto=format&n=x_6IXnot9ETOc_0g&q=85&s=98b70193724c820a01edc9a45cd7bf4f" alt="Using a Skill to enrich a configured prompt." width="2802" height="878" data-path="images/docs/7374b405d08210a64a932ad62b8c2a5bb54b6ace9b694fd1d9d81912c3bfae79-Screenshot_2024-10-11_at_16.15.21.png" />
</Frame>
