Skip to main content

A powerful Wikipedia QA system with LLM integration

Project description

🎯 WikiQA

A powerful Wikipedia Question Answering system with LLM integration. WikiQA allows you to extract information from Wikipedia articles using natural language questions and various extraction methods.

✨ Features

  • 🤖 Direct question answering about Wikipedia content
  • 🔍 Entity extraction from articles
  • 📝 Article summarization with customizable length and focus
  • ⏳ Timeline extraction from articles
  • 🔌 Support for multiple LLM providers (OpenAI, Anthropic, Together)

🚀 Installation

pip install wikiqa

🎮 Quick Start

from wikiqa import WikiQA

# Initialize with your preferred LLM provider
qa = WikiQA(
    llm_provider="together",  # or "openai" or "anthropic"
    api_key="your_api_key",
    model="your_model_name"  # optional, defaults to provider's best model
)

# Ask a question about a Wikipedia article
answer, page_url, revision_id = qa.ask(
    "What is the capital of France?",
    article="France"
)
print(f"Answer: {answer}")
print(f"Source: {page_url}")

# Extract specific information
birth_date, page_url, revision_id = qa.extract_entity(
    "Albert Einstein",
    "date of birth"
)
print(f"Birth date: {birth_date}")

# Get a summary
summary, page_url, revision_id = qa.summarize(
    article="Python (programming language)",
    length="paragraph"
)
print(f"Summary: {summary}")

# Extract a timeline
timeline, page_url, revision_id = qa.extract_timeline("World War II")
print(f"Timeline: {timeline.events}")

🤝 Supported LLM Providers

  • 🎨 OpenAI (GPT models)
  • 🧠 Anthropic (Claude models)
  • 🌟 Together (various open-source models)

📋 Requirements

  • 🐍 Python 3.8 or higher
  • 🌐 Internet connection for Wikipedia access
  • 🔑 API key for your chosen LLM provider

📄 License

MIT License

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

⭐ Star History

Star History Chart

📊 Stats

GitHub stars GitHub forks GitHub issues GitHub license Python Version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wikiqa-0.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wikiqa-0.1.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file wikiqa-0.1.1.tar.gz.

File metadata

  • Download URL: wikiqa-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for wikiqa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f73e2bf351e023cdb2616dd8c7f5b257a8e5b30fee341a45b3cd43cacb6286b
MD5 0df9ee22699a0d32127d061665906f85
BLAKE2b-256 4237c65b82971846be74a407ffcf9876e67e281f524e59bd4c1f925390be3cb0

See more details on using hashes here.

File details

Details for the file wikiqa-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wikiqa-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for wikiqa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef3543e557078f195ba38b6596ef666cb265b4974a0fde886d9a7f80a8570d24
MD5 a54af0d4845eb895629f01373ee22d27
BLAKE2b-256 0ae709be61e8cf23b791eef28ff5592abaf44268a404455bad5516e41c43e441

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page