CodeGPT icon indicating copy to clipboard operation
CodeGPT copied to clipboard

Gemini Model Chat Error

Open bootsma opened this issue 7 months ago • 2 comments

What happened?

When using Chat function in ProxyAI to communicate with a Google Gemini Model (tested on Gemini 2.0 Flash) in PyCharm through the Google Provider (e.g. "Cloud Providers: Google (Gemini)" -> "Gemini 2.0 Flash") the following response is received:

Invalid JSON payload received. Unknown name "systemInstruction": Cannot find field.

Which seems like it might be related to this bug:

https://github.com/googleapis/python-genai/issues/425

Where the request is being made with: http_options=HttpOptions(api_version="v1")

Whereas the Gemini 2.0 Flash model from ProxyAI works fine and "Cloud Providers: Google (Gemini)" -> "Gemini 2.5 Flash (Preview)" works as well

Relevant log output or stack trace


Steps to reproduce

No response

CodeGPT version

3.30-241.1

Operating System

Windows

bootsma avatar May 27 '25 19:05 bootsma

Can confirm that this is still an issue, @bootsma, @carlrobertoh. Got same error (Invalid JSON payload received. Unknown name "systemInstruction": Cannot find field.) on last version of PhpStorm (2025.2.2) and last version of ProxyAI for PhpStorm (3.6.0-241.1) on Gemini 2.5 Pro and Gemini 1.5 Pro.

When trying Gemini 2.5 Flash, I'm getting * GenerateContentRequest.contents[1].parts[0].data: required oneof field 'data' must have one initialized field error or this mess:

GenerateContentRequest.contents[1].parts[0].data: required oneof field 'data' must have one initialized field * GenerateContentRequest.contents[7].parts[0].data: required oneof field 'data' must have one initialized field * GenerateContentRequest.contents[9].parts[0].data: required oneof field 'data' must have one initialized field * GenerateContentRequest.contents[11].parts[0].data: required oneof field 'data' must have one initialized field * GenerateContentRequest.contents[13].parts[0].data: required oneof field 'data' must have one initialized field * GenerateContentRequest.contents[15].parts[0].data: required oneof field 'data' must have one initialized field

Basically nothing from Google works. ProxyAI version seems working, however it beats the reason I'm trying to use this plugin with my own api key for Google and using Gemini directly.

JustGetSchwifty avatar Oct 02 '25 22:10 JustGetSchwifty

Gemini has an OpenAI-compatible interface, so you can just add it as a "Custom OpenAI" provider in the config with the URL for the OpenAI interface. For example for the chat there's this URL https://generativelanguage.googleapis.com/v1beta/openai/chat/completions. It's a little slow, admittedly, but it works at least.

L3tum avatar Oct 16 '25 20:10 L3tum