AS AgentScopeAPI 手册 / API Reference

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–49

ImageReader

public ImageReader(boolean enableOCR)

初始化 ImageReader 实例。

Creates a new ImageReader with the specified OCR setting.

参数Parameters
名称Name类型Type说明Description
enableOCRboolean启用 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
inputReaderInput输入消息(类型 `ReaderInput`)。The input.
返回Returns Mono<List<Document>>
返回Mono>。Returns mono.
源码Source io/agentscope/core/rag/reader/ImageReader.java:60–76

getSupportedFormats

public List<String> getSupportedFormats()

获取 getSupportedFormats。

Returns the supported formats.

返回Returns List<String>
返回列出。Returns list.
源码Source io/agentscope/core/rag/reader/ImageReader.java:78–81

isOcrEnabled

public boolean isOcrEnabled()

检查if OCR 是已启用。

Checks if OCR is enabled.

返回Returns boolean
返回布尔值,表示判断结果。true if OCR is enabled
源码Source io/agentscope/core/rag/reader/ImageReader.java:153–155
基于官方固定版本源码静态生成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.