Skip to content

Commit 84c4ae4

Browse files
authored
Sync notebook content (google#185)
Mainly to update the img URLs for the new domain. Also includes latest content.
1 parent be9d976 commit 84c4ae4

19 files changed

+49
-100
lines changed

site/en/docs/semantic_retriever.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/docs/semantic_retriever\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=https://ai.google.dev/docs/semantic_retriever\"><img src=\"https://ai.google.dev/docs/semantic_retriever\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" <td>\n",
5353
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/docs/semantic_retriever.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
5454
" </td>\n",
5555
" <td>\n",
56-
" <a target=\"_blank\" href=\"https://github.com/google/generative-ai-docs/blob/main/site/en/docs/semantic_retriever.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
56+
" <a target=\"_blank\" href=\" https://github.com/google/generative-ai-docs/blob/main/site/en/docs/semantic_retriever.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
5757
" </td>\n",
5858
"</table>"
5959
]

site/en/examples/anomaly_detection.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/anomaly_detection\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/anomaly_detection\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" <td>\n",
5353
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/anomaly_detection.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
5454
" </td>\n",

site/en/examples/chat_calculator.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/chat_calculator\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/chat_calculator\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/chat_calculator.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",

site/en/examples/clustering_with_embeddings.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/clustering_with_embeddings\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/clustering_with_embeddings\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/clustering_with_embeddings.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
@@ -131,7 +131,7 @@
131131
"source": [
132132
"### Grab an API Key\n",
133133
"\n",
134-
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in MakerSuite.\n",
134+
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in Google AI Studio.\n",
135135
"\n",
136136
"<a class=\"button button-primary\" href=\"https://makersuite.google.com/app/apikey\" target=\"_blank\" rel=\"noopener noreferrer\">Get an API key</a>\n",
137137
"\n",

site/en/examples/doc_search_emb.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/doc_search_emb\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/doc_search_emb\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/doc_search_emb.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
@@ -125,7 +125,7 @@
125125
"source": [
126126
"### Grab an API Key\n",
127127
"\n",
128-
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in MakerSuite.\n",
128+
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in Google AI Studio.\n",
129129
"\n",
130130
"<a class=\"button button-primary\" href=\"https://makersuite.google.com/app/apikey\" target=\"_blank\" rel=\"noopener noreferrer\">Get an API key</a>\n",
131131
"\n",

site/en/examples/text_calculator.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/text_calculator\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/text_calculator\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/text_calculator.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",

site/en/examples/train_text_classifier_embeddings.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/train_text_classifier_embeddings\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/train_text_classifier_embeddings\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/train_text_classifier_embeddings.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
@@ -133,7 +133,7 @@
133133
"source": [
134134
"### Grab an API Key\n",
135135
"\n",
136-
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in MakerSuite.\n",
136+
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in Google AI Studio.\n",
137137
"\n",
138138
"<a class=\"button button-primary\" href=\"https://makersuite.google.com/app/apikey\" target=\"_blank\" rel=\"noopener noreferrer\">Get an API key</a>\n",
139139
"\n",

site/en/examples/vectordb_with_chroma.ipynb

Lines changed: 25 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/vectordb_with_chroma\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/examples/vectordb_with_chroma\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/examples/vectordb_with_chroma.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
@@ -79,14 +79,10 @@
7979
"\n",
8080
"You can run this quickstart in Google Colab.\n",
8181
"\n",
82-
"To complete this quickstart on your own development environment, ensure that your envirmonement meets the following requirements:\n",
82+
"To complete this quickstart on your own development environment, ensure that your environment meets the following requirements:\n",
8383
"\n",
8484
"- Python 3.9+\n",
85-
"- An installation of `jupyter` to run the notebook.\n",
86-
"\n",
87-
"## Setup\n",
88-
"\n",
89-
"First, download and install the Gemini API Python library."
85+
"- An installation of `jupyter` to run the notebook."
9086
]
9187
},
9288
{
@@ -95,15 +91,8 @@
9591
"id": "akuOzK4dJl3j"
9692
},
9793
"source": [
98-
"## Setup\n"
99-
]
100-
},
101-
{
102-
"cell_type": "markdown",
103-
"metadata": {
104-
"id": "L47er-HZN5NI"
105-
},
106-
"source": [
94+
"## Setup\n",
95+
"\n",
10796
"First, download and install ChromaDB and the Gemini API Python library."
10897
]
10998
},
@@ -129,6 +118,15 @@
129118
"!pip install -q chromadb"
130119
]
131120
},
121+
{
122+
"cell_type": "markdown",
123+
"metadata": {
124+
"id": "jwmKt115PxK8"
125+
},
126+
"source": [
127+
"Then import the modules you'll use in this tutorial."
128+
]
129+
},
132130
{
133131
"cell_type": "code",
134132
"execution_count": null,
@@ -160,7 +158,7 @@
160158
"source": [
161159
"### Grab an API Key\n",
162160
"\n",
163-
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in MakerSuite.\n",
161+
"Before you can use the Gemini API, you must first obtain an API key. If you don't already have one, create a key with one click in Google AI Studio.\n",
164162
"\n",
165163
"<a class=\"button button-primary\" href=\"https://makersuite.google.com/app/apikey\" target=\"_blank\" rel=\"noopener noreferrer\">Get an API key</a>\n",
166164
"\n",
@@ -335,7 +333,6 @@
335333
"outputs": [],
336334
"source": [
337335
"# Set up the DB\n",
338-
"import json\n",
339336
"db = create_chroma_db(documents, \"googlecarsdatabase\")"
340337
]
341338
},
@@ -670,7 +667,6 @@
670667
},
671668
"outputs": [],
672669
"source": [
673-
"# TODO: Update the query to accept an embed_fn that allows us to specify the query task_type. Running into Chroma errors.\n",
674670
"def get_relevant_passage(query, db):\n",
675671
" passage = db.query(query_texts=[query], n_results=1)['documents'][0][0]\n",
676672
" return passage"
@@ -709,7 +705,7 @@
709705
"id": "s8PNRMpOQkm5"
710706
},
711707
"source": [
712-
"Now that you have found the relevant passage in your set of documents, you can use it make a prompt to pass into the PaLM API."
708+
"Now that you have found the relevant passage in your set of documents, you can use it make a prompt to pass into the Gemini API."
713709
]
714710
},
715711
{
@@ -739,33 +735,10 @@
739735
{
740736
"cell_type": "markdown",
741737
"metadata": {
742-
"id": "hnHUJbE9RgwK"
743-
},
744-
"source": [
745-
"The `answer` function will generate a response based on the query you have passed in. It retrieves the relevant document, and from there calls the PaLM text generation API to generate a response to the query."
746-
]
747-
},
748-
{
749-
"cell_type": "code",
750-
"execution_count": null,
751-
"metadata": {
752-
"id": "NWe34VIcsf7J"
738+
"id": "hMEjbz4EswQ6"
753739
},
754-
"outputs": [
755-
{
756-
"name": "stdout",
757-
"output_type": "stream",
758-
"text": [
759-
"models/gemini-pro\n",
760-
"models/gemini-pro-vision\n",
761-
"models/gemini-ultra\n"
762-
]
763-
}
764-
],
765740
"source": [
766-
"for m in genai.list_models():\n",
767-
" if 'generateContent' in m.supported_generation_methods:\n",
768-
" print(m.name)"
741+
"Pass a query to the prompt:"
769742
]
770743
},
771744
{
@@ -795,54 +768,30 @@
795768
}
796769
],
797770
"source": [
798-
"query = \"How do you shift gears in the Google car?\"\n",
771+
"query = \"How do you use the touchscreen in the Google car?\"\n",
799772
"prompt = make_prompt(query, passage)\n",
800773
"Markdown(prompt)"
801774
]
802775
},
803-
{
804-
"cell_type": "code",
805-
"execution_count": null,
806-
"metadata": {
807-
"id": "EwfyxFM6Giy9"
808-
},
809-
"outputs": [],
810-
"source": [
811-
"model = genai.GenerativeModel('gemini-pro')\n",
812-
"answer = model.generate_content(prompt)"
813-
]
814-
},
815776
{
816777
"cell_type": "markdown",
817778
"metadata": {
818-
"id": "hiDpAV5ScQ42"
779+
"id": "VRy6yXzcPxLB"
819780
},
820781
"source": [
821-
"The temperature controls the randomness of the output. The larger the value, the more random the generated text will be."
782+
"Now use the `generate_content` method to to generate a response from the model."
822783
]
823784
},
824785
{
825786
"cell_type": "code",
826787
"execution_count": null,
827788
"metadata": {
828-
"id": "IvgK5xq6HPRx"
789+
"id": "EwfyxFM6Giy9"
829790
},
830-
"outputs": [
831-
{
832-
"data": {
833-
"text/markdown": [
834-
"The provided passage does not provide information about shifting gears in the Google car, so I am unable to answer your question based on this text."
835-
],
836-
"text/plain": [
837-
"<IPython.core.display.Markdown object>"
838-
]
839-
},
840-
"execution_count": 119,
841-
"metadata": {},
842-
"output_type": "execute_result"
843-
}
844-
],
791+
"outputs": [],
845792
"source": [
793+
"model = genai.GenerativeModel('gemini-pro')\n",
794+
"answer = model.generate_content(prompt)\n",
846795
"Markdown(answer.text)"
847796
]
848797
},

site/en/palm_docs/chat_node_quickstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"source": [
5050
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5151
" <td>\n",
52-
" <a target=\"_blank\" href=\"https://ai.google.dev/palm_docs/chat_node_quickstart\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
52+
" <a target=\"_blank\" href=\"https://ai.google.dev/palm_docs/chat_node_quickstart\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5353
" </td>\n",
5454
" <td>\n",
5555
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/palm_docs/chat_node_quickstart.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",

site/en/palm_docs/chat_quickstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"source": [
4949
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
5050
" <td>\n",
51-
" <a target=\"_blank\" href=\"https://ai.google.dev/palm_docs/chat_quickstart\"><img src=\"https://developers.generativeai.google/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
51+
" <a target=\"_blank\" href=\"https://ai.google.dev/palm_docs/chat_quickstart\"><img src=\"https://ai.google.dev/static/site-assets/images/docs/notebook-site-button.png\" height=\"32\" width=\"32\" />View on Generative AI</a>\n",
5252
" </td>\n",
5353
" <td>\n",
5454
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/palm_docs/chat_quickstart.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",

0 commit comments

Comments
 (0)