Knowledge
@Deprecated(forRemoval = true, since = "2.0.0") public interface Knowledge
源码Source
io/agentscope/core/rag/Knowledge.java:33–58定义知识库契约的接口。位于 io.agentscope.core.rag 包。核心成员包括 addDocuments、retrieve。
Interface for knowledge bases.
This interface provides a unified API for storing and retrieving documents in a knowledge base. Knowledge bases are used in RAG (Retrieval-Augmented Generation) systems to provide context to language models.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<Void> addDocuments(List<Document> documents) | 添加文档。 Adds documents to the knowledge base. |
public Mono<List<Document>> retrieve(String query, RetrieveConfig config) | 按查询检索相关文档。 Retrieves relevant documents based on a query. |
方法详情Method Detail
addDocuments
public Mono<Void> addDocuments(List<Document> documents)
添加文档。
Adds documents to the knowledge base.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
documents | List<Document> | 文档到添加的列出。the list of documents to add |
Mono<Void>返回Mono。a Mono that completes when all documents have been added
源码Source
io/agentscope/core/rag/Knowledge.java:44retrieve
public Mono<List<Document>> retrieve(String query, RetrieveConfig config)
按查询检索相关文档。
Retrieves relevant documents based on a query.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
query | String | 搜索查询文本。the search query text |
config | RetrieveConfig | 配置对象(类型 `RetrieveConfig`)。the retrieval configuration (limit, score threshold, etc.) |
Mono<List<Document>>返回Mono>。a Mono that emits a list of relevant Document objects, sorted by relevance
源码Source
io/agentscope/core/rag/Knowledge.java:57