quarkiverse / quarkus-langchain4j

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

Change the way the request models are collected #1059

Closed mkouba closed 2 weeks ago

mkouba commented 2 weeks ago

Currently, only "specific" injection points, such as @Inject @ModelName ChatLanguageModel, are considered. This means that programmatic lookup, such as @Inject @Any Instance<ChatLanguageModel> or @Inject @All List<ChatLanguageModel>, does not work unless a specific model is injected somewhere else.

See also zulip discussion: https://quarkusio.zulipchat.com/#narrow/channel/187038-dev/topic/named.20ai.20models.3F

geoand commented 2 weeks ago

Thanks for opening the issue. I'll have a look

geoand commented 2 weeks ago

I don't see a good way of handling these to be honest...

manovotn commented 2 weeks ago

I don't see a good way of handling these to be honest...

@geoand What's the reason behind only creating those beans if you find the injection point for them?

To implement this, we'd need to scan the config and pull out all of the models from there. But looking at the code, there is quite some effort to not do that.

geoand commented 2 weeks ago

The idea was to provide great error messages in order to guide users when configuring various models.

Your idea makes sense, but we'll have to move the configuration to build time (which I want to do anyway at some point)

manovotn commented 2 weeks ago

The idea was to provide great error messages in order to guide users when configuring various models.

Your idea makes sense, but we'll have to move the configuration to build time (which I want to do anyway at some point)

I see. You can still keep that and do some best effort in registering all the other models for which you have no injection points. Here's a draft of what I mean - https://github.com/quarkiverse/quarkus-langchain4j/pull/1061 I am not saying the PR is nice; just sharing it to show what I had in mind :)