-
-
Notifications
You must be signed in to change notification settings - Fork 0
LLM Planning
Praveen Kumar edited this page Jul 11, 2026
·
2 revisions
LLM planning is optional. Default cf.clean(df) uses the rules planner only.
- The model receives metadata (column names, dtypes, semantic types, null
rates, pattern sketches) — not raw cells — unless you opt into
sample. - The model returns JSON that is parsed through the same
Recipemodel as rules. - On failure / budget exceed, CleanFrame falls back to rules and emits a
UserWarning(also recorded inrecipe.meta["llm_fallback"]). - HTTP calls use a 60 second timeout.
provider/model
Examples:
anthropic/claude-sonnet-4-6
openai/gpt-4o
openrouter/anthropic/claude-sonnet-4
groq/llama-3.3-70b-versatile
ollama/llama3.2
openai-compatible/my-model # set OPENAI_BASE_URL
result = cf.clean(
df,
llm="anthropic/claude-sonnet-4-6",
llm_exposure="metadata",
max_tokens_budget=50_000,
)Install SDKs: pip install "cleanframe[llm]".
| Mode | What leaves the machine |
|---|---|
metadata (default) |
Names, dtypes, stats, pattern sketches (₹99,99,999-style) |
sample |
Small anonymized, deterministically shuffled sample (emails/phones redacted) |
none |
Structural metadata only |
Short categorical tokens (≤ 24 chars) may be sent verbatim in sample mode to
help planning (e.g. city names). Do not use sample on highly sensitive columns
without review.
Built-in: Anthropic (native), OpenAI, OpenRouter, Groq, Together, Fireworks,
DeepSeek, Mistral, Google Gemini (OpenAI-compatible), xAI, Perplexity, Cohere,
Ollama, LM Studio, Azure / generic openai-compatible.
cf.list_providers()Any object with .complete(system, user, *, max_tokens) → LLMResponse works:
result = cf.clean(df, llm=MyClient(), mode="review")cf.clean(df, llm="openai/gpt-4o", max_tokens_budget=10_000)Pre-flight estimate uses ~4 chars/token; actual usage is checked after the call.