Description
Use runner.run_live with gemini model
Sometimes there is a WS connection break between the server and the LLM.
The problem is that connection closure processing does not involve closing the LiveRequestQueueue queue.
That is, the queue continues to exist and receive messages, but the consumer is no longer there. Looking through the code I realized that at the moment there is no way to determine whether the connection is broken or not.
It would be nice to add a 'closed' flag to LiveRequestQueue and set it when the connection is closed. And add a custom LiveRequestQueueClosed error when invoke get or send (send_content ...).
Such a solution will allow to implement the check, and recreate the runner instance when the connection is lost.
I saw a note that shotdown is planned to be added. But in fact the 'closed' flag solves the problem completely, because you can recreate the runner with the same queue or create a new one. And we dont depend on python version.
I tried to think of a crutch. But so far I have not been able to get to the WS instance to implement the check. Please advise me on a temporary solution.
Reproduse:
Run runner
Turn off the internet
Wait connection close
Send new message