Metadata-Version: 2.5
Name: wikivectors
Version: 0.4.0
Summary: Fresh English Wikipedia for AI apps: search, answers, pages, facts and a change feed. LangChain and LlamaIndex retrievers included.
Project-URL: Homepage, https://wikivectors.com
Project-URL: Documentation, https://wikivectors.com/docs
Author: WikiVectors
License-Expression: MIT
License-File: LICENSE
Keywords: grounding,langchain,llamaindex,llm,rag,retrieval,search,wikipedia
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.12; extra == 'llamaindex'
Description-Content-Type: text/markdown

# wikivectors

Fresh English Wikipedia for AI apps. Ask in plain English and get the right paragraphs, each with its link and revision, updated within the hour. Also short cited answers, whole pages, infobox facts and a change feed.

Free key (1,000 searches a month): https://wikivectors.com/account · Docs: https://wikivectors.com/docs

```bash
pip install wikivectors
export WIKIVECTORS_KEY=wv_live_...
```

## Search

```python
from wikivectors import WikiVectors

wv = WikiVectors()  # reads WIKIVECTORS_KEY
for p in wv.search("who won the 2026 FIFA World Cup", limit=3):
    print(p["title"], p["permalink"])
    print(p["text"])
```

## Everything else

```python
wv.answer("who won the 2026 FIFA World Cup")       # short answer + sources, or answered=False
wv.pages(["Ada Lovelace", "Alan Turing"])            # whole pages
wv.facts("Ada Lovelace")                             # infobox as JSON: born, died, known for...
wv.identify("Michael Jordan", hint="professor, machine learning")
wv.similar("Ada Lovelace", limit=5)                 # pages most like this one
wv.titles(prefix="2025 in ")
wv.changes(pages=["Ada Lovelace"])                   # recent edits; pass next_after back as after=
wv.watch(page="Ada Lovelace", callback_url="https://example.com/hook")
```

## Let your app or AI get its own key

No key yet? Ask for one by email. The person gets a code and an Approve button; the key comes back once they click it.

```python
from wikivectors import WikiVectors, request_key

key = request_key("ada@example.com", "My Notebook")   # prints the code, waits up to 15 min
wv = WikiVectors(api_key=key)
```

Errors raise `WikiVectorsError` with `.status`, `.code`, `.message` and `.request_id`.

## LangChain

```bash
pip install "wikivectors[langchain]"
```

```python
from wikivectors.langchain import WikiVectorsRetriever

retriever = WikiVectorsRetriever(k=3)
for doc in retriever.invoke("who won the 2026 FIFA World Cup"):
    print(doc.metadata["title"], doc.metadata["permalink"])
```

## LlamaIndex

```bash
pip install "wikivectors[llamaindex]"
```

```python
from wikivectors.llamaindex import WikiVectorsRetriever

for n in WikiVectorsRetriever(k=3).retrieve("who won the 2026 FIFA World Cup"):
    print(n.node.metadata["title"], n.node.metadata["permalink"])
```

## License

The client is MIT. Wikipedia text is CC BY-SA 4.0: show the `attribution` line, or at least the link, wherever you show the text.
