fix: drop Groq reasoning_content from assistant history#6065
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical compatibility issue with the Groq API, which previously rejected assistant history messages containing specific reasoning fields. By proactively removing these unsupported fields, the change ensures seamless follow-up interactions and maintains the integrity of conversational flows when using the Groq provider. The update also includes robust testing to validate the correct behavior across different API providers. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
嗨——我已经审查了你的更改,一切看起来都很棒!
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续的代码审查。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with Groq rejecting assistant history messages containing reasoning content. The fix is implemented by stripping reasoning_content and reasoning fields from assistant messages before sending requests to Groq. This is achieved by overriding _finally_convert_payload in the ProviderGroq class. The changes include valuable regression tests that verify the new behavior for Groq and ensure the existing behavior for the base OpenAI provider remains unchanged. The overall approach is sound.
…6065) Co-authored-by: Stable Genius <259448942+stablegenius49@users.noreply.github.com>
…6065) Co-authored-by: Stable Genius <259448942+stablegenius49@users.noreply.github.com>
…6065) Co-authored-by: Stable Genius <259448942+stablegenius49@users.noreply.github.com>
Summary
reasoning_content/reasoningfrom assistant history before Groq requestsWhy
Groq rejects assistant history messages that include
reasoning_content, which breaks follow-up turns after prior responses contained reasoning. This keeps the cleaned assistant text while omitting the unsupported field for Groq.Closes #5946
Summary by Sourcery
调整 Groq 聊天补全(chat completion)请求负载的处理方式:在保留现有 OpenAI 行为的同时,从 assistant 历史消息中剥离不受支持的推理字段,并为两个提供商增加回归测试覆盖。
Bug Fixes:
reasoning和reasoning_content字段,防止 Groq 请求失败。Tests:
reasoning_content字段,而 Groq 会丢弃推理相关字段。Original summary in English
Summary by Sourcery
Adjust Groq chat completion payload handling to strip unsupported reasoning fields from assistant history while preserving existing OpenAI behavior and add regression coverage for both providers.
Bug Fixes:
Tests: