Based on documentation for configuration settings used when generating the prompt. Under parameters of responseMimeType we have gemini-1.5-pro and gemini-1.5-flash only for the available models. Try to change your api_version variable either of the two.
Specify the appropriate response type to avoid unintended behaviors. For example, if you require a JSON-formatted response, specify application/json and not text/plain.