Skip to content

Commit

Permalink
fix: Add note about Terms of Service for Grounding with Google Search (
Browse files Browse the repository at this point in the history
…#538)

Fixes #536 🦕
  • Loading branch information
holtskinner authored Apr 12, 2024
1 parent 35f8c5e commit 34f207a
Showing 1 changed file with 12 additions and 66 deletions.
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

0 comments on commit 34f207a

Please sign in to comment.