From 811639dbfdc6dd055a20b5a5d608ed9bdef679e4 Mon Sep 17 00:00:00 2001 From: tantanchen Date: Sun, 21 Apr 2024 21:07:15 -0400 Subject: [PATCH] Update groq_client.py --- dsp/modules/groq_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsp/modules/groq_client.py b/dsp/modules/groq_client.py index c6e11103f9..deeda29daa 100644 --- a/dsp/modules/groq_client.py +++ b/dsp/modules/groq_client.py @@ -64,9 +64,9 @@ def __init__( def log_usage(self, response): """Log the total tokens from the Groq API response.""" - usage_data = response.get("usage") + usage_data = response.usage if usage_data: - total_tokens = usage_data.get("total_tokens") + total_tokens = usage_data.total_tokens logging.debug(f"Groq Total Tokens Response Usage: {total_tokens}") def basic_request(self, prompt: str, **kwargs):