Skip to main content

Installation

Install the Helicone prompts package:

Quick Start

Core Methods

getPromptBody

Retrieves a prompt, substitutes variables, and returns the compiled body ready for your LLM provider.

pullPromptVersion

Fetches prompt version metadata without the full body.

pullPromptBody

Retrieves the raw prompt body without variable substitution.

Working with Variables

Helicone prompts support typed variables using the {{hc:name:type}} syntax.

Variable Types

Variable Validation

The SDK validates variable types and returns errors:

Extract Variables from Template

Working with Prompt Partials

Prompt partials allow you to reuse content from other prompts.

Using Partials

Extract Prompt Partials

Get Partial Substitution Value

Environment-Based Loading

Version-Specific Loading

Merging with Additional Parameters

Combine template prompts with runtime parameters:

Advanced: Custom Variable Substitution

Advanced: JSON Variable Substitution

For complex objects like tools or response formats:

Error Handling

Type Definitions

Complete Integration Example

Next Steps

Overview

Learn about prompt management concepts

Versioning

Manage prompt versions

Deployment

Deploy prompts to environments

API Reference

Explore the Prompts API