mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fix: Fix token_count method to handle list of messages
This commit is contained in:
parent
ed38497c68
commit
0a5b5c3fd6
1 changed files with 3 additions and 0 deletions
|
@ -528,6 +528,9 @@ class Model:
|
|||
return litellm.encode(model=self.name, text=text)
|
||||
|
||||
def token_count(self, messages):
|
||||
if type(messages) is list:
|
||||
return litellm.token_counter(model=self.name, messages=messages)
|
||||
|
||||
if not self.tokenizer:
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue