Calculate the number of tokens for the turn.
(self)
| 245 | return {k: v for k, v in asdict(self).items() if k != "embedding"} |
| 246 | |
| 247 | def calc_token(self): |
| 248 | """ |
| 249 | Calculate the number of tokens for the turn. |
| 250 | """ |
| 251 | if self.images is not None: |
| 252 | self.input_tokens += calc_image_tokens(self.images) |
| 253 | self.input_tokens += len(ENCODING.encode(self.prompt)) |
| 254 | self.output_tokens = len(ENCODING.encode(self.response)) |
| 255 | |
| 256 | def __eq__(self, other): |
| 257 | return self is other |
no test coverage detected