Gemini response format Plain-Text (Seems not permitted) #2047
Replies: 2 comments
-
|
Thanks for reporting! I can't say I understand the issue completely, but if you have a reproducer, that would help a lot. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the quick reply. Thanks for your quick reply, have a nice day. As mentioned in the PR, there is a quick fix for me if I set the response format to zero as described in the PR, i dont get the NPE Cheers |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
Happy New Year first of all, I hope you've had a good start to the new year.
Is it possible that GeminiChatLanguageModel does not currently allow direct return from the string, but only within a json?
See:
https://github.com/quarkiverse/quarkus-langchain4j/blob/main/model-providers/google/gemini/gemini-common/runtime/src/main/java/io/quarkiverse/langchain4j/gemini/common/GeminiChatLanguageModel.java
When the chat function is called and the response type is text, the JSON schema is deliberately and correctly null.
However, this currently results in an NPE
I also set .responseFormat(ResponseFormat.TEXT)

Also i use the chatLanguageModelSupplier functionality
This is caused by:
public static Schema fromJsonSchemaToSchema(JsonSchema jsonSchema) { var result = fromJsonSchemaToSchema(jsonSchema.rootElement()); if ((result == null) || result.isEffectiveEmptyObject()) { return null; } return result; }Is there any solution here, or is the answer that all responses must be JSON, even if the object only has a single string?
Thank you for your time.
Best regards
Simon
Beta Was this translation helpful? Give feedback.
All reactions