realtime-qa / llm /utils /wiki_client.py
mohit-raghavendra's picture
Upload 25 files
3060e5b verified
raw
history blame contribute delete
489 Bytes
import wikipediaapi
class WikiClient:
def __init__(self):
self.wiki = wikipediaapi.Wikipedia(
user_agent="WikiAgent/0.0 [email protected]",
language="en",
extract_format=wikipediaapi.ExtractFormat.WIKI,
)
def get_pages(self, query):
pages = self.wiki.page(query)
return pages
if __name__ == "__main__":
client = WikiClient()
pages = client.get_pages("Cricket World Cup")
print(pages.summary)