Creates a new TextPromptClient instance.
The text prompt data
Whether this is fallback content
ReadonlycommitOptional commit message for the prompt version
ReadonlyconfigConfiguration object associated with the prompt
ReadonlyisWhether this prompt client is using fallback content
ReadonlylabelsLabels associated with the prompt
ReadonlynameThe name of the prompt
ReadonlypromptThe text content of the prompt
ReadonlypromptThe original prompt response from the API
ReadonlytagsTags associated with the prompt
ReadonlytypeThe type of prompt ("text" or "chat")
ReadonlyversionThe version number of the prompt
Protected_Compiles the text prompt by substituting variables.
Uses Mustache templating to replace {{variable}} placeholders with provided values.
Optionalvariables: Record<string, string>Key-value pairs for variable substitution
Optional_placeholders: Record<string, any>Ignored for text prompts
The compiled text with variables substituted
ProtectedescapeEscapes 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.