fix(gemini): remove metadata and disable inbound query merge#1124
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 and resolves 400 errors that occurred during interactions with the Gemini OpenAI endpoint. The core changes involve modifying the outbound request structure to exclude unsupported fields, specifically 'metadata', and disabling the inbound query merge functionality. These adjustments ensure that requests conform to the Gemini API's expectations, thereby improving the reliability and success rate of API calls. Highlights
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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses 400 errors from the Gemini OpenAI endpoint by removing the metadata field and disabling inbound query merging. The changes are logical and directly address the issue. My review includes suggestions to enhance the test suite to ensure these fixes are robust and prevent future regressions by properly testing the new behavior.
| // Gemini OpenAI endpoint does not accept metadata. | ||
| req.Metadata = nil |
There was a problem hiding this comment.
This change correctly nullifies the metadata on the request. To ensure this fix is properly tested and to prevent regressions, please consider updating the test case (valid chat completion request in outbound_test.go) to cover the case where the original request has metadata. Verify that it's stripped out.
| Headers: headers, | ||
| Body: body, | ||
| Auth: auth, | ||
| SkipInboundQueryMerge: true, |
Summary
Fix Gemini OpenAI request 400 errors.
Closes #1123
Changes
metadatafrom outbound bodyResult
Avoid forwarding unsupported fields like
betaandmetadata.