Always getting InternalServerError

I’m using the api like this:

chat = model.start_chat(
        history=['Tell me if the sentence is positive or negative']
)

then use a loop to input sentences.

However, recently it keeps returning

InternalServerError: 500 An internal error has occurred

after less than 30 sentences. I’ve used it for weeks and it usually returned 500 answers or more until resources were exhausted. Changing the model to gemini-1.5-pro solves the problem but I have to stick with gemini-1.0-pro for specific reasons.

There was a bug where accepting two user messages in a row was allowed, when it was supposed to be rejected. That bug was fixed, and I think it is what you are seeing.

The best solution, in your case, is to not include this as part of the history but, instead, to build a prompt with something like this:

Identify if this sentence is positive or negative:
{message_from_user}

And send the result of that to Gemini.