Class SaaStTemplateRenderer.Builder
java.lang.Object
com.alibaba.cloud.ai.graph.agent.renderer.SaaStTemplateRenderer.Builder
- Enclosing class:
- SaaStTemplateRenderer
Builder for configuring and creating
SaaStTemplateRenderer instances.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns a newSaaStTemplateRendererinstance with the configured settings.endDelimiter(String endDelimiterString) Sets the string used as the end delimiter for template expressions.endDelimiterToken(char endDelimiterToken) Sets the character used as the end delimiter for template expressions.startDelimiter(String startDelimiterString) Sets the string used as the start delimiter for template expressions.startDelimiterToken(char startDelimiterToken) Sets the character used as the start delimiter for template expressions.Configures the renderer to support StringTemplate's built-in functions during validation.validationMode(org.springframework.ai.template.ValidationMode validationMode) Sets the validation mode to control behavior when the provided variables do not match the variables required by the template.
-
Method Details
-
startDelimiterToken
Sets the character used as the start delimiter for template expressions. Default is '{'.- Parameters:
startDelimiterToken- The start delimiter character.- Returns:
- This builder instance for chaining.
-
endDelimiterToken
Sets the character used as the end delimiter for template expressions. Default is '}'.- Parameters:
endDelimiterToken- The end delimiter character.- Returns:
- This builder instance for chaining.
-
startDelimiter
Sets the string used as the start delimiter for template expressions. This allows using multi-character delimiters (e.g., "{{") which is useful for avoiding conflicts with JSON content or other text that uses single-character delimiters.When string delimiters are set, they take precedence over character delimiters.
- Parameters:
startDelimiterString- The start delimiter string (e.g., "{{").- Returns:
- This builder instance for chaining.
-
endDelimiter
Sets the string used as the end delimiter for template expressions. This allows using multi-character delimiters (e.g., "}}") which is useful for avoiding conflicts with JSON content or other text that uses single-character delimiters.When string delimiters are set, they take precedence over character delimiters.
- Parameters:
endDelimiterString- The end delimiter string (e.g., "}}").- Returns:
- This builder instance for chaining.
-
validationMode
public SaaStTemplateRenderer.Builder validationMode(org.springframework.ai.template.ValidationMode validationMode) Sets the validation mode to control behavior when the provided variables do not match the variables required by the template. Default isValidationMode.THROW.- Parameters:
validationMode- The desired validation mode.- Returns:
- This builder instance for chaining.
-
validateStFunctions
Configures the renderer to support StringTemplate's built-in functions during validation.When enabled (set to true), identifiers in the template that match known ST function names (e.g., "first", "rest", "length") will not be treated as required input variables during validation.
When disabled (default, false), these identifiers are treated like regular variables and must be provided in the input map if validation is enabled (
ValidationMode.WARNorValidationMode.THROW).- Returns:
- This builder instance for chaining.
-
build
Builds and returns a newSaaStTemplateRendererinstance with the configured settings.- Returns:
- A configured
SaaStTemplateRenderer.
-