Skip to content

fix(groq): honor model kwarg in generate_with_usage response metadata#207

Merged
himanshu231204 merged 2 commits into
OpenAgentHQ:mainfrom
syf2211:fix/groq-response-model-kwarg-79
Jul 22, 2026
Merged

fix(groq): honor model kwarg in generate_with_usage response metadata#207
himanshu231204 merged 2 commits into
OpenAgentHQ:mainfrom
syf2211:fix/groq-response-model-kwarg-79

Conversation

@syf2211

@syf2211 syf2211 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Description

Groq.generate_with_usage() already sent the per-request model override in the API payload but always reported self.model in the returned LLMResponse. This fix uses the resolved request model so response metadata matches the model actually used.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Test update
  • CI/CD update

Related Issues

Closes #79

How Has This Been Tested?

  • Unit tests pass (pytest tests/unit/test_providers/test_groq.py -v — 18 passed)
  • Linter passes on changed files (ruff check on groq.py and test_groq.py)
  • Type checker passes (uv run mypy openagent_eval/)
  • Manual testing performed

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

One-line behavioral fix in groq.py; follows the model-override testing pattern from test_ollama.py.

Fixes OpenAgentHQ#79

generate_with_usage() already sent the per-request model override in the
API payload but LLMResponse.model always used self.model. Use the resolved
request model so evaluation pipelines and cost trackers attribute responses
correctly.
@opencode-agent

Copy link
Copy Markdown

PR Review: fix(groq): honor model kwarg in generate_with_usage response metadata

Overall: ✅ Looks good. One-line bug fix with appropriate test coverage.

Change

openagent_eval/providers/llm/groq.py:278model=self.modelmodel=request_params["model"]

request_params["model"] is already resolved from kwargs.get("model", self.model) on line 248, so this correctly reflects the per-request override. Before the fix, generate_with_usage() sent the right model to the API but always reported self.model in the metadata. The parallel generate() method didn't have this bug since it only returns a string.

Tests

The two new tests follow the existing patterns correctly:

  • test_generate_with_usage_returns_llm_response — verifies default self.model when no override is passed
  • test_generate_with_usage_model_override — verifies the overridden model appears in both the API call params and result.model

Lint / Types

Lint passes on the changed file (the two pre-existing E402 warnings in test_groq.py are from the importorskip pattern, which is standard for optional dependencies). The groq package is unavailable in CI so tests are skipped, but the diff is trivially correct.

Verdict

Approve. No issues found.

New%20session%20-%202026-07-22T13%3A32%3A14.106Z
opencode session  |  github run

@opencode-agent

Copy link
Copy Markdown

@himanshu231204
himanshu231204 merged commit 69fedb9 into OpenAgentHQ:main Jul 22, 2026
8 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congratulations @syf2211!

Your pull request has been successfully merged into main. 🚀

Thank you for contributing to OpenAgentHQ and helping improve the project.

We truly appreciate your contribution and hope to see you back with more amazing PRs!

Happy Open Sourcing! ❤️

🌟 This is your first merged contribution to this repository.
Welcome to the OpenAgentHQ contributors family!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

providers(groq): generate_with_usage response.model ignores model kwarg override

2 participants