quarkus-langchain4j icon indicating copy to clipboard operation
quarkus-langchain4j copied to clipboard

[Question] How to get the WatsonxChatModel instance

Open andreadimaio opened this issue 1 year ago • 47 comments

I need to access the WatsonxChatModel class to use some specific functionality that watsonx.ai provides to the developer.

Specifically, I need to call a rest api that returns a prompt stored in watsonx.ai that I would like to use as input of an `AiService'. This would allow me to use a prompt that can be updated and tested by an AI engineer without touching the backend during the dev phase.

Initially my idea was to find a way to integrate this feature into the library with a specific annotation, but this functionality is something that would only be used by watsonx.ai and would require a lot of changes touching different parts of the core module, so the quickest way could be to inject ChatLanguageModel and use ClientProxy.unwrap to have access to the WatsonxChatModel instance where I will add the methods I need.

This change will allow me to avoid rewriting the rest client. Is this the right way to go? Or is it better to use another approach?

andreadimaio avatar Jul 17 '24 16:07 andreadimaio