Count tokens in text.
(self, text: str)
| 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: |
no test coverage detected