Conversation history in self.client.models.generate_content in google.gen-ai

I was able to add conversation history in the form of json to the prompt and pass to generate_content in google.generativeai SDK. but with new SDK and 2.0 models it does not accept it. I want to give the content in this format : […{‘role’: ‘model’, ‘parts’: ‘’}, {‘role’: ‘user’, ‘parts’: ‘’}, {‘role’: ‘model’, ‘parts’: […]}, {‘role’: ‘function’, ‘parts’: […]}…] .

I handle the history myself as I want to switch between different LLM backend.

The new SDK gives error : “Extra inputs are not permitted [type=extra_forbidden, input_value=‘model’, input_type=str]
For further information visit Redirecting...
contents.list[union[File,Part,is-instance[Image],str]].69.Part.parts…”