我正尝试向Gemini Pro Vision模型发送请求,但它持续返回以下错误:
400 Multiturn chat is not enabled for models/gemini-pro-vision
我的代码如下:
# 创建客户端
client = generativelanguage_v1beta.GenerativeServiceAsyncClient()
content1 = build_content("user", image, text)
contents2 = build_content("model", image, "这是一只狗")
contents3 = build_content("user", image, "你确定吗?")
request = generativelanguage_v1beta.GenerateContentRequest(
model="models/gemini-pro-vision",
contents=[content1, contents2, contents3],
generation_config=generation_config,
safety_settings=safety_settings
)
# 发送请求
response = await client.generate_content(request=request)
# 处理响应
return response.candidates[0].content.parts[0].text