Skip to main content
Greenflash provides a comprehensive platform for managing and optimizing AI prompts based on real user interactions. This guide covers everything from basic prompt structure to advanced optimization strategies.

Understanding Prompts in Greenflash

Simple String Format (Quick Start)

The easiest way to get started with Greenflash is to submit your system prompt as a simple string:
This simple format:
  • ✅ Automatically tracks and versions your prompts
  • ✅ Links prompts to conversation outcomes
  • ✅ Generates optimization suggestions
  • ✅ Provides performance analytics
  • ❌ Can’t use template variables or dynamic content
  • ❌ Can’t use component-level optimization
Perfect for: Teams wanting to start analyzing and optimizing prompts immediately without any structural changes.

Advanced: Prompt Components

For more control and features, prompts in Greenflash can be built from components - modular pieces that can be combined, versioned, and optimized independently:
Component Types:
  • system - Core instructions and behavior guidelines
  • user - User-provided context or instructions
  • tool - Tool outputs and function call results
  • guardrail - Safety checks and content moderation rules
  • rag - Retrieval-augmented generation context
  • agent - Agent tool outputs and observations
  • other - Custom or miscellaneous component types

Templates and Variables

Greenflash supports variable interpolation using Handlebars-style syntax ({{variableName}}), allowing you to create reusable templates:

Dynamic Content Slots

The isDynamic flag indicates components with content that varies per conversation (like RAG results):
Key distinction:
  • isDynamic: false - Template components (may have variables)
  • isDynamic: true - Dynamic content slots (RAG, agent outputs)
Both types can contain variables that will be interpolated!

Recording Prompts via API

Simple String Format

The quickest way to start - just pass your prompt as a string:
Greenflash automatically converts this to a component internally and tracks all the same metrics. When you’re ready for more features, you can switch to the component format.

Component-Based Prompt Logging

For more control, structure your prompts using components:

Using External IDs

Track prompts across different environments with external IDs:

Component-Level Management

Mix and match components to create flexible prompt architectures:

Managing Prompts via API

The management API endpoints require component format. Simple string prompts are automatically converted to components when logged, but explicit prompt creation/updates need the structured format.

Create a Prompt

Create and version prompts explicitly:

Update a Prompt

Update existing prompts while maintaining version history:

Retrieve a Prompt

Fetch prompts with optional variable interpolation:

List Prompts

Browse and filter your prompt library:

Template Matching and Deduplication

Greenflash automatically deduplicates prompts based on their template content, not the hydrated values. When you use variables, the template (with {{placeholders}}) is what gets hashed and versioned — different variable values reuse the same template.
This ensures:
  • Consistent versioning across variable values
  • No prompt/version explosion from per-user content
  • Accurate performance metrics
  • Efficient storage
  • Better optimization insights

UI Features

The Greenflash dashboard provides powerful prompt management capabilities:

Prompt Library

  • Browse all prompts across products
  • Filter by type, usage, performance
  • View version history
  • Compare prompt versions side-by-side

Performance Analytics

  • Usage metrics - How often each prompt is used
  • Quality scores - Average CQI per prompt version
  • Sentiment analysis - User satisfaction by prompt
  • Error rates - Hallucination and failure patterns
  • Latency impact - Response time by prompt complexity

Optimization Suggestions

  • AI-generated improvements based on conversation analysis
  • A/B testing recommendations
  • Side-by-side comparisons with expected impact
  • Evidence from actual conversations

Collaboration Tools

  • Name and organize prompts
  • Add descriptions and documentation
  • Tag prompts for easy discovery
  • Share prompts across teams

Active Optimization

How Greenflash Improves Prompts

Greenflash continuously analyzes conversations to identify optimization opportunities:
  1. Pattern Recognition
    • Detects recurring user confusion
    • Identifies successful interaction patterns
    • Finds correlation between prompts and outcomes
  2. Failure Analysis
    • Tracks where conversations go wrong
    • Identifies prompt ambiguities
    • Detects missing instructions
  3. Success Modeling
    • Learns from high-quality conversations
    • Identifies effective prompt patterns
    • Suggests proven improvements

Optimization Examples

Before optimization:
After Greenflash analysis:

Implementing Suggestions

Review and apply optimizations through the UI or API:

Best Practices

1. Use Components Strategically

  • Separate concerns into different components
  • Share common components across prompts
  • Version components independently

2. Leverage Variables

  • Use variables for customer-specific information
  • Keep templates generic and reusable
  • Document required variables clearly

3. Track Everything

  • Include prompts with every conversation
  • Use consistent external IDs
  • Monitor performance metrics

4. Iterate Based on Data

  • Review optimization suggestions weekly
  • Test improvements with small user segments
  • Measure impact before full rollout

5. Organize for Scale

  • Use clear naming conventions
  • Document prompt purposes
  • Maintain a prompt changelog

Advanced Features

Conditional Components

Use metadata to conditionally include components:

Prompt Chains

Track multi-turn prompt strategies:

Getting Started Checklist

Quick Start (Simple String)

  1. Log with string prompts - Pass your prompt as a simple string
  2. Monitor metrics - Review performance in the dashboard
  3. Review suggestions - Apply AI-generated improvements
  4. Graduate to components - Add structure when you need more features

Full Implementation (Components)

  1. Set up component logging - Structure prompts into logical components
  2. Add variables - Use templates for customer-specific content
  3. Set external IDs - Track prompts across environments
  4. Configure dynamic slots - Mark RAG/agent components appropriately
  5. Monitor metrics - Review detailed performance analytics
  6. Review suggestions - Apply component-level optimizations
  7. Iterate and improve - Continuously optimize based on data

API Reference

Full API documentation for prompt management:

Next

AI Product Analysis

Understand conversation metrics and performance insights.

Webhooks

Set up real-time alerts for prompt performance changes.

SDK Integration

Language-specific examples for implementing prompt optimization.