Closed philippart-s closed 2 months ago
@langchain4j is this a known issue on the library side?
@geoand I can't reproduce the missing content
scenario, but it should work fine on our side:
Handling of missing content
: https://github.com/langchain4j/langchain4j/blob/d34e1df9caa7747083eb927cb92283d2cc37c9e0/langchain4j-mistral-ai/src/main/java/dev/langchain4j/model/mistralai/DefaultMistralAiClient.java#L139
if I can add my opinion, for me the issue is here: https://github.com/quarkiverse/quarkus-langchain4j/blob/9e6f7596e23888a6e5d909ff9d5f6d086be65e5a/mistral/runtime/src/main/java/io/quarkiverse/langchain4j/mistralai/QuarkusMistralAiClient.java#L82
If the chunk
is null it is sent to this:
https://github.com/langchain4j/langchain4j/blob/d34e1df9caa7747083eb927cb92283d2cc37c9e0/langchain4j/src/main/java/dev/langchain4j/service/AiServiceStreamingResponseHandler.java#L53
And then a NPE is thrown.
@philippart-s would you like to provide a PR with the proposed fix?
@philippart-s would you like to provide a PR with the proposed fix?
If you agree with my proposal, I'd love to 😉
Go right ahead :)
I'm not sure if it's the same problem, but I also use Mistral 7b locally, and the problem is each time it finishes token streaming, it returns this error to me. When i inspect with Postman it seems to me that the last token has no content in it (to indicate that it's done) but somehow the code continues to pass in the onNext block which causes this IllegalArgumentException instead of entering the onComplete block. For the streaming code, I literally copied paste the one from the example.
Have you tried with 0.12.1?
That is the version of which one ?
Of quarkus-langchain4j-mistral-ai
Ok thanks I'll try it out and I'll let you know if the problem persists
🙏🏼
Hi, I use Mistral 7b model self deployed and I have the following error in streaming mode:
this seems to be due to the fact that the first JSON response line has not a
content
field:Perhaps it should be fine to test the presence of the
content
field?