mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Fix incorrect wikipage summaries (#2169)
Creating a page using the title causes a wikipedia search with
autocomplete set to true. This frequently causes the summaries to be
unrelated to the actual page found.
See:
1554943e8a/wikipedia/wikipedia.py (L254-L280)
This commit is contained in:
parent
6be67279fb
commit
f83c36d8fd
@ -47,7 +47,7 @@ class WikipediaAPIWrapper(BaseModel):
|
|||||||
|
|
||||||
def fetch_formatted_page_summary(self, page: str) -> Optional[str]:
|
def fetch_formatted_page_summary(self, page: str) -> Optional[str]:
|
||||||
try:
|
try:
|
||||||
wiki_page = self.wiki_client.page(title=page)
|
wiki_page = self.wiki_client.page(pageid=page)
|
||||||
return f"Page: {page}\nSummary: {wiki_page.summary}"
|
return f"Page: {page}\nSummary: {wiki_page.summary}"
|
||||||
except (
|
except (
|
||||||
self.wiki_client.exceptions.PageError,
|
self.wiki_client.exceptions.PageError,
|
||||||
|
Loading…
Reference in New Issue
Block a user