feat(indexation): disable topic tagging by default#653
Conversation
Topic tagging ran on every indexed document, spending one LLM call per file to produce tags that nothing consumes yet — they are not exposed in the API and not used in retrieval. The admin UI already ships the toggle as disabled with a "Coming soon" hint. Make it opt-in instead: - IndexationPipelineConfig.enable_topic_tagging defaults to False - the seeded `default` indexation preset sets it False explicitly - _required_llm_names no longer resolves an LLM endpoint for an absent key - _replace_topic_tags_if_needed treats an absent key as disabled, so a re-index under a preset that never enabled tagging clears tags left behind by an earlier run - the admin UI toggle falls back to off, matching the backend Existing deployments are unaffected: seed_defaults only inserts when a preset type has no rows, so a stored preset with tagging on keeps it on.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughChanges the default value of ChangesTopic Tagging Default Flip
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant IndexerActor
participant PipelineOutput
participant IndexerPool
IndexerActor->>IndexerActor: read indexation_config.enable_topic_tagging
IndexerActor->>PipelineOutput: check topic_tags presence
IndexerActor->>IndexerActor: treat missing/falsy flag as disabled, clear stale tags
IndexerPool->>IndexerPool: _required_llm_names checks enable_topic_tagging (default False)
IndexerPool->>IndexerPool: exclude topic_tagging_llm when disabled
Possibly related PRs
Suggested labels: `admin-ui` Suggested reviewers: `andyne13` 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
Topic tagging is currently on by default for every partition, so every indexed document pays an extra LLM call to generate tags that nothing consumes: they are not surfaced in the API and not used in retrieval. The admin UI already acknowledges this — the toggle ships
disabledwith the hint "Coming soon — generated tags aren't surfaced or used in retrieval yet."This makes the feature opt-in until it actually ships.
What changed
core/config/indexation_pipeline.pyenable_topic_taggingdefaultTrue→Falseservices/orchestrators/preset_service.pydefaultindexation preset sets itFalseservices/workers/indexer_pool.py_required_llm_namesno longer resolves an LLM for an absent keyservices/workers/indexer_actor.py_replace_topic_tags_if_neededtreats an absent key as disabledui/src/pages/admin/presets.tsxtrue→false, matching the backendReviewer note — one behavior change beyond the flag
_replace_topic_tags_if_neededpreviously purged tags only when a preset setenable_topic_taggingexplicitly toFalse. Now that an absent key means disabled, the purge must apply to absent-key presets too (legal,finance) — otherwise they would silently stop tagging but never clear tags written by an earlier run.The cost is one indexed
DELETE FROM topic_tags WHERE document_id = ? AND partition = ?per indexed document on the (now default) disabled path. It is a no-op for fresh files. Happy to scope it back tois Falsesemantics if you'd rather not pay that on the hot path, at the price of leaving stale tags unreachable for those two presets.Upgrade impact
Existing deployments keep their current behavior.
seed_defaults()only inserts when a preset type has zero rows, so a database that already seededdefaultwith tagging on retains it. Only fresh deployments get the new default. Operators who want tagging back setenable_topic_tagging: trueon the partition's indexation preset.Testing
test_indexation_pipeline_topic_tagging_defaults_offpinning the model default.test_seed_defaults_indexation_leaves_topic_tagging_offcovering the seeded presets.test_required_llm_names_mirrors_pipeline_selection—{}now resolves no LLM, and an explicitTruestill resolvesdefault.uv run pytest tests/unit/→ 1663 passed. The 2 failures intests/unit/api/middleware/test_rate_limit.pyare timing-flaky and reproduce unchanged onorigin/main.uv run ruff check/format --checkclean.Summary by CodeRabbit
Bug Fixes
Tests