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.0a1.tar.gz (10.6 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.0a1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ovos_wikipedia_plugin-1.0.0a1.tar.gz
  • Upload date:
  • Size: 10.6 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.0a1.tar.gz
Algorithm Hash digest
SHA256 3a7f7c3582237f165b6a84660318da003922d324740fe094f9f8f79f68ef8dd9
MD5 33a965ca87f7511a88bd9ef03bfe0a87
BLAKE2b-256 b6df89a246d76bf192216319bcc402ab9bf3674134762d7568f64beff76a1957

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_wikipedia_plugin-1.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5bf5581aab31d1e020933c4a5a7d39215623098ca18c971342d73a4ac8d7510
MD5 9c8bc9d45b70fc926f4310a12f882cb1
BLAKE2b-256 11cd541faf9f8ac6285ed1dfb5251f85db1ff9c5c00b63da3fdc6ee40b70a9df

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