quarkiverse / quarkus-langchain4j

Quarkus Langchain4j extension
https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html
Apache License 2.0
133 stars 79 forks source link

better error message when compiled without -parameters #942

Open maxandersen opened 3 days ago

maxandersen commented 3 days ago

if you (like me) forget to add -parameters to your jbang project then quarkus langchain4j shows this error:

java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:233)
        at io.quarkus.qute.TemplateInstanceBase.data(TemplateInstanceBase.java:45)
        at io.quarkiverse.langchain4j.QuarkusPromptTemplateFactory$QuteTemplate.render(QuarkusPromptTemplateFactory.java:67)
        at dev.langchain4j.model.input.PromptTemplate.apply(PromptTemplate.java:102)
        at io.quarkiverse.langchain4j.runtime.aiservice.AiServiceMethodImplementationSupport.prepareSystemMessage(AiServiceMethodImplementationSupport.java:502)
        at io.quarkiverse.langchain4j.runtime.aiservice.AiServiceMethodImplementationSupport.doImplement(AiServiceMethodImplementationSupport.java:140)
        at io.quarkiverse.langchain4j.runtime.aiservice.AiServiceMethodImplementationSupport.implement(AiServiceMethodImplementationSupport.java:122)

would be great if it would provide hint that the reason for NPE is that parameters are missing names and should add -parameter to the compilation.

geoand commented 2 days ago

Yeah, it makes sense to see what we can better on the Quarkus LangChain4j side, but doesn't it also make sense to have JBang invoke javac with -parameters by default?

geoand commented 2 days ago

Actually, we do have a warning message, it should be:

The application has been compiled without the '-parameters' being set flag on javac. Make sure your build tool is configured to pass this flag to javac, otherwise Quarkus LangChain4j is unlikely to work properly without it.

did you not get that at all?