Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add note about Terms of Service for Grounding with Google Search #538

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 12 additions & 66 deletions gemini/grounding/intro-grounding-gemini.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -376,79 +376,25 @@
"source": [
"### Text generation grounded in Google Search results\n",
"\n",
"Now you can add the `tools` keyword arg with a grounding tool of `grounding.GoogleSearchRetrieval()` to instruct the LLM to first perform a Google Search with the prompt, then construct an answer based on the web search results:"
"Now you can add the `tools` keyword arg with a grounding tool of `grounding.GoogleSearchRetrieval()` to instruct the LLM to first perform a Google Search with the prompt, then construct an answer based on the web search results.\n",
"\n",
"**Note:** Before running the sample below, you will need to opt-in for Grounding with Google Search using [this form](https://docs.google.com/forms/d/e/1FAIpQLSfj7SJNAqXOe7vB9Re-WtwJedTWjHkBKZ6OHaLoGoXRG93ymg/viewform). If you use this service in a production application, you will also need to [use a Google Search entry point](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/grounding-search-entry-points)."
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"- Price: Starting from USD 499\n",
"- Storage size options: 128 GB and 256 GB\n",
"- Available colors: Porcelain, Rose, and Hazel"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"candidates {\n",
" content {\n",
" role: \"model\"\n",
" parts {\n",
" text: \"- Price: Starting from USD 499\\n- Storage size options: 128 GB and 256 GB\\n- Available colors: Porcelain, Rose, and Hazel\"\n",
" }\n",
" }\n",
" finish_reason: STOP\n",
" safety_ratings {\n",
" category: HARM_CATEGORY_HATE_SPEECH\n",
" probability: NEGLIGIBLE\n",
" }\n",
" safety_ratings {\n",
" category: HARM_CATEGORY_DANGEROUS_CONTENT\n",
" probability: NEGLIGIBLE\n",
" }\n",
" safety_ratings {\n",
" category: HARM_CATEGORY_HARASSMENT\n",
" probability: NEGLIGIBLE\n",
" }\n",
" safety_ratings {\n",
" category: HARM_CATEGORY_SEXUALLY_EXPLICIT\n",
" probability: NEGLIGIBLE\n",
" }\n",
" grounding_metadata {\n",
" web_search_queries: \"Pixel Tablet price, colors, and storage size options?\"\n",
" grounding_attributions {\n",
" web {\n",
" uri: \"https://store.google.com/product/pixel_tablet_specs\"\n",
" title: \"Pixel Tablet Technical Specs - Google Store\"\n",
" }\n",
" segment {\n",
" end_index: 119\n",
" }\n",
" confidence_score: 0.778106511\n",
" }\n",
" }\n",
"}\n",
"usage_metadata {\n",
" prompt_token_count: 17\n",
" candidates_token_count: 38\n",
" total_token_count: 55\n",
"}"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31mRunning cells with 'Python 3.12.2' requires the ipykernel package.\n",
"\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
"\u001b[1;31mCommand: '/opt/homebrew/bin/python3 -m pip install ipykernel -U --user --force-reinstall'"
]
}
],
"source": [
Expand Down
Loading