StreamUserInput
@Deprecated(forRemoval = true, since = "2.0.0") public class StreamUserInput implements UserInputBase
io/agentscope/core/agent/user/StreamUserInput.java:55–256流用户输入,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.agent.user 包,实现 UserInputBase。核心成员包括 builder、handleInput。
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();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | StreamUserInput的构建器。 Builder for StreamUserInput. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static Builder builder()static | 创建用于StreamUserInput的构建器。 Create a new builder for StreamUserInput. |
public Mono<UserInputData> handleInput(String agentId, String agentName, List<Msg> contextMessages, Class<?> structuredModel) | 处理输入。 Handle user input from the configured input stream. |
方法详情Method Detail
builder
public static Builder builder()
创建用于StreamUserInput的构建器。
Create a new builder for StreamUserInput.
Builderio/agentscope/core/agent/user/StreamUserInput.java:78–80handleInput
public Mono<UserInputData> handleInput(String agentId, String agentName, List<Msg> contextMessages, Class<?> structuredModel)
处理输入。
Handle user input from the configured input stream.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent identifier (unused in this implementation) |
agentName | String | 智能体名称(类型 `String`)。The agent name (unused in this implementation) |
contextMessages | List<Msg> | 上下文消息(类型 `List`)。Optional messages to display before prompting (e.g., assistant response) |
structuredModel | Class<?> | 用于结构化输入格式的可选类。Optional class for structured input format |
Mono<UserInputData>io/agentscope/core/agent/user/StreamUserInput.java:95–132嵌套类详情Nested Class Detail
Builder
public static class BuilderStreamUserInput的构建器。位于 io.agentscope.core.agent.user 包。核心成员包括 inputHint、inputStream、outputStream、build。
Builder for StreamUserInput.
Provides fluent API for configuring input/output streams and prompt hint. Defaults to System.in/System.out if not specified.