RetrievalMode
public enum RetrievalMode
io/agentscope/core/rag/integration/dify/RetrievalMode.java:36–118定义检索模式相关取值的枚举。位于 io.agentscope.core.rag.integration.dify 包。核心成员包括 getValue、fromValue、toString、KEYWORD_SEARCH、SEMANTIC_SEARCH、HYBRID_SEARCH。
Dify retrieval modes for knowledge base search.
Different retrieval modes use different strategies to find relevant documents:
-
KEYWORD_SEARCH: Traditional keyword-based search (BM25, TF-IDF)
-
SEMANTIC_SEARCH: Vector-based semantic similarity search
-
HYBRID_SEARCH: Combines keyword and semantic search (recommended)
-
FULL_TEXT_SEARCH: Full-text search across all document content
Example usage:
`DifyRAGConfig config = DifyRAGConfig.builder()
.retrievalMode(RetrievalMode.HYBRID_SEARCH) // Use hybrid search
.build();
`
枚举常量摘要Enum Constant Summary
| 常量Constant | 说明Description |
|---|---|
KEYWORD_SEARCH | 执行KEYWORD 搜索相关操作。 Keyword-based retrieval using BM25 or similar algorithms. |
SEMANTIC_SEARCH | 执行SEMANTIC 搜索相关操作。 Semantic retrieval using vector embeddings and similarity search. |
HYBRID_SEARCH | 执行HYBRID 搜索相关操作。 Hybrid retrieval combining keyword and semantic approaches. |
FULL_TEXT_SEARCH | 执行FULL 文本搜索相关操作。 Full-text search across all document content. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getValue() | 获取值。 Gets the string value for use in Dify API requests. |
public static RetrievalMode fromValue(String value)static | 设置来自值。 Converts a string value to the corresponding RetrievalMode enum. |
public String toString() | 返回 `toString` 结果。 Returns the to string. |
枚举常量详情Enum Constant Detail
KEYWORD_SEARCH
KEYWORD_SEARCH("keyword_search")
执行KEYWORD 搜索相关操作。
Keyword-based retrieval using BM25 or similar algorithms.
io/agentscope/core/rag/integration/dify/RetrievalMode.java:43SEMANTIC_SEARCH
SEMANTIC_SEARCH("semantic_search")
执行SEMANTIC 搜索相关操作。
Semantic retrieval using vector embeddings and similarity search.
io/agentscope/core/rag/integration/dify/RetrievalMode.java:50HYBRID_SEARCH
HYBRID_SEARCH("hybrid_search")
执行HYBRID 搜索相关操作。
Hybrid retrieval combining keyword and semantic approaches.
io/agentscope/core/rag/integration/dify/RetrievalMode.java:60FULL_TEXT_SEARCH
FULL_TEXT_SEARCH("full_text_search")
执行FULL 文本搜索相关操作。
Full-text search across all document content.
io/agentscope/core/rag/integration/dify/RetrievalMode.java:67方法详情Method Detail
getValue
public String getValue()
获取值。
Gets the string value for use in Dify API requests.
Stringio/agentscope/core/rag/integration/dify/RetrievalMode.java:85–87fromValue
public static RetrievalMode fromValue(String value)
设置来自值。
Converts a string value to the corresponding RetrievalMode enum.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | String | 值(类型 `String`)。the string value |
RetrievalModeIllegalArgumentException可能抛出 `IllegalArgumentException`。if the value doesn't match any mode
io/agentscope/core/rag/integration/dify/RetrievalMode.java:96–112toString
public String toString()
返回 toString 结果。
Returns the to string.
Stringio/agentscope/core/rag/integration/dify/RetrievalMode.java:114–117