This project demonstrates how to build an AI-powered Wikipedia research assistant using Google Gemini (via LangChain) and a custom Wikipedia search tool.
The agent can take any query, search Wikipedia for relevant information, and summarize the results into a concise, human-readable answer.
- Google Gemini Integration β Uses
gemini-1.5-flashfor fast and accurate text generation. - Wikipedia Search Tool β Retrieves summaries from Wikipedia using the
wikipediaPython library. - LangChain Agent β Automatically decides when and how to use the Wikipedia tool to answer your question.
- Interactive CLI β Enter any topic and get an instant summarized response.
This project uses Google Gemini API for natural language processing and Wikipedia API for retrieving topic summaries.
Before running the project, you need to set your API key in a .env file.
- Create a
.envfile in the project root directory. - Add your Gemini API key:
GEMINI_API_KEY=your_gemini_api_key_hereEnter a topic to research: MS Dhoni
Answer
MS Dhoni is a former Indian professional cricketer, widely regarded as one of the greatest ODI batsmen and captains.
He captained India in limited-overs formats from 2007 to 2017 and in Test cricket from 2008 to 2014.
He led India to victory in the 2007 ICC World Twenty20, the 2011 Cricket World Cup, and the 2013 ICC Champions Trophy.
To run the Wikipedia Search Agent with a Streamlit UI:
streamlit run Gagents.py