Creates a new ChatPromptClient instance.
The chat 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 chat messages that make up 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 chat prompt by replacing placeholders and variables.
First resolves placeholders with provided values, then applies variable substitution to message content using Mustache templating. Unresolved placeholders remain as placeholder objects in the output.
Optionalvariables: Record<string, string>Key-value pairs for Mustache variable substitution in message content
Optionalplaceholders: Record<string, any>Key-value pairs where keys are placeholder names and values are ChatMessage arrays
Array of ChatMessage objects and unresolved placeholder objects
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 ChatPromptTemplate format.
Resolves placeholders with provided values and converts unresolved ones to LangChain MessagesPlaceholder objects. Transforms variables from {{var}} to {var} format without rendering them.
Optionaloptions: { placeholders?: Record<string, any> }Configuration object
Optionalplaceholders?: Record<string, any>Key-value pairs for placeholder resolution
Array of ChatMessage objects and LangChain MessagesPlaceholder objects
Serializes the prompt client to JSON.
JSON string representation of the prompt
Client for working with chat-based prompts.
Provides methods to compile chat prompts with variable substitution and placeholder resolution, and convert them to LangChain-compatible formats.