Skip to main content

OVOS Wikipedia plugin

Project description

ovos-wikipedia-plugin

PyPI License Python

Wikipedia integration for OpenVoiceOS. Provides a retrieval engine for RAG pipelines and an agent toolbox for tool-using agents, both as standard OPM plugins.


Installation

pip install ovos-wikipedia-plugin

OPM Entry Points

Entry point Class Use case
opm.agents.retrievalovos-wikipedia-plugin WikipediaRetrievalEngine Retrieval — returns ranked (passage, score) tuples
opm.agents.toolboxovos-wikipedia-tool WikipediaToolbox Agent tool use — exposes search_wikipedia

Retrieval Engine

WikipediaRetrievalEngine implements the RetrievalEngine OPM interface. It searches Wikipedia, fetches article summaries in parallel, scores them for relevance, and optionally applies extractive QA and reranking sub-plugins.

from ovos_wikipedia import WikipediaRetrievalEngine

engine = WikipediaRetrievalEngine()

# Returns List[WikipediaResult] sorted by relevance
for result in engine.search("Ada Lovelace", lang="en"):
    print(result.title, result.conf)
    print(result.summary)
    if result.image:
        print(result.image)

# RAG interface: List[Tuple[str, float]]  (passage, score)
passages = engine.query("who was Ada Lovelace", lang="en", k=3)

Optional sub-plugins

Config key OPM type Effect
extractive_qa opm.agents.extractive_qa Extract the best passage from each article summary
reranker opm.agents.reranker Re-score results with a cross-encoder
keyword_extractor opm.plugin.keywords Rewrite the query when the initial search returns nothing
engine = WikipediaRetrievalEngine(config={
    "extractive_qa": "ovos-bm25-solver",
    "reranker": "ovos-bm25-reranker",
    "keyword_extractor": "ovos-rake-keywords",
})

Agent Toolbox

WikipediaToolbox exposes a single search_wikipedia tool that any OPM-compatible agent loop ( e.g. ovos-agentic-loop) can discover and call.

Loading via entry point (recommended)

Any agent loop that supports opm.agents.toolbox entry points will auto-discover this toolbox by name:

{
  "name": "ResearchAgent",
  "solvers": [
    "ovos-react-loop"
  ],
  "ovos-react-loop": {
    "brain": "ovos-chat-openai-plugin",
    "ovos-chat-openai-plugin": {
      "api_url": "http://localhost:11434/v1/chat/completions"
    },
    "toolboxes": [
      "ovos-wikipedia-tool"
    ]
  }
}

Direct usage

from ovos_wikipedia import WikipediaToolbox, SearchWikipediaArgs

tb = WikipediaToolbox()

# Discover the tool (used internally by agent loops)
tools = tb.discover_tools()
# [AgentTool(name="search_wikipedia", description="Search Wikipedia for information about a topic...")]

# Call directly
output = tb.search_wikipedia(SearchWikipediaArgs(query="Ada Lovelace", lang="en"))
for title, summary in output.results:
    print(title)
    print(summary)

License

Apache 2.0 — see LICENSE.

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

ovos_wikipedia_plugin-1.0.0a2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

ovos_wikipedia_plugin-1.0.0a2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file ovos_wikipedia_plugin-1.0.0a2.tar.gz.

File metadata

  • Download URL: ovos_wikipedia_plugin-1.0.0a2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ovos_wikipedia_plugin-1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 e2475bbbcb7a9ec78b8ddcc1127ed908c119e52afb6cd3ab6b723d8a49c276e3
MD5 5b0ea7ebb91cae5ff2051a367d744f63
BLAKE2b-256 db5a97aed42ee948dc60544386126b8b272605d84b1b0a02df26b90ecbdfba75

See more details on using hashes here.

File details

Details for the file ovos_wikipedia_plugin-1.0.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_wikipedia_plugin-1.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a1ab4d9209a6bdd6f0392d7928ae06568aaa91ea9823e97f717215a60099871
MD5 faefbea9a9a66c9f7fbc15b3169f238a
BLAKE2b-256 df5d3e50e8cbdc4de9200b414c61f42069bc0163d65aa7a1dfd7fecba96cb29c

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