MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / count_tokens

Method count_tokens

methods/base.py:112–116  ·  view source on GitHub ↗

Count tokens in text.

(self, text: str)

Source from the content-addressed store, hash-verified

110 self._context_id = context_id
111
112 def count_tokens(self, text: str) -> int:
113 """Count tokens in text."""
114 if not text:
115 return 0
116 return len(self._tokenizer.encode(text))
117
118 @property
119 def memory_size(self) -> int:

Callers 15

total_memory_tokensMethod · 0.95
get_gemini_answersFunction · 0.45
queryMethod · 0.45
queryMethod · 0.45
process_chunksMethod · 0.45
memorizeMethod · 0.45
_query_manualMethod · 0.45
queryMethod · 0.45

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected