-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Labels
component:python sdkIssue/PR related to Python SDKIssue/PR related to Python SDKtype:bugSomething isn't workingSomething isn't working
Description
Description of the bug:
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@
Metadata
Metadata
Assignees
Labels
component:python sdkIssue/PR related to Python SDKIssue/PR related to Python SDKtype:bugSomething isn't workingSomething isn't working