Skip to content

Add require_categories DSL and fix ActiveSupport dependency#1

Merged
DmitrySychev merged 1 commit intomainfrom
fix-multi-label-and-blank
Apr 5, 2026
Merged

Add require_categories DSL and fix ActiveSupport dependency#1
DmitrySychev merged 1 commit intomainfrom
fix-multi-label-and-blank

Conversation

@DmitrySychev
Copy link
Copy Markdown
Contributor

Summary

  • Add require_categories true DSL macro for multi-label classifiers that should fail when no categories match
  • Fix .blank? ActiveSupport dependency in Web content fetcher
  • Bump to 0.2.0

Details

require_categories

Multi-label classifiers previously always returned Result.success even with an empty categories array. This made it impossible to distinguish "the LLM found no matching categories" from "classification succeeded with results."

class MyClassifier < LlmClassifier::Classifier
  categories :a, :b, :c
  multi_label true
  require_categories true  # now returns Result.failure when categories is empty
end

.blank? fix

ContentFetchers::Web#normalize_redirect_url called .blank? which is an ActiveSupport method. Replaced with nil? || empty? so the gem works without Rails/ActiveSupport.

@DmitrySychev
Copy link
Copy Markdown
Contributor Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

- Add `require_categories true` DSL macro: when set, multi-label
  classifiers return Result.failure when no valid categories are found
  (previously multi-label always returned success with empty array)
- Fix .blank? call in Web content fetcher's normalize_redirect_url
  that required ActiveSupport. Replaced with nil/empty check.
- Bump version to 0.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@DmitrySychev DmitrySychev force-pushed the fix-multi-label-and-blank branch from fa35b84 to 93b7b91 Compare April 5, 2026 20:07
@DmitrySychev DmitrySychev merged commit 9972f50 into main Apr 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant