Skip to content

Fix auto-truncate false setting#836

Merged
alvarobartt merged 1 commit intohuggingface:mainfrom
vrdn-23:vrdn-23/fix-auto-truncate-cli
Feb 23, 2026
Merged

Fix auto-truncate false setting#836
alvarobartt merged 1 commit intohuggingface:mainfrom
vrdn-23:vrdn-23/fix-auto-truncate-cli

Conversation

@vrdn-23
Copy link
Copy Markdown
Contributor

@vrdn-23 vrdn-23 commented Feb 20, 2026

What does this PR do?

Summary

The --auto-truncate CLI flag could not be set to false via the command line after its default was changed to true in #829. This is because clap treats bool fields as presence-based flags, so --auto-truncate false would error with "unexpected argument 'false' found".

The fix adds num_args = 0..=1, default_missing_value = "true" to the clap attribute, allowing the flag to optionally accept an explicit value. All existing usage remains backward compatible:

Usage Result
(flag omitted) true (default)
--auto-truncate true (backward compatible)
--auto-truncate true true
--auto-truncate false false (new)

The AUTO_TRUNCATE env var continues to work as before.

Fixes #833

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the documentation guidelines.
  • Did you write any new necessary tests? If applicable, did you include or update the insta snapshots?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@alvarobartt @kozistr @michaelfeil

Copy link
Copy Markdown
Contributor

@kozistr kozistr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@alvarobartt alvarobartt merged commit 77ee99d into huggingface:main Feb 23, 2026
3 of 15 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.

How to disable --auto-truncate via the text-embeddings-router CLI?

3 participants