Class TokenStreamExtensionsKt
-
- All Implemented Interfaces:
public final class TokenStreamExtensionsKt
-
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerDEFAULT_BUFFER_CAPACITY
-
Method Summary
Modifier and Type Method Description final static Flow<String>asFlow(TokenStream $self, Integer bufferCapacity, BufferOverflow onBufferOverflow, Boolean includeCompleteResponse)Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error. final static Flow<String>asFlow(TokenStream $self, Integer bufferCapacity, BufferOverflow onBufferOverflow)Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error. final static Flow<String>asFlow(TokenStream $self, Integer bufferCapacity)Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error. final static Flow<String>asFlow(TokenStream $self)Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error. final static Flow<StreamingChatModelReply>asReplyFlow(TokenStream $self, Integer bufferCapacity, BufferOverflow onBufferOverflow)Converts a TokenStreaminto aFlowofStreamingChatModelReplyinstances, where each emitted item represents a partial or complete response received during streaming.final static Flow<StreamingChatModelReply>asReplyFlow(TokenStream $self, Integer bufferCapacity)Converts a TokenStreaminto aFlowofStreamingChatModelReplyinstances, where each emitted item represents a partial or complete response received during streaming.final static Flow<StreamingChatModelReply>asReplyFlow(TokenStream $self)Converts a TokenStreaminto aFlowofStreamingChatModelReplyinstances, where each emitted item represents a partial or complete response received during streaming.-
-
Method Detail
-
asFlow
@JvmOverloads() final static Flow<String> asFlow(TokenStream $self, Integer bufferCapacity, BufferOverflow onBufferOverflow, Boolean includeCompleteResponse)
Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error.
- Parameters:
bufferCapacity- The capacity of the buffer used in the flow to control backpressure.- Returns:
A Flow emitting strings, where each string represents a partial response from the associated language model.
-
asFlow
@JvmOverloads() final static Flow<String> asFlow(TokenStream $self, Integer bufferCapacity, BufferOverflow onBufferOverflow)
Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error.
- Parameters:
bufferCapacity- The capacity of the buffer used in the flow to control backpressure.- Returns:
A Flow emitting strings, where each string represents a partial response from the associated language model.
-
asFlow
@JvmOverloads() final static Flow<String> asFlow(TokenStream $self, Integer bufferCapacity)
Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error.
- Parameters:
bufferCapacity- The capacity of the buffer used in the flow to control backpressure.- Returns:
A Flow emitting strings, where each string represents a partial response from the associated language model.
-
asFlow
@JvmOverloads() final static Flow<String> asFlow(TokenStream $self)
Converts a TokenStream into a Flow of strings which emits partial responses as they are streamed, and closes when the stream is complete or encounters an error.
- Returns:
A Flow emitting strings, where each string represents a partial response from the associated language model.
-
asReplyFlow
@JvmOverloads() final static Flow<StreamingChatModelReply> asReplyFlow(TokenStream $self, Integer bufferCapacity, BufferOverflow onBufferOverflow)
Converts a
TokenStreaminto aFlowofStreamingChatModelReplyinstances, where each emitted item represents a partial or complete response received during streaming.This function utilizes a coroutine-based flow to provide real-time updates of the streaming response. The flow handles partial responses, the final complete response, and errors that may occur during the streaming process. Responses are buffered with the specified capacity.
- Parameters:
bufferCapacity- The capacity of the flow buffer, which determines how many items can be collected before backpressure occurs.- Returns:
A
Flowthat will emitStreamingChatModelReplyinstances including partial responses, complete responses, or errors in the order they are received.
-
asReplyFlow
@JvmOverloads() final static Flow<StreamingChatModelReply> asReplyFlow(TokenStream $self, Integer bufferCapacity)
Converts a
TokenStreaminto aFlowofStreamingChatModelReplyinstances, where each emitted item represents a partial or complete response received during streaming.This function utilizes a coroutine-based flow to provide real-time updates of the streaming response. The flow handles partial responses, the final complete response, and errors that may occur during the streaming process. Responses are buffered with the specified capacity.
- Parameters:
bufferCapacity- The capacity of the flow buffer, which determines how many items can be collected before backpressure occurs.- Returns:
A
Flowthat will emitStreamingChatModelReplyinstances including partial responses, complete responses, or errors in the order they are received.
-
asReplyFlow
@JvmOverloads() final static Flow<StreamingChatModelReply> asReplyFlow(TokenStream $self)
Converts a
TokenStreaminto aFlowofStreamingChatModelReplyinstances, where each emitted item represents a partial or complete response received during streaming.This function utilizes a coroutine-based flow to provide real-time updates of the streaming response. The flow handles partial responses, the final complete response, and errors that may occur during the streaming process. Responses are buffered with the specified capacity.
- Returns:
A
Flowthat will emitStreamingChatModelReplyinstances including partial responses, complete responses, or errors in the order they are received.
-
-
-
-