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

qute templating not working anymore #141

Closed cescoffier closed 9 months ago

cescoffier commented 9 months ago

In the triage application:

2023-12-13 08:50:25,350 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /review failed, error id: 96d58d36-8cfc-436a-9a57-9058e5151e4a-2: io.quarkus.qute.TemplateException: Rendering error: Entry "review" not found in the data map in expression {review}

code:

@SystemMessage("""
            You are working for a bank. You are an AI processing reviews about financial products. You need to triage the reviews into positive and negative ones.
            You will always answer with a JSON document, and only this JSON document.
            """)
    @UserMessage("""
            Your task is to process the review delimited by ---.
            Apply a sentiment analysis to the passed review to determine if it is positive or negative.
            The review can be in any language. So, you will need to identify the language.

            For example:
            - "I love your bank, you are the best!", this is a 'POSITIVE' review
            - "J'adore votre banque", this is a 'POSITIVE' review
            - "I hate your bank, you are the worst!", this is a 'NEGATIVE' review

             Answer with a JSON document containing:
            - the 'evaluation' key set to 'POSITIVE' if the review is positive, 'NEGATIVE' otherwise, depending if the review is positive or negative
            - the 'message' key set to a message thanking the customer in the case of a positive review, or an apology and a note that the bank is going to contact the customer in the case of a negative review. These messages must be polite and use the same language as the passed review.

            ---
            {review}
            ---
            """)
    @Retry(maxRetries = 2)
    @Fallback(fallbackMethod = "fallback")
    TriagedReview triage(String review);

    static TriagedReview fallback(String review) {
        return new TriagedReview(Evaluation.NEGATIVE, "Sorry, we are unable to process your review at the moment. Please try again later.");
    }
geoand commented 9 months ago

I cannot reproduce this unfortunately

geoand commented 9 months ago

My best guess is that in your example, <maven.compiler.parameters>true</maven.compiler.parameters> has not been set

cescoffier commented 9 months ago

hum... weird,

it's just a copy of the triage app using the last release.

cescoffier commented 9 months ago

Seems to comes from fault tolerance. As soon as I added that extension, it happened (even if I removed the annotation)

geoand commented 9 months ago

I added FT and didn't see the problem. But let me try again

cescoffier commented 9 months ago

ok, the issue only happens in dev mode.

cescoffier commented 9 months ago

well, it's a combination of things.... I need to find the proper scenario (because users will do it)

geoand commented 9 months ago

I still can't reproduce it...

cescoffier commented 9 months ago

ok, forget about it, found the issue:

you cannot reconfigure the maven compiler plugin when FT is used.