cescoffier / quarkus-llm-workshop

Quarkus LLM workshop
https://cescoffier.github.io/quarkus-llm-workshop/
Apache License 2.0
18 stars 10 forks source link

Quarkus template can't resolve param name #23

Open sdaschner opened 5 months ago

sdaschner commented 5 months ago

When trying out the project (cloning, mvn quarkus:dev, however with ollama as backend) I ran into the following error:

io.quarkus.qute.TemplateException: Rendering error: Entry "review" not found in the data map in expression {review}
    at io.quarkus.qute.TemplateException$Builder.build(TemplateException.java:169)
    at io.quarkus.qute.EvaluatorImpl.propertyNotFound(EvaluatorImpl.java:234)
    at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:204)
    at io.quarkus.qute.EvaluatorImpl.resolveReference(EvaluatorImpl.java:131)
    at io.quarkus.qute.EvaluatorImpl.evaluate(EvaluatorImpl.java:85)
    at io.quarkus.qute.ResolutionContextImpl.evaluate(ResolutionContextImpl.java:29)
    at io.quarkus.qute.ExpressionNode.resolve(ExpressionNode.java:36)
[...]

It worked when I added the @V annotation from langchain4j to the param. Not sure if that is intented but that solved it for me:

// TriageService
TriagedReview triage(@V("review") String review);
cescoffier commented 5 months ago

@geoand - Do we support @V ? I don't think so. I guess we just use the name of the parameter.

geoand commented 5 months ago

We do support it

sdaschner commented 5 months ago

At least it didn't work for me without @V. I also reasoned that there might be an issue with my build/compilation that it doesn't resolve the param name from the Java signature, so maybe there is a fixable Quarkus issue in that version, not sure...

geoand commented 5 months ago

Do you have <maven.compiler.parameters>true</maven.compiler.parameters> set?

sdaschner commented 5 months ago

No, I haven't, good point

geoand commented 5 months ago

That setting is pretty much mandatory for lots of Quarkus extensions :)

sdaschner commented 5 months ago

Oh but wait, in this repository that param is set, and it still didn't work for me without @V...

https://github.com/cescoffier/quarkus-llm-workshop/blob/main/triage-application/pom.xml#L21

geoand commented 5 months ago

I will give a try shortly

geoand commented 5 months ago

I could not reproduce the reported issue