You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accessing the property response.text no longer works.
genai.configure(api_key=gcp_key)
model=genai.GenerativeModel("gemini-pro")
response=model.generate_content(prompt)
print(str(response.text)
# TypeError: argument of type 'Part' is not iterable# google/generativeai/types/generation_types.py# line 327, in text# if len(parts) != 1 or "text" not in parts[0]:
As a workaround, I can get the detail with response.candidates[0].content.parts[0].text, but this seems like it might be a breaking change?
Actual vs expected behavior:
I should be able to reference response.text directly.
Any other information you'd like to share?
NOTE: I am using the internal Google3 version of this SDK - see go/generative-ai-python-sdk-response-type-issue for the exact line internally. There seems to be a discrepancy between Google3 and GitHub - this is the line in the GitHub repo.
Feel free to reach out to me internally - mitchspano@