From 970fe36771ccb8b3d9854b29c64b12664b5d7715 Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 17 Dec 2024 17:53:27 -0600 Subject: [PATCH] Make token_usage() a method not a property Just in case we want parameters --- chatlas/_chat.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chatlas/_chat.py b/chatlas/_chat.py index 5984b09..6edf5f0 100644 --- a/chatlas/_chat.py +++ b/chatlas/_chat.py @@ -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. @@ -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 @@ -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()) ``` """