Interface StreamingPromptRunner.Streaming
-
- All Implemented Interfaces:
-
com.embabel.agent.api.common.PromptRunner.StreamingCapability
public interface StreamingPromptRunner.Streaming implements PromptRunner.StreamingCapability
Fluent interface for reactive streaming operations from LLM responses. Provides configuration options for:
Streaming object creation
Streaming with thinking content
Instances are obtained via StreamingPromptRunner.streaming.
-
-
Method Summary
Modifier and Type Method Description abstract StreamingPromptRunner.StreamingwithPrompt(String prompt)Configure the streaming operation with a single prompt message. abstract StreamingPromptRunner.StreamingwithMessages(List<Message> messages)Configure the streaming operation with a list of messages. abstract <T extends Any> Flux<T>createObjectStream(Class<T> itemClass)Create a reactive stream of objects of the specified type. abstract <T extends Any> Flux<StreamingEvent<T>>createObjectStreamWithThinking(Class<T> itemClass)Create a reactive stream with both objects and thinking content. abstract Flux<String>generateStream()Generate a reactive stream of text chunks as they arrive from the LLM. -
-
Method Detail
-
withPrompt
abstract StreamingPromptRunner.Streaming withPrompt(String prompt)
Configure the streaming operation with a single prompt message.
- Parameters:
prompt- The prompt text to send to the LLM- Returns:
StreamingPromptRunner.Streaming for method chaining
-
withMessages
abstract StreamingPromptRunner.Streaming withMessages(List<Message> messages)
Configure the streaming operation with a list of messages.
- Parameters:
messages- The conversation messages to send to the LLM- Returns:
StreamingPromptRunner.Streaming for method chaining
-
createObjectStream
abstract <T extends Any> Flux<T> createObjectStream(Class<T> itemClass)
Create a reactive stream of objects of the specified type. Objects are emitted as they become available during LLM processing.
- Parameters:
itemClass- The class of objects to create- Returns:
Flux emitting objects as they are parsed from the LLM response
-
createObjectStreamWithThinking
abstract <T extends Any> Flux<StreamingEvent<T>> createObjectStreamWithThinking(Class<T> itemClass)
Create a reactive stream with both objects and thinking content. Provides access to the LLM's reasoning process alongside the results.
- Parameters:
itemClass- The class of objects to create- Returns:
Flux emitting StreamingEvent instances for objects and thinking
-
generateStream
abstract Flux<String> generateStream()
Generate a reactive stream of text chunks as they arrive from the LLM.
- Returns:
Flux emitting text chunks as they arrive from the LLM
-
-
-
-