DSPy: The framework for programming—not prompting—language models
Python
fix(groq_client): corrected attribute access in log_usage
matte0fabr050c6ae0f5001
diff --git a/dsp/modules/groq_client.py b/dsp/modules/groq_client.pyindex c6e11103f..6650897ae 100644--- a/dsp/modules/groq_client.py+++ b/dsp/modules/groq_client.py@@ -64,9 +64,9 @@ class GroqLM(LM):def log_usage(self, response):"""Log the total tokens from the Groq API response."""- usage_data = response.get("usage")+ usage_data = response.usage # Directly accessing the 'usage' attributeif usage_data:- total_tokens = usage_data.get("total_tokens")+ total_tokens = usage_data.total_tokenslogging.debug(f"Groq Total Tokens Response Usage: {total_tokens}")def basic_request(self, prompt: str, **kwargs):