Skip to main content

Prompts

Design, test, and manage prompts with Prompt Studio.

Overview

Prompt Studio provides tools for prompt engineering:
  • Visual editor — Design prompts with templates and variables
  • Testing — Test prompts across models
  • Version control — Track prompt changes
  • Collaboration — Team-based prompt development

Prompt Studio

Editor Interface

┌─────────────────────────────────────────────────────────────────────────────┐
│  Prompt Studio                                      [Save] [Test] [Deploy]  │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌─────────────────────────────────────┐  ┌───────────────────────────────┐│
│  │  Prompt Editor                      │  │  Test Panel                   ││
│  │                                     │  │                               ││
│  │  System:                            │  │  Model: gpt-4                 ││
│  │  You are a helpful assistant that   │  │                               ││
│  │  extracts invoice data.             │  │  Variables:                   ││
│  │                                     │  │  document_text: [...]         ││
│  │  User:                              │  │                               ││
│  │  Extract the following fields from  │  │  [Run Test]                   ││
│  │  this invoice:                      │  │                               ││
│  │  {{document_text}}                  │  │  Output:                      ││
│  │                                     │  │  {                            ││
│  │  Return as JSON:                    │  │    "invoice_number": "123",   ││
│  │  - invoice_number                   │  │    "amount": 1250.00,         ││
│  │  - amount                           │  │    ...                        ││
│  │  - vendor_name                      │  │  }                            ││
│  │                                     │  │                               ││
│  └─────────────────────────────────────┘  └───────────────────────────────┘│
│                                                                             │
│  Variables: document_text                          Tokens: 234 | Cost: $0.02│
└─────────────────────────────────────────────────────────────────────────────┘

Creating Prompts

Prompt Structure

Prompt: Invoice Extractor
Type: completion | chat
Messages:
  - role: system
    content: |
      You are a data extraction assistant.
      Extract structured data from invoice documents.
      Always return valid JSON.

  - role: user
    content: |
      Extract the following fields from this invoice:

      {{document_text}}

      Return JSON with:
      - invoice_number (string)
      - amount (number)
      - vendor_name (string)
      - due_date (ISO date)
      - line_items (array)

Variables

Use variables for dynamic content:
SyntaxDescription
{{variable}}Simple substitution
{{variable | default: "value"}}With default
{{#if condition}}...{{/if}}Conditional
{{#each items}}...{{/each}}Iteration
Example with conditions:
{{#if include_examples}}
Here are some examples:
{{#each examples}}
Input: {{this.input}}
Output: {{this.output}}
{{/each}}
{{/if}}

Testing Prompts

Single Test

Test with specific inputs:
  1. Enter variable values in Test Panel
  2. Select model
  3. Click Run Test
  4. Review output

Batch Testing

Test with multiple inputs:
Test Suite: Invoice Extraction
Tests:
  - name: "Standard invoice"
    variables:
      document_text: "Invoice #123..."
    expected:
      contains: "invoice_number"
      json_valid: true

  - name: "International invoice"
    variables:
      document_text: "Factura #456..."
    expected:
      contains: "invoice_number"

Model Comparison

Compare outputs across models:
ModelOutputLatencyCost
GPT-4✓ Valid JSON2.3s$0.03
GPT-3.5✓ Valid JSON0.8s$0.002
Claude 3✓ Valid JSON1.5s$0.02

Advanced Features

Output Parsing

Define expected output format:
Output:
  format: json
  schema:
    type: object
    properties:
      invoice_number:
        type: string
      amount:
        type: number
    required:
      - invoice_number
      - amount
  validation:
    - json_valid
    - matches_schema

Few-Shot Examples

Include examples in prompts:
Examples:
  - input: "Invoice from Acme Corp, #INV-001, $500"
    output: |
      {
        "invoice_number": "INV-001",
        "amount": 500,
        "vendor_name": "Acme Corp"
      }

  - input: "Bill #2024-123 from TechCorp for $1,250.00"
    output: |
      {
        "invoice_number": "2024-123",
        "amount": 1250.00,
        "vendor_name": "TechCorp"
      }

Chain of Thought

Encourage step-by-step reasoning:
Analyze this document step by step:

1. First, identify the document type
2. Then, locate key fields (invoice number, amount, vendor)
3. Extract the values
4. Validate the extraction
5. Return the structured result

Document:
{{document_text}}

Think through each step before providing the final JSON output.

Version Control

Versioning

Track prompt changes:
Version: 2.1.0
Changes:
  - Improved JSON formatting instructions
  - Added handling for international formats
  - Updated examples
Created: 2024-01-15
Author: jane@company.com

Version History

VersionDateAuthorChanges
2.1.02024-01-15JaneJSON improvements
2.0.02024-01-10BobNew extraction schema
1.0.02024-01-01JaneInitial version

Deployment

Deploy specific versions:
Deployment:
  production:
    version: 2.0.0
    deployed: 2024-01-12
  staging:
    version: 2.1.0
    deployed: 2024-01-15

Collaboration

Sharing

Share prompts with team:
Access LevelPermissions
OwnerFull control
EditorEdit, test, version
TesterTest only
ViewerRead only

Comments

Add comments to prompts:
Comments:
  - line: 15
    author: bob@company.com
    text: "Should we add more examples for edge cases?"
    resolved: false

Templates

Create reusable templates:
Template: Extraction Base
Description: Base template for data extraction tasks
Variables:
  - name: entity_type
    description: Type of entity to extract
  - name: document_text
    description: Source document
Content: |
  You are a {{entity_type}} extraction assistant.
  Extract all {{entity_type}} information from the document.

  {{document_text}}

  Return structured JSON.

Using in Workflows

Reference Prompts

Use prompts in workflow nodes:
AI Node:
  type: text-to-text
  prompt_ref: prompts/invoice-extractor@2.1.0
  variables:
    document_text: "{{input.document}}"

Inline vs Referenced

ApproachUse Case
ReferencedShared prompts, version control
InlineSimple, workflow-specific prompts

Best Practices

Prompt Design

  • Be specific and clear in instructions
  • Include output format specifications
  • Use examples for complex tasks
  • Test edge cases

Testing

  • Test with diverse inputs
  • Compare models for quality/cost
  • Validate output format
  • Monitor production performance

Organization

  • Use consistent naming conventions
  • Tag prompts by use case
  • Document prompt purpose
  • Review and update regularly