detect_metadata_from_hf

Function detect_metadata_from_hf 

Source
pub fn detect_metadata_from_hf(backend_str: &str) -> Result<HfMetadata, String>
Expand description

Detect HfMetadata from the raw text of a tokenizer.json.

Returns Err only when backend_str is not parseable JSON or is not a JSON object — faithful to the C++ XGRAMMAR_CHECK(err.empty() && v.is<object>()). A well-formed object that simply lacks the expected fields yields HfMetadata { vocab_type: Raw, add_prefix_space: false }.