quarkiverse / quarkus-langchain4j

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

:grey_question: (SYSTEM) PROMPT as external configuration #540

Closed adriens closed 2 months ago

adriens commented 2 months ago

:information_source: Context

We are bulding an agent for our division, its aim is to answer incoming questions so we don't have to.

We have currently working on the Quarkus/podman/ollama stack.

I would like to share the same SYSTEM PROMPT accross all our functions to provide an homogeneous UX for people asking questions.

eg :

You are the assisstant of GLIA division, your mission is to....

We have started to implement some functions and I wonder how we could inject SYSTEM prompt from within standard conf files so we can use it in very wide amount of places in our code and :

:grey_question: Question

geoand commented 2 months ago

Hi,

It seems to me that @SystemMessage(fromResource="someresource") is what you are after.

adriens commented 2 months ago

Hi,

It seems to me that @SystemMessage(fromResource="someresource") is what you are after.

Looks like, yes, do there is some example in the samples ?

geoand commented 2 months ago

There are tests that use it, but I am not in front of my machine now so it's hard to find them.

I can look later

adriens commented 2 months ago

No worry, that's very cool to get these elements :pray:

geoand commented 2 months ago

This is an example usage in our testsuite

adriens commented 2 months ago

Es ist wirklich gut, vielen danke für die hefle :

    interface Translator {

        @SystemMessage(fromResource = "messages/translate-system")
        @UserMessage(fromResource = "/messages/translate-user.txt")
        String translate(@V("text") String text, @V("lang") String language);
    }