AS AgentScopeAPI 手册 / API Reference

ReaderInput

public class ReaderInput
源码Source 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 IOException
static
创建ReaderInput 来自文件路径。
Creates a ReaderInput from a file path.
public static ReaderInput fromFile(Path filePath) throws IOException
static
创建ReaderInput 来自文件路径。
Creates a ReaderInput from a file path.
public static ReaderInput fromFile(File file) throws IOException
static
创建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)
static

设置该参数。

Creates a ReaderInput from a text string.

参数Parameters
名称Name类型Type说明Description
textString文本内容。the text content
返回Returns ReaderInput
一种ReaderInput 实例。a ReaderInput instance
源码Source io/agentscope/core/rag/reader/ReaderInput.java:45–50

fromFile

public static ReaderInput fromFile(String filePath) throws IOException
static

创建ReaderInput 来自文件路径。

Creates a ReaderInput from a file path.

参数Parameters
名称Name类型Type说明Description
filePathString路径到文件。the path to the file
返回Returns ReaderInput
一种ReaderInput 实例。a ReaderInput instance
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/core/rag/reader/ReaderInput.java:59–64

fromFile

public static ReaderInput fromFile(Path filePath) throws IOException
static

创建ReaderInput 来自文件路径。

Creates a ReaderInput from a file path.

参数Parameters
名称Name类型Type说明Description
filePathPath路径到文件。the path to the file
返回Returns ReaderInput
一种ReaderInput 实例。a ReaderInput instance
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/core/rag/reader/ReaderInput.java:73–82

fromFile

public static ReaderInput fromFile(File file) throws IOException
static

创建ReaderInput 来自文件对象。

Creates a ReaderInput from a File object.

参数Parameters
名称Name类型Type说明Description
fileFile文件对象。the file object
返回Returns ReaderInput
一种ReaderInput 实例。a ReaderInput instance
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/core/rag/reader/ReaderInput.java:91–96

fromPath

public static ReaderInput fromPath(String path)
static

设置来自路径。

Creates a ReaderInput from a File path string.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。the file path string
返回Returns ReaderInput
一种ReaderInput 实例。a ReaderInput instance
抛出Throws
  • IllegalArgumentException 当if 路径是无效时抛出 `IllegalArgumentException`。if the path is invalid
源码Source io/agentscope/core/rag/reader/ReaderInput.java:105–110

fromPath

public static ReaderInput fromPath(Path path)
static

创建ReaderInput 来自文件路径。

Creates a ReaderInput from a File path.

参数Parameters
名称Name类型Type说明Description
pathPath文件路径。the file path
返回Returns ReaderInput
一种ReaderInput 实例。a ReaderInput instance
抛出Throws
  • IllegalArgumentException 当if 路径是无效时抛出 `IllegalArgumentException`。if the path is invalid
源码Source io/agentscope/core/rag/reader/ReaderInput.java:119–129

asString

public String asString()

返回 asString 结果。

Gets the input content as a string.

返回Returns String
返回字符串结果。the content string
源码Source io/agentscope/core/rag/reader/ReaderInput.java:136–138

getType

public InputType getType()

获取输入类型。

Gets the input type.

返回Returns InputType
输入类型。the input type
源码Source io/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.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.