Skip to content

PromptTemplate should configure error reporting in String Template #3604

@pkubowicz

Description

@pkubowicz

Expected Behavior

I would like to see details about what is wrong with my prompt template in my logs (that go to LogStash or a similar system), not in standard error.

So if I have code:

PromptTemplate.builder().template("bad {template").build().create()

there should be something like

11:12:13 org.springframework.ai.template.st.StTemplateRenderer ERROR 1:13: premature EOF

Current Behavior

org.stringtemplate.v4.misc.ErrorManager#DEFAULT_ERROR_LISTENER is used, which prints using System.err.println. So the message is unstructured message in stderr:

1:13: premature EOF

Context

I think StTemplateRenderer should pass a custom implementation of STErrorListener that uses SLF4J instead of System.err.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions