AS AgentScopeAPI 手册 / API Reference

RAGFlowKnowledge

public class RAGFlowKnowledge implements Knowledge
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:79–214

RAG Flow 知识库,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.integration.ragflow 包,实现 Knowledge。核心成员包括 builder、retrieve、addDocuments。

RAGFlow Knowledge Base implementation.

This class provides integration with RAGFlow Knowledge Base service, implementing the Knowledge interface to enable seamless RAG (Retrieval-Augmented Generation) capabilities with RAGFlow-hosted knowledge bases.

Key features:

  • Local or remote RAGFlow deployment support

  • Advanced document understanding with OCR

  • Knowledge graph enhanced retrieval

  • Reranking support for better results

  • Conversation history support for context-aware retrieval

  • Compatible with Bailian and Dify RAG plugins (same Knowledge interface)

Functional Scope: This plugin focuses on retrieval capabilities only, similar to Bailian and Dify RAG plugins. Document management (upload/delete/update) should be performed via RAGFlow console.

Example usage:

`RAGFlowConfig config = RAGFlowConfig.builder()
.apiKey("ragflow-xxx")
.baseUrl("http://localhost:9380")
.knowledgeBaseId("kb-xxx")
.topK(10)
.similarityThreshold(0.5)
.enableRerank(true)
.build();

RAGFlowKnowledge knowledge = RAGFlowKnowledge.builder()
.config(config)
.build();

// Retrieve documents
List<Document> docs = knowledge.retrieve("What is AI?", retrieveConfig).block();

// Use with Agent
ReActAgent agent = ReActAgent.builder()
.knowledge(knowledge)
.ragMode(RAGMode.AGENTIC)
.build();
`

Note: Document management is not supported via this plugin. Please use RAGFlow console to upload, delete, and manage documents. This design ensures compatibility with Bailian and Dify RAG plugins and keeps the plugin focused.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
A class in io.agentscope.core.rag.integration.ragflow that turns private documents into retrievable knowledge.

方法摘要Method Summary

方法Method说明Description
public static Builder builder()
static
返回构建器实例。
Returns the builder.
public Mono<List<Document>> retrieve(String query, RetrieveConfig config)
按查询检索相关文档。
Retrieve documents from the RAGFlow knowledge base.
public Mono<Void> addDocuments(List<Document> documents)
添加文档。
Adds documents to the knowledge base.

方法详情Method Detail

builder

public static Builder builder()
static

返回构建器实例。

Returns the builder.

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:92–94

retrieve

public Mono<List<Document>> retrieve(String query, RetrieveConfig config)

按查询检索相关文档。

Retrieve documents from the RAGFlow knowledge base.

参数Parameters
名称Name类型Type说明Description
queryString查询文本(必填)。the query text (required)
configRetrieveConfig检索配置(限制,分数阈值)。the retrieval configuration (limit, score threshold)
返回Returns Mono<List<Document>>
返回Mono>。a Mono emitting the list of retrieved documents, sorted by relevance
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:124–163

addDocuments

public Mono<Void> addDocuments(List<Document> documents)

添加文档。

Adds documents to the knowledge base.

参数Parameters
名称Name类型Type说明Description
documentsList<Document>文档到添加的列出。the list of documents to add
返回Returns Mono<Void>
返回Mono。a Mono that completes with an error indicating the operation is not supported
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:181–189

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.rag.integration.ragflow 包。核心成员包括 config、client、build。

A class in io.agentscope.core.rag.integration.ragflow that turns private documents into retrievable knowledge. Declared in io.agentscope.core.rag.integration.ragflow.

基于官方固定版本源码静态生成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.