Simultaneous Multiple user

How does gemini 1.5 flash API work for multiple simultaneous user. Do I have to send the chat history each time for each conversation to identify each user or?
(if possible please provide a sample code to handle multiple users simultaneously)

Welcome to the forums!

Yes, you need to manage the history and make sure that the correct history is sent to each user.

You don’t mention what language you use, but you may want to look at examples for the start_chat() or startChat() method. The object that this returns contains a history, and you should save this history for a user’s session. Then, the next time you get a message from the user, you should call startChat() with the previous history.

1 Like