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 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

      Sets an optional context resolver to resolve context placeholders. This is in addition to and independent of replacing 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

      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 configured replacer(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 provided text 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 configured context 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.

      Parameters:
      textParameters - The text parameters object. Should be a JSON like object, i.e. null, Boolean, Number, String; or a List or Map thereof.
      Returns:
      This builder for chaining method calls.