Interface RawStreamingEvent
- All Superinterfaces:
ChatModelStreamingEvent
ChatModelStreamingEvent type — for example a web-search, citation or reasoning-summary event.
This is an escape hatch: rather than silently dropping such events, a provider surfaces them as
RawStreamingEvent so callers can consume them — typically by inspecting rawEvent()
themselves — even though the library has no typed representation for them.
Consumers must be prepared to receive event types they do not recognize and ignore them (see
StreamingChatModel.chat(dev.langchain4j.model.chat.request.ChatRequest)).
This is the reactive (ChatModelStreamingEvent publisher) counterpart of the handler-based
StreamingChatResponseHandler.onUnmappedRawEvent(Object) callback: it carries the same raw provider
event.
Forward compatibility. This is an interface on purpose. If such an event later graduates to a
dedicated typed event, that typed event can also implement
RawStreamingEvent (exposing the same rawEvent()). A single emitted object then satisfies
both audiences: code that matched instanceof RawStreamingEvent and inspected rawEvent()
keeps working, while new code can match the typed event and use its typed accessors.
- Since:
- 1.20.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic RawStreamingEventCreates aRawStreamingEventwrapping the given raw provider event.rawEvent()The raw provider streaming event that LangChain4j does not map to a typedChatModelStreamingEvent.
-
Method Details
-
rawEvent
Object rawEvent()The raw provider streaming event that LangChain4j does not map to a typedChatModelStreamingEvent.Its type depends on the provider implementation: implementations built on the
dev.langchain4j.http.client.HttpClientabstraction (e.g., OpenAI) typically expose aServerSentEvent; SDK-based implementations may expose the SDK's own event object. The object's shape is the provider's wire format and carries no stability guarantee. -
of
Creates aRawStreamingEventwrapping the given raw provider event.- Parameters:
rawEvent- the raw provider streaming event; seerawEvent()- Returns:
- a
RawStreamingEventcarryingrawEvent
-