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
Holt Skinner asked me to file this bug. I was executing the lab in a Workbench instance, not Colab. The %pip install --upgrade --user --quiet google-cloud-aiplatform didn't seem to upgrade, it outputted:
%pip install --upgrade --user --quiet google-cloud-aiplatform
WARNING: The script tb-gcp-uploader is installed in '/home/jupyter/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Note: you may need to restart the kernel to use updated packages.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[25], line 5
1 tool = Tool.from_google_search_retrieval(grounding.GoogleSearchRetrieval())
3 response = model.generate_content(PROMPT, tools=[tool])
----> 5 print_grounding_response(response)
Cell In[24], line 5, in print_grounding_response(response)
3 print(response.candidates[0])
4 print(str(dir(response.candidates[0])))
----> 5 grounding_metadata = response.candidates[0].grounding_metadata
7 # Citation indices are in byte units
8 ENCODING = "utf-8"
AttributeError: 'Candidate' object has no attribute 'grounding_metadata'
Output of print(response.candidates[0]):
content {
role: "model"
parts {
text: "The next solar eclipse in the US will be an annular solar eclipse on October 14, 2023. This eclipse will cross the US from Oregon to Texas. \n\nAfter that, the next solar eclipse will be a total solar eclipse on April 8, 2024. This eclipse will sweep across North America from Mazatl\303\241n to Newfoundland. \n\nThe next total solar eclipse visible in the contiguous US after 2024 will be on August 23, 2044. \n"
}
}
finish_reason: STOP
safety_ratings {
category: HARM_CATEGORY_HATE_SPEECH
probability: NEGLIGIBLE
probability_score: 0.05654813349246979
severity: HARM_SEVERITY_NEGLIGIBLE
severity_score: 0.043042849749326706
}
safety_ratings {
category: HARM_CATEGORY_DANGEROUS_CONTENT
probability: NEGLIGIBLE
probability_score: 0.21667379140853882
severity: HARM_SEVERITY_NEGLIGIBLE
severity_score: 0.16940586268901825
}
safety_ratings {
category: HARM_CATEGORY_HARASSMENT
probability: NEGLIGIBLE
probability_score: 0.1710611879825592
severity: HARM_SEVERITY_NEGLIGIBLE
severity_score: 0.05399883911013603
}
safety_ratings {
category: HARM_CATEGORY_SEXUALLY_EXPLICIT
probability: NEGLIGIBLE
probability_score: 0.11338310688734055
severity: HARM_SEVERITY_NEGLIGIBLE
severity_score: 0.0699218362569809
}
grounding_metadata {
web_search_queries: "When is the next solar eclipse in the US?"
}
Output of print(str(dir(response.candidates[0]))):
File Name
intro-grounding-gemini.ipynb
What happened?
For some reason the step
resulted in this.
Holt Skinner asked me to file this bug. I was executing the lab in a Workbench instance, not Colab. The
%pip install --upgrade --user --quiet google-cloud-aiplatform
didn't seem to upgrade, it outputted:pip freeze | grep ai
:Relevant log output
Output of
print(response.candidates[0])
:Output of
print(str(dir(response.candidates[0])))
:Code of Conduct
The text was updated successfully, but these errors were encountered: