ReaderInput
public class ReaderInput
io/agentscope/core/rag/reader/ReaderInput.java:29–157读取器输入,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.reader 包。核心成员包括 fromString、fromFile、fromPath、asString、getType。
Input wrapper for document readers.
This class provides a unified interface for different types of input sources (text strings, file paths, URLs, etc.) that can be read by document readers.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
InputType | 枚举enum | 定义输入类型的枚举。 Input type enumeration. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static ReaderInput fromString(String text)static | 设置该参数。 Creates a ReaderInput from a text string. |
public static ReaderInput fromFile(String filePath) throws IOExceptionstatic | 创建ReaderInput 来自文件路径。 Creates a ReaderInput from a file path. |
public static ReaderInput fromFile(Path filePath) throws IOExceptionstatic | 创建ReaderInput 来自文件路径。 Creates a ReaderInput from a file path. |
public static ReaderInput fromFile(File file) throws IOExceptionstatic | 创建ReaderInput 来自文件对象。 Creates a ReaderInput from a File object. |
public static ReaderInput fromPath(String path)static | 设置来自路径。 Creates a ReaderInput from a File path string. |
public static ReaderInput fromPath(Path path)static | 创建ReaderInput 来自文件路径。 Creates a ReaderInput from a File path. |
public String asString() | 返回 `asString` 结果。 Gets the input content as a string. |
public InputType getType() | 获取输入类型。 Gets the input type. |
方法详情Method Detail
fromString
public static ReaderInput fromString(String text)
设置该参数。
Creates a ReaderInput from a text string.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本内容。the text content |
ReaderInputio/agentscope/core/rag/reader/ReaderInput.java:45–50fromFile
public static ReaderInput fromFile(String filePath) throws IOException
创建ReaderInput 来自文件路径。
Creates a ReaderInput from a file path.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filePath | String | 路径到文件。the path to the file |
ReaderInputIOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
io/agentscope/core/rag/reader/ReaderInput.java:59–64fromFile
public static ReaderInput fromFile(Path filePath) throws IOException
创建ReaderInput 来自文件路径。
Creates a ReaderInput from a file path.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filePath | Path | 路径到文件。the path to the file |
ReaderInputIOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
io/agentscope/core/rag/reader/ReaderInput.java:73–82fromFile
public static ReaderInput fromFile(File file) throws IOException
创建ReaderInput 来自文件对象。
Creates a ReaderInput from a File object.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
file | File | 文件对象。the file object |
ReaderInputIOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
io/agentscope/core/rag/reader/ReaderInput.java:91–96fromPath
public static ReaderInput fromPath(String path)
设置来自路径。
Creates a ReaderInput from a File path string.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。the file path string |
ReaderInputIllegalArgumentException当if 路径是无效时抛出 `IllegalArgumentException`。if the path is invalid
io/agentscope/core/rag/reader/ReaderInput.java:105–110fromPath
public static ReaderInput fromPath(Path path)
创建ReaderInput 来自文件路径。
Creates a ReaderInput from a File path.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | Path | 文件路径。the file path |
ReaderInputIllegalArgumentException当if 路径是无效时抛出 `IllegalArgumentException`。if the path is invalid
io/agentscope/core/rag/reader/ReaderInput.java:119–129asString
public String asString()
返回 asString 结果。
Gets the input content as a string.
Stringio/agentscope/core/rag/reader/ReaderInput.java:136–138getType
public InputType getType()
获取输入类型。
Gets the input type.
InputTypeio/agentscope/core/rag/reader/ReaderInput.java:145–147嵌套类详情Nested Class Detail
InputType
public enum InputType定义输入类型的枚举。位于 io.agentscope.core.rag.reader 包。核心成员包括 STRING、FILE、URL。
Input type enumeration.