类 StreamUserInput
java.lang.Object
io.agentscope.core.agent.user.StreamUserInput
- 所有已实现的接口:
UserInputBase
Stream-based user input implementation that reads from any InputStream and writes to any
OutputStream. By default, uses System.in and System.out for console interaction.
Supports both simple text input and structured data input via key=value pairs. Blocking I/O operations are executed on the bounded elastic scheduler to maintain reactive compatibility.
Usage examples:
// Default console input/output
StreamUserInput consoleInput = StreamUserInput.builder().build();
// Custom streams (e.g., for testing)
StreamUserInput customInput = StreamUserInput.builder()
.inputStream(myInputStream)
.outputStream(myOutputStream)
.inputHint("Enter: ")
.build();
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明static StreamUserInput.Builderbuilder()Create a new builder for StreamUserInput.reactor.core.publisher.Mono<UserInputData> Handle user input from the configured input stream.
-
方法详细资料
-
builder
Create a new builder for StreamUserInput.- 返回:
- A new builder instance
-
handleInput
public reactor.core.publisher.Mono<UserInputData> handleInput(String agentId, String agentName, List<Msg> contextMessages, Class<?> structuredModel) Handle user input from the configured input stream. Prints any context messages before prompting the user with the configured input hint, reads a line of text, and optionally collects structured data if a model class is provided. Returns a UserInputData containing both the text content blocks and any structured input.- 指定者:
handleInput在接口中UserInputBase- 参数:
agentId- The agent identifier (unused in this implementation)agentName- The agent name (unused in this implementation)contextMessages- Optional messages to display before prompting (e.g., assistant response)structuredModel- Optional class for structured input format- 返回:
- Mono containing the user input data
-