Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to close a vertex AI chat session?

Hello,

I am creating a chat session, conducting a series of automatic requests but I can't find a way using the python API to close the session in order to initiate another and not leave the context alive.

I am creating the session using:

 

chat_model = GenerativeModel('gemini-pro')
chat_model.start_chat()

 

 
The underlying reason why I wan to close the session is because we are getting a ResponseBlockedError when sending a message and after trying other sources, we believe having too many sessions opened could be the reason.
 
Any help will be highly appreciated.
 
Thank you.
 

 

0 0 577
0 REPLIES 0