Skip to content

Commit 45928ff

Browse files
authored
Clarify wikipedia note in reranking guide (google#288)
* Clarify the note on the search re-ranking tutorial. When published it looks like it could be talking about our package, so I've reworded the note such that it is clear while keeping the references intact. * Minor tweaks
1 parent 826f1d1 commit 45928ff

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

site/en/docs/search_reranking_using_embeddings.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
"id": "739f0bb73f05"
161161
},
162162
"source": [
163-
"> Note: This library was designed for ease of use and simplicity, not for advanced use. If you plan on doing serious scraping or automated requests, please use [Pywikipediabot](http://www.mediawiki.org/wiki/Manual:Pywikipediabot) or one of the other more advanced [Python MediaWiki API wrappers](http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot#Python), which has a larger API, rate limiting, and other features so you can be considerate of the MediaWiki infrastructure."
163+
"Note: The [`wikipedia` package](https://pypi.org/project/wikipedia/) notes that it was \"designed for ease of use and simplicity, not for advanced use\", and that production or heavy use should instead \"use [Pywikipediabot](http://www.mediawiki.org/wiki/Manual:Pywikipediabot) or one of the other more advanced [Python MediaWiki API wrappers](http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot#Python)\"."
164164
]
165165
},
166166
{
@@ -189,8 +189,6 @@
189189
"import wikipedia\n",
190190
"from wikipedia.exceptions import DisambiguationError, PageError\n",
191191
"\n",
192-
"\n",
193-
"\n",
194192
"import numpy as np\n",
195193
"\n",
196194
"from IPython.display import Markdown\n",
@@ -323,12 +321,15 @@
323321
" for query in search_queries:\n",
324322
" print(f'Searching for \"{query}\"')\n",
325323
" search_terms = wikipedia.search(query)\n",
324+
"\n",
326325
" print(f\"Related search terms: {search_terms[:n_topics]}\")\n",
327326
" for search_term in search_terms[:n_topics]: # select first `n_topics` candidates\n",
328327
" if search_term in search_history: # check if the topic is already covered\n",
329328
" continue\n",
329+
"\n",
330330
" print(f'Fetching page: \"{search_term}\"')\n",
331331
" search_history.add(search_term) # add to search history\n",
332+
"\n",
332333
" try:\n",
333334
" # extract the relevant data by using `gemini-pro` model\n",
334335
" page = wikipedia.page(search_term, auto_suggest=False)\n",
@@ -345,6 +346,7 @@
345346
"\n",
346347
" Note: Do not summarize. Only Extract and return the relevant information\n",
347348
" \"\"\"))\n",
349+
"\n",
348350
" urls = [url]\n",
349351
" if response.candidates[0].citation_metadata:\n",
350352
" extra_citations = response.candidates[0].citation_metadata.citation_sources\n",
@@ -724,7 +726,9 @@
724726
"outputs": [
725727
{
726728
"data": {
727-
"text/plain": []
729+
"text/plain": [
730+
"'No citations found'"
731+
]
728732
},
729733
"execution_count": 49,
730734
"metadata": {},
@@ -1092,7 +1096,7 @@
10921096
"id": "tip8ArqJf_ep"
10931097
},
10941098
"source": [
1095-
"Please refer to the [embeddings_guide](https://ai.google.dev/docs/embeddings_guide) for more information on embeddings."
1099+
"Please refer to the [embeddings guide](https://ai.google.dev/docs/embeddings_guide) for more information on embeddings."
10961100
]
10971101
},
10981102
{

0 commit comments

Comments
 (0)