Commit 9203a83
committed
chore(types): annotate text_length is upper-bound estimate (char ≈ 4 tokens)
`MessageContent::text_length` is sometimes used as a proxy for LLM
token count, but it returns UTF-8 byte length — not Unicode chars and
not real tokens. Document the upper-bound semantics, the ~4 bytes ≈
1 token rule of thumb, and that exact counts should swap to a real
tokenizer rather than mutate this function.1 parent b64a24c commit 9203a83
1 file changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
173 | 193 | | |
174 | 194 | | |
175 | 195 | | |
| |||
0 commit comments