Skip to content

GroqLM integration issue #867

@k2ai

Description

@k2ai

I identified GroqLM integration issue due to syntax error in below file.

https://github.com/stanfordnlp/dspy/blob/main/dsp/modules/groq_client.py

There is an issue found in line number 67 and 69

CURRENT CODE :

def log_usage(self, response):
        """Log the total tokens from the Groq API response."""
        usage_data = response.get("usage")
        if usage_data:
            total_tokens = usage_data.get("total_tokens")
            logging.debug(f"Groq Total Tokens Response Usage: {total_tokens}")

RESOLUTION:

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}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions