Fix wikipedia summaries (#2187)

This upsteam wikipedia page loading seems to still have issues. Finding
a compromise solution where it does an exact match search and not a
search for the completion.

See previous PR: https://github.com/hwchase17/langchain/pull/2169
This commit is contained in:
Rui Ferreira 2023-03-30 15:34:13 +01:00 committed by GitHub
parent 35a3218e84
commit 5d86a6acf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,7 @@ class WikipediaAPIWrapper(BaseModel):
def fetch_formatted_page_summary(self, page: str) -> Optional[str]:
try:
wiki_page = self.wiki_client.page(pageid=page)
wiki_page = self.wiki_client.page(title=page, auto_suggest=False)
return f"Page: {page}\nSummary: {wiki_page.summary}"
except (
self.wiki_client.exceptions.PageError,