Package dev.langchain4j.reactive.streaming
package dev.langchain4j.reactive.streaming
-
ClassDescriptionBuilds a reactive
Publisher<ChatModelStreamingEvent>for a streaming chat model from an upstreamPublisher<HttpStreamingEvent>(typicallyhttpClient.stream(request, parser)), factoring out the boilerplate every provider's reactive path otherwise hand-rolls: a bounded, back-pressuredTubeofChatModelStreamingEvents (ZeroPublisher); a subscriber whose cancellation is subscription-based — it cancels the upstreamFlow.Subscriptionon any terminal signal (a downstream cancel, an error, or a buffer overflow), so, for example, an overflow actually aborts the HTTP connection; and delegation of each upstream event to a provider-suppliedHttpStreamingChatPublisher.Sink. Only the per-event interpretation (parsing the provider's SSE payloads and driving aStreamingChatResponseHandler/TubeBackedStreamingChatResponseHandler) is provider-specific; that lives in theHttpStreamingChatPublisher.Sink, created per subscription from theTube.Consumes the upstreamHttpStreamingEvents of a single subscription and drives the assembledChatModelStreamingEvents into theTube(typically via aTubeBackedStreamingChatResponseHandler).Shared defaults for the reactive (Flow.Publisher) streaming path used by streaming chat model providers.Bridge from the handler-basedStreamingChatResponseHandlercontract to aTubeofChatModelStreamingEvents.