Skip to content

Builder ergonomics: configure LightRAG / Leiden via GraphRAGBuilder #8

Description

@ronaldmannak

Motivation

LightRAG and Leiden are configured by constructing DualRetrievalConfig, KeywordExtractorConfig, and LeidenConfig and passing them to rag.lightRAG(...). A fluent builder surface (matching the existing withChunkSize/withTopK/withApproach style) makes them discoverable and consistent.

Scope

  • Add builder methods (e.g. withMergeStrategy, withKeywordLimit, withLeidenResolution, or a single withLightRAG(config:keywordConfig:) / withLeiden(config:)) that store defaults on Config.
  • Have GraphRAG.lightRAG() / detectCommunities() use those stored defaults when the caller doesn't override them (while keeping the explicit per-call parameters working).
  • Keep it purely additive — no behavior change when the new methods aren't used.

Files (small, low-overlap)

Sources/GraphRAG/GraphRAG/Builder.swift, Sources/GraphRAG/GraphRAG/Config.swift. Small; only coordinate with the "LLM community summaries" issue if that one also adds a Config flag.

Acceptance criteria

  • New builder methods set the defaults; lightRAG()/detectCommunities() honor them; existing call sites unchanged.
  • Unit tests for the new builder methods.
  • CI green.

Context: follow-up to PRs #2 / #3. Good "starter" / parallelizable task.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions