#Gemini: Please ensure that function response then comes immediately after a function call

1 messages · Page 1 of 1 (latest)

zealous burrow
#

Hi,

For a while I have consistently been getting this error maybe 60-70% of the time I use Gemini for the voice assistant. I am using gemini-flash-latest and all the default settings.

Has anyone else had this and found a solution?
Full debug: https://gist.github.com/KrisQuack/789bd101a60f6e49ece62535e6c8bca0

Logger: homeassistant.components.google_generative_ai_conversation
Source: components/google_generative_ai_conversation/entity.py:438
integration: Google Gemini (documentation, issues)
First occurred: 14:33:51 (4 occurrences)
Last logged: 14:49:25

Error sending message: <class 'google.genai.errors.ServerError'> 500 Internal Server Error. {'message': '{\n "error": {\n "code": 500,\n "message": "An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting",\n "status": "INTERNAL"\n }\n}\n', 'status': 'Internal Server Error'}
Error sending message: <class 'google.genai.errors.ClientError'> 400 Bad Request. {'message': '{\n "error": {\n "code": 400,\n "message": "Please ensure that function response turn comes immediately after a function call turn.",\n "status": "INVALID_ARGUMENT"\n }\n}\n', 'status': 'Bad Request'}
uncut pebble
#

@zealous burrow Did you applied Gemini fix so it can search the web?

#

Check Google Search paragraph

zealous burrow
zealous burrow
#

It also continues to happen if I apply the search workaround. It's not every message but I would say definitely over half of them

uncut pebble
#

@zealous burrow you need to setup web search if you want questions to be answered that HA can't provide. Your example is: "What will the weather be like for the next two hours?" that is something that HA does not provide since it provide only current temp, wind, humidity... that are for current hour. So it will error since it can't find it online. For this kind of questions, you need to setup in prompt your location and to have fix applied.
Other thing to check is your wifi signal for your HA VA that can impact as well

zealous burrow
#

Hey so even though I don't need web data I added that workaround for search and still get this issue even for simple queries quite often

leaden estuary
#

I have this issue as well

zealous burrow
#

Yeah I have reinstalled my whole setup since then, resetup the Gemini integration along with the web workaround. Both with and without web same issue as the debug logs I posted originally

zealous burrow
#

Another example of kinda how it will give that error then the next response will be fine.

#

I'm not the best with python but I might give it a try debugging it myself