Class RAGFlowConfig

java.lang.Object
io.agentscope.core.rag.integration.ragflow.RAGFlowConfig

public class RAGFlowConfig extends Object
Configuration for RAGFlow integration.

This class holds the configuration for connecting to RAGFlow service, including authentication, endpoint, and retrieval parameters.

API Reference: This configuration is designed to work with RAGFlow's retrieval API: POST /api/v1/retrieval

  • Method Details

    • builder

      public static RAGFlowConfig.Builder builder()
    • getApiKey

      public String getApiKey()
    • getBaseUrl

      public String getBaseUrl()
    • getDatasetIds

      public List<String> getDatasetIds()
      Gets the dataset IDs.

      These IDs are used in the API request body: "dataset_ids": ["id1", "id2"]

      Returns:
      the list of dataset IDs
    • getDocumentIds

      public List<String> getDocumentIds()
      Gets the document IDs to filter retrieval.

      Optional: If specified, only search within these documents.

      Returns:
      the list of document IDs, or null if not set
    • getTopK

      public Integer getTopK()
      Gets the top K value for retrieval.

      Default value: 5 (as per RAGFlow API documentation)

      Returns:
      the top K value
    • getSimilarityThreshold

      public Double getSimilarityThreshold()
      Gets the similarity threshold for filtering results.

      Default value: 0.2 (as per RAGFlow API documentation)

      Returns:
      the similarity threshold (0.0-1.0)
    • getVectorSimilarityWeight

      public Double getVectorSimilarityWeight()
      Gets the vector similarity weight.

      The weight of vector cosine similarity. If x represents the weight, then (1 - x) is the term similarity weight.

      Default value: 0.3

      Returns:
      the vector similarity weight (0.0-1.0)
    • getPage

      public Integer getPage()
      Gets the page number for pagination.

      Default value: 1

      Returns:
      the page number
    • getPageSize

      public Integer getPageSize()
      Gets the page size for pagination.

      Default value: 30

      Returns:
      the page size
    • getUseKg

      public Boolean getUseKg()
      Gets whether to use knowledge graph for multi-hop queries.

      Default value: false

      Returns:
      true if knowledge graph is enabled
    • getTocEnhance

      public Boolean getTocEnhance()
      Gets whether to use TOC (Table of Contents) enhancement.

      Default value: false

      Returns:
      true if TOC enhancement is enabled
    • getRerankId

      public String getRerankId()
      Gets the rerank model ID.

      RAGFlow identifies rerank models by name, e.g. "BAAI/bge-reranker-v2-m3@BAAI" or a hex UUID, so this is a String rather than a numeric id.

      Returns:
      the rerank model ID, or null if not set
    • getKeyword

      public Boolean getKeyword()
      Gets whether keyword-based matching is enabled.

      Default value: false

      Returns:
      true if keyword matching is enabled
    • getHighlight

      public Boolean getHighlight()
      Gets whether highlighting of matched terms is enabled.

      Default value: false

      Returns:
      true if highlighting is enabled
    • getCrossLanguages

      public List<String> getCrossLanguages()
      Gets the list of languages for cross-language retrieval.
      Returns:
      the list of target languages, or null if not set
    • getMetadataCondition

      public Map<String,Object> getMetadataCondition()
      Gets the metadata filtering conditions.

      This is used to filter chunks based on their metadata fields. For example:

      
       Map<String, Object> condition = Map.of(
           "author", "John",
           "category", "tech"
       );
       
      Returns:
      the metadata condition map, or null if not set
    • getTimeout

      public Duration getTimeout()
    • getMaxRetries

      public Integer getMaxRetries()
    • getCustomHeaders

      public Map<String,String> getCustomHeaders()