ValueError:“response.text”快速访问器仅适用于简单(单“部分”)文本响应。此响应不是简单的文本。请改用“result.parts”访问器或完整的“result.candidates[index].content.parts”查找。·期号 #170 ·谷歌-双子座/生成-人工智能-python ·GitHub上https://github.com/google-gemini/generative-ai-python/issues/170
safety_settings = [
{
"category": "HARM_CATEGORY_DANGEROUS",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE",
},
]
# For image model
image_model.generate_content([your_image, prompt], safety_settings=safety_settings)
# For text model
text_model.generate_content(prompt, safety_settings=safety_settings)