MCPcopy Create free account
hub / github.com/BerriAI/litellm / encode

Method encode

litellm/litellm_core_utils/tokenizer.py:85–95  ·  view source on GitHub ↗
(
        self,
        text: str,
        *,
        allowed_special: AllowedSpecial = frozenset(),
        disallowed_special: SpecialTokens = "all",
    )

Source from the content-addressed store, hash-verified

83 return self._native.encode(text)
84
85 def encode(
86 self,
87 text: str,
88 *,
89 allowed_special: AllowedSpecial = frozenset(),
90 disallowed_special: SpecialTokens = "all",
91 ) -> list[int]: # mutable-ok: [LIT001] SDK return type
92 allowed: Final = self._allowed(text, allowed_special, disallowed_special)
93 if not allowed:
94 return self.encode_ordinary(text)
95 return self._native.encode_special(text, tuple(allowed))
96
97 def encode_to_numpy(
98 self,

Callers 15

encode_to_numpyMethod · 0.95
_token_cache_keyMethod · 0.45
to_basic_authFunction · 0.45
_hash_discovery_authMethod · 0.45
_fits_reference_limitFunction · 0.45
hash_tokenFunction · 0.45
canonical_video_idFunction · 0.45

Calls 3

_allowedMethod · 0.95
encode_ordinaryMethod · 0.95
encode_specialMethod · 0.45

Tested by

no test coverage detected