machinelibrary
Python client for Machine Library: search full text
across scholarly papers, books, patents, standards and Wikipedia (plus Reddit,
Telegram and Discord), read bounded full text, and find passages inside long
documents. Every result carries a canonical source_uri to cite.
Built for AI agents and RAG pipelines. Framework adapters:
langchain-machinelibrary,
llama-index-tools-machinelibrary.
Prefer MCP? Connect https://mcp.machinelibrary.ai — see
machinelibrary.ai/mcp.
Install
pip install machinelibrary
export MACHINELIBRARY_API_KEY=ml_... # https://machinelibrary.ai/keys
Use
from machinelibrary import MachineLibrary
ml = MachineLibrary()
hits = ml.search("solid-state battery dendrite growth", limit=5)
for hit in hits:
print(hit.title, hit.source_uri)
print(" ", hit.text)
# Find the passages that support a claim, without downloading the whole text.
for passage in ml.search_in_document(hits[0].source_uri, "critical current density"):
print(passage.text)
# Bounded full text (check `content_truncated`).
doc = ml.fetch_document("doi:10.1038/nature14539", max_tokens=8000)
AsyncMachineLibrary has the same methods as coroutines.
search(index="social") searches Reddit, Telegram and Discord. Dates for
issued_after / issued_before are Unix seconds. Identifiers accept DOIs
(doi:…, https://doi.org/…), pmid:, arxiv: and isbn: shorthands.
Billing and limits
Searches and document reads are charged per request to the account that owns
the key; see pricing. InsufficientCreditError
means the balance needs a top-up.
Results are evidence to review, not proof that a claim is correct, and coverage
is not exhaustive.
License
MIT
Metadata
Release files for machinelibrary 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| machinelibrary-0.1.0.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| machinelibrary-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 kB
Release files / machinelibrary-0.1.0.tar.gz
| Download URL | machinelibrary-0.1.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc11f6abc3c41d321a946cb4905a55659d21b669964cc10364b028d8c858b7bb
|
|
BLAKE2b-256 checksum How to use checksums |
8dc8dc0003d0e44808a65253539a10b67d732a85941e55b01e20be470a2bf89d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / machinelibrary-0.1.0-py3-none-any.whl
| Download URL | machinelibrary-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d4a074f84982eb9f9c156aee513384544775d75445d2bf675c6dbe44509224f
|
|
BLAKE2b-256 checksum How to use checksums |
be81a130a12e495ee97112c4cfad4ace1af83ed71f2e978064173df15ba17c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|