Skip to content

Commit

Permalink
Make token_usage() a method not a property
Browse files Browse the repository at this point in the history
Just in case we want parameters
  • Loading branch information
cpsievert committed Dec 17, 2024
1 parent 710e6fe commit 970fe36
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions chatlas/_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def system_prompt(self, value: str | None):
if value is not None:
self._turns.insert(0, Turn("system", value))

@property
def token_usage(self) -> tuple[int, int]:
"""
Get the current token usage for the chat.
Expand All @@ -199,7 +198,7 @@ def token_count(
"""
Get the token count for the given input.
This is useful for estimating the number of tokens your input will cost
This is useful for estimating the number of tokens your input will cost
before sending it to the model.
Parameters
Expand All @@ -226,7 +225,7 @@ def token_count(
# Once input is sent, you can get the actual input and output
# token counts from the chat object
chat.chat("What is 2 + 2?", echo="none")
print(chat.token_usage)
print(chat.token_usage())
```
"""

Expand Down

0 comments on commit 970fe36

Please sign in to comment.