Interface IPromptExecutionObjectGraphPlaceholderReplacerBuilder
public interface IPromptExecutionObjectGraphPlaceholderReplacerBuilder
Builder for a replacer that replaces placeholders in an object graph of a prompt model.
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new replacer instance for replacing placeholders in an object graph, using the current configuration.contextPlaceholderResolver(IPromptExecutionReplacerContextResolver contextResolver) Sets an optional context resolver to resolve context placeholders.escaper(IPromptExecutionReplacerEscaper escaper) Sets the escaper to escape replaced values.replacePlaceholdersInTextParameters(boolean replacePlaceholdersInTextParameters) Sets whether to replace placeholders in text parameters.replacer(IPromptExecutionReplacer replacer) Sets the replacer to use for replacing placeholders.textParameterContextName(String textParameterContextName) Sets the context name for text parameters.textParameters(Object textParameters) Sets the text parameters with the data for context placeholders whose context name matches the configuredcontext name.
-
Method Details
-
build
Creates a new replacer instance for replacing placeholders in an object graph, using the current configuration. Subsequent modifications to this builder do not affect the created instance.- Returns:
- The replacer instance.
-
contextPlaceholderResolver
IPromptExecutionObjectGraphPlaceholderReplacerBuilder contextPlaceholderResolver(IPromptExecutionReplacerContextResolver contextResolver) Sets an optional context resolver to resolve context placeholders. This is in addition to and independent ofreplacing text parameter context placeholders. When set, this context resolve is applied first, before text parameter context placeholders are resolved.- Parameters:
contextResolver- The context resolver. When null, no additional context resolution is performed.- Returns:
- This builder for chaining method calls.
-
escaper
IPromptExecutionObjectGraphPlaceholderReplacerBuilder escaper(IPromptExecutionReplacerEscaper escaper) Sets the escaper to escape replaced values. When not set, no escaping is performed.- Parameters:
escaper- The escaper. When null, no escaping is performed.- Returns:
- This builder for chaining method calls.
-
replacePlaceholdersInTextParameters
IPromptExecutionObjectGraphPlaceholderReplacerBuilder replacePlaceholdersInTextParameters(boolean replacePlaceholdersInTextParameters) Sets whether to replace placeholders in text parameters. If true, placeholders in text parameters are replaced, using the configuredreplacer(IPromptExecutionReplacer). If false, they are not replaced. Defaults to false.- Parameters:
replacePlaceholdersInTextParameters- Whether to replace placeholders in text parameters.- Returns:
- This builder for chaining method calls.
-
replacer
Sets the replacer to use for replacing placeholders. If not set, uses a replacer that only replaces context placeholders.- Parameters:
replacer- The replacer to use.- Returns:
- This builder for chaining method calls.
-
textParameterContextName
IPromptExecutionObjectGraphPlaceholderReplacerBuilder textParameterContextName(String textParameterContextName) Sets the context name for text parameters. Context placeholders are of the form[%<Context-Name>.<Content>%]. When the context name of the placeholder matches the configured name, the content of the context placeholder is interpreted as a JSON path into the providedtext parameters.Defaults to "param".
- Parameters:
textParameterContextName- The context name.- Returns:
- This builder for chaining method calls.
-
textParameters
Sets the text parameters with the data for context placeholders whose context name matches the configuredcontext name. Context placeholders are of the form[%<Context-Name>.<Content>%]. The content of the context placeholder is interpreted as a JSON path into the provided text parameters.Default to null.
-