接口 Knowledge
public interface Knowledge
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.
-
方法概要
修饰符和类型方法说明reactor.core.publisher.Mono<Void> addDocuments(List<Document> documents) Adds documents to the knowledge base.retrieve(String query, RetrieveConfig config) Retrieves relevant documents based on a query.
-
方法详细资料
-
addDocuments
Adds documents to the knowledge base.Documents are embedded and stored in the vector database for later retrieval.
- 参数:
documents- the list of documents to add- 返回:
- a Mono that completes when all documents have been added
-
retrieve
Retrieves relevant documents based on a query.The query is embedded and used to search for similar documents in the knowledge base. Results are filtered by the score threshold and limited by the configured limit.
- 参数:
query- the search query textconfig- the retrieval configuration (limit, score threshold, etc.)- 返回:
- a Mono that emits a list of relevant Document objects, sorted by relevance
-