spring-ai
spring-ai copied to clipboard
Fixed the issue where using built-in functions in PromptTemplate caused validation failures, and added a method:skipValidate() to skip validation for PromptTemplate.
trafficstars
As mentioned in https://github.com/spring-projects/spring-ai/issues/2456, when using PromptTemplate, if the template contains certain built-in functions, it fails validation during render(). I made the following two fixes and optimizations:
- By comparing the function names in
org.stringtemplate.v4.compiler.Compiler#funcs, I skip the validation of these built-in functions. - Added a
skipValidate()method to allow users to actively skip this validation.