spring-ai icon indicating copy to clipboard operation
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.

Open sunyuhan1998 opened this issue 8 months ago • 2 comments
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:

  1. By comparing the function names in org.stringtemplate.v4.compiler.Compiler#funcs, I skip the validation of these built-in functions.
  2. Added a skipValidate() method to allow users to actively skip this validation.

sunyuhan1998 avatar Mar 13 '25 09:03 sunyuhan1998