helidon-io / helidon

Java libraries for writing microservices
https://helidon.io
Apache License 2.0
3.44k stars 562 forks source link

4.x: SSE mediaType comes null after first consumed event #8922

Open jbescos opened 4 days ago

jbescos commented 4 days ago

Description

Events with media type are throwing exception after the first is sent. The reason is that there is one workflow that creates a new builder and forgets about the mediaType.

2024.06.28 15:09:45 INFO io.helidon.ai.integration.Main !thread!: Response is: 
Exception in thread "main" java.lang.IllegalStateException: Media context has not been set on this event
    at io.helidon.http.sse.SseEvent.data(SseEvent.java:125)
    at io.helidon.http.sse.SseEvent.data(SseEvent.java:153)
    at io.helidon.ai.openai.OpenAIStreamingChatModel$1.onEvent(OpenAIStreamingChatModel.java:71)
    at io.helidon.ai.openai.OpenAIStreamingChatModel$1.onEvent(OpenAIStreamingChatModel.java:68)
    at io.helidon.webclient.sse.SseSourceHandlerProvider.handle(SseSourceHandlerProvider.java:72)
    at io.helidon.webclient.http1.Http1ClientResponseImpl.source(Http1ClientResponseImpl.java:173)
    at io.helidon.ai.openai.OpenAIStreamingChatModel.call(OpenAIStreamingChatModel.java:68)
    at io.helidon.ai.integration.Main.openAIStreamingChatModel(Main.java:86)
    at io.helidon.ai.integration.Main.main(Main.java:58)

Documentation

N/A