quarkiverse/quarkus-langchain4j

Allow the injection of TokenCountEstimator

Closed this issue · 5 comments

Today it is not possible to inject the TokenCountEstimator, this could be useful to estimate the number of tokens.

Where would one inject that?

The idea is to have the same configuration of the ChatLanguageModel, in this case the developers can inject the interface where they prefer.

For example, suppose I have two AIServices configured with watsonx, one with llama3 and the other with mixstral. The developer could inject the TokenCountEstimator for both models and choose which to use based on the token counts.

This is an idea of what I have in mind LINK.

We can certainly do that and it does makes sense!

Ok, I'm going to share what I wrote (I have more tests to add) for the end of the day.

Thanks!