Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Error when trying to do multiturn chat with gemini-pro

$
0
0

This is the code I took from the API docs in order to start multiturn chat

model = genai.GenerativeModel("gemini-pro")messages = [{'role':'user', 'parts': ['hello']}]response = model.generate_content(messages) # "Hello, how can I help"messages.append(response.candidates[0].content)messages.append({'role':'user', 'parts': ['How does quantum physics work?']})response = model.generate_content(messages)

But I'm getting the following error:

TypeError: Could not create Blob, expected Blob, dict or an Image type(PIL.Image.Image or IPython.display.Image).Got a: <class 'google.ai.generativelanguage_v1beta.types.content.Content'>Value: parts {text: "hello"}

I also tried using the send_message feature, but I got the same error after I tried to use send_message the second time.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>