Enum Class RetrievalMode

java.lang.Object
java.lang.Enum<RetrievalMode>
io.agentscope.core.rag.integration.dify.RetrievalMode
All Implemented Interfaces:
Serializable, Comparable<RetrievalMode>, Constable

public enum RetrievalMode extends Enum<RetrievalMode>
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 Details

  • Method Details

    • values

      public static RetrievalMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RetrievalMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Gets the string value for use in Dify API requests.
      Returns:
      the API value
    • fromValue

      public static RetrievalMode fromValue(String value)
      Converts a string value to the corresponding RetrievalMode enum.
      Parameters:
      value - the string value
      Returns:
      the matching RetrievalMode
      Throws:
      IllegalArgumentException - if the value doesn't match any mode
    • toString

      public String toString()
      Overrides:
      toString in class Enum<RetrievalMode>