An intelligent Wikipedia assistant that allows users to chat with Wikipedia articles using natural language questions.
- Interactive chat interface for querying Wikipedia articles
- Support for any Wikipedia article via URL input
- Multiple chat sessions for different articles
- Semantic search using vector embeddings
- Conversational memory to maintain context in discussions
- Clean and intuitive user interface
- Enter a Wikipedia article URL in the input field
- The application extracts and processes the article content
- Ask questions about the article in natural language
- Get accurate answers based on the article content
- Create multiple chat sessions to explore different articles
This application uses:
- Streamlit: For the web interface
- LangChain: For conversational retrieval chain
- FAISS: For efficient vector storage and similarity search
- OpenAI Embeddings: To convert text into vector representations
- BeautifulSoup: For web scraping Wikipedia articles
- Pickle: For storing and retrieving vector databases
- Python 3.7+
- OpenAI API key
- Required Python packages:
- streamlit
- streamlit-extras
- langchain
- openai
- faiss-cpu
- beautifulsoup4
- requests
- python-dotenv
- pillow
- wikipedia-api
-
Clone the repository:
git clone https://github.com/Prince-Choudhury/WikipediaURL-Chatbot-QnA.git cd WikipediaURL-Chatbot-QnA -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install the required packages:
pip install -r requirements.txt -
Create a
.envfile in the project root and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here
- Make sure you have the
logo.pngfile in the project directory - Run the Streamlit app:
streamlit run app.py - Open your browser and navigate to the URL displayed in the terminal (typically http://localhost:8501)
- Enter a Wikipedia article URL in the input field
- Start asking questions about the article
app.py: Main application file containing the Streamlit interface and Wikipedia QnA functionalitylogo.png: Logo image for the application.env: Environment file for storing API keys (not included in repository)*.pkl: Generated vector stores for each Wikipedia article (created at runtime)
- Enter a Wikipedia URL: Paste a full Wikipedia article URL in the input field
- Ask Questions: Type your questions in the chat input at the bottom
- Create New Chats: Click the "New Chat" button in the sidebar to start a fresh conversation
- Switch Between Chats: Click on any previous chat session in the sidebar to continue that conversation
- The first time you load an article, it may take a few moments to process and create the vector store
- Subsequent queries to the same article will be faster as the vector store is saved locally
- For very large articles, processing time may be longer
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by Prince Choudhury