ImageReader
public class ImageReader implements Reader
源码Source
io/agentscope/core/rag/reader/ImageReader.java:40–156图像读取器,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.reader 包,实现 Reader。核心成员包括 read、getSupportedFormats、isOcrEnabled、ImageReader。
Image reader implementation that reads image files.
This reader supports various image formats and can optionally extract text from images using OCR (if enabled). The reader creates Document objects with image content that can be used in multimodal RAG systems.
Example usage:
`ImageReader reader = new ImageReader(false);
ReaderInput input = ReaderInput.fromString("path/to/image.jpg");
List<Document> documents = reader.read(input).block();
`
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ImageReader() | 创建新的ImageReader 使用 OCR 已禁用。 Creates a new ImageReader with OCR disabled. |
public ImageReader(boolean enableOCR) | 初始化 `ImageReader` 实例。 Creates a new ImageReader with the specified OCR setting. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<List<Document>> read(ReaderInput input) | 设置读取。 Performs the read operation. |
public List<String> getSupportedFormats() | 获取 `getSupportedFormats`。 Returns the supported formats. |
public boolean isOcrEnabled() | 检查if OCR 是已启用。 Checks if OCR is enabled. |
构造器详情Constructor Detail
ImageReader
public ImageReader()
创建新的ImageReader 使用 OCR 已禁用。
Creates a new ImageReader with OCR disabled.
源码Source
io/agentscope/core/rag/reader/ImageReader.java:47–49ImageReader
public ImageReader(boolean enableOCR)
初始化 ImageReader 实例。
Creates a new ImageReader with the specified OCR setting.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableOCR | boolean | 启用 OCR(类型 `boolean`)。true to enable OCR text extraction from images |
源码Source
io/agentscope/core/rag/reader/ImageReader.java:56–58方法详情Method Detail
read
public Mono<List<Document>> read(ReaderInput input)
设置读取。
Performs the read operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
input | ReaderInput | 输入消息(类型 `ReaderInput`)。The input. |
Mono<List<Document>>返回Mono>。Returns mono.
源码Source
io/agentscope/core/rag/reader/ImageReader.java:60–76getSupportedFormats
public List<String> getSupportedFormats()
获取 getSupportedFormats。
Returns the supported formats.
List<String>返回列出。Returns list.
源码Source
io/agentscope/core/rag/reader/ImageReader.java:78–81isOcrEnabled
public boolean isOcrEnabled()
检查if OCR 是已启用。
Checks if OCR is enabled.
boolean返回布尔值,表示判断结果。true if OCR is enabled
源码Source
io/agentscope/core/rag/reader/ImageReader.java:153–155