Closed dennysfredericci closed 10 hours ago
I think we can guard against it with an AtomicBoolean
, that way the timing doesn't matter. Would you be willing to provide such a patch?
Thanks!
Yes, but don’t forget to bring a Quarkus t-shirt next time you visit Belgium! 😛
I reproduced the issue using the existing test AnthropicStreamingChatLanguageModelSmokeTest by adding an empty line for the message_stop event. A complete event also contains an empty line.
....
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":41} }
event: message_stop
data: {"type":"message_stop" }
""";
....
The handleMessageStop
method is now being called twice. I resolved this issue by removing its invocation from onComplete
.
Do you have any objections to removing the invocation from onComplete
?
I will build a version locally and test it in the application that I found the issue.
Thanks a lot!
Yes, but don’t forget to bring a Quarkus t-shirt next time you visit Belgium!
I will try, but marketing get's all the t-shirt budget :)
I found duplicated assistant messages in memory when using quarkus-langchain4j-anthropic with websocket.
I did a quick troubleshooting, and discovered that the handleMessageStop method in QuarkusAnthropicClient is being called twice:
The handleMessageStop method should only be called once, but I'm unsure about the correct timing for this single invocation.