Skip to main content

tokenize_query

Function tokenize_query 

Source
pub fn tokenize_query(
    text: &str,
    tokenizer: &Tokenizer,
    model_max_tokens: usize,
) -> Result<Encoding>
Expand description

Tokenize a query string for embedding, truncating to model_max_tokens.

Returns an crate::backend::Encoding with input_ids, attention_mask, and token_type_ids cast to i64, ready for ONNX inference.

ยงErrors

Returns an error if the tokenizer fails to encode the text.