-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get the service to return anything but a String
.
#671
Comments
If you can attach a sample application that we can use to run and debug things, that would be most helpful |
|
Thanks |
I assume I need some data as well? |
Nope |
I see what the problem is.
|
I tried with arrays before and got a funky error as well. |
Yeah, they don't work great |
Seems like in upstream the methods I need are private, so I'll have to open a PR to open them. |
At some point we probably want to write our own JsonSchema generater from a Jandex type (should be fairly easy), but I don't want to do it now since I have a talk next week. Maybe I can bait you into doing that? :P The upstream code that tries to do this is here. |
I wish I had time to do something like that, but I really can't promise anything soon. I also filed #675 which I hope I might be able to work on in the future. |
🙏🏼 |
It would be helpful if the new parser could be customized using the For example, today the use of the You must respond strictly in the following JSON format: <object_schema> With the custom parser, we could have control of the prefix, which could be enabled or disabled, with a property like quarkus.langchain4j.response-schema.prefix={true|false} This allows the developer to remove the prefix and add something else, for example if they are writing the prompt in a language other than English. |
That's a good point. We just need to do this at some point: I don't envision it to be more than a day's work (likely less) :) |
Correct! But I think that @andreadimaio was looking at something similar... |
I see, well I will give it a shot just in case as without mapped collections it is misses a lot of potential :D |
I'm looking for how to force the LLM provider to force the use of the json/json-schema mode but not the deserialization of collections. |
@geoand I think part in QuarkusServiceOutputParser is one thing, the other is having tools argument to be lists. I found this in ToolProcessor.java is extension deployment:
Do you happen to have any ideas if its even possible to resolve generic types from Collections there? I think java is eliding generic types at runtime isnt it? |
…s in tool arguments resolves quarkiverse#671
…chema, to allow collections in tool arguments
…chema, to allow collections in tool arguments
…chema, to allow collections in tool arguments
…chema, to allow collections in tool arguments
@geoand I think I was wrong about that type elision, I will try to also put required and optional parameters but in general now it works, but I also need to check when strict set, as this is adding some extra field checks on schema. Then I will also adjust output parser |
Correct! #1039 seems to cover that pretty well |
@geoand Can we reopen this? I wanted to still tackle the case mentioned by @FroMage as well, As mapping results from case he mentions |
Oh, I was not aware it was closed automatically |
The docs at https://docs.quarkiverse.io/quarkus-langchain4j/dev/ai-services.html#_ai_method_return_type say I should be able to get a structured return type from my service, but it does not seem to support anything but a
String
.This generates the following exception:
So it looks like the generated service interface has
String
as a method return type.Also, @geoand told me:
But the docs say:
So that's contradictory.
The text was updated successfully, but these errors were encountered: