Creates a new TextPromptClient instance.
The text prompt data
Whether this is fallback content
Readonly
commitOptional commit message for the prompt version
Readonly
configConfiguration object associated with the prompt
Readonly
isWhether this prompt client is using fallback content
Readonly
labelsLabels associated with the prompt
Readonly
nameThe name of the prompt
Readonly
promptThe text content of the prompt
Readonly
promptThe original prompt response from the API
Readonly
tagsTags associated with the prompt
Readonly
typeThe type of prompt ("text" or "chat")
Readonly
versionThe version number of the prompt
Protected
_Compiles the text prompt by substituting variables.
Uses Mustache templating to replace {{variable}} placeholders with provided values.
Optional
variables: Record<string, string>Key-value pairs for variable substitution
Optional
_placeholders: Record<string, any>Ignored for text prompts
The compiled text with variables substituted
Protected
escapeEscapes every curly brace that is part of a JSON object by doubling it.
A curly brace is considered “JSON-related” when, after skipping any immediate whitespace, the next non-whitespace character is a single (') or double (") quote.
Braces that are already doubled (e.g. {{variable}}
placeholders) are left untouched.
Input string that may contain JSON snippets.
The string with JSON-related braces doubled.
Converts the prompt to LangChain PromptTemplate format.
Transforms Mustache-style {{variable}} syntax to LangChain's {variable} format.
Optional
_options: { placeholders?: Record<string, any> }Ignored for text prompts
The prompt string compatible with LangChain PromptTemplate
Serializes the prompt client to JSON.
JSON string representation of the prompt
Client for working with text-based prompts.
Provides methods to compile text prompts with variable substitution and convert them to LangChain-compatible formats.