HayStackKnowledge
public class HayStackKnowledge implements Knowledge
io/agentscope/core/rag/integration/haystack/HayStackKnowledge.java:71–238Hay Stack 知识库,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.integration.haystack 包,实现 Knowledge。核心成员包括 builder、addDocuments、retrieve。
HayStack RAG Knowledge Base implementation.
This class provides integration with HayStack Knowledge Base service, implementing the Knowledge interface to enable seamless RAG (Retrieval-Augmented Generation) capabilities with HayStack-hosted knowledge bases.
Key features:
-
Built on HayStack RAG with end-to-end retrieval, ranking, and generation pipelines
-
Local or remote HayStack deployment support
-
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 HayStack RAG server.
Example usage:
`HayStackConfig config = HayStackConfig.builder()
.baseUrl("http://localhost:8080")
.topK(10)
.build();
HayStackKnowledge knowledge = HayStackKnowledge.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 HayStack server 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.haystack that turns private documents into retrievable knowledge. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static Builder builder()static | 返回构建器实例。 Returns the builder. |
public Mono<Void> addDocuments(List<Document> documents) | 添加文档。 Adds documents to the Haystack knowledge base. |
public Mono<List<Document>> retrieve(String query, RetrieveConfig config) | 按查询检索相关文档。 Retrieve documents from the HayStack knowledge base. |
方法详情Method Detail
builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/core/rag/integration/haystack/HayStackKnowledge.java:84–86addDocuments
public Mono<Void> addDocuments(List<Document> documents)
添加文档。
Adds documents to the Haystack knowledge base.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
documents | List<Document> | 文档到添加的列出。the list of documents to add |
Mono<Void>io/agentscope/core/rag/integration/haystack/HayStackKnowledge.java:108–116retrieve
public Mono<List<Document>> retrieve(String query, RetrieveConfig config)
按查询检索相关文档。
Retrieve documents from the HayStack knowledge base.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
query | String | 查询文本(必填)。the query text (required) |
config | RetrieveConfig | 检索配置(限制,分数)。the retrieval configuration (limit, score) |
Mono<List<Document>>io/agentscope/core/rag/integration/haystack/HayStackKnowledge.java:144–214嵌套类详情Nested Class Detail
Builder
public static class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.core.rag.integration.haystack 包。核心成员包括 config、client、build。
A class in io.agentscope.core.rag.integration.haystack that turns private documents into retrievable knowledge. Declared in io.agentscope.core.rag.integration.haystack.