RAGFlowKnowledge
public class RAGFlowKnowledge implements Knowledge
io/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:79–214RAG 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()
返回构建器实例。
Returns the builder.
Builderio/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:92–94retrieve
public Mono<List<Document>> retrieve(String query, RetrieveConfig config)
按查询检索相关文档。
Retrieve documents from the RAGFlow knowledge base.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
query | String | 查询文本(必填)。the query text (required) |
config | RetrieveConfig | 检索配置(限制,分数阈值)。the retrieval configuration (limit, score threshold) |
Mono<List<Document>>io/agentscope/core/rag/integration/ragflow/RAGFlowKnowledge.java:124–163addDocuments
public Mono<Void> addDocuments(List<Document> documents)
添加文档。
Adds documents to the knowledge base.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
documents | List<Document> | 文档到添加的列出。the list of documents to add |
Mono<Void>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.