Skip to main content
Glama

chunktuner

PyPI version Python versions License: MIT CI Docs

RAG 파이프라인을 위한 자동 청킹 튜너 및 MCP 서버입니다.

문서를 제공하면 여러 청킹 전략을 시도하고, 어떤 전략이 AI가 질문에 가장 정확하게 답변할 수 있는지 측정하여 최적의 전략을 알려줍니다.

chunktuner 프로젝트 흐름: 문서가 전략, 평가를 거쳐 권장 구성으로 이어짐


기능

RAG 파이프라인을 구축할 때 문서를 청크로 나누는 방식은 검색 품질에 직접적인 영향을 미칩니다. chunktuner는 특정 말뭉치, 임베딩 모델 및 사용 사례에 최적화된 청킹 전략을 찾는 과정을 자동화합니다.

고정 토큰 윈도우, 재귀적 문자 분할, 의미론적 분할, PDF 구조적 청킹, AST 기반 코드 청킹과 같은 전략을 벤치마킹한 다음, 실제 검색 지표(토큰 재현율, MRR, NDCG) 및 선택적 생성 지표(RAGAS 충실도, 답변 관련성)를 기준으로 각 전략의 점수를 매깁니다.


Related MCP server: golden-dataset-mcp

인터페이스

  • Python 라이브러리 — 파이프라인에 프로그래밍 방식으로 통합

  • CLI (chunk-tune) — 터미널에서 사람이 직접 튜닝

  • MCP 서버 — Claude Desktop 또는 모든 MCP 호스트에서 직접 사용


퀵스타트

# Install
uv tool install chunktuner

# Initialize workspace
chunk-tune init --provider openai

# See cost estimate before running anything
chunk-tune estimate ./my_docs --use-case rag_qa

# Get a recommendation
chunk-tune recommend ./my_docs --use-case rag_qa

Python API:

from pathlib import Path
from chunktuner import FileIngestor, LiteLLMEmbeddingFunction, AutoTuner
from chunktuner import default_registry, Evaluator, ScoreCalculator

docs = FileIngestor().ingest_dir(Path("./my_docs"))
embedding_fn = LiteLLMEmbeddingFunction("text-embedding-3-small")
tuner = AutoTuner(
    strategies=default_registry,
    evaluator=Evaluator(embedding_fn),
    scorer=ScoreCalculator(use_case="rag_qa"),
)
result = tuner.recommend(docs, use_case="rag_qa")
print(result.best.config)

지원되는 전략

전략

용도

fixed_tokens

기준점; 균일한 토큰 윈도우

recursive_character

일반 산문 및 문서

semantic

주제 중심의 기사

markdown_semantic

구조화된 마크다운 문서

pdf_structural

레이아웃 영역 및 표가 포함된 PDF

structural_semantic

레이아웃과 텍스트가 혼합된 PDF/DOCX

late_chunking

밀도 높은 상호 참조가 포함된 긴 문서

agentic

가치가 높은 서사 문서

code_ast

코드 저장소 (Python, JavaScript)

code_window

코드 기준점 (슬라이딩 윈도우)


MCP 서버 (Claude Desktop)

Python FastMCP (chunk-tune-mcp, stdio). Node.js 빌드가 필요 없습니다. docs/mcp_setup.md를 참조하세요.

.mcp.json에 추가하세요:

{
  "mcpServers": {
    "chunktuner": {
      "command": "uvx",
      "args": ["--from", "chunktuner[mcp]", "chunk-tune-mcp"],
      "env": {
        "CHUNK_TUNER_BASE_DIR": "/path/to/your/corpus"
      }
    }
  }
}

사용 가능한 도구: list_strategies, preview_chunks, evaluate_chunking, recommend_config.


CLI 참조

chunk-tune init       Bootstrap workspace config
chunk-tune analyze    Quick structural scan (no API cost)
chunk-tune estimate   Dry-run cost/token estimate
chunk-tune evaluate   Full evaluation across strategies
chunk-tune recommend  Evaluation + best config recommendation
chunk-tune compare    Side-by-side comparison of specific strategies
chunk-tune preview    Inspect how a strategy splits a document
chunk-tune cache      Manage embedding and chunk cache

설치 옵션

uv add chunktuner                    # library
uv tool install chunktuner           # global CLI
uvx chunktuner                       # ephemeral, no install

# With optional extras
uv add "chunktuner[docling]"         # PDF/DOCX support
uv add "chunktuner[ragas]"           # generation metrics
uv add "chunktuner[semantic]"        # semantic chunking
uv add "chunktuner[code]"            # AST code chunking
uv add "chunktuner[all]"             # everything

기여하기

CONTRIBUTING.md를 참조하세요.


👨🏻💻 작성자

Shantanu Deshmukh

E2E AI 애플리케이션 구축 경험이 있는 풀스택 개발자.

Linkedin / Twitter / AngelList

Install Server
A
license - permissive license
B
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Exposes queryable GPU inference benchmark data (quantization, throughput, VRAM, concurrent users) as tools for LLM clients.
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Enables version-controlled golden dataset management and semantic evaluation for RAG/LLM pipelines using TF-IDF cosine similarity, without requiring an LLM API key.
    9
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Evaluates RAG outputs on faithfulness, answer relevancy, and context precision using an LLM-as-a-Judge backend. Exposes tools for running evaluations, scoring individual samples, and checking thresholds, enabling CI gating and on-demand assessment via MCP.
    MIT

View all related MCP servers

Related MCP Connectors

  • Multi-LLM entity enrichment: schemas, single/batch enrichment, fusion, model benchmarks.

  • Bounded tools for rendering, extraction, RAG, enrichment, local discovery and review analysis.

  • Machine-readable utilities and datasets for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shantanu-deshmukh/chunktuner'

If you have feedback or need assistance with the MCP directory API, please join our Discord server