Skip to content

Commit b55d340

Browse files
authored
Merge pull request #883 from matte0fabr0/fix-groq_client-log-usage-error
fix(groq_client): corrected attribute access in log_usage
2 parents 1c10a9d + 50c6ae0 commit b55d340

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dsp/modules/groq_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def __init__(
6464

6565
def log_usage(self, response):
6666
"""Log the total tokens from the Groq API response."""
67-
usage_data = response.get("usage")
67+
usage_data = response.usage # Directly accessing the 'usage' attribute
6868
if usage_data:
69-
total_tokens = usage_data.get("total_tokens")
69+
total_tokens = usage_data.total_tokens
7070
logging.debug(f"Groq Total Tokens Response Usage: {total_tokens}")
7171

7272
def basic_request(self, prompt: str, **kwargs):

0 commit comments

Comments
 (0)