Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ovos-wikipedia-plugin

PyPI License Python

This plugin connects OpenVoiceOS to Wikipedia. It provides a retrieval engine for RAG pipelines and an agent toolbox for tool-using agents. Both ship as standard OPM plugins.


Installation

pip install ovos-wikipedia-plugin

OPM Entry Points

Entry point Class Use case
opm.agents.retrieval (ovos-wikipedia-plugin) WikipediaRetrievalEngine Retrieval. Returns ranked (passage, score) tuples
opm.agents.toolbox (ovos-wikipedia-tools) WikipediaToolbox Agent tool use. Exposes search_wikipedia

Retrieval Engine

WikipediaRetrievalEngine implements the RetrievalEngine OPM interface. It searches Wikipedia, fetches article summaries in parallel, and scores them for relevance. It can also apply 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. Any OPM-compatible agent loop, such as ovos-agentic-loop, can discover and call it.

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-tools"
    ]
  }
}

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)


Docker

This repo publishes ghcr.io/openvoiceos/ovos-wikipedia-plugin, a standalone ovos-persona-server that serves one persona, WikiBot, backed by the WikipediaRetrievalEngine in this plugin. Wikipedia's public API needs no key, so the image works with no configuration at all.

docker run -p 8390:8337 ghcr.io/openvoiceos/ovos-wikipedia-plugin:dev
curl http://localhost:8390/v1/models
curl http://localhost:8390/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{"model": "WikiBot", "messages": [{"role": "user", "content": "what is the capital of Portugal?"}]}'

Known issue as of ovos-persona 0.9.0a9 through 0.9.0a16 (the latest published alpha): Persona.chat passes sess.lang and sess.system_unit into chat_completion in the wrong order, so the retrieval engine receives the unit string ("metric") where it expects a language code, and the request above answers 500 Internal Server Error with Persona chat failed: 'NoneType' object has no attribute 'split'. This is a bug in ovos-persona itself, not in this plugin or this image -- calling WikipediaRetrievalEngine().query(...) directly returns a correct answer. It will clear up once a fixed ovos-persona is published; there is nothing to configure around it from this image.

A compose snippet:

services:
  ovos-wikipedia-persona:
    image: ghcr.io/openvoiceos/ovos-wikipedia-plugin:dev
    ports:
      - "8390:8337"
    restart: unless-stopped

The image builds on every pull request touching Dockerfile, .dockerignore, pyproject.toml, or the docker workflow itself (build only, no push), and publishes on pushes to master (latest), dev (dev), and version tags. See the docker workflow.

License

Apache 2.0. See LICENSE.

Metadata

Release files for ovos-wikipedia-plugin 1.1.2a5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ovos-wikipedia-plugin 1.1.2a5
File Size Uploaded Provenance Actions
ovos_wikipedia_plugin-1.1.2a5.tar.gz 9.3 kB Without provenance Details for ovos_wikipedia_plugin-1.1.2a5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ovos-wikipedia-plugin 1.1.2a5
File Interpreter ABI Platform Actions
ovos_wikipedia_plugin-1.1.2a5-py3-none-any.whl Python 3 none any Details for ovos_wikipedia_plugin-1.1.2a5-py3-none-any.whl

Total release size: 18.9 kB

Release files / ovos_wikipedia_plugin-1.1.2a5.tar.gz

Download URL ovos_wikipedia_plugin-1.1.2a5.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dc623100ed68dd95c80f097a9595d6be5e737d501938a614c5e93f166b58f6cb
BLAKE2b-256 checksum
How to use checksums
4d0a3a3d690ede51a7d9b39166ae988db4b2c6afd426b27b9fd3900039dc74ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ovos_wikipedia_plugin-1.1.2a5-py3-none-any.whl

Download URL ovos_wikipedia_plugin-1.1.2a5-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
476a34ebe6006045df604f9c543307c71544dfacf2f08c92f099f90c2b2d8c2c
BLAKE2b-256 checksum
How to use checksums
ad0ccc036deddc08609963edd76b0ea69bee796c48080493f1c5e4ef8ff3e7ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ovos-wikipedia-plugin 1.1.2a5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page